[alsa-devel] [PATCH 0/3] ASoC: rename rsrc-card to simple-dpcm-card
Hi Mark
These patches moves current Renesas specific rsrc-card to more generic simple-dpcm-card, but by 1 patch was difficult. So, it uses 3 phases
Kuninori Morimoto (3): ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1 ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2 ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3
.../bindings/sound/renesas,rsrc-card.txt | 75 --------- .../devicetree/bindings/sound/simple-dpcm-card.txt | 79 ++++++++++ sound/soc/generic/Kconfig | 6 + sound/soc/generic/Makefile | 2 + .../rsrc-card.c => generic/simple-dpcm-card.c} | 173 +++++++++------------ sound/soc/sh/Kconfig | 6 - sound/soc/sh/rcar/Makefile | 3 - 7 files changed, 160 insertions(+), 184 deletions(-) delete mode 100644 Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt create mode 100644 Documentation/devicetree/bindings/sound/simple-dpcm-card.txt rename sound/soc/{sh/rcar/rsrc-card.c => generic/simple-dpcm-card.c} (57%)
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 | 69 +++++++--------------- 2 files changed, 51 insertions(+), 74 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 a9ea7fa..e885dde 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -28,21 +28,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); @@ -64,6 +51,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) { @@ -174,10 +162,6 @@ static int asoc_simple_card_parse_links(struct device_node *np,
asoc_simple_card_canonicalize_cpu(dai_link, is_single_links); } else { - const struct asoc_simple_card_of_data *of_data; - - 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"; @@ -201,16 +185,10 @@ 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 { - snd_soc_of_parse_audio_prefix(&priv->snd_card, - &priv->codec_conf, - dai_link->codec_of_node, - "audio-prefix"); - } + snd_soc_of_parse_audio_prefix(&priv->snd_card, + &priv->codec_conf, + dai_link->codec_of_node, + PREFIX "prefix"); }
ret = asoc_simple_card_canonicalize_dailink(dai_link); @@ -245,9 +223,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; @@ -261,7 +239,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); @@ -277,7 +255,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; @@ -303,33 +280,29 @@ static int asoc_simple_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"); - } + ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing"); + if (ret < 0) + return ret;
/* 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); - - 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); + 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;
- 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 card: %s\n", + priv->snd_card.name ? priv->snd_card.name : ""); + dev_dbg(dev, "convert_rate %d\n", priv->convert_rate); + dev_dbg(dev, "convert_channels %d\n", priv->convert_channels); + return 0; }
@@ -372,7 +345,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,
On Thu, Aug 11, 2016 at 11:43:18AM +0900, Kuninori Morimoto wrote:
-- 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"
Since the card is already in released kernels we can't just remove the old compatible strings, we should continue to support them. I'm also a bit unsure about adding a generic DPCM compatible string - it really is a Linux specific thing. While code reuse in the implementation is good so factoring out the card is good I'm not sure we want to bake in the idea that this is a strong abstraction so keeping a list of specific compatible strings might be better.
Hi Mark
-- 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"
Since the card is already in released kernels we can't just remove the old compatible strings, we should continue to support them. I'm also a bit unsure about adding a generic DPCM compatible string - it really is a Linux specific thing. While code reuse in the implementation is good so factoring out the card is good I'm not sure we want to bake in the idea that this is a strong abstraction so keeping a list of specific compatible strings might be better.
OK, I see. This driver was used for Renesas SCU (Sampling Rate Converter Unit) which is including SRC (Sampling Rate Converter), CTU (Channel Transfer Unit), MIX (Mixer), 1 or more CPU and 1 Codec system. (Original was only for SRC, rsrc = Renesas SRC)
Can I use simple-scu-audio-card ? If OK, I can send such patch.
Hi Mark again
-- 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"
Since the card is already in released kernels we can't just remove the old compatible strings, we should continue to support them. I'm also a bit unsure about adding a generic DPCM compatible string - it really is a Linux specific thing. While code reuse in the implementation is good so factoring out the card is good I'm not sure we want to bake in the idea that this is a strong abstraction so keeping a list of specific compatible strings might be better.
OK, I see. This driver was used for Renesas SCU (Sampling Rate Converter Unit) which is including SRC (Sampling Rate Converter), CTU (Channel Transfer Unit), MIX (Mixer), 1 or more CPU and 1 Codec system. (Original was only for SRC, rsrc = Renesas SRC)
Can I use simple-scu-audio-card ? If OK, I can send such patch.
I can keep "renesas,rsrc-card" compatible, but I would like to remove above "board" specific compatible, because it exists in my test environment only. No one is using it. And it makes this driver very complex.
Best regards --- Kuninori Morimoto
On Mon, Aug 22, 2016 at 07:12:50AM +0000, Kuninori Morimoto wrote:
- "renesas,rsrc-card,lager"
- "renesas,rsrc-card,koelsch"
I can keep "renesas,rsrc-card" compatible, but I would like to remove above "board" specific compatible, because it exists in my test environment only. No one is using it. And it makes this driver very complex.
I thought Lager and Koelsch were quite widely available? But if the boards you're removing really are just specials on your desk then it's fine, just make sure you provide a separate patch doing that with a clear explanation as to why.
Hi Mark
- "renesas,rsrc-card,lager"
- "renesas,rsrc-card,koelsch"
I can keep "renesas,rsrc-card" compatible, but I would like to remove above "board" specific compatible, because it exists in my test environment only. No one is using it. And it makes this driver very complex.
I thought Lager and Koelsch were quite widely available? But if the boards you're removing really are just specials on your desk then it's fine, just make sure you provide a separate patch doing that with a clear explanation as to why.
Ahh sorry, my explanation was not good. Lager/Koelsch boards itself is very common board. But, the "user of board specific compatible" is only my test environment. It was created as 1st prototype. Now, normal user can use generic compatible (= without specific board name). I will create and send removing patch which has explanation.
Best regards --- Kuninori Morimoto
On Tue, Aug 23, 2016 at 12:22:05AM +0000, Kuninori Morimoto wrote:
Ahh sorry, my explanation was not good. Lager/Koelsch boards itself is very common board. But, the "user of board specific compatible" is only my test environment. It was created as 1st prototype. Now, normal user can use generic compatible (= without specific board name). I will create and send removing patch which has explanation.
I see. The other thing you can do there is keep the compatibles but just handle them the same as the generic one.
On Mon, Aug 22, 2016 at 03:34:23AM +0000, Kuninori Morimoto wrote:
This driver was used for Renesas SCU (Sampling Rate Converter Unit) which is including SRC (Sampling Rate Converter), CTU (Channel Transfer Unit), MIX (Mixer), 1 or more CPU and 1 Codec system. (Original was only for SRC, rsrc = Renesas SRC)
Can I use simple-scu-audio-card ? If OK, I can send such patch.
Yes, that seems fine.
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 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 | 110 +++++++++++++++++++++--------------------- 1 file changed, 55 insertions(+), 55 deletions(-)
diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 16dc13e..a9ea7fa 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 @@ -22,7 +22,7 @@ #include <sound/soc-dai.h> #include <sound/simple_card_utils.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; @@ -33,23 +33,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; @@ -58,48 +58,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; @@ -107,10 +107,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, @@ -127,13 +127,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, - int idx, bool is_fe) +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 ret;
/* Parse TDM slot */ @@ -174,7 +174,7 @@ static int rsrc_card_parse_links(struct device_node *np,
asoc_simple_card_canonicalize_cpu(dai_link, is_single_links); } 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);
@@ -185,7 +185,7 @@ 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->be_hw_params_fixup = asoc_simple_card_be_hw_params_fixup;
ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL); if (ret < 0) @@ -219,8 +219,8 @@ static int rsrc_card_parse_links(struct device_node *np,
dai_link->dpcm_playback = 1; dai_link->dpcm_capture = 1; - 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, @@ -230,10 +230,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; @@ -243,7 +243,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, @@ -257,14 +257,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++; @@ -273,11 +273,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; @@ -322,7 +322,7 @@ static int rsrc_card_parse_of(struct device_node *node, 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); + ret = asoc_simple_card_dai_link_of(node, priv); if (ret < 0) return ret;
@@ -333,9 +333,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; @@ -345,7 +345,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); @@ -363,25 +363,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");
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 c01c5dd..bb35494 100644 --- a/sound/soc/generic/Kconfig +++ b/sound/soc/generic/Kconfig @@ -6,3 +6,9 @@ config SND_SIMPLE_CARD select SND_SIMPLE_CARD_UTILS 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_UTILS + help + This option enables generic simple DPCM sound card support diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile index 2d53c8d..88a557d 100644 --- a/sound/soc/generic/Makefile +++ b/sound/soc/generic/Makefile @@ -1,5 +1,7 @@ snd-soc-simple-card-utils-objs := simple-card-utils.o snd-soc-simple-card-objs := simple-card.o +snd-soc-simple-dpcm-card-objs := simple-dpcm-card.o
obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) += snd-soc-simple-card-utils.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 9311f11..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_UTILS - 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
participants (2)
-
Kuninori Morimoto
-
Mark Brown