diff options
author | Misael Lopez Cruz | 2013-07-24 16:00:44 -0500 |
---|---|---|
committer | Gerrit Code Review | 2013-08-05 15:53:01 -0500 |
commit | 28f0b7749dc033aea7fbeccfc61bf2fe8c659ac4 (patch) | |
tree | c81e630a2f3f539942bc8fddf25fde6d4be5558a | |
parent | c03b70ef926884648b3498f6ad8d1fdd59750078 (diff) | |
download | kernel-audio-28f0b7749dc033aea7fbeccfc61bf2fe8c659ac4.tar.gz kernel-audio-28f0b7749dc033aea7fbeccfc61bf2fe8c659ac4.tar.xz kernel-audio-28f0b7749dc033aea7fbeccfc61bf2fe8c659ac4.zip |
ASoC: tlv320aic3x: Add ADC settle time
There are artifacts during capture route start (e.g. caused by bias or even
ADC power-on itsef) that cannot be removed through DAPM or with CODEC's
facilities. A settle time is added to account for these artifacts.
--
similar to:
commit: 07ca81d43d5c7ed7be2e164e0f85631c1938be30
Author: Gabriel M. Beddingfield <gabrbedd@ti.com>
ASoC: twl6040: Let amics settle after biasing
--
Change-Id: Iba12c014b8e088d2a4346a1cf34884be40959ac9
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
-rw-r--r-- | Documentation/devicetree/bindings/sound/tlv320aic3x.txt | 2 | ||||
-rw-r--r-- | include/sound/tlv320aic3x.h | 1 | ||||
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 29 |
3 files changed, 29 insertions, 3 deletions
diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt index e7b98f41fa5f..cac3d0b68662 100644 --- a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt +++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt | |||
@@ -11,6 +11,8 @@ Optional properties: | |||
11 | 11 | ||
12 | - gpio-reset - gpio pin number used for codec reset | 12 | - gpio-reset - gpio pin number used for codec reset |
13 | - ai3x-gpio-func - <array of 2 int> - AIC3X_GPIO1 & AIC3X_GPIO2 Functionality | 13 | - ai3x-gpio-func - <array of 2 int> - AIC3X_GPIO1 & AIC3X_GPIO2 Functionality |
14 | - adc-settle-ms - Settle time to remove capture glitches caused by ADC power up, | ||
15 | mic bias, etc. | ||
14 | 16 | ||
15 | Example: | 17 | Example: |
16 | 18 | ||
diff --git a/include/sound/tlv320aic3x.h b/include/sound/tlv320aic3x.h index ffd9bc793105..b670b2b5f740 100644 --- a/include/sound/tlv320aic3x.h +++ b/include/sound/tlv320aic3x.h | |||
@@ -53,6 +53,7 @@ struct aic3x_setup_data { | |||
53 | struct aic3x_pdata { | 53 | struct aic3x_pdata { |
54 | int gpio_reset; /* < 0 if not used */ | 54 | int gpio_reset; /* < 0 if not used */ |
55 | struct aic3x_setup_data *setup; | 55 | struct aic3x_setup_data *setup; |
56 | unsigned int adc_settle_ms; | ||
56 | }; | 57 | }; |
57 | 58 | ||
58 | #endif | 59 | #endif |
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 | } |