From 1f85e118c81d15aa9e002604dfb69c823d4aac16 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 3 Aug 2016 01:24:05 +0000 Subject: [PATCH 01/20] ASoC: simple-card-utils: add missing MODULE_xxx() simple-card-utils might be used as module, but MODULE_xxx() information was missed. This patch adds it. Otherwise, we will have below error, and can't use it. Specil thanks to Kevin. > insmod simple-card-utils.ko simple_card_utils: module license 'unspecified' taints kernel. Disabling lock debugging due to kernel taint simple_card_utils: Unknown symbol snd_soc_of_parse_daifmt (err 0) simple_card_utils: Unknown symbol snd_soc_of_parse_card_name (err 0) insmod: can't insert 'simple-card-utils.ko': \ unknown symbol in module, or unknown parameter Reported-by: Kevin Hilman Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/Makefile | 6 +++--- sound/soc/generic/simple-card-utils.c | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile index 45602ca8536e..2d53c8d70705 100644 --- a/sound/soc/generic/Makefile +++ b/sound/soc/generic/Makefile @@ -1,5 +1,5 @@ -obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) := simple-card-utils.o - +snd-soc-simple-card-utils-objs := simple-card-utils.o snd-soc-simple-card-objs := simple-card.o -obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o +obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) += snd-soc-simple-card-utils.o +obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index d89a9a1b2471..9599de69a880 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -7,6 +7,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include #include #include @@ -95,3 +96,8 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card, return 0; } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name); + +/* Module information */ +MODULE_AUTHOR("Kuninori Morimoto "); +MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); +MODULE_LICENSE("GPL v2"); From 28abd99b6e40741cd0e75be20817f23a3044d338 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 19 Jul 2016 02:53:13 +0000 Subject: [PATCH 02/20] ASoC: simple-card: use asoc_simple_card_parse_clk() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 35 ++++++++++----------------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 43295f024982..b37c81b09203 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -244,8 +244,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np, int *args_count) { struct of_phandle_args args; - struct clk *clk; - u32 val; int ret; if (!np) @@ -282,29 +280,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np, if (ret) return ret; - /* - * Parse dai->sysclk come from "clocks = <&xxx>" - * (if system has common clock) - * or "system-clock-frequency = " - * or device's module clock. - */ - if (of_property_read_bool(np, "clocks")) { - clk = of_clk_get(np, 0); - if (IS_ERR(clk)) { - ret = PTR_ERR(clk); - return ret; - } - - dai->sysclk = clk_get_rate(clk); - dai->clk = clk; - } else if (!of_property_read_u32(np, "system-clock-frequency", &val)) { - dai->sysclk = val; - } else { - clk = of_clk_get(args.np, 0); - if (!IS_ERR(clk)) - dai->sysclk = clk_get_rate(clk); - } - return 0; } @@ -316,6 +291,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, struct device *dev = simple_priv_to_dev(priv); struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); struct simple_dai_props *dai_props = simple_priv_to_props(priv, idx); + struct asoc_simple_dai *cpu_dai = &dai_props->cpu_dai; + struct asoc_simple_dai *codec_dai = &dai_props->codec_dai; struct device_node *cpu = NULL; struct device_node *plat = NULL; struct device_node *codec = NULL; @@ -370,6 +347,14 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, if (ret < 0) goto dai_link_of_err; + ret = asoc_simple_card_parse_clk_cpu(cpu, dai_link, cpu_dai); + if (ret < 0) + goto dai_link_of_err; + + ret = asoc_simple_card_parse_clk_codec(codec, dai_link, codec_dai); + if (ret < 0) + goto dai_link_of_err; + if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) { ret = -EINVAL; goto dai_link_of_err; From c9a235da8a61cf9af7653fca341ded0881a64eca Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 19 Jul 2016 02:53:32 +0000 Subject: [PATCH 03/20] ASoC: rsrc-card: use asoc_simple_card_parse_clk() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/rsrc-card.c | 68 ++++++----------------------------- 1 file changed, 10 insertions(+), 58 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index fa37f842b62f..ed5391f41280 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -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; + ret = asoc_simple_card_set_dailink_name(dev, dai_link, "fe.%s", dai_link->cpu_dai_name); @@ -225,6 +229,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; + ret = asoc_simple_card_set_dailink_name(dev, dai_link, "be.%s", dai_link->codec_dai_name); @@ -250,68 +258,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 = " - * 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, @@ -348,7 +300,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++; From bb6fc620c2ed972f58a0174f64f8dbd22a5911b1 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 8 Aug 2016 05:59:56 +0000 Subject: [PATCH 04/20] ASoC: simple-card-utils: add asoc_simple_card_parse_clk() Current simple-card can get clock via DT clocks or "system-clock-frequency" property. This patch makes it simple style standard Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- include/sound/simple_card_utils.h | 8 +++++++ sound/soc/generic/simple-card-utils.c | 30 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 86088aed9002..1392eb56cf0e 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -33,4 +33,12 @@ int asoc_simple_card_set_dailink_name(struct device *dev, int asoc_simple_card_parse_card_name(struct snd_soc_card *card, char *prefix); +#define asoc_simple_card_parse_clk_cpu(node, dai_link, simple_dai) \ + asoc_simple_card_parse_clk(node, dai_link->cpu_of_node, simple_dai) +#define asoc_simple_card_parse_clk_codec(node, dai_link, simple_dai) \ + asoc_simple_card_parse_clk(node, dai_link->codec_of_node, simple_dai) +int asoc_simple_card_parse_clk(struct device_node *node, + struct device_node *dai_of_node, + struct asoc_simple_dai *simple_dai); + #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 9599de69a880..16f65f972d04 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -7,6 +7,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include #include #include #include @@ -97,6 +98,35 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name); +int asoc_simple_card_parse_clk(struct device_node *node, + struct device_node *dai_of_node, + 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 = " + * or device's module clock. + */ + clk = of_clk_get(node, 0); + if (!IS_ERR(clk)) { + simple_dai->sysclk = clk_get_rate(clk); + simple_dai->clk = clk; + } else if (!of_property_read_u32(node, "system-clock-frequency", &val)) { + simple_dai->sysclk = val; + } else { + clk = of_clk_get(dai_of_node, 0); + if (!IS_ERR(clk)) + simple_dai->sysclk = clk_get_rate(clk); + } + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto "); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); From ae30a694da4c37b4d0c8b750c9a4104d8da749b3 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 8 Aug 2016 06:01:43 +0000 Subject: [PATCH 05/20] ASoC: simple-card-utils: add asoc_simple_card_parse_dai() simple-card needs to get its dai name and endpoint node. This patch makes it simple style standard Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- include/sound/simple_card_utils.h | 17 ++++++++++++ sound/soc/generic/simple-card-utils.c | 37 +++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 1392eb56cf0e..62b392695d2d 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -41,4 +41,21 @@ int asoc_simple_card_parse_clk(struct device_node *node, struct device_node *dai_of_node, struct asoc_simple_dai *simple_dai); +#define asoc_simple_card_parse_cpu(node, dai_link, \ + list_name, cells_name, is_single_link) \ + asoc_simple_card_parse_dai(node, &dai_link->cpu_of_node, \ + &dai_link->cpu_dai_name, list_name, cells_name, is_single_link) +#define asoc_simple_card_parse_codec(node, dai_link, list_name, cells_name) \ + asoc_simple_card_parse_dai(node, &dai_link->codec_of_node, \ + &dai_link->codec_dai_name, list_name, cells_name, NULL) +#define asoc_simple_card_parse_platform(node, dai_link, list_name, cells_name) \ + asoc_simple_card_parse_dai(node, &dai_link->platform_of_node, \ + NULL, list_name, cells_name, NULL) +int asoc_simple_card_parse_dai(struct device_node *node, + struct device_node **endpoint_np, + const char **dai_name, + const char *list_name, + const char *cells_name, + int *is_single_links); + #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 16f65f972d04..27e6d038a902 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -127,6 +127,43 @@ int asoc_simple_card_parse_clk(struct device_node *node, } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_clk); +int asoc_simple_card_parse_dai(struct device_node *node, + struct device_node **dai_of_node, + const char **dai_name, + const char *list_name, + const char *cells_name, + int *is_single_link) +{ + struct of_phandle_args args; + int ret; + + if (!node) + 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(node, list_name, cells_name, 0, &args); + if (ret) + return ret; + + /* Get dai->name */ + if (dai_name) { + ret = snd_soc_of_get_dai_name(node, dai_name); + if (ret < 0) + return ret; + } + + *dai_of_node = args.np; + + if (is_single_link) + *is_single_link = !args.args_count; + + return 0; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto "); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); From 44c16af1fa8a5b1464fd76834ee6943f721748fa Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 8 Aug 2016 06:02:07 +0000 Subject: [PATCH 06/20] ASoC: simple-card: use asoc_simple_card_parse_dai() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 43 ++++++++++++++------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index b37c81b09203..05d6e02c42f3 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -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; @@ -298,7 +278,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, struct device_node *codec = NULL; char prop[128]; char *prefix = ""; - int ret, cpu_args; + int ret, single_cpu; u32 val; /* For single DAI link & old style of DT node */ @@ -328,10 +308,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; @@ -392,7 +385,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: From 5bbf3866cbc1da23c628ad5dd7248cca8b8adc2c Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 8 Aug 2016 06:02:31 +0000 Subject: [PATCH 07/20] ASoC: rsrc-card: use asoc_simple_card_parse_dai() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/rsrc-card.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index ed5391f41280..82187e00eb12 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -62,6 +62,9 @@ struct rsrc_card_priv { #define rsrc_priv_to_link(priv, i) ((priv)->snd_card.dai_link + (i)) #define rsrc_priv_to_props(priv, i) ((priv)->dai_props + (i)) +#define DAI "sound-dai" +#define CELL "#sound-dai-cells" + static int rsrc_card_startup(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; @@ -155,18 +158,9 @@ static int rsrc_card_parse_links(struct device_node *np, struct device *dev = rsrc_priv_to_dev(priv); struct snd_soc_dai_link *dai_link = rsrc_priv_to_link(priv, idx); struct asoc_simple_dai *dai_props = rsrc_priv_to_props(priv, idx); - struct of_phandle_args args; + int is_single_links = 0; int ret; - /* - * Get node via "sound-dai = <&phandle port>" - * it will be used as xxx_of_node on soc_bind_dai_link() - */ - ret = of_parse_phandle_with_args(np, "sound-dai", - "#sound-dai-cells", 0, &args); - if (ret) - return ret; - /* Parse TDM slot */ ret = snd_soc_of_parse_tdm_slot(np, &dai_props->tx_slot_mask, @@ -185,9 +179,10 @@ static int rsrc_card_parse_links(struct device_node *np, /* FE settings */ dai_link->dynamic = 1; dai_link->dpcm_merged_format = 1; - dai_link->cpu_of_node = args.np; - ret = snd_soc_of_get_dai_name(np, &dai_link->cpu_dai_name); - if (ret < 0) + + ret = asoc_simple_card_parse_cpu(np, dai_link, DAI, CELL, + &is_single_links); + if (ret) return ret; ret = asoc_simple_card_parse_clk_cpu(np, dai_link, dai_props); @@ -209,7 +204,7 @@ static int rsrc_card_parse_links(struct device_node *np, * fmt_single_name() * fmt_multiple_name() */ - if (!args.args_count) + if (is_single_links) dai_link->cpu_dai_name = NULL; } else { const struct rsrc_card_of_data *of_data; @@ -224,8 +219,8 @@ static int rsrc_card_parse_links(struct device_node *np, /* BE settings */ dai_link->no_pcm = 1; dai_link->be_hw_params_fixup = rsrc_card_be_hw_params_fixup; - dai_link->codec_of_node = args.np; - ret = snd_soc_of_get_dai_name(np, &dai_link->codec_dai_name); + + ret = asoc_simple_card_parse_codec(np, dai_link, DAI, CELL); if (ret < 0) return ret; From c3b19c8dd069894961d0616aa3706df2920e7be4 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Mon, 8 Aug 2016 06:03:35 +0000 Subject: [PATCH 08/20] ASoC: simple-card: remove asoc_simple_card_sub_parse_of() asoc_simple_card_sub_parse_of() is no longer needed. Let's cleanup Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 46 ++++++--------------------------- 1 file changed, 8 insertions(+), 38 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 05d6e02c42f3..99028c190ea3 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -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, @@ -321,22 +296,17 @@ 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); + ret = snd_soc_of_parse_tdm_slot(cpu, &cpu_dai->tx_slot_mask, + &cpu_dai->rx_slot_mask, + &cpu_dai->slots, + &cpu_dai->slot_width); 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); - 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 = snd_soc_of_parse_tdm_slot(codec, &codec_dai->tx_slot_mask, + &codec_dai->rx_slot_mask, + &codec_dai->slots, + &codec_dai->slot_width); if (ret < 0) goto dai_link_of_err; From 21ba62f849a20accf7d41e3056ea8913bc23cfb1 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 9 Aug 2016 05:48:30 +0000 Subject: [PATCH 09/20] ASoC: simple-card-utils: add asoc_simple_card_init_dai() simple-card is supporting clock/tdm slot initialization. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 29 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 62b392695d2d..13168e029232 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -58,4 +58,6 @@ int asoc_simple_card_parse_dai(struct device_node *node, 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 */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 27e6d038a902..33abe1f7014e 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -164,6 +164,35 @@ int asoc_simple_card_parse_dai(struct device_node *node, } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dai); +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); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto "); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); From d8cb9354c86dddb1fb67d3f247c9ebbacd6b4c07 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 9 Aug 2016 05:48:53 +0000 Subject: [PATCH 10/20] ASoC: simple-card: use asoc_simple_card_init_dai() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 38 +++------------------------------ 1 file changed, 3 insertions(+), 35 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 99028c190ea3..03ecca85a724 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -179,51 +179,19 @@ static struct snd_soc_ops asoc_simple_card_ops = { .hw_params = asoc_simple_card_hw_params, }; -static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, - struct asoc_simple_dai *set) -{ - int ret; - - if (set->sysclk) { - ret = snd_soc_dai_set_sysclk(dai, 0, set->sysclk, 0); - if (ret && ret != -ENOTSUPP) { - dev_err(dai->dev, "simple-card: set_sysclk error\n"); - goto err; - } - } - - if (set->slots) { - ret = snd_soc_dai_set_tdm_slot(dai, - set->tx_slot_mask, - set->rx_slot_mask, - set->slots, - set->slot_width); - if (ret && ret != -ENOTSUPP) { - dev_err(dai->dev, "simple-card: set_tdm_slot error\n"); - goto err; - } - } - - ret = 0; - -err: - return ret; -} - static int asoc_simple_card_dai_init(struct snd_soc_pcm_runtime *rtd) { struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); struct snd_soc_dai *codec = rtd->codec_dai; struct snd_soc_dai *cpu = rtd->cpu_dai; - struct simple_dai_props *dai_props; + struct simple_dai_props *dai_props = &priv->dai_props[rtd->num]; int ret; - dai_props = &priv->dai_props[rtd->num]; - ret = __asoc_simple_card_dai_init(codec, &dai_props->codec_dai); + ret = asoc_simple_card_init_dai(codec, &dai_props->codec_dai); if (ret < 0) return ret; - ret = __asoc_simple_card_dai_init(cpu, &dai_props->cpu_dai); + ret = asoc_simple_card_init_dai(cpu, &dai_props->cpu_dai); if (ret < 0) return ret; From c262c9ab7a956b15c4c12b81472502a587d0dfcd Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 9 Aug 2016 05:49:41 +0000 Subject: [PATCH 11/20] ASoC: simple-card-utils: add asoc_simple_card_canonicalize_dailink() simple-card is assuming that sometimes platform and cpu are same. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- include/sound/simple_card_utils.h | 3 +++ sound/soc/generic/simple-card-utils.c | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 13168e029232..a71d46a95ca8 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -60,4 +60,7 @@ int asoc_simple_card_parse_dai(struct device_node *node, int asoc_simple_card_init_dai(struct snd_soc_dai *dai, struct asoc_simple_dai *simple_dai); + +int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link); + #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 33abe1f7014e..189eadddfad3 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -193,6 +193,19 @@ int asoc_simple_card_init_dai(struct snd_soc_dai *dai, } 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); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto "); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); From c958374f1cd22ec87f210985f9f9e1ba8b3df30b Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 9 Aug 2016 05:50:02 +0000 Subject: [PATCH 12/20] ASoC: simple-card: use asoc_simple_card_canonicalize_dailink() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 03ecca85a724..8b1efdd2b115 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -286,14 +286,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_set_dailink_name(dev, dai_link, "%s-%s", From 600ee2085515c03a7a4a6025034fefccf29e5a24 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 9 Aug 2016 05:49:21 +0000 Subject: [PATCH 13/20] ASoC: rsrc-card: use asoc_simple_card_init_dai() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/rsrc-card.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 82187e00eb12..1bf35634ebba 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -97,7 +97,6 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dai_link *dai_link; struct asoc_simple_dai *dai_props; int num = rtd->num; - int ret; dai_link = rsrc_priv_to_link(priv, num); dai_props = rsrc_priv_to_props(priv, num); @@ -105,30 +104,7 @@ static int rsrc_card_dai_init(struct snd_soc_pcm_runtime *rtd) rtd->cpu_dai : rtd->codec_dai; - if (dai_props->sysclk) { - ret = snd_soc_dai_set_sysclk(dai, 0, dai_props->sysclk, 0); - if (ret && ret != -ENOTSUPP) { - dev_err(dai->dev, "set_sysclk error\n"); - goto err; - } - } - - if (dai_props->slots) { - ret = snd_soc_dai_set_tdm_slot(dai, - dai_props->tx_slot_mask, - dai_props->rx_slot_mask, - dai_props->slots, - dai_props->slot_width); - if (ret && ret != -ENOTSUPP) { - dev_err(dai->dev, "set_tdm_slot error\n"); - goto err; - } - } - - ret = 0; - -err: - return ret; + return asoc_simple_card_init_dai(dai, dai_props); } static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, From a09f383ef72947b7d59fc7fe50fe332ab5c35dca Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Tue, 9 Aug 2016 05:50:19 +0000 Subject: [PATCH 14/20] ASoC: rsrc-card: use asoc_simple_card_canonicalize_dailink() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/rsrc-card.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 1bf35634ebba..0bf17dae2b64 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -222,8 +222,10 @@ static int rsrc_card_parse_links(struct device_node *np, } } - /* Simple Card assumes platform == cpu */ - dai_link->platform_of_node = dai_link->cpu_of_node; + 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; From 983cebd602af8c2bf9d5830f15fb4e18fb38f994 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 10 Aug 2016 02:20:19 +0000 Subject: [PATCH 15/20] ASoC: simple-card-utils: add asoc_simple_card_canonicalize_cpu() simple-card needs remove dai_link->cpu_dai_name if it CPU was single DAI. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index a71d46a95ca8..f760f559393e 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -62,5 +62,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); +void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link, + int is_single_links); #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 189eadddfad3..c5d32dad48b2 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -206,6 +206,23 @@ int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link) } EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_dailink); +void 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; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_canonicalize_cpu); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto "); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); From 16f1de6f3656519120fd4a88d6b21fc3da8d373a Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 10 Aug 2016 02:20:43 +0000 Subject: [PATCH 16/20] ASoC: simple-card: use asoc_simple_card_canonicalize_cpu() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 8b1efdd2b115..64896e361bde 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -309,17 +309,7 @@ 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; + asoc_simple_card_canonicalize_cpu(dai_link, single_cpu); dai_link_of_err: of_node_put(cpu); From 27b010815bcfbb2cc79de7544547e33e4d169594 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 10 Aug 2016 02:21:03 +0000 Subject: [PATCH 17/20] ASoC: rsrc-card: use asoc_simple_card_canonicalize_cpu() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/rsrc-card.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 0bf17dae2b64..dd5eda1f9a29 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -134,7 +134,6 @@ 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); - int is_single_links = 0; int ret; /* Parse TDM slot */ @@ -147,6 +146,8 @@ static int rsrc_card_parse_links(struct device_node *np, return ret; if (is_fe) { + int is_single_links = 0; + /* BE is dummy */ dai_link->codec_of_node = NULL; dai_link->codec_dai_name = "snd-soc-dummy-dai"; @@ -171,17 +172,7 @@ 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; + asoc_simple_card_canonicalize_cpu(dai_link, is_single_links); } else { const struct rsrc_card_of_data *of_data; From 0f4e0711b735a148cb6da0e6f91253b62fc2c5b2 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 10 Aug 2016 02:21:25 +0000 Subject: [PATCH 18/20] ASoC: simple-card-utils: add asoc_simple_card_clean_reference() simple-card needs to decrease the reference count of the device nodes. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- include/sound/simple_card_utils.h | 2 ++ sound/soc/generic/simple-card-utils.c | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index f760f559393e..403ec92164fc 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -65,4 +65,6 @@ int asoc_simple_card_canonicalize_dailink(struct snd_soc_dai_link *dai_link); void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link, int is_single_links); +int asoc_simple_card_clean_reference(struct snd_soc_card *card); + #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index c5d32dad48b2..1cb39309f5d5 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -223,6 +223,21 @@ void asoc_simple_card_canonicalize_cpu(struct snd_soc_dai_link *dai_link, } 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); + /* Module information */ MODULE_AUTHOR("Kuninori Morimoto "); MODULE_DESCRIPTION("ALSA SoC Simple Card Utils"); From 885fc0595a3e91ed7b6f78ea419952345be0222b Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 10 Aug 2016 02:21:42 +0000 Subject: [PATCH 19/20] ASoC: simple-card: use asoc_simple_card_clean_reference() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 64896e361bde..55638a800f20 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -378,21 +378,6 @@ static int asoc_simple_card_parse_of(struct device_node *node, return 0; } -/* Decrease the reference count of the device nodes */ -static int asoc_simple_card_unref(struct snd_soc_card *card) -{ - struct snd_soc_dai_link *dai_link; - int num_links; - - for (num_links = 0, dai_link = card->dai_link; - num_links < card->num_links; - num_links++, dai_link++) { - of_node_put(dai_link->cpu_of_node); - of_node_put(dai_link->codec_of_node); - } - return 0; -} - static int asoc_simple_card_probe(struct platform_device *pdev) { struct simple_card_data *priv; @@ -478,7 +463,7 @@ static int asoc_simple_card_probe(struct platform_device *pdev) return ret; err: - asoc_simple_card_unref(&priv->snd_card); + asoc_simple_card_clean_reference(&priv->snd_card); return ret; } @@ -490,7 +475,7 @@ static int asoc_simple_card_remove(struct platform_device *pdev) asoc_simple_card_remove_jack(&priv->hp_jack); asoc_simple_card_remove_jack(&priv->mic_jack); - return asoc_simple_card_unref(card); + return asoc_simple_card_clean_reference(card); } static const struct of_device_id asoc_simple_of_match[] = { From 239486baee2bbefd81053cd4a168f90ce5c46fa2 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 10 Aug 2016 02:22:01 +0000 Subject: [PATCH 20/20] ASoC: rsrc-card: use asoc_simple_card_clean_reference() Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/sh/rcar/rsrc-card.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index dd5eda1f9a29..16dc13e0bec9 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -333,21 +333,6 @@ static int rsrc_card_parse_of(struct device_node *node, return 0; } -/* Decrease the reference count of the device nodes */ -static int rsrc_card_unref(struct snd_soc_card *card) -{ - struct snd_soc_dai_link *dai_link; - int num_links; - - for (num_links = 0, dai_link = card->dai_link; - num_links < card->num_links; - num_links++, dai_link++) { - of_node_put(dai_link->cpu_of_node); - of_node_put(dai_link->codec_of_node); - } - return 0; -} - static int rsrc_card_probe(struct platform_device *pdev) { struct rsrc_card_priv *priv; @@ -373,7 +358,7 @@ static int rsrc_card_probe(struct platform_device *pdev) if (ret >= 0) return ret; err: - rsrc_card_unref(&priv->snd_card); + asoc_simple_card_clean_reference(&priv->snd_card); return ret; } @@ -382,7 +367,7 @@ static int rsrc_card_remove(struct platform_device *pdev) { struct snd_soc_card *card = platform_get_drvdata(pdev); - return rsrc_card_unref(card); + return asoc_simple_card_clean_reference(card); } static struct platform_driver rsrc_card = {