All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card
@ 2016-05-20  9:36 ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

Hi Mark

These are very big patch-set, but basically just cleanup for
simple-card driver.
Now, we have simple-card driver, but it is not simple today.
I would like to cleanup this.

And Renesas already have rsrc-card driver which is supporting DPCM,
and it is based on simple-card. This measn rsrc-card and simple-card
are very similar.
Thus, I would like to share these code between rsrc-card and simple-card.

This rsrc-card is only used from Renesas (actually, there is no upstream user,
current user is only me, by local). But this is not Renesas special driver,
I can say it is DPCM version of simple-card.
I would like to open it for all of ALSA people.
But, not merge simple-card <-> rsrc-card, to avoid diffcult future maintenance.
Thus, rsrc-card will be simple-dpcm-audio-card, and we can maintenance both
simple-card, and simple-dpcm-card. I'm not sure this is good nameing.

And finally, we will need HDMI sound support which uses graph base probing.
I know it needs more discussion with V4L2 people.
But in my understanding, basically, we can reuse simple-card base feature/function
on graph base driver somehow.
I would like to standardize simple card style, and use/share it with graph driver too.
It will be simple-graph-card ? I'm not sure. But I think we can share same code,
and can avoid development from 0.

These patch are for it.
Basically, it pickups common function/feature from simple-card and rsrc-card,
and standardize each feature/parse/init etc in simple-card-core.
Because of this patch-set, "simple-card" become "simple" again :)

I tested these (simple-card, rsrc-card) on my lager, Salvator boards.
But I couldn't test some feature. I hope test it on many environment.

 1) -  4) cleanup for these patch-set
 5) - 19) pickuped common function/feature and put it to simple-card-core
20) - 32) use simple-card-core on simple-card
33) - 46) use simple-card-core on rsrc-card
47) - 49) rename rsrc-card to simple-dpcm-audio-card

Kuninori Morimoto (49):
       1) ASoC: simple-card: remove duplicate header
       2) ASoC: rsrc-card: remove duplicate header
       3) ASoC: rsrc-card: remove unused dai_num
       4) ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()
       5) ASoC: add new simple-card-core.c
       6) ASoC: simple-card-core: add asoc_simple_card_parse_tdm()
       7) ASoC: simple-card-core: add asoc_simple_card_parse_dailink_name()
       8) ASoC: simple-card-core: add asoc_simple_card_parse_card_name()
       9) ASoC: simple-card-core: add asoc_simple_card_parse_card_prefix()
      10) ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
      11) ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
      12) ASoC: simple-card-core: add asoc_simple_card_parse_clk()
      13) ASoC: simple-card-core: add asoc_simple_card_parse_endpoint()
      14) ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()
      15) ASoC: simple-card-core: add asoc_simple_card_init_jack()
      16) ASoC: simple-card-core: add asoc_simple_card_init_dai()
      17) ASoC: simple-card-core: add asoc_simple_card_canonicalize_dailink()
      18) ASoC: simple-card-core: add asoc_simple_card_canonicalize_cpu()
      19) ASoC: simple-card-core: add asoc_simple_card_clean_reference()
      20) ASoC: simple-card: use asoc_simple_card_parse_daifmt()
      21) ASoC: simple-card: use asoc_simple_card_parse_clk()
      22) ASoC: simple-card: use asoc_simple_card_parse_endpoint()
      23) ASoC: simple-card: use asoc_simple_card_parse_tdm()
      24) ASoC: simple-card: use asoc_simple_card_parse_card_name()
      25) ASoC: simple-card: use asoc_simple_card_parse_card_route()
      26) ASoC: simple-card: use asoc_simple_card_parse_card_widgets()
      27) ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
      28) ASoC: simple-card: use asoc_simple_card_init_jack()
      29) ASoC: simple-card: use asoc_simple_card_init_dai()
      30) ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
      31) ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()
      32) ASoC: simple-card: use asoc_simple_card_clean_reference()
      33) ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
      34) ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()
      35) ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai
      36) ASoC: rsrc-card: use asoc_simple_card_parse_clk()
      37) ASoC: rsrc-card: use asoc_simple_card_parse_endpoint()
      38) ASoC: rsrc-card: use asoc_simple_card_parse_card_name()
      39) ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix()
      40) ASoC: rsrc-card: use asoc_simple_card_parse_dpcm()
      41) ASoC: rsrc-card: use asoc_simple_card_parse_card_route()
      42) ASoC: rsrc-card: use asoc_simple_card_parse_tdm()
      43) ASoC: rsrc-card: use asoc_simple_card_init_dai()
      44) ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu()
      45) ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
      46) ASoC: rsrc-card: use asoc_simple_card_clean_reference()
      47) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1
      48) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
      49) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3

 Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt |  75 --------------
 Documentation/devicetree/bindings/sound/simple-dpcm-card.txt  |  79 +++++++++++++++
 include/sound/simple_card.h                                   |  11 +--
 include/sound/simple_card_core.h                              | 106 ++++++++++++++++++++
 sound/soc/generic/Kconfig                                     |  10 ++
 sound/soc/generic/Makefile                                    |   4 +
 sound/soc/generic/simple-card-core.c                          | 409 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/generic/simple-card.c                               | 359 ++++++++++++------------------------------------------------------
 sound/soc/generic/simple-dpcm-card.c                          | 330 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/sh/Kconfig                                          |   5 -
 sound/soc/sh/rcar/Makefile                                    |   3 -
 sound/soc/sh/rcar/rsrc-card.c                                 | 529 --------------------------------------------------------------------------------------------------
 12 files changed, 999 insertions(+), 921 deletions(-)

^ permalink raw reply	[flat|nested] 139+ messages in thread

* [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card
@ 2016-05-20  9:36 ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

Hi Mark

These are very big patch-set, but basically just cleanup for
simple-card driver.
Now, we have simple-card driver, but it is not simple today.
I would like to cleanup this.

And Renesas already have rsrc-card driver which is supporting DPCM,
and it is based on simple-card. This measn rsrc-card and simple-card
are very similar.
Thus, I would like to share these code between rsrc-card and simple-card.

This rsrc-card is only used from Renesas (actually, there is no upstream user,
current user is only me, by local). But this is not Renesas special driver,
I can say it is DPCM version of simple-card.
I would like to open it for all of ALSA people.
But, not merge simple-card <-> rsrc-card, to avoid diffcult future maintenance.
Thus, rsrc-card will be simple-dpcm-audio-card, and we can maintenance both
simple-card, and simple-dpcm-card. I'm not sure this is good nameing.

And finally, we will need HDMI sound support which uses graph base probing.
I know it needs more discussion with V4L2 people.
But in my understanding, basically, we can reuse simple-card base feature/function
on graph base driver somehow.
I would like to standardize simple card style, and use/share it with graph driver too.
It will be simple-graph-card ? I'm not sure. But I think we can share same code,
and can avoid development from 0.

These patch are for it.
Basically, it pickups common function/feature from simple-card and rsrc-card,
and standardize each feature/parse/init etc in simple-card-core.
Because of this patch-set, "simple-card" become "simple" again :)

I tested these (simple-card, rsrc-card) on my lager, Salvator boards.
But I couldn't test some feature. I hope test it on many environment.

 1) -  4) cleanup for these patch-set
 5) - 19) pickuped common function/feature and put it to simple-card-core
20) - 32) use simple-card-core on simple-card
33) - 46) use simple-card-core on rsrc-card
47) - 49) rename rsrc-card to simple-dpcm-audio-card

Kuninori Morimoto (49):
       1) ASoC: simple-card: remove duplicate header
       2) ASoC: rsrc-card: remove duplicate header
       3) ASoC: rsrc-card: remove unused dai_num
       4) ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()
       5) ASoC: add new simple-card-core.c
       6) ASoC: simple-card-core: add asoc_simple_card_parse_tdm()
       7) ASoC: simple-card-core: add asoc_simple_card_parse_dailink_name()
       8) ASoC: simple-card-core: add asoc_simple_card_parse_card_name()
       9) ASoC: simple-card-core: add asoc_simple_card_parse_card_prefix()
      10) ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
      11) ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
      12) ASoC: simple-card-core: add asoc_simple_card_parse_clk()
      13) ASoC: simple-card-core: add asoc_simple_card_parse_endpoint()
      14) ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()
      15) ASoC: simple-card-core: add asoc_simple_card_init_jack()
      16) ASoC: simple-card-core: add asoc_simple_card_init_dai()
      17) ASoC: simple-card-core: add asoc_simple_card_canonicalize_dailink()
      18) ASoC: simple-card-core: add asoc_simple_card_canonicalize_cpu()
      19) ASoC: simple-card-core: add asoc_simple_card_clean_reference()
      20) ASoC: simple-card: use asoc_simple_card_parse_daifmt()
      21) ASoC: simple-card: use asoc_simple_card_parse_clk()
      22) ASoC: simple-card: use asoc_simple_card_parse_endpoint()
      23) ASoC: simple-card: use asoc_simple_card_parse_tdm()
      24) ASoC: simple-card: use asoc_simple_card_parse_card_name()
      25) ASoC: simple-card: use asoc_simple_card_parse_card_route()
      26) ASoC: simple-card: use asoc_simple_card_parse_card_widgets()
      27) ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
      28) ASoC: simple-card: use asoc_simple_card_init_jack()
      29) ASoC: simple-card: use asoc_simple_card_init_dai()
      30) ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
      31) ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()
      32) ASoC: simple-card: use asoc_simple_card_clean_reference()
      33) ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
      34) ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()
      35) ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai
      36) ASoC: rsrc-card: use asoc_simple_card_parse_clk()
      37) ASoC: rsrc-card: use asoc_simple_card_parse_endpoint()
      38) ASoC: rsrc-card: use asoc_simple_card_parse_card_name()
      39) ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix()
      40) ASoC: rsrc-card: use asoc_simple_card_parse_dpcm()
      41) ASoC: rsrc-card: use asoc_simple_card_parse_card_route()
      42) ASoC: rsrc-card: use asoc_simple_card_parse_tdm()
      43) ASoC: rsrc-card: use asoc_simple_card_init_dai()
      44) ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu()
      45) ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
      46) ASoC: rsrc-card: use asoc_simple_card_clean_reference()
      47) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1
      48) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
      49) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3

 Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt |  75 --------------
 Documentation/devicetree/bindings/sound/simple-dpcm-card.txt  |  79 +++++++++++++++
 include/sound/simple_card.h                                   |  11 +--
 include/sound/simple_card_core.h                              | 106 ++++++++++++++++++++
 sound/soc/generic/Kconfig                                     |  10 ++
 sound/soc/generic/Makefile                                    |   4 +
 sound/soc/generic/simple-card-core.c                          | 409 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/generic/simple-card.c                               | 359 ++++++++++++------------------------------------------------------
 sound/soc/generic/simple-dpcm-card.c                          | 330 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 sound/soc/sh/Kconfig                                          |   5 -
 sound/soc/sh/rcar/Makefile                                    |   3 -
 sound/soc/sh/rcar/rsrc-card.c                                 | 529 --------------------------------------------------------------------------------------------------
 12 files changed, 999 insertions(+), 921 deletions(-)

^ permalink raw reply	[flat|nested] 139+ messages in thread

* [PATCH 01/49] ASoC: simple-card: remove duplicate header
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:38   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:38 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card.h includes soc.h, and soc.h includes soc-dai.h
Let's remove these header.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2389ab4..a542b71 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -18,8 +18,6 @@
 #include <linux/string.h>
 #include <sound/jack.h>
 #include <sound/simple_card.h>
-#include <sound/soc-dai.h>
-#include <sound/soc.h>
 
 struct simple_card_data {
 	struct snd_soc_card snd_card;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 01/49] ASoC: simple-card: remove duplicate header
@ 2016-05-20  9:38   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:38 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card.h includes soc.h, and soc.h includes soc-dai.h
Let's remove these header.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2389ab4..a542b71 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -18,8 +18,6 @@
 #include <linux/string.h>
 #include <sound/jack.h>
 #include <sound/simple_card.h>
-#include <sound/soc-dai.h>
-#include <sound/soc.h>
 
 struct simple_card_data {
 	struct snd_soc_card snd_card;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 02/49] ASoC: rsrc-card: remove duplicate header
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:39   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:39 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

It doesn't use jack, soc.h includes soc-dai.h
Let's remove these header.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 1bc7ecf..b3f92e8 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -17,9 +17,7 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
-#include <sound/jack.h>
 #include <sound/soc.h>
-#include <sound/soc-dai.h>
 
 struct rsrc_card_of_data {
 	const char *prefix;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 02/49] ASoC: rsrc-card: remove duplicate header
@ 2016-05-20  9:39   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:39 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

It doesn't use jack, soc.h includes soc-dai.h
Let's remove these header.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 1bc7ecf..b3f92e8 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -17,9 +17,7 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
-#include <sound/jack.h>
 #include <sound/soc.h>
-#include <sound/soc-dai.h>
 
 struct rsrc_card_of_data {
 	const char *prefix;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 03/49] ASoC: rsrc-card: remove unused dai_num
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:39   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:39 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index b3f92e8..e17bc2e 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -62,7 +62,6 @@ struct rsrc_card_priv {
 	struct snd_soc_codec_conf codec_conf;
 	struct rsrc_card_dai *dai_props;
 	struct snd_soc_dai_link *dai_link;
-	int dai_num;
 	u32 convert_rate;
 	u32 convert_channels;
 };
@@ -416,7 +415,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 
 	priv->dai_props	= props;
 	priv->dai_link	= links;
-	priv->dai_num	= num;
 
 	/* Init snd_soc_card */
 	priv->snd_card.owner			= THIS_MODULE;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 03/49] ASoC: rsrc-card: remove unused dai_num
@ 2016-05-20  9:39   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:39 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index b3f92e8..e17bc2e 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -62,7 +62,6 @@ struct rsrc_card_priv {
 	struct snd_soc_codec_conf codec_conf;
 	struct rsrc_card_dai *dai_props;
 	struct snd_soc_dai_link *dai_link;
-	int dai_num;
 	u32 convert_rate;
 	u32 convert_channels;
 };
@@ -416,7 +415,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 
 	priv->dai_props	= props;
 	priv->dai_link	= links;
-	priv->dai_num	= num;
 
 	/* Init snd_soc_card */
 	priv->snd_card.owner			= THIS_MODULE;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 04/49] ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:40   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

In current simple-card, platform is handled as special case,
but, the code is not readable.
This patch makes platform to use asoc_simple_card_sub_parse_of()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index a542b71..f9fc686 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -221,6 +221,9 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	u32 val;
 	int ret;
 
+	if (!np)
+		return 0;
+
 	/*
 	 * Get node via "sound-dai = <&phandle port>"
 	 * it will be used as xxx_of_node on soc_bind_dai_link()
@@ -236,9 +239,14 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 		*args_count = args.args_count;
 
 	/* Get dai->name */
-	ret = snd_soc_of_get_dai_name(np, name);
-	if (ret < 0)
-		return ret;
+	if (name) {
+		ret = snd_soc_of_get_dai_name(np, name);
+		if (ret < 0)
+			return ret;
+	}
+
+	if (!dai)
+		return 0;
 
 	/* Parse TDM slot */
 	ret = snd_soc_of_parse_tdm_slot(np, &dai->tx_slot_mask,
@@ -372,21 +380,20 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_card_sub_parse_of(plat, NULL,
+					    &dai_link->platform_of_node,
+					    NULL, NULL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
 		ret = -EINVAL;
 		goto dai_link_of_err;
 	}
 
-	if (plat) {
-		struct of_phandle_args args;
-
-		ret = of_parse_phandle_with_args(plat, "sound-dai",
-						 "#sound-dai-cells", 0, &args);
-		dai_link->platform_of_node = args.np;
-	} else {
-		/* Assumes platform == cpu */
+	/* Assumes platform == cpu */
+	if (!dai_link->platform_of_node)
 		dai_link->platform_of_node = dai_link->cpu_of_node;
-	}
 
 	/* DAI link name is created from CPU/CODEC dai name */
 	name = devm_kzalloc(dev,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 04/49] ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()
@ 2016-05-20  9:40   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:40 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

In current simple-card, platform is handled as special case,
but, the code is not readable.
This patch makes platform to use asoc_simple_card_sub_parse_of()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index a542b71..f9fc686 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -221,6 +221,9 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	u32 val;
 	int ret;
 
+	if (!np)
+		return 0;
+
 	/*
 	 * Get node via "sound-dai = <&phandle port>"
 	 * it will be used as xxx_of_node on soc_bind_dai_link()
@@ -236,9 +239,14 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 		*args_count = args.args_count;
 
 	/* Get dai->name */
-	ret = snd_soc_of_get_dai_name(np, name);
-	if (ret < 0)
-		return ret;
+	if (name) {
+		ret = snd_soc_of_get_dai_name(np, name);
+		if (ret < 0)
+			return ret;
+	}
+
+	if (!dai)
+		return 0;
 
 	/* Parse TDM slot */
 	ret = snd_soc_of_parse_tdm_slot(np, &dai->tx_slot_mask,
@@ -372,21 +380,20 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_card_sub_parse_of(plat, NULL,
+					    &dai_link->platform_of_node,
+					    NULL, NULL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
 		ret = -EINVAL;
 		goto dai_link_of_err;
 	}
 
-	if (plat) {
-		struct of_phandle_args args;
-
-		ret = of_parse_phandle_with_args(plat, "sound-dai",
-						 "#sound-dai-cells", 0, &args);
-		dai_link->platform_of_node = args.np;
-	} else {
-		/* Assumes platform == cpu */
+	/* Assumes platform == cpu */
+	if (!dai_link->platform_of_node)
 		dai_link->platform_of_node = dai_link->cpu_of_node;
-	}
 
 	/* DAI link name is created from CPU/CODEC dai name */
 	name = devm_kzalloc(dev,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 05/49] ASoC: add new simple-card-core.c
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:42   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:42 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current ALSA SoC has simple-card driver which is supporting both
platform and DT probe.
Now, some sound cards driver are created based on simple-card.
They have similar feature or function, but implemented separately
on each drivers. This is a waste of code.
OTOH, merging these driver into same driver is highly risk,
because keeping compatibility will be very difficult.
More over, ALSA SoC want to have graph base of DT feature in the
future. Maybe it want to use simple-card like feature / function.
Because of these background, this patch tries to create
new simple-card-core, and provides common function to each drivers.
1st is asoc_simple_card_parse_daifmt()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     | 21 ++++++++++++++
 sound/soc/generic/Kconfig            |  3 ++
 sound/soc/generic/Makefile           |  2 ++
 sound/soc/generic/simple-card-core.c | 54 ++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+)
 create mode 100644 include/sound/simple_card_core.h
 create mode 100644 sound/soc/generic/simple-card-core.c

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
new file mode 100644
index 0000000..7acc798
--- /dev/null
+++ b/include/sound/simple_card_core.h
@@ -0,0 +1,21 @@
+/*
+ * simple_card_core.h
+ *
+ * Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __SIMPLE_CARD_CORE_H
+#define __SIMPLE_CARD_CORE_H
+
+#include <sound/soc.h>
+
+int asoc_simple_card_parse_daifmt(struct device *dev,
+				  struct device_node *node,
+				  struct device_node *codec,
+				  char *prefix,
+				  unsigned int *retfmt);
+
+#endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 610f612..59c2e66 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -1,3 +1,6 @@
+config SND_SIMPLE_CARD_CORE
+       tristate
+
 config SND_SIMPLE_CARD
 	tristate "ASoC Simple sound card support"
 	help
diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile
index 9c3b246..d8a982d 100644
--- a/sound/soc/generic/Makefile
+++ b/sound/soc/generic/Makefile
@@ -1,3 +1,5 @@
+obj-$(CONFIG_SND_SIMPLE_CARD_CORE) := simple-card-core.o
+
 snd-soc-simple-card-objs	:= simple-card.o
 
 obj-$(CONFIG_SND_SIMPLE_CARD)	+= snd-soc-simple-card.o
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
new file mode 100644
index 0000000..ddef5d1
--- /dev/null
+++ b/sound/soc/generic/simple-card-core.c
@@ -0,0 +1,54 @@
+/*
+ * simple-card-core.c
+ *
+ * Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/of.h>
+#include <sound/simple_card_core.h>
+
+int asoc_simple_card_parse_daifmt(struct device *dev,
+				  struct device_node *node,
+				  struct device_node *codec,
+				  char *prefix,
+				  unsigned int *retfmt)
+{
+	struct device_node *bitclkmaster = NULL;
+	struct device_node *framemaster = NULL;
+	int prefix_len = prefix ? strlen(prefix) : 0;
+	unsigned int daifmt;
+
+	daifmt = snd_soc_of_parse_daifmt(node, prefix,
+					 &bitclkmaster, &framemaster);
+	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
+
+	if (prefix_len && !bitclkmaster && !framemaster) {
+		/*
+		 * No dai-link level and master setting was not found from
+		 * sound node level, revert back to legacy DT parsing and
+		 * take the settings from codec node.
+		 */
+		dev_dbg(dev, "Revert to legacy daifmt parsing\n");
+
+		daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
+			(daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
+	} else {
+		if (codec == bitclkmaster)
+			daifmt |= (codec == framemaster) ?
+				SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
+		else
+			daifmt |= (codec == framemaster) ?
+				SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
+	}
+
+	of_node_put(bitclkmaster);
+	of_node_put(framemaster);
+
+	*retfmt = daifmt;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 05/49] ASoC: add new simple-card-core.c
@ 2016-05-20  9:42   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:42 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current ALSA SoC has simple-card driver which is supporting both
platform and DT probe.
Now, some sound cards driver are created based on simple-card.
They have similar feature or function, but implemented separately
on each drivers. This is a waste of code.
OTOH, merging these driver into same driver is highly risk,
because keeping compatibility will be very difficult.
More over, ALSA SoC want to have graph base of DT feature in the
future. Maybe it want to use simple-card like feature / function.
Because of these background, this patch tries to create
new simple-card-core, and provides common function to each drivers.
1st is asoc_simple_card_parse_daifmt()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     | 21 ++++++++++++++
 sound/soc/generic/Kconfig            |  3 ++
 sound/soc/generic/Makefile           |  2 ++
 sound/soc/generic/simple-card-core.c | 54 ++++++++++++++++++++++++++++++++++++
 4 files changed, 80 insertions(+)
 create mode 100644 include/sound/simple_card_core.h
 create mode 100644 sound/soc/generic/simple-card-core.c

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
new file mode 100644
index 0000000..7acc798
--- /dev/null
+++ b/include/sound/simple_card_core.h
@@ -0,0 +1,21 @@
+/*
+ * simple_card_core.h
+ *
+ * Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef __SIMPLE_CARD_CORE_H
+#define __SIMPLE_CARD_CORE_H
+
+#include <sound/soc.h>
+
+int asoc_simple_card_parse_daifmt(struct device *dev,
+				  struct device_node *node,
+				  struct device_node *codec,
+				  char *prefix,
+				  unsigned int *retfmt);
+
+#endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 610f612..59c2e66 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -1,3 +1,6 @@
+config SND_SIMPLE_CARD_CORE
+       tristate
+
 config SND_SIMPLE_CARD
 	tristate "ASoC Simple sound card support"
 	help
diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile
index 9c3b246..d8a982d 100644
--- a/sound/soc/generic/Makefile
+++ b/sound/soc/generic/Makefile
@@ -1,3 +1,5 @@
+obj-$(CONFIG_SND_SIMPLE_CARD_CORE) := simple-card-core.o
+
 snd-soc-simple-card-objs	:= simple-card.o
 
 obj-$(CONFIG_SND_SIMPLE_CARD)	+= snd-soc-simple-card.o
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
new file mode 100644
index 0000000..ddef5d1
--- /dev/null
+++ b/sound/soc/generic/simple-card-core.c
@@ -0,0 +1,54 @@
+/*
+ * simple-card-core.c
+ *
+ * Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/of.h>
+#include <sound/simple_card_core.h>
+
+int asoc_simple_card_parse_daifmt(struct device *dev,
+				  struct device_node *node,
+				  struct device_node *codec,
+				  char *prefix,
+				  unsigned int *retfmt)
+{
+	struct device_node *bitclkmaster = NULL;
+	struct device_node *framemaster = NULL;
+	int prefix_len = prefix ? strlen(prefix) : 0;
+	unsigned int daifmt;
+
+	daifmt = snd_soc_of_parse_daifmt(node, prefix,
+					 &bitclkmaster, &framemaster);
+	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
+
+	if (prefix_len && !bitclkmaster && !framemaster) {
+		/*
+		 * No dai-link level and master setting was not found from
+		 * sound node level, revert back to legacy DT parsing and
+		 * take the settings from codec node.
+		 */
+		dev_dbg(dev, "Revert to legacy daifmt parsing\n");
+
+		daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
+			(daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
+	} else {
+		if (codec == bitclkmaster)
+			daifmt |= (codec == framemaster) ?
+				SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
+		else
+			daifmt |= (codec == framemaster) ?
+				SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
+	}
+
+	of_node_put(bitclkmaster);
+	of_node_put(framemaster);
+
+	*retfmt = daifmt;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 06/49] ASoC: simple-card-core: add asoc_simple_card_parse_tdm()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:42   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:42 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting TDM.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     | 12 ++++++++++++
 sound/soc/generic/simple-card-core.c | 11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 7acc798..6bb2c5f 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -12,10 +12,22 @@
 
 #include <sound/soc.h>
 
+struct asoc_simple_dai {
+	const char *name;
+	unsigned int sysclk;
+	int slots;
+	int slot_width;
+	unsigned int tx_slot_mask;
+	unsigned int rx_slot_mask;
+	struct clk *clk;
+};
+
 int asoc_simple_card_parse_daifmt(struct device *dev,
 				  struct device_node *node,
 				  struct device_node *codec,
 				  char *prefix,
 				  unsigned int *retfmt);
+int asoc_simple_card_parse_tdm(struct device_node *port_np,
+			       struct asoc_simple_dai *simple_dai);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index ddef5d1..e3536f4 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -52,3 +52,14 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);
+
+int asoc_simple_card_parse_tdm(struct device_node *port_np,
+			       struct asoc_simple_dai *simple_dai)
+{
+	return snd_soc_of_parse_tdm_slot(port_np,
+					 &simple_dai->tx_slot_mask,
+					 &simple_dai->rx_slot_mask,
+					 &simple_dai->slots,
+					 &simple_dai->slot_width);
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 06/49] ASoC: simple-card-core: add asoc_simple_card_parse_tdm()
@ 2016-05-20  9:42   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:42 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting TDM.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     | 12 ++++++++++++
 sound/soc/generic/simple-card-core.c | 11 +++++++++++
 2 files changed, 23 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 7acc798..6bb2c5f 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -12,10 +12,22 @@
 
 #include <sound/soc.h>
 
+struct asoc_simple_dai {
+	const char *name;
+	unsigned int sysclk;
+	int slots;
+	int slot_width;
+	unsigned int tx_slot_mask;
+	unsigned int rx_slot_mask;
+	struct clk *clk;
+};
+
 int asoc_simple_card_parse_daifmt(struct device *dev,
 				  struct device_node *node,
 				  struct device_node *codec,
 				  char *prefix,
 				  unsigned int *retfmt);
+int asoc_simple_card_parse_tdm(struct device_node *port_np,
+			       struct asoc_simple_dai *simple_dai);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index ddef5d1..e3536f4 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -52,3 +52,14 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_daifmt);
+
+int asoc_simple_card_parse_tdm(struct device_node *port_np,
+			       struct asoc_simple_dai *simple_dai)
+{
+	return snd_soc_of_parse_tdm_slot(port_np,
+					 &simple_dai->tx_slot_mask,
+					 &simple_dai->rx_slot_mask,
+					 &simple_dai->slots,
+					 &simple_dai->slot_width);
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 07/49] ASoC: simple-card-core: add asoc_simple_card_parse_dailink_name()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:44   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:44 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current simple-card is creating dai_link->name / dai_link->stream_name.
These are based on CPU + Codec name.
It can be "fe.CPU" or "be.Codec" if it was DPCM.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 42 ++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 6bb2c5f..41e567b 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -29,5 +29,7 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
 				  unsigned int *retfmt);
 int asoc_simple_card_parse_tdm(struct device_node *port_np,
 			       struct asoc_simple_dai *simple_dai);
+int asoc_simple_card_parse_dailink_name(struct device *dev,
+					struct snd_soc_dai_link *dai_link);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index e3536f4..51ed96e 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -63,3 +63,45 @@ int asoc_simple_card_parse_tdm(struct device_node *port_np,
 					 &simple_dai->slot_width);
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm);
+
+int asoc_simple_card_parse_dailink_name(struct device *dev,
+					struct snd_soc_dai_link *dai_link)
+{
+	char *name = NULL;
+	int ret = -ENOMEM;
+
+	if (dai_link->dynamic && dai_link->cpu_dai_name) {
+		name = devm_kzalloc(dev,
+				    strlen(dai_link->cpu_dai_name) + 4,
+				    GFP_KERNEL);
+		if (name)
+			sprintf(name, "fe.%s", dai_link->cpu_dai_name);
+
+	} else if (dai_link->no_pcm && dai_link->codec_dai_name) {
+		name = devm_kzalloc(dev,
+				    strlen(dai_link->codec_dai_name) + 4,
+				    GFP_KERNEL);
+		if (name)
+			sprintf(name, "be.%s", dai_link->codec_dai_name);
+	} else if (dai_link->cpu_dai_name && dai_link->codec_dai_name) {
+		name = devm_kzalloc(dev,
+				    strlen(dai_link->cpu_dai_name)   +
+				    strlen(dai_link->codec_dai_name) + 2,
+				    GFP_KERNEL);
+		if (name) {
+			sprintf(name, "%s-%s",
+				dai_link->cpu_dai_name,
+				dai_link->codec_dai_name);
+		}
+	}
+
+	if (name) {
+		ret = 0;
+
+		dai_link->name =
+			dai_link->stream_name = name;
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dailink_name);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 07/49] ASoC: simple-card-core: add asoc_simple_card_parse_dailink_name()
@ 2016-05-20  9:44   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:44 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current simple-card is creating dai_link->name / dai_link->stream_name.
These are based on CPU + Codec name.
It can be "fe.CPU" or "be.Codec" if it was DPCM.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 42 ++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 6bb2c5f..41e567b 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -29,5 +29,7 @@ int asoc_simple_card_parse_daifmt(struct device *dev,
 				  unsigned int *retfmt);
 int asoc_simple_card_parse_tdm(struct device_node *port_np,
 			       struct asoc_simple_dai *simple_dai);
+int asoc_simple_card_parse_dailink_name(struct device *dev,
+					struct snd_soc_dai_link *dai_link);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index e3536f4..51ed96e 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -63,3 +63,45 @@ int asoc_simple_card_parse_tdm(struct device_node *port_np,
 					 &simple_dai->slot_width);
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_tdm);
+
+int asoc_simple_card_parse_dailink_name(struct device *dev,
+					struct snd_soc_dai_link *dai_link)
+{
+	char *name = NULL;
+	int ret = -ENOMEM;
+
+	if (dai_link->dynamic && dai_link->cpu_dai_name) {
+		name = devm_kzalloc(dev,
+				    strlen(dai_link->cpu_dai_name) + 4,
+				    GFP_KERNEL);
+		if (name)
+			sprintf(name, "fe.%s", dai_link->cpu_dai_name);
+
+	} else if (dai_link->no_pcm && dai_link->codec_dai_name) {
+		name = devm_kzalloc(dev,
+				    strlen(dai_link->codec_dai_name) + 4,
+				    GFP_KERNEL);
+		if (name)
+			sprintf(name, "be.%s", dai_link->codec_dai_name);
+	} else if (dai_link->cpu_dai_name && dai_link->codec_dai_name) {
+		name = devm_kzalloc(dev,
+				    strlen(dai_link->cpu_dai_name)   +
+				    strlen(dai_link->codec_dai_name) + 2,
+				    GFP_KERNEL);
+		if (name) {
+			sprintf(name, "%s-%s",
+				dai_link->cpu_dai_name,
+				dai_link->codec_dai_name);
+		}
+	}
+
+	if (name) {
+		ret = 0;
+
+		dai_link->name =
+			dai_link->stream_name = name;
+	}
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dailink_name);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 08/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_name()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:44   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:44 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card needs to get its card name.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 41e567b..2f991da 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -31,5 +31,7 @@ int asoc_simple_card_parse_tdm(struct device_node *port_np,
 			       struct asoc_simple_dai *simple_dai);
 int asoc_simple_card_parse_dailink_name(struct device *dev,
 					struct snd_soc_dai_link *dai_link);
