ASoC: OMAP machine driver cleanups
v2 cover ASoC: OMAP machine driver cleanups
Hello,
Some cleanups for the OMAP ASoC machine drivers:
- do not call soc_dapm_sync from dai_link->init callback since it is useless
- Convert drivers to use table based DAPM initialization
- Remove dapm_enable_pin calls from dai_link->init callback since pins are enabled by default
Changelog since v1:
- Do not touch ams-delta just remove the dapm_sync call.
- Do not convert soc_dapm_sync calls to dapm_new_widgets call
Regards,
Peter
---
Peter Ujfalusi (9):
ASoC: OMAP machines: Remove soc_dapm_sync() call from init
ASoC: am3517evm: Let core to deal with the DAPM widgets
ASoC: n810: Let the core to register DAPM widgets/routes and controls
ASoC: osk5912: Let core to deal with the DAPM widgets
ASoC: sdp3430: Let core to deal with the DAPM widgets
ASoC: zoom2: Let core to deal with the DAPM widgets
ASoC: zoom2: No need to call dapm_pin_enable at init time
ASoC: sdp4430: Let core to deal with the DAPM widgets
ASoC: sdp4430: No need to call dapm_pin_enable at init time
sound/soc/omap/am3517evm.c | 28 +++++----------------------- sound/soc/omap/ams-delta.c | 1 - sound/soc/omap/n810.c | 23 +++++++---------------- sound/soc/omap/omap3pandora.c | 8 ++------ sound/soc/omap/osk5912.c | 27 +++++---------------------- sound/soc/omap/rx51.c | 2 -- sound/soc/omap/sdp3430.c | 18 +++++------------- sound/soc/omap/sdp4430.c | 27 +++++---------------------- sound/soc/omap/zoom2.c | 26 ++++++-------------------- 9 files changed, 35 insertions(+), 125 deletions(-)
Signature · 1 line
1.7.7
PATCH v2 1/9 ASoC: OMAP machines: Remove soc_dapm_sync() call from init
No need to call soc_dapm_sync at init time.
--- sound/soc/omap/am3517evm.c | 2 -- sound/soc/omap/ams-delta.c | 1 - sound/soc/omap/n810.c | 6 +----- sound/soc/omap/omap3pandora.c | 8 ++------ sound/soc/omap/osk5912.c | 2 -- sound/soc/omap/rx51.c | 2 -- sound/soc/omap/sdp3430.c | 4 ---- sound/soc/omap/sdp4430.c | 4 ---- sound/soc/omap/zoom2.c | 4 +--- 9 files changed, 4 insertions(+), 29 deletions(-)
sound/soc/omap/am3517evm.c +0 -2
@@ -107,8 +107,6 @@ static int am3517evm_aic23_init(struct snd_soc_pcm_runtime *rtd)snd_soc_dapm_enable_pin (dapm,"Line In" );snd_soc_dapm_enable_pin (dapm,"Mic In" ); -snd_soc_dapm_sync (dapm); -return 0 ; }
sound/soc/omap/ams-delta.c +0 -1
@@ -569,7 +569,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)snd_soc_dapm_disable_pin (dapm,"Speaker" );snd_soc_dapm_disable_pin (dapm,"AGCIN" );snd_soc_dapm_disable_pin (dapm,"AGCOUT" ); -snd_soc_dapm_sync (dapm);/* Add virtual switch */ ret = snd_soc_add_controls(codec, ams_delta_audio_controls,
sound/soc/omap/n810.c +1 -5
@@ -280,11 +280,7 @@ static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd) ARRAY_SIZE(aic33_dapm_widgets));/* Set up N810 specific audio path audio_map */ -snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map)); - -snd_soc_dapm_sync (dapm); - -return 0 ; +return snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map)); }/* Digital audio interface glue - connects codec <--> CPU */
sound/soc/omap/omap3pandora.c +2 -6
@@ -173,10 +173,8 @@ static int omap3pandora_out_init(struct snd_soc_pcm_runtime *rtd)if (ret <0 )return ret; -snd_soc_dapm_add_routes (dapm, omap3pandora_out_map, +return snd_soc_dapm_add_routes (dapm, omap3pandora_out_map,ARRAY_SIZE (omap3pandora_out_map)); - -return snd_soc_dapm_sync (dapm); }static int omap3pandora_in_init (struct snd_soc_pcm_runtime *rtd)
@@ -196,10 +194,8 @@ static int omap3pandora_in_init(struct snd_soc_pcm_runtime *rtd)if (ret <0 )return ret; -snd_soc_dapm_add_routes (dapm, omap3pandora_in_map, +return snd_soc_dapm_add_routes (dapm, omap3pandora_in_map,ARRAY_SIZE (omap3pandora_in_map)); - -return snd_soc_dapm_sync (dapm); }static struct snd_soc_ops omap3pandora_ops = {
sound/soc/omap/osk5912.c +0 -2
@@ -107,8 +107,6 @@ static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)snd_soc_dapm_enable_pin (dapm,"Line In" );snd_soc_dapm_enable_pin (dapm,"Mic Jack" ); -snd_soc_dapm_sync (dapm); -return 0 ; }
sound/soc/omap/rx51.c +0 -2
@@ -317,8 +317,6 @@ static int rx51_aic34_init(struct snd_soc_pcm_runtime *rtd)if (err <0 )return err; -snd_soc_dapm_sync (dapm); -/* AV jack detection */ err = snd_soc_jack_new(codec, "AV Jack", SND_JACK_HEADSET | SND_JACK_VIDEOOUT,
sound/soc/omap/sdp3430.c +0 -4
@@ -159,10 +159,6 @@ static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)snd_soc_dapm_nc_pin (dapm,"CARKITL" );snd_soc_dapm_nc_pin (dapm,"CARKITR" ); - ret =snd_soc_dapm_sync (dapm); -if (ret) -return ret; -/* Headset jack detection */ ret =snd_soc_jack_new (codec,"Headset Jack" ,SND_JACK_HEADSET , &hs_jack);
sound/soc/omap/sdp4430.c +0 -4
@@ -140,10 +140,6 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)snd_soc_dapm_enable_pin (dapm,"Headset Mic" );snd_soc_dapm_enable_pin (dapm,"Headset Stereophone" ); - ret =snd_soc_dapm_sync (dapm); -if (ret) -return ret; -/* * Configure McPDM offset cancellation based on the HSOTRIM value from * twl6040.
sound/soc/omap/zoom2.c +1 -3
@@ -126,9 +126,7 @@ static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd)snd_soc_dapm_nc_pin (dapm,"CARKITL" );snd_soc_dapm_nc_pin (dapm,"CARKITR" ); - ret =snd_soc_dapm_sync (dapm); - -return ret; +return 0 ; }static int zoom2_twl4030_voice_init (struct snd_soc_pcm_runtime *rtd)
Signature · 6 lines
1.7.7 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
PATCH v2 2/9 ASoC: am3517evm: Let core to deal with the DAPM widgets
In reply to Peter UjfalusiPass the DAPM widgets/routes via the snd_soc_card struct to core. With this change we do not need the init function since the remaining snd_soc_dapm_enable_pin calls are not needed.
--- sound/soc/omap/am3517evm.c | 26 +++++--------------------- 1 files changed, 5 insertions(+), 21 deletions(-)
sound/soc/omap/am3517evm.c +5 -21
@@ -90,26 +90,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"MICIN", NULL, "Mic In"}, }; -static int am3517evm_aic23_init (struct snd_soc_pcm_runtime *rtd) -{ -struct snd_soc_codec *codec = rtd->codec; -struct snd_soc_dapm_context *dapm = &codec->dapm; - -/* Add am3517-evm specific widgets */ -snd_soc_dapm_new_controls (dapm, tlv320aic23_dapm_widgets, -ARRAY_SIZE (tlv320aic23_dapm_widgets)); - -/* Set up davinci-evm specific audio path audio_map */ -snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map)); - -/* always connected */ -snd_soc_dapm_enable_pin (dapm,"Line Out" ); -snd_soc_dapm_enable_pin (dapm,"Line In" ); -snd_soc_dapm_enable_pin (dapm,"Mic In" ); - -return 0 ; -} -/* Digital audio interface glue - connects codec <--> CPU */ static struct snd_soc_dai_link am3517evm_dai = { .name = "TLV320AIC23",
@@ -120,7 +100,6 @@ static struct snd_soc_dai_link am3517evm_dai = { .codec_name = "tlv320aic23-codec.2-001a", .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, - .init = am3517evm_aic23_init, .ops = &am3517evm_ops, };
@@ -129,6 +108,11 @@ static struct snd_soc_card snd_soc_am3517evm = { .name = "am3517evm", .dai_link = &am3517evm_dai, .num_links = 1, + + .dapm_widgets = tlv320aic23_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(tlv320aic23_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), };static struct platform_device *am3517evm_snd_device;
Signature · 1 line
1.7.7
PATCH v2 3/9 ASoC: n810: Let the core to register DAPM widgets/routes and controls
In reply to Peter UjfalusiPass the DAPM widgets/routes and static controls via the snd_soc_card struct to core. In this way the machine driver does not need to handle the DAPM widgets/routes.
--- sound/soc/omap/n810.c | 21 ++++++++------------- 1 files changed, 8 insertions(+), 13 deletions(-)
sound/soc/omap/n810.c +8 -13
@@ -257,7 +257,6 @@ static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd) {struct snd_soc_codec *codec = rtd->codec;struct snd_soc_dapm_context *dapm = &codec->dapm; -int err;/* Not connected */ snd_soc_dapm_nc_pin (dapm,"MONO_LOUT" );
@@ -269,18 +268,7 @@ static int n810_aic33_init(struct snd_soc_pcm_runtime *rtd)snd_soc_dapm_nc_pin (dapm,"LINE2L" );snd_soc_dapm_nc_pin (dapm,"LINE2R" ); -/* Add N810 specific controls */ - err =snd_soc_add_controls (codec, aic33_n810_controls, -ARRAY_SIZE (aic33_n810_controls)); -if (err <0 ) -return err; - -/* Add N810 specific widgets */ -snd_soc_dapm_new_controls (dapm, aic33_dapm_widgets, -ARRAY_SIZE (aic33_dapm_widgets)); - -/* Set up N810 specific audio path audio_map */ -return snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map)); +return 0 ; }/* Digital audio interface glue - connects codec <--> CPU */
@@ -302,6 +290,13 @@ static struct snd_soc_card snd_soc_n810 = { .name = "N810", .dai_link = &n810_dai, .num_links = 1, + + .controls = aic33_n810_controls, + .num_controls = ARRAY_SIZE(aic33_n810_controls), + .dapm_widgets = aic33_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(aic33_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), };static struct platform_device *n810_snd_device;
Signature · 1 line
1.7.7
PATCH v2 4/9 ASoC: osk5912: Let core to deal with the DAPM widgets
In reply to Peter UjfalusiPass the DAPM widgets/routes via the snd_soc_card struct to core. With this change we do not need the init function since the remaining snd_soc_dapm_enable_pin calls are not needed.
--- sound/soc/omap/osk5912.c | 25 +++++-------------------- 1 files changed, 5 insertions(+), 20 deletions(-)
sound/soc/omap/osk5912.c +5 -20
@@ -91,25 +91,6 @@ static const struct snd_soc_dapm_route audio_map[] = { {"MICIN", NULL, "Mic Jack"}, }; -static int osk_tlv320aic23_init (struct snd_soc_pcm_runtime *rtd) -{ -struct snd_soc_codec *codec = rtd->codec; -struct snd_soc_dapm_context *dapm = &codec->dapm; - -/* Add osk5912 specific widgets */ -snd_soc_dapm_new_controls (dapm, tlv320aic23_dapm_widgets, -ARRAY_SIZE (tlv320aic23_dapm_widgets)); - -/* Set up osk5912 specific audio path audio_map */ -snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map)); - -snd_soc_dapm_enable_pin (dapm,"Headphone Jack" ); -snd_soc_dapm_enable_pin (dapm,"Line In" ); -snd_soc_dapm_enable_pin (dapm,"Mic Jack" ); - -return 0 ; -} -/* Digital audio interface glue - connects codec <--> CPU */ static struct snd_soc_dai_link osk_dai = { .name = "TLV320AIC23",
@@ -120,7 +101,6 @@ static struct snd_soc_dai_link osk_dai = { .codec_name = "tlv320aic23-codec", .dai_fmt = SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM, - .init = osk_tlv320aic23_init, .ops = &osk_ops, };
@@ -129,6 +109,11 @@ static struct snd_soc_card snd_soc_card_osk = { .name = "OSK5912", .dai_link = &osk_dai, .num_links = 1, + + .dapm_widgets = tlv320aic23_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(tlv320aic23_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), };static struct platform_device *osk_snd_device;
Signature · 1 line
1.7.7
PATCH v2 5/9 ASoC: sdp3430: Let core to deal with the DAPM widgets
In reply to Peter UjfalusiPass the DAPM widgets/routes via the snd_soc_card struct to core.
--- sound/soc/omap/sdp3430.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-)
sound/soc/omap/sdp3430.c +5 -9
@@ -129,15 +129,6 @@ static int sdp3430_twl4030_init(struct snd_soc_pcm_runtime *rtd)struct snd_soc_dapm_context *dapm = &codec->dapm;int ret; -/* Add SDP3430 specific widgets */ - ret =snd_soc_dapm_new_controls (dapm, sdp3430_twl4030_dapm_widgets, -ARRAY_SIZE (sdp3430_twl4030_dapm_widgets)); -if (ret) -return ret; - -/* Set up SDP3430 specific audio path audio_map */ -snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map)); -/* SDP3430 connected pins */ snd_soc_dapm_enable_pin (dapm,"Ext Mic" );snd_soc_dapm_enable_pin (dapm,"Ext Spk" );
@@ -223,6 +214,11 @@ static struct snd_soc_card snd_soc_sdp3430 = { .name = "SDP3430", .dai_link = sdp3430_dai, .num_links = ARRAY_SIZE(sdp3430_dai), + + .dapm_widgets = sdp3430_twl4030_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(sdp3430_twl4030_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), };static struct platform_device *sdp3430_snd_device;
Signature · 1 line
1.7.7
PATCH v2 6/9 ASoC: zoom2: Let core to deal with the DAPM widgets
In reply to Peter UjfalusiPass the DAPM widgets/routes via the snd_soc_card struct to core.
--- sound/soc/omap/zoom2.c | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-)
sound/soc/omap/zoom2.c +5 -10
@@ -98,16 +98,6 @@ static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd) {struct snd_soc_codec *codec = rtd->codec;struct snd_soc_dapm_context *dapm = &codec->dapm; -int ret; - -/* Add Zoom2 specific widgets */ - ret =snd_soc_dapm_new_controls (dapm, zoom2_twl4030_dapm_widgets, -ARRAY_SIZE (zoom2_twl4030_dapm_widgets)); -if (ret) -return ret; - -/* Set up Zoom2 specific audio path audio_map */ -snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map));/* Zoom2 connected pins */ snd_soc_dapm_enable_pin (dapm,"Ext Mic" );
@@ -175,6 +165,11 @@ static struct snd_soc_card snd_soc_zoom2 = { .name = "Zoom2", .dai_link = zoom2_dai, .num_links = ARRAY_SIZE(zoom2_dai), + + .dapm_widgets = zoom2_twl4030_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(zoom2_twl4030_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), };static struct platform_device *zoom2_snd_device;
Signature · 1 line
1.7.7
PATCH v2 7/9 ASoC: zoom2: No need to call dapm_pin_enable at init time
In reply to Peter UjfalusiWidgets are connected by default.
--- sound/soc/omap/zoom2.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
sound/soc/omap/zoom2.c +0 -7
@@ -99,13 +99,6 @@ static int zoom2_twl4030_init(struct snd_soc_pcm_runtime *rtd)struct snd_soc_codec *codec = rtd->codec;struct snd_soc_dapm_context *dapm = &codec->dapm; -/* Zoom2 connected pins */ -snd_soc_dapm_enable_pin (dapm,"Ext Mic" ); -snd_soc_dapm_enable_pin (dapm,"Ext Spk" ); -snd_soc_dapm_enable_pin (dapm,"Headset Mic" ); -snd_soc_dapm_enable_pin (dapm,"Headset Stereophone" ); -snd_soc_dapm_enable_pin (dapm,"Aux In" ); -/* TWL4030 not connected pins */ snd_soc_dapm_nc_pin (dapm,"CARKITMIC" );snd_soc_dapm_nc_pin (dapm,"DIGIMIC0" );
Signature · 1 line
1.7.7
PATCH v2 8/9 ASoC: sdp4430: Let core to deal with the DAPM widgets
In reply to Peter UjfalusiPass the DAPM widgets/routes via the snd_soc_card struct to core.
--- sound/soc/omap/sdp4430.c | 14 +++++--------- 1 files changed, 5 insertions(+), 9 deletions(-)
sound/soc/omap/sdp4430.c +5 -9
@@ -123,15 +123,6 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)struct snd_soc_dapm_context *dapm = &codec->dapm;int ret, hs_trim; -/* Add SDP4430 specific widgets */ - ret =snd_soc_dapm_new_controls (dapm, sdp4430_twl6040_dapm_widgets, -ARRAY_SIZE (sdp4430_twl6040_dapm_widgets)); -if (ret) -return ret; - -/* Set up SDP4430 specific audio path audio_map */ -snd_soc_dapm_add_routes (dapm, audio_map,ARRAY_SIZE (audio_map)); -/* SDP4430 connected pins */ snd_soc_dapm_enable_pin (dapm,"Ext Mic" );snd_soc_dapm_enable_pin (dapm,"Ext Spk" );
@@ -182,6 +173,11 @@ static struct snd_soc_card snd_soc_sdp4430 = { .name = "SDP4430", .dai_link = &sdp4430_dai, .num_links = 1, + + .dapm_widgets = sdp4430_twl6040_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), };static struct platform_device *sdp4430_snd_device;
Signature · 1 line
1.7.7
PATCH v2 9/9 ASoC: sdp4430: No need to call dapm_pin_enable at init time
In reply to Peter UjfalusiWidgets are connected by default.
--- sound/soc/omap/sdp4430.c | 9 --------- 1 files changed, 0 insertions(+), 9 deletions(-)
sound/soc/omap/sdp4430.c +0 -9
@@ -120,17 +120,8 @@ static const struct snd_soc_dapm_route audio_map[] = {static int sdp4430_twl6040_init (struct snd_soc_pcm_runtime *rtd) {struct snd_soc_codec *codec = rtd->codec; -struct snd_soc_dapm_context *dapm = &codec->dapm;int ret, hs_trim; -/* SDP4430 connected pins */ -snd_soc_dapm_enable_pin (dapm,"Ext Mic" ); -snd_soc_dapm_enable_pin (dapm,"Ext Spk" ); -snd_soc_dapm_enable_pin (dapm,"AFML" ); -snd_soc_dapm_enable_pin (dapm,"AFMR" ); -snd_soc_dapm_enable_pin (dapm,"Headset Mic" ); -snd_soc_dapm_enable_pin (dapm,"Headset Stereophone" ); -/* * Configure McPDM offset cancellation based on the HSOTRIM value from * twl6040.
Signature · 1 line
1.7.7
Mark Brown
AppliedQuoted 5 lines · Peter Ujfalusi
Some cleanups for the OMAP ASoC machine drivers:
- do not callsoc_dapm_syncfromdai_link->initcallback since it is useless
- Convert drivers to use table based DAPM initialization
- Removedapm_enable_pincalls fromdai_link->initcallback since pins are enabled by default
Applied all, thanks.