mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
Audio: update controls, widgets and audio map register in machine driver
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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),
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user