ASoC: add simple-card-core and standardize "simple" card
Subsystems (5)
Kuninori Morimoto
maintainerv2 cover ASoC: add simple-card-core and standardize "simple" card
Hi Mark
These are v2 of simple-card cleanup patches.
Main purpose of these patches are
- cleanup simple-card
- rename rsrc-card to simple-dpcm-card
Main diff v1 <-> v2 are
- remove duplicate header patch
- rename simple-card-core.c -> simple-card-utils.c
- remove dpcm function from simple-card-utils.
- remove jack/pin/gpio/ function from simple-card-utils.
- remove widgets/route function from simple-card-utils.
I removed widgets/routing related function. it was very thin cosmetic functions. About jack/pin/gpio on simple-card, it is still have same method, but keeping it as static function.
dpcm related function too, it is keeping static.
1) - 3) cleaup patch as prepare
4) - 14) simple-card-utils
15) - 24) simple-card
25) - 36) rsrc-card
37) - 39) rsrc-card -> simple-dpcm-card
Kuninori Morimoto (39):
1) ASoC: rsrc-card: remove unused dai_num
2) ASoC: simple-card: use common PREFIX for each DT property
3) ASoC: simple-card: add new asoc_simple_jack and use it
4) ASoC: add new simple-card-utils.c
5) ASoC: simple-card-utils: add asoc_simple_card_parse_tdm()
6) ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name()
7) ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
8) ASoC: simple-card-utils: add asoc_simple_card_parse_card_prefix()
9) ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
10) ASoC: simple-card-utils: add asoc_simple_card_parse_endpoint()
11) ASoC: simple-card-utils: add asoc_simple_card_init_dai()
12) ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink()
13) ASoC: simple-card-utils: add asoc_simple_card_canonicalize_cpu()
14) ASoC: simple-card-utils: add asoc_simple_card_clean_reference()
15) ASoC: simple-card: use asoc_simple_card_parse_daifmt()
16) ASoC: simple-card: use asoc_simple_card_parse_clk()
17) ASoC: simple-card: use asoc_simple_card_parse_endpoint()
18) ASoC: simple-card: use asoc_simple_card_parse_tdm()
19) ASoC: simple-card: use asoc_simple_card_parse_card_name()
20) ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
21) ASoC: simple-card: use asoc_simple_card_init_dai()
22) ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
23) ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()
24) ASoC: simple-card: use asoc_simple_card_clean_reference()
25) ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
26) ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()
27) ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai
28) ASoC: rsrc-card: use asoc_simple_card_parse_clk()
29) ASoC: rsrc-card: use asoc_simple_card_parse_endpoint()
30) ASoC: rsrc-card: use asoc_simple_card_parse_card_name()
31) ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix()
32) ASoC: rsrc-card: use asoc_simple_card_parse_tdm()
33) ASoC: rsrc-card: use asoc_simple_card_init_dai()
34) ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu()
35) ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
36) ASoC: rsrc-card: use asoc_simple_card_clean_reference()
37) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1
38) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
39) 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_utils.h | 77 +++++++++++++++ sound/soc/generic/Kconfig | 10 ++ sound/soc/generic/Makefile | 4 + sound/soc/generic/simple-card-utils.c | 288 +++++++++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/generic/simple-card.c | 424 ++++++++++++++++++++++++------------------------------------------------------ sound/soc/generic/simple-dpcm-card.c | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/sh/Kconfig | 5 - sound/soc/sh/rcar/Makefile | 3 - sound/soc/sh/rcar/rsrc-card.c | 529 -------------------------------------------------------------------------------------------------- 12 files changed, 937 insertions(+), 919 deletions(-)
Kuninori Morimoto
maintainerPATCH v2 1/39 ASoC: rsrc-card: remove unused dai_num
From: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +0 -2
@@ -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 ;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 2/39 ASoC: simple-card: use common PREFIX for each DT property
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
sound/soc/generic/simple-card.c +13 -11
@@ -40,6 +40,8 @@ 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 PREFIX "simple-audio-card," +static int asoc_simple_card_startup (struct snd_pcm_substream *substream) {struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -344,7 +346,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);
@@ -453,26 +455,26 @@ static int asoc_simple_card_parse_of(struct device_node *node,return -EINVAL ;/* Parse the card name from DT */ -snd_soc_of_parse_card_name (&priv->snd_card,"simple-audio-card,name" ); +snd_soc_of_parse_card_name (&priv->snd_card,PREFIX "name" );/* The off-codec widgets */ -if (of_property_read_bool (node,"simple-audio-card,widgets" )) { +if (of_property_read_bool (node,PREFIX "widgets" )) { ret =snd_soc_of_parse_audio_simple_widgets (&priv->snd_card, -"simple-audio-card,widgets" ); +PREFIX "widgets" );if (ret)return ret; }/* DAPM routes */ -if (of_property_read_bool (node,"simple-audio-card,routing" )) { +if (of_property_read_bool (node,PREFIX "routing" )) { ret =snd_soc_of_parse_audio_routing (&priv->snd_card, -"simple-audio-card,routing" ); +PREFIX "routing" );if (ret)return ret; }/* Factor to mclk, used in hw_params() */ - ret =of_property_read_u32 (node,"simple-audio-card,mclk-fs" , &val); + ret =of_property_read_u32 (node,PREFIX "mclk-fs" , &val);if (ret ==0 ) priv->mclk_fs = val;
@@ -480,7 +482,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, 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" )) { +if (of_get_child_by_name (node,PREFIX "dai-link" )) {struct device_node *np =NULL ;int i =0 ;
@@ -502,13 +504,13 @@ static int asoc_simple_card_parse_of(struct device_node *node, } priv->gpio_hp_det =of_get_named_gpio_flags (node, -"simple-audio-card,hp-det-gpio" ,0 , &flags); +PREFIX "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); +PREFIX "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 ;
@@ -543,7 +545,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)int num_links, ret;/* Get the number of DAI links */ -if (np &&of_get_child_by_name (np,"simple-audio-card,dai-link" )) +if (np &&of_get_child_by_name (np,PREFIX "dai-link" )) num_links =of_get_child_count (np);else num_links =1 ;
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: simple-card: use common PREFIX for each DT property" to the asoc tree
The patch
ASoC: simple-card: use common PREFIX for each DT property
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
Quoted 1 line
From
548563fa3e430ce61db79aa11331da6e5f535a3bMon Sep 17 00:00:00 2001
From: Kuninori Morimoto <[email protected]>
Date: Tue, 31 May 2016 08:59:01 +0000
Subject: [PATCH] ASoC: simple-card: use common PREFIX for each DT property
--- sound/soc/generic/simple-card.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-)
sound/soc/generic/simple-card.c +13 -11
@@ -40,6 +40,8 @@ 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 PREFIX "simple-audio-card," +static int asoc_simple_card_startup (struct snd_pcm_substream *substream) {struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -344,7 +346,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);
@@ -453,26 +455,26 @@ static int asoc_simple_card_parse_of(struct device_node *node,return -EINVAL ;/* Parse the card name from DT */ -snd_soc_of_parse_card_name (&priv->snd_card,"simple-audio-card,name" ); +snd_soc_of_parse_card_name (&priv->snd_card,PREFIX "name" );/* The off-codec widgets */ -if (of_property_read_bool (node,"simple-audio-card,widgets" )) { +if (of_property_read_bool (node,PREFIX "widgets" )) { ret =snd_soc_of_parse_audio_simple_widgets (&priv->snd_card, -"simple-audio-card,widgets" ); +PREFIX "widgets" );if (ret)return ret; }/* DAPM routes */ -if (of_property_read_bool (node,"simple-audio-card,routing" )) { +if (of_property_read_bool (node,PREFIX "routing" )) { ret =snd_soc_of_parse_audio_routing (&priv->snd_card, -"simple-audio-card,routing" ); +PREFIX "routing" );if (ret)return ret; }/* Factor to mclk, used in hw_params() */ - ret =of_property_read_u32 (node,"simple-audio-card,mclk-fs" , &val); + ret =of_property_read_u32 (node,PREFIX "mclk-fs" , &val);if (ret ==0 ) priv->mclk_fs = val;
@@ -480,7 +482,7 @@ static int asoc_simple_card_parse_of(struct device_node *node, 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" )) { +if (of_get_child_by_name (node,PREFIX "dai-link" )) {struct device_node *np =NULL ;int i =0 ;
@@ -502,13 +504,13 @@ static int asoc_simple_card_parse_of(struct device_node *node, } priv->gpio_hp_det =of_get_named_gpio_flags (node, -"simple-audio-card,hp-det-gpio" ,0 , &flags); +PREFIX "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); +PREFIX "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 ;
@@ -543,7 +545,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev)int num_links, ret;/* Get the number of DAI links */ -if (np &&of_get_child_by_name (np,"simple-audio-card,dai-link" )) +if (np &&of_get_child_by_name (np,PREFIX "dai-link" )) num_links =of_get_child_count (np);else num_links =1 ;
Signature · 1 line
2.8.1
Kuninori Morimoto
maintainerPATCH v2 3/39 ASoC: simple-card: add new asoc_simple_jack and use it
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Current simple-card supports snd_soc_jack/pin/gpio. These code are very similar, but driver has verbosity code. So, this patch adds new snd_soc_jack and cleanups code
--- sound/soc/generic/simple-card.c | 153 ++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 75 deletions(-)
sound/soc/generic/simple-card.c +78 -75
@@ -21,6 +21,12 @@#include <sound/soc-dai.h> #include <sound/soc.h> +struct asoc_simple_jack { +struct snd_soc_jack jack; +struct snd_soc_jack_pin pin; +struct snd_soc_jack_gpio gpio; +}; + struct simple_card_data { struct snd_soc_card snd_card; struct simple_dai_props {
@@ -29,10 +35,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 */ };
@@ -42,6 +46,67 @@ struct simple_card_data {#define PREFIX "simple-audio-card," +#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) +static 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 ; +} + +static 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); +} +static int asoc_simple_card_startup (struct snd_pcm_substream *substream) {struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -112,32 +177,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 +225,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 ; }
@@ -447,7 +470,6 @@ static int asoc_simple_card_parse_of(struct device_node *node, struct simple_card_data *priv) {struct device *dev =simple_priv_to_dev (priv); -enum of_gpio_flags flags;u32 val;int ret;
@@ -503,18 +525,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,return ret; } - priv->gpio_hp_det =of_get_named_gpio_flags (node, -PREFIX "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, -PREFIX "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 ; -if (!priv->snd_card.name) priv->snd_card.name = priv->snd_card.dai_link->name;
@@ -564,9 +574,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,
@@ -633,12 +640,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); }
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: simple-card: add new asoc_simple_jack and use it" to the asoc tree
The patch
ASoC: simple-card: add new asoc_simple_jack and use it
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
Quoted 1 line
From
9eac361877b3c96c8f68dffd7a7a3e92a2b85d0bMon Sep 17 00:00:00 2001
From: Kuninori Morimoto <[email protected]>
Date: Tue, 31 May 2016 08:59:46 +0000
Subject: [PATCH] ASoC: simple-card: add new asoc_simple_jack and use it
Current simple-card supports snd_soc_jack/pin/gpio. These code are very similar, but driver has verbosity code. So, this patch adds new snd_soc_jack and cleanups code
--- sound/soc/generic/simple-card.c | 153 ++++++++++++++++++++-------------------- 1 file changed, 78 insertions(+), 75 deletions(-)
sound/soc/generic/simple-card.c +78 -75
@@ -21,6 +21,12 @@#include <sound/soc-dai.h> #include <sound/soc.h> +struct asoc_simple_jack { +struct snd_soc_jack jack; +struct snd_soc_jack_pin pin; +struct snd_soc_jack_gpio gpio; +}; + struct simple_card_data { struct snd_soc_card snd_card; struct simple_dai_props {
@@ -29,10 +35,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 */ };
@@ -42,6 +46,67 @@ struct simple_card_data {#define PREFIX "simple-audio-card," +#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) +static 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 ; +} + +static 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); +} +static int asoc_simple_card_startup (struct snd_pcm_substream *substream) {struct snd_soc_pcm_runtime *rtd = substream->private_data;
@@ -112,32 +177,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 +225,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 ; }
@@ -447,7 +470,6 @@ static int asoc_simple_card_parse_of(struct device_node *node, struct simple_card_data *priv) {struct device *dev =simple_priv_to_dev (priv); -enum of_gpio_flags flags;u32 val;int ret;
@@ -503,18 +525,6 @@ static int asoc_simple_card_parse_of(struct device_node *node,return ret; } - priv->gpio_hp_det =of_get_named_gpio_flags (node, -PREFIX "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, -PREFIX "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 ; -if (!priv->snd_card.name) priv->snd_card.name = priv->snd_card.dai_link->name;
@@ -564,9 +574,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,
@@ -633,12 +640,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); }
Signature · 1 line
2.8.1
Kuninori Morimoto
maintainerPATCH v2 4/39 ASoC: add new simple-card-utils.c
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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 it will be very difficult to keep compatibility. 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 creates simple-card helper utils, and provides common function to each drivers. 1st is asoc_simple_card_parse_daifmt()
--- include/sound/simple_card_utils.h | 21 ++++++++++++++ sound/soc/generic/Kconfig | 3 ++ sound/soc/generic/Makefile | 2 ++ sound/soc/generic/simple-card-utils.c | 54 +++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 include/sound/simple_card_utils.h create mode 100644 sound/soc/generic/simple-card-utils.c
include/sound/simple_card_utils.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* simple_card_core.h +* +* Copyright (c) 2016 Kuninori Morimoto <[email protected]> +* +* 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 */
sound/soc/generic/Kconfig +3 -0
@@ -1,3 +1,6 @@ +config SND_SIMPLE_CARD_UTILS + tristate + config SND_SIMPLE_CARD tristate "ASoC Simple sound card support" help
sound/soc/generic/Makefile +2 -0
@@ -1,3 +1,5 @@ +obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) := simple-card-utils.o + snd-soc-simple-card-objs := simple-card.o obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o
sound/soc/generic/simple-card-utils.c new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: add new simple-card-utils.c" to the asoc tree
The patch
ASoC: add new simple-card-utils.c
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
Quoted 1 line
From
abd3147e69481caade441e8d8296fa3f541aea03Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <[email protected]>
Date: Tue, 31 May 2016 09:00:14 +0000
Subject: [PATCH] ASoC: add new simple-card-utils.c
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 it will be very difficult to keep compatibility. 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 creates simple-card helper utils, and provides common function to each drivers. 1st is asoc_simple_card_parse_daifmt()
--- include/sound/simple_card_utils.h | 21 ++++++++++++++ sound/soc/generic/Kconfig | 3 ++ sound/soc/generic/Makefile | 2 ++ sound/soc/generic/simple-card-utils.c | 54 +++++++++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+) create mode 100644 include/sound/simple_card_utils.h create mode 100644 sound/soc/generic/simple-card-utils.c
include/sound/simple_card_utils.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* simple_card_core.h +* +* Copyright (c) 2016 Kuninori Morimoto <[email protected]> +* +* 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 */
sound/soc/generic/Kconfig +3 -0
@@ -1,3 +1,6 @@ +config SND_SIMPLE_CARD_UTILS + tristate + config SND_SIMPLE_CARD tristate "ASoC Simple sound card support" help
sound/soc/generic/Makefile +2 -0
@@ -1,3 +1,5 @@ +obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) := simple-card-utils.o + snd-soc-simple-card-objs := simple-card.o obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o
sound/soc/generic/simple-card-utils.c new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.8.1
Kuninori Morimoto
maintainerPATCH v2 5/39 ASoC: simple-card-utils: add asoc_simple_card_parse_tdm()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
simple-card is supporting TDM.
This patch makes this method simple style standard.
--- include/sound/simple_card_utils.h | 12 ++++++++++++ sound/soc/generic/simple-card-utils.c | 11 +++++++++++ 2 files changed, 23 insertions(+)
include/sound/simple_card_utils.h +12 -0
@@ -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 */
sound/soc/generic/simple-card-utils.c +11 -0
@@ -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);
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH 05/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_tdm()
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_daifmt(struct device *dev, · line 65
Quoted 10 lines · Kuninori Morimoto
sound/soc/generic/simple-card-utils.c +10
-0+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);
This is (obviously) a very thin wrapper around the existing interface. If that makes sense then perhaps we should just update the existing interface?
Kuninori Morimoto
maintainerRe: [PATCH 05/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_tdm()
Hi Mark
Quoted 6 lines
Quoted 6 lines
sound/soc/generic/simple-card-utils.c +6
-0+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,
Quoted 8 lines
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_daifmt(struct device *dev, · line 65
Quoted 4 lines
sound/soc/generic/simple-card-utils.c +4
-0+ &simple_dai->slots, + &simple_dai->slot_width); +} +EXPORT_SYMBOL_GPL (asoc_simple_card_parse_tdm);This is (obviously) a very thin wrapper around the existing interface. If that makes sense then perhaps we should just update the existing interface?
Indeed it is very thin. I will just remove it in v3
Kuninori Morimoto
maintainerPATCH v2 6/39 ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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 adds simple card common function for it.
--- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 42 +++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+)
include/sound/simple_card_utils.h +2 -0
@@ -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 */
sound/soc/generic/simple-card-utils.c +42 -0
45 lines not on this page · raw message
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH 06/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name()
Quoted 6 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
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 adds simple card common function for it.
This looks like it's about putting DPCM into the DT. Given that DPCM is very much an implementation detail we're trying to get rid of this seems like it's going in the wrong direction. What's the intended use?
Kuninori Morimoto
maintainerRe: [PATCH 06/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_dailink_name()
Hi Mark
Quoted 10 lines
Quoted 6 lines
From: Kuninori Morimoto <[email protected]>
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 adds simple card common function for it.This looks like it's about putting DPCM into the DT. Given that DPCM is very much an implementation detail we're trying to get rid of this seems like it's going in the wrong direction. What's the intended use?
My rsrc-card already supporting DPCM on DT.
This function is for name setting, for both DPCM card and normal simple-card. It doesn't related to DPCM feature, just for name.
simple-card name will be created from CPU/Codec dai name, then, we need to allocate memory for it, and dai_link name setting
So, this is for it.
Kuninori Morimoto
maintainerPATCH v2 7/39 ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
simple-card needs to get its card name. This patch makes this method simple style standard.
--- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+)
include/sound/simple_card_utils.h +2 -0
@@ -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 */
sound/soc/generic/simple-card-utils.c +20 -0
@@ -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);
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_dailink_name(struct device *dev, · line 123
Quoted 2 lines · Kuninori Morimoto
sound/soc/generic/simple-card-utils.c +2
-0+if (!card->name) + card->name = card->dai_link->name;
This will unconditionally defererence dai_link but it's optional - we can have analogue only cards.
Kuninori Morimoto
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
Hi Mark
Quoted 5 lines
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_dailink_name(struct device *dev, · line 123
Quoted 2 lines
sound/soc/generic/simple-card-utils.c +2
-0+if (!card->name) + card->name = card->dai_link->name;This will unconditionally defererence
dai_linkbut it's optional - we can have analogue only cards.
This is not new feature. Current simple-card already has it.
--------------------
commit 2772555b6c5ba79783c04ea6c60549530d737e2e
Author: Xiubo Li <[email protected]> Date: Fri Jan 24 15:43:02 2014 +0800
ASoC: simple-card: Add snd_card's name parsing from DT node support
If the DT is used and the CPU DAI device has only one DAI, the card name will be like :
ALSA device list:
0: 40031000.sai-sgtl5000
And this name maybe a little ugly to some customers, so here the card name parsing from DT node is supported.
--------------------
Mark Brown
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
Quoted 7 lines · Kuninori Morimoto
Quoted 5 lines
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_dailink_name(struct device *dev, · line 123
Quoted 2 lines
sound/soc/generic/simple-card-utils.c +2
-0+if (!card->name) + card->name = card->dai_link->name;This will unconditionally defererence
dai_linkbut it's optional - we can have analogue only cards.This is not new feature. Current simple-card already has it.
Right, but simple-card does need DAIs IIRC while this is intended to be more general. All it needs is a check before the dereference to be safe so it's trivial to handle.
Kuninori Morimoto
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
Hi Mark
Quoted 11 lines
Quoted 7 lines
Quoted 5 lines
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_dailink_name(struct device *dev, · line 123
Quoted 2 lines
sound/soc/generic/simple-card-utils.c +2
-0+if (!card->name) + card->name = card->dai_link->name;This will unconditionally defererence
dai_linkbut it's optional - we can have analogue only cards.This is not new feature. Current simple-card already has it.
Right, but simple-card does need DAIs IIRC while this is intended to be more general. All it needs is a check before the dereference to be safe so it's trivial to handle.
Sorry, I'm not 100% understand.
Do you mean we don't need handle card->name ? (= we should remove above ?) If so, we can't register card on simple-card. Because snd_soc_register_card() requests it.
Kuninori Morimoto
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
Hi Mark, again
sorry previous was not good question
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_dailink_name(struct device *dev, · line 123
Quoted 2 lines
sound/soc/generic/simple-card-utils.c +2
-0+if (!card->name) + card->name = card->dai_link->name;This will unconditionally defererence
dai_linkbut it's optional - we can have analogue only cards.This is not new feature. Current simple-card already has it.
Quoted 8 lines
Quoted 3 lines
Right, but simple-card does need DAIs IIRC while this is intended to be more general. All it needs is a check before the dereference to be safe so it's trivial to handle.
Sorry, I'm not 100% understand.
Do you mean we don't need handlecard->name? (= we should remove above ?) If so, we can't register card on simple-card. Becausesnd_soc_register_card()requests it.
This function tries to get card name from snd_soc_of_parse_card_name(). and it tries to set card->name from dai_link if card still doesn't have name. So, above is optional 2nd try.
Or, do you mean this if (!card->name) can goes to simple-card, instead of utils ? I have no objection about it , but it can be double handling ? Because other simple family have same situation.
Mark Brown
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
Quoted 17 lines · Kuninori Morimoto
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_dailink_name(struct device *dev, · line 123
Quoted 2 lines
sound/soc/generic/simple-card-utils.c +2
-0+if (!card->name) + card->name = card->dai_link->name;This will unconditionally defererence
dai_linkbut it's optional - we can have analogue only cards.This is not new feature. Current simple-card already has it.
Quoted 8 lines
Quoted 3 lines
Right, but simple-card does need DAIs IIRC while this is intended to be more general. All it needs is a check before the dereference to be safe so it's trivial to handle.
Sorry, I'm not 100% understand.
Do you mean we don't need handlecard->name? (= we should remove above ?) If so, we can't register card on simple-card. Becausesnd_soc_register_card()requests it.
Quoted 6 lines
This function tries to get card name from
snd_soc_of_parse_card_name(). and it tries to setcard->namefromdai_linkif card still doesn't have name. So, above is optional 2nd try.
Or, do you mean this if (!card->name) can goes to simple-card, instead of utils ? I have no objection about it , but it can be double handling ? Because other simple family have same situation.
If we try to dereference card->dai_link without checking to see if it's set then we'll crash.
Kuninori Morimoto
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
Hi Mark
Thank you for your feedback
Quoted 9 lines
Quoted 6 lines
This function tries to get card name from
snd_soc_of_parse_card_name(). and it tries to setcard->namefromdai_linkif card still doesn't have name. So, above is optional 2nd try.
Or, do you mean this if (!card->name) can goes to simple-card, instead of utils ? I have no objection about it , but it can be double handling ? Because other simple family have same situation.If we try to dereference
card->dai_linkwithout checking to see if it's set then we'll crash.
Ahh, do you mean we need like this ?
if (!card->name && card->dai_link)
card->name = card->dai_link->name;
Mark Brown
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
Quoted 7 lines · Kuninori Morimoto
Quoted 2 lines
If we try to dereference
card->dai_linkwithout checking to see if it's set then we'll crash.Ahh, do you mean we need like this ?
if (!card->name &&
card->dai_link)card->name = card->dai_link->name;
Yes, exactly.
Kuninori Morimoto
maintainerRe: [PATCH 07/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
Hi Mark
Quoted 6 lines
Quoted 4 lines
Ahh, do you mean we need like this ?
if (!card->name &&
card->dai_link)card->name = card->dai_link->name;Yes, exactly.
OK, I understand.
next version will do it.
Kuninori Morimoto
maintainerPATCH v2 8/39 ASoC: simple-card-utils: add asoc_simple_card_parse_card_prefix()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
DPCM might need audio prefix for route matching. This patch makes this method simple style standard.
--- include/sound/simple_card_utils.h | 4 ++++ sound/soc/generic/simple-card-utils.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+)
include/sound/simple_card_utils.h +4 -0
@@ -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 */
sound/soc/generic/simple-card-utils.c +17 -0
@@ -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);
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH 08/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_card_prefix()
Quoted 6 lines · Kuninori Morimoto
sound/soc/generic/simple-card-utils.c +6
-0+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 ];
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_card_name(struct snd_soc_card *card, · line 144
Quoted 10 lines
sound/soc/generic/simple-card-utils.c +10
-0+ +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);
Similar thin wrapper comment as before: what is this offering over the underlying function?
Kuninori Morimoto
maintainerPATCH v2 9/39 ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
Current simple-card can get clock via DT clocks or "system-clock-frequency" property.
This patch makes it simple style standard
--- include/sound/simple_card_utils.h | 8 ++++++++ sound/soc/generic/simple-card-utils.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+)
include/sound/simple_card_utils.h +8 -0
@@ -38,4 +38,12 @@ int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card,struct snd_soc_codec_conf *codec_conf, 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 */
sound/soc/generic/simple-card-utils.c +30 -0
@@ -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_utils.h>
@@ -142,3 +143,32 @@ 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_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);
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
Quoted 10 lines · Kuninori Morimoto
sound/soc/generic/simple-card-utils.c +10
-0+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 );
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card, · line 170
Quoted 10 lines
sound/soc/generic/simple-card-utils.c +10
-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); + }
This looks like we're leaking the clocks - devm_ might help here perhaps?
Kuninori Morimoto
maintainerRe: [PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
Hi Mark
Quoted 15 lines
Quoted 15 lines
sound/soc/generic/simple-card-utils.c +15
-0+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;
Quoted 8 lines
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card, · line 170
Quoted 5 lines
sound/soc/generic/simple-card-utils.c +5
-0+ }else { + clk =of_clk_get (endpoint_np,0 ); +if (!IS_ERR (clk)) + simple_dai->sysclk =clk_get_rate (clk); + }This looks like we're leaking the clocks -
devm_might help here perhaps?
Good catch.
This came from original simple-card, but yes, we should use devm_* I will fix it on v3
Kuninori Morimoto
maintainerRe: [PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
Hi Mark, again
Quoted 24 lines
Quoted 15 lines
Quoted 15 lines
sound/soc/generic/simple-card-utils.c +15
-0+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;Quoted 8 lines
sound/soc/generic/simple-card-utils.c int asoc_simple_card_parse_card_prefix(struct snd_soc_card *card, · line 170
Quoted 5 lines
sound/soc/generic/simple-card-utils.c +5
-0+ }else { + clk =of_clk_get (endpoint_np,0 ); +if (!IS_ERR (clk)) + simple_dai->sysclk =clk_get_rate (clk); + }This looks like we're leaking the clocks -
devm_might help here perhaps?
Quoted 3 lines
Good catch.
This came from original simple-card, but yes, we should use devm_* I will fix it on v3
Oops, of_clk_get() doesn't have devm_of_clk_get() ? (and no of_clk_put() ... )
I will keep above as-is in v3. We can fix it incrementally (?)
Mark Brown
maintainerRe: [PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
Quoted 1 line · Kuninori Morimoto
Oops,
of_clk_get()doesn't havedevm_of_clk_get()?
Perhaps add it?
Quoted 2 lines
(and no
of_clk_put()... )
I will keep above as-is in v3. We can fix it incrementally (?)
You can just use regular clk_put() with of_clk_get().
Kuninori Morimoto
maintainerRe: [PATCH 09/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_clk()
Hi Mark
Quoted 8 lines
Quoted 1 line
Oops,
of_clk_get()doesn't havedevm_of_clk_get()?Perhaps add it?
Quoted 2 lines
(and no
of_clk_put()... )
I will keep above as-is in v3. We can fix it incrementally (?)You can just use regular
clk_put()withof_clk_get().
Ohh.. OK, but can I do it in additional patch ? Because main purpose of this patch is cleanup by using util.c, not adding new feature.
Maybe it can be
0001 add devm_of_clk_get()
0002 use devm_of_clk_get() on simple-card-utils.c
Kuninori Morimoto
maintainerPATCH v2 10/39 ASoC: simple-card-utils: add asoc_simple_card_parse_endpoint()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
simple-card needs to get its dai name and endpoint node. This patch makes it simple style standard
--- include/sound/simple_card_utils.h | 19 ++++++++++++++++++ sound/soc/generic/simple-card-utils.c | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+)
include/sound/simple_card_utils.h +19 -0
@@ -46,4 +46,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 */
sound/soc/generic/simple-card-utils.c +38 -0
@@ -172,3 +172,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);
Signature · 1 line
1.9.1
Mark Brown
maintainerRe: [PATCH 10/39 v2] ASoC: simple-card-utils: add asoc_simple_card_parse_endpoint()
Quoted 4 lines · Kuninori Morimoto
From: Kuninori Morimoto <[email protected]>
simple-card needs to get its dai name and endpoint node. This patch makes it simple style standard
I'm finding these descriptions very clear and hard to follow, and the lack of any changes to the simple-card code is a bit unclear. Can I suggest that future versions of this should have patches that move code out of simple-card to helper functions as a single patch rather than adding the helper in one and (I presume) the use in another?
In this case I'm not entirely clear what an endpoint is.
Kuninori Morimoto
maintainerPATCH v2 11/39 ASoC: simple-card-utils: add asoc_simple_card_init_dai()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
simple-card is supporting clock/tdm slot initialization. This patch makes this method simple style standard.
--- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+)
include/sound/simple_card_utils.h +2 -0
@@ -65,4 +65,6 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,const char *cells_name, int *is_single_links); +int asoc_simple_card_init_dai (struct snd_soc_dai *dai, +struct asoc_simple_dai *simple_dai);#endif /* __SIMPLE_CARD_CORE_H */
sound/soc/generic/simple-card-utils.c +29 -0
@@ -210,3 +210,32 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,return 0 ; }EXPORT_SYMBOL_GPL (asoc_simple_card_parse_endpoint); + +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);
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 12/39 ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
simple-card is assuming that sometimes platform and cpu are same. This patch makes this method simple style standard.
--- include/sound/simple_card_utils.h | 3 +++ sound/soc/generic/simple-card-utils.c | 13 +++++++++++++ 2 files changed, 16 insertions(+)
include/sound/simple_card_utils.h +3 -0
@@ -67,4 +67,7 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np,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 */
sound/soc/generic/simple-card-utils.c +13 -0
@@ -239,3 +239,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);
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 13/39 ASoC: simple-card-utils: add asoc_simple_card_canonicalize_cpu()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
simple-card needs remove dai_link->cpu_dai_name if it CPU was single DAI.
This patch makes this method simple style standard.
--- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+)
include/sound/simple_card_utils.h +2 -0
@@ -69,5 +69,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 */
sound/soc/generic/simple-card-utils.c +19 -0
@@ -252,3 +252,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);
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 14/39 ASoC: simple-card-utils: add asoc_simple_card_clean_reference()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
simple-card needs to decrease the reference count of the device nodes. This patch makes this method simple style standard.
--- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+)
include/sound/simple_card_utils.h +2 -0
@@ -72,4 +72,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 */
sound/soc/generic/simple-card-utils.c +15 -0
@@ -271,3 +271,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);
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 15/39 ASoC: simple-card: use asoc_simple_card_parse_daifmt()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- 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(-)
include/sound/simple_card.h +1 -10
@@ -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_utils.h> struct asoc_simple_card_info {const char *name;
sound/soc/generic/Kconfig +1 -0
@@ -3,5 +3,6 @@ config SND_SIMPLE_CARD_UTILS config SND_SIMPLE_CARD tristate "ASoC Simple sound card support" + select SND_SIMPLE_CARD_UTILS help This option enables generic simple sound card support
sound/soc/generic/simple-card.c +2 -44
58 lines not on this page · raw message
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 16/39 ASoC: simple-card: use asoc_simple_card_parse_clk()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 35 ++++++++++------------------------- 1 file changed, 10 insertions(+), 25 deletions(-)
sound/soc/generic/simple-card.c +10 -25
@@ -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 ;
@@ -371,6 +348,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;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 17/39 ASoC: simple-card: use asoc_simple_card_parse_endpoint()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 43 +++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 25 deletions(-)
sound/soc/generic/simple-card.c +18 -25
@@ -44,6 +44,8 @@ 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"#define PREFIX "simple-audio-card,"#define asoc_simple_card_init_hp (card, sjack, prefix)\
@@ -243,33 +245,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 ;
@@ -299,7 +279,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 */
@@ -329,10 +309,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;
@@ -399,7 +392,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:
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 18/39 ASoC: simple-card: use asoc_simple_card_parse_tdm()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 40 ++-------------------------------------- 1 file changed, 2 insertions(+), 38 deletions(-)
sound/soc/generic/simple-card.c +2 -38
@@ -238,31 +238,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,
@@ -322,22 +297,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;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 19/39 ASoC: simple-card: use asoc_simple_card_parse_card_name()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/soc/generic/simple-card.c +3 -8
@@ -376,9 +376,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,PREFIX "name" ); -/* The off-codec widgets */ if (of_property_read_bool (node,PREFIX "widgets" )) { ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
@@ -400,9 +397,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,PREFIX "dai-link" )) {struct device_node *np =NULL ;
@@ -425,8 +419,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,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,PREFIX ); +if (ret) +return ret;return 0 ; }
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: simple-card: use asoc_simple_card_parse_card_name()" to the asoc tree
The patch
ASoC: simple-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
Quoted 1 line
From
3527d85b85e65401b7d93073b3ab4e687cdd2521Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <[email protected]>
Date: Mon, 11 Jul 2016 23:59:40 +0000
Subject: [PATCH] ASoC: simple-card: use asoc_simple_card_parse_card_name()
--- sound/soc/generic/simple-card.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
sound/soc/generic/simple-card.c +3 -8
@@ -427,9 +427,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,PREFIX "name" ); -/* The off-codec widgets */ if (of_property_read_bool (node,PREFIX "widgets" )) { ret = snd_soc_of_parse_audio_simple_widgets(&priv->snd_card,
@@ -451,9 +448,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,PREFIX "dai-link" )) {struct device_node *np =NULL ;
@@ -476,8 +470,9 @@ static int asoc_simple_card_parse_of(struct device_node *node,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,PREFIX ); +if (ret) +return ret;return 0 ; }
Signature · 1 line
2.8.1
Kuninori Morimoto
maintainerPATCH v2 20/39 ASoC: simple-card: use asoc_simple_card_parse_dailink_name()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
sound/soc/generic/simple-card.c +2 -12
@@ -251,7 +251,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;
@@ -322,19 +321,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;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 21/39 ASoC: simple-card: use asoc_simple_card_init_dai()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-)
sound/soc/generic/simple-card.c +3 -35
@@ -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;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 22/39 ASoC: simple-card: use asoc_simple_card_canonicalize_dailink()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/soc/generic/simple-card.c +2 -7
@@ -280,14 +280,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 )
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 23/39 ASoC: simple-card: use asoc_simple_card_canonicalize_cpu()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-)
sound/soc/generic/simple-card.c +3 -11
@@ -300,17 +300,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);
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 24/39 ASoC: simple-card: use asoc_simple_card_clean_reference()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/generic/simple-card.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
sound/soc/generic/simple-card.c +2 -17
@@ -371,21 +371,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;
@@ -471,7 +456,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; }
@@ -483,7 +468,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[] = {
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 25/39 ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/Kconfig | 1 + sound/soc/sh/rcar/rsrc-card.c | 38 ++++---------------------------------- 2 files changed, 5 insertions(+), 34 deletions(-)
sound/soc/sh/Kconfig +1 -0
@@ -44,6 +44,7 @@ config SND_SOC_RCAR 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
sound/soc/sh/rcar/rsrc-card.c +4 -34
@@ -20,6 +20,7 @@#include <sound/jack.h> #include <sound/soc.h> #include <sound/soc-dai.h> +#include <sound/simple_card_utils.h> struct rsrc_card_of_data {const char *prefix;
@@ -158,38 +159,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)
@@ -357,6 +326,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 ;
@@ -369,8 +339,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 ;
Signature · 1 line
1.9.1
Mark Brown
maintainerApplied "ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()" to the asoc tree
The patch
ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
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
Quoted 1 line
From
d6a4a9a45d072e3a27ea6e5f98192d78be621a9cMon Sep 17 00:00:00 2001
From: Kuninori Morimoto <[email protected]>
Date: Thu, 30 Jun 2016 06:03:13 +0000
Subject: [PATCH] ASoC: rsrc-card: use asoc_simple_card_parse_daifmt()
--- sound/soc/sh/Kconfig | 1 + sound/soc/sh/rcar/rsrc-card.c | 38 ++++---------------------------------- 2 files changed, 5 insertions(+), 34 deletions(-)
sound/soc/sh/Kconfig +1 -0
@@ -44,6 +44,7 @@ config SND_SOC_RCAR 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
sound/soc/sh/rcar/rsrc-card.c +4 -34
@@ -20,6 +20,7 @@#include <sound/jack.h> #include <sound/soc.h> #include <sound/soc-dai.h> +#include <sound/simple_card_utils.h> struct rsrc_card_of_data {const char *prefix;
@@ -159,38 +160,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)
@@ -358,6 +327,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 ;
@@ -370,8 +340,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 ;
Signature · 1 line
2.8.1
Kuninori Morimoto
maintainerPATCH v2 26/39 ASoC: rsrc-card: use asoc_simple_card_parse_dailink_name()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +7 -14
@@ -47,7 +47,6 @@ static const struct of_device_id rsrc_card_of_match[] = { };MODULE_DEVICE_TABLE (of, rsrc_card_of_match); -#define DAI_NAME_NUM 32struct rsrc_card_dai {unsigned int sysclk;unsigned int tx_slot_mask;
@@ -55,7 +54,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
@@ -163,6 +162,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;
@@ -200,10 +200,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.
@@ -216,7 +212,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);
@@ -244,18 +239,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;
@@ -316,7 +309,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);
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 27/39 ASoC: rsrc-card: use asoc_simple_dai instead of rsrc_card_dai
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 26 ++++++++------------------ 1 file changed, 8 insertions(+), 18 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +8 -18
@@ -47,22 +47,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 1struct 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;
@@ -76,7 +66,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);
@@ -86,7 +76,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);
@@ -102,7 +92,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;
@@ -164,7 +154,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;
@@ -260,7 +250,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;
@@ -297,7 +287,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);
@@ -364,7 +354,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;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 28/39 ASoC: rsrc-card: use asoc_simple_card_parse_clk()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 68 +++++++------------------------------------ 1 file changed, 10 insertions(+), 58 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +10 -58
@@ -190,6 +190,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.
@@ -219,6 +223,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;
@@ -242,68 +250,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,
@@ -340,7 +292,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++;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 29/39 ASoC: rsrc-card: use asoc_simple_card_parse_endpoint()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +11 -16
@@ -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);
@@ -203,7 +198,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;
@@ -218,8 +213,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;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 30/39 ASoC: rsrc-card: use asoc_simple_card_parse_card_name()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +3 -5
@@ -334,9 +334,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);
@@ -352,8 +349,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 ; }
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 31/39 ASoC: rsrc-card: use asoc_simple_card_parse_card_prefix()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +5 -4
@@ -227,10 +227,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; } }
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 32/39 ASoC: rsrc-card: use asoc_simple_card_parse_tdm()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +4 -9
@@ -161,15 +161,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) {/* BE is dummy */ dai_link->codec_of_node =NULL ;
@@ -235,6 +226,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;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 33/39 ASoC: rsrc-card: use asoc_simple_card_init_dai()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +1 -25
@@ -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,
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 34/39 ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +5 -11
@@ -156,17 +156,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;
@@ -222,6 +211,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 ; }
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 35/39 ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +4 -2
@@ -199,8 +199,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->dpcm_playback =1 ; dai_link->dpcm_capture =1 ; dai_link->ops = &rsrc_card_ops;
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 36/39 ASoC: rsrc-card: use asoc_simple_card_clean_reference()
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
--- sound/soc/sh/rcar/rsrc-card.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +2 -17
@@ -324,21 +324,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;
@@ -364,7 +349,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; }
@@ -373,7 +358,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 = {
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 37/39 ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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".
--- sound/soc/sh/rcar/rsrc-card.c | 108 +++++++++++++++++++++--------------------- 1 file changed, 54 insertions(+), 54 deletions(-)
sound/soc/sh/rcar/rsrc-card.c +54 -54
@@ -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 <[email protected]>
@@ -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, +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;
@@ -157,7 +157,7 @@ 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);
@@ -168,7 +168,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 )
@@ -205,8 +205,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,
@@ -221,10 +221,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 ;
@@ -234,7 +234,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,
@@ -248,14 +248,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++;
@@ -264,11 +264,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;
@@ -313,7 +313,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;
@@ -324,9 +324,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;
@@ -336,7 +336,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);
@@ -354,25 +354,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 <[email protected]>" );
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 38/39 ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
In reply to Kuninori MorimotoFrom: Kuninori Morimoto <[email protected]>
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.
--- .../bindings/sound/renesas,rsrc-card.txt | 56 +++++++++-------- sound/soc/sh/rcar/rsrc-card.c | 71 +++++++--------------- 2 files changed, 52 insertions(+), 75 deletions(-)
Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt +30 -26
@@ -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>; };
sound/soc/sh/rcar/rsrc-card.c +22 -49
139 lines not on this page · raw message
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerPATCH v2 39/39 ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3
In reply to Kuninori Morimotorsrc-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.
---
.../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%)Documentation/devicetree/bindings/sound/simple-dpcm-card.txt renamed from Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt +0 -0
sound/soc/generic/Kconfig +6 -0
@@ -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
sound/soc/generic/Makefile +2 -0
@@ -1,5 +1,7 @@ obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) := 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) += snd-soc-simple-card.o +obj-$(CONFIG_SND_SIMPLE_DPCM_CARD) += snd-soc-simple-dpcm-card.o
sound/soc/generic/simple-dpcm-card.c renamed from sound/soc/sh/rcar/rsrc-card.c +0 -0
sound/soc/sh/Kconfig +0 -6
@@ -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 ##
sound/soc/sh/rcar/Makefile +0 -3
@@ -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
Signature · 1 line
1.9.1
Kuninori Morimoto
maintainerHi Mark
I know you are Mr busy man,
but do you have plan to review this patch-set ?
Should I re-send these ?
Quoted 78 lines
These are v2 of simple-card cleanup patches.
Main purpose of these patches are
- cleanup simple-card
- rename rsrc-card to simple-dpcm-cardMain diff v1 <-> v2 are
- remove duplicate header patch
- renamesimple-card-core.c->simple-card-utils.c
- remove dpcm function from simple-card-utils.
- remove jack/pin/gpio/ function from simple-card-utils.
- remove widgets/route function from simple-card-utils.I removed widgets/routing related function. it was very thin cosmetic functions. About jack/pin/gpio on simple-card, it is still have same method, but keeping it as static function.
dpcm related function too, it is keeping static.1) - 3) cleaup patch as prepare
4) - 14) simple-card-utils
15) - 24) simple-card
25) - 36) rsrc-card
37) - 39) rsrc-card -> simple-dpcm-cardKuninori Morimoto (39):
1) ASoC: rsrc-card: remove unuseddai_num
2) ASoC: simple-card: use common PREFIX for each DT property
3) ASoC: simple-card: add newasoc_simple_jackand use it
4) ASoC: add newsimple-card-utils.c
5) ASoC: simple-card-utils: addasoc_simple_card_parse_tdm()
6) ASoC: simple-card-utils: addasoc_simple_card_parse_dailink_name()
7) ASoC: simple-card-utils: addasoc_simple_card_parse_card_name()
8) ASoC: simple-card-utils: addasoc_simple_card_parse_card_prefix()
9) ASoC: simple-card-utils: addasoc_simple_card_parse_clk()
10) ASoC: simple-card-utils: addasoc_simple_card_parse_endpoint()
11) ASoC: simple-card-utils: addasoc_simple_card_init_dai()
12) ASoC: simple-card-utils: addasoc_simple_card_canonicalize_dailink()
13) ASoC: simple-card-utils: addasoc_simple_card_canonicalize_cpu()
14) ASoC: simple-card-utils: addasoc_simple_card_clean_reference()
15) ASoC: simple-card: useasoc_simple_card_parse_daifmt()
16) ASoC: simple-card: useasoc_simple_card_parse_clk()
17) ASoC: simple-card: useasoc_simple_card_parse_endpoint()
18) ASoC: simple-card: useasoc_simple_card_parse_tdm()
19) ASoC: simple-card: useasoc_simple_card_parse_card_name()
20) ASoC: simple-card: useasoc_simple_card_parse_dailink_name()
21) ASoC: simple-card: useasoc_simple_card_init_dai()
22) ASoC: simple-card: useasoc_simple_card_canonicalize_dailink()
23) ASoC: simple-card: useasoc_simple_card_canonicalize_cpu()
24) ASoC: simple-card: useasoc_simple_card_clean_reference()
25) ASoC: rsrc-card: useasoc_simple_card_parse_daifmt()
26) ASoC: rsrc-card: useasoc_simple_card_parse_dailink_name()
27) ASoC: rsrc-card: useasoc_simple_daiinstead ofrsrc_card_dai
28) ASoC: rsrc-card: useasoc_simple_card_parse_clk()
29) ASoC: rsrc-card: useasoc_simple_card_parse_endpoint()
30) ASoC: rsrc-card: useasoc_simple_card_parse_card_name()
31) ASoC: rsrc-card: useasoc_simple_card_parse_card_prefix()
32) ASoC: rsrc-card: useasoc_simple_card_parse_tdm()
33) ASoC: rsrc-card: useasoc_simple_card_init_dai()
34) ASoC: rsrc-card: useasoc_simple_card_canonicalize_cpu()
35) ASoC: rsrc-card: useasoc_simple_card_canonicalize_dailink()
36) ASoC: rsrc-card: useasoc_simple_card_clean_reference()
37) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase1
38) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase2
39) ASoC: rsrc-card: rename rsrc-card to simple-dpcm-card phase3Documentation/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_utils.h | 77 +++++++++++++++ sound/soc/generic/Kconfig | 10 ++ sound/soc/generic/Makefile | 4 + sound/soc/generic/simple-card-utils.c | 288 +++++++++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/generic/simple-card.c | 424 ++++++++++++++++++++++++------------------------------------------------------ sound/soc/generic/simple-dpcm-card.c | 351 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ sound/soc/sh/Kconfig | 5 - sound/soc/sh/rcar/Makefile | 3 - sound/soc/sh/rcar/rsrc-card.c | 529 -------------------------------------------------------------------------------------------------- 12 files changed, 937 insertions(+), 919 deletions(-)
Mark Brown
maintainerQuoted 3 lines · Kuninori Morimoto
Hi Mark
These are v2 of simple-card cleanup patches.
I've said this a few times before but *please* try to make these patch serieses smaller. A 20 patch series is a large patch series, this is twice that size...
Kuninori Morimoto
maintainerHi Mark
Quoted 5 lines
Quoted 1 line
These are v2 of simple-card cleanup patches.
I've said this a few times before but *please* try to make these patch serieses smaller. A 20 patch series is a large patch series, this is twice that size...
I'm sorry, this was from my misunderstanding.
v3 will be more small patch-set.