Skip to contentSkip to conversation

ASoC: cs4271: Convert to table based control init

PATCH In review Mark Brown 3 participants 6 messages Aug 11, 2013

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author maintainer
#0 lore raw

PATCH 1/2 ASoC: cs4271: Convert to table based control init

From: Mark Brown <[email protected]>

---
 sound/soc/codecs/cs4271.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/codecs/cs4271.c +4 -2
index 03036b3..65ad56c 100644
@@ -576,8 +576,7 @@ static int cs4271_probe(struct snd_soc_codec *codec)
 				   CS4271_MODE2_MUTECAEQUB,
 				   CS4271_MODE2_MUTECAEQUB);
 
-	return snd_soc_add_codec_controls(codec, cs4271_snd_controls,
-		ARRAY_SIZE(cs4271_snd_controls));
+	return 0;
 }
 
 static int cs4271_remove(struct snd_soc_codec *codec)
@@ -596,6 +595,9 @@ static struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
 	.remove			= cs4271_remove,
 	.suspend		= cs4271_soc_suspend,
 	.resume			= cs4271_soc_resume,
+
+	.controls		= cs4271_snd_controls,
+	.num_controls		= ARRAY_SIZE(cs4271_snd_controls),
 };
 
 #if defined(CONFIG_SPI_MASTER)
Signature · 1 line
1.8.4.rc1
author maintainer
#1 lore raw

PATCH 2/2 ASoC: cs4271: Add DAPM support

From: Mark Brown <[email protected]>

This makes it possible to hook the device into a more complex board and ensures it will continue to work with non-DAPM support removed from the core.

---
 sound/soc/codecs/cs4271.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
sound/soc/codecs/cs4271.c +24 -0
index 65ad56c..35a6a67 100644
@@ -173,6 +173,26 @@ struct cs4271_private {
 	bool				enable_soft_reset;
 };
 