+int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
+				     char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 51ed96e..3b8cd33 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -105,3 +105,23 @@ int asoc_simple_card_parse_dailink_name(struct device *dev,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dailink_name);
+
+int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
+				     char *prefix)
+{
+	char prop[128];
+	int ret;
+
+	snprintf(prop, sizeof(prop), "%sname", prefix);
+
+	/* Parse the card name from DT */
+	ret = snd_soc_of_parse_card_name(card, prop);
+	if (ret < 0)
+		return ret;
+
+	if (!card->name)
+		card->name = card->dai_link->name;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 08/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_name()
@ 2016-05-20  9:44   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:44 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card needs to get its card name.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 20 ++++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 41e567b..2f991da 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -31,5 +31,7 @@ int asoc_simple_card_parse_tdm(struct device_node *port_np,
 			       struct asoc_simple_dai *simple_dai);
 int asoc_simple_card_parse_dailink_name(struct device *dev,
 					struct snd_soc_dai_link *dai_link);
+int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
+				     char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 51ed96e..3b8cd33 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -105,3 +105,23 @@ int asoc_simple_card_parse_dailink_name(struct device *dev,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dailink_name);
+
+int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
+				     char *prefix)
+{
+	char prop[128];
+	int ret;
+
+	snprintf(prop, sizeof(prop), "%sname", prefix);
+
+	/* Parse the card name from DT */
+	ret = snd_soc_of_parse_card_name(card, prop);
+	if (ret < 0)
+		return ret;
+
+	if (!card->name)
+		card->name = card->dai_link->name;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 09/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_prefix()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:45   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:45 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

DPCM might need audio prefix for route matching.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  4 ++++
 sound/soc/generic/simple-card-core.c | 17 +++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 2f991da..89172aa 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -33,5 +33,9 @@ int asoc_simple_card_parse_dailink_name(struct device *dev,
 					struct snd_soc_dai_link *dai_link);
 int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 				     char *prefix);
+int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
+				       struct snd_soc_dai_link *dai_link,
+				       struct snd_soc_codec_conf *codec_conf,
+				       char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 3b8cd33..bc1f2a9 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -125,3 +125,20 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
+
+int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
+				       struct snd_soc_dai_link *dai_link,
+				       struct snd_soc_codec_conf *codec_conf,
+				       char *prefix)
+{
+	char prop[128];
+
+	snprintf(prop, sizeof(prop), "%sprefix", prefix);
+
+	snd_soc_of_parse_audio_prefix(card, codec_conf,
+				      dai_link->codec_of_node,
+				      prop);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_prefix);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 09/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_prefix()
@ 2016-05-20  9:45   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:45 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

DPCM might need audio prefix for route matching.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  4 ++++
 sound/soc/generic/simple-card-core.c | 17 +++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 2f991da..89172aa 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -33,5 +33,9 @@ int asoc_simple_card_parse_dailink_name(struct device *dev,
 					struct snd_soc_dai_link *dai_link);
 int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 				     char *prefix);
+int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
+				       struct snd_soc_dai_link *dai_link,
+				       struct snd_soc_codec_conf *codec_conf,
+				       char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 3b8cd33..bc1f2a9 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -125,3 +125,20 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
+
+int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
+				       struct snd_soc_dai_link *dai_link,
+				       struct snd_soc_codec_conf *codec_conf,
+				       char *prefix)
+{
+	char prop[128];
+
+	snprintf(prop, sizeof(prop), "%sprefix", prefix);
+
+	snd_soc_of_parse_audio_prefix(card, codec_conf,
+				      dai_link->codec_of_node,
+				      prop);
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_prefix);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 10/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:45   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:45 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting widgets.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 89172aa..d66b536 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -37,5 +37,7 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
 				       struct snd_soc_dai_link *dai_link,
 				       struct snd_soc_codec_conf *codec_conf,
 				       char *prefix);
+int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
+				      char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index bc1f2a9..bfe3bf4 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -142,3 +142,19 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_prefix);
+
+int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
+				      char *prefix)
+{
+	struct device_node *np = card->dev->of_node;
+	char prop[128];
+	int ret = 0;
+
+	snprintf(prop, sizeof(prop), "%srouting", prefix);
+
+	if (of_property_read_bool(np, prop))
+		ret = snd_soc_of_parse_audio_routing(card, prop);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_route);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 10/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
@ 2016-05-20  9:45   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:45 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting widgets.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 89172aa..d66b536 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -37,5 +37,7 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
 				       struct snd_soc_dai_link *dai_link,
 				       struct snd_soc_codec_conf *codec_conf,
 				       char *prefix);
+int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
+				      char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index bc1f2a9..bfe3bf4 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -142,3 +142,19 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_prefix);
+
+int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
+				      char *prefix)
+{
+	struct device_node *np = card->dev->of_node;
+	char prop[128];
+	int ret = 0;
+
+	snprintf(prop, sizeof(prop), "%srouting", prefix);
+
+	if (of_property_read_bool(np, prop))
+		ret = snd_soc_of_parse_audio_routing(card, prop);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_route);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:46   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:46 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting widgets.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index d66b536..41a66e8 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -39,5 +39,7 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
 				       char *prefix);
 int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
 				      char *prefix);
+int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
+					char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index bfe3bf4..baabb50 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -158,3 +158,19 @@ int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_route);
+
+int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
+					char *prefix)
+{
+	struct device_node *np = card->dev->of_node;
+	char prop[128];
+	int ret = 0;
+
+	snprintf(prop, sizeof(prop), "%swidgets", prefix);
+
+	if (of_property_read_bool(np, prop))
+		ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
@ 2016-05-20  9:46   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:46 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting widgets.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index d66b536..41a66e8 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -39,5 +39,7 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,
 				       char *prefix);
 int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
 				      char *prefix);
+int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
+					char *prefix);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index bfe3bf4..baabb50 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -158,3 +158,19 @@ int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_route);
+
+int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
+					char *prefix)
+{
+	struct device_node *np = card->dev->of_node;
+	char prop[128];
+	int ret = 0;
+
+	snprintf(prop, sizeof(prop), "%swidgets", prefix);
+
+	if (of_property_read_bool(np, prop))
+		ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 12/49] ASoC: simple-card-core: add asoc_simple_card_parse_clk()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:47   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:47 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current simple-card can get clock via DT clocks or
"system-clock-frequency" property.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  8 ++++++++
 sound/soc/generic/simple-card-core.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 41a66e8..5105b24 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -42,4 +42,12 @@ int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
 int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
 					char *prefix);
 
+#define asoc_simple_card_parse_clk_cpu(port_np, dai_link, simple_dai)\
+	asoc_simple_card_parse_clk(port_np, dai_link->cpu_of_node, simple_dai)
+#define asoc_simple_card_parse_clk_codec(port_np, dai_link, simple_dai)  \
+	asoc_simple_card_parse_clk(port_np, dai_link->codec_of_node, simple_dai)
+int asoc_simple_card_parse_clk(struct device_node *port_np,
+			       struct device_node *endpoint_np,
+			       struct asoc_simple_dai *simple_dai);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index baabb50..1b01c07 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -7,6 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/clk.h>
 #include <linux/of.h>
 #include <sound/simple_card_core.h>
 
@@ -174,3 +175,32 @@ int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
+
+int asoc_simple_card_parse_clk(struct device_node *port_np,
+			       struct device_node *endpoint_np,
+			       struct asoc_simple_dai *simple_dai)
+{
+	struct clk *clk;
+	u32 val;
+
+	/*
+	 * Parse dai->sysclk come from "clocks = <&xxx>"
+	 * (if system has common clock)
+	 *  or "system-clock-frequency = <xxx>"
+	 *  or device's module clock.
+	 */
+	clk = of_clk_get(port_np, 0);
+	if (!IS_ERR(clk)) {
+		simple_dai->sysclk = clk_get_rate(clk);
+		simple_dai->clk = clk;
+	} else if (!of_property_read_u32(port_np, "system-clock-frequency", &val)) {
+		simple_dai->sysclk = val;
+	} else {
+		clk = of_clk_get(endpoint_np, 0);
+		if (!IS_ERR(clk))
+			simple_dai->sysclk = clk_get_rate(clk);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 12/49] ASoC: simple-card-core: add asoc_simple_card_parse_clk()
@ 2016-05-20  9:47   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:47 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current simple-card can get clock via DT clocks or
"system-clock-frequency" property.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  8 ++++++++
 sound/soc/generic/simple-card-core.c | 30 ++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 41a66e8..5105b24 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -42,4 +42,12 @@ int asoc_simple_card_parse_card_route(struct snd_soc_card *card,
 int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
 					char *prefix);
 
+#define asoc_simple_card_parse_clk_cpu(port_np, dai_link, simple_dai)\
+	asoc_simple_card_parse_clk(port_np, dai_link->cpu_of_node, simple_dai)
+#define asoc_simple_card_parse_clk_codec(port_np, dai_link, simple_dai)  \
+	asoc_simple_card_parse_clk(port_np, dai_link->codec_of_node, simple_dai)
+int asoc_simple_card_parse_clk(struct device_node *port_np,
+			       struct device_node *endpoint_np,
+			       struct asoc_simple_dai *simple_dai);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index baabb50..1b01c07 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -7,6 +7,7 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
+#include <linux/clk.h>
 #include <linux/of.h>
 #include <sound/simple_card_core.h>
 
@@ -174,3 +175,32 @@ int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
 	return ret;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
+
+int asoc_simple_card_parse_clk(struct device_node *port_np,
+			       struct device_node *endpoint_np,
+			       struct asoc_simple_dai *simple_dai)
+{
+	struct clk *clk;
+	u32 val;
+
+	/*
+	 * Parse dai->sysclk come from "clocks = <&xxx>"
+	 * (if system has common clock)
+	 *  or "system-clock-frequency = <xxx>"
+	 *  or device's module clock.
+	 */
+	clk = of_clk_get(port_np, 0);
+	if (!IS_ERR(clk)) {
+		simple_dai->sysclk = clk_get_rate(clk);
+		simple_dai->clk = clk;
+	} else if (!of_property_read_u32(port_np, "system-clock-frequency", &val)) {
+		simple_dai->sysclk = val;
+	} else {
+		clk = of_clk_get(endpoint_np, 0);
+		if (!IS_ERR(clk))
+			simple_dai->sysclk = clk_get_rate(clk);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 13/49] ASoC: simple-card-core: add asoc_simple_card_parse_endpoint()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:47   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:47 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card needs to get its dai name and endpoint node.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     | 19 ++++++++++++++++++
 sound/soc/generic/simple-card-core.c | 38 ++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 5105b24..8155001 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -50,4 +50,23 @@ int asoc_simple_card_parse_clk(struct device_node *port_np,
 			       struct device_node *endpoint_np,
 			       struct asoc_simple_dai *simple_dai);
 
+#define asoc_simple_card_parse_cpu(port_np, dai_link,				\
+				   list_name, cells_name, is_single_link)	\
+	asoc_simple_card_parse_endpoint(port_np, &dai_link->cpu_of_node,	\
+		&dai_link->cpu_dai_name, list_name, cells_name, is_single_link)
+#define asoc_simple_card_parse_codec(port_np, dai_link,				\
+				     list_name, cells_name)			\
+	asoc_simple_card_parse_endpoint(port_np, &dai_link->codec_of_node,	\
+		&dai_link->codec_dai_name, list_name, cells_name, NULL)
+#define asoc_simple_card_parse_platform(port_np, dai_link,			\
+					list_name, cells_name)			\
+	asoc_simple_card_parse_endpoint(port_np, &dai_link->platform_of_node,	\
+		NULL, list_name, cells_name, NULL)
+int asoc_simple_card_parse_endpoint(struct device_node *port_np,
+				  struct device_node **endpoint_np,
+				  const char **dai_name,
+				  const char *list_name,
+				  const char *cells_name,
+				  int *is_single_links);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 1b01c07..d9285df 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -204,3 +204,41 @@ int asoc_simple_card_parse_clk(struct device_node *port_np,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk);
+
+int asoc_simple_card_parse_endpoint(struct device_node *port_np,
+				    struct device_node **endpoint_np,
+				    const char **dai_name,
+				    const char *list_name,
+				    const char *cells_name,
+				    int *is_single_link)
+{
+	struct of_phandle_args args;
+	int ret;
+
+	if (!port_np)
+		return 0;
+
+	/*
+	 * Get node via "sound-dai = <&phandle port>"
+	 * it will be used as xxx_of_node on soc_bind_dai_link()
+	 */
+	ret = of_parse_phandle_with_args(port_np,
+					 list_name, cells_name, 0, &args);
+	if (ret)
+		return ret;
+
+	/* Get dai->name */
+	if (dai_name) {
+		ret = snd_soc_of_get_dai_name(port_np, dai_name);
+		if (ret < 0)
+			return ret;
+	}
+
+	*endpoint_np = args.np;
+
+	if (is_single_link)
+		*is_single_link = !args.args_count;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 13/49] ASoC: simple-card-core: add asoc_simple_card_parse_endpoint()
@ 2016-05-20  9:47   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:47 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card needs to get its dai name and endpoint node.
This patch makes it simple style standard

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     | 19 ++++++++++++++++++
 sound/soc/generic/simple-card-core.c | 38 ++++++++++++++++++++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 5105b24..8155001 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -50,4 +50,23 @@ int asoc_simple_card_parse_clk(struct device_node *port_np,
 			       struct device_node *endpoint_np,
 			       struct asoc_simple_dai *simple_dai);
 
+#define asoc_simple_card_parse_cpu(port_np, dai_link,				\
+				   list_name, cells_name, is_single_link)	\
+	asoc_simple_card_parse_endpoint(port_np, &dai_link->cpu_of_node,	\
+		&dai_link->cpu_dai_name, list_name, cells_name, is_single_link)
+#define asoc_simple_card_parse_codec(port_np, dai_link,				\
+				     list_name, cells_name)			\
+	asoc_simple_card_parse_endpoint(port_np, &dai_link->codec_of_node,	\
+		&dai_link->codec_dai_name, list_name, cells_name, NULL)
+#define asoc_simple_card_parse_platform(port_np, dai_link,			\
+					list_name, cells_name)			\
+	asoc_simple_card_parse_endpoint(port_np, &dai_link->platform_of_node,	\
+		NULL, list_name, cells_name, NULL)
+int asoc_simple_card_parse_endpoint(struct device_node *port_np,
+				  struct device_node **endpoint_np,
+				  const char **dai_name,
+				  const char *list_name,
+				  const char *cells_name,
+				  int *is_single_links);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 1b01c07..d9285df 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -204,3 +204,41 @@ int asoc_simple_card_parse_clk(struct device_node *port_np,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk);
+
+int asoc_simple_card_parse_endpoint(struct device_node *port_np,
+				    struct device_node **endpoint_np,
+				    const char **dai_name,
+				    const char *list_name,
+				    const char *cells_name,
+				    int *is_single_link)
+{
+	struct of_phandle_args args;
+	int ret;
+
+	if (!port_np)
+		return 0;
+
+	/*
+	 * Get node via "sound-dai = <&phandle port>"
+	 * it will be used as xxx_of_node on soc_bind_dai_link()
+	 */
+	ret = of_parse_phandle_with_args(port_np,
+					 list_name, cells_name, 0, &args);
+	if (ret)
+		return ret;
+
+	/* Get dai->name */
+	if (dai_name) {
+		ret = snd_soc_of_get_dai_name(port_np, dai_name);
+		if (ret < 0)
+			return ret;
+	}
+
+	*endpoint_np = args.np;
+
+	if (is_single_link)
+		*is_single_link = !args.args_count;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:48   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:48 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card like driver is supporting DPCM FE/BE.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  7 +++++++
 sound/soc/generic/simple-card-core.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 8155001..5e2e824 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -69,4 +69,11 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,
 				  const char *cells_name,
 				  int *is_single_links);
 
+#define asoc_simple_card_parse_dpcm_fe(dai_link)	\
+	asoc_simple_card_parse_dpcm(dai_link, NULL)
+#define asoc_simple_card_parse_dpcm_be(dai_link, fixup)	\
+	asoc_simple_card_parse_dpcm(dai_link, fixup)
+void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
+			int (*be_fixup)(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params));
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index d9285df..d3aab6d 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -242,3 +242,32 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint);
+
+void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
+				 int (*be_fixup)(struct snd_soc_pcm_runtime *rtd,
+						 struct snd_pcm_hw_params *params))
+{
+	if (be_fixup) {
+		/* FE is dummy */
+		dai_link->cpu_of_node		= NULL;
+		dai_link->cpu_dai_name		= "snd-soc-dummy-dai";
+		dai_link->cpu_name		= "snd-soc-dummy";
+
+		/* BE settings */
+		dai_link->no_pcm		= 1;
+		dai_link->be_hw_params_fixup	= be_fixup;
+	} else {
+		/* BE is dummy */
+		dai_link->codec_of_node		= NULL;
+		dai_link->codec_dai_name	= "snd-soc-dummy-dai";
+		dai_link->codec_name		= "snd-soc-dummy";
+
+		/* FE settings */
+		dai_link->dynamic		= 1;
+		dai_link->dpcm_merged_format	= 1;
+	}
+
+	dai_link->dpcm_playback		= 1;
+	dai_link->dpcm_capture		= 1;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dpcm);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()
@ 2016-05-20  9:48   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:48 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card like driver is supporting DPCM FE/BE.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  7 +++++++
 sound/soc/generic/simple-card-core.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 8155001..5e2e824 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -69,4 +69,11 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,
 				  const char *cells_name,
 				  int *is_single_links);
 
+#define asoc_simple_card_parse_dpcm_fe(dai_link)	\
+	asoc_simple_card_parse_dpcm(dai_link, NULL)
+#define asoc_simple_card_parse_dpcm_be(dai_link, fixup)	\
+	asoc_simple_card_parse_dpcm(dai_link, fixup)
+void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
+			int (*be_fixup)(struct snd_soc_pcm_runtime *rtd,
+					struct snd_pcm_hw_params *params));
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index d9285df..d3aab6d 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -242,3 +242,32 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint);
+
+void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
+				 int (*be_fixup)(struct snd_soc_pcm_runtime *rtd,
+						 struct snd_pcm_hw_params *params))
+{
+	if (be_fixup) {
+		/* FE is dummy */
+		dai_link->cpu_of_node		= NULL;
+		dai_link->cpu_dai_name		= "snd-soc-dummy-dai";
+		dai_link->cpu_name		= "snd-soc-dummy";
+
+		/* BE settings */
+		dai_link->no_pcm		= 1;
+		dai_link->be_hw_params_fixup	= be_fixup;
+	} else {
+		/* BE is dummy */
+		dai_link->codec_of_node		= NULL;
+		dai_link->codec_dai_name	= "snd-soc-dummy-dai";
+		dai_link->codec_name		= "snd-soc-dummy";
+
+		/* FE settings */
+		dai_link->dynamic		= 1;
+		dai_link->dpcm_merged_format	= 1;
+	}
+
+	dai_link->dpcm_playback		= 1;
+	dai_link->dpcm_capture		= 1;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dpcm);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:48   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:48 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting jack/gpio.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     | 18 +++++++++++
 sound/soc/generic/simple-card-core.c | 60 ++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 5e2e824..d37acee 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -11,6 +11,13 @@
 #define __SIMPLE_CARD_CORE_H
 
 #include <sound/soc.h>
+#include <sound/jack.h>
+
+struct asoc_simple_jack {
+	struct snd_soc_jack jack;
+	struct snd_soc_jack_pin pin;
+	struct snd_soc_jack_gpio gpio;
+};
 
 struct asoc_simple_dai {
 	const char *name;
@@ -76,4 +83,15 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,
 void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
 			int (*be_fixup)(struct snd_soc_pcm_runtime *rtd,
 					struct snd_pcm_hw_params *params));
+
+#define asoc_simple_card_init_hp(card, sjack, prefix)		\
+	asoc_simple_card_init_jack(card, sjack, 1, prefix)
+#define asoc_simple_card_init_mic(card, sjack, prefix)		\
+	asoc_simple_card_init_jack(card, sjack, 0, prefix)
+int asoc_simple_card_init_jack(struct snd_soc_card *card,
+			       struct asoc_simple_jack *sjack,
+			       int is_hp, char *prefix);
+
+void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index d3aab6d..86f64da 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -9,6 +9,7 @@
  */
 #include <linux/clk.h>
 #include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <sound/simple_card_core.h>
 
 int asoc_simple_card_parse_daifmt(struct device *dev,
@@ -271,3 +272,62 @@ void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
 	dai_link->dpcm_capture		= 1;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dpcm);
+
+int asoc_simple_card_init_jack(struct snd_soc_card *card,
+			       struct asoc_simple_jack *sjack,
+			       int is_hp, char *prefix)
+{
+	struct device *dev = card->dev;
+	enum of_gpio_flags flags;
+	char prop[128];
+	char *pin_name;
+	char *gpio_name;
+	int mask;
+	int det;
+
+	sjack->gpio.gpio = -ENOENT;
+
+	if (is_hp) {
+		snprintf(prop, sizeof(prop), "%shp-det-gpio", prefix);
+		pin_name	= "Headphones";
+		gpio_name	= "Headphone detection";
+		mask		= SND_JACK_HEADPHONE;
+	} else {
+		snprintf(prop, sizeof(prop), "%smic-det-gpio", prefix);
+		pin_name	= "Mic Jack";
+		gpio_name	= "Mic detection";
+		mask		= SND_JACK_MICROPHONE;
+	}
+
+	det = of_get_named_gpio_flags(dev->of_node, prop, 0, &flags);
+	if (det == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+
+	if (gpio_is_valid(det)) {
+		sjack->pin.pin		= pin_name;
+		sjack->pin.mask		= mask;
+
+		sjack->gpio.name	= gpio_name;
+		sjack->gpio.report	= mask;
+		sjack->gpio.gpio	= det;
+		sjack->gpio.invert	= !!(flags & OF_GPIO_ACTIVE_LOW);
+		sjack->gpio.debounce_time = 150;
+
+		snd_soc_card_jack_new(card, pin_name, mask,
+				      &sjack->jack,
+				      &sjack->pin, 1);
+
+		snd_soc_jack_add_gpios(&sjack->jack, 1,
+				       &sjack->gpio);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_init_jack);
+
+void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack)
+{
+	if (gpio_is_valid(sjack->gpio.gpio))
+		snd_soc_jack_free_gpios(&sjack->jack, 1, &sjack->gpio);
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_remove_jack);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()
@ 2016-05-20  9:48   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:48 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting jack/gpio.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     | 18 +++++++++++
 sound/soc/generic/simple-card-core.c | 60 ++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 5e2e824..d37acee 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -11,6 +11,13 @@
 #define __SIMPLE_CARD_CORE_H
 
 #include <sound/soc.h>
+#include <sound/jack.h>
+
+struct asoc_simple_jack {
+	struct snd_soc_jack jack;
+	struct snd_soc_jack_pin pin;
+	struct snd_soc_jack_gpio gpio;
+};
 
 struct asoc_simple_dai {
 	const char *name;
@@ -76,4 +83,15 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,
 void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
 			int (*be_fixup)(struct snd_soc_pcm_runtime *rtd,
 					struct snd_pcm_hw_params *params));
+
+#define asoc_simple_card_init_hp(card, sjack, prefix)		\
+	asoc_simple_card_init_jack(card, sjack, 1, prefix)
+#define asoc_simple_card_init_mic(card, sjack, prefix)		\
+	asoc_simple_card_init_jack(card, sjack, 0, prefix)
+int asoc_simple_card_init_jack(struct snd_soc_card *card,
+			       struct asoc_simple_jack *sjack,
+			       int is_hp, char *prefix);
+
+void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index d3aab6d..86f64da 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -9,6 +9,7 @@
  */
 #include <linux/clk.h>
 #include <linux/of.h>
+#include <linux/of_gpio.h>
 #include <sound/simple_card_core.h>
 
 int asoc_simple_card_parse_daifmt(struct device *dev,
@@ -271,3 +272,62 @@ void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link,
 	dai_link->dpcm_capture		= 1;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dpcm);
+
+int asoc_simple_card_init_jack(struct snd_soc_card *card,
+			       struct asoc_simple_jack *sjack,
+			       int is_hp, char *prefix)
+{
+	struct device *dev = card->dev;
+	enum of_gpio_flags flags;
+	char prop[128];
+	char *pin_name;
+	char *gpio_name;
+	int mask;
+	int det;
+
+	sjack->gpio.gpio = -ENOENT;
+
+	if (is_hp) {
+		snprintf(prop, sizeof(prop), "%shp-det-gpio", prefix);
+		pin_name	= "Headphones";
+		gpio_name	= "Headphone detection";
+		mask		= SND_JACK_HEADPHONE;
+	} else {
+		snprintf(prop, sizeof(prop), "%smic-det-gpio", prefix);
+		pin_name	= "Mic Jack";
+		gpio_name	= "Mic detection";
+		mask		= SND_JACK_MICROPHONE;
+	}
+
+	det = of_get_named_gpio_flags(dev->of_node, prop, 0, &flags);
+	if (det == -EPROBE_DEFER)
+		return -EPROBE_DEFER;
+
+	if (gpio_is_valid(det)) {
+		sjack->pin.pin		= pin_name;
+		sjack->pin.mask		= mask;
+
+		sjack->gpio.name	= gpio_name;
+		sjack->gpio.report	= mask;
+		sjack->gpio.gpio	= det;
+		sjack->gpio.invert	= !!(flags & OF_GPIO_ACTIVE_LOW);
+		sjack->gpio.debounce_time = 150;
+
+		snd_soc_card_jack_new(card, pin_name, mask,
+				      &sjack->jack,
+				      &sjack->pin, 1);
+
+		snd_soc_jack_add_gpios(&sjack->jack, 1,
+				       &sjack->gpio);
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_init_jack);
+
+void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack)
+{
+	if (gpio_is_valid(sjack->gpio.gpio))
+		snd_soc_jack_free_gpios(&sjack->jack, 1, &sjack->gpio);
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_remove_jack);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 16/49] ASoC: simple-card-core: add asoc_simple_card_init_dai()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:49   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:49 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting clock/tdm slot initialization.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  3 +++
 sound/soc/generic/simple-card-core.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index d37acee..9146825 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -94,4 +94,7 @@ int asoc_simple_card_init_jack(struct snd_soc_card *card,
 
 void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack);
 
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
+			      struct asoc_simple_dai *simple_dai);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 86f64da..cc638e9 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -331,3 +331,32 @@ void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack)
 		snd_soc_jack_free_gpios(&sjack->jack, 1, &sjack->gpio);
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_remove_jack);
+
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
+			      struct asoc_simple_dai *simple_dai)
+{
+	int ret;
+
+	if (simple_dai->sysclk) {
+		ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0);
+		if (ret && ret != -ENOTSUPP) {
+			dev_err(dai->dev, "simple-card: set_sysclk error\n");
+			return ret;
+		}
+	}
+
+	if (simple_dai->slots) {
+		ret = snd_soc_dai_set_tdm_slot(dai,
+					       simple_dai->tx_slot_mask,
+					       simple_dai->rx_slot_mask,
+					       simple_dai->slots,
+					       simple_dai->slot_width);
+		if (ret && ret != -ENOTSUPP) {
+			dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
+			return ret;
+		}
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 16/49] ASoC: simple-card-core: add asoc_simple_card_init_dai()
@ 2016-05-20  9:49   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:49 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is supporting clock/tdm slot initialization.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  3 +++
 sound/soc/generic/simple-card-core.c | 29 +++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index d37acee..9146825 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -94,4 +94,7 @@ int asoc_simple_card_init_jack(struct snd_soc_card *card,
 
 void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack);
 
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
+			      struct asoc_simple_dai *simple_dai);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 86f64da..cc638e9 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -331,3 +331,32 @@ void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack)
 		snd_soc_jack_free_gpios(&sjack->jack, 1, &sjack->gpio);
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_remove_jack);
+
+int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
+			      struct asoc_simple_dai *simple_dai)
+{
+	int ret;
+
+	if (simple_dai->sysclk) {
+		ret = snd_soc_dai_set_sysclk(dai, 0, simple_dai->sysclk, 0);
+		if (ret && ret != -ENOTSUPP) {
+			dev_err(dai->dev, "simple-card: set_sysclk error\n");
+			return ret;
+		}
+	}
+
+	if (simple_dai->slots) {
+		ret = snd_soc_dai_set_tdm_slot(dai,
+					       simple_dai->tx_slot_mask,
+					       simple_dai->rx_slot_mask,
+					       simple_dai->slots,
+					       simple_dai->slot_width);
+		if (ret && ret != -ENOTSUPP) {
+			dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
+			return ret;
+		}
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 17/49] ASoC: simple-card-core: add asoc_simple_card_canonicalize_dailink()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:49   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:49 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is assuming that sometimes platform and cpu are same.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 9146825..2db9de8 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -97,4 +97,6 @@ void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack);
 int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
 			      struct asoc_simple_dai *simple_dai);
 
+int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index cc638e9..5c2ea50 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -360,3 +360,16 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
+
+int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
+{
+	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name)
+		return -EINVAL;
+
+	/* Assumes platform == cpu */
+	if (!dai_link->platform_of_node)
+		dai_link->platform_of_node = dai_link->cpu_of_node;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 17/49] ASoC: simple-card-core: add asoc_simple_card_canonicalize_dailink()
@ 2016-05-20  9:49   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:49 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card is assuming that sometimes platform and cpu are same.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 13 +++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 9146825..2db9de8 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -97,4 +97,6 @@ void asoc_simple_card_remove_jack(struct asoc_simple_jack *sjack);
 int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
 			      struct asoc_simple_dai *simple_dai);
 
+int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index cc638e9..5c2ea50 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -360,3 +360,16 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_init_dai);
+
+int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
+{
+	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name)
+		return -EINVAL;
+
+	/* Assumes platform == cpu */
+	if (!dai_link->platform_of_node)
+		dai_link->platform_of_node = dai_link->cpu_of_node;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 18/49] ASoC: simple-card-core: add asoc_simple_card_canonicalize_cpu()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:50   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card needs remove dai_link->cpu_dai_name if it CPU was
single DAI.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 2db9de8..cd69d52 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -98,5 +98,7 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
 			      struct asoc_simple_dai *simple_dai);
 
 int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
+int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
+				      int is_single_links);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 5c2ea50..bcc7826 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -373,3 +373,22 @@ int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink);
+
+int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
+				      int is_single_links)
+{
+	/*
+	 * In soc_bind_dai_link() will check cpu name after
+	 * of_node matching if dai_link has cpu_dai_name.
+	 * but, it will never match if name was created by
+	 * fmt_single_name() remove cpu_dai_name if cpu_args
+	 * was 0. See:
+	 *	fmt_single_name()
+	 *	fmt_multiple_name()
+	 */
+	if (is_single_links)
+		dai_link->cpu_dai_name = NULL;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_cpu);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 18/49] ASoC: simple-card-core: add asoc_simple_card_canonicalize_cpu()
@ 2016-05-20  9:50   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card needs remove dai_link->cpu_dai_name if it CPU was
single DAI.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index 2db9de8..cd69d52 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -98,5 +98,7 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai,
 			      struct asoc_simple_dai *simple_dai);
 
 int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
+int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
+				      int is_single_links);
 
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index 5c2ea50..bcc7826 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -373,3 +373,22 @@ int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink);
+
+int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
+				      int is_single_links)
+{
+	/*
+	 * In soc_bind_dai_link() will check cpu name after
+	 * of_node matching if dai_link has cpu_dai_name.
+	 * but, it will never match if name was created by
+	 * fmt_single_name() remove cpu_dai_name if cpu_args
+	 * was 0. See:
+	 *	fmt_single_name()
+	 *	fmt_multiple_name()
+	 */
+	if (is_single_links)
+		dai_link->cpu_dai_name = NULL;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_cpu);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 19/49] ASoC: simple-card-core: add asoc_simple_card_clean_reference()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:50   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card needs to decrease the reference count of the device nodes.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index cd69d52..10892ae 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -101,4 +101,6 @@ int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
 int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
 				      int is_single_links);
 
+int asoc_simple_card_clean_reference(struct snd_soc_card *card);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index bcc7826..f1d1f9d 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -392,3 +392,18 @@ int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_cpu);
+
+int asoc_simple_card_clean_reference(struct snd_soc_card *card)
+{
+	struct snd_soc_dai_link *dai_link;
+	int num_links;
+
+	for (num_links = 0, dai_link = card->dai_link;
+	     num_links < card->num_links;
+	     num_links++, dai_link++) {
+		of_node_put(dai_link->cpu_of_node);
+		of_node_put(dai_link->codec_of_node);
+	}
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_clean_reference);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 19/49] ASoC: simple-card-core: add asoc_simple_card_clean_reference()
@ 2016-05-20  9:50   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

simple-card needs to decrease the reference count of the device nodes.
This patch makes this method simple style standard.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card_core.h     |  2 ++
 sound/soc/generic/simple-card-core.c | 15 +++++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h
index cd69d52..10892ae 100644
--- a/include/sound/simple_card_core.h
+++ b/include/sound/simple_card_core.h
@@ -101,4 +101,6 @@ int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link);
 int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
 				      int is_single_links);
 
+int asoc_simple_card_clean_reference(struct snd_soc_card *card);
+
 #endif /* __SIMPLE_CARD_CORE_H */
diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c
index bcc7826..f1d1f9d 100644
--- a/sound/soc/generic/simple-card-core.c
+++ b/sound/soc/generic/simple-card-core.c
@@ -392,3 +392,18 @@ int asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link,
 	return 0;
 }
 EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_cpu);
+
+int asoc_simple_card_clean_reference(struct snd_soc_card *card)
+{
+	struct snd_soc_dai_link *dai_link;
+	int num_links;
+
+	for (num_links = 0, dai_link = card->dai_link;
+	     num_links < card->num_links;
+	     num_links++, dai_link++) {
+		of_node_put(dai_link->cpu_of_node);
+		of_node_put(dai_link->codec_of_node);
+	}
+	return 0;
+}
+EXPORT_SYMBOL_GPL(asoc_simple_card_clean_reference);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 20/49] ASoC: simple-card: use asoc_simple_card_parse_daifmt()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:50   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card.h     | 11 +---------
 sound/soc/generic/Kconfig       |  1 +
 sound/soc/generic/simple-card.c | 46 ++---------------------------------------
 3 files changed, 4 insertions(+), 54 deletions(-)

diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 0399352..27ff63a 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -13,16 +13,7 @@
 #define __SIMPLE_CARD_H
 
 #include <sound/soc.h>
-
-struct asoc_simple_dai {
-	const char *name;
-	unsigned int sysclk;
-	int slots;
-	int slot_width;
-	unsigned int tx_slot_mask;
-	unsigned int rx_slot_mask;
-	struct clk *clk;
-};
+#include <sound/simple_card_core.h>
 
 struct asoc_simple_card_info {
 	const char *name;
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 59c2e66..441fc9f 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -3,5 +3,6 @@ config SND_SIMPLE_CARD_CORE
 
 config SND_SIMPLE_CARD
 	tristate "ASoC Simple sound card support"
+	select SND_SIMPLE_CARD_CORE
 	help
 	  This option enables generic simple sound card support
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index f9fc686..c67d94f 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -281,48 +281,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	return 0;
 }
 
-static int asoc_simple_card_parse_daifmt(struct device_node *node,
-					 struct simple_card_data *priv,
-					 struct device_node *codec,
-					 char *prefix, int idx)
-{
-	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
-	struct device *dev = simple_priv_to_dev(priv);
-	struct device_node *bitclkmaster = NULL;
-	struct device_node *framemaster = NULL;
-	unsigned int daifmt;
-
-	daifmt = snd_soc_of_parse_daifmt(node, prefix,
-					 &bitclkmaster, &framemaster);
-	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-	if (strlen(prefix) && !bitclkmaster && !framemaster) {
-		/*
-		 * No dai-link level and master setting was not found from
-		 * sound node level, revert back to legacy DT parsing and
-		 * take the settings from codec node.
-		 */
-		dev_dbg(dev, "Revert to legacy daifmt parsing\n");
-
-		daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
-			(daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
-	} else {
-		if (codec == bitclkmaster)
-			daifmt |= (codec == framemaster) ?
-				SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-		else
-			daifmt |= (codec == framemaster) ?
-				SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-	}
-
-	dai_link->dai_fmt = daifmt;
-
-	of_node_put(bitclkmaster);
-	of_node_put(framemaster);
-
-	return 0;
-}
-
 static int asoc_simple_card_dai_link_of(struct device_node *node,
 					struct simple_card_data *priv,
 					int idx,
@@ -359,8 +317,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		goto dai_link_of_err;
 	}
 
-	ret = asoc_simple_card_parse_daifmt(node, priv,
-					    codec, prefix, idx);
+	ret = asoc_simple_card_parse_daifmt(dev, node, codec,
+					    prefix, &dai_link->dai_fmt);
 	if (ret < 0)
 		goto dai_link_of_err;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 20/49] ASoC: simple-card: use asoc_simple_card_parse_daifmt()
@ 2016-05-20  9:50   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:50 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/simple_card.h     | 11 +---------
 sound/soc/generic/Kconfig       |  1 +
 sound/soc/generic/simple-card.c | 46 ++---------------------------------------
 3 files changed, 4 insertions(+), 54 deletions(-)

diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h
index 0399352..27ff63a 100644
--- a/include/sound/simple_card.h
+++ b/include/sound/simple_card.h
@@ -13,16 +13,7 @@
 #define __SIMPLE_CARD_H
 
 #include <sound/soc.h>
-
-struct asoc_simple_dai {
-	const char *name;
-	unsigned int sysclk;
-	int slots;
-	int slot_width;
-	unsigned int tx_slot_mask;
-	unsigned int rx_slot_mask;
-	struct clk *clk;
-};
+#include <sound/simple_card_core.h>
 
 struct asoc_simple_card_info {
 	const char *name;
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 59c2e66..441fc9f 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -3,5 +3,6 @@ config SND_SIMPLE_CARD_CORE
 
 config SND_SIMPLE_CARD
 	tristate "ASoC Simple sound card support"
+	select SND_SIMPLE_CARD_CORE
 	help
 	  This option enables generic simple sound card support
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index f9fc686..c67d94f 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -281,48 +281,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	return 0;
 }
 
-static int asoc_simple_card_parse_daifmt(struct device_node *node,
-					 struct simple_card_data *priv,
-					 struct device_node *codec,
-					 char *prefix, int idx)
-{
-	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
-	struct device *dev = simple_priv_to_dev(priv);
-	struct device_node *bitclkmaster = NULL;
-	struct device_node *framemaster = NULL;
-	unsigned int daifmt;
-
-	daifmt = snd_soc_of_parse_daifmt(node, prefix,
-					 &bitclkmaster, &framemaster);
-	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-	if (strlen(prefix) && !bitclkmaster && !framemaster) {
-		/*
-		 * No dai-link level and master setting was not found from
-		 * sound node level, revert back to legacy DT parsing and
-		 * take the settings from codec node.
-		 */
-		dev_dbg(dev, "Revert to legacy daifmt parsing\n");
-
-		daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) |
-			(daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK);
-	} else {
-		if (codec == bitclkmaster)
-			daifmt |= (codec == framemaster) ?
-				SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-		else
-			daifmt |= (codec == framemaster) ?
-				SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-	}
-
-	dai_link->dai_fmt = daifmt;
-
-	of_node_put(bitclkmaster);
-	of_node_put(framemaster);
-
-	return 0;
-}
-
 static int asoc_simple_card_dai_link_of(struct device_node *node,
 					struct simple_card_data *priv,
 					int idx,
@@ -359,8 +317,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		goto dai_link_of_err;
 	}
 
-	ret = asoc_simple_card_parse_daifmt(node, priv,
-					    codec, prefix, idx);
+	ret = asoc_simple_card_parse_daifmt(dev, node, codec,
+					    prefix, &dai_link->dai_fmt);
 	if (ret < 0)
 		goto dai_link_of_err;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 21/49] ASoC: simple-card: use asoc_simple_card_parse_clk()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:51   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:51 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index c67d94f..9b7f525 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -217,8 +217,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      int *args_count)
 {
 	struct of_phandle_args args;
-	struct clk *clk;
-	u32 val;
 	int ret;
 
 	if (!np)
@@ -255,29 +253,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	if (ret)
 		return ret;
 
-	/*
-	 * Parse dai->sysclk come from "clocks = <&xxx>"
-	 * (if system has common clock)
-	 *  or "system-clock-frequency = <xxx>"
-	 *  or device's module clock.
-	 */
-	if (of_property_read_bool(np, "clocks")) {
-		clk = of_clk_get(np, 0);
-		if (IS_ERR(clk)) {
-			ret = PTR_ERR(clk);
-			return ret;
-		}
-
-		dai->sysclk = clk_get_rate(clk);
-		dai->clk = clk;
-	} else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
-		dai->sysclk = val;
-	} else {
-		clk = of_clk_get(args.np, 0);
-		if (!IS_ERR(clk))
-			dai->sysclk = clk_get_rate(clk);
-	}
-
 	return 0;
 }
 
@@ -289,6 +264,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
 	struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
+	struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai;
+	struct asoc_simple_dai *codec_dai = &dai_props->codec_dai;
 	struct device_node *cpu = NULL;
 	struct device_node *plat = NULL;
 	struct device_node *codec = NULL;
@@ -344,6 +321,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
 		ret = -EINVAL;
 		goto dai_link_of_err;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 21/49] ASoC: simple-card: use asoc_simple_card_parse_clk()
@ 2016-05-20  9:51   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:51 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index c67d94f..9b7f525 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -217,8 +217,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      int *args_count)
 {
 	struct of_phandle_args args;
-	struct clk *clk;
-	u32 val;
 	int ret;
 
 	if (!np)
@@ -255,29 +253,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	if (ret)
 		return ret;
 
-	/*
-	 * Parse dai->sysclk come from "clocks = <&xxx>"
-	 * (if system has common clock)
-	 *  or "system-clock-frequency = <xxx>"
-	 *  or device's module clock.
-	 */
-	if (of_property_read_bool(np, "clocks")) {
-		clk = of_clk_get(np, 0);
-		if (IS_ERR(clk)) {
-			ret = PTR_ERR(clk);
-			return ret;
-		}
-
-		dai->sysclk = clk_get_rate(clk);
-		dai->clk = clk;
-	} else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
-		dai->sysclk = val;
-	} else {
-		clk = of_clk_get(args.np, 0);
-		if (!IS_ERR(clk))
-			dai->sysclk = clk_get_rate(clk);
-	}
-
 	return 0;
 }
 
@@ -289,6 +264,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
 	struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
+	struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai;
+	struct asoc_simple_dai *codec_dai = &dai_props->codec_dai;
 	struct device_node *cpu = NULL;
 	struct device_node *plat = NULL;
 	struct device_node *codec = NULL;
@@ -344,6 +321,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
 		ret = -EINVAL;
 		goto dai_link_of_err;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 22/49] ASoC: simple-card: use asoc_simple_card_parse_endpoint()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:51   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:51 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 44 ++++++++++++++++++-----------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9b7f525..aa7c7ef 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -38,6 +38,9 @@ struct simple_card_data {
 #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
 #define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
 
+#define DAI	"sound-dai"
+#define CELL	"#sound-dai-cells"
+
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -216,33 +219,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      const char **name,
 			      int *args_count)
 {
-	struct of_phandle_args args;
 	int ret;
 
 	if (!np)
 		return 0;
 
-	/*
-	 * Get node via "sound-dai = <&phandle port>"
-	 * it will be used as xxx_of_node on soc_bind_dai_link()
-	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
-	if (ret)
-		return ret;
-
-	*p_node = args.np;
-
-	if (args_count)
-		*args_count = args.args_count;
-
-	/* Get dai->name */
-	if (name) {
-		ret = snd_soc_of_get_dai_name(np, name);
-		if (ret < 0)
-			return ret;
-	}
-
 	if (!dai)
 		return 0;
 
@@ -272,7 +253,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	char *name;
 	char prop[128];
 	char *prefix = "";
-	int ret, cpu_args;
+	int ret, single_cpu;
 	u32 val;
 
 	/* For single DAI link & old style of DT node */
@@ -302,10 +283,23 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (!of_property_read_u32(node, "mclk-fs", &val))
 		dai_props->mclk_fs = val;
 
+	ret = asoc_simple_card_parse_cpu(cpu, dai_link,
+					 DAI, CELL, &single_cpu);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_codec(codec, dai_link, DAI, CELL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_platform(plat, dai_link, DAI, CELL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai,
 					    &dai_link->cpu_of_node,
 					    &dai_link->cpu_dai_name,
-					    &cpu_args);
+					    &single_cpu);
 	if (ret < 0)
 		goto dai_link_of_err;
 
@@ -372,7 +366,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	 *	fmt_single_name()
 	 *	fmt_multiple_name()
 	 */
-	if (!cpu_args)
+	if (single_cpu)
 		dai_link->cpu_dai_name = NULL;
 
 dai_link_of_err:
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 22/49] ASoC: simple-card: use asoc_simple_card_parse_endpoint()
@ 2016-05-20  9:51   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:51 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 44 ++++++++++++++++++-----------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9b7f525..aa7c7ef 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -38,6 +38,9 @@ struct simple_card_data {
 #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
 #define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
 
+#define DAI	"sound-dai"
+#define CELL	"#sound-dai-cells"
+
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -216,33 +219,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      const char **name,
 			      int *args_count)
 {
-	struct of_phandle_args args;
 	int ret;
 
 	if (!np)
 		return 0;
 
-	/*
-	 * Get node via "sound-dai = <&phandle port>"
-	 * it will be used as xxx_of_node on soc_bind_dai_link()
-	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
-	if (ret)
-		return ret;
-
-	*p_node = args.np;
-
-	if (args_count)
-		*args_count = args.args_count;
-
-	/* Get dai->name */
-	if (name) {
-		ret = snd_soc_of_get_dai_name(np, name);
-		if (ret < 0)
-			return ret;
-	}
-
 	if (!dai)
 		return 0;
 
@@ -272,7 +253,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	char *name;
 	char prop[128];
 	char *prefix = "";
-	int ret, cpu_args;
+	int ret, single_cpu;
 	u32 val;
 
 	/* For single DAI link & old style of DT node */
@@ -302,10 +283,23 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (!of_property_read_u32(node, "mclk-fs", &val))
 		dai_props->mclk_fs = val;
 
+	ret = asoc_simple_card_parse_cpu(cpu, dai_link,
+					 DAI, CELL, &single_cpu);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_codec(codec, dai_link, DAI, CELL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_platform(plat, dai_link, DAI, CELL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai,
 					    &dai_link->cpu_of_node,
 					    &dai_link->cpu_dai_name,
-					    &cpu_args);
+					    &single_cpu);
 	if (ret < 0)
 		goto dai_link_of_err;
 
@@ -372,7 +366,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	 *	fmt_single_name()
 	 *	fmt_multiple_name()
 	 */
-	if (!cpu_args)
+	if (single_cpu)
 		dai_link->cpu_dai_name = NULL;
 
 dai_link_of_err:
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 22/49] ASoC: simple-card: use asoc_simple_card_parse_endpoint()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:52   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:52 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 44 ++++++++++++++++++-----------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9b7f525..aa7c7ef 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -38,6 +38,9 @@ struct simple_card_data {
 #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
 #define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
 
+#define DAI	"sound-dai"
+#define CELL	"#sound-dai-cells"
+
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -216,33 +219,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      const char **name,
 			      int *args_count)
 {
-	struct of_phandle_args args;
 	int ret;
 
 	if (!np)
 		return 0;
 
-	/*
-	 * Get node via "sound-dai = <&phandle port>"
-	 * it will be used as xxx_of_node on soc_bind_dai_link()
-	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
-	if (ret)
-		return ret;
-
-	*p_node = args.np;
-
-	if (args_count)
-		*args_count = args.args_count;
-
-	/* Get dai->name */
-	if (name) {
-		ret = snd_soc_of_get_dai_name(np, name);
-		if (ret < 0)
-			return ret;
-	}
-
 	if (!dai)
 		return 0;
 
@@ -272,7 +253,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	char *name;
 	char prop[128];
 	char *prefix = "";
-	int ret, cpu_args;
+	int ret, single_cpu;
 	u32 val;
 
 	/* For single DAI link & old style of DT node */
@@ -302,10 +283,23 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (!of_property_read_u32(node, "mclk-fs", &val))
 		dai_props->mclk_fs = val;
 
+	ret = asoc_simple_card_parse_cpu(cpu, dai_link,
+					 DAI, CELL, &single_cpu);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_codec(codec, dai_link, DAI, CELL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_platform(plat, dai_link, DAI, CELL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai,
 					    &dai_link->cpu_of_node,
 					    &dai_link->cpu_dai_name,
-					    &cpu_args);
+					    &single_cpu);
 	if (ret < 0)
 		goto dai_link_of_err;
 
@@ -372,7 +366,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	 *	fmt_single_name()
 	 *	fmt_multiple_name()
 	 */
-	if (!cpu_args)
+	if (single_cpu)
 		dai_link->cpu_dai_name = NULL;
 
 dai_link_of_err:
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 22/49] ASoC: simple-card: use asoc_simple_card_parse_endpoint()
@ 2016-05-20  9:52   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:52 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 44 ++++++++++++++++++-----------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 9b7f525..aa7c7ef 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -38,6 +38,9 @@ struct simple_card_data {
 #define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + i)
 #define simple_priv_to_props(priv, i) ((priv)->dai_props + i)
 
+#define DAI	"sound-dai"
+#define CELL	"#sound-dai-cells"
+
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -216,33 +219,11 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      const char **name,
 			      int *args_count)
 {
-	struct of_phandle_args args;
 	int ret;
 
 	if (!np)
 		return 0;
 
-	/*
-	 * Get node via "sound-dai = <&phandle port>"
-	 * it will be used as xxx_of_node on soc_bind_dai_link()
-	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
-	if (ret)
-		return ret;
-
-	*p_node = args.np;
-
-	if (args_count)
-		*args_count = args.args_count;
-
-	/* Get dai->name */
-	if (name) {
-		ret = snd_soc_of_get_dai_name(np, name);
-		if (ret < 0)
-			return ret;
-	}
-
 	if (!dai)
 		return 0;
 
@@ -272,7 +253,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	char *name;
 	char prop[128];
 	char *prefix = "";
-	int ret, cpu_args;
+	int ret, single_cpu;
 	u32 val;
 
 	/* For single DAI link & old style of DT node */
@@ -302,10 +283,23 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (!of_property_read_u32(node, "mclk-fs", &val))
 		dai_props->mclk_fs = val;
 
+	ret = asoc_simple_card_parse_cpu(cpu, dai_link,
+					 DAI, CELL, &single_cpu);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_codec(codec, dai_link, DAI, CELL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_platform(plat, dai_link, DAI, CELL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai,
 					    &dai_link->cpu_of_node,
 					    &dai_link->cpu_dai_name,
-					    &cpu_args);
+					    &single_cpu);
 	if (ret < 0)
 		goto dai_link_of_err;
 
@@ -372,7 +366,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	 *	fmt_single_name()
 	 *	fmt_multiple_name()
 	 */
-	if (!cpu_args)
+	if (single_cpu)
 		dai_link->cpu_dai_name = NULL;
 
 dai_link_of_err:
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 23/49] ASoC: simple-card: use asoc_simple_card_parse_tdm()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:54   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 40 ++--------------------------------------
 1 file changed, 2 insertions(+), 38 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index aa7c7ef..56a8938 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -212,31 +212,6 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	return 0;
 }
 
-static int
-asoc_simple_card_sub_parse_of(struct device_node *np,
-			      struct asoc_simple_dai *dai,
-			      struct device_node **p_node,
-			      const char **name,
-			      int *args_count)
-{
-	int ret;
-
-	if (!np)
-		return 0;
-
-	if (!dai)
-		return 0;
-
-	/* Parse TDM slot */
-	ret = snd_soc_of_parse_tdm_slot(np, &dai->tx_slot_mask,
-					&dai->rx_slot_mask,
-					&dai->slots, &dai->slot_width);
-	if (ret)
-		return ret;
-
-	return 0;
-}
-
 static int asoc_simple_card_dai_link_of(struct device_node *node,
 					struct simple_card_data *priv,
 					int idx,
@@ -296,22 +271,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
-	ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai,
-					    &dai_link->cpu_of_node,
-					    &dai_link->cpu_dai_name,
-					    &single_cpu);
-	if (ret < 0)
-		goto dai_link_of_err;
-
-	ret = asoc_simple_card_sub_parse_of(codec, &dai_props->codec_dai,
-					    &dai_link->codec_of_node,
-					    &dai_link->codec_dai_name, NULL);
+	ret = asoc_simple_card_parse_tdm(cpu, cpu_dai);
 	if (ret < 0)
 		goto dai_link_of_err;
 
-	ret = asoc_simple_card_sub_parse_of(plat, NULL,
-					    &dai_link->platform_of_node,
-					    NULL, NULL);
+	ret = asoc_simple_card_parse_tdm(codec, codec_dai);
 	if (ret < 0)
 		goto dai_link_of_err;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 23/49] ASoC: simple-card: use asoc_simple_card_parse_tdm()
@ 2016-05-20  9:54   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 40 ++--------------------------------------
 1 file changed, 2 insertions(+), 38 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index aa7c7ef..56a8938 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -212,31 +212,6 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	return 0;
 }
 
-static int
-asoc_simple_card_sub_parse_of(struct device_node *np,
-			      struct asoc_simple_dai *dai,
-			      struct device_node **p_node,
-			      const char **name,
-			      int *args_count)
-{
-	int ret;
-
-	if (!np)
-		return 0;
-
-	if (!dai)
-		return 0;
-
-	/* Parse TDM slot */
-	ret = snd_soc_of_parse_tdm_slot(np, &dai->tx_slot_mask,
-					&dai->rx_slot_mask,
-					&dai->slots, &dai->slot_width);
-	if (ret)
-		return ret;
-
-	return 0;
-}
-
 static int asoc_simple_card_dai_link_of(struct device_node *node,
 					struct simple_card_data *priv,
 					int idx,
@@ -296,22 +271,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
-	ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai,
-					    &dai_link->cpu_of_node,
-					    &dai_link->cpu_dai_name,
-					    &single_cpu);
-	if (ret < 0)
-		goto dai_link_of_err;
-
-	ret = asoc_simple_card_sub_parse_of(codec, &dai_props->codec_dai,
-					    &dai_link->codec_of_node,
-					    &dai_link->codec_dai_name, NULL);
+	ret = asoc_simple_card_parse_tdm(cpu, cpu_dai);
 	if (ret < 0)
 		goto dai_link_of_err;
 
-	ret = asoc_simple_card_sub_parse_of(plat, NULL,
-					    &dai_link->platform_of_node,
-					    NULL, NULL);
+	ret = asoc_simple_card_parse_tdm(codec, codec_dai);
 	if (ret < 0)
 		goto dai_link_of_err;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 24/49] ASoC: simple-card: use asoc_simple_card_parse_card_name()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:54   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 56a8938..a85245c 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -40,6 +40,7 @@ struct simple_card_data {
 
 #define DAI	"sound-dai"
 #define CELL	"#sound-dai-cells"
+#define PREFIX	"simple-audio-card,"
 
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
@@ -233,7 +234,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 
 	/* For single DAI link & old style of DT node */
 	if (is_top_level_node)
-		prefix = "simple-audio-card,";
+		prefix = PREFIX;
 
 	snprintf(prop, sizeof(prop), "%scpu", prefix);
 	cpu = of_get_child_by_name(node, prop);
@@ -344,6 +345,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 				     struct simple_card_data *priv)
 {
 	struct device *dev = simple_priv_to_dev(priv);
+	struct snd_soc_card *card = &priv->snd_card;
 	enum of_gpio_flags flags;
 	u32 val;
 	int ret;
@@ -351,9 +353,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (!node)
 		return -EINVAL;
 
-	/* Parse the card name from DT */
-	snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name");
-
 	/* The off-codec widgets */
 	if (of_property_read_bool(node, "simple-audio-card,widgets")) {
 		ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
@@ -375,9 +374,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (ret == 0)
 		priv->mclk_fs = val;
 
-	dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ?
-		priv->snd_card.name : "");
-
 	/* Single/Muti DAI link(s) & New style of DT node */
 	if (of_get_child_by_name(node, "simple-audio-card,dai-link")) {
 		struct device_node *np = NULL;
@@ -412,8 +408,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (priv->gpio_mic_det == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 
-	if (!priv->snd_card.name)
-		priv->snd_card.name = priv->snd_card.dai_link->name;
+	ret = asoc_simple_card_parse_card_name(card, PREFIX);
+	if (ret)
+		return ret;
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 24/49] ASoC: simple-card: use asoc_simple_card_parse_card_name()
@ 2016-05-20  9:54   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:54 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 56a8938..a85245c 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -40,6 +40,7 @@ struct simple_card_data {
 
 #define DAI	"sound-dai"
 #define CELL	"#sound-dai-cells"
+#define PREFIX	"simple-audio-card,"
 
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
@@ -233,7 +234,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 
 	/* For single DAI link & old style of DT node */
 	if (is_top_level_node)
-		prefix = "simple-audio-card,";
+		prefix = PREFIX;
 
 	snprintf(prop, sizeof(prop), "%scpu", prefix);
 	cpu = of_get_child_by_name(node, prop);
@@ -344,6 +345,7 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 				     struct simple_card_data *priv)
 {
 	struct device *dev = simple_priv_to_dev(priv);
+	struct snd_soc_card *card = &priv->snd_card;
 	enum of_gpio_flags flags;
 	u32 val;
 	int ret;
@@ -351,9 +353,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (!node)
 		return -EINVAL;
 
-	/* Parse the card name from DT */
-	snd_soc_of_parse_card_name(&priv->snd_card, "simple-audio-card,name");
-
 	/* The off-codec widgets */
 	if (of_property_read_bool(node, "simple-audio-card,widgets")) {
 		ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
@@ -375,9 +374,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (ret == 0)
 		priv->mclk_fs = val;
 
-	dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ?
-		priv->snd_card.name : "");
-
 	/* Single/Muti DAI link(s) & New style of DT node */
 	if (of_get_child_by_name(node, "simple-audio-card,dai-link")) {
 		struct device_node *np = NULL;
@@ -412,8 +408,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (priv->gpio_mic_det == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 
-	if (!priv->snd_card.name)
-		priv->snd_card.name = priv->snd_card.dai_link->name;
+	ret = asoc_simple_card_parse_card_name(card, PREFIX);
+	if (ret)
+		return ret;
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 25/49] ASoC: simple-card: use asoc_simple_card_parse_card_route()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:55   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index a85245c..5b2559a 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -361,14 +361,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 			return ret;
 	}
 
-	/* DAPM routes */
-	if (of_property_read_bool(node, "simple-audio-card,routing")) {
-		ret = snd_soc_of_parse_audio_routing(&priv->snd_card,
-					"simple-audio-card,routing");
-		if (ret)
-			return ret;
-	}
-
 	/* Factor to mclk, used in hw_params() */
 	ret = of_property_read_u32(node, "simple-audio-card,mclk-fs", &val);
 	if (ret == 0)
@@ -408,6 +400,10 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (priv->gpio_mic_det == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 
+	ret = asoc_simple_card_parse_card_route(card, PREFIX);
+	if (ret)
+		return ret;
+
 	ret = asoc_simple_card_parse_card_name(card, PREFIX);
 	if (ret)
 		return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 25/49] ASoC: simple-card: use asoc_simple_card_parse_card_route()
@ 2016-05-20  9:55   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index a85245c..5b2559a 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -361,14 +361,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 			return ret;
 	}
 
-	/* DAPM routes */
-	if (of_property_read_bool(node, "simple-audio-card,routing")) {
-		ret = snd_soc_of_parse_audio_routing(&priv->snd_card,
-					"simple-audio-card,routing");
-		if (ret)
-			return ret;
-	}
-
 	/* Factor to mclk, used in hw_params() */
 	ret = of_property_read_u32(node, "simple-audio-card,mclk-fs", &val);
 	if (ret == 0)
@@ -408,6 +400,10 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (priv->gpio_mic_det == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 
+	ret = asoc_simple_card_parse_card_route(card, PREFIX);
+	if (ret)
+		return ret;
+
 	ret = asoc_simple_card_parse_card_name(card, PREFIX);
 	if (ret)
 		return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 26/49] ASoC: simple-card: use asoc_simple_card_parse_card_widgets()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 5b2559a..ab97a07 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -353,14 +353,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (!node)
 		return -EINVAL;
 
-	/* The off-codec widgets */
-	if (of_property_read_bool(node, "simple-audio-card,widgets")) {
-		ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
-					"simple-audio-card,widgets");
-		if (ret)
-			return ret;
-	}
-
 	/* Factor to mclk, used in hw_params() */
 	ret = of_property_read_u32(node, "simple-audio-card,mclk-fs", &val);
 	if (ret == 0)
@@ -400,6 +392,10 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (priv->gpio_mic_det == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 
+	ret = asoc_simple_card_parse_card_widgets(card, PREFIX);
+	if (ret)
+		return ret;
+
 	ret = asoc_simple_card_parse_card_route(card, PREFIX);
 	if (ret)
 		return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 26/49] ASoC: simple-card: use asoc_simple_card_parse_card_widgets()
@ 2016-05-20  9:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 5b2559a..ab97a07 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -353,14 +353,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (!node)
 		return -EINVAL;
 
-	/* The off-codec widgets */
-	if (of_property_read_bool(node, "simple-audio-card,widgets")) {
-		ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
-					"simple-audio-card,widgets");
-		if (ret)
-			return ret;
-	}
-
 	/* Factor to mclk, used in hw_params() */
 	ret = of_property_read_u32(node, "simple-audio-card,mclk-fs", &val);
 	if (ret == 0)
@@ -400,6 +392,10 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	if (priv->gpio_mic_det == -EPROBE_DEFER)
 		return -EPROBE_DEFER;
 
+	ret = asoc_simple_card_parse_card_widgets(card, PREFIX);
+	if (ret)
+		return ret;
+
 	ret = asoc_simple_card_parse_card_route(card, PREFIX);
 	if (ret)
 		return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 27/49] ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index ab97a07..45c8ccc 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -226,7 +226,6 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	struct device_node *cpu = NULL;
 	struct device_node *plat = NULL;
 	struct device_node *codec = NULL;
-	char *name;
 	char prop[128];
 	char *prefix = "";
 	int ret, single_cpu;
@@ -297,19 +296,10 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (!dai_link->platform_of_node)
 		dai_link->platform_of_node = dai_link->cpu_of_node;
 
-	/* DAI link name is created from CPU/CODEC dai name */
-	name = devm_kzalloc(dev,
-			    strlen(dai_link->cpu_dai_name)   +
-			    strlen(dai_link->codec_dai_name) + 2,
-			    GFP_KERNEL);
-	if (!name) {
-		ret = -ENOMEM;
+	ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
+	if (ret < 0)
 		goto dai_link_of_err;
-	}
 
-	sprintf(name, "%s-%s", dai_link->cpu_dai_name,
-				dai_link->codec_dai_name);
-	dai_link->name = dai_link->stream_name = name;
 	dai_link->ops = &asoc_simple_card_ops;
 	dai_link->init = asoc_simple_card_dai_init;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 27/49] ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
@ 2016-05-20  9:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index ab97a07..45c8ccc 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -226,7 +226,6 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	struct device_node *cpu = NULL;
 	struct device_node *plat = NULL;
 	struct device_node *codec = NULL;
-	char *name;
 	char prop[128];
 	char *prefix = "";
 	int ret, single_cpu;
@@ -297,19 +296,10 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (!dai_link->platform_of_node)
 		dai_link->platform_of_node = dai_link->cpu_of_node;
 
-	/* DAI link name is created from CPU/CODEC dai name */
-	name = devm_kzalloc(dev,
-			    strlen(dai_link->cpu_dai_name)   +
-			    strlen(dai_link->codec_dai_name) + 2,
-			    GFP_KERNEL);
-	if (!name) {
-		ret = -ENOMEM;
+	ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
+	if (ret < 0)
 		goto dai_link_of_err;
-	}
 
-	sprintf(name, "%s-%s", dai_link->cpu_dai_name,
-				dai_link->codec_dai_name);
-	dai_link->name = dai_link->stream_name = name;
 	dai_link->ops = &asoc_simple_card_ops;
 	dai_link->init = asoc_simple_card_dai_init;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 28/49] ASoC: simple-card: use asoc_simple_card_init_jack()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:56   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 86 ++++++-----------------------------------
 1 file changed, 11 insertions(+), 75 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 45c8ccc..2aacff7 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -27,10 +27,8 @@ struct simple_card_data {
 		unsigned int mclk_fs;
 	} *dai_props;
 	unsigned int mclk_fs;
-	int gpio_hp_det;
-	int gpio_hp_det_invert;
-	int gpio_mic_det;
-	int gpio_mic_det_invert;
+	struct asoc_simple_jack hp_jack;
+	struct asoc_simple_jack mic_jack;
 	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
 };
 
@@ -112,32 +110,6 @@ static struct snd_soc_ops asoc_simple_card_ops = {
 	.hw_params = asoc_simple_card_hw_params,
 };
 
