Commit 92eba04e authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent cdcfcac9
...@@ -101,31 +101,30 @@ struct rsnd_ssiu { ...@@ -101,31 +101,30 @@ struct rsnd_ssiu {
#define rsnd_ssi_to_ssiu(ssi)\ #define rsnd_ssi_to_ssiu(ssi)\
(((struct rsnd_ssiu *)((ssi) - rsnd_mod_id(&(ssi)->mod))) - 1) (((struct rsnd_ssiu *)((ssi) - rsnd_mod_id(&(ssi)->mod))) - 1)
static void rsnd_ssi_mode_init(struct rsnd_priv *priv, static void rsnd_ssi_mode_set(struct rsnd_priv *priv,
struct rsnd_ssiu *ssiu) struct rsnd_dai *rdai,
struct rsnd_ssi *ssi)
{ {
struct device *dev = rsnd_priv_to_dev(priv); struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_ssi *ssi;
struct rsnd_mod *scu; struct rsnd_mod *scu;
struct rsnd_ssiu *ssiu = rsnd_ssi_to_ssiu(ssi);
int id = rsnd_mod_id(&ssi->mod);
u32 flags; u32 flags;
u32 val; u32 val;
int i;
scu = rsnd_scu_mod_get(priv, rsnd_mod_id(&ssi->mod));
/* /*
* SSI_MODE0 * SSI_MODE0
*/ */
ssiu->ssi_mode0 = 0;
for_each_rsnd_ssi(ssi, priv, i) { /* see also BUSIF_MODE */
flags = rsnd_ssi_mode_flags(ssi); if (rsnd_scu_hpbif_is_enable(scu)) {
scu = rsnd_scu_mod_get(priv, rsnd_mod_id(&ssi->mod)); ssiu->ssi_mode0 &= ~(1 << id);
dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", id);
/* see also BUSIF_MODE */ } else {
if (rsnd_scu_hpbif_is_enable(scu)) { ssiu->ssi_mode0 |= (1 << id);
dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", i); dev_dbg(dev, "SSI%d uses INDEPENDENT mode\n", id);
} else {
ssiu->ssi_mode0 |= (1 << i);
dev_dbg(dev, "SSI%d uses INDEPENDENT mode\n", i);
}
} }
/* /*
...@@ -134,7 +133,7 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv, ...@@ -134,7 +133,7 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
#define ssi_parent_set(p, sync, adg, ext) \ #define ssi_parent_set(p, sync, adg, ext) \
do { \ do { \
ssi->parent = ssiu->ssi + p; \ ssi->parent = ssiu->ssi + p; \
if (flags & RSND_SSI_CLK_FROM_ADG) \ if (rsnd_rdai_is_clk_master(rdai)) \
val = adg; \ val = adg; \
else \ else \
val = ext; \ val = ext; \
...@@ -142,15 +141,11 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv, ...@@ -142,15 +141,11 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
val |= sync; \ val |= sync; \
} while (0) } while (0)
ssiu->ssi_mode1 = 0; flags = rsnd_ssi_mode_flags(ssi);
for_each_rsnd_ssi(ssi, priv, i) { if (flags & RSND_SSI_CLK_PIN_SHARE) {
flags = rsnd_ssi_mode_flags(ssi);
if (!(flags & RSND_SSI_CLK_PIN_SHARE))
continue;
val = 0; val = 0;
switch (i) { switch (id) {
case 1: case 1:
ssi_parent_set(0, (1 << 4), (0x2 << 0), (0x1 << 0)); ssi_parent_set(0, (1 << 4), (0x2 << 0), (0x1 << 0));
break; break;
...@@ -167,11 +162,6 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv, ...@@ -167,11 +162,6 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
ssiu->ssi_mode1 |= val; 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_MODE0, ssiu->ssi_mode0);
rsnd_mod_write(&ssi->mod, SSI_MODE1, ssiu->ssi_mode1); rsnd_mod_write(&ssi->mod, SSI_MODE1, ssiu->ssi_mode1);
...@@ -381,7 +371,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, ...@@ -381,7 +371,7 @@ static int rsnd_ssi_init(struct rsnd_mod *mod,
ssi->cr_own = cr; ssi->cr_own = cr;
ssi->err = -1; /* ignore 1st error */ 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)); 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, ...@@ -708,8 +698,6 @@ int rsnd_ssi_probe(struct platform_device *pdev,
rsnd_mod_init(priv, &ssi->mod, ops, i); rsnd_mod_init(priv, &ssi->mod, ops, i);
} }
rsnd_ssi_mode_init(priv, ssiu);
dev_dbg(dev, "ssi probed\n"); dev_dbg(dev, "ssi probed\n");
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment