From e0ae225b7e96e50daaa3ca8d3cd2c944ce48e007 Mon Sep 17 00:00:00 2001 From: Jun Nie Date: Wed, 29 Apr 2015 18:11:07 +0800 Subject: ASoC: simple-card: support platform in dts parse Support platform in dts parse so that dma pcm component can be added in dts. Signed-off-by: Jun Nie Signed-off-by: Mark Brown --- sound/soc/generic/simple-card.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 33feee9ca8c3..c87e58504a62 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -307,6 +307,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, 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 device_node *cpu = NULL; + struct device_node *plat = NULL; struct device_node *codec = NULL; char *name; char prop[128]; @@ -320,6 +321,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, snprintf(prop, sizeof(prop), "%scpu", prefix); cpu = of_get_child_by_name(node, prop); + snprintf(prop, sizeof(prop), "%splat", prefix); + plat = of_get_child_by_name(node, prop); + snprintf(prop, sizeof(prop), "%scodec", prefix); codec = of_get_child_by_name(node, prop); @@ -352,8 +356,16 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, goto dai_link_of_err; } - /* Simple Card assumes platform == cpu */ - dai_link->platform_of_node = dai_link->cpu_of_node; + if (plat) { + struct of_phandle_args args; + + ret = of_parse_phandle_with_args(plat, "sound-dai", + "#sound-dai-cells", 0, &args); + dai_link->platform_of_node = args.np; + } else { + /* Assumes platform == cpu */ + dai_link->platform_of_node = dai_link->cpu_of_node; + } /* DAI link name is created from CPU/CODEC dai name */ name = devm_kzalloc(dev, -- cgit v1.2.3 From aa3a0f2ec79b72acfb48ef8c326da711b2a096e6 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 May 2015 18:46:12 +0200 Subject: ASoC: ssm2518: Replace direct snd_soc_codec dapm field access The dapm field of the snd_soc_codec struct is eventually going to be removed, in preparation for this replace all manual access to codec->dapm.bias_level with snd_soc_codec_get_bias_level(). Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ssm2518.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/ssm2518.c b/sound/soc/codecs/ssm2518.c index 67ea55adb307..6608903bff0d 100644 --- a/sound/soc/codecs/ssm2518.c +++ b/sound/soc/codecs/ssm2518.c @@ -510,7 +510,7 @@ static int ssm2518_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: - if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) + if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) ret = ssm2518_set_power(ssm2518, true); break; case SND_SOC_BIAS_OFF: -- cgit v1.2.3 From fa68cfd4c1d3f1a277777942966c9f94d78d1c53 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 May 2015 18:46:13 +0200 Subject: ASoC: ssm2602: Replace direct snd_soc_codec dapm field access The dapm field of the snd_soc_codec struct is eventually going to be removed, in preparation for this replace all manual access to codec->dapm with snd_soc_codec_get_dapm(). Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ssm2602.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c index 314eaece1b7d..40190e0a3dc9 100644 --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -524,8 +524,8 @@ static int ssm2602_resume(struct snd_soc_codec *codec) static int ssm2602_codec_probe(struct snd_soc_codec *codec) { + struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); - struct snd_soc_dapm_context *dapm = &codec->dapm; int ret; regmap_update_bits(ssm2602->regmap, SSM2602_LOUT1V, @@ -549,7 +549,7 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec) static int ssm2604_codec_probe(struct snd_soc_codec *codec) { - struct snd_soc_dapm_context *dapm = &codec->dapm; + struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); int ret; ret = snd_soc_dapm_new_controls(dapm, ssm2604_dapm_widgets, -- cgit v1.2.3 From 9a122de678e11fb70b85c6b319b4b1359d8fcb5e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Mon, 4 May 2015 18:46:14 +0200 Subject: ASoC: ssm4567: Replace direct snd_soc_codec dapm field access The dapm field of the snd_soc_codec struct is eventually going to be removed, in preparation for this replace all manual access to codec->dapm.bias_level with snd_soc_codec_get_bias_level(). Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/codecs/ssm4567.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/ssm4567.c b/sound/soc/codecs/ssm4567.c index a984485108cd..466258736706 100644 --- a/sound/soc/codecs/ssm4567.c +++ b/sound/soc/codecs/ssm4567.c @@ -353,7 +353,7 @@ static int ssm4567_set_bias_level(struct snd_soc_codec *codec, case SND_SOC_BIAS_PREPARE: break; case SND_SOC_BIAS_STANDBY: - if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) + if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) ret = ssm4567_set_power(ssm4567, true); break; case SND_SOC_BIAS_OFF: -- cgit v1.2.3 From 79ffbf11b77d4ded9935cdd291a84936b7f003ef Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sat, 9 May 2015 23:08:33 +0800 Subject: ASoC: sta32x: Use devm_gpiod_get_optional at appropriate place devm_gpiod_get_optional() is equivalent to devm_gpiod_get(), except that when no GPIO was assigned to the requested function it will return NULL. This is convenient for drivers that need to handle optional GPIOs. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- sound/soc/codecs/sta32x.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 007a0e3bc273..0111baf9a5d4 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -1096,16 +1096,10 @@ static int sta32x_i2c_probe(struct i2c_client *i2c, #endif /* GPIOs */ - sta32x->gpiod_nreset = devm_gpiod_get(dev, "reset"); - if (IS_ERR(sta32x->gpiod_nreset)) { - ret = PTR_ERR(sta32x->gpiod_nreset); - if (ret != -ENOENT && ret != -ENOSYS) - return ret; - - sta32x->gpiod_nreset = NULL; - } else { - gpiod_direction_output(sta32x->gpiod_nreset, 0); - } + sta32x->gpiod_nreset = devm_gpiod_get_optional(dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(sta32x->gpiod_nreset)) + return PTR_ERR(sta32x->gpiod_nreset); /* regulators */ for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++) -- cgit v1.2.3