-static struct snd_soc_jack simple_card_hp_jack;
-static struct snd_soc_jack_pin simple_card_hp_jack_pins[] = {
-	{
-		.pin = "Headphones",
-		.mask = SND_JACK_HEADPHONE,
-	},
-};
-static struct snd_soc_jack_gpio simple_card_hp_jack_gpio = {
-	.name = "Headphone detection",
-	.report = SND_JACK_HEADPHONE,
-	.debounce_time = 150,
-};
-
-static struct snd_soc_jack simple_card_mic_jack;
-static struct snd_soc_jack_pin simple_card_mic_jack_pins[] = {
-	{
-		.pin = "Mic Jack",
-		.mask = SND_JACK_MICROPHONE,
-	},
-};
-static struct snd_soc_jack_gpio simple_card_mic_jack_gpio = {
-	.name = "Mic detection",
-	.report = SND_JACK_MICROPHONE,
-	.debounce_time = 150,
-};
-
 static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
 				       struct asoc_simple_dai *set)
 {
@@ -186,30 +158,14 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	if (ret < 0)
 		return ret;
 
-	if (gpio_is_valid(priv->gpio_hp_det)) {
-		snd_soc_card_jack_new(rtd->card, "Headphones",
-				      SND_JACK_HEADPHONE,
-				      &simple_card_hp_jack,
-				      simple_card_hp_jack_pins,
-				      ARRAY_SIZE(simple_card_hp_jack_pins));
-
-		simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det;
-		simple_card_hp_jack_gpio.invert = priv->gpio_hp_det_invert;
-		snd_soc_jack_add_gpios(&simple_card_hp_jack, 1,
-				       &simple_card_hp_jack_gpio);
-	}
+	ret = asoc_simple_card_init_hp(rtd->card, &priv->hp_jack, PREFIX);
+	if (ret < 0)
+		return ret;
+
+	ret = asoc_simple_card_init_mic(rtd->card, &priv->hp_jack, PREFIX);
+	if (ret < 0)
+		return ret;
 
-	if (gpio_is_valid(priv->gpio_mic_det)) {
-		snd_soc_card_jack_new(rtd->card, "Mic Jack",
-				      SND_JACK_MICROPHONE,
-				      &simple_card_mic_jack,
-				      simple_card_mic_jack_pins,
-				      ARRAY_SIZE(simple_card_mic_jack_pins));
-		simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det;
-		simple_card_mic_jack_gpio.invert = priv->gpio_mic_det_invert;
-		snd_soc_jack_add_gpios(&simple_card_mic_jack, 1,
-				       &simple_card_mic_jack_gpio);
-	}
 	return 0;
 }
 
@@ -336,7 +292,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 {
 	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_card *card = &priv->snd_card;
-	enum of_gpio_flags flags;
 	u32 val;
 	int ret;
 
@@ -370,18 +325,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 			return ret;
 	}
 
-	priv->gpio_hp_det = of_get_named_gpio_flags(node,
-				"simple-audio-card,hp-det-gpio", 0, &flags);
-	priv->gpio_hp_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
-	if (priv->gpio_hp_det == -EPROBE_DEFER)
-		return -EPROBE_DEFER;
-
-	priv->gpio_mic_det = of_get_named_gpio_flags(node,
-				"simple-audio-card,mic-det-gpio", 0, &flags);
-	priv->gpio_mic_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
-	if (priv->gpio_mic_det == -EPROBE_DEFER)
-		return -EPROBE_DEFER;
-
 	ret = asoc_simple_card_parse_card_widgets(card, PREFIX);
 	if (ret)
 		return ret;
@@ -440,9 +383,6 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	priv->snd_card.dai_link = dai_link;
 	priv->snd_card.num_links = num_links;
 
-	priv->gpio_hp_det = -ENOENT;
-	priv->gpio_mic_det = -ENOENT;
-
 	/* Get room for the other properties */
 	priv->dai_props = devm_kzalloc(dev,
 			sizeof(*priv->dai_props) * num_links,
@@ -509,12 +449,8 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 	struct simple_card_data *priv = snd_soc_card_get_drvdata(card);
 
-	if (gpio_is_valid(priv->gpio_hp_det))
-		snd_soc_jack_free_gpios(&simple_card_hp_jack, 1,
-					&simple_card_hp_jack_gpio);
-	if (gpio_is_valid(priv->gpio_mic_det))
-		snd_soc_jack_free_gpios(&simple_card_mic_jack, 1,
-					&simple_card_mic_jack_gpio);
+	asoc_simple_card_remove_jack(&priv->hp_jack);
+	asoc_simple_card_remove_jack(&priv->mic_jack);
 
 	return asoc_simple_card_unref(card);
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 28/49] ASoC: simple-card: use asoc_simple_card_init_jack()
@ 2016-05-20  9:56   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:56 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 86 ++++++-----------------------------------
 1 file changed, 11 insertions(+), 75 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 45c8ccc..2aacff7 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -27,10 +27,8 @@ struct simple_card_data {
 		unsigned int mclk_fs;
 	} *dai_props;
 	unsigned int mclk_fs;
-	int gpio_hp_det;
-	int gpio_hp_det_invert;
-	int gpio_mic_det;
-	int gpio_mic_det_invert;
+	struct asoc_simple_jack hp_jack;
+	struct asoc_simple_jack mic_jack;
 	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
 };
 
@@ -112,32 +110,6 @@ static struct snd_soc_ops asoc_simple_card_ops = {
 	.hw_params = asoc_simple_card_hw_params,
 };
 
-static struct snd_soc_jack simple_card_hp_jack;
-static struct snd_soc_jack_pin simple_card_hp_jack_pins[] = {
-	{
-		.pin = "Headphones",
-		.mask = SND_JACK_HEADPHONE,
-	},
-};
-static struct snd_soc_jack_gpio simple_card_hp_jack_gpio = {
-	.name = "Headphone detection",
-	.report = SND_JACK_HEADPHONE,
-	.debounce_time = 150,
-};
-
-static struct snd_soc_jack simple_card_mic_jack;
-static struct snd_soc_jack_pin simple_card_mic_jack_pins[] = {
-	{
-		.pin = "Mic Jack",
-		.mask = SND_JACK_MICROPHONE,
-	},
-};
-static struct snd_soc_jack_gpio simple_card_mic_jack_gpio = {
-	.name = "Mic detection",
-	.report = SND_JACK_MICROPHONE,
-	.debounce_time = 150,
-};
-
 static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
 				       struct asoc_simple_dai *set)
 {
@@ -186,30 +158,14 @@ static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	if (ret < 0)
 		return ret;
 
-	if (gpio_is_valid(priv->gpio_hp_det)) {
-		snd_soc_card_jack_new(rtd->card, "Headphones",
-				      SND_JACK_HEADPHONE,
-				      &simple_card_hp_jack,
-				      simple_card_hp_jack_pins,
-				      ARRAY_SIZE(simple_card_hp_jack_pins));
-
-		simple_card_hp_jack_gpio.gpio = priv->gpio_hp_det;
-		simple_card_hp_jack_gpio.invert = priv->gpio_hp_det_invert;
-		snd_soc_jack_add_gpios(&simple_card_hp_jack, 1,
-				       &simple_card_hp_jack_gpio);
-	}
+	ret = asoc_simple_card_init_hp(rtd->card, &priv->hp_jack, PREFIX);
+	if (ret < 0)
+		return ret;
+
+	ret = asoc_simple_card_init_mic(rtd->card, &priv->hp_jack, PREFIX);
+	if (ret < 0)
+		return ret;
 
-	if (gpio_is_valid(priv->gpio_mic_det)) {
-		snd_soc_card_jack_new(rtd->card, "Mic Jack",
-				      SND_JACK_MICROPHONE,
-				      &simple_card_mic_jack,
-				      simple_card_mic_jack_pins,
-				      ARRAY_SIZE(simple_card_mic_jack_pins));
-		simple_card_mic_jack_gpio.gpio = priv->gpio_mic_det;
-		simple_card_mic_jack_gpio.invert = priv->gpio_mic_det_invert;
-		snd_soc_jack_add_gpios(&simple_card_mic_jack, 1,
-				       &simple_card_mic_jack_gpio);
-	}
 	return 0;
 }
 
@@ -336,7 +292,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 {
 	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_card *card = &priv->snd_card;
-	enum of_gpio_flags flags;
 	u32 val;
 	int ret;
 
@@ -370,18 +325,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 			return ret;
 	}
 
-	priv->gpio_hp_det = of_get_named_gpio_flags(node,
-				"simple-audio-card,hp-det-gpio", 0, &flags);
-	priv->gpio_hp_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
-	if (priv->gpio_hp_det == -EPROBE_DEFER)
-		return -EPROBE_DEFER;
-
-	priv->gpio_mic_det = of_get_named_gpio_flags(node,
-				"simple-audio-card,mic-det-gpio", 0, &flags);
-	priv->gpio_mic_det_invert = !!(flags & OF_GPIO_ACTIVE_LOW);
-	if (priv->gpio_mic_det == -EPROBE_DEFER)
-		return -EPROBE_DEFER;
-
 	ret = asoc_simple_card_parse_card_widgets(card, PREFIX);
 	if (ret)
 		return ret;
@@ -440,9 +383,6 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 	priv->snd_card.dai_link = dai_link;
 	priv->snd_card.num_links = num_links;
 
-	priv->gpio_hp_det = -ENOENT;
-	priv->gpio_mic_det = -ENOENT;
-
 	/* Get room for the other properties */
 	priv->dai_props = devm_kzalloc(dev,
 			sizeof(*priv->dai_props) * num_links,
@@ -509,12 +449,8 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 	struct simple_card_data *priv = snd_soc_card_get_drvdata(card);
 
-	if (gpio_is_valid(priv->gpio_hp_det))
-		snd_soc_jack_free_gpios(&simple_card_hp_jack, 1,
-					&simple_card_hp_jack_gpio);
-	if (gpio_is_valid(priv->gpio_mic_det))
-		snd_soc_jack_free_gpios(&simple_card_mic_jack, 1,
-					&simple_card_mic_jack_gpio);
+	asoc_simple_card_remove_jack(&priv->hp_jack);
+	asoc_simple_card_remove_jack(&priv->mic_jack);
 
 	return asoc_simple_card_unref(card);
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 29/49] ASoC: simple-card: use asoc_simple_card_init_dai()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:57   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2aacff7..cde5d50 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -110,51 +110,19 @@ static struct snd_soc_ops asoc_simple_card_ops = {
 	.hw_params = asoc_simple_card_hw_params,
 };
 
-static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
-				       struct asoc_simple_dai *set)
-{
-	int ret;
-
-	if (set->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_sysclk error\n");
-			goto err;
-		}
-	}
-
-	if (set->slots) {
-		ret = snd_soc_dai_set_tdm_slot(dai,
-					       set->tx_slot_mask,
-					       set->rx_slot_mask,
-						set->slots,
-						set->slot_width);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
-			goto err;
-		}
-	}
-
-	ret = 0;
-
-err:
-	return ret;
-}
-
 static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *codec = rtd->codec_dai;
 	struct snd_soc_dai *cpu = rtd->cpu_dai;
-	struct simple_dai_props *dai_props;
+	struct simple_dai_props *dai_props = &priv->dai_props[rtd->num];
 	int ret;
 
-	dai_props = &priv->dai_props[rtd->num];
-	ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai);
+	ret = asoc_simple_card_init_dai(codec, &dai_props->codec_dai);
 	if (ret < 0)
 		return ret;
 
-	ret = __asoc_simple_card_dai_init(cpu, &dai_props->cpu_dai);
+	ret = asoc_simple_card_init_dai(cpu, &dai_props->cpu_dai);
 	if (ret < 0)
 		return ret;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 29/49] ASoC: simple-card: use asoc_simple_card_init_dai()
@ 2016-05-20  9:57   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2aacff7..cde5d50 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -110,51 +110,19 @@ static struct snd_soc_ops asoc_simple_card_ops = {
 	.hw_params = asoc_simple_card_hw_params,
 };
 
-static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
-				       struct asoc_simple_dai *set)
-{
-	int ret;
-
-	if (set->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_sysclk error\n");
-			goto err;
-		}
-	}
-
-	if (set->slots) {
-		ret = snd_soc_dai_set_tdm_slot(dai,
-					       set->tx_slot_mask,
-					       set->rx_slot_mask,
-						set->slots,
-						set->slot_width);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
-			goto err;
-		}
-	}
-
-	ret = 0;
-
-err:
-	return ret;
-}
-
 static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *codec = rtd->codec_dai;
 	struct snd_soc_dai *cpu = rtd->cpu_dai;
-	struct simple_dai_props *dai_props;
+	struct simple_dai_props *dai_props = &priv->dai_props[rtd->num];
 	int ret;
 
-	dai_props = &priv->dai_props[rtd->num];
-	ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai);
+	ret = asoc_simple_card_init_dai(codec, &dai_props->codec_dai);
 	if (ret < 0)
 		return ret;
 
-	ret = __asoc_simple_card_dai_init(cpu, &dai_props->cpu_dai);
+	ret = asoc_simple_card_init_dai(cpu, &dai_props->cpu_dai);
 	if (ret < 0)
 		return ret;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 30/49] ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:57   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index cde5d50..ec07975 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -211,14 +211,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
-	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
-		ret = -EINVAL;
+	ret = asoc_simple_card_canonicalize_dailink(dai_link);
+	if (ret < 0)
 		goto dai_link_of_err;
-	}
-
-	/* Assumes platform == cpu */
-	if (!dai_link->platform_of_node)
-		dai_link->platform_of_node = dai_link->cpu_of_node;
 
 	ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
 	if (ret < 0)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 30/49] ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
@ 2016-05-20  9:57   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:57 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index cde5d50..ec07975 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -211,14 +211,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
-	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
-		ret = -EINVAL;
+	ret = asoc_simple_card_canonicalize_dailink(dai_link);
+	if (ret < 0)
 		goto dai_link_of_err;
-	}
-
-	/* Assumes platform == cpu */
-	if (!dai_link->platform_of_node)
-		dai_link->platform_of_node = dai_link->cpu_of_node;
 
 	ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
 	if (ret < 0)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 31/49] ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:58   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index ec07975..2ec59ae 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -231,17 +231,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		dai_link->codec_dai_name,
 		dai_props->codec_dai.sysclk);
 
-	/*
-	 * In soc_bind_dai_link() will check cpu name after
-	 * of_node matching if dai_link has cpu_dai_name.
-	 * but, it will never match if name was created by
-	 * fmt_single_name() remove cpu_dai_name if cpu_args
-	 * was 0. See:
-	 *	fmt_single_name()
-	 *	fmt_multiple_name()
-	 */
-	if (single_cpu)
-		dai_link->cpu_dai_name = NULL;
+	ret = asoc_simple_card_canonicalize_cpu(dai_link, single_cpu);
+	if (ret < 0)
+		goto dai_link_of_err;
 
 dai_link_of_err:
 	of_node_put(cpu);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 31/49] ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()
@ 2016-05-20  9:58   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index ec07975..2ec59ae 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -231,17 +231,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		dai_link->codec_dai_name,
 		dai_props->codec_dai.sysclk);
 
-	/*
-	 * In soc_bind_dai_link() will check cpu name after
-	 * of_node matching if dai_link has cpu_dai_name.
-	 * but, it will never match if name was created by
-	 * fmt_single_name() remove cpu_dai_name if cpu_args
-	 * was 0. See:
-	 *	fmt_single_name()
-	 *	fmt_multiple_name()
-	 */
-	if (single_cpu)
-		dai_link->cpu_dai_name = NULL;
+	ret = asoc_simple_card_canonicalize_cpu(dai_link, single_cpu);
+	if (ret < 0)
+		goto dai_link_of_err;
 
 dai_link_of_err:
 	of_node_put(cpu);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 32/49] ASoC: simple-card: use asoc_simple_card_clean_reference()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:58   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2ec59ae..0b5ff0e 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -295,21 +295,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int asoc_simple_card_unref(struct snd_soc_card *card)
-{
-	struct snd_soc_dai_link *dai_link;
-	int num_links;
-
-	for (num_links = 0, dai_link = card->dai_link;
-	     num_links < card->num_links;
-	     num_links++, dai_link++) {
-		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-	}
-	return 0;
-}
-
 static int asoc_simple_card_probe(struct platform_device *pdev)
 {
 	struct simple_card_data *priv;
@@ -395,7 +380,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 		return ret;
 
 err:
-	asoc_simple_card_unref(&priv->snd_card);
+	asoc_simple_card_clean_reference(&priv->snd_card);
 	return ret;
 }
 
@@ -407,7 +392,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 	asoc_simple_card_remove_jack(&priv->hp_jack);
 	asoc_simple_card_remove_jack(&priv->mic_jack);
 
-	return asoc_simple_card_unref(card);
+	return asoc_simple_card_clean_reference(card);
 }
 
 static const struct of_device_id asoc_simple_of_match[] = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 32/49] ASoC: simple-card: use asoc_simple_card_clean_reference()
@ 2016-05-20  9:58   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:58 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/generic/simple-card.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 2ec59ae..0b5ff0e 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -295,21 +295,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int asoc_simple_card_unref(struct snd_soc_card *card)
-{
-	struct snd_soc_dai_link *dai_link;
-	int num_links;
-
-	for (num_links = 0, dai_link = card->dai_link;
-	     num_links < card->num_links;
-	     num_links++, dai_link++) {
-		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-	}
-	return 0;
-}
-
 static int asoc_simple_card_probe(struct platform_device *pdev)
 {
 	struct simple_card_data *priv;
@@ -395,7 +380,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 		return ret;
 
 err:
-	asoc_simple_card_unref(&priv->snd_card);
+	asoc_simple_card_clean_reference(&priv->snd_card);
 	return ret;
 }
 
@@ -407,7 +392,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 	asoc_simple_card_remove_jack(&priv->hp_jack);
 	asoc_simple_card_remove_jack(&priv->mic_jack);
 
-	return asoc_simple_card_unref(card);
+	return asoc_simple_card_clean_reference(card);
 }
 
 static const struct of_device_id asoc_simple_of_match[] = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 33/49] ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:59   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/Kconfig          |  1 +
 sound/soc/sh/rcar/rsrc-card.c | 39 ++++-----------------------------------
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig
index c9902a6..d34d5ed 100644
--- a/sound/soc/sh/Kconfig
+++ b/sound/soc/sh/Kconfig
@@ -44,6 +44,7 @@ config SND_SOC_RCAR
 
 config SND_SOC_RSRC_CARD
 	tristate "Renesas Sampling Rate Convert Sound Card"
