ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control
Subsystems (3)
PATCH 1/8 ASoC: pxa: Pass correct DAPM context to {corgi, poodle, spitz}_ext_control
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.
--- 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(-)
sound/soc/pxa/corgi.c +1 -2
@@ -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 ; }
sound/soc/pxa/poodle.c +1 -2
@@ -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 ; }
sound/soc/pxa/spitz.c +1 -2
@@ -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 ; }
Signature · 1 line
1.8.0
PATCH 2/8 ASoC: pxa: e740_wm9705: Convert to table based DAPM setup
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.
--- sound/soc/pxa/e740_wm9705.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/pxa/e740_wm9705.c +5 -5
@@ -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[] = {
Signature · 1 line
1.8.0
Re: [PATCH 2/8] ASoC: pxa: e740_wm9705: Convert to table based DAPM setup
Quoted 4 lines · Lars-Peter Clausen
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.
PATCH 3/8 ASoC: pxa: e750_wm9705: Convert to table based DAPM setup
In reply to Lars-Peter ClausenUse 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.
--- sound/soc/pxa/e750_wm9705.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
sound/soc/pxa/e750_wm9705.c +5 -5
@@ -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[] = {
Signature · 1 line
1.8.0
Re: [PATCH 3/8] ASoC: pxa: e750_wm9705: Convert to table based DAPM setup
Quoted 4 lines · Lars-Peter Clausen
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.
PATCH 4/8 ASoC: pxa: e800_wm9712: Convert to table based DAPM setup
In reply to Lars-Peter ClausenUse 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.
--- sound/soc/pxa/e800_wm9712.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
sound/soc/pxa/e800_wm9712.c +5 -14
@@ -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[] = {
Signature · 1 line
1.8.0
Re: [PATCH 4/8] ASoC: pxa: e800_wm9712: Convert to table based DAPM setup
Quoted 4 lines · Lars-Peter Clausen
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.
PATCH 5/8 ASoC: pxa: magician: Convert to table based DAPM and control setup
In reply to Lars-Peter ClausenUse 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.
--- sound/soc/pxa/magician.c | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-)
sound/soc/pxa/magician.c +12 -23
@@ -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;
Signature · 1 line
1.8.0
Mark Brown
maintainerRe: [PATCH 5/8] ASoC: pxa: magician: Convert to table based DAPM and control setup
Quoted 4 lines · Lars-Peter Clausen
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.
PATCH 6/8 ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup
In reply to Lars-Peter ClausenUse 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.
--- sound/soc/pxa/mioa701_wm9713.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)
sound/soc/pxa/mioa701_wm9713.c +5 -14
@@ -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)
Signature · 1 line
1.8.0
Mark Brown
maintainerRe: [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup
Quoted 4 lines · Lars-Peter Clausen
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.
Mark Brown
maintainerRe: [PATCH 6/8] ASoC: pxa: mioa701_wm9713: Convert to table based DAPM setup
In reply to Lars-Peter ClausenQuoted 4 lines · Lars-Peter Clausen
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.
PATCH 7/8 ASoC: pxa: tosa: Convert to table based DAPM and control setup
In reply to Lars-Peter ClausenUse 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.
--- sound/soc/pxa/tosa.c | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-)
sound/soc/pxa/tosa.c +13 -23
@@ -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)
Signature · 1 line
1.8.0
Mark Brown
maintainerRe: [PATCH 7/8] ASoC: pxa: tosa: Convert to table based DAPM and control setup
Quoted 4 lines · Lars-Peter Clausen
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.
PATCH 8/8 ASoC: pxa: zylonite: Convert to table based DAPM setup
In reply to Lars-Peter ClausenUse 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.
--- sound/soc/pxa/zylonite.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-)
sound/soc/pxa/zylonite.c +5 -12
@@ -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;
Signature · 1 line
1.8.0
Re: [PATCH 8/8] ASoC: pxa: zylonite: Convert to table based DAPM setup
Quoted 4 lines · Lars-Peter Clausen
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.
Quoted 4 lines · Lars-Peter Clausen
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.