alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control
@ 2014-03-01 14:48 Lars-Peter Clausen
  2014-03-01 14:48 ` [PATCH 2/8] ASoC: pxa: e740_wm9705: Convert to table based DAPM setup Lars-Peter Clausen
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 14:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Russell King, alsa-devel, Lars-Peter Clausen, Eric Miao, Haojian Zhuang

When calling {corgi,poodle,spitz}_ext_control() from the startup callback we
pass the CODEC's DAPM context instead of the card's DAPM context. This is not a
problem per se since all the DAPM functions in ext_control() fallback to widgets
from other DAPM contexts, but passing the card's context is more consistent.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/pxa/corgi.c  | 3 +--
 sound/soc/pxa/poodle.c | 3 +--
 sound/soc/pxa/spitz.c  | 3 +--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index b4db3b9..5a88136 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -101,10 +101,9 @@ static void corgi_ext_control(struct snd_soc_dapm_context *dapm)
 static int corgi_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
 
 	/* check the jack status at stream startup */
-	corgi_ext_control(&codec->dapm);
+	corgi_ext_control(&rtd->card->dapm);
 
 	return 0;
 }
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 27c6c03..c6bdc6c 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -74,10 +74,9 @@ static void poodle_ext_control(struct snd_soc_dapm_context *dapm)
 static int poodle_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
 
 	/* check the jack status at stream startup */
-	poodle_ext_control(&codec->dapm);
+	poodle_ext_control(&rtd->card->dapm);
 
 	return 0;
 }
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index a3a13c9..1373b01 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -111,10 +111,9 @@ static void spitz_ext_control(struct snd_soc_dapm_context *dapm)
 static int spitz_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
 
 	/* check the jack status at stream startup */
-	spitz_ext_control(&codec->dapm);
+	spitz_ext_control(&rtd->card->dapm);
 
 	return 0;
 }
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/8] ASoC: pxa: e740_wm9705: Convert to table based DAPM setup
  2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
@ 2014-03-01 14:48 ` Lars-Peter Clausen
  2014-03-03  2:04   ` Mark Brown
  2014-03-01 14:48 ` [PATCH 3/8] ASoC: pxa: e750_wm9705: " Lars-Peter Clausen
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 14:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Russell King, alsa-devel, Lars-Peter Clausen, Eric Miao, Haojian Zhuang

Use table based setup to register the DAPM widgets and routes. This on one hand
makes the code a bit cleaner and on the other hand the board level DAPM elements
get registered in the card's DAPM context rather than in the CODEC's DAPM
context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/pxa/e740_wm9705.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c
index 44b5c09..c29feda 100644
--- a/sound/soc/pxa/e740_wm9705.c
+++ b/sound/soc/pxa/e740_wm9705.c
@@ -103,11 +103,6 @@ static int e740_ac97_init(struct snd_soc_pcm_runtime *rtd)
 	snd_soc_dapm_nc_pin(dapm, "PCBEEP");
 	snd_soc_dapm_nc_pin(dapm, "MIC2");
 
-	snd_soc_dapm_new_controls(dapm, e740_dapm_widgets,
-					ARRAY_SIZE(e740_dapm_widgets));
-
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
 	return 0;
 }
 
@@ -136,6 +131,11 @@ static struct snd_soc_card e740 = {
 	.owner = THIS_MODULE,
 	.dai_link = e740_dai,
 	.num_links = ARRAY_SIZE(e740_dai),
+
+	.dapm_widgets = e740_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(e740_dapm_widgets),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
 static struct gpio e740_audio_gpios[] = {
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/8] ASoC: pxa: e750_wm9705: Convert to table based DAPM setup
  2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
  2014-03-01 14:48 ` [PATCH 2/8] ASoC: pxa: e740_wm9705: Convert to table based DAPM setup Lars-Peter Clausen
@ 2014-03-01 14:48 ` Lars-Peter Clausen
  2014-03-03  2:05   ` Mark Brown
  2014-03-01 14:48 ` [PATCH 4/8] ASoC: pxa: e800_wm9712: " Lars-Peter Clausen
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 14:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Russell King, alsa-devel, Lars-Peter Clausen, Eric Miao, Haojian Zhuang

Use table based setup to register the DAPM widgets and routes. This on one hand
makes the code a bit cleaner and on the other hand the board level DAPM elements
get registered in the card's DAPM context rather than in the CODEC's DAPM
context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/pxa/e750_wm9705.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c
index c34e447..ee36aba 100644
--- a/sound/soc/pxa/e750_wm9705.c
+++ b/sound/soc/pxa/e750_wm9705.c
@@ -85,11 +85,6 @@ static int e750_ac97_init(struct snd_soc_pcm_runtime *rtd)
 	snd_soc_dapm_nc_pin(dapm, "PCBEEP");
 	snd_soc_dapm_nc_pin(dapm, "MIC2");
 
-	snd_soc_dapm_new_controls(dapm, e750_dapm_widgets,
-					ARRAY_SIZE(e750_dapm_widgets));
-
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
 	return 0;
 }
 
