* [PATCH 0/2] ASoC: rcar: remove un-needed flags
@ 2013-10-18 5:50 Kuninori Morimoto
2013-10-18 5:50 ` [PATCH 1/2] ASoC: rcar: add rsnd_scu_hpbif_is_enable() Kuninori Morimoto
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2013-10-18 5:50 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto
Hi Mark
These 2 patches remove un-needed flags.
These are prepare patches for DT support
Kuninori Morimoto (2):
ASoC: rcar: add rsnd_scu_hpbif_is_enable()
ASoC: rcar: remove RSND_SSI_CLK_FROM_ADG
include/sound/rcar_snd.h | 1 -
sound/soc/sh/rcar/rsnd.h | 1 +
sound/soc/sh/rcar/scu.c | 12 ++++++++---
sound/soc/sh/rcar/ssi.c | 52 +++++++++++++++++++---------------------------
4 files changed, 31 insertions(+), 35 deletions(-)
Best regards
---
Kuninori Morimoto
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] ASoC: rcar: add rsnd_scu_hpbif_is_enable()
2013-10-18 5:50 [PATCH 0/2] ASoC: rcar: remove un-needed flags Kuninori Morimoto
@ 2013-10-18 5:50 ` Kuninori Morimoto
2013-10-18 5:51 ` [PATCH 2/2] ASoC: rcar: remove RSND_SSI_CLK_FROM_ADG Kuninori Morimoto
2013-10-20 16:28 ` [PATCH 0/2] ASoC: rcar: remove un-needed flags Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2013-10-18 5:50 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto
Current SSI needs RSND_SSI_DEPENDENT flag to
decide dependent/independent mode.
And SCU needs RSND_SCU_USE_HPBIF flag
to decide HPBIF is enable/disable.
But these 2 means same things.
This patch adds new rsnd_scu_hpbif_is_enable()
function, and merges above methods.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
include/sound/rcar_snd.h | 1 -
sound/soc/sh/rcar/rsnd.h | 1 +
sound/soc/sh/rcar/scu.c | 12 +++++++++---
sound/soc/sh/rcar/ssi.c | 8 +++++---
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/include/sound/rcar_snd.h b/include/sound/rcar_snd.h
index fe66533..6b4211c 100644
--- a/include/sound/rcar_snd.h
+++ b/include/sound/rcar_snd.h
@@ -36,7 +36,6 @@
#define RSND_SSI_CLK_PIN_SHARE (1 << 31)
#define RSND_SSI_CLK_FROM_ADG (1 << 30) /* clock parent is master */
#define RSND_SSI_SYNC (1 << 29) /* SSI34_sync etc */
-#define RSND_SSI_DEPENDENT (1 << 28) /* SSI needs SRU/SCU */
#define RSND_SSI_PLAY (1 << 24)
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 3868aaf..5feb67c 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -281,6 +281,7 @@ int rsnd_scu_probe(struct platform_device *pdev,
void rsnd_scu_remove(struct platform_device *pdev,
struct rsnd_priv *priv);
struct rsnd_mod *rsnd_scu_mod_get(struct rsnd_priv *priv, int id);
+bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod);
#define rsnd_scu_nr(priv) ((priv)->scu_nr)
/*
diff --git a/sound/soc/sh/rcar/scu.c b/sound/soc/sh/rcar/scu.c
index 2df2e91..1ab1bce 100644
--- a/sound/soc/sh/rcar/scu.c
+++ b/sound/soc/sh/rcar/scu.c
@@ -146,20 +146,26 @@ static int rsnd_scu_set_hpbif(struct rsnd_priv *priv,
return 0;
}
+bool rsnd_scu_hpbif_is_enable(struct rsnd_mod *mod)
+{
+ struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
+ u32 flags = rsnd_scu_mode_flags(scu);
+
+ return !!(flags & RSND_SCU_USE_HPBIF);
+}
+
static int rsnd_scu_start(struct rsnd_mod *mod,
struct rsnd_dai *rdai,
struct rsnd_dai_stream *io)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
- struct rsnd_scu *scu = rsnd_mod_to_scu(mod);
struct device *dev = rsnd_priv_to_dev(priv);
- u32 flags = rsnd_scu_mode_flags(scu);
int ret;
/*
* SCU will be used if it has RSND_SCU_USE_HPBIF flags
*/
- if (!(flags & RSND_SCU_USE_HPBIF)) {
+ if (!rsnd_scu_hpbif_is_enable(mod)) {
/* it use PIO transter */
dev_dbg(dev, "%s%d is not used\n",
rsnd_mod_name(mod), rsnd_mod_id(mod));
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index fae26d3..7613256c 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -106,6 +106,7 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
{
struct device *dev = rsnd_priv_to_dev(priv);
struct rsnd_ssi *ssi;
+ struct rsnd_mod *scu;
u32 flags;
u32 val;
int i;
@@ -116,13 +117,14 @@ static void rsnd_ssi_mode_init(struct rsnd_priv *priv,
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 (!(flags & RSND_SSI_DEPENDENT)) {
+ if (rsnd_scu_hpbif_is_enable(scu)) {
+ dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", i);
+ } else {
ssiu->ssi_mode0 |= (1 << i);
dev_dbg(dev, "SSI%d uses INDEPENDENT mode\n", i);
- } else {
- dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", i);
}
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] ASoC: rcar: remove RSND_SSI_CLK_FROM_ADG
2013-10-18 5:50 [PATCH 0/2] ASoC: rcar: remove un-needed flags Kuninori Morimoto
2013-10-18 5:50 ` [PATCH 1/2] ASoC: rcar: add rsnd_scu_hpbif_is_enable() Kuninori Morimoto
@ 2013-10-18 5:51 ` Kuninori Morimoto
2013-10-20 16:28 ` [PATCH 0/2] ASoC: rcar: remove un-needed flags Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Kuninori Morimoto @ 2013-10-18 5:51 UTC (permalink / raw)
To: Mark Brown; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto
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>
---
sound/soc/sh/rcar/ssi.c | 52 ++++++++++++++++++-----------------------------
1 file changed, 20 insertions(+), 32 deletions(-)
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 7613256c..b71cf9d 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -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);
- } else {
- ssiu->ssi_mode0 |= (1 << i);
- dev_dbg(dev, "SSI%d uses INDEPENDENT mode\n", i);
- }
+
+ /* see also BUSIF_MODE */
+ if (rsnd_scu_hpbif_is_enable(scu)) {
+ ssiu->ssi_mode0 &= ~(1 << id);
+ dev_dbg(dev, "SSI%d uses DEPENDENT mode\n", id);
+ } else {
+ 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;
+ flags = rsnd_ssi_mode_flags(ssi);
+ 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;
--
1.7.9.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] ASoC: rcar: remove un-needed flags
2013-10-18 5:50 [PATCH 0/2] ASoC: rcar: remove un-needed flags Kuninori Morimoto
2013-10-18 5:50 ` [PATCH 1/2] ASoC: rcar: add rsnd_scu_hpbif_is_enable() Kuninori Morimoto
2013-10-18 5:51 ` [PATCH 2/2] ASoC: rcar: remove RSND_SSI_CLK_FROM_ADG Kuninori Morimoto
@ 2013-10-20 16:28 ` Mark Brown
2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2013-10-20 16:28 UTC (permalink / raw)
To: Kuninori Morimoto; +Cc: Linux-ALSA, Simon, Liam Girdwood, Kuninori Morimoto
[-- Attachment #1.1: Type: text/plain, Size: 199 bytes --]
On Thu, Oct 17, 2013 at 10:50:18PM -0700, Kuninori Morimoto wrote:
>
> Hi Mark
>
> These 2 patches remove un-needed flags.
> These are prepare patches for DT support
Applied both, thanks.
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-20 16:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-18 5:50 [PATCH 0/2] ASoC: rcar: remove un-needed flags Kuninori Morimoto
2013-10-18 5:50 ` [PATCH 1/2] ASoC: rcar: add rsnd_scu_hpbif_is_enable() Kuninori Morimoto
2013-10-18 5:51 ` [PATCH 2/2] ASoC: rcar: remove RSND_SSI_CLK_FROM_ADG Kuninori Morimoto
2013-10-20 16:28 ` [PATCH 0/2] ASoC: rcar: remove un-needed flags Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).