ASoC: rcar: remove RSND_SSI_CLK_FROM_ADG

R-Car sound has clock pin for each SSI, and sometimes,
these pins are shared with paired SSI.
It may sometimes become "SSI-A clock pin is master" and
"SSI-B clock pin is slave", but "SSI-A/B clock pins are shared".
SSI-B needs SSI-A clock in this case.

Current R-Car sound driver is using RSND_SSI_xxx flag
to control this kind of shared pin behavior.

But, this information, especially clock master setting,
can be got from ASoC set_fmt settings.
This patch removes rsnd_ssi_mode_init() and extend rsnd_ssi_mode_set()
to controlling pin settings via .set_fmt.

This patch doesn't removes RSND_SSI_CLK_FROM_ADG flag at this point
to avoid conflict branch merging between ASoC <-> SH-ARM.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
This commit is contained in:
Kuninori Morimoto 2013-10-17 22:51:40 -07:00 committed by Mark Brown
parent cdcfcac968
commit 92eba04e4b

View File

@ -101,31 +101,30 @@ struct rsnd_ssiu {
#define rsnd_ssi_to_ssiu(ssi)\
(((struct rsnd_ssiu *)((ssi) - rsnd_mod_id(&(ssi)->mod))) - 1)
static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
struct rsnd_ssiu *ssiu)
static void rsnd_ssi_mode_set(struct rsnd_priv *priv,
struct rsnd_dai *rdai,
struct rsnd_ssi *ssi)
{
struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_ssi *ssi;
struct rsnd_mod *scu;
struct rsnd_ssiu *ssiu = rsnd_ssi_to_ssiu(ssi);
int id = rsnd_mod_id(&ssi->mod);
u32 flags;
u32 val;
int i;
scu = rsnd_scu_mod_get(priv, rsnd_mod_id(&ssi->mod));
/*
* SSI_MODE0
*/
ssiu->ssi_mode0 = 0;
for_each_rsnd_ssi(ssi, priv, i) {
flags = rsnd_ssi_mode_flags(ssi);
scu = rsnd_scu_mod_get(priv, rsnd_mod_id(&ssi->mod));
/* see also BUSIF_MODE */
if (rsnd_scu_hpbif_is_enable(scu)) {
dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", i);
ssiu->ssi_mode0 &= ~(1 << id);
dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", id);
} else {
ssiu->ssi_mode0 |= (1 << i);
dev_dbg(dev, "SSI%d uses INDEPENDENT mode\n", i);
}
ssiu->ssi_mode0 |= (1 << id);
dev_dbg(dev, "SSI%d uses INDEPENDENT mode\n", id);
}
/*
@ -134,7 +133,7 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
#define ssi_parent_set(p, sync, adg, ext) \
do { \
ssi->parent = ssiu->ssi + p; \
if (flags & RSND_SSI_CLK_FROM_ADG) \
if (rsnd_rdai_is_clk_master(rdai)) \
val = adg; \
else \
val = ext; \
@ -142,15 +141,11 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
val |= sync; \
} while (0)
ssiu->ssi_mode1 = 0;
for_each_rsnd_ssi(ssi, priv, i) {
flags = rsnd_ssi_mode_flags(ssi);
if (!(flags & RSND_SSI_CLK_PIN_SHARE))
continue;
if (flags & RSND_SSI_CLK_PIN_SHARE) {
val = 0;
switch (i) {
switch (id) {
case 1:
ssi_parent_set(0, (1 << 4), (0x2 << 0), (0x1 << 0));
break;
@ -167,11 +162,6 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
ssiu->ssi_mode1 |= val;
}
}
static void rsnd_ssi_mode_set(struct rsnd_ssi *ssi)
{
struct rsnd_ssiu *ssiu = rsnd_ssi_to_ssiu(ssi);
rsnd_mod_write(&ssi->mod, SSI_MODE0, ssiu->ssi_mode0);
rsnd_mod_write(&ssi->mod, SSI_MODE1, ssiu->ssi_mode1);
@ -381,7 +371,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
ssi->cr_own = cr;
ssi->err = -1; /* ignore 1st error */
rsnd_ssi_mode_set(ssi);
rsnd_ssi_mode_set(priv, rdai, ssi);
dev_dbg(dev, "%s.%d init\n", rsnd_mod_name(mod), rsnd_mod_id(mod));
@ -708,8 +698,6 @@ int rsnd_ssi_probe(struct platform_device *pdev,
rsnd_mod_init(priv, &ssi->mod, ops, i);
}
rsnd_ssi_mode_init(priv, ssiu);
dev_dbg(dev, "ssi probed\n");
return 0;