@@ -119,6 +114,11 @@ static struct snd_soc_card e750 = {
 	.owner = THIS_MODULE,
 	.dai_link = e750_dai,
 	.num_links = ARRAY_SIZE(e750_dai),
+
+	.dapm_widgets = e750_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(e750_dapm_widgets),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
 static struct gpio e750_audio_gpios[] = {
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/8] ASoC: pxa: e800_wm9712: Convert to table based DAPM setup
  2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
  2014-03-01 14:48 ` [PATCH 2/8] ASoC: pxa: e740_wm9705: Convert to table based DAPM setup Lars-Peter Clausen
  2014-03-01 14:48 ` [PATCH 3/8] ASoC: pxa: e750_wm9705: " Lars-Peter Clausen
@ 2014-03-01 14:48 ` Lars-Peter Clausen
  2014-03-03  2:05   ` Mark Brown
  2014-03-01 14:48 ` [PATCH 5/8] ASoC: pxa: magician: Convert to table based DAPM and control setup Lars-Peter Clausen
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 14:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Russell King, alsa-devel, Lars-Peter Clausen, Eric Miao, Haojian Zhuang

Use table based setup to register the DAPM widgets and routes. This on one hand
makes the code a bit cleaner and on the other hand the board level DAPM elements
get registered in the card's DAPM context rather than in the CODEC's DAPM
context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/pxa/e800_wm9712.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c
index 3137f80..24c2078 100644
--- a/sound/soc/pxa/e800_wm9712.c
+++ b/sound/soc/pxa/e800_wm9712.c
@@ -71,19 +71,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
 	{"MIC2", NULL, "Mic (Internal2)"},
 };
 
-static int e800_ac97_init(struct snd_soc_pcm_runtime *rtd)
-{
-	struct snd_soc_codec *codec = rtd->codec;
-	struct snd_soc_dapm_context *dapm = &codec->dapm;
-
-	snd_soc_dapm_new_controls(dapm, e800_dapm_widgets,
-					ARRAY_SIZE(e800_dapm_widgets));
-
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
-	return 0;
-}
-
 static struct snd_soc_dai_link e800_dai[] = {
 	{
 		.name = "AC97",
@@ -92,7 +79,6 @@ static struct snd_soc_dai_link e800_dai[] = {
 		.codec_dai_name = "wm9712-hifi",
 		.platform_name = "pxa-pcm-audio",
 		.codec_name = "wm9712-codec",
-		.init = e800_ac97_init,
 	},
 	{
 		.name = "AC97 Aux",
@@ -109,6 +95,11 @@ static struct snd_soc_card e800 = {
 	.owner = THIS_MODULE,
 	.dai_link = e800_dai,
 	.num_links = ARRAY_SIZE(e800_dai),
+
+	.dapm_widgets = e800_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(e800_dapm_widgets),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
 static struct gpio e800_audio_gpios[] = {
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 5/8] ASoC: pxa: magician: Convert to table based DAPM and control setup
  2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
                   ` (2 preceding siblings ...)
  2014-03-01 14:48 ` [PATCH 4/8] ASoC: pxa: e800_wm9712: " Lars-Peter Clausen
@ 2014-03-01 14:48 ` Lars-Peter Clausen
  2014-03-03  2:02   ` Mark Brown
  2014-03-01 14:48 ` [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup Lars-Peter Clausen
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 14:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Russell King, alsa-devel, Lars-Peter Clausen, Eric Miao, Haojian Zhuang

Use table based setup to register the controls and DAPM widgets and routes. This
on one hand makes the code a bit shorter and cleaner and on the other hand the
board level DAPM elements get registered in the card's DAPM context rather than
in the CODEC's DAPM context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/pxa/magician.c | 35 ++++++++++++-----------------------
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index 41ab6678..6296059 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -41,10 +41,8 @@ static int magician_hp_switch;
 static int magician_spk_switch = 1;
 static int magician_in_sel = MAGICIAN_MIC;
 
-static void magician_ext_control(struct snd_soc_codec *codec)
+static void magician_ext_control(struct snd_soc_dapm_context *dapm)
 {
-	struct snd_soc_dapm_context *dapm = &codec->dapm;
-
 	snd_soc_dapm_mutex_lock(dapm);
 
 	if (magician_spk_switch)
@@ -75,10 +73,9 @@ static void magician_ext_control(struct snd_soc_codec *codec)
 static int magician_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
 
 	/* check the jack status at stream startup */
-	magician_ext_control(codec);
+	magician_ext_control(&rtd->card->dapm);
 
 	return 0;
 }
@@ -277,13 +274,13 @@ static int magician_get_hp(struct snd_kcontrol *kcontrol,
 static int magician_set_hp(struct snd_kcontrol *kcontrol,
 			     struct snd_ctl_elem_value *ucontrol)
 {
-	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
 	if (magician_hp_switch == ucontrol->value.integer.value[0])
 		return 0;
 
 	magician_hp_switch = ucontrol->value.integer.value[0];
-	magician_ext_control(codec);
+	magician_ext_control(&card->dapm);
 	return 1;
 }
 
@@ -297,13 +294,13 @@ static int magician_get_spk(struct snd_kcontrol *kcontrol,
 static int magician_set_spk(struct snd_kcontrol *kcontrol,
 			    struct snd_ctl_elem_value *ucontrol)
 {
-	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
 	if (magician_spk_switch == ucontrol->value.integer.value[0])
 		return 0;
 
 	magician_spk_switch = ucontrol->value.integer.value[0];
-	magician_ext_control(codec);
+	magician_ext_control(&card->dapm);
 	return 1;
 }
 
@@ -400,7 +397,6 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_codec *codec = rtd->codec;
 	struct snd_soc_dapm_context *dapm = &codec->dapm;
-	int err;
 
 	/* NC codec pins */
 	snd_soc_dapm_nc_pin(dapm, "VOUTLHP");
@@ -410,19 +406,6 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
 	snd_soc_dapm_nc_pin(dapm, "VINL");
 	snd_soc_dapm_nc_pin(dapm, "VINR");
 
-	/* Add magician specific controls */
-	err = snd_soc_add_codec_controls(codec, uda1380_magician_controls,
-				ARRAY_SIZE(uda1380_magician_controls));
-	if (err < 0)
-		return err;
-
-	/* Add magician specific widgets */
-	snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
-				  ARRAY_SIZE(uda1380_dapm_widgets));
-
-	/* Set up magician specific audio path interconnects */
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
 	return 0;
 }
 
@@ -456,6 +439,12 @@ static struct snd_soc_card snd_soc_card_magician = {
 	.dai_link = magician_dai,
 	.num_links = ARRAY_SIZE(magician_dai),
 
+	.controls = uda1380_magician_controls,
+	.num_controls = ARRAY_SIZE(uda1380_magician_controls),
+	.dapm_widgets = uda1380_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(uda1380_dapm_widgets),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
 static struct platform_device *magician_snd_device;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup
  2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
                   ` (3 preceding siblings ...)
  2014-03-01 14:48 ` [PATCH 5/8] ASoC: pxa: magician: Convert to table based DAPM and control setup Lars-Peter Clausen
@ 2014-03-01 14:48 ` Lars-Peter Clausen
  2014-03-03  2:01   ` Mark Brown
  2014-03-03  2:02   ` Mark Brown
  2014-03-01 14:48 ` [PATCH 7/8] ASoC: pxa: tosa: Convert to table based DAPM and control setup Lars-Peter Clausen
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 14:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Russell King, alsa-devel, Lars-Peter Clausen, Eric Miao, Haojian Zhuang

Use table based setup to register the DAPM widgets and routes. This on one hand
makes the code a bit cleaner and on the other hand the board level DAPM elements
get registered in the card's DAPM context rather than in the CODEC's DAPM
context.

Also remove the snd_soc_dapm_enable_pin() calls, since pins are enabled by
default and there are no matching snd_soc_dapm_disable_pin() calls.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/pxa/mioa701_wm9713.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c
index 160c524..595eee3 100644
--- a/sound/soc/pxa/mioa701_wm9713.c
+++ b/sound/soc/pxa/mioa701_wm9713.c
@@ -127,16 +127,8 @@ static const struct snd_soc_dapm_route audio_map[] = {
 static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_codec *codec = rtd->codec;
-	struct snd_soc_dapm_context *dapm = &codec->dapm;
 	unsigned short reg;
 
-	/* Add mioa701 specific widgets */
-	snd_soc_dapm_new_controls(dapm, mioa701_dapm_widgets,
-				  ARRAY_SIZE(mioa701_dapm_widgets));
-
-	/* Set up mioa701 specific audio path audio_mapnects */
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
 	/* Prepare GPIO8 for rear speaker amplifier */
 	reg = codec->driver->read(codec, AC97_GPIO_CFG);
 	codec->driver->write(codec, AC97_GPIO_CFG, reg | 0x0100);
@@ -145,12 +137,6 @@ static int mioa701_wm9713_init(struct snd_soc_pcm_runtime *rtd)
 	reg = codec->driver->read(codec, AC97_3D_CONTROL);
 	codec->driver->write(codec, AC97_3D_CONTROL, reg | 0xc000);
 
-	snd_soc_dapm_enable_pin(dapm, "Front Speaker");
-	snd_soc_dapm_enable_pin(dapm, "Rear Speaker");
-	snd_soc_dapm_enable_pin(dapm, "Front Mic");
-	snd_soc_dapm_enable_pin(dapm, "GSM Line In");
-	snd_soc_dapm_enable_pin(dapm, "GSM Line Out");
-
 	return 0;
 }
 
@@ -183,6 +169,11 @@ static struct snd_soc_card mioa701 = {
 	.owner = THIS_MODULE,
 	.dai_link = mioa701_dai,
 	.num_links = ARRAY_SIZE(mioa701_dai),
+
+	.dapm_widgets = mioa701_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(mioa701_dapm_widgets),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
 static int mioa701_wm9713_probe(struct platform_device *pdev)
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 7/8] ASoC: pxa: tosa: Convert to table based DAPM and control setup
  2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
                   ` (4 preceding siblings ...)
  2014-03-01 14:48 ` [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup Lars-Peter Clausen
@ 2014-03-01 14:48 ` Lars-Peter Clausen
  2014-03-03  2:03   ` Mark Brown
  2014-03-01 14:48 ` [PATCH 8/8] ASoC: pxa: zylonite: Convert to table based DAPM setup Lars-Peter Clausen
  2014-03-03  2:04 ` [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Mark Brown
  7 siblings, 1 reply; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 14:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Russell King, alsa-devel, Lars-Peter Clausen, Eric Miao, Haojian Zhuang

Use table based setup to register the controls and DAPM widgets and routes. This
on one hand makes the code a bit shorter and cleaner and on the other hand the
board level DAPM elements get registered in the card's DAPM context rather than
in the CODEC's DAPM context.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/pxa/tosa.c | 36 +++++++++++++-----------------------
 1 file changed, 13 insertions(+), 23 deletions(-)

diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index cead165..4570725 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -44,10 +44,8 @@
 static int tosa_jack_func;
 static int tosa_spk_func;
 
-static void tosa_ext_control(struct snd_soc_codec *codec)
+static void tosa_ext_control(struct snd_soc_dapm_context *dapm)
 {
-	struct snd_soc_dapm_context *dapm = &codec->dapm;
-
 	snd_soc_dapm_mutex_lock(dapm);
 
 	/* set up jack connection */
@@ -82,10 +80,9 @@ static void tosa_ext_control(struct snd_soc_codec *codec)
 static int tosa_startup(struct snd_pcm_substream *substream)
 {
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_codec *codec = rtd->codec;
 
 	/* check the jack status at stream startup */
-	tosa_ext_control(codec);
+	tosa_ext_control(&rtd->card->dapm);
 
 	return 0;
 }
@@ -104,13 +101,13 @@ static int tosa_get_jack(struct snd_kcontrol *kcontrol,
 static int tosa_set_jack(struct snd_kcontrol *kcontrol,
 	struct snd_ctl_elem_value *ucontrol)
 {
-	struct snd_soc_codec *codec =  snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
 	if (tosa_jack_func == ucontrol->value.integer.value[0])
 		return 0;
 
 	tosa_jack_func = ucontrol->value.integer.value[0];
-	tosa_ext_control(codec);
+	tosa_ext_control(&card->dapm);
 	return 1;
 }
 
@@ -124,13 +121,13 @@ static int tosa_get_spk(struct snd_kcontrol *kcontrol,
 static int tosa_set_spk(struct snd_kcontrol *kcontrol,
 	struct snd_ctl_elem_value *ucontrol)
 {
-	struct snd_soc_codec *codec =  snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
 
 	if (tosa_spk_func == ucontrol->value.integer.value[0])
 		return 0;
 
 	tosa_spk_func = ucontrol->value.integer.value[0];
-	tosa_ext_control(codec);
+	tosa_ext_control(&card->dapm);
 	return 1;
 }
 
@@ -191,24 +188,10 @@ static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_codec *codec = rtd->codec;
 	struct snd_soc_dapm_context *dapm = &codec->dapm;
-	int err;
 
 	snd_soc_dapm_nc_pin(dapm, "OUT3");
 	snd_soc_dapm_nc_pin(dapm, "MONOOUT");
 
-	/* add tosa specific controls */
-	err = snd_soc_add_codec_controls(codec, tosa_controls,
-				ARRAY_SIZE(tosa_controls));
-	if (err < 0)
-		return err;
-
-	/* add tosa specific widgets */
-	snd_soc_dapm_new_controls(dapm, tosa_dapm_widgets,
-				  ARRAY_SIZE(tosa_dapm_widgets));
-
-	/* set up tosa specific audio path audio_map */
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
 	return 0;
 }
 
@@ -239,6 +222,13 @@ static struct snd_soc_card tosa = {
 	.owner = THIS_MODULE,
 	.dai_link = tosa_dai,
 	.num_links = ARRAY_SIZE(tosa_dai),
+
+	.controls = tosa_controls,
+	.num_controls = ARRAY_SIZE(tosa_controls),
+	.dapm_widgets = tosa_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(tosa_dapm_widgets),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
 static int tosa_probe(struct platform_device *pdev)
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 8/8] ASoC: pxa: zylonite: Convert to table based DAPM setup
  2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
                   ` (5 preceding siblings ...)
  2014-03-01 14:48 ` [PATCH 7/8] ASoC: pxa: tosa: Convert to table based DAPM and control setup Lars-Peter Clausen
@ 2014-03-01 14:48 ` Lars-Peter Clausen
  2014-03-03  2:04   ` Mark Brown
  2014-03-03  2:04 ` [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Mark Brown
  7 siblings, 1 reply; 17+ messages in thread
From: Lars-Peter Clausen @ 2014-03-01 14:48 UTC (permalink / raw)
  To: Mark Brown, Liam Girdwood
  Cc: Russell King, alsa-devel, Lars-Peter Clausen, Eric Miao, Haojian Zhuang

Use table based setup to register the DAPM widgets and routes. This on one hand
makes the code a bit cleaner and on the other hand the board level DAPM elements
get registered in the card's DAPM context rather than in the CODEC's DAPM
context.

Also drop the two snd_soc_dapm_enable_pin() since pins are enabled by default
and there is no matching snd_soc_dapm_disable_pin() in the driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 sound/soc/pxa/zylonite.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c
index db8aadf..23bf991 100644
--- a/sound/soc/pxa/zylonite.c
+++ b/sound/soc/pxa/zylonite.c
@@ -71,22 +71,10 @@ static const struct snd_soc_dapm_route audio_map[] = {
 
 static int zylonite_wm9713_init(struct snd_soc_pcm_runtime *rtd)
 {
-	struct snd_soc_codec *codec = rtd->codec;
-	struct snd_soc_dapm_context *dapm = &codec->dapm;
-
 	if (clk_pout)
 		snd_soc_dai_set_pll(rtd->codec_dai, 0, 0,
 				    clk_get_rate(pout), 0);
 
-	snd_soc_dapm_new_controls(dapm, zylonite_dapm_widgets,
-				  ARRAY_SIZE(zylonite_dapm_widgets));
-
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
-
-	/* Static setup for now */
-	snd_soc_dapm_enable_pin(dapm, "Headphone");
-	snd_soc_dapm_enable_pin(dapm, "Headset Earpiece");
-
 	return 0;
 }
 
@@ -256,6 +244,11 @@ static struct snd_soc_card zylonite = {
 	.resume_pre = &zylonite_resume_pre,
 	.dai_link = zylonite_dai,
 	.num_links = ARRAY_SIZE(zylonite_dai),
+
+	.dapm_widgets = zylonite_dapm_widgets,
+	.num_dapm_widgets = ARRAY_SIZE(zylonite_dapm_widgets),
+	.dapm_routes = audio_map,
+	.num_dapm_routes = ARRAY_SIZE(audio_map),
 };
 
 static struct platform_device *zylonite_snd_ac97_device;
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup
  2014-03-01 14:48 ` [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup Lars-Peter Clausen
@ 2014-03-03  2:01   ` Mark Brown
  2014-03-03  2:02   ` Mark Brown
  1 sibling, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:01 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 366 bytes --]

On Sat, Mar 01, 2014 at 03:48:18PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the DAPM widgets and routes. This on one hand
> makes the code a bit cleaner and on the other hand the board level DAPM elements
> get registered in the card's DAPM context rather than in the CODEC's DAPM
> context.

This doesn't apply, please check and resend.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 5/8] ASoC: pxa: magician: Convert to table based DAPM and control setup
  2014-03-01 14:48 ` [PATCH 5/8] ASoC: pxa: magician: Convert to table based DAPM and control setup Lars-Peter Clausen
@ 2014-03-03  2:02   ` Mark Brown
  0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:02 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 391 bytes --]

On Sat, Mar 01, 2014 at 03:48:17PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the controls and DAPM widgets and routes. This
> on one hand makes the code a bit shorter and cleaner and on the other hand the
> board level DAPM elements get registered in the card's DAPM context rather than
> in the CODEC's DAPM context.

This doesn't apply, please check and resend.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup
  2014-03-01 14:48 ` [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup Lars-Peter Clausen
  2014-03-03  2:01   ` Mark Brown
@ 2014-03-03  2:02   ` Mark Brown
  1 sibling, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:02 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 378 bytes --]

On Sat, Mar 01, 2014 at 03:48:18PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the DAPM widgets and routes. This on one hand
> makes the code a bit cleaner and on the other hand the board level DAPM elements
> get registered in the card's DAPM context rather than in the CODEC's DAPM
> context.

Sorry, got the wrong mail to reply to - applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 7/8] ASoC: pxa: tosa: Convert to table based DAPM and control setup
  2014-03-01 14:48 ` [PATCH 7/8] ASoC: pxa: tosa: Convert to table based DAPM and control setup Lars-Peter Clausen
@ 2014-03-03  2:03   ` Mark Brown
  0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:03 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 391 bytes --]

On Sat, Mar 01, 2014 at 03:48:19PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the controls and DAPM widgets and routes. This
> on one hand makes the code a bit shorter and cleaner and on the other hand the
> board level DAPM elements get registered in the card's DAPM context rather than
> in the CODEC's DAPM context.

This doesn't apply, please check and resend.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 8/8] ASoC: pxa: zylonite: Convert to table based DAPM setup
  2014-03-01 14:48 ` [PATCH 8/8] ASoC: pxa: zylonite: Convert to table based DAPM setup Lars-Peter Clausen
@ 2014-03-03  2:04   ` Mark Brown
  0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:04 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 338 bytes --]

On Sat, Mar 01, 2014 at 03:48:20PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the DAPM widgets and routes. This on one hand
> makes the code a bit cleaner and on the other hand the board level DAPM elements
> get registered in the card's DAPM context rather than in the CODEC's DAPM
> context.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control
  2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
                   ` (6 preceding siblings ...)
  2014-03-01 14:48 ` [PATCH 8/8] ASoC: pxa: zylonite: Convert to table based DAPM setup Lars-Peter Clausen
@ 2014-03-03  2:04 ` Mark Brown
  7 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:04 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 409 bytes --]

On Sat, Mar 01, 2014 at 03:48:13PM +0100, Lars-Peter Clausen wrote:
> When calling {corgi,poodle,spitz}_ext_control() from the startup callback we
> pass the CODEC's DAPM context instead of the card's DAPM context. This is not a
> problem per se since all the DAPM functions in ext_control() fallback to widgets
> from other DAPM contexts, but passing the card's context is more consistent.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/8] ASoC: pxa: e740_wm9705: Convert to table based DAPM setup
  2014-03-01 14:48 ` [PATCH 2/8] ASoC: pxa: e740_wm9705: Convert to table based DAPM setup Lars-Peter Clausen
@ 2014-03-03  2:04   ` Mark Brown
  0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:04 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 338 bytes --]

On Sat, Mar 01, 2014 at 03:48:14PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the DAPM widgets and routes. This on one hand
> makes the code a bit cleaner and on the other hand the board level DAPM elements
> get registered in the card's DAPM context rather than in the CODEC's DAPM
> context.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/8] ASoC: pxa: e750_wm9705: Convert to table based DAPM setup
  2014-03-01 14:48 ` [PATCH 3/8] ASoC: pxa: e750_wm9705: " Lars-Peter Clausen
@ 2014-03-03  2:05   ` Mark Brown
  0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:05 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 338 bytes --]

On Sat, Mar 01, 2014 at 03:48:15PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the DAPM widgets and routes. This on one hand
> makes the code a bit cleaner and on the other hand the board level DAPM elements
> get registered in the card's DAPM context rather than in the CODEC's DAPM
> context.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 4/8] ASoC: pxa: e800_wm9712: Convert to table based DAPM setup
  2014-03-01 14:48 ` [PATCH 4/8] ASoC: pxa: e800_wm9712: " Lars-Peter Clausen
@ 2014-03-03  2:05   ` Mark Brown
  0 siblings, 0 replies; 17+ messages in thread
From: Mark Brown @ 2014-03-03  2:05 UTC (permalink / raw)
  To: Lars-Peter Clausen
  Cc: Russell King, alsa-devel, Eric Miao, Liam Girdwood, Haojian Zhuang


[-- Attachment #1.1: Type: text/plain, Size: 338 bytes --]

On Sat, Mar 01, 2014 at 03:48:16PM +0100, Lars-Peter Clausen wrote:
> Use table based setup to register the DAPM widgets and routes. This on one hand
> makes the code a bit cleaner and on the other hand the board level DAPM elements
> get registered in the card's DAPM context rather than in the CODEC's DAPM
> context.

Applied, thanks.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-03-03  3:36 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-01 14:48 [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Lars-Peter Clausen
2014-03-01 14:48 ` [PATCH 2/8] ASoC: pxa: e740_wm9705: Convert to table based DAPM setup Lars-Peter Clausen
2014-03-03  2:04   ` Mark Brown
2014-03-01 14:48 ` [PATCH 3/8] ASoC: pxa: e750_wm9705: " Lars-Peter Clausen
2014-03-03  2:05   ` Mark Brown
2014-03-01 14:48 ` [PATCH 4/8] ASoC: pxa: e800_wm9712: " Lars-Peter Clausen
2014-03-03  2:05   ` Mark Brown
2014-03-01 14:48 ` [PATCH 5/8] ASoC: pxa: magician: Convert to table based DAPM and control setup Lars-Peter Clausen
2014-03-03  2:02   ` Mark Brown
2014-03-01 14:48 ` [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup Lars-Peter Clausen
2014-03-03  2:01   ` Mark Brown
2014-03-03  2:02   ` Mark Brown
2014-03-01 14:48 ` [PATCH 7/8] ASoC: pxa: tosa: Convert to table based DAPM and control setup Lars-Peter Clausen
2014-03-03  2:03   ` Mark Brown
2014-03-01 14:48 ` [PATCH 8/8] ASoC: pxa: zylonite: Convert to table based DAPM setup Lars-Peter Clausen
2014-03-03  2:04   ` Mark Brown
2014-03-03  2:04 ` [PATCH 1/8] ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).