[alsa-devel] [PATCH 0/8] ASoC: simple-scu-card: tidyup and synchronize patches
Hi Mark
These are cleanup/tidyup and synchronize patches for simple-scu-card. We have now simple-card and simple-scu-card. These are almost same, difference is very small. But, because of historical reason, these have "code" difference. This patch cleanup and synchronize these.
These are based on mark/topic/rcar
Kuninori Morimoto (8): ASoC: simple-scu-card: remove unused definitions ASoC: simple-scu-card: is GPL v2 ASoC: simple-scu-card: tidyup codec daifmt handling method ASoC: simple-scu-card: tidyup asoc_simple_card_parse_links() method ASoC: simple-scu-card: depends on CONFIG_OF ASoC: simple-scu-card: add 2 CPU 1 Codec example ASoC: simple-scu-card: code sync: move asoc_simple_card_of_match ASoC: simple-scu-card: code sync: tidyup TDM setting position
.../devicetree/bindings/sound/simple-scu-card.txt | 32 +++++++++- sound/soc/generic/Kconfig | 1 + sound/soc/generic/simple-scu-card.c | 72 +++++++++------------- 3 files changed, 60 insertions(+), 45 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-scu-card.c | 8 -------- 1 file changed, 8 deletions(-)
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 3fa1908..fdfaf4f 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -22,12 +22,6 @@ #include <sound/soc-dai.h> #include <sound/simple_card_utils.h>
-struct asoc_simple_card_of_data { - const char *prefix; - const struct snd_soc_dapm_route *routes; - int num_routes; -}; - static const struct of_device_id asoc_simple_card_of_match[] = { { .compatible = "renesas,rsrc-card", }, { .compatible = "simple-scu-audio-card", }, @@ -35,8 +29,6 @@ static const struct of_device_id asoc_simple_card_of_match[] = { }; MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match);
-#define IDX_CPU 0 -#define IDX_CODEC 1 struct asoc_simple_card_priv { struct snd_soc_card snd_card; struct snd_soc_codec_conf codec_conf;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
It is indicating that this driver is GPL v2 on top of C code. Let's fixup it on MODULE_LICENSE()
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-scu-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index fdfaf4f..ac7ba97 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -348,6 +348,6 @@ static struct platform_driver asoc_simple_card = { module_platform_driver(asoc_simple_card);
MODULE_ALIAS("platform:asoc-simple-scu-card"); -MODULE_LICENSE("GPL"); +MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("ASoC Simple SCU Sound Card"); MODULE_AUTHOR("Kuninori Morimoto kuninori.morimoto.gx@renesas.com");
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Current simple-scu-card is handling codec daifmt by using for_each_child_of_node(), and low-level method. Let's use of_get_child_by_name() instead it
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-scu-card.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index ac7ba97..83add14 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -212,19 +212,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, bool is_fe;
/* find 1st codec */ - i = 0; - for_each_child_of_node(node, np) { - dai_link = simple_priv_to_link(priv, i); + np = of_get_child_by_name(node, PREFIX "codec"); + if (!np) + return -ENODEV;
- if (strcmp(np->name, PREFIX "codec") == 0) { - ret = asoc_simple_card_parse_daifmt(dev, node, np, - PREFIX, &daifmt); - if (ret < 0) - return ret; - break; - } - i++; - } + ret = asoc_simple_card_parse_daifmt(dev, node, np, + PREFIX, &daifmt); + if (ret < 0) + return ret;
i = 0; for_each_child_of_node(node, np) {
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Current asoc_simple_card_parse_links() is setting dai_link daifmt. But, asoc_simple_card_parse_links() is doing it. This patch clean-up this point less method
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-scu-card.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 83add14..2f40f9c 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -110,6 +110,7 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
static int asoc_simple_card_parse_links(struct device_node *np, struct asoc_simple_card_priv *priv, + unsigned int daifmt, int idx, bool is_fe) { struct device *dev = simple_priv_to_dev(priv); @@ -188,6 +189,7 @@ static int asoc_simple_card_parse_links(struct device_node *np, if (ret < 0) return ret;
+ dai_link->dai_fmt = daifmt; dai_link->dpcm_playback = 1; dai_link->dpcm_capture = 1; dai_link->ops = &asoc_simple_card_ops; @@ -205,7 +207,6 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, struct asoc_simple_card_priv *priv) { struct device *dev = simple_priv_to_dev(priv); - struct snd_soc_dai_link *dai_link; struct device_node *np; unsigned int daifmt = 0; int ret, i; @@ -223,14 +224,11 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
i = 0; for_each_child_of_node(node, np) { - dai_link = simple_priv_to_link(priv, i); - dai_link->dai_fmt = daifmt; - is_fe = false; if (strcmp(np->name, PREFIX "cpu") == 0) is_fe = true;
- ret = asoc_simple_card_parse_links(np, priv, i, is_fe); + ret = asoc_simple_card_parse_links(np, priv, daifmt, i, is_fe); if (ret < 0) return ret; i++;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
simple-scu-card driver is under CONFIG_OF. This patch adds missing config.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig index 2d0ff03..b95ae49 100644 --- a/sound/soc/generic/Kconfig +++ b/sound/soc/generic/Kconfig @@ -9,6 +9,7 @@ config SND_SIMPLE_CARD
config SND_SIMPLE_SCU_CARD tristate "ASoC Simple SCU sound card support" + depends on OF select SND_SIMPLE_CARD_UTILS help This option enables generic simple SCU sound card support.
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- .../devicetree/bindings/sound/simple-scu-card.txt | 32 +++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/sound/simple-scu-card.txt b/Documentation/devicetree/bindings/sound/simple-scu-card.txt index ecb4a24..d6fe47e 100644 --- a/Documentation/devicetree/bindings/sound/simple-scu-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-scu-card.txt @@ -52,7 +52,7 @@ Optional CPU/CODEC subnodes properties: clk_disable_unprepare() in dai shutdown().
-Example +Example 1. Sampling Rate Covert
sound { compatible = "simple-scu-audio-card"; @@ -78,3 +78,33 @@ sound { system-clock-frequency = <11289600>; }; }; + +Example 2. 2 CPU 1 Codec + +sound { + compatible = "renesas,rsrc-card"; + + card-name = "rsnd-ak4643"; + format = "left_j"; + bitclock-master = <&dpcmcpu>; + frame-master = <&dpcmcpu>; + + convert-rate = <48000>; /* see audio_clk_a */ + + audio-prefix = "ak4642"; + audio-routing = "ak4642 Playback", "DAI0 Playback", + "ak4642 Playback", "DAI1 Playback"; + + dpcmcpu: cpu@0 { + sound-dai = <&rcar_sound 0>; + }; + + cpu@1 { + sound-dai = <&rcar_sound 1>; + }; + + codec { + sound-dai = <&ak4643>; + clocks = <&audio_clock>; + }; +};
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
simple sound card family are using very similar style, but because of its historical reason, there are small differences. For example pointer style, function name, caller postion etc... This patch synchronized simple card style to other simple card family
This patch moves asoc_simple_card_of_match to bottom side, and rename it to asoc_simple_of_match same as other simple card family.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-scu-card.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index 2f40f9c..abe31dc 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -22,13 +22,6 @@ #include <sound/soc-dai.h> #include <sound/simple_card_utils.h>
-static const struct of_device_id asoc_simple_card_of_match[] = { - { .compatible = "renesas,rsrc-card", }, - { .compatible = "simple-scu-audio-card", }, - {}, -}; -MODULE_DEVICE_TABLE(of, asoc_simple_card_of_match); - struct asoc_simple_card_priv { struct snd_soc_card snd_card; struct snd_soc_codec_conf codec_conf; @@ -329,10 +322,17 @@ static int asoc_simple_card_remove(struct platform_device *pdev) return asoc_simple_card_clean_reference(card); }
+static const struct of_device_id asoc_simple_of_match[] = { + { .compatible = "renesas,rsrc-card", }, + { .compatible = "simple-scu-audio-card", }, + {}, +}; +MODULE_DEVICE_TABLE(of, asoc_simple_of_match); + static struct platform_driver asoc_simple_card = { .driver = { .name = "simple-scu-audio-card", - .of_match_table = asoc_simple_card_of_match, + .of_match_table = asoc_simple_of_match, }, .probe = asoc_simple_card_probe, .remove = asoc_simple_card_remove,
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
simple sound card family are using very similar style, but because of its historical reason, there are small differences. For example pointer style, function name, caller postion etc... This patch tidyup TDM setting position
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/generic/simple-scu-card.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index abe31dc..b9973a5 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -111,15 +111,6 @@ static int asoc_simple_card_parse_links(struct device_node *np, struct asoc_simple_dai *dai_props = simple_priv_to_props(priv, idx); 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) { int is_single_links = 0;
@@ -178,6 +169,14 @@ static int asoc_simple_card_parse_links(struct device_node *np, PREFIX "prefix"); }
+ 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; + ret = asoc_simple_card_canonicalize_dailink(dai_link); if (ret < 0) return ret;
participants (1)
-
Kuninori Morimoto