+	select SND_SIMPLE_CARD_CORE
 	help
 	  This option enables simple sound if you need sampling rate convert
 
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index e17bc2e..0533518 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -17,7 +17,7 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
-#include <sound/soc.h>
+#include <sound/simple_card_core.h>
 
 struct rsrc_card_of_data {
 	const char *prefix;
@@ -156,38 +156,6 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
-static int rsrc_card_parse_daifmt(struct device_node *node,
-				  struct device_node *codec,
-				  struct rsrc_card_priv *priv,
-				  struct snd_soc_dai_link *dai_link,
-				  unsigned int *retfmt)
-{
-	struct device_node *bitclkmaster = NULL;
-	struct device_node *framemaster = NULL;
-	unsigned int daifmt;
-
-	daifmt = snd_soc_of_parse_daifmt(node, NULL,
-					 &bitclkmaster, &framemaster);
-	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-	if (!bitclkmaster && !framemaster)
-		return -EINVAL;
-
-	if (codec == bitclkmaster)
-		daifmt |= (codec == framemaster) ?
-			SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-	else
-		daifmt |= (codec == framemaster) ?
-			SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-
-	of_node_put(bitclkmaster);
-	of_node_put(framemaster);
-
-	*retfmt = daifmt;
-
-	return 0;
-}
-
 static int rsrc_card_parse_links(struct device_node *np,
 				 struct rsrc_card_priv *priv,
 				 int idx, bool is_fe)
@@ -355,6 +323,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node *node,
 static int rsrc_card_dai_link_of(struct device_node *node,
 				 struct rsrc_card_priv *priv)
 {
+	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link;
 	struct device_node *np;
 	unsigned int daifmt = 0;
@@ -367,8 +336,8 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 		dai_link = rsrc_priv_to_link(priv, i);
 
 		if (strcmp(np->name, "codec") == 0) {
-			ret = rsrc_card_parse_daifmt(node, np, priv,
-						     dai_link, &daifmt);
+			ret = asoc_simple_card_parse_daifmt(dev, node, np,
+							    NULL, &daifmt);
 			if (ret < 0)
 				return ret;
 			break;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 33/49] ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
@ 2016-05-20  9:59   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/Kconfig          |  1 +
 sound/soc/sh/rcar/rsrc-card.c | 39 ++++-----------------------------------
 2 files changed, 5 insertions(+), 35 deletions(-)

diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig
index c9902a6..d34d5ed 100644
--- a/sound/soc/sh/Kconfig
+++ b/sound/soc/sh/Kconfig
@@ -44,6 +44,7 @@ config SND_SOC_RCAR
 
 config SND_SOC_RSRC_CARD
 	tristate "Renesas Sampling Rate Convert Sound Card"
+	select SND_SIMPLE_CARD_CORE
 	help
 	  This option enables simple sound if you need sampling rate convert
 
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index e17bc2e..0533518 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -17,7 +17,7 @@
 #include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/string.h>
-#include <sound/soc.h>
+#include <sound/simple_card_core.h>
 
 struct rsrc_card_of_data {
 	const char *prefix;
@@ -156,38 +156,6 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
-static int rsrc_card_parse_daifmt(struct device_node *node,
-				  struct device_node *codec,
-				  struct rsrc_card_priv *priv,
-				  struct snd_soc_dai_link *dai_link,
-				  unsigned int *retfmt)
-{
-	struct device_node *bitclkmaster = NULL;
-	struct device_node *framemaster = NULL;
-	unsigned int daifmt;
-
-	daifmt = snd_soc_of_parse_daifmt(node, NULL,
-					 &bitclkmaster, &framemaster);
-	daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK;
-
-	if (!bitclkmaster && !framemaster)
-		return -EINVAL;
-
-	if (codec == bitclkmaster)
-		daifmt |= (codec == framemaster) ?
-			SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS;
-	else
-		daifmt |= (codec == framemaster) ?
-			SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS;
-
-	of_node_put(bitclkmaster);
-	of_node_put(framemaster);
-
-	*retfmt = daifmt;
-
-	return 0;
-}
-
 static int rsrc_card_parse_links(struct device_node *np,
 				 struct rsrc_card_priv *priv,
 				 int idx, bool is_fe)
@@ -355,6 +323,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node *node,
 static int rsrc_card_dai_link_of(struct device_node *node,
 				 struct rsrc_card_priv *priv)
 {
+	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link;
 	struct device_node *np;
 	unsigned int daifmt = 0;
@@ -367,8 +336,8 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 		dai_link = rsrc_priv_to_link(priv, i);
 
 		if (strcmp(np->name, "codec") == 0) {
-			ret = rsrc_card_parse_daifmt(node, np, priv,
-						     dai_link, &daifmt);
+			ret = asoc_simple_card_parse_daifmt(dev, node, np,
+							    NULL, &daifmt);
 			if (ret < 0)
 				return ret;
 			break;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 34/49] ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20  9:59   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 0533518..e268011 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -44,7 +44,6 @@ static const struct of_device_id rsrc_card_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
 
-#define DAI_NAME_NUM	32
 struct rsrc_card_dai {
 	unsigned int sysclk;
 	unsigned int tx_slot_mask;
@@ -52,7 +51,7 @@ struct rsrc_card_dai {
 	int slots;
 	int slot_width;
 	struct clk *clk;
-	char dai_name[DAI_NAME_NUM];
+	const char *name;
 };
 
 #define IDX_CPU		0
@@ -160,6 +159,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 				 struct rsrc_card_priv *priv,
 				 int idx, bool is_fe)
 {
+	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
 	struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
 	struct of_phandle_args args;
@@ -197,10 +197,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
-		/* set dai_name */
-		snprintf(dai_props->dai_name, DAI_NAME_NUM, "fe.%s",
-			 dai_link->cpu_dai_name);
-
 		/*
 		 * In soc_bind_dai_link() will check cpu name after
 		 * of_node matching if dai_link has cpu_dai_name.
@@ -213,7 +209,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (!args.args_count)
 			dai_link->cpu_dai_name = NULL;
 	} else {
-		struct device *dev = rsrc_priv_to_dev(priv);
 		const struct rsrc_card_of_data *of_data;
 
 		of_data = of_device_get_match_data(dev);
@@ -241,18 +236,16 @@ static int rsrc_card_parse_links(struct device_node *np,
 						      dai_link->codec_of_node,
 						      "audio-prefix");
 		}
-
-		/* set dai_name */
-		snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
-			 dai_link->codec_dai_name);
 	}
 
+	ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
+	if (ret < 0)
+		return ret;
+
 	/* Simple Card assumes platform == cpu */
 	dai_link->platform_of_node	= dai_link->cpu_of_node;
 	dai_link->dpcm_playback		= 1;
 	dai_link->dpcm_capture		= 1;
-	dai_link->name			= dai_props->dai_name;
-	dai_link->stream_name		= dai_props->dai_name;
 	dai_link->ops			= &rsrc_card_ops;
 	dai_link->init			= rsrc_card_dai_init;
 
@@ -313,7 +306,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node *node,
 		return ret;
 
 	dev_dbg(dev, "\t%s / %04x / %d\n",
-		dai_props->dai_name,
+		dai_link->name,
 		dai_link->dai_fmt,
 		dai_props->sysclk);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 34/49] ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()
@ 2016-05-20  9:59   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20  9:59 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 21 +++++++--------------
 1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 0533518..e268011 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -44,7 +44,6 @@ static const struct of_device_id rsrc_card_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
 
-#define DAI_NAME_NUM	32
 struct rsrc_card_dai {
 	unsigned int sysclk;
 	unsigned int tx_slot_mask;
@@ -52,7 +51,7 @@ struct rsrc_card_dai {
 	int slots;
 	int slot_width;
 	struct clk *clk;
-	char dai_name[DAI_NAME_NUM];
+	const char *name;
 };
 
 #define IDX_CPU		0
@@ -160,6 +159,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 				 struct rsrc_card_priv *priv,
 				 int idx, bool is_fe)
 {
+	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
 	struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
 	struct of_phandle_args args;
@@ -197,10 +197,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
-		/* set dai_name */
-		snprintf(dai_props->dai_name, DAI_NAME_NUM, "fe.%s",
-			 dai_link->cpu_dai_name);
-
 		/*
 		 * In soc_bind_dai_link() will check cpu name after
 		 * of_node matching if dai_link has cpu_dai_name.
@@ -213,7 +209,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (!args.args_count)
 			dai_link->cpu_dai_name = NULL;
 	} else {
-		struct device *dev = rsrc_priv_to_dev(priv);
 		const struct rsrc_card_of_data *of_data;
 
 		of_data = of_device_get_match_data(dev);
@@ -241,18 +236,16 @@ static int rsrc_card_parse_links(struct device_node *np,
 						      dai_link->codec_of_node,
 						      "audio-prefix");
 		}
-
-		/* set dai_name */
-		snprintf(dai_props->dai_name, DAI_NAME_NUM, "be.%s",
-			 dai_link->codec_dai_name);
 	}
 
+	ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
+	if (ret < 0)
+		return ret;
+
 	/* Simple Card assumes platform == cpu */
 	dai_link->platform_of_node	= dai_link->cpu_of_node;
 	dai_link->dpcm_playback		= 1;
 	dai_link->dpcm_capture		= 1;
-	dai_link->name			= dai_props->dai_name;
-	dai_link->stream_name		= dai_props->dai_name;
 	dai_link->ops			= &rsrc_card_ops;
 	dai_link->init			= rsrc_card_dai_init;
 
@@ -313,7 +306,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node *node,
 		return ret;
 
 	dev_dbg(dev, "\t%s / %04x / %d\n",
-		dai_props->dai_name,
+		dai_link->name,
 		dai_link->dai_fmt,
 		dai_props->sysclk);
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 35/49] ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:00   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index e268011..fa3f02b 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -44,22 +44,12 @@ static const struct of_device_id rsrc_card_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
 
-struct rsrc_card_dai {
-	unsigned int sysclk;
-	unsigned int tx_slot_mask;
-	unsigned int rx_slot_mask;
-	int slots;
-	int slot_width;
-	struct clk *clk;
-	const char *name;
-};
-
 #define IDX_CPU		0
 #define IDX_CODEC	1
 struct rsrc_card_priv {
 	struct snd_soc_card snd_card;
 	struct snd_soc_codec_conf codec_conf;
-	struct rsrc_card_dai *dai_props;
+	struct asoc_simple_dai *dai_props;
 	struct snd_soc_dai_link *dai_link;
 	u32 convert_rate;
 	u32 convert_channels;
@@ -73,7 +63,7 @@ static int rsrc_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct rsrc_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
-	struct rsrc_card_dai *dai_props =
+	struct asoc_simple_dai *dai_props =
 		rsrc_priv_to_props(priv, rtd->num);
 
 	return clk_prepare_enable(dai_props->clk);
@@ -83,7 +73,7 @@ static void rsrc_card_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct rsrc_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
-	struct rsrc_card_dai *dai_props =
+	struct asoc_simple_dai *dai_props =
 		rsrc_priv_to_props(priv, rtd->num);
 
 	clk_disable_unprepare(dai_props->clk);
@@ -99,7 +89,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *dai;
 	struct snd_soc_dai_link *dai_link;
-	struct rsrc_card_dai *dai_props;
+	struct asoc_simple_dai *dai_props;
 	int num = rtd->num;
 	int ret;
 
@@ -161,7 +151,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 {
 	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
 	struct of_phandle_args args;
 	int ret;
 
@@ -257,7 +247,7 @@ static int rsrc_card_parse_clk(struct device_node *np,
 			       int idx, bool is_fe)
 {
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
 	struct clk *clk;
 	struct device_node *of_np = is_fe ?	dai_link->cpu_of_node :
 						dai_link->codec_of_node;
@@ -294,7 +284,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node *node,
 {
 	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
 	int ret;
 
 	ret = rsrc_card_parse_links(np, priv, idx, is_fe);
@@ -361,7 +351,7 @@ static int rsrc_card_parse_of(struct device_node *node,
 			      struct device *dev)
 {
 	const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev);
-	struct rsrc_card_dai *props;
+	struct asoc_simple_dai *props;
 	struct snd_soc_dai_link *links;
 	int ret;
 	int num;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 35/49] ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai
@ 2016-05-20 10:00   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:00 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index e268011..fa3f02b 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -44,22 +44,12 @@ static const struct of_device_id rsrc_card_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
 
-struct rsrc_card_dai {
-	unsigned int sysclk;
-	unsigned int tx_slot_mask;
-	unsigned int rx_slot_mask;
-	int slots;
-	int slot_width;
-	struct clk *clk;
-	const char *name;
-};
-
 #define IDX_CPU		0
 #define IDX_CODEC	1
 struct rsrc_card_priv {
 	struct snd_soc_card snd_card;
 	struct snd_soc_codec_conf codec_conf;
-	struct rsrc_card_dai *dai_props;
+	struct asoc_simple_dai *dai_props;
 	struct snd_soc_dai_link *dai_link;
 	u32 convert_rate;
 	u32 convert_channels;
@@ -73,7 +63,7 @@ static int rsrc_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct rsrc_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
-	struct rsrc_card_dai *dai_props =
+	struct asoc_simple_dai *dai_props =
 		rsrc_priv_to_props(priv, rtd->num);
 
 	return clk_prepare_enable(dai_props->clk);
@@ -83,7 +73,7 @@ static void rsrc_card_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct rsrc_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
-	struct rsrc_card_dai *dai_props =
+	struct asoc_simple_dai *dai_props =
 		rsrc_priv_to_props(priv, rtd->num);
 
 	clk_disable_unprepare(dai_props->clk);
@@ -99,7 +89,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *dai;
 	struct snd_soc_dai_link *dai_link;
-	struct rsrc_card_dai *dai_props;
+	struct asoc_simple_dai *dai_props;
 	int num = rtd->num;
 	int ret;
 
@@ -161,7 +151,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 {
 	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
 	struct of_phandle_args args;
 	int ret;
 
@@ -257,7 +247,7 @@ static int rsrc_card_parse_clk(struct device_node *np,
 			       int idx, bool is_fe)
 {
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
 	struct clk *clk;
 	struct device_node *of_np = is_fe ?	dai_link->cpu_of_node :
 						dai_link->codec_of_node;
@@ -294,7 +284,7 @@ static int rsrc_card_dai_sub_link_of(struct device_node *node,
 {
 	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct rsrc_card_dai *dai_props = rsrc_priv_to_props(priv, idx);
+	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
 	int ret;
 
 	ret = rsrc_card_parse_links(np, priv, idx, is_fe);
@@ -361,7 +351,7 @@ static int rsrc_card_parse_of(struct device_node *node,
 			      struct device *dev)
 {
 	const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev);
-	struct rsrc_card_dai *props;
+	struct asoc_simple_dai *props;
 	struct snd_soc_dai_link *links;
 	int ret;
 	int num;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 36/49] ASoC: rsrc-card: use asoc_simple_card_parse_clk()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:01   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:01 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 68 +++++++------------------------------------
 1 file changed, 10 insertions(+), 58 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index fa3f02b..f61eff9 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -187,6 +187,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
+		ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props);
+		if (ret < 0)
+			return ret;
+
 		/*
 		 * In soc_bind_dai_link() will check cpu name after
 		 * of_node matching if dai_link has cpu_dai_name.
@@ -216,6 +220,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
+		ret = asoc_simple_card_parse_clk_codec(np, dai_link, dai_props);
+		if (ret < 0)
+			return ret;
+
 		/* additional name prefix */
 		if (of_data) {
 			priv->codec_conf.of_node = dai_link->codec_of_node;
@@ -239,68 +247,12 @@ static int rsrc_card_parse_links(struct device_node *np,
 	dai_link->ops			= &rsrc_card_ops;
 	dai_link->init			= rsrc_card_dai_init;
 
-	return 0;
-}
-
-static int rsrc_card_parse_clk(struct device_node *np,
-			       struct rsrc_card_priv *priv,
-			       int idx, bool is_fe)
-{
-	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-	struct clk *clk;
-	struct device_node *of_np = is_fe ?	dai_link->cpu_of_node :
-						dai_link->codec_of_node;
-	u32 val;
-
-	/*
-	 * Parse dai->sysclk come from "clocks = <&xxx>"
-	 * (if system has common clock)
-	 *  or "system-clock-frequency = <xxx>"
-	 *  or device's module clock.
-	 */
-	if (of_property_read_bool(np, "clocks")) {
-		clk = of_clk_get(np, 0);
-		if (IS_ERR(clk))
-			return PTR_ERR(clk);
-
-		dai_props->sysclk = clk_get_rate(clk);
-		dai_props->clk = clk;
-	} else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
-		dai_props->sysclk = val;
-	} else {
-		clk = of_clk_get(of_np, 0);
-		if (!IS_ERR(clk))
-			dai_props->sysclk = clk_get_rate(clk);
-	}
-
-	return 0;
-}
-
-static int rsrc_card_dai_sub_link_of(struct device_node *node,
-				     struct device_node *np,
-				     struct rsrc_card_priv *priv,
-				     int idx, bool is_fe)
-{
-	struct device *dev = rsrc_priv_to_dev(priv);
-	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-	int ret;
-
-	ret = rsrc_card_parse_links(np, priv, idx, is_fe);
-	if (ret < 0)
-		return ret;
-
-	ret = rsrc_card_parse_clk(np, priv, idx, is_fe);
-	if (ret < 0)
-		return ret;
-
 	dev_dbg(dev, "\t%s / %04x / %d\n",
 		dai_link->name,
 		dai_link->dai_fmt,
 		dai_props->sysclk);
 
-	return ret;
+	return 0;
 }
 
 static int rsrc_card_dai_link_of(struct device_node *node,
@@ -337,7 +289,7 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 		if (strcmp(np->name, "cpu") == 0)
 			is_fe = true;
 
-		ret = rsrc_card_dai_sub_link_of(node, np, priv, i, is_fe);
+		ret = rsrc_card_parse_links(np, priv, i, is_fe);
 		if (ret < 0)
 			return ret;
 		i++;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 36/49] ASoC: rsrc-card: use asoc_simple_card_parse_clk()
@ 2016-05-20 10:01   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:01 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 68 +++++++------------------------------------
 1 file changed, 10 insertions(+), 58 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index fa3f02b..f61eff9 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -187,6 +187,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
+		ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props);
+		if (ret < 0)
+			return ret;
+
 		/*
 		 * In soc_bind_dai_link() will check cpu name after
 		 * of_node matching if dai_link has cpu_dai_name.
@@ -216,6 +220,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
+		ret = asoc_simple_card_parse_clk_codec(np, dai_link, dai_props);
+		if (ret < 0)
+			return ret;
+
 		/* additional name prefix */
 		if (of_data) {
 			priv->codec_conf.of_node = dai_link->codec_of_node;
@@ -239,68 +247,12 @@ static int rsrc_card_parse_links(struct device_node *np,
 	dai_link->ops			= &rsrc_card_ops;
 	dai_link->init			= rsrc_card_dai_init;
 
-	return 0;
-}
-
-static int rsrc_card_parse_clk(struct device_node *np,
-			       struct rsrc_card_priv *priv,
-			       int idx, bool is_fe)
-{
-	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-	struct clk *clk;
-	struct device_node *of_np = is_fe ?	dai_link->cpu_of_node :
-						dai_link->codec_of_node;
-	u32 val;
-
-	/*
-	 * Parse dai->sysclk come from "clocks = <&xxx>"
-	 * (if system has common clock)
-	 *  or "system-clock-frequency = <xxx>"
-	 *  or device's module clock.
-	 */
-	if (of_property_read_bool(np, "clocks")) {
-		clk = of_clk_get(np, 0);
-		if (IS_ERR(clk))
-			return PTR_ERR(clk);
-
-		dai_props->sysclk = clk_get_rate(clk);
-		dai_props->clk = clk;
-	} else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
-		dai_props->sysclk = val;
-	} else {
-		clk = of_clk_get(of_np, 0);
-		if (!IS_ERR(clk))
-			dai_props->sysclk = clk_get_rate(clk);
-	}
-
-	return 0;
-}
-
-static int rsrc_card_dai_sub_link_of(struct device_node *node,
-				     struct device_node *np,
-				     struct rsrc_card_priv *priv,
-				     int idx, bool is_fe)
-{
-	struct device *dev = rsrc_priv_to_dev(priv);
-	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-	int ret;
-
-	ret = rsrc_card_parse_links(np, priv, idx, is_fe);
-	if (ret < 0)
-		return ret;
-
-	ret = rsrc_card_parse_clk(np, priv, idx, is_fe);
-	if (ret < 0)
-		return ret;
-
 	dev_dbg(dev, "\t%s / %04x / %d\n",
 		dai_link->name,
 		dai_link->dai_fmt,
 		dai_props->sysclk);
 
-	return ret;
+	return 0;
 }
 
 static int rsrc_card_dai_link_of(struct device_node *node,
@@ -337,7 +289,7 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 		if (strcmp(np->name, "cpu") == 0)
 			is_fe = true;
 
-		ret = rsrc_card_dai_sub_link_of(node, np, priv, i, is_fe);
+		ret = rsrc_card_parse_links(np, priv, i, is_fe);
 		if (ret < 0)
 			return ret;
 		i++;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 37/49] ASoC: rsrc-card: use asoc_simple_card_parse_endpoint()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:02   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:02 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index f61eff9..87f96e8 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -59,6 +59,9 @@ struct rsrc_card_priv {
 #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
 #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i))
 
+#define DAI	"sound-dai"
+#define CELL	"#sound-dai-cells"
+
 static int rsrc_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -152,18 +155,9 @@ static int rsrc_card_parse_links(struct device_node *np,
 	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
 	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-	struct of_phandle_args args;
+	int is_single_links = 0;
 	int ret;
 
-	/*
-	 * Get node via "sound-dai = <&phandle port>"
-	 * it will be used as xxx_of_node on soc_bind_dai_link()
-	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
-	if (ret)
-		return ret;
-
 	/* Parse TDM slot */
 	ret = snd_soc_of_parse_tdm_slot(np,
 					&dai_props->tx_slot_mask,
@@ -182,9 +176,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		/* FE settings */
 		dai_link->dynamic		= 1;
 		dai_link->dpcm_merged_format	= 1;
-		dai_link->cpu_of_node		= args.np;
-		ret = snd_soc_of_get_dai_name(np, &dai_link->cpu_dai_name);
-		if (ret < 0)
+
+		ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL,
+						 &is_single_links);
+		if (ret)
 			return ret;
 
 		ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props);
@@ -200,7 +195,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 		 *	fmt_single_name()
 		 *	fmt_multiple_name()
 		 */
-		if (!args.args_count)
+		if (is_single_links)
 			dai_link->cpu_dai_name = NULL;
 	} else {
 		const struct rsrc_card_of_data *of_data;
@@ -215,8 +210,8 @@ static int rsrc_card_parse_links(struct device_node *np,
 		/* BE settings */
 		dai_link->no_pcm		= 1;
 		dai_link->be_hw_params_fixup	= rsrc_card_be_hw_params_fixup;
-		dai_link->codec_of_node		= args.np;
-		ret = snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
+
+		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
 		if (ret < 0)
 			return ret;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 37/49] ASoC: rsrc-card: use asoc_simple_card_parse_endpoint()
@ 2016-05-20 10:02   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:02 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index f61eff9..87f96e8 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -59,6 +59,9 @@ struct rsrc_card_priv {
 #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
 #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i))
 
+#define DAI	"sound-dai"
+#define CELL	"#sound-dai-cells"
+
 static int rsrc_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -152,18 +155,9 @@ static int rsrc_card_parse_links(struct device_node *np,
 	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
 	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-	struct of_phandle_args args;
+	int is_single_links = 0;
 	int ret;
 
-	/*
-	 * Get node via "sound-dai = <&phandle port>"
-	 * it will be used as xxx_of_node on soc_bind_dai_link()
-	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
-	if (ret)
-		return ret;
-
 	/* Parse TDM slot */
 	ret = snd_soc_of_parse_tdm_slot(np,
 					&dai_props->tx_slot_mask,
@@ -182,9 +176,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		/* FE settings */
 		dai_link->dynamic		= 1;
 		dai_link->dpcm_merged_format	= 1;
-		dai_link->cpu_of_node		= args.np;
-		ret = snd_soc_of_get_dai_name(np, &dai_link->cpu_dai_name);
-		if (ret < 0)
+
+		ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL,
+						 &is_single_links);
+		if (ret)
 			return ret;
 
 		ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props);
@@ -200,7 +195,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 		 *	fmt_single_name()
 		 *	fmt_multiple_name()
 		 */
-		if (!args.args_count)
+		if (is_single_links)
 			dai_link->cpu_dai_name = NULL;
 	} else {
 		const struct rsrc_card_of_data *of_data;
@@ -215,8 +210,8 @@ static int rsrc_card_parse_links(struct device_node *np,
 		/* BE settings */
 		dai_link->no_pcm		= 1;
 		dai_link->be_hw_params_fixup	= rsrc_card_be_hw_params_fixup;
-		dai_link->codec_of_node		= args.np;
-		ret = snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
+
+		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
 		if (ret < 0)
 			return ret;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 38/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_name()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:02   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:02 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 87f96e8..997f745 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -331,9 +331,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 					       "audio-routing");
 	}
 
-	/* Parse the card name from DT */
-	snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-
 	/* sampling rate convert */
 	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
 
@@ -349,8 +346,9 @@ static int rsrc_card_parse_of(struct device_node *node,
 	if (ret < 0)
 		return ret;
 
-	if (!priv->snd_card.name)
-		priv->snd_card.name = priv->snd_card.dai_link->name;
+	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 38/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_name()
@ 2016-05-20 10:02   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:02 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 87f96e8..997f745 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -331,9 +331,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 					       "audio-routing");
 	}
 
-	/* Parse the card name from DT */
-	snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-
 	/* sampling rate convert */
 	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
 
@@ -349,8 +346,9 @@ static int rsrc_card_parse_of(struct device_node *node,
 	if (ret < 0)
 		return ret;
 
-	if (!priv->snd_card.name)
-		priv->snd_card.name = priv->snd_card.dai_link->name;
+	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 39/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:03   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:03 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 997f745..3053f62 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -224,10 +224,11 @@ static int rsrc_card_parse_links(struct device_node *np,
 			priv->codec_conf.of_node = dai_link->codec_of_node;
 			priv->codec_conf.name_prefix = of_data->prefix;
 		} else {
-			snd_soc_of_parse_audio_prefix(&priv->snd_card,
-						      &priv->codec_conf,
-						      dai_link->codec_of_node,
-						      "audio-prefix");
+			ret = asoc_simple_card_parse_card_prefix(&priv->snd_card,
+						dai_link, &priv->codec_conf,
+						"audio-");
+			if (ret < 0)
+				return ret;
 		}
 	}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 39/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix()
@ 2016-05-20 10:03   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:03 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 997f745..3053f62 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -224,10 +224,11 @@ static int rsrc_card_parse_links(struct device_node *np,
 			priv->codec_conf.of_node = dai_link->codec_of_node;
 			priv->codec_conf.name_prefix = of_data->prefix;
 		} else {
-			snd_soc_of_parse_audio_prefix(&priv->snd_card,
-						      &priv->codec_conf,
-						      dai_link->codec_of_node,
-						      "audio-prefix");
+			ret = asoc_simple_card_parse_card_prefix(&priv->snd_card,
+						dai_link, &priv->codec_conf,
+						"audio-");
+			if (ret < 0)
+				return ret;
 		}
 	}
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 40/49] ASoC: rsrc-card: use asoc_simple_card_parse_dpcm()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:03   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:03 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 3053f62..5907fd8 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -168,14 +168,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 		return ret;
 
 	if (is_fe) {
-		/* BE is dummy */
-		dai_link->codec_of_node		= NULL;
-		dai_link->codec_dai_name	= "snd-soc-dummy-dai";
-		dai_link->codec_name		= "snd-soc-dummy";
-
-		/* FE settings */
-		dai_link->dynamic		= 1;
-		dai_link->dpcm_merged_format	= 1;
+		asoc_simple_card_parse_dpcm_fe(dai_link);
 
 		ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL,
 						 &is_single_links);
@@ -202,14 +195,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 
 		of_data = of_device_get_match_data(dev);
 
-		/* FE is dummy */
-		dai_link->cpu_of_node		= NULL;
-		dai_link->cpu_dai_name		= "snd-soc-dummy-dai";
-		dai_link->cpu_name		= "snd-soc-dummy";
-
-		/* BE settings */
-		dai_link->no_pcm		= 1;
-		dai_link->be_hw_params_fixup	= rsrc_card_be_hw_params_fixup;
+		asoc_simple_card_parse_dpcm_be(dai_link, rsrc_card_be_hw_params_fixup);
 
 		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
 		if (ret < 0)
@@ -238,8 +224,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 
 	/* Simple Card assumes platform == cpu */
 	dai_link->platform_of_node	= dai_link->cpu_of_node;
-	dai_link->dpcm_playback		= 1;
-	dai_link->dpcm_capture		= 1;
 	dai_link->ops			= &rsrc_card_ops;
 	dai_link->init			= rsrc_card_dai_init;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 40/49] ASoC: rsrc-card: use asoc_simple_card_parse_dpcm()
@ 2016-05-20 10:03   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:03 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 3053f62..5907fd8 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -168,14 +168,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 		return ret;
 
 	if (is_fe) {
-		/* BE is dummy */
-		dai_link->codec_of_node		= NULL;
-		dai_link->codec_dai_name	= "snd-soc-dummy-dai";
-		dai_link->codec_name		= "snd-soc-dummy";
-
-		/* FE settings */
-		dai_link->dynamic		= 1;
-		dai_link->dpcm_merged_format	= 1;
+		asoc_simple_card_parse_dpcm_fe(dai_link);
 
 		ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL,
 						 &is_single_links);
@@ -202,14 +195,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 
 		of_data = of_device_get_match_data(dev);
 
-		/* FE is dummy */
-		dai_link->cpu_of_node		= NULL;
-		dai_link->cpu_dai_name		= "snd-soc-dummy-dai";
-		dai_link->cpu_name		= "snd-soc-dummy";
-
-		/* BE settings */
-		dai_link->no_pcm		= 1;
-		dai_link->be_hw_params_fixup	= rsrc_card_be_hw_params_fixup;
+		asoc_simple_card_parse_dpcm_be(dai_link, rsrc_card_be_hw_params_fixup);
 
 		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
 		if (ret < 0)
@@ -238,8 +224,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 
 	/* Simple Card assumes platform == cpu */
 	dai_link->platform_of_node	= dai_link->cpu_of_node;
-	dai_link->dpcm_playback		= 1;
-	dai_link->dpcm_capture		= 1;
 	dai_link->ops			= &rsrc_card_ops;
 	dai_link->init			= rsrc_card_dai_init;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 41/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_route()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:04   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 5907fd8..3cec0e8 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -308,33 +308,32 @@ static int rsrc_card_parse_of(struct device_node *node,
 	priv->snd_card.codec_conf		= &priv->codec_conf;
 	priv->snd_card.num_configs		= 1;
 
-	if (of_data) {
-		priv->snd_card.of_dapm_routes		= of_data->routes;
-		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
-	} else {
-		snd_soc_of_parse_audio_routing(&priv->snd_card,
-					       "audio-routing");
-	}
-
 	/* sampling rate convert */
 	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
 
 	/* channels transfer */
 	of_property_read_u32(node, "convert-channels", &priv->convert_channels);
 
-	dev_dbg(dev, "New rsrc-audio-card: %s\n",
-		priv->snd_card.name ? priv->snd_card.name : "");
-	dev_dbg(dev, "SRC : convert_rate     %d\n", priv->convert_rate);
-	dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels);
-
 	ret = rsrc_card_dai_link_of(node, priv);
 	if (ret < 0)
 		return ret;
 
+	if (of_data) {
+		priv->snd_card.of_dapm_routes		= of_data->routes;
+		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
+	} else {
+		asoc_simple_card_parse_card_route(&priv->snd_card, "audio-");
+	}
+
 	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
 	if (ret < 0)
 		return ret;
 
+	dev_dbg(dev, "New rsrc-audio-card: %s\n",
+		priv->snd_card.name ? priv->snd_card.name : "");
+	dev_dbg(dev, "SRC : convert_rate     %d\n", priv->convert_rate);
+	dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels);
+
 	return 0;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 41/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_route()
@ 2016-05-20 10:04   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 5907fd8..3cec0e8 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -308,33 +308,32 @@ static int rsrc_card_parse_of(struct device_node *node,
 	priv->snd_card.codec_conf		= &priv->codec_conf;
 	priv->snd_card.num_configs		= 1;
 
-	if (of_data) {
-		priv->snd_card.of_dapm_routes		= of_data->routes;
-		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
-	} else {
-		snd_soc_of_parse_audio_routing(&priv->snd_card,
-					       "audio-routing");
-	}
-
 	/* sampling rate convert */
 	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
 
 	/* channels transfer */
 	of_property_read_u32(node, "convert-channels", &priv->convert_channels);
 
-	dev_dbg(dev, "New rsrc-audio-card: %s\n",
-		priv->snd_card.name ? priv->snd_card.name : "");
-	dev_dbg(dev, "SRC : convert_rate     %d\n", priv->convert_rate);
-	dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels);
-
 	ret = rsrc_card_dai_link_of(node, priv);
 	if (ret < 0)
 		return ret;
 
+	if (of_data) {
+		priv->snd_card.of_dapm_routes		= of_data->routes;
+		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
+	} else {
+		asoc_simple_card_parse_card_route(&priv->snd_card, "audio-");
+	}
+
 	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
 	if (ret < 0)
 		return ret;
 
+	dev_dbg(dev, "New rsrc-audio-card: %s\n",
+		priv->snd_card.name ? priv->snd_card.name : "");
+	dev_dbg(dev, "SRC : convert_rate     %d\n", priv->convert_rate);
+	dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels);
+
 	return 0;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 42/49] ASoC: rsrc-card: use asoc_simple_card_parse_tdm()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:04   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 3cec0e8..de59a4a 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -158,15 +158,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 	int is_single_links = 0;
 	int ret;
 
-	/* Parse TDM slot */
-	ret = snd_soc_of_parse_tdm_slot(np,
-					&dai_props->tx_slot_mask,
-					&dai_props->rx_slot_mask,
-					&dai_props->slots,
-					&dai_props->slot_width);
-	if (ret)
-		return ret;
-
 	if (is_fe) {
 		asoc_simple_card_parse_dpcm_fe(dai_link);
 
@@ -218,6 +209,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		}
 	}
 
+	ret = asoc_simple_card_parse_tdm(np, dai_props);
+	if (ret < 0)
+		return ret;
+
 	ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
 	if (ret < 0)
 		return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 42/49] ASoC: rsrc-card: use asoc_simple_card_parse_tdm()
@ 2016-05-20 10:04   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:04 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 3cec0e8..de59a4a 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -158,15 +158,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 	int is_single_links = 0;
 	int ret;
 
-	/* Parse TDM slot */
-	ret = snd_soc_of_parse_tdm_slot(np,
-					&dai_props->tx_slot_mask,
-					&dai_props->rx_slot_mask,
-					&dai_props->slots,
-					&dai_props->slot_width);
-	if (ret)
-		return ret;
-
 	if (is_fe) {
 		asoc_simple_card_parse_dpcm_fe(dai_link);
 
@@ -218,6 +209,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		}
 	}
 
+	ret = asoc_simple_card_parse_tdm(np, dai_props);
+	if (ret < 0)
+		return ret;
+
 	ret = asoc_simple_card_parse_dailink_name(dev, dai_link);
 	if (ret < 0)
 		return ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 43/49] ASoC: rsrc-card: use asoc_simple_card_init_dai()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index de59a4a..08fed4c 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -94,7 +94,6 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_dai *dai_props;
 	int num = rtd->num;
-	int ret;
 
 	dai_link	= rsrc_priv_to_link(priv, num);
 	dai_props	= rsrc_priv_to_props(priv, num);
@@ -102,30 +101,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 				rtd->cpu_dai :
 				rtd->codec_dai;
 
-	if (dai_props->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, dai_props->sysclk, 0);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "set_sysclk error\n");
-			goto err;
-		}
-	}
-
-	if (dai_props->slots) {
-		ret = snd_soc_dai_set_tdm_slot(dai,
-					       dai_props->tx_slot_mask,
-					       dai_props->rx_slot_mask,
-					       dai_props->slots,
-					       dai_props->slot_width);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "set_tdm_slot error\n");
-			goto err;
-		}
-	}
-
-	ret = 0;
-
-err:
-	return ret;
+	return asoc_simple_card_init_dai(dai, dai_props);
 }
 
 static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 43/49] ASoC: rsrc-card: use asoc_simple_card_init_dai()
@ 2016-05-20 10:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index de59a4a..08fed4c 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -94,7 +94,6 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_dai *dai_props;
 	int num = rtd->num;
-	int ret;
 
 	dai_link	= rsrc_priv_to_link(priv, num);
 	dai_props	= rsrc_priv_to_props(priv, num);
@@ -102,30 +101,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 				rtd->cpu_dai :
 				rtd->codec_dai;
 
-	if (dai_props->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, dai_props->sysclk, 0);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "set_sysclk error\n");
-			goto err;
-		}
-	}
-
-	if (dai_props->slots) {
-		ret = snd_soc_dai_set_tdm_slot(dai,
-					       dai_props->tx_slot_mask,
-					       dai_props->rx_slot_mask,
-					       dai_props->slots,
-					       dai_props->slot_width);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "set_tdm_slot error\n");
-			goto err;
-		}
-	}
-
-	ret = 0;
-
-err:
-	return ret;
+	return asoc_simple_card_init_dai(dai, dai_props);
 }
 
 static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 44/49] ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 08fed4c..b18f156 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -146,17 +146,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
-		/*
-		 * In soc_bind_dai_link() will check cpu name after
-		 * of_node matching if dai_link has cpu_dai_name.
-		 * but, it will never match if name was created by
-		 * fmt_single_name() remove cpu_dai_name if cpu_args
-		 * was 0. See:
-		 *	fmt_single_name()
-		 *	fmt_multiple_name()
-		 */
-		if (is_single_links)
-			dai_link->cpu_dai_name = NULL;
 	} else {
 		const struct rsrc_card_of_data *of_data;
 
@@ -203,6 +192,11 @@ static int rsrc_card_parse_links(struct device_node *np,
 		dai_link->dai_fmt,
 		dai_props->sysclk);
 
+	ret = asoc_simple_card_canonicalize_cpu(dai_link,
+						is_single_links);
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 44/49] ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu()
@ 2016-05-20 10:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 08fed4c..b18f156 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -146,17 +146,6 @@ static int rsrc_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
-		/*
-		 * In soc_bind_dai_link() will check cpu name after
-		 * of_node matching if dai_link has cpu_dai_name.
-		 * but, it will never match if name was created by
-		 * fmt_single_name() remove cpu_dai_name if cpu_args
-		 * was 0. See:
-		 *	fmt_single_name()
-		 *	fmt_multiple_name()
-		 */
-		if (is_single_links)
-			dai_link->cpu_dai_name = NULL;
 	} else {
 		const struct rsrc_card_of_data *of_data;
 
@@ -203,6 +192,11 @@ static int rsrc_card_parse_links(struct device_node *np,
 		dai_link->dai_fmt,
 		dai_props->sysclk);
 
+	ret = asoc_simple_card_canonicalize_cpu(dai_link,
+						is_single_links);
+	if (ret)
+		return ret;
+
 	return 0;
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 45/49] ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index b18f156..814cdbe 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -182,8 +182,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 	if (ret < 0)
 		return ret;
 
-	/* Simple Card assumes platform == cpu */
-	dai_link->platform_of_node	= dai_link->cpu_of_node;
+	ret = asoc_simple_card_canonicalize_dailink(dai_link);
+	if (ret < 0)
+		return ret;
+
 	dai_link->ops			= &rsrc_card_ops;
 	dai_link->init			= rsrc_card_dai_init;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 45/49] ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
@ 2016-05-20 10:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index b18f156..814cdbe 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -182,8 +182,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 	if (ret < 0)
 		return ret;
 
-	/* Simple Card assumes platform == cpu */
-	dai_link->platform_of_node	= dai_link->cpu_of_node;
+	ret = asoc_simple_card_canonicalize_dailink(dai_link);
+	if (ret < 0)
+		return ret;
+
 	dai_link->ops			= &rsrc_card_ops;
 	dai_link->init			= rsrc_card_dai_init;
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 46/49] ASoC: rsrc-card: use asoc_simple_card_clean_reference()
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:06   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:06 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 814cdbe..6b77152 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -304,21 +304,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int rsrc_card_unref(struct snd_soc_card *card)
-{
-	struct snd_soc_dai_link *dai_link;
-	int num_links;
-
-	for (num_links = 0, dai_link = card->dai_link;
-	     num_links < card->num_links;
-	     num_links++, dai_link++) {
-		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-	}
-	return 0;
-}
-
 static int rsrc_card_probe(struct platform_device *pdev)
 {
 	struct rsrc_card_priv *priv;
@@ -344,7 +329,7 @@ static int rsrc_card_probe(struct platform_device *pdev)
 	if (ret >= 0)
 		return ret;
 err:
-	rsrc_card_unref(&priv->snd_card);
+	asoc_simple_card_clean_reference(&priv->snd_card);
 
 	return ret;
 }
@@ -353,7 +338,7 @@ static int rsrc_card_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
-	return rsrc_card_unref(card);
+	return asoc_simple_card_clean_reference(card);
 }
 
 static struct platform_driver rsrc_card = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 46/49] ASoC: rsrc-card: use asoc_simple_card_clean_reference()
@ 2016-05-20 10:06   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:06 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 814cdbe..6b77152 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -304,21 +304,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int rsrc_card_unref(struct snd_soc_card *card)
-{
-	struct snd_soc_dai_link *dai_link;
-	int num_links;
-
-	for (num_links = 0, dai_link = card->dai_link;
-	     num_links < card->num_links;
-	     num_links++, dai_link++) {
-		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-	}
-	return 0;
-}
-
 static int rsrc_card_probe(struct platform_device *pdev)
 {
 	struct rsrc_card_priv *priv;
@@ -344,7 +329,7 @@ static int rsrc_card_probe(struct platform_device *pdev)
 	if (ret >= 0)
 		return ret;
 err:
-	rsrc_card_unref(&priv->snd_card);
+	asoc_simple_card_clean_reference(&priv->snd_card);
 
 	return ret;
 }
@@ -353,7 +338,7 @@ static int rsrc_card_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
-	return rsrc_card_unref(card);
+	return asoc_simple_card_clean_reference(card);
 }
 
 static struct platform_driver rsrc_card = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 47/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:07   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:07 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rsrc-card which is using DPCM feature was created for Renesas sound.
