diff options
Diffstat (limited to 'sound/soc/codecs/tlv320aic3x.c')
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index a945452fce0a..31490c3e00e7 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -85,6 +85,7 @@ struct aic3x_priv { | |||
85 | #define AIC3X_MODEL_33 1 | 85 | #define AIC3X_MODEL_33 1 |
86 | #define AIC3X_MODEL_3007 2 | 86 | #define AIC3X_MODEL_3007 2 |
87 | u16 model; | 87 | u16 model; |
88 | unsigned int adc_settle_ms; | ||
88 | }; | 89 | }; |
89 | 90 | ||
90 | /* | 91 | /* |
@@ -539,6 +540,22 @@ SOC_DAPM_ENUM("Route", aic3x_enum[LINE2L_ENUM]); | |||
539 | static const struct snd_kcontrol_new aic3x_right_line2_mux_controls = | 540 | static const struct snd_kcontrol_new aic3x_right_line2_mux_controls = |
540 | SOC_DAPM_ENUM("Route", aic3x_enum[LINE2R_ENUM]); | 541 | SOC_DAPM_ENUM("Route", aic3x_enum[LINE2R_ENUM]); |
541 | 542 | ||
543 | static int aic3x_adc_event(struct snd_soc_dapm_widget *w, | ||
544 | struct snd_kcontrol *kcontrol, int event) | ||
545 | { | ||
546 | struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(w->codec); | ||
547 | |||
548 | /* | ||
549 | * Sleep for a device specific ADC settle time, it accounts | ||
550 | * for any artifacts caused by the ADC power, mic bias, etc. | ||
551 | * Event type has to be POST_PMU. | ||
552 | */ | ||
553 | if (aic3x->adc_settle_ms) | ||
554 | msleep(aic3x->adc_settle_ms); | ||
555 | |||
556 | return 0; | ||
557 | } | ||
558 | |||
542 | static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { | 559 | static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { |
543 | /* Left DAC to Left Outputs */ | 560 | /* Left DAC to Left Outputs */ |
544 | SND_SOC_DAPM_DAC("Left DAC", "Left Playback", DAC_PWR, 7, 0), | 561 | SND_SOC_DAPM_DAC("Left DAC", "Left Playback", DAC_PWR, 7, 0), |
@@ -564,7 +581,9 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { | |||
564 | SND_SOC_DAPM_PGA("Mono Out", MONOLOPM_CTRL, 0, 0, NULL, 0), | 581 | SND_SOC_DAPM_PGA("Mono Out", MONOLOPM_CTRL, 0, 0, NULL, 0), |
565 | 582 | ||
566 | /* Inputs to Left ADC */ | 583 | /* Inputs to Left ADC */ |
567 | SND_SOC_DAPM_ADC("Left ADC", "Left Capture", LINE1L_2_LADC_CTRL, 2, 0), | 584 | SND_SOC_DAPM_ADC_E("Left ADC", "Left Capture", |
585 | LINE1L_2_LADC_CTRL, 2, 0, | ||
586 | aic3x_adc_event, SND_SOC_DAPM_POST_PMU), | ||
568 | SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0, | 587 | SND_SOC_DAPM_MIXER("Left PGA Mixer", SND_SOC_NOPM, 0, 0, |
569 | &aic3x_left_pga_mixer_controls[0], | 588 | &aic3x_left_pga_mixer_controls[0], |
570 | ARRAY_SIZE(aic3x_left_pga_mixer_controls)), | 589 | ARRAY_SIZE(aic3x_left_pga_mixer_controls)), |
@@ -576,8 +595,9 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { | |||
576 | &aic3x_left_line2_mux_controls), | 595 | &aic3x_left_line2_mux_controls), |
577 | 596 | ||
578 | /* Inputs to Right ADC */ | 597 | /* Inputs to Right ADC */ |
579 | SND_SOC_DAPM_ADC("Right ADC", "Right Capture", | 598 | SND_SOC_DAPM_ADC_E("Right ADC", "Right Capture", |
580 | LINE1R_2_RADC_CTRL, 2, 0), | 599 | LINE1R_2_RADC_CTRL, 2, 0, |
600 | aic3x_adc_event, SND_SOC_DAPM_POST_PMU), | ||
581 | SND_SOC_DAPM_MIXER("Right PGA Mixer", SND_SOC_NOPM, 0, 0, | 601 | SND_SOC_DAPM_MIXER("Right PGA Mixer", SND_SOC_NOPM, 0, 0, |
582 | &aic3x_right_pga_mixer_controls[0], | 602 | &aic3x_right_pga_mixer_controls[0], |
583 | ARRAY_SIZE(aic3x_right_pga_mixer_controls)), | 603 | ARRAY_SIZE(aic3x_right_pga_mixer_controls)), |
@@ -1492,6 +1512,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, | |||
1492 | if (pdata) { | 1512 | if (pdata) { |
1493 | aic3x->gpio_reset = pdata->gpio_reset; | 1513 | aic3x->gpio_reset = pdata->gpio_reset; |
1494 | aic3x->setup = pdata->setup; | 1514 | aic3x->setup = pdata->setup; |
1515 | aic3x->adc_settle_ms = pdata->adc_settle_ms; | ||
1495 | } else if (np) { | 1516 | } else if (np) { |
1496 | ai3x_setup = devm_kzalloc(&i2c->dev, sizeof(*ai3x_setup), | 1517 | ai3x_setup = devm_kzalloc(&i2c->dev, sizeof(*ai3x_setup), |
1497 | GFP_KERNEL); | 1518 | GFP_KERNEL); |
@@ -1511,6 +1532,8 @@ static int aic3x_i2c_probe(struct i2c_client *i2c, | |||
1511 | aic3x->setup = ai3x_setup; | 1532 | aic3x->setup = ai3x_setup; |
1512 | } | 1533 | } |
1513 | 1534 | ||
1535 | of_property_read_u32(np, "adc-settle-ms", | ||
1536 | &aic3x->adc_settle_ms); | ||
1514 | } else { | 1537 | } else { |
1515 | aic3x->gpio_reset = -1; | 1538 | aic3x->gpio_reset = -1; |
1516 | } | 1539 | } |