+static const struct snd_soc_dapm_widget cs4271_dapm_widgets[] = {
+SND_SOC_DAPM_INPUT("AINA"),
+SND_SOC_DAPM_INPUT("AINB"),
+
+SND_SOC_DAPM_OUTPUT("AOUTA+"),
+SND_SOC_DAPM_OUTPUT("AOUTA-"),
+SND_SOC_DAPM_OUTPUT("AOUTB+"),
+SND_SOC_DAPM_OUTPUT("AOUTB-"),
+};
+
+static const struct snd_soc_dapm_route cs4271_dapm_routes[] = {
+	{ "Capture", NULL, "AINL" },
+	{ "Capture", NULL, "AINR" },
+
+	{ "AOUTA+", NULL, "Playback" },
+	{ "AOUTA-", NULL, "Playback" },
+	{ "AOUTB+", NULL, "Playback" },
+	{ "AOUTB-", NULL, "Playback" },
+};
+
 /*
  * @freq is the desired MCLK rate
  * MCLK rate should (c) be the sample rate, multiplied by one of the
@@ -598,6 +618,10 @@ static struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
 
 	.controls		= cs4271_snd_controls,
 	.num_controls		= ARRAY_SIZE(cs4271_snd_controls),
+	.dapm_widgets		= cs4271_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(cs4271_dapm_widgets),
+	.dapm_routes		= cs4271_dapm_routes,
+	.num_dapm_routes	= ARRAY_SIZE(cs4271_dapm_routes),
 };
 
 #if defined(CONFIG_SPI_MASTER)
Signature · 1 line
1.8.4.rc1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ASoC: cs4271: Add DAPM support

Hello!

Quoted 7 lines · Mark Brown

From: Mark Brown <[email protected]>

This makes it possible to hook the device into a more complex board and ensures it will continue to work with non-DAPM support removed from the core.

Quoted 46 lines
---
 sound/soc/codecs/cs4271.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
sound/soc/codecs/cs4271.c +24 -0
index 65ad56c..35a6a67 100644
@@ -173,6 +173,26 @@ struct cs4271_private {
 	bool				enable_soft_reset;
 };
 
+static const struct snd_soc_dapm_widget cs4271_dapm_widgets[] = {
+SND_SOC_DAPM_INPUT("AINA"),
+SND_SOC_DAPM_INPUT("AINB"),
+
+SND_SOC_DAPM_OUTPUT("AOUTA+"),
+SND_SOC_DAPM_OUTPUT("AOUTA-"),
+SND_SOC_DAPM_OUTPUT("AOUTB+"),
+SND_SOC_DAPM_OUTPUT("AOUTB-"),
+};
+
+static const struct snd_soc_dapm_route cs4271_dapm_routes[] = {
+	{ "Capture", NULL, "AINL" },
+	{ "Capture", NULL, "AINR" },
+
+	{ "AOUTA+", NULL, "Playback" },
+	{ "AOUTA-", NULL, "Playback" },
+	{ "AOUTB+", NULL, "Playback" },
+	{ "AOUTB-", NULL, "Playback" },
+};
+
 /*
  * @freq is the desired MCLK rate
  * MCLK rate should (c) be the sample rate, multiplied by one of the
@@ -598,6 +618,10 @@ static struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
 
 	.controls		= cs4271_snd_controls,
 	.num_controls		= ARRAY_SIZE(cs4271_snd_controls),
+	.dapm_widgets		= cs4271_dapm_widgets,
+	.num_dapm_widgets	= ARRAY_SIZE(cs4271_dapm_widgets),
+	.dapm_routes		= cs4271_dapm_routes,
+	.num_dapm_routes	= ARRAY_SIZE(cs4271_dapm_routes),
 };
 
 #if defined(CONFIG_SPI_MASTER)
#3 lore raw

Re: [PATCH 2/2] ASoC: cs4271: Add DAPM support

In reply to Mark Brown

sound/soc/codecs/cs4271.c struct cs4271_private { · line 188

Quoted 13 lines · Mark Brown
sound/soc/codecs/cs4271.c +13 -0
+static const struct snd_soc_dapm_widget cs4271_dapm_widgets[] = {
+SND_SOC_DAPM_INPUT("AINA"),
+SND_SOC_DAPM_INPUT("AINB"),
+
+SND_SOC_DAPM_OUTPUT("AOUTA+"),
+SND_SOC_DAPM_OUTPUT("AOUTA-"),
+SND_SOC_DAPM_OUTPUT("AOUTB+"),
+SND_SOC_DAPM_OUTPUT("AOUTB-"),
+};
+
+static const struct snd_soc_dapm_route cs4271_dapm_routes[] = {
+	{ "Capture", NULL, "AINL" },
+	{ "Capture", NULL, "AINR" },

Here you call the widgets "AINL"/"AINR", while above it's "AINA"/"AINB".
According to the datasheet, the latter is
correct.

Daniel

author maintainer
#4 lore raw

Re: [PATCH 2/2] ASoC: cs4271: Add DAPM support

Quoted 3 lines · Daniel Mack

Here you call the widgets "AINL"/"AINR", while above it's "AINA"/"AINB".
According to the datasheet, the latter is
correct.

Fixed, thanks.

Acked-by on v1 1/2
#5 lore raw
In reply to Mark Brown

Hello!

Quoted 3 lines · Mark Brown

From: Mark Brown <[email protected]>

Quoted 28 lines
---
 sound/soc/codecs/cs4271.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/codecs/cs4271.c +4 -2
index 03036b3..65ad56c 100644
@@ -576,8 +576,7 @@ static int cs4271_probe(struct snd_soc_codec *codec)
 				   CS4271_MODE2_MUTECAEQUB,
 				   CS4271_MODE2_MUTECAEQUB);
 
-	return snd_soc_add_codec_controls(codec, cs4271_snd_controls,
-		ARRAY_SIZE(cs4271_snd_controls));
+	return 0;
 }
 
 static int cs4271_remove(struct snd_soc_codec *codec)
@@ -596,6 +595,9 @@ static struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
 	.remove			= cs4271_remove,
 	.suspend		= cs4271_soc_suspend,
 	.resume			= cs4271_soc_resume,
+
+	.controls		= cs4271_snd_controls,
+	.num_controls		= ARRAY_SIZE(cs4271_snd_controls),
 };
 
 #if defined(CONFIG_SPI_MASTER)