But not only Renesas, but many SoC can use this driver, because
it is based on simple-card driver.
To use it as more open driver, function prefix rsrc-card should be
renamed to asoc_simple. In order to easy patch review, as 1st step,
this patch renames "rsrc" function prefix to "asoc_simple".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 108 +++++++++++++++++++++---------------------
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 6b77152..6c81b93 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -1,5 +1,5 @@
 /*
- * Renesas Sampling Rate Convert Sound Card for DPCM
+ * ASoC simple DPCM sound card support
  *
  * Copyright (C) 2015 Renesas Solutions Corp.
  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
@@ -19,7 +19,7 @@
 #include <linux/string.h>
 #include <sound/simple_card_core.h>
 
-struct rsrc_card_of_data {
+struct asoc_simple_card_of_data {
 	const char *prefix;
 	const struct snd_soc_dapm_route *routes;
 	int num_routes;
@@ -30,23 +30,23 @@ static const struct snd_soc_dapm_route routes_ssi0_ak4642[] = {
 	{"DAI0 Capture", NULL, "ak4642 Capture"},
 };
 
-static const struct rsrc_card_of_data routes_of_ssi0_ak4642 = {
+static const struct asoc_simple_card_of_data routes_of_ssi0_ak4642 = {
 	.prefix		= "ak4642",
 	.routes		= routes_ssi0_ak4642,
 	.num_routes	= ARRAY_SIZE(routes_ssi0_ak4642),
 };
 
-static const struct of_device_id rsrc_card_of_match[] = {
+static const struct of_device_id asoc_simple_card_of_match[] = {
 	{ .compatible = "renesas,rsrc-card,lager",	.data = &routes_of_ssi0_ak4642 },
 	{ .compatible = "renesas,rsrc-card,koelsch",	.data = &routes_of_ssi0_ak4642 },
 	{ .compatible = "renesas,rsrc-card", },
 	{},
 };
-MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
+MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match);
 
 #define IDX_CPU		0
 #define IDX_CODEC	1
-struct rsrc_card_priv {
+struct asoc_simple_card_priv {
 	struct snd_soc_card snd_card;
 	struct snd_soc_codec_conf codec_conf;
 	struct asoc_simple_dai *dai_props;
@@ -55,48 +55,48 @@ struct rsrc_card_priv {
 	u32 convert_channels;
 };
 
-#define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev)
-#define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
-#define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i))
+#define simple_priv_to_dev(priv) ((priv)->snd_card.dev)
+#define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
+#define simple_priv_to_props(priv, i) ((priv)->dai_props + (i))
 
 #define DAI	"sound-dai"
 #define CELL	"#sound-dai-cells"
 
-static int rsrc_card_startup(struct snd_pcm_substream *substream)
+static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct rsrc_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
+	struct asoc_simple_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct asoc_simple_dai *dai_props =
-		rsrc_priv_to_props(priv, rtd->num);
+		simple_priv_to_props(priv, rtd->num);
 
 	return clk_prepare_enable(dai_props->clk);
 }
 
-static void rsrc_card_shutdown(struct snd_pcm_substream *substream)
+static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct rsrc_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
+	struct asoc_simple_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct asoc_simple_dai *dai_props =
-		rsrc_priv_to_props(priv, rtd->num);
+		simple_priv_to_props(priv, rtd->num);
 
 	clk_disable_unprepare(dai_props->clk);
 }
 
-static struct snd_soc_ops rsrc_card_ops = {
-	.startup = rsrc_card_startup,
-	.shutdown = rsrc_card_shutdown,
+static struct snd_soc_ops asoc_simple_card_ops = {
+	.startup = asoc_simple_card_startup,
+	.shutdown = asoc_simple_card_shutdown,
 };
 
-static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
+static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
-	struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+	struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *dai;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_dai *dai_props;
 	int num = rtd->num;
 
-	dai_link	= rsrc_priv_to_link(priv, num);
-	dai_props	= rsrc_priv_to_props(priv, num);
+	dai_link	= simple_priv_to_link(priv, num);
+	dai_props	= simple_priv_to_props(priv, num);
 	dai		= dai_link->dynamic ?
 				rtd->cpu_dai :
 				rtd->codec_dai;
@@ -104,10 +104,10 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	return asoc_simple_card_init_dai(dai, dai_props);
 }
 
-static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 					struct snd_pcm_hw_params *params)
 {
-	struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+	struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_interval *rate = hw_param_interval(params,
 						      SNDRV_PCM_HW_PARAM_RATE);
 	struct snd_interval *channels = hw_param_interval(params,
@@ -124,13 +124,13 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
-static int rsrc_card_parse_links(struct device_node *np,
-				 struct rsrc_card_priv *priv,
+static int asoc_simple_card_parse_links(struct device_node *np,
+				 struct asoc_simple_card_priv *priv,
 				 int idx, bool is_fe)
 {
-	struct device *dev = rsrc_priv_to_dev(priv);
-	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
+	struct device *dev = simple_priv_to_dev(priv);
+	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
+	struct asoc_simple_dai *dai_props = simple_priv_to_props(priv, idx);
 	int is_single_links = 0;
 	int ret;
 
@@ -147,11 +147,11 @@ static int rsrc_card_parse_links(struct device_node *np,
 			return ret;
 
 	} else {
-		const struct rsrc_card_of_data *of_data;
+		const struct asoc_simple_card_of_data *of_data;
 
 		of_data = of_device_get_match_data(dev);
 
-		asoc_simple_card_parse_dpcm_be(dai_link, rsrc_card_be_hw_params_fixup);
+		asoc_simple_card_parse_dpcm_be(dai_link, asoc_simple_card_be_hw_params_fixup);
 
 		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
 		if (ret < 0)
@@ -186,8 +186,8 @@ static int rsrc_card_parse_links(struct device_node *np,
 	if (ret < 0)
 		return ret;
 
-	dai_link->ops			= &rsrc_card_ops;
-	dai_link->init			= rsrc_card_dai_init;
+	dai_link->ops			= &asoc_simple_card_ops;
+	dai_link->init			= asoc_simple_card_dai_init;
 
 	dev_dbg(dev, "\t%s / %04x / %d\n",
 		dai_link->name,
@@ -202,10 +202,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 	return 0;
 }
 
-static int rsrc_card_dai_link_of(struct device_node *node,
-				 struct rsrc_card_priv *priv)
+static int asoc_simple_card_dai_link_of(struct device_node *node,
+				 struct asoc_simple_card_priv *priv)
 {
-	struct device *dev = rsrc_priv_to_dev(priv);
+	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link;
 	struct device_node *np;
 	unsigned int daifmt = 0;
@@ -215,7 +215,7 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 	/* find 1st codec */
 	i = 0;
 	for_each_child_of_node(node, np) {
-		dai_link = rsrc_priv_to_link(priv, i);
+		dai_link = simple_priv_to_link(priv, i);
 
 		if (strcmp(np->name, "codec") == 0) {
 			ret = asoc_simple_card_parse_daifmt(dev, node, np,
@@ -229,14 +229,14 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 
 	i = 0;
 	for_each_child_of_node(node, np) {
-		dai_link = rsrc_priv_to_link(priv, i);
+		dai_link = simple_priv_to_link(priv, i);
 		dai_link->dai_fmt = daifmt;
 
 		is_fe = false;
 		if (strcmp(np->name, "cpu") == 0)
 			is_fe = true;
 
-		ret = rsrc_card_parse_links(np, priv, i, is_fe);
+		ret = asoc_simple_card_parse_links(np, priv, i, is_fe);
 		if (ret < 0)
 			return ret;
 		i++;
@@ -245,11 +245,11 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 	return 0;
 }
 
-static int rsrc_card_parse_of(struct device_node *node,
-			      struct rsrc_card_priv *priv,
+static int asoc_simple_card_parse_of(struct device_node *node,
+			      struct asoc_simple_card_priv *priv,
 			      struct device *dev)
 {
-	const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev);
+	const struct asoc_simple_card_of_data *of_data = of_device_get_match_data(dev);
 	struct asoc_simple_dai *props;
 	struct snd_soc_dai_link *links;
 	int ret;
@@ -281,7 +281,7 @@ static int rsrc_card_parse_of(struct device_node *node,
 	/* channels transfer */
 	of_property_read_u32(node, "convert-channels", &priv->convert_channels);
 
-	ret = rsrc_card_dai_link_of(node, priv);
+	ret = asoc_simple_card_dai_link_of(node, priv);
 	if (ret < 0)
 		return ret;
 
@@ -304,9 +304,9 @@ static int rsrc_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-static int rsrc_card_probe(struct platform_device *pdev)
+static int asoc_simple_card_probe(struct platform_device *pdev)
 {
-	struct rsrc_card_priv *priv;
+	struct asoc_simple_card_priv *priv;
 	struct device_node *np = pdev->dev.of_node;
 	struct device *dev = &pdev->dev;
 	int ret;
@@ -316,7 +316,7 @@ static int rsrc_card_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	ret = rsrc_card_parse_of(np, priv, dev);
+	ret = asoc_simple_card_parse_of(np, priv, dev);
 	if (ret < 0) {
 		if (ret != -EPROBE_DEFER)
 			dev_err(dev, "parse error %d\n", ret);
@@ -334,25 +334,25 @@ err:
 	return ret;
 }
 
-static int rsrc_card_remove(struct platform_device *pdev)
+static int asoc_simple_card_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
 	return asoc_simple_card_clean_reference(card);
 }
 
-static struct platform_driver rsrc_card = {
+static struct platform_driver asoc_simple_card = {
 	.driver = {
 		.name = "renesas-src-audio-card",
-		.of_match_table = rsrc_card_of_match,
+		.of_match_table = asoc_simple_card_of_match,
 	},
-	.probe = rsrc_card_probe,
-	.remove = rsrc_card_remove,
+	.probe = asoc_simple_card_probe,
+	.remove = asoc_simple_card_remove,
 };
 
-module_platform_driver(rsrc_card);
+module_platform_driver(asoc_simple_card);
 
-MODULE_ALIAS("platform:renesas-src-audio-card");
+MODULE_ALIAS("platform:asoc-simple-dpcm-card");
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Renesas Sampling Rate Convert Sound Card");
+MODULE_DESCRIPTION("ASoC Simple DPCM Sound Card");
 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 47/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1
@ 2016-05-20 10:07   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:07 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rsrc-card which is using DPCM feature was created for Renesas sound.
But not only Renesas, but many SoC can use this driver, because
it is based on simple-card driver.
To use it as more open driver, function prefix rsrc-card should be
renamed to asoc_simple. In order to easy patch review, as 1st step,
this patch renames "rsrc" function prefix to "asoc_simple".

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/rsrc-card.c | 108 +++++++++++++++++++++---------------------
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 6b77152..6c81b93 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -1,5 +1,5 @@
 /*
- * Renesas Sampling Rate Convert Sound Card for DPCM
+ * ASoC simple DPCM sound card support
  *
  * Copyright (C) 2015 Renesas Solutions Corp.
  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
@@ -19,7 +19,7 @@
 #include <linux/string.h>
 #include <sound/simple_card_core.h>
 
-struct rsrc_card_of_data {
+struct asoc_simple_card_of_data {
 	const char *prefix;
 	const struct snd_soc_dapm_route *routes;
 	int num_routes;
@@ -30,23 +30,23 @@ static const struct snd_soc_dapm_route routes_ssi0_ak4642[] = {
 	{"DAI0 Capture", NULL, "ak4642 Capture"},
 };
 
-static const struct rsrc_card_of_data routes_of_ssi0_ak4642 = {
+static const struct asoc_simple_card_of_data routes_of_ssi0_ak4642 = {
 	.prefix		= "ak4642",
 	.routes		= routes_ssi0_ak4642,
 	.num_routes	= ARRAY_SIZE(routes_ssi0_ak4642),
 };
 
-static const struct of_device_id rsrc_card_of_match[] = {
+static const struct of_device_id asoc_simple_card_of_match[] = {
 	{ .compatible = "renesas,rsrc-card,lager",	.data = &routes_of_ssi0_ak4642 },
 	{ .compatible = "renesas,rsrc-card,koelsch",	.data = &routes_of_ssi0_ak4642 },
 	{ .compatible = "renesas,rsrc-card", },
 	{},
 };
-MODULE_DEVICE_TABLE(of, rsrc_card_of_match);
+MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match);
 
 #define IDX_CPU		0
 #define IDX_CODEC	1
-struct rsrc_card_priv {
+struct asoc_simple_card_priv {
 	struct snd_soc_card snd_card;
 	struct snd_soc_codec_conf codec_conf;
 	struct asoc_simple_dai *dai_props;
@@ -55,48 +55,48 @@ struct rsrc_card_priv {
 	u32 convert_channels;
 };
 
-#define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev)
-#define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
-#define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i))
+#define simple_priv_to_dev(priv) ((priv)->snd_card.dev)
+#define simple_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
+#define simple_priv_to_props(priv, i) ((priv)->dai_props + (i))
 
 #define DAI	"sound-dai"
 #define CELL	"#sound-dai-cells"
 
-static int rsrc_card_startup(struct snd_pcm_substream *substream)
+static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct rsrc_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
+	struct asoc_simple_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct asoc_simple_dai *dai_props =
-		rsrc_priv_to_props(priv, rtd->num);
+		simple_priv_to_props(priv, rtd->num);
 
 	return clk_prepare_enable(dai_props->clk);
 }
 
-static void rsrc_card_shutdown(struct snd_pcm_substream *substream)
+static void asoc_simple_card_shutdown(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct rsrc_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
+	struct asoc_simple_card_priv *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct asoc_simple_dai *dai_props =
-		rsrc_priv_to_props(priv, rtd->num);
+		simple_priv_to_props(priv, rtd->num);
 
 	clk_disable_unprepare(dai_props->clk);
 }
 
-static struct snd_soc_ops rsrc_card_ops = {
-	.startup = rsrc_card_startup,
-	.shutdown = rsrc_card_shutdown,
+static struct snd_soc_ops asoc_simple_card_ops = {
+	.startup = asoc_simple_card_startup,
+	.shutdown = asoc_simple_card_shutdown,
 };
 
-static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
+static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
-	struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+	struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *dai;
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_dai *dai_props;
 	int num = rtd->num;
 
-	dai_link	= rsrc_priv_to_link(priv, num);
-	dai_props	= rsrc_priv_to_props(priv, num);
+	dai_link	= simple_priv_to_link(priv, num);
+	dai_props	= simple_priv_to_props(priv, num);
 	dai		= dai_link->dynamic ?
 				rtd->cpu_dai :
 				rtd->codec_dai;
@@ -104,10 +104,10 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	return asoc_simple_card_init_dai(dai, dai_props);
 }
 
-static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 					struct snd_pcm_hw_params *params)
 {
-	struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
+	struct asoc_simple_card_priv *priv = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_interval *rate = hw_param_interval(params,
 						      SNDRV_PCM_HW_PARAM_RATE);
 	struct snd_interval *channels = hw_param_interval(params,
@@ -124,13 +124,13 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
 	return 0;
 }
 
-static int rsrc_card_parse_links(struct device_node *np,
-				 struct rsrc_card_priv *priv,
+static int asoc_simple_card_parse_links(struct device_node *np,
+				 struct asoc_simple_card_priv *priv,
 				 int idx, bool is_fe)
 {
-	struct device *dev = rsrc_priv_to_dev(priv);
-	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
-	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
+	struct device *dev = simple_priv_to_dev(priv);
+	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
+	struct asoc_simple_dai *dai_props = simple_priv_to_props(priv, idx);
 	int is_single_links = 0;
 	int ret;
 
@@ -147,11 +147,11 @@ static int rsrc_card_parse_links(struct device_node *np,
 			return ret;
 
 	} else {
-		const struct rsrc_card_of_data *of_data;
+		const struct asoc_simple_card_of_data *of_data;
 
 		of_data = of_device_get_match_data(dev);
 
-		asoc_simple_card_parse_dpcm_be(dai_link, rsrc_card_be_hw_params_fixup);
+		asoc_simple_card_parse_dpcm_be(dai_link, asoc_simple_card_be_hw_params_fixup);
 
 		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
 		if (ret < 0)
@@ -186,8 +186,8 @@ static int rsrc_card_parse_links(struct device_node *np,
 	if (ret < 0)
 		return ret;
 
-	dai_link->ops			= &rsrc_card_ops;
-	dai_link->init			= rsrc_card_dai_init;
+	dai_link->ops			= &asoc_simple_card_ops;
+	dai_link->init			= asoc_simple_card_dai_init;
 
 	dev_dbg(dev, "\t%s / %04x / %d\n",
 		dai_link->name,
@@ -202,10 +202,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 	return 0;
 }
 
-static int rsrc_card_dai_link_of(struct device_node *node,
-				 struct rsrc_card_priv *priv)
+static int asoc_simple_card_dai_link_of(struct device_node *node,
+				 struct asoc_simple_card_priv *priv)
 {
-	struct device *dev = rsrc_priv_to_dev(priv);
+	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link;
 	struct device_node *np;
 	unsigned int daifmt = 0;
@@ -215,7 +215,7 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 	/* find 1st codec */
 	i = 0;
 	for_each_child_of_node(node, np) {
-		dai_link = rsrc_priv_to_link(priv, i);
+		dai_link = simple_priv_to_link(priv, i);
 
 		if (strcmp(np->name, "codec") == 0) {
 			ret = asoc_simple_card_parse_daifmt(dev, node, np,
@@ -229,14 +229,14 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 
 	i = 0;
 	for_each_child_of_node(node, np) {
-		dai_link = rsrc_priv_to_link(priv, i);
+		dai_link = simple_priv_to_link(priv, i);
 		dai_link->dai_fmt = daifmt;
 
 		is_fe = false;
 		if (strcmp(np->name, "cpu") == 0)
 			is_fe = true;
 
-		ret = rsrc_card_parse_links(np, priv, i, is_fe);
+		ret = asoc_simple_card_parse_links(np, priv, i, is_fe);
 		if (ret < 0)
 			return ret;
 		i++;
@@ -245,11 +245,11 @@ static int rsrc_card_dai_link_of(struct device_node *node,
 	return 0;
 }
 
-static int rsrc_card_parse_of(struct device_node *node,
-			      struct rsrc_card_priv *priv,
+static int asoc_simple_card_parse_of(struct device_node *node,
+			      struct asoc_simple_card_priv *priv,
 			      struct device *dev)
 {
-	const struct rsrc_card_of_data *of_data = of_device_get_match_data(dev);
+	const struct asoc_simple_card_of_data *of_data = of_device_get_match_data(dev);
 	struct asoc_simple_dai *props;
 	struct snd_soc_dai_link *links;
 	int ret;
@@ -281,7 +281,7 @@ static int rsrc_card_parse_of(struct device_node *node,
 	/* channels transfer */
 	of_property_read_u32(node, "convert-channels", &priv->convert_channels);
 
-	ret = rsrc_card_dai_link_of(node, priv);
+	ret = asoc_simple_card_dai_link_of(node, priv);
 	if (ret < 0)
 		return ret;
 
@@ -304,9 +304,9 @@ static int rsrc_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-static int rsrc_card_probe(struct platform_device *pdev)
+static int asoc_simple_card_probe(struct platform_device *pdev)
 {
-	struct rsrc_card_priv *priv;
+	struct asoc_simple_card_priv *priv;
 	struct device_node *np = pdev->dev.of_node;
 	struct device *dev = &pdev->dev;
 	int ret;
@@ -316,7 +316,7 @@ static int rsrc_card_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	ret = rsrc_card_parse_of(np, priv, dev);
+	ret = asoc_simple_card_parse_of(np, priv, dev);
 	if (ret < 0) {
 		if (ret != -EPROBE_DEFER)
 			dev_err(dev, "parse error %d\n", ret);
@@ -334,25 +334,25 @@ err:
 	return ret;
 }
 
-static int rsrc_card_remove(struct platform_device *pdev)
+static int asoc_simple_card_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
 	return asoc_simple_card_clean_reference(card);
 }
 
-static struct platform_driver rsrc_card = {
+static struct platform_driver asoc_simple_card = {
 	.driver = {
 		.name = "renesas-src-audio-card",
-		.of_match_table = rsrc_card_of_match,
+		.of_match_table = asoc_simple_card_of_match,
 	},
-	.probe = rsrc_card_probe,
-	.remove = rsrc_card_remove,
+	.probe = asoc_simple_card_probe,
+	.remove = asoc_simple_card_remove,
 };
 
-module_platform_driver(rsrc_card);
+module_platform_driver(asoc_simple_card);
 
-MODULE_ALIAS("platform:renesas-src-audio-card");
+MODULE_ALIAS("platform:asoc-simple-dpcm-card");
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Renesas Sampling Rate Convert Sound Card");
+MODULE_DESCRIPTION("ASoC Simple DPCM Sound Card");
 MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 48/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:08   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rsrc-card which is using DPCM feature was created for Renesas sound.
But not only Renesas, but many SoC can use this driver, because
it is based on simple-card driver.
To use it as more open driver, rsrc-card should be renamed to
simple-dpcm-card. In order to easy patch review, as 2nd step,
this patch renames compatible from "renesas,rsrc-car" to
"simple-dpcm-audio-card";

rcar-card used specific property, not "simple-audio-card",
but it should be now. Actually, rsrc-card is upstreamed driver,
but noone is using it on upstream. The user is only local,
and it is only me. Thus, there is no compatible break by this patch.
This patch uses "simple-audio-card" prefix.
And it removes rcar-card specifix compatible too.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../bindings/sound/renesas,rsrc-card.txt           | 56 +++++++++---------
 sound/soc/sh/rcar/rsrc-card.c                      | 66 +++++++---------------
 2 files changed, 49 insertions(+), 73 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
index 255ece3..cfdf441 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
@@ -1,38 +1,35 @@
-Renesas Sampling Rate Convert Sound Card:
+ASoC simple DPCM Sound Card
 
-Renesas Sampling Rate Convert Sound Card specifies audio DAI connections of SoC <-> codec.
+Simple-Card specifies audio DAI connections of SoC <-> codec.
 
 Required properties:
 
-- compatible				: "renesas,rsrc-card{,<board>}"
-					  Examples with boards are:
-					    - "renesas,rsrc-card"
-					    - "renesas,rsrc-card,lager"
-					    - "renesas,rsrc-card,koelsch"
+- compatible				: "simple-dpcm-audio-card"
+
 Optional properties:
 
-- card_name				: User specified audio sound card name, one string
+- simple-audio-card,name		: User specified audio sound card name, one string
 					  property.
-- cpu					: CPU   sub-node
-- codec					: CODEC sub-node
+- simple-audio-card,cpu			: CPU   sub-node
+- simple-audio-card,codec		: CODEC sub-node
 
 Optional subnode properties:
 
-- format				: CPU/CODEC common audio format.
+- simple-audio-card,format		: CPU/CODEC common audio format.
 					  "i2s", "right_j", "left_j" , "dsp_a"
 					  "dsp_b", "ac97", "pdm", "msb", "lsb"
-- frame-master				: Indicates dai-link frame master.
+- simple-audio-card,frame-master	: Indicates dai-link frame master.
 					  phandle to a cpu or codec subnode.
-- bitclock-master			: Indicates dai-link bit clock master.
+- simple-audio-card,bitclock-master	: Indicates dai-link bit clock master.
 					  phandle to a cpu or codec subnode.
-- bitclock-inversion			: bool property. Add this if the
+- simple-audio-card,bitclock-inversion	: bool property. Add this if the
 					  dai-link uses bit clock inversion.
-- frame-inversion			: bool property. Add this if the
+- simple-audio-card,frame-inversion	: bool property. Add this if the
 					  dai-link uses frame clock inversion.
-- convert-rate				: platform specified sampling rate convert
-- convert-channels			: platform specified converted channel size (2 - 8 ch)
-- audio-prefix				: see audio-routing
-- audio-routing				: A list of the connections between audio components.
+- simple-audio-card,convert-rate	: platform specified sampling rate convert
+- simple-audio-card,convert-channels	: platform specified converted channel size (2 - 8 ch)
+- simple-audio-card,prefix		: see audio-routing
+- simple-audio-card,routing		: A list of the connections between audio components.
 					  Each entry is a pair of strings, the first being the connection's sink,
 					  the second being the connection's source. Valid names for sources.
 					  use audio-prefix if some components is using same sink/sources naming.
@@ -57,18 +54,25 @@ Optional CPU/CODEC subnodes properties:
 Example
 
 sound {
-	compatible = "renesas,rsrc-card,lager";
+	compatible = "simple-dpcm-audio-card";
+
+	simple-audio-card,name = "rsnd-ak4643";
+	simple-audio-card,format = "left_j";
+	simple-audio-card,format = "left_j";
+	simple-audio-card,bitclock-master = <&sndcodec>;
+	simple-audio-card,frame-master = <&sndcodec>;
+
+	simple-audio-card,convert-rate = <48000>; /* see audio_clk_a */
 
-	card-name = "rsnd-ak4643";
-	format = "left_j";
-	bitclock-master = <&sndcodec>;
-	frame-master = <&sndcodec>;
+	simple-audio-card,prefix = "ak4642";
+	simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
+			"DAI0 Capture", "ak4642 Capture";
 
-	sndcpu: cpu {
+	sndcpu: simple-audio-card,cpu {
 		sound-dai = <&rcar_sound>;
 	};
 
-	sndcodec: codec {
+	sndcodec: simple-audio-card,codec {
 		sound-dai = <&ak4643>;
 		system-clock-frequency = <11289600>;
 	};
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 6c81b93..333642f 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -25,21 +25,8 @@ struct asoc_simple_card_of_data {
 	int num_routes;
 };
 
-static const struct snd_soc_dapm_route routes_ssi0_ak4642[] = {
-	{"ak4642 Playback", NULL, "DAI0 Playback"},
-	{"DAI0 Capture", NULL, "ak4642 Capture"},
-};
-
-static const struct asoc_simple_card_of_data routes_of_ssi0_ak4642 = {
-	.prefix		= "ak4642",
-	.routes		= routes_ssi0_ak4642,
-	.num_routes	= ARRAY_SIZE(routes_ssi0_ak4642),
-};
-
 static const struct of_device_id asoc_simple_card_of_match[] = {
-	{ .compatible = "renesas,rsrc-card,lager",	.data = &routes_of_ssi0_ak4642 },
-	{ .compatible = "renesas,rsrc-card,koelsch",	.data = &routes_of_ssi0_ak4642 },
-	{ .compatible = "renesas,rsrc-card", },
+	{ .compatible = "simple-dpcm-audio-card", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match);
@@ -61,6 +48,7 @@ struct asoc_simple_card_priv {
 
 #define DAI	"sound-dai"
 #define CELL	"#sound-dai-cells"
+#define PREFIX	"simple-audio-card,"
 
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
@@ -147,10 +135,6 @@ static int asoc_simple_card_parse_links(struct device_node *np,
 			return ret;
 
 	} else {
-		const struct asoc_simple_card_of_data *of_data;
-
-		of_data = of_device_get_match_data(dev);
-
 		asoc_simple_card_parse_dpcm_be(dai_link, asoc_simple_card_be_hw_params_fixup);
 
 		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
@@ -161,17 +145,11 @@ static int asoc_simple_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
-		/* additional name prefix */
-		if (of_data) {
-			priv->codec_conf.of_node = dai_link->codec_of_node;
-			priv->codec_conf.name_prefix = of_data->prefix;
-		} else {
-			ret = asoc_simple_card_parse_card_prefix(&priv->snd_card,
-						dai_link, &priv->codec_conf,
-						"audio-");
-			if (ret < 0)
-				return ret;
-		}
+		ret = asoc_simple_card_parse_card_prefix(&priv->snd_card,
+						 dai_link, &priv->codec_conf,
+						 PREFIX);
+		if (ret < 0)
+			return ret;
 	}
 
 	ret = asoc_simple_card_parse_tdm(np, dai_props);
@@ -217,9 +195,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	for_each_child_of_node(node, np) {
 		dai_link = simple_priv_to_link(priv, i);
 
-		if (strcmp(np->name, "codec") == 0) {
+		if (strcmp(np->name, PREFIX "codec") == 0) {
 			ret = asoc_simple_card_parse_daifmt(dev, node, np,
-							    NULL, &daifmt);
+							    PREFIX, &daifmt);
 			if (ret < 0)
 				return ret;
 			break;
@@ -233,7 +211,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		dai_link->dai_fmt = daifmt;
 
 		is_fe = false;
-		if (strcmp(np->name, "cpu") == 0)
+		if (strcmp(np->name, PREFIX "cpu") == 0)
 			is_fe = true;
 
 		ret = asoc_simple_card_parse_links(np, priv, i, is_fe);
@@ -249,7 +227,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 			      struct asoc_simple_card_priv *priv,
 			      struct device *dev)
 {
-	const struct asoc_simple_card_of_data *of_data = of_device_get_match_data(dev);
 	struct asoc_simple_dai *props;
 	struct snd_soc_dai_link *links;
 	int ret;
@@ -276,30 +253,25 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	priv->snd_card.num_configs		= 1;
 
 	/* sampling rate convert */
-	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
+	of_property_read_u32(node, PREFIX "convert-rate", &priv->convert_rate);
 
 	/* channels transfer */
-	of_property_read_u32(node, "convert-channels", &priv->convert_channels);
+	of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels);
 
 	ret = asoc_simple_card_dai_link_of(node, priv);
 	if (ret < 0)
 		return ret;
 
-	if (of_data) {
-		priv->snd_card.of_dapm_routes		= of_data->routes;
-		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
-	} else {
-		asoc_simple_card_parse_card_route(&priv->snd_card, "audio-");
-	}
+	ret = asoc_simple_card_parse_card_route(&priv->snd_card, PREFIX);
+	if (ret < 0)
+		return ret;
 
-	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
+	ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX);
 	if (ret < 0)
 		return ret;
 
-	dev_dbg(dev, "New rsrc-audio-card: %s\n",
-		priv->snd_card.name ? priv->snd_card.name : "");
-	dev_dbg(dev, "SRC : convert_rate     %d\n", priv->convert_rate);
-	dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels);
+	dev_dbg(dev, "convert_rate     %d\n", priv->convert_rate);
+	dev_dbg(dev, "convert_channels %d\n", priv->convert_channels);
 
 	return 0;
 }
@@ -343,7 +315,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 
 static struct platform_driver asoc_simple_card = {
 	.driver = {
-		.name = "renesas-src-audio-card",
+		.name = "simple-dpcm-audio-card",
 		.of_match_table = asoc_simple_card_of_match,
 	},
 	.probe = asoc_simple_card_probe,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 48/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
@ 2016-05-20 10:08   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rsrc-card which is using DPCM feature was created for Renesas sound.
But not only Renesas, but many SoC can use this driver, because
it is based on simple-card driver.
To use it as more open driver, rsrc-card should be renamed to
simple-dpcm-card. In order to easy patch review, as 2nd step,
this patch renames compatible from "renesas,rsrc-car" to
"simple-dpcm-audio-card";

rcar-card used specific property, not "simple-audio-card",
but it should be now. Actually, rsrc-card is upstreamed driver,
but noone is using it on upstream. The user is only local,
and it is only me. Thus, there is no compatible break by this patch.
This patch uses "simple-audio-card" prefix.
And it removes rcar-card specifix compatible too.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../bindings/sound/renesas,rsrc-card.txt           | 56 +++++++++---------
 sound/soc/sh/rcar/rsrc-card.c                      | 66 +++++++---------------
 2 files changed, 49 insertions(+), 73 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
index 255ece3..cfdf441 100644
--- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
+++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
@@ -1,38 +1,35 @@
-Renesas Sampling Rate Convert Sound Card:
+ASoC simple DPCM Sound Card
 
-Renesas Sampling Rate Convert Sound Card specifies audio DAI connections of SoC <-> codec.
+Simple-Card specifies audio DAI connections of SoC <-> codec.
 
 Required properties:
 
-- compatible				: "renesas,rsrc-card{,<board>}"
-					  Examples with boards are:
-					    - "renesas,rsrc-card"
-					    - "renesas,rsrc-card,lager"
-					    - "renesas,rsrc-card,koelsch"
+- compatible				: "simple-dpcm-audio-card"
+
 Optional properties:
 
-- card_name				: User specified audio sound card name, one string
+- simple-audio-card,name		: User specified audio sound card name, one string
 					  property.
-- cpu					: CPU   sub-node
-- codec					: CODEC sub-node
+- simple-audio-card,cpu			: CPU   sub-node
+- simple-audio-card,codec		: CODEC sub-node
 
 Optional subnode properties:
 
-- format				: CPU/CODEC common audio format.
+- simple-audio-card,format		: CPU/CODEC common audio format.
 					  "i2s", "right_j", "left_j" , "dsp_a"
 					  "dsp_b", "ac97", "pdm", "msb", "lsb"
-- frame-master				: Indicates dai-link frame master.
+- simple-audio-card,frame-master	: Indicates dai-link frame master.
 					  phandle to a cpu or codec subnode.
-- bitclock-master			: Indicates dai-link bit clock master.
+- simple-audio-card,bitclock-master	: Indicates dai-link bit clock master.
 					  phandle to a cpu or codec subnode.
-- bitclock-inversion			: bool property. Add this if the
+- simple-audio-card,bitclock-inversion	: bool property. Add this if the
 					  dai-link uses bit clock inversion.
-- frame-inversion			: bool property. Add this if the
+- simple-audio-card,frame-inversion	: bool property. Add this if the
 					  dai-link uses frame clock inversion.
-- convert-rate				: platform specified sampling rate convert
-- convert-channels			: platform specified converted channel size (2 - 8 ch)
-- audio-prefix				: see audio-routing
-- audio-routing				: A list of the connections between audio components.
+- simple-audio-card,convert-rate	: platform specified sampling rate convert
+- simple-audio-card,convert-channels	: platform specified converted channel size (2 - 8 ch)
+- simple-audio-card,prefix		: see audio-routing
+- simple-audio-card,routing		: A list of the connections between audio components.
 					  Each entry is a pair of strings, the first being the connection's sink,
 					  the second being the connection's source. Valid names for sources.
 					  use audio-prefix if some components is using same sink/sources naming.
@@ -57,18 +54,25 @@ Optional CPU/CODEC subnodes properties:
 Example
 
 sound {
-	compatible = "renesas,rsrc-card,lager";
+	compatible = "simple-dpcm-audio-card";
+
+	simple-audio-card,name = "rsnd-ak4643";
+	simple-audio-card,format = "left_j";
+	simple-audio-card,format = "left_j";
+	simple-audio-card,bitclock-master = <&sndcodec>;
+	simple-audio-card,frame-master = <&sndcodec>;
+
+	simple-audio-card,convert-rate = <48000>; /* see audio_clk_a */
 
-	card-name = "rsnd-ak4643";
-	format = "left_j";
-	bitclock-master = <&sndcodec>;
-	frame-master = <&sndcodec>;
+	simple-audio-card,prefix = "ak4642";
+	simple-audio-card,routing = "ak4642 Playback", "DAI0 Playback",
+			"DAI0 Capture", "ak4642 Capture";
 
-	sndcpu: cpu {
+	sndcpu: simple-audio-card,cpu {
 		sound-dai = <&rcar_sound>;
 	};
 
-	sndcodec: codec {
+	sndcodec: simple-audio-card,codec {
 		sound-dai = <&ak4643>;
 		system-clock-frequency = <11289600>;
 	};
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 6c81b93..333642f 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -25,21 +25,8 @@ struct asoc_simple_card_of_data {
 	int num_routes;
 };
 
-static const struct snd_soc_dapm_route routes_ssi0_ak4642[] = {
-	{"ak4642 Playback", NULL, "DAI0 Playback"},
-	{"DAI0 Capture", NULL, "ak4642 Capture"},
-};
-
-static const struct asoc_simple_card_of_data routes_of_ssi0_ak4642 = {
-	.prefix		= "ak4642",
-	.routes		= routes_ssi0_ak4642,
-	.num_routes	= ARRAY_SIZE(routes_ssi0_ak4642),
-};
-
 static const struct of_device_id asoc_simple_card_of_match[] = {
-	{ .compatible = "renesas,rsrc-card,lager",	.data = &routes_of_ssi0_ak4642 },
-	{ .compatible = "renesas,rsrc-card,koelsch",	.data = &routes_of_ssi0_ak4642 },
-	{ .compatible = "renesas,rsrc-card", },
+	{ .compatible = "simple-dpcm-audio-card", },
 	{},
 };
 MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match);
@@ -61,6 +48,7 @@ struct asoc_simple_card_priv {
 
 #define DAI	"sound-dai"
 #define CELL	"#sound-dai-cells"
+#define PREFIX	"simple-audio-card,"
 
 static int asoc_simple_card_startup(struct snd_pcm_substream *substream)
 {
@@ -147,10 +135,6 @@ static int asoc_simple_card_parse_links(struct device_node *np,
 			return ret;
 
 	} else {
-		const struct asoc_simple_card_of_data *of_data;
-
-		of_data = of_device_get_match_data(dev);
-
 		asoc_simple_card_parse_dpcm_be(dai_link, asoc_simple_card_be_hw_params_fixup);
 
 		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
@@ -161,17 +145,11 @@ static int asoc_simple_card_parse_links(struct device_node *np,
 		if (ret < 0)
 			return ret;
 
-		/* additional name prefix */
-		if (of_data) {
-			priv->codec_conf.of_node = dai_link->codec_of_node;
-			priv->codec_conf.name_prefix = of_data->prefix;
-		} else {
-			ret = asoc_simple_card_parse_card_prefix(&priv->snd_card,
-						dai_link, &priv->codec_conf,
-						"audio-");
-			if (ret < 0)
-				return ret;
-		}
+		ret = asoc_simple_card_parse_card_prefix(&priv->snd_card,
+						 dai_link, &priv->codec_conf,
+						 PREFIX);
+		if (ret < 0)
+			return ret;
 	}
 
 	ret = asoc_simple_card_parse_tdm(np, dai_props);
@@ -217,9 +195,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	for_each_child_of_node(node, np) {
 		dai_link = simple_priv_to_link(priv, i);
 
-		if (strcmp(np->name, "codec") == 0) {
+		if (strcmp(np->name, PREFIX "codec") == 0) {
 			ret = asoc_simple_card_parse_daifmt(dev, node, np,
-							    NULL, &daifmt);
+							    PREFIX, &daifmt);
 			if (ret < 0)
 				return ret;
 			break;
@@ -233,7 +211,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 		dai_link->dai_fmt = daifmt;
 
 		is_fe = false;
-		if (strcmp(np->name, "cpu") == 0)
+		if (strcmp(np->name, PREFIX "cpu") == 0)
 			is_fe = true;
 
 		ret = asoc_simple_card_parse_links(np, priv, i, is_fe);
@@ -249,7 +227,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 			      struct asoc_simple_card_priv *priv,
 			      struct device *dev)
 {
-	const struct asoc_simple_card_of_data *of_data = of_device_get_match_data(dev);
 	struct asoc_simple_dai *props;
 	struct snd_soc_dai_link *links;
 	int ret;
@@ -276,30 +253,25 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	priv->snd_card.num_configs		= 1;
 
 	/* sampling rate convert */
-	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
+	of_property_read_u32(node, PREFIX "convert-rate", &priv->convert_rate);
 
 	/* channels transfer */
-	of_property_read_u32(node, "convert-channels", &priv->convert_channels);
+	of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels);
 
 	ret = asoc_simple_card_dai_link_of(node, priv);
 	if (ret < 0)
 		return ret;
 
-	if (of_data) {
-		priv->snd_card.of_dapm_routes		= of_data->routes;
-		priv->snd_card.num_of_dapm_routes	= of_data->num_routes;
-	} else {
-		asoc_simple_card_parse_card_route(&priv->snd_card, "audio-");
-	}
+	ret = asoc_simple_card_parse_card_route(&priv->snd_card, PREFIX);
+	if (ret < 0)
+		return ret;
 
-	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
+	ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX);
 	if (ret < 0)
 		return ret;
 
-	dev_dbg(dev, "New rsrc-audio-card: %s\n",
-		priv->snd_card.name ? priv->snd_card.name : "");
-	dev_dbg(dev, "SRC : convert_rate     %d\n", priv->convert_rate);
-	dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels);
+	dev_dbg(dev, "convert_rate     %d\n", priv->convert_rate);
+	dev_dbg(dev, "convert_channels %d\n", priv->convert_channels);
 
 	return 0;
 }
@@ -343,7 +315,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 
 static struct platform_driver asoc_simple_card = {
 	.driver = {
-		.name = "renesas-src-audio-card",
+		.name = "simple-dpcm-audio-card",
 		.of_match_table = asoc_simple_card_of_match,
 	},
 	.probe = asoc_simple_card_probe,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 49/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3
  2016-05-20  9:36 ` Kuninori Morimoto
@ 2016-05-20 10:09   ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rsrc-card which is using DPCM feature was created for Renesas sound.
But not only Renesas, but many SoC can use this driver, because
it is based on simple-card driver.
To use it as more open driver, rsrc-card should be renamed to
simple-dpcm-card. In order to easy patch review, as 3rd step,
this patch moves rsrc-card driver to generic folder.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../bindings/sound/{renesas,rsrc-card.txt => simple-dpcm-card.txt}  | 0
 sound/soc/generic/Kconfig                                           | 6 ++++++
 sound/soc/generic/Makefile                                          | 2 ++
 sound/soc/{sh/rcar/rsrc-card.c => generic/simple-dpcm-card.c}       | 0
 sound/soc/sh/Kconfig                                                | 6 ------
 sound/soc/sh/rcar/Makefile                                          | 3 ---
 6 files changed, 8 insertions(+), 9 deletions(-)
 rename Documentation/devicetree/bindings/sound/{renesas,rsrc-card.txt => simple-dpcm-card.txt} (100%)
 rename sound/soc/{sh/rcar/rsrc-card.c => generic/simple-dpcm-card.c} (100%)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/simple-dpcm-card.txt
similarity index 100%
rename from Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
rename to Documentation/devicetree/bindings/sound/simple-dpcm-card.txt
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 441fc9f..fbba1e6 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -6,3 +6,9 @@ config SND_SIMPLE_CARD
 	select SND_SIMPLE_CARD_CORE
 	help
 	  This option enables generic simple sound card support
+
+config SND_SIMPLE_DPCM_CARD
+	tristate "ASoC Simple DPCM sound card support"
+	select SND_SIMPLE_CARD_CORE
+	help
+	  This option enables generic simple DPCM sound card support
diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile
index d8a982d..a5f0e4d 100644
--- a/sound/soc/generic/Makefile
+++ b/sound/soc/generic/Makefile
@@ -1,5 +1,7 @@
 obj-$(CONFIG_SND_SIMPLE_CARD_CORE) := simple-card-core.o
 
 snd-soc-simple-card-objs	:= simple-card.o
+snd-soc-simple-dpcm-card-objs	:= simple-dpcm-card.o
 
 obj-$(CONFIG_SND_SIMPLE_CARD)	+= snd-soc-simple-card.o
+obj-$(CONFIG_SND_SIMPLE_DPCM_CARD)	+= snd-soc-simple-dpcm-card.o
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/generic/simple-dpcm-card.c
similarity index 100%
rename from sound/soc/sh/rcar/rsrc-card.c
rename to sound/soc/generic/simple-dpcm-card.c
diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig
index d34d5ed..6db6405 100644
--- a/sound/soc/sh/Kconfig
+++ b/sound/soc/sh/Kconfig
@@ -42,12 +42,6 @@ config SND_SOC_RCAR
 	help
 	  This option enables R-Car SRU/SCU/SSIU/SSI sound support
 
-config SND_SOC_RSRC_CARD
-	tristate "Renesas Sampling Rate Convert Sound Card"
-	select SND_SIMPLE_CARD_CORE
-	help
-	  This option enables simple sound if you need sampling rate convert
-
 ##
 ## Boards
 ##
diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index a89ddf7..9c3d5ae 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,5 +1,2 @@
 snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o ssiu.o src.o ctu.o mix.o dvc.o cmd.o
 obj-$(CONFIG_SND_SOC_RCAR)	+= snd-soc-rcar.o
-
-snd-soc-rsrc-card-objs	:= rsrc-card.o
-obj-$(CONFIG_SND_SOC_RSRC_CARD)	+= snd-soc-rsrc-card.o
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* [PATCH 49/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3
@ 2016-05-20 10:09   ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-20 10:09 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

rsrc-card which is using DPCM feature was created for Renesas sound.
But not only Renesas, but many SoC can use this driver, because
it is based on simple-card driver.
To use it as more open driver, rsrc-card should be renamed to
simple-dpcm-card. In order to easy patch review, as 3rd step,
this patch moves rsrc-card driver to generic folder.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 .../bindings/sound/{renesas,rsrc-card.txt => simple-dpcm-card.txt}  | 0
 sound/soc/generic/Kconfig                                           | 6 ++++++
 sound/soc/generic/Makefile                                          | 2 ++
 sound/soc/{sh/rcar/rsrc-card.c => generic/simple-dpcm-card.c}       | 0
 sound/soc/sh/Kconfig                                                | 6 ------
 sound/soc/sh/rcar/Makefile                                          | 3 ---
 6 files changed, 8 insertions(+), 9 deletions(-)
 rename Documentation/devicetree/bindings/sound/{renesas,rsrc-card.txt => simple-dpcm-card.txt} (100%)
 rename sound/soc/{sh/rcar/rsrc-card.c => generic/simple-dpcm-card.c} (100%)

diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/simple-dpcm-card.txt
similarity index 100%
rename from Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt
rename to Documentation/devicetree/bindings/sound/simple-dpcm-card.txt
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig
index 441fc9f..fbba1e6 100644
--- a/sound/soc/generic/Kconfig
+++ b/sound/soc/generic/Kconfig
@@ -6,3 +6,9 @@ config SND_SIMPLE_CARD
 	select SND_SIMPLE_CARD_CORE
 	help
 	  This option enables generic simple sound card support
+
+config SND_SIMPLE_DPCM_CARD
+	tristate "ASoC Simple DPCM sound card support"
+	select SND_SIMPLE_CARD_CORE
+	help
+	  This option enables generic simple DPCM sound card support
diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile
index d8a982d..a5f0e4d 100644
--- a/sound/soc/generic/Makefile
+++ b/sound/soc/generic/Makefile
@@ -1,5 +1,7 @@
 obj-$(CONFIG_SND_SIMPLE_CARD_CORE) := simple-card-core.o
 
 snd-soc-simple-card-objs	:= simple-card.o
+snd-soc-simple-dpcm-card-objs	:= simple-dpcm-card.o
 
 obj-$(CONFIG_SND_SIMPLE_CARD)	+= snd-soc-simple-card.o
+obj-$(CONFIG_SND_SIMPLE_DPCM_CARD)	+= snd-soc-simple-dpcm-card.o
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/generic/simple-dpcm-card.c
similarity index 100%
rename from sound/soc/sh/rcar/rsrc-card.c
rename to sound/soc/generic/simple-dpcm-card.c
diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig
index d34d5ed..6db6405 100644
--- a/sound/soc/sh/Kconfig
+++ b/sound/soc/sh/Kconfig
@@ -42,12 +42,6 @@ config SND_SOC_RCAR
 	help
 	  This option enables R-Car SRU/SCU/SSIU/SSI sound support
 
-config SND_SOC_RSRC_CARD
-	tristate "Renesas Sampling Rate Convert Sound Card"
-	select SND_SIMPLE_CARD_CORE
-	help
-	  This option enables simple sound if you need sampling rate convert
-
 ##
 ## Boards
 ##
diff --git a/sound/soc/sh/rcar/Makefile b/sound/soc/sh/rcar/Makefile
index a89ddf7..9c3d5ae 100644
--- a/sound/soc/sh/rcar/Makefile
+++ b/sound/soc/sh/rcar/Makefile
@@ -1,5 +1,2 @@
 snd-soc-rcar-objs	:= core.o gen.o dma.o adg.o ssi.o ssiu.o src.o ctu.o mix.o dvc.o cmd.o
 obj-$(CONFIG_SND_SOC_RCAR)	+= snd-soc-rcar.o
-
-snd-soc-rsrc-card-objs	:= rsrc-card.o
-obj-$(CONFIG_SND_SOC_RSRC_CARD)	+= snd-soc-rsrc-card.o
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Re: [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card
  2016-05-20  9:36 ` Kuninori Morimoto
                   ` (50 preceding siblings ...)
  (?)
@ 2016-05-23 10:58 ` Mark Brown
  2016-05-24  5:11     ` Kuninori Morimoto
  -1 siblings, 1 reply; 139+ messages in thread
From: Mark Brown @ 2016-05-23 10:58 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

On Fri, May 20, 2016 at 09:36:53AM +0000, Kuninori Morimoto wrote:

> These are very big patch-set, but basically just cleanup for
> simple-card driver.
> Now, we have simple-card driver, but it is not simple today.
> I would like to cleanup this.

This really is far too big.  Don't worry about it this time but in
future please try to keep patch serieses to a reasonable size, split
them up and send them separately (and not at the same time either).  A
huge stack of patches really does not look good as a reviewer.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card
  2016-05-23 10:58 ` [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card Mark Brown
@ 2016-05-24  5:11     ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-24  5:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > These are very big patch-set, but basically just cleanup for
> > simple-card driver.
> > Now, we have simple-card driver, but it is not simple today.
> > I would like to cleanup this.
> 
> This really is far too big.  Don't worry about it this time but in
> future please try to keep patch serieses to a reasonable size, split
> them up and send them separately (and not at the same time either).  A
> huge stack of patches really does not look good as a reviewer.

I'm sorry about big patch-set, and thanks for your help.
I will do my best in the next time.
My excuse for this time is that I thought that it will be difficult to
understand overall picture if I separated these into small patch-sets.
But yes, big patch-set is difficult to review.

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card
@ 2016-05-24  5:11     ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-24  5:11 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > These are very big patch-set, but basically just cleanup for
> > simple-card driver.
> > Now, we have simple-card driver, but it is not simple today.
> > I would like to cleanup this.
> 
> This really is far too big.  Don't worry about it this time but in
> future please try to keep patch serieses to a reasonable size, split
> them up and send them separately (and not at the same time either).  A
> huge stack of patches really does not look good as a reviewer.

I'm sorry about big patch-set, and thanks for your help.
I will do my best in the next time.
My excuse for this time is that I thought that it will be difficult to
understand overall picture if I separated these into small patch-sets.
But yes, big patch-set is difficult to review.

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 01/49] ASoC: simple-card: remove duplicate header
  2016-05-20  9:38   ` Kuninori Morimoto
  (?)
@ 2016-05-30 16:00   ` Mark Brown
  2016-05-30 23:53       ` Kuninori Morimoto
  -1 siblings, 1 reply; 139+ messages in thread
From: Mark Brown @ 2016-05-30 16:00 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 562 bytes --]

On Fri, May 20, 2016 at 09:38:39AM +0000, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> simple-card.h includes soc.h, and soc.h includes soc-dai.h
> Let's remove these header.

It's not automatically good to remove headers, one common reason for
build breaks is that a file will rely on some header including another
header for an API it uses but then the header will change and the C file
will stop building.  It's better to directly include any headers that
are being used to avoid issues like this.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: remove unused dai_num" to the asoc tree
  2016-05-20  9:39   ` Kuninori Morimoto
@ 2016-05-30 16:01     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-05-30 16:01 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: rsrc-card: remove unused dai_num

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 52fd98bcaf22052fc8946d36b13d5e646b7b41b0 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Fri, 20 May 2016 09:39:55 +0000
Subject: [PATCH] ASoC: rsrc-card: remove unused dai_num

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 1bc7ecfc42a9..b85b5ee5fad4 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -64,7 +64,6 @@ struct rsrc_card_priv {
 	struct snd_soc_codec_conf codec_conf;
 	struct rsrc_card_dai *dai_props;
 	struct snd_soc_dai_link *dai_link;
-	int dai_num;
 	u32 convert_rate;
 	u32 convert_channels;
 };
@@ -418,7 +417,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 
 	priv->dai_props	= props;
 	priv->dai_link	= links;
-	priv->dai_num	= num;
 
 	/* Init snd_soc_card */
 	priv->snd_card.owner			= THIS_MODULE;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: remove unused dai_num" to the asoc tree
@ 2016-05-30 16:01     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-05-30 16:01 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: rsrc-card: remove unused dai_num

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 52fd98bcaf22052fc8946d36b13d5e646b7b41b0 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Fri, 20 May 2016 09:39:55 +0000
Subject: [PATCH] ASoC: rsrc-card: remove unused dai_num

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 1bc7ecfc42a9..b85b5ee5fad4 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -64,7 +64,6 @@ struct rsrc_card_priv {
 	struct snd_soc_codec_conf codec_conf;
 	struct rsrc_card_dai *dai_props;
 	struct snd_soc_dai_link *dai_link;
-	int dai_num;
 	u32 convert_rate;
 	u32 convert_channels;
 };
@@ -418,7 +417,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 
 	priv->dai_props	= props;
 	priv->dai_link	= links;
-	priv->dai_num	= num;
 
 	/* Init snd_soc_card */
 	priv->snd_card.owner			= THIS_MODULE;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Re: [PATCH 05/49] ASoC: add new simple-card-core.c
  2016-05-20  9:42   ` Kuninori Morimoto
  (?)
@ 2016-05-30 16:22   ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-05-30 16:22 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 734 bytes --]

On Fri, May 20, 2016 at 09:42:25AM +0000, Kuninori Morimoto wrote:

> future. Maybe it want to use simple-card like feature / function.
> Because of these background, this patch tries to create
> new simple-card-core, and provides common function to each drivers.
> 1st is asoc_simple_card_parse_daifmt()

This isn't really a core but more helper functions so should probably be
called -utils or something.  In the past we've added helpers to the
core, though this particular one is obviously a bit different as most
machine drivers should be expected to have the formats hard coded into
them - it's not something we'd normally have in the DT since it
shouldn't be varying except in the case of very generic drivers like
simple-card.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
  2016-05-20  9:46   ` Kuninori Morimoto
  (?)
@ 2016-05-30 16:23   ` Mark Brown
  2016-05-31  2:05       ` Kuninori Morimoto
  -1 siblings, 1 reply; 139+ messages in thread
From: Mark Brown @ 2016-05-30 16:23 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 642 bytes --]

On Fri, May 20, 2016 at 09:46:04AM +0000, Kuninori Morimoto wrote:

> +int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
> +					char *prefix)
> +{
> +	struct device_node *np = card->dev->of_node;
> +	char prop[128];
> +	int ret = 0;
> +
> +	snprintf(prop, sizeof(prop), "%swidgets", prefix);
> +
> +	if (of_property_read_bool(np, prop))
> +		ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);

This seems like an extremely thin wrapper around existing core
functionality, shouldn't we just be adding the property check into the
core?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()
  2016-05-20  9:48   ` Kuninori Morimoto
  (?)
@ 2016-05-30 16:47   ` Mark Brown
  2016-05-31  0:17       ` Kuninori Morimoto
  -1 siblings, 1 reply; 139+ messages in thread
From: Mark Brown @ 2016-05-30 16:47 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

On Fri, May 20, 2016 at 09:48:07AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> simple-card like driver is supporting DPCM FE/BE.
> This patch makes this method simple style standard.

DPCM is very much an implementation detail of the current stack,
providing helpers that promote its use doesn't seem like the best idea -
we want to change it for in kernel use going forwards and that's going
to be harder with DPCM.  We should be encouraging bindings that make
DSPs look more like CODECs.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()
  2016-05-20  9:48   ` Kuninori Morimoto
  (?)
@ 2016-05-30 17:14   ` Mark Brown
  2016-05-31  2:08       ` Kuninori Morimoto
  -1 siblings, 1 reply; 139+ messages in thread
From: Mark Brown @ 2016-05-30 17:14 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 455 bytes --]

On Fri, May 20, 2016 at 09:48:38AM +0000, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> simple-card is supporting jack/gpio.
> This patch makes this method simple style standard.

There was some recent discussion about a more complete core binding
for this based on the work that Dylan Reid had been pushing a while ago
- it's not clear that the simple-card binding is great for
generalization here.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Applied "ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()" to the asoc tree
  2016-05-20  9:40   ` Kuninori Morimoto
@ 2016-05-30 17:39     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-05-30 17:39 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5fb9cb165130cdb67fb3ac42b4510ed7677a077d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Fri, 20 May 2016 09:40:41 +0000
Subject: [PATCH] ASoC: simple-card: platform also uses
 asoc_simple_card_sub_parse_of()

In current simple-card, platform is handled as special case,
but, the code is not readable.
This patch makes platform to use asoc_simple_card_sub_parse_of()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 466492b7d4f5..4e39c0fa78c9 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -223,6 +223,9 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	u32 val;
 	int ret;
 
+	if (!np)
+		return 0;
+
 	/*
 	 * Get node via "sound-dai = <&phandle port>"
 	 * it will be used as xxx_of_node on soc_bind_dai_link()
@@ -238,9 +241,14 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 		*args_count = args.args_count;
 
 	/* Get dai->name */
-	ret = snd_soc_of_get_dai_name(np, name);
-	if (ret < 0)
-		return ret;
+	if (name) {
+		ret = snd_soc_of_get_dai_name(np, name);
+		if (ret < 0)
+			return ret;
+	}
+
+	if (!dai)
+		return 0;
 
 	/* Parse TDM slot */
 	ret = snd_soc_of_parse_tdm_slot(np, &dai->tx_slot_mask,
@@ -374,21 +382,20 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_card_sub_parse_of(plat, NULL,
+					    &dai_link->platform_of_node,
+					    NULL, NULL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
 		ret = -EINVAL;
 		goto dai_link_of_err;
 	}
 
-	if (plat) {
-		struct of_phandle_args args;
-
-		ret = of_parse_phandle_with_args(plat, "sound-dai",
-						 "#sound-dai-cells", 0, &args);
-		dai_link->platform_of_node = args.np;
-	} else {
-		/* Assumes platform == cpu */
+	/* Assumes platform == cpu */
+	if (!dai_link->platform_of_node)
 		dai_link->platform_of_node = dai_link->cpu_of_node;
-	}
 
 	/* DAI link name is created from CPU/CODEC dai name */
 	name = devm_kzalloc(dev,
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()" to the asoc tree
@ 2016-05-30 17:39     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-05-30 17:39 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5fb9cb165130cdb67fb3ac42b4510ed7677a077d Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Fri, 20 May 2016 09:40:41 +0000
Subject: [PATCH] ASoC: simple-card: platform also uses
 asoc_simple_card_sub_parse_of()

In current simple-card, platform is handled as special case,
but, the code is not readable.
This patch makes platform to use asoc_simple_card_sub_parse_of()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 466492b7d4f5..4e39c0fa78c9 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -223,6 +223,9 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	u32 val;
 	int ret;
 
+	if (!np)
+		return 0;
+
 	/*
 	 * Get node via "sound-dai = <&phandle port>"
 	 * it will be used as xxx_of_node on soc_bind_dai_link()
@@ -238,9 +241,14 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 		*args_count = args.args_count;
 
 	/* Get dai->name */
-	ret = snd_soc_of_get_dai_name(np, name);
-	if (ret < 0)
-		return ret;
+	if (name) {
+		ret = snd_soc_of_get_dai_name(np, name);
+		if (ret < 0)
+			return ret;
+	}
+
+	if (!dai)
+		return 0;
 
 	/* Parse TDM slot */
 	ret = snd_soc_of_parse_tdm_slot(np, &dai->tx_slot_mask,
@@ -374,21 +382,20 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_card_sub_parse_of(plat, NULL,
+					    &dai_link->platform_of_node,
+					    NULL, NULL);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
 		ret = -EINVAL;
 		goto dai_link_of_err;
 	}
 
-	if (plat) {
-		struct of_phandle_args args;
-
-		ret = of_parse_phandle_with_args(plat, "sound-dai",
-						 "#sound-dai-cells", 0, &args);
-		dai_link->platform_of_node = args.np;
-	} else {
-		/* Assumes platform == cpu */
+	/* Assumes platform == cpu */
+	if (!dai_link->platform_of_node)
 		dai_link->platform_of_node = dai_link->cpu_of_node;
-	}
 
 	/* DAI link name is created from CPU/CODEC dai name */
 	name = devm_kzalloc(dev,
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Re: [PATCH 01/49] ASoC: simple-card: remove duplicate header
  2016-05-30 16:00   ` Mark Brown
@ 2016-05-30 23:53       ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-30 23:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > simple-card.h includes soc.h, and soc.h includes soc-dai.h
> > Let's remove these header.
> 
> It's not automatically good to remove headers, one common reason for
> build breaks is that a file will rely on some header including another
> header for an API it uses but then the header will change and the C file
> will stop building.  It's better to directly include any headers that
> are being used to avoid issues like this.

OK, fair enough.
Please drop this (and [02/49] ?) patch

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 01/49] ASoC: simple-card: remove duplicate header
@ 2016-05-30 23:53       ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-30 23:53 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > simple-card.h includes soc.h, and soc.h includes soc-dai.h
> > Let's remove these header.
> 
> It's not automatically good to remove headers, one common reason for
> build breaks is that a file will rely on some header including another
> header for an API it uses but then the header will change and the C file
> will stop building.  It's better to directly include any headers that
> are being used to avoid issues like this.

OK, fair enough.
Please drop this (and [02/49] ?) patch

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()
  2016-05-30 16:47   ` Mark Brown
@ 2016-05-31  0:17       ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-31  0:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > simple-card like driver is supporting DPCM FE/BE.
> > This patch makes this method simple style standard.
> 
> DPCM is very much an implementation detail of the current stack,
> providing helpers that promote its use doesn't seem like the best idea -
> we want to change it for in kernel use going forwards and that's going
> to be harder with DPCM.  We should be encouraging bindings that make
> DSPs look more like CODECs.

rsrc-card which is using DPCM is already existing in upstream.
And, sharing code between simple-card <-> rsrc-card (= simple-dpcm-card),
(and expand it to simple-graph-card) is the purpose of this patch-set.

So, I will drop this "DPCM specific helper function" from
simple-card-core (= will be simple-card-util).
But simple-dpcm-card itself is OK. Is this correct ?

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm()
@ 2016-05-31  0:17       ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-31  0:17 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > simple-card like driver is supporting DPCM FE/BE.
> > This patch makes this method simple style standard.
> 
> DPCM is very much an implementation detail of the current stack,
> providing helpers that promote its use doesn't seem like the best idea -
> we want to change it for in kernel use going forwards and that's going
> to be harder with DPCM.  We should be encouraging bindings that make
> DSPs look more like CODECs.

rsrc-card which is using DPCM is already existing in upstream.
And, sharing code between simple-card <-> rsrc-card (= simple-dpcm-card),
(and expand it to simple-graph-card) is the purpose of this patch-set.

So, I will drop this "DPCM specific helper function" from
simple-card-core (= will be simple-card-util).
But simple-dpcm-card itself is OK. Is this correct ?

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
  2016-05-30 16:23   ` Mark Brown
@ 2016-05-31  2:05       ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-31  2:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > +int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
> > +					char *prefix)
> > +{
> > +	struct device_node *np = card->dev->of_node;
> > +	char prop[128];
> > +	int ret = 0;
> > +
> > +	snprintf(prop, sizeof(prop), "%swidgets", prefix);
> > +
> > +	if (of_property_read_bool(np, prop))
> > +		ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
> > +
> > +	return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
> 
> This seems like an extremely thin wrapper around existing core
> functionality, shouldn't we just be adding the property check into the
> core?

OK, will do in v2

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
@ 2016-05-31  2:05       ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-31  2:05 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > +int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
> > +					char *prefix)
> > +{
> > +	struct device_node *np = card->dev->of_node;
> > +	char prop[128];
> > +	int ret = 0;
> > +
> > +	snprintf(prop, sizeof(prop), "%swidgets", prefix);
> > +
> > +	if (of_property_read_bool(np, prop))
> > +		ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
> > +
> > +	return ret;
> > +}
> > +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
> 
> This seems like an extremely thin wrapper around existing core
> functionality, shouldn't we just be adding the property check into the
> core?

OK, will do in v2

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()
  2016-05-30 17:14   ` Mark Brown
@ 2016-05-31  2:08       ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-31  2:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > simple-card is supporting jack/gpio.
> > This patch makes this method simple style standard.
> 
> There was some recent discussion about a more complete core binding
> for this based on the work that Dylan Reid had been pushing a while ago
> - it's not clear that the simple-card binding is great for
> generalization here.

Can you show me where can I see it ?
Anyway, I will keep this related function as static in simple-card,
not simple-card-utils in v2.

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()
@ 2016-05-31  2:08       ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-31  2:08 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark

> > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> > 
> > simple-card is supporting jack/gpio.
> > This patch makes this method simple style standard.
> 
> There was some recent discussion about a more complete core binding
> for this based on the work that Dylan Reid had been pushing a while ago
> - it's not clear that the simple-card binding is great for
> generalization here.

Can you show me where can I see it ?
Anyway, I will keep this related function as static in simple-card,
not simple-card-utils in v2.

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
  2016-05-31  2:05       ` Kuninori Morimoto
@ 2016-05-31  2:19         ` Kuninori Morimoto
  -1 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-31  2:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark, again

> > > +int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
> > > +					char *prefix)
> > > +{
> > > +	struct device_node *np = card->dev->of_node;
> > > +	char prop[128];
> > > +	int ret = 0;
> > > +
> > > +	snprintf(prop, sizeof(prop), "%swidgets", prefix);
> > > +
> > > +	if (of_property_read_bool(np, prop))
> > > +		ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
> > > +
> > > +	return ret;
> > > +}
> > > +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
> > 
> > This seems like an extremely thin wrapper around existing core
> > functionality, shouldn't we just be adding the property check into the
> > core?
> 
> OK, will do in v2

This, and asoc_simple_card_parse_card_route() (= _route) had same concept.
(_widgets user is only simple-card...)
Many drivers are using _route function, and almost all drivers are expecting
that it will be error if DT doesn't have its property.
But, above helper is tring to parse it, and it is not error if DT doesn't have it.
I will put these 2 helper in soc-core.c, as _try_ function in v2.

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 11/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets()
@ 2016-05-31  2:19         ` Kuninori Morimoto
  0 siblings, 0 replies; 139+ messages in thread
From: Kuninori Morimoto @ 2016-05-31  2:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc


Hi Mark, again

> > > +int asoc_simple_card_parse_card_widgets(struct snd_soc_card *card,
> > > +					char *prefix)
> > > +{
> > > +	struct device_node *np = card->dev->of_node;
> > > +	char prop[128];
> > > +	int ret = 0;
> > > +
> > > +	snprintf(prop, sizeof(prop), "%swidgets", prefix);
> > > +
> > > +	if (of_property_read_bool(np, prop))
> > > +		ret = snd_soc_of_parse_audio_simple_widgets(card, prop);
> > > +
> > > +	return ret;
> > > +}
> > > +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_widgets);
> > 
> > This seems like an extremely thin wrapper around existing core
> > functionality, shouldn't we just be adding the property check into the
> > core?
> 
> OK, will do in v2

This, and asoc_simple_card_parse_card_route() (= _route) had same concept.
(_widgets user is only simple-card...)
Many drivers are using _route function, and almost all drivers are expecting
that it will be error if DT doesn't have its property.
But, above helper is tring to parse it, and it is not error if DT doesn't have it.
I will put these 2 helper in soc-core.c, as _try_ function in v2.

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Re: [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack()
  2016-05-31  2:08       ` Kuninori Morimoto
  (?)
@ 2016-05-31 14:51       ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-05-31 14:51 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, Liam Girdwood, Simon, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

On Tue, May 31, 2016 at 02:08:31AM +0000, Kuninori Morimoto wrote:

> > There was some recent discussion about a more complete core binding
> > for this based on the work that Dylan Reid had been pushing a while ago
> > - it's not clear that the simple-card binding is great for
> > generalization here.

> Can you show me where can I see it ?
> Anyway, I will keep this related function as static in simple-card,
> not simple-card-utils in v2.

This is the proposal from Dylan I was thinking of:

   http://thread.gmane.org/gmane.linux.alsa.devel/138906

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: use asoc_simple_card_parse_card_name()" to the asoc tree
  2016-05-20 10:02   ` Kuninori Morimoto
@ 2016-07-16 12:05     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-07-16 12:05 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: rsrc-card: use asoc_simple_card_parse_card_name()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 53ae918f117dbb86e7b872e3b7532839f752c895 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 12 Jul 2016 00:00:00 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_parse_card_name()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 239a13a30bed..fa37f842b62f 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -395,9 +395,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 					       "audio-routing");
 	}
 
-	/* Parse the card name from DT */
-	snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-
 	/* sampling rate convert */
 	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
 
@@ -413,8 +410,9 @@ static int rsrc_card_parse_of(struct device_node *node,
 	if (ret < 0)
 		return ret;
 
-	if (!priv->snd_card.name)
-		priv->snd_card.name = priv->snd_card.dai_link->name;
+	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: use asoc_simple_card_parse_card_name()" to the asoc tree
@ 2016-07-16 12:05     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-07-16 12:05 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: rsrc-card: use asoc_simple_card_parse_card_name()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 53ae918f117dbb86e7b872e3b7532839f752c895 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 12 Jul 2016 00:00:00 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_parse_card_name()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 239a13a30bed..fa37f842b62f 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -395,9 +395,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 					       "audio-routing");
 	}
 
-	/* Parse the card name from DT */
-	snd_soc_of_parse_card_name(&priv->snd_card, "card-name");
-
 	/* sampling rate convert */
 	of_property_read_u32(node, "convert-rate", &priv->convert_rate);
 
@@ -413,8 +410,9 @@ static int rsrc_card_parse_of(struct device_node *node,
 	if (ret < 0)
 		return ret;
 
-	if (!priv->snd_card.name)
-		priv->snd_card.name = priv->snd_card.dai_link->name;
+	ret = asoc_simple_card_parse_card_name(&priv->snd_card, "card-");
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: simple-card: use asoc_simple_card_parse_clk()" to the asoc tree
  2016-05-20  9:51   ` Kuninori Morimoto
@ 2016-08-05 12:09     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-05 12:09 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: simple-card: use asoc_simple_card_parse_clk()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 28abd99b6e40741cd0e75be20817f23a3044d338 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 19 Jul 2016 02:53:13 +0000
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_parse_clk()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 43295f024982..b37c81b09203 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -244,8 +244,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      int *args_count)
 {
 	struct of_phandle_args args;
-	struct clk *clk;
-	u32 val;
 	int ret;
 
 	if (!np)
@@ -282,29 +280,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	if (ret)
 		return ret;
 
-	/*
-	 * Parse dai->sysclk come from "clocks = <&xxx>"
-	 * (if system has common clock)
-	 *  or "system-clock-frequency = <xxx>"
-	 *  or device's module clock.
-	 */
-	if (of_property_read_bool(np, "clocks")) {
-		clk = of_clk_get(np, 0);
-		if (IS_ERR(clk)) {
-			ret = PTR_ERR(clk);
-			return ret;
-		}
-
-		dai->sysclk = clk_get_rate(clk);
-		dai->clk = clk;
-	} else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
-		dai->sysclk = val;
-	} else {
-		clk = of_clk_get(args.np, 0);
-		if (!IS_ERR(clk))
-			dai->sysclk = clk_get_rate(clk);
-	}
-
 	return 0;
 }
 
@@ -316,6 +291,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
 	struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
+	struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai;
+	struct asoc_simple_dai *codec_dai = &dai_props->codec_dai;
 	struct device_node *cpu = NULL;
 	struct device_node *plat = NULL;
 	struct device_node *codec = NULL;
@@ -370,6 +347,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
 		ret = -EINVAL;
 		goto dai_link_of_err;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: simple-card: use asoc_simple_card_parse_clk()" to the asoc tree
@ 2016-08-05 12:09     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-05 12:09 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: simple-card: use asoc_simple_card_parse_clk()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 28abd99b6e40741cd0e75be20817f23a3044d338 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 19 Jul 2016 02:53:13 +0000
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_parse_clk()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 35 ++++++++++-------------------------
 1 file changed, 10 insertions(+), 25 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 43295f024982..b37c81b09203 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -244,8 +244,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 			      int *args_count)
 {
 	struct of_phandle_args args;
-	struct clk *clk;
-	u32 val;
 	int ret;
 
 	if (!np)
@@ -282,29 +280,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np,
 	if (ret)
 		return ret;
 
-	/*
-	 * Parse dai->sysclk come from "clocks = <&xxx>"
-	 * (if system has common clock)
-	 *  or "system-clock-frequency = <xxx>"
-	 *  or device's module clock.
-	 */
-	if (of_property_read_bool(np, "clocks")) {
-		clk = of_clk_get(np, 0);
-		if (IS_ERR(clk)) {
-			ret = PTR_ERR(clk);
-			return ret;
-		}
-
-		dai->sysclk = clk_get_rate(clk);
-		dai->clk = clk;
-	} else if (!of_property_read_u32(np, "system-clock-frequency", &val)) {
-		dai->sysclk = val;
-	} else {
-		clk = of_clk_get(args.np, 0);
-		if (!IS_ERR(clk))
-			dai->sysclk = clk_get_rate(clk);
-	}
-
 	return 0;
 }
 
@@ -316,6 +291,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	struct device *dev = simple_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx);
 	struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx);
+	struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai;
+	struct asoc_simple_dai *codec_dai = &dai_props->codec_dai;
 	struct device_node *cpu = NULL;
 	struct device_node *plat = NULL;
 	struct device_node *codec = NULL;
@@ -370,6 +347,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
 	if (ret < 0)
 		goto dai_link_of_err;
 
+	ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai);
+	if (ret < 0)
+		goto dai_link_of_err;
+
+	ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai);
+	if (ret < 0)
+		goto dai_link_of_err;
+
 	if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {
 		ret = -EINVAL;
 		goto dai_link_of_err;
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: use asoc_simple_card_parse_dai()" to the asoc tree
  2016-05-20 10:02   ` Kuninori Morimoto
@ 2016-08-08 10:46     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-08 10:46 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: rsrc-card: use asoc_simple_card_parse_dai()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5bbf3866cbc1da23c628ad5dd7248cca8b8adc2c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 8 Aug 2016 06:02:31 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_parse_dai()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index ed5391f41280..82187e00eb12 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -62,6 +62,9 @@ struct rsrc_card_priv {
 #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
 #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i))
 
+#define DAI	"sound-dai"
+#define CELL	"#sound-dai-cells"
+
 static int rsrc_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -155,18 +158,9 @@ static int rsrc_card_parse_links(struct device_node *np,
 	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
 	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-	struct of_phandle_args args;
+	int is_single_links = 0;
 	int ret;
 
-	/*
-	 * Get node via "sound-dai = <&phandle port>"
-	 * it will be used as xxx_of_node on soc_bind_dai_link()
-	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
-	if (ret)
-		return ret;
-
 	/* Parse TDM slot */
 	ret = snd_soc_of_parse_tdm_slot(np,
 					&dai_props->tx_slot_mask,
@@ -185,9 +179,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		/* FE settings */
 		dai_link->dynamic		= 1;
 		dai_link->dpcm_merged_format	= 1;
-		dai_link->cpu_of_node		= args.np;
-		ret = snd_soc_of_get_dai_name(np, &dai_link->cpu_dai_name);
-		if (ret < 0)
+
+		ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL,
+						 &is_single_links);
+		if (ret)
 			return ret;
 
 		ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props);
@@ -209,7 +204,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 		 *	fmt_single_name()
 		 *	fmt_multiple_name()
 		 */
-		if (!args.args_count)
+		if (is_single_links)
 			dai_link->cpu_dai_name = NULL;
 	} else {
 		const struct rsrc_card_of_data *of_data;
@@ -224,8 +219,8 @@ static int rsrc_card_parse_links(struct device_node *np,
 		/* BE settings */
 		dai_link->no_pcm		= 1;
 		dai_link->be_hw_params_fixup	= rsrc_card_be_hw_params_fixup;
-		dai_link->codec_of_node		= args.np;
-		ret = snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
+
+		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
 		if (ret < 0)
 			return ret;
 
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: use asoc_simple_card_parse_dai()" to the asoc tree
@ 2016-08-08 10:46     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-08 10:46 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: rsrc-card: use asoc_simple_card_parse_dai()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 5bbf3866cbc1da23c628ad5dd7248cca8b8adc2c Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Mon, 8 Aug 2016 06:02:31 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_parse_dai()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 27 +++++++++++----------------
 1 file changed, 11 insertions(+), 16 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index ed5391f41280..82187e00eb12 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -62,6 +62,9 @@ struct rsrc_card_priv {
 #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i))
 #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i))
 
+#define DAI	"sound-dai"
+#define CELL	"#sound-dai-cells"
+
 static int rsrc_card_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -155,18 +158,9 @@ static int rsrc_card_parse_links(struct device_node *np,
 	struct device *dev = rsrc_priv_to_dev(priv);
 	struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx);
 	struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx);
-	struct of_phandle_args args;
+	int is_single_links = 0;
 	int ret;
 
-	/*
-	 * Get node via "sound-dai = <&phandle port>"
-	 * it will be used as xxx_of_node on soc_bind_dai_link()
-	 */
-	ret = of_parse_phandle_with_args(np, "sound-dai",
-					 "#sound-dai-cells", 0, &args);
-	if (ret)
-		return ret;
-
 	/* Parse TDM slot */
 	ret = snd_soc_of_parse_tdm_slot(np,
 					&dai_props->tx_slot_mask,
@@ -185,9 +179,10 @@ static int rsrc_card_parse_links(struct device_node *np,
 		/* FE settings */
 		dai_link->dynamic		= 1;
 		dai_link->dpcm_merged_format	= 1;
-		dai_link->cpu_of_node		= args.np;
-		ret = snd_soc_of_get_dai_name(np, &dai_link->cpu_dai_name);
-		if (ret < 0)
+
+		ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL,
+						 &is_single_links);
+		if (ret)
 			return ret;
 
 		ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props);
@@ -209,7 +204,7 @@ static int rsrc_card_parse_links(struct device_node *np,
 		 *	fmt_single_name()
 		 *	fmt_multiple_name()
 		 */
-		if (!args.args_count)
+		if (is_single_links)
 			dai_link->cpu_dai_name = NULL;
 	} else {
 		const struct rsrc_card_of_data *of_data;
@@ -224,8 +219,8 @@ static int rsrc_card_parse_links(struct device_node *np,
 		/* BE settings */
 		dai_link->no_pcm		= 1;
 		dai_link->be_hw_params_fixup	= rsrc_card_be_hw_params_fixup;
-		dai_link->codec_of_node		= args.np;
-		ret = snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name);
+
+		ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL);
 		if (ret < 0)
 			return ret;
 
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: use asoc_simple_card_init_dai()" to the asoc tree
  2016-05-20 10:05   ` Kuninori Morimoto
@ 2016-08-09 12:43     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-09 12:43 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: rsrc-card: use asoc_simple_card_init_dai()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 600ee2085515c03a7a4a6025034fefccf29e5a24 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 9 Aug 2016 05:49:21 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_init_dai()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 82187e00eb12..1bf35634ebba 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -97,7 +97,6 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_dai *dai_props;
 	int num = rtd->num;
-	int ret;
 
 	dai_link	= rsrc_priv_to_link(priv, num);
 	dai_props	= rsrc_priv_to_props(priv, num);
@@ -105,30 +104,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 				rtd->cpu_dai :
 				rtd->codec_dai;
 
-	if (dai_props->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, dai_props->sysclk, 0);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "set_sysclk error\n");
-			goto err;
-		}
-	}
-
-	if (dai_props->slots) {
-		ret = snd_soc_dai_set_tdm_slot(dai,
-					       dai_props->tx_slot_mask,
-					       dai_props->rx_slot_mask,
-					       dai_props->slots,
-					       dai_props->slot_width);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "set_tdm_slot error\n");
-			goto err;
-		}
-	}
-
-	ret = 0;
-
-err:
-	return ret;
+	return asoc_simple_card_init_dai(dai, dai_props);
 }
 
 static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: use asoc_simple_card_init_dai()" to the asoc tree
@ 2016-08-09 12:43     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-09 12:43 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: rsrc-card: use asoc_simple_card_init_dai()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 600ee2085515c03a7a4a6025034fefccf29e5a24 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 9 Aug 2016 05:49:21 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_init_dai()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 26 +-------------------------
 1 file changed, 1 insertion(+), 25 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index 82187e00eb12..1bf35634ebba 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -97,7 +97,6 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 	struct snd_soc_dai_link *dai_link;
 	struct asoc_simple_dai *dai_props;
 	int num = rtd->num;
-	int ret;
 
 	dai_link	= rsrc_priv_to_link(priv, num);
 	dai_props	= rsrc_priv_to_props(priv, num);
@@ -105,30 +104,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 				rtd->cpu_dai :
 				rtd->codec_dai;
 
-	if (dai_props->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, dai_props->sysclk, 0);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "set_sysclk error\n");
-			goto err;
-		}
-	}
-
-	if (dai_props->slots) {
-		ret = snd_soc_dai_set_tdm_slot(dai,
-					       dai_props->tx_slot_mask,
-					       dai_props->rx_slot_mask,
-					       dai_props->slots,
-					       dai_props->slot_width);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "set_tdm_slot error\n");
-			goto err;
-		}
-	}
-
-	ret = 0;
-
-err:
-	return ret;
+	return asoc_simple_card_init_dai(dai, dai_props);
 }
 
 static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: simple-card: use asoc_simple_card_init_dai()" to the asoc tree
  2016-05-20  9:57   ` Kuninori Morimoto
@ 2016-08-09 12:43     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-09 12:43 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: simple-card: use asoc_simple_card_init_dai()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d8cb9354c86dddb1fb67d3f247c9ebbacd6b4c07 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 9 Aug 2016 05:48:53 +0000
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_init_dai()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 99028c190ea3..03ecca85a724 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -179,51 +179,19 @@ static struct snd_soc_ops asoc_simple_card_ops = {
 	.hw_params = asoc_simple_card_hw_params,
 };
 
-static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
-				       struct asoc_simple_dai *set)
-{
-	int ret;
-
-	if (set->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_sysclk error\n");
-			goto err;
-		}
-	}
-
-	if (set->slots) {
-		ret = snd_soc_dai_set_tdm_slot(dai,
-					       set->tx_slot_mask,
-					       set->rx_slot_mask,
-						set->slots,
-						set->slot_width);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
-			goto err;
-		}
-	}
-
-	ret = 0;
-
-err:
-	return ret;
-}
-
 static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *codec = rtd->codec_dai;
 	struct snd_soc_dai *cpu = rtd->cpu_dai;
-	struct simple_dai_props *dai_props;
+	struct simple_dai_props *dai_props = &priv->dai_props[rtd->num];
 	int ret;
 
-	dai_props = &priv->dai_props[rtd->num];
-	ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai);
+	ret = asoc_simple_card_init_dai(codec, &dai_props->codec_dai);
 	if (ret < 0)
 		return ret;
 
-	ret = __asoc_simple_card_dai_init(cpu, &dai_props->cpu_dai);
+	ret = asoc_simple_card_init_dai(cpu, &dai_props->cpu_dai);
 	if (ret < 0)
 		return ret;
 
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: simple-card: use asoc_simple_card_init_dai()" to the asoc tree
@ 2016-08-09 12:43     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-09 12:43 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: simple-card: use asoc_simple_card_init_dai()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From d8cb9354c86dddb1fb67d3f247c9ebbacd6b4c07 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Tue, 9 Aug 2016 05:48:53 +0000
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_init_dai()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 38 +++-----------------------------------
 1 file changed, 3 insertions(+), 35 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 99028c190ea3..03ecca85a724 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -179,51 +179,19 @@ static struct snd_soc_ops asoc_simple_card_ops = {
 	.hw_params = asoc_simple_card_hw_params,
 };
 
-static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai,
-				       struct asoc_simple_dai *set)
-{
-	int ret;
-
-	if (set->sysclk) {
-		ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_sysclk error\n");
-			goto err;
-		}
-	}
-
-	if (set->slots) {
-		ret = snd_soc_dai_set_tdm_slot(dai,
-					       set->tx_slot_mask,
-					       set->rx_slot_mask,
-						set->slots,
-						set->slot_width);
-		if (ret && ret != -ENOTSUPP) {
-			dev_err(dai->dev, "simple-card: set_tdm_slot error\n");
-			goto err;
-		}
-	}
-
-	ret = 0;
-
-err:
-	return ret;
-}
-
 static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct simple_card_data *priv =	snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *codec = rtd->codec_dai;
 	struct snd_soc_dai *cpu = rtd->cpu_dai;
-	struct simple_dai_props *dai_props;
+	struct simple_dai_props *dai_props = &priv->dai_props[rtd->num];
 	int ret;
 
-	dai_props = &priv->dai_props[rtd->num];
-	ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai);
+	ret = asoc_simple_card_init_dai(codec, &dai_props->codec_dai);
 	if (ret < 0)
 		return ret;
 
-	ret = __asoc_simple_card_dai_init(cpu, &dai_props->cpu_dai);
+	ret = asoc_simple_card_init_dai(cpu, &dai_props->cpu_dai);
 	if (ret < 0)
 		return ret;
 
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: use asoc_simple_card_clean_reference()" to the asoc tree
  2016-05-20 10:06   ` Kuninori Morimoto
@ 2016-08-10 20:03     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-10 20:03 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: rsrc-card: use asoc_simple_card_clean_reference()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 239486baee2bbefd81053cd4a168f90ce5c46fa2 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 10 Aug 2016 02:22:01 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_clean_reference()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index dd5eda1f9a29..16dc13e0bec9 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -333,21 +333,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int rsrc_card_unref(struct snd_soc_card *card)
-{
-	struct snd_soc_dai_link *dai_link;
-	int num_links;
-
-	for (num_links = 0, dai_link = card->dai_link;
-	     num_links < card->num_links;
-	     num_links++, dai_link++) {
-		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-	}
-	return 0;
-}
-
 static int rsrc_card_probe(struct platform_device *pdev)
 {
 	struct rsrc_card_priv *priv;
@@ -373,7 +358,7 @@ static int rsrc_card_probe(struct platform_device *pdev)
 	if (ret >= 0)
 		return ret;
 err:
-	rsrc_card_unref(&priv->snd_card);
+	asoc_simple_card_clean_reference(&priv->snd_card);
 
 	return ret;
 }
@@ -382,7 +367,7 @@ static int rsrc_card_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
-	return rsrc_card_unref(card);
+	return asoc_simple_card_clean_reference(card);
 }
 
 static struct platform_driver rsrc_card = {
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: rsrc-card: use asoc_simple_card_clean_reference()" to the asoc tree
@ 2016-08-10 20:03     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-10 20:03 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: rsrc-card: use asoc_simple_card_clean_reference()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 239486baee2bbefd81053cd4a168f90ce5c46fa2 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 10 Aug 2016 02:22:01 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_clean_reference()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/sh/rcar/rsrc-card.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c
index dd5eda1f9a29..16dc13e0bec9 100644
--- a/sound/soc/sh/rcar/rsrc-card.c
+++ b/sound/soc/sh/rcar/rsrc-card.c
@@ -333,21 +333,6 @@ static int rsrc_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int rsrc_card_unref(struct snd_soc_card *card)
-{
-	struct snd_soc_dai_link *dai_link;
-	int num_links;
-
-	for (num_links = 0, dai_link = card->dai_link;
-	     num_links < card->num_links;
-	     num_links++, dai_link++) {
-		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-	}
-	return 0;
-}
-
 static int rsrc_card_probe(struct platform_device *pdev)
 {
 	struct rsrc_card_priv *priv;
@@ -373,7 +358,7 @@ static int rsrc_card_probe(struct platform_device *pdev)
 	if (ret >= 0)
 		return ret;
 err:
-	rsrc_card_unref(&priv->snd_card);
+	asoc_simple_card_clean_reference(&priv->snd_card);
 
 	return ret;
 }
@@ -382,7 +367,7 @@ static int rsrc_card_remove(struct platform_device *pdev)
 {
 	struct snd_soc_card *card = platform_get_drvdata(pdev);
 
-	return rsrc_card_unref(card);
+	return asoc_simple_card_clean_reference(card);
 }
 
 static struct platform_driver rsrc_card = {
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: simple-card: use asoc_simple_card_clean_reference()" to the asoc tree
  2016-05-20  9:58   ` Kuninori Morimoto
@ 2016-08-10 20:03     ` Mark Brown
  -1 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-10 20:03 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Mark Brown, Mark Brown, linux-renesas-soc, Linux-ALSA, Simon,
	Liam Girdwood

The patch

   ASoC: simple-card: use asoc_simple_card_clean_reference()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 885fc0595a3e91ed7b6f78ea419952345be0222b Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 10 Aug 2016 02:21:42 +0000
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_clean_reference()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 64896e361bde..55638a800f20 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -378,21 +378,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int asoc_simple_card_unref(struct snd_soc_card *card)
-{
-	struct snd_soc_dai_link *dai_link;
-	int num_links;
-
-	for (num_links = 0, dai_link = card->dai_link;
-	     num_links < card->num_links;
-	     num_links++, dai_link++) {
-		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-	}
-	return 0;
-}
-
 static int asoc_simple_card_probe(struct platform_device *pdev)
 {
 	struct simple_card_data *priv;
@@ -478,7 +463,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 		return ret;
 
 err:
-	asoc_simple_card_unref(&priv->snd_card);
+	asoc_simple_card_clean_reference(&priv->snd_card);
 	return ret;
 }
 
@@ -490,7 +475,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 	asoc_simple_card_remove_jack(&priv->hp_jack);
 	asoc_simple_card_remove_jack(&priv->mic_jack);
 
-	return asoc_simple_card_unref(card);
+	return asoc_simple_card_clean_reference(card);
 }
 
 static const struct of_device_id asoc_simple_of_match[] = {
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

* Applied "ASoC: simple-card: use asoc_simple_card_clean_reference()" to the asoc tree
@ 2016-08-10 20:03     ` Mark Brown
  0 siblings, 0 replies; 139+ messages in thread
From: Mark Brown @ 2016-08-10 20:03 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Mark Brown

The patch

   ASoC: simple-card: use asoc_simple_card_clean_reference()

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 885fc0595a3e91ed7b6f78ea419952345be0222b Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Wed, 10 Aug 2016 02:21:42 +0000
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_clean_reference()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/generic/simple-card.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 64896e361bde..55638a800f20 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -378,21 +378,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,
 	return 0;
 }
 
-/* Decrease the reference count of the device nodes */
-static int asoc_simple_card_unref(struct snd_soc_card *card)
-{
-	struct snd_soc_dai_link *dai_link;
-	int num_links;
-
-	for (num_links = 0, dai_link = card->dai_link;
-	     num_links < card->num_links;
-	     num_links++, dai_link++) {
-		of_node_put(dai_link->cpu_of_node);
-		of_node_put(dai_link->codec_of_node);
-	}
-	return 0;
-}
-
 static int asoc_simple_card_probe(struct platform_device *pdev)
 {
 	struct simple_card_data *priv;
@@ -478,7 +463,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
 		return ret;
 
 err:
-	asoc_simple_card_unref(&priv->snd_card);
+	asoc_simple_card_clean_reference(&priv->snd_card);
 	return ret;
 }
 
@@ -490,7 +475,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev)
 	asoc_simple_card_remove_jack(&priv->hp_jack);
 	asoc_simple_card_remove_jack(&priv->mic_jack);
 
-	return asoc_simple_card_unref(card);
+	return asoc_simple_card_clean_reference(card);
 }
 
 static const struct of_device_id asoc_simple_of_match[] = {
-- 
2.8.1

^ permalink raw reply related	[flat|nested] 139+ messages in thread

end of thread, other threads:[~2016-08-10 20:04 UTC | newest]

Thread overview: 139+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-20  9:36 [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card Kuninori Morimoto
2016-05-20  9:36 ` Kuninori Morimoto
2016-05-20  9:38 ` [PATCH 01/49] ASoC: simple-card: remove duplicate header Kuninori Morimoto
2016-05-20  9:38   ` Kuninori Morimoto
2016-05-30 16:00   ` Mark Brown
2016-05-30 23:53     ` Kuninori Morimoto
2016-05-30 23:53       ` Kuninori Morimoto
2016-05-20  9:39 ` [PATCH 02/49] ASoC: rsrc-card: " Kuninori Morimoto
2016-05-20  9:39   ` Kuninori Morimoto
2016-05-20  9:39 ` [PATCH 03/49] ASoC: rsrc-card: remove unused dai_num Kuninori Morimoto
2016-05-20  9:39   ` Kuninori Morimoto
2016-05-30 16:01   ` Applied "ASoC: rsrc-card: remove unused dai_num" to the asoc tree Mark Brown
2016-05-30 16:01     ` Mark Brown
2016-05-20  9:40 ` [PATCH 04/49] ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of() Kuninori Morimoto
2016-05-20  9:40   ` Kuninori Morimoto
2016-05-30 17:39   ` Applied "ASoC: simple-card: platform also uses asoc_simple_card_sub_parse_of()" to the asoc tree Mark Brown
2016-05-30 17:39     ` Mark Brown
2016-05-20  9:42 ` [PATCH 05/49] ASoC: add new simple-card-core.c Kuninori Morimoto
2016-05-20  9:42   ` Kuninori Morimoto
2016-05-30 16:22   ` Mark Brown
2016-05-20  9:42 ` [PATCH 06/49] ASoC: simple-card-core: add asoc_simple_card_parse_tdm() Kuninori Morimoto
2016-05-20  9:42   ` Kuninori Morimoto
2016-05-20  9:44 ` [PATCH 07/49] ASoC: simple-card-core: add asoc_simple_card_parse_dailink_name() Kuninori Morimoto
2016-05-20  9:44   ` Kuninori Morimoto
2016-05-20  9:44 ` [PATCH 08/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_name() Kuninori Morimoto
2016-05-20  9:44   ` Kuninori Morimoto
2016-05-20  9:45 ` [PATCH 09/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_prefix() Kuninori Morimoto
2016-05-20  9:45   ` Kuninori Morimoto
2016-05-20  9:45 ` [PATCH 10/49] ASoC: simple-card-core: add asoc_simple_card_parse_card_widgets() Kuninori Morimoto
2016-05-20  9:45   ` Kuninori Morimoto
2016-05-20  9:46 ` [PATCH 11/49] " Kuninori Morimoto
2016-05-20  9:46   ` Kuninori Morimoto
2016-05-30 16:23   ` Mark Brown
2016-05-31  2:05     ` Kuninori Morimoto
2016-05-31  2:05       ` Kuninori Morimoto
2016-05-31  2:19       ` Kuninori Morimoto
2016-05-31  2:19         ` Kuninori Morimoto
2016-05-20  9:47 ` [PATCH 12/49] ASoC: simple-card-core: add asoc_simple_card_parse_clk() Kuninori Morimoto
2016-05-20  9:47   ` Kuninori Morimoto
2016-05-20  9:47 ` [PATCH 13/49] ASoC: simple-card-core: add asoc_simple_card_parse_endpoint() Kuninori Morimoto
2016-05-20  9:47   ` Kuninori Morimoto
2016-05-20  9:48 ` [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm() Kuninori Morimoto
2016-05-20  9:48   ` Kuninori Morimoto
2016-05-30 16:47   ` Mark Brown
2016-05-31  0:17     ` Kuninori Morimoto
2016-05-31  0:17       ` Kuninori Morimoto
2016-05-20  9:48 ` [PATCH 15/49] ASoC: simple-card-core: add asoc_simple_card_init_jack() Kuninori Morimoto
2016-05-20  9:48   ` Kuninori Morimoto
2016-05-30 17:14   ` Mark Brown
2016-05-31  2:08     ` Kuninori Morimoto
2016-05-31  2:08       ` Kuninori Morimoto
2016-05-31 14:51       ` Mark Brown
2016-05-20  9:49 ` [PATCH 16/49] ASoC: simple-card-core: add asoc_simple_card_init_dai() Kuninori Morimoto
2016-05-20  9:49   ` Kuninori Morimoto
2016-05-20  9:49 ` [PATCH 17/49] ASoC: simple-card-core: add asoc_simple_card_canonicalize_dailink() Kuninori Morimoto
2016-05-20  9:49   ` Kuninori Morimoto
2016-05-20  9:50 ` [PATCH 18/49] ASoC: simple-card-core: add asoc_simple_card_canonicalize_cpu() Kuninori Morimoto
2016-05-20  9:50   ` Kuninori Morimoto
2016-05-20  9:50 ` [PATCH 19/49] ASoC: simple-card-core: add asoc_simple_card_clean_reference() Kuninori Morimoto
2016-05-20  9:50   ` Kuninori Morimoto
2016-05-20  9:50 ` [PATCH 20/49] ASoC: simple-card: use asoc_simple_card_parse_daifmt() Kuninori Morimoto
2016-05-20  9:50   ` Kuninori Morimoto
2016-05-20  9:51 ` [PATCH 21/49] ASoC: simple-card: use asoc_simple_card_parse_clk() Kuninori Morimoto
2016-05-20  9:51   ` Kuninori Morimoto
2016-08-05 12:09   ` Applied "ASoC: simple-card: use asoc_simple_card_parse_clk()" to the asoc tree Mark Brown
2016-08-05 12:09     ` Mark Brown
2016-05-20  9:51 ` [PATCH 22/49] ASoC: simple-card: use asoc_simple_card_parse_endpoint() Kuninori Morimoto
2016-05-20  9:51   ` Kuninori Morimoto
2016-05-20  9:52 ` Kuninori Morimoto
2016-05-20  9:52   ` Kuninori Morimoto
2016-05-20  9:54 ` [PATCH 23/49] ASoC: simple-card: use asoc_simple_card_parse_tdm() Kuninori Morimoto
2016-05-20  9:54   ` Kuninori Morimoto
2016-05-20  9:54 ` [PATCH 24/49] ASoC: simple-card: use asoc_simple_card_parse_card_name() Kuninori Morimoto
2016-05-20  9:54   ` Kuninori Morimoto
2016-05-20  9:55 ` [PATCH 25/49] ASoC: simple-card: use asoc_simple_card_parse_card_route() Kuninori Morimoto
2016-05-20  9:55   ` Kuninori Morimoto
2016-05-20  9:56 ` [PATCH 26/49] ASoC: simple-card: use asoc_simple_card_parse_card_widgets() Kuninori Morimoto
2016-05-20  9:56   ` Kuninori Morimoto
2016-05-20  9:56 ` [PATCH 27/49] ASoC: simple-card: use asoc_simple_card_parse_dailink_name() Kuninori Morimoto
2016-05-20  9:56   ` Kuninori Morimoto
2016-05-20  9:56 ` [PATCH 28/49] ASoC: simple-card: use asoc_simple_card_init_jack() Kuninori Morimoto
2016-05-20  9:56   ` Kuninori Morimoto
2016-05-20  9:57 ` [PATCH 29/49] ASoC: simple-card: use asoc_simple_card_init_dai() Kuninori Morimoto
2016-05-20  9:57   ` Kuninori Morimoto
2016-08-09 12:43   ` Applied "ASoC: simple-card: use asoc_simple_card_init_dai()" to the asoc tree Mark Brown
2016-08-09 12:43     ` Mark Brown
2016-05-20  9:57 ` [PATCH 30/49] ASoC: simple-card: use asoc_simple_card_canonicalize_dailink() Kuninori Morimoto
2016-05-20  9:57   ` Kuninori Morimoto
2016-05-20  9:58 ` [PATCH 31/49] ASoC: simple-card: use asoc_simple_card_canonicalize_cpu() Kuninori Morimoto
2016-05-20  9:58   ` Kuninori Morimoto
2016-05-20  9:58 ` [PATCH 32/49] ASoC: simple-card: use asoc_simple_card_clean_reference() Kuninori Morimoto
2016-05-20  9:58   ` Kuninori Morimoto
2016-08-10 20:03   ` Applied "ASoC: simple-card: use asoc_simple_card_clean_reference()" to the asoc tree Mark Brown
2016-08-10 20:03     ` Mark Brown
2016-05-20  9:59 ` [PATCH 33/49] ASoC: rsrc-card: use asoc_simple_card_parse_daifmt() Kuninori Morimoto
2016-05-20  9:59   ` Kuninori Morimoto
2016-05-20  9:59 ` [PATCH 34/49] ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name() Kuninori Morimoto
2016-05-20  9:59   ` Kuninori Morimoto
2016-05-20 10:00 ` [PATCH 35/49] ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai Kuninori Morimoto
2016-05-20 10:00   ` Kuninori Morimoto
2016-05-20 10:01 ` [PATCH 36/49] ASoC: rsrc-card: use asoc_simple_card_parse_clk() Kuninori Morimoto
2016-05-20 10:01   ` Kuninori Morimoto
2016-05-20 10:02 ` [PATCH 37/49] ASoC: rsrc-card: use asoc_simple_card_parse_endpoint() Kuninori Morimoto
2016-05-20 10:02   ` Kuninori Morimoto
2016-08-08 10:46   ` Applied "ASoC: rsrc-card: use asoc_simple_card_parse_dai()" to the asoc tree Mark Brown
2016-08-08 10:46     ` Mark Brown
2016-05-20 10:02 ` [PATCH 38/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_name() Kuninori Morimoto
2016-05-20 10:02   ` Kuninori Morimoto
2016-07-16 12:05   ` Applied "ASoC: rsrc-card: use asoc_simple_card_parse_card_name()" to the asoc tree Mark Brown
2016-07-16 12:05     ` Mark Brown
2016-05-20 10:03 ` [PATCH 39/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix() Kuninori Morimoto
2016-05-20 10:03   ` Kuninori Morimoto
2016-05-20 10:03 ` [PATCH 40/49] ASoC: rsrc-card: use asoc_simple_card_parse_dpcm() Kuninori Morimoto
2016-05-20 10:03   ` Kuninori Morimoto
2016-05-20 10:04 ` [PATCH 41/49] ASoC: rsrc-card: use asoc_simple_card_parse_card_route() Kuninori Morimoto
2016-05-20 10:04   ` Kuninori Morimoto
2016-05-20 10:04 ` [PATCH 42/49] ASoC: rsrc-card: use asoc_simple_card_parse_tdm() Kuninori Morimoto
2016-05-20 10:04   ` Kuninori Morimoto
2016-05-20 10:05 ` [PATCH 43/49] ASoC: rsrc-card: use asoc_simple_card_init_dai() Kuninori Morimoto
2016-05-20 10:05   ` Kuninori Morimoto
2016-08-09 12:43   ` Applied "ASoC: rsrc-card: use asoc_simple_card_init_dai()" to the asoc tree Mark Brown
2016-08-09 12:43     ` Mark Brown
2016-05-20 10:05 ` [PATCH 44/49] ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu() Kuninori Morimoto
2016-05-20 10:05   ` Kuninori Morimoto
2016-05-20 10:05 ` [PATCH 45/49] ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink() Kuninori Morimoto
2016-05-20 10:05   ` Kuninori Morimoto
2016-05-20 10:06 ` [PATCH 46/49] ASoC: rsrc-card: use asoc_simple_card_clean_reference() Kuninori Morimoto
2016-05-20 10:06   ` Kuninori Morimoto
2016-08-10 20:03   ` Applied "ASoC: rsrc-card: use asoc_simple_card_clean_reference()" to the asoc tree Mark Brown
2016-08-10 20:03     ` Mark Brown
2016-05-20 10:07 ` [PATCH 47/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1 Kuninori Morimoto
2016-05-20 10:07   ` Kuninori Morimoto
2016-05-20 10:08 ` [PATCH 48/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2 Kuninori Morimoto
2016-05-20 10:08   ` Kuninori Morimoto
2016-05-20 10:09 ` [PATCH 49/49] ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3 Kuninori Morimoto
2016-05-20 10:09   ` Kuninori Morimoto
2016-05-23 10:58 ` [PATCH 00/49] ASoC: add simple-card-core and standardize "simple" card Mark Brown
2016-05-24  5:11   ` Kuninori Morimoto
2016-05-24  5:11     ` Kuninori Morimoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.