From: 陈金泉 Date: Tue, 1 Apr 2014 06:10:29 +0000 (+0800) Subject: Audio: update controls, widgets and audio map register in machine driver X-Git-Tag: firefly_0821_release~5679 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7ff35dad30957cdf09b7c4732d35861428740397;p=firefly-linux-kernel-4.4.55.git Audio: update controls, widgets and audio map register in machine driver --- diff --git a/sound/soc/rockchip/rk_aic3262.c b/sound/soc/rockchip/rk_aic3262.c index 905e1e7d5c95..5312c4630b4b 100644 --- a/sound/soc/rockchip/rk_aic3262.c +++ b/sound/soc/rockchip/rk_aic3262.c @@ -162,28 +162,6 @@ static int rk29_aic3262_init(struct snd_soc_pcm_runtime *rtd) DBG_AIC3262("rk29_aic3262_init\n"); - ret = snd_soc_add_codec_controls(codec, rk29_aic326x_controls, - ARRAY_SIZE(rk29_aic326x_controls)); - - if (ret < 0) { - printk("rk29_aic3262: Err snd_soc_add_codec_controls ret: %d\n", ret ); - return ret; - } - - /* Add rk29 specific widgets */ - ret = snd_soc_dapm_new_controls(dapm, rk29_aic3262_dapm_widgets, - ARRAY_SIZE(rk29_aic3262_dapm_widgets)); - if (ret) - return ret; - - /* Set up rk29 specific audio path audio_map */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - - - 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); @@ -456,6 +434,12 @@ static struct snd_soc_card rockchip_aic3262_snd_card = { .name = "RK_AIC3262", .dai_link = rk29_dai, .num_links = ARRAY_SIZE(rk29_dai), + .controls = rk29_aic326x_controls, + .num_controls = ARRAY_SIZE(rk29_aic326x_controls), + .dapm_widgets = rk29_aic3262_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rk29_aic3262_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), }; static int rockchip_aic3262_audio_probe(struct platform_device *pdev) diff --git a/sound/soc/rockchip/rk_rk3026.c b/sound/soc/rockchip/rk_rk3026.c index 47065b879156..b904ba4ce63a 100644 --- a/sound/soc/rockchip/rk_rk3026.c +++ b/sound/soc/rockchip/rk_rk3026.c @@ -69,15 +69,6 @@ static int rk3026_init(struct snd_soc_pcm_runtime *rtd) DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); - snd_soc_add_codec_controls(codec, rk_controls, - ARRAY_SIZE(rk_controls)); - - /* Add specific widgets */ - snd_soc_dapm_new_controls(dapm, rk_dapm_widgets, - ARRAY_SIZE(rk_dapm_widgets)); - /* Set up specific audio path audio_mapnects */ - snd_soc_dapm_add_routes(dapm, rk_audio_map, ARRAY_SIZE(rk_audio_map)); - mutex_lock(&dapm->card->dapm_mutex); snd_soc_dapm_enable_pin(dapm, "Mic Jack"); @@ -236,6 +227,12 @@ static struct snd_soc_card rockchip_rk3026_snd_card = { .name = "RK_RK3026", .dai_link = rk_dai, .num_links = 2, + .controls = rk_controls, + .num_controls = ARRAY_SIZE(rk_controls), + .dapm_widgets = rk_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rk_dapm_widgets), + .dapm_routes = rk_audio_map, + .num_dapm_routes = ARRAY_SIZE(rk_audio_map), }; static int rockchip_rk3026_audio_probe(struct platform_device *pdev) diff --git a/sound/soc/rockchip/rk_rk3190.c b/sound/soc/rockchip/rk_rk3190.c index a83b4cb27f75..2210b73d8d30 100755 --- a/sound/soc/rockchip/rk_rk3190.c +++ b/sound/soc/rockchip/rk_rk3190.c @@ -67,27 +67,7 @@ static int rk3190_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm = &codec->dapm; DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); -#if 0 - snd_soc_add_codec_controls(codec, rk_controls, - ARRAY_SIZE(rk_controls)); - - /* Add specific widgets */ - snd_soc_dapm_new_controls(dapm, rk_dapm_widgets, - ARRAY_SIZE(rk_dapm_widgets)); - /* Set up specific audio path audio_mapnects */ - snd_soc_dapm_add_routes(dapm, rk_audio_map, ARRAY_SIZE(rk_audio_map)); - - mutex_lock(&dapm->card->dapm_mutex); - snd_soc_dapm_enable_pin(dapm, "Mic Jack"); - snd_soc_dapm_enable_pin(dapm, "Headset Jack"); - snd_soc_dapm_enable_pin(dapm, "Ext Spk"); - snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); - - mutex_unlock(&dapm->card->dapm_mutex); - - snd_soc_dapm_sync(dapm); -#endif return 0; } diff --git a/sound/soc/rockchip/rk_rk616.c b/sound/soc/rockchip/rk_rk616.c index ef6b58af07d5..0f7a36c969bd 100755 --- a/sound/soc/rockchip/rk_rk616.c +++ b/sound/soc/rockchip/rk_rk616.c @@ -54,14 +54,14 @@ static bool get_hdmi_state(void) return false; } -static const struct snd_soc_dapm_widget rk_dapm_widgets[] = { +static const struct snd_soc_dapm_widget rk_rk616_dapm_widgets[] = { SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_MIC("Headset Jack", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_HP("Headphone Jack", NULL), }; -static const struct snd_soc_dapm_route rk_audio_map[]={ +static const struct snd_soc_dapm_route rk_rk616_audio_map[]={ /* Mic Jack --> MIC_IN*/ {"Mic1 Bias", NULL, "Mic Jack"}, @@ -80,7 +80,7 @@ static const struct snd_soc_dapm_route rk_audio_map[]={ {"Headphone Jack", NULL, "HPOUTL"}, } ; -static const struct snd_kcontrol_new rk_controls[] = { +static const struct snd_kcontrol_new rk_rk616_controls[] = { SOC_DAPM_PIN_SWITCH("Mic Jack"), SOC_DAPM_PIN_SWITCH("Headset Jack"), SOC_DAPM_PIN_SWITCH("Ext Spk"), @@ -99,15 +99,6 @@ static int rk616_init(struct snd_soc_pcm_runtime *rtd) DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); - snd_soc_add_codec_controls(codec, rk_controls, - ARRAY_SIZE(rk_controls)); - - /* Add specific widgets */ - snd_soc_dapm_new_controls(dapm, rk_dapm_widgets, - ARRAY_SIZE(rk_dapm_widgets)); - /* Set up specific audio path audio_mapnects */ - snd_soc_dapm_add_routes(dapm, rk_audio_map, ARRAY_SIZE(rk_audio_map)); - mutex_lock(&dapm->card->dapm_mutex); snd_soc_dapm_enable_pin(dapm, "Mic Jack"); @@ -289,6 +280,12 @@ static struct snd_soc_card rockchip_rk616_snd_card = { .name = "RK_RK616", .dai_link = rk_dai, .num_links = 2, + .controls = rk_rk616_controls, + .num_controls = ARRAY_SIZE(rk_rk616_controls), + .dapm_widgets = rk_rk616_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rk_rk616_dapm_widgets), + .dapm_routes = rk_rk616_audio_map, + .num_dapm_routes = ARRAY_SIZE(rk_rk616_audio_map), }; /* dts: diff --git a/sound/soc/rockchip/rk_rt3261.c b/sound/soc/rockchip/rk_rt3261.c index 91959d96601b..66acee89dc19 100644 --- a/sound/soc/rockchip/rk_rt3261.c +++ b/sound/soc/rockchip/rk_rt3261.c @@ -197,15 +197,6 @@ static int rockchip_rt3261_init(struct snd_soc_pcm_runtime *rtd) DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); - snd_soc_add_codec_controls(codec, rockchip_rt3261_controls, - ARRAY_SIZE(rockchip_rt3261_controls)); - - /* Add specific widgets */ - snd_soc_dapm_new_controls(dapm, rockchip_rt3261_dapm_widgets, - ARRAY_SIZE(rockchip_rt3261_dapm_widgets)); - /* Set up specific audio path audio_mapnects */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - mutex_lock(&dapm->card->dapm_mutex); snd_soc_dapm_enable_pin(dapm, "Mic Jack"); @@ -253,6 +244,12 @@ static struct snd_soc_card rockchip_rt3261_snd_card = { .owner = THIS_MODULE, .dai_link = rockchip_rt3261_dai, .num_links = ARRAY_SIZE(rockchip_rt3261_dai), + .controls = rockchip_rt3261_controls, + .num_controls = ARRAY_SIZE(rockchip_rt3261_controls), + .dapm_widgets = rockchip_rt3261_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rockchip_rt3261_dapm_widgets), + .dapm_routes = audio_map, + .num_dapm_routes = ARRAY_SIZE(audio_map), }; /* diff --git a/sound/soc/rockchip/rk_rt5631_phone.c b/sound/soc/rockchip/rk_rt5631_phone.c index 1ccbba964642..02f045a9dbea 100755 --- a/sound/soc/rockchip/rk_rt5631_phone.c +++ b/sound/soc/rockchip/rk_rt5631_phone.c @@ -157,7 +157,7 @@ static int rk29_hw_params_voice(struct snd_pcm_substream *substream, return 0; } -static const struct snd_soc_dapm_widget rt5631_dapm_widgets[] = { +static const struct snd_soc_dapm_widget rk_rt5631_dapm_widgets[] = { SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), @@ -165,7 +165,7 @@ static const struct snd_soc_dapm_widget rt5631_dapm_widgets[] = { }; -static const struct snd_soc_dapm_route audio_map[]={ +static const struct snd_soc_dapm_route rk_rt5631_audio_map[]={ {"Headphone Jack", NULL, "HPOL"}, {"Headphone Jack", NULL, "HPOR"}, {"Ext Spk", NULL, "SPOL"}, @@ -174,7 +174,7 @@ static const struct snd_soc_dapm_route audio_map[]={ {"MIC Bias1", NULL, "Mic Jack"}, } ; //bard 7-5 s -static const struct snd_kcontrol_new rk29_controls[] = { +static const struct snd_kcontrol_new rk_rt5631_controls[] = { SOC_DAPM_PIN_SWITCH("Mic Jack"), SOC_DAPM_PIN_SWITCH("Ext Spk"), SOC_DAPM_PIN_SWITCH("Headphone Jack"), @@ -189,15 +189,7 @@ static int rk29_rt5631_init(struct snd_soc_pcm_runtime *rtd) struct snd_soc_dapm_context *dapm = &codec->dapm; DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); -//bard 7-5 s - snd_soc_add_codec_controls(codec, rk29_controls, - ARRAY_SIZE(rk29_controls)); -//bard 7-5 e - /* Add specific widgets */ - snd_soc_dapm_new_controls(dapm, rt5631_dapm_widgets, - ARRAY_SIZE(rt5631_dapm_widgets)); - /* Set up specific audio path audio_mapnects */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); + // snd_soc_dapm_nc_pin(dapm, "MONO"); // snd_soc_dapm_nc_pin(dapm, "MONOIN_RXN"); // snd_soc_dapm_nc_pin(dapm, "MONOIN_RXP"); @@ -234,6 +226,12 @@ static struct snd_soc_card rockchip_rt5631_snd_card = { .name = "RK_RT5631", .dai_link = rk29_dai, .num_links = 2, + .controls = rk_rt5631_controls, + .num_controls = ARRAY_SIZE(rk_rt5631_controls), + .dapm_widgets = rk_rt5631_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rk_rt5631_dapm_widgets), + .dapm_routes = rk_rt5631_audio_map, + .num_dapm_routes = ARRAY_SIZE(rk_rt5631_audio_map), }; static int rockchip_rt5631_audio_probe(struct platform_device *pdev) diff --git a/sound/soc/rockchip/rk_rt5640.c b/sound/soc/rockchip/rk_rt5640.c index f7a1d3dcb0c2..ed41ee9cefcc 100755 --- a/sound/soc/rockchip/rk_rt5640.c +++ b/sound/soc/rockchip/rk_rt5640.c @@ -154,14 +154,14 @@ static int rt5640_voice_hw_params(struct snd_pcm_substream *substream, return 0; } -static const struct snd_soc_dapm_widget rt5640_dapm_widgets[] = { +static const struct snd_soc_dapm_widget rk_rt5640_dapm_widgets[] = { SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_MIC("Headset Jack", NULL), SND_SOC_DAPM_SPK("Ext Spk", NULL), SND_SOC_DAPM_HP("Headphone Jack", NULL), }; -static const struct snd_soc_dapm_route audio_map[]={ +static const struct snd_soc_dapm_route rk_rt5640_audio_map[]={ /* Mic Jack --> MIC_IN*/ {"micbias1", NULL, "Mic Jack"}, @@ -180,7 +180,7 @@ static const struct snd_soc_dapm_route audio_map[]={ {"Headphone Jack", NULL, "HPOR"}, } ; -static const struct snd_kcontrol_new rk_controls[] = { +static const struct snd_kcontrol_new rk_rt5640_controls[] = { SOC_DAPM_PIN_SWITCH("Mic Jack"), SOC_DAPM_PIN_SWITCH("Headset Jack"), SOC_DAPM_PIN_SWITCH("Ext Spk"), @@ -197,15 +197,6 @@ static int rk29_rt5640_init(struct snd_soc_pcm_runtime *rtd) DBG("Enter::%s----%d\n",__FUNCTION__,__LINE__); - snd_soc_add_codec_controls(codec, rk_controls, - ARRAY_SIZE(rk_controls)); - - /* Add specific widgets */ - snd_soc_dapm_new_controls(dapm, rt5640_dapm_widgets, - ARRAY_SIZE(rt5640_dapm_widgets)); - /* Set up specific audio path audio_mapnects */ - snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); - mutex_lock(&dapm->card->dapm_mutex); snd_soc_dapm_enable_pin(dapm, "Mic Jack"); @@ -248,6 +239,12 @@ static struct snd_soc_card rockchip_rt5640_snd_card = { .name = "RK_RT5640", .dai_link = rk29_dai, .num_links = 2, + .controls = rk_rt5640_controls, + .num_controls = ARRAY_SIZE(rk_rt5640_controls), + .dapm_widgets = rk_rt5640_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(rk_rt5640_dapm_widgets), + .dapm_routes = rk_rt5640_audio_map, + .num_dapm_routes = ARRAY_SIZE(rk_rt5640_audio_map), }; static int rockchip_rt5640_audio_probe(struct platform_device *pdev)