diff options
author | Jorge Eduardo Candelaria <jorge.candelaria@ti.com> | 2010-07-15 12:38:01 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2010-07-17 14:27:18 -0400 |
commit | 0fad4ed7b230f593539b2da9cadbb77cb3a3131a (patch) | |
tree | cd1e44176e99a0ed20e912e876746207e5438bd7 /sound/soc | |
parent | 27eeb1feed5c85877f39ff05f6fde0b538b8b9fc (diff) |
ASoC: TWL6040: Correct widget handling for drivers
In order to reduce pop-noise at powering up/down of the DACs and Drivers,
these components have to be handled in a specific sequence. Headset,
Handsfree, and Earphone drivers are now registered as PGA components to
ensure DACs are enabled first.
Also, add a delay to leave time for DACs to settle before
continuing power up/down sequence.
Signed-off-by: Jorge Eduardo Candelaria <jorge.candelaria@ti.com>
Signed-off-by: Margarita Olaya Cabrera <magi.olaya@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/twl6040.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c index 85dd4fb4c681..64a807f1a8a1 100644 --- a/sound/soc/codecs/twl6040.c +++ b/sound/soc/codecs/twl6040.c | |||
@@ -360,6 +360,13 @@ static int headset_power_mode(struct snd_soc_codec *codec, int high_perf) | |||
360 | return 0; | 360 | return 0; |
361 | } | 361 | } |
362 | 362 | ||
363 | static int twl6040_hs_dac_event(struct snd_soc_dapm_widget *w, | ||
364 | struct snd_kcontrol *kcontrol, int event) | ||
365 | { | ||
366 | msleep(1); | ||
367 | return 0; | ||
368 | } | ||
369 | |||
363 | static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w, | 370 | static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w, |
364 | struct snd_kcontrol *kcontrol, int event) | 371 | struct snd_kcontrol *kcontrol, int event) |
365 | { | 372 | { |
@@ -371,6 +378,8 @@ static int twl6040_power_mode_event(struct snd_soc_dapm_widget *w, | |||
371 | else | 378 | else |
372 | priv->non_lp--; | 379 | priv->non_lp--; |
373 | 380 | ||
381 | msleep(1); | ||
382 | |||
374 | return 0; | 383 | return 0; |
375 | } | 384 | } |
376 | 385 | ||
@@ -471,20 +480,6 @@ static const struct snd_kcontrol_new hfdacl_switch_controls = | |||
471 | static const struct snd_kcontrol_new hfdacr_switch_controls = | 480 | static const struct snd_kcontrol_new hfdacr_switch_controls = |
472 | SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 2, 1, 0); | 481 | SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 2, 1, 0); |
473 | 482 | ||
474 | /* Headset driver switches */ | ||
475 | static const struct snd_kcontrol_new hsl_driver_switch_controls = | ||
476 | SOC_DAPM_SINGLE("Switch", TWL6040_REG_HSLCTL, 2, 1, 0); | ||
477 | |||
478 | static const struct snd_kcontrol_new hsr_driver_switch_controls = | ||
479 | SOC_DAPM_SINGLE("Switch", TWL6040_REG_HSRCTL, 2, 1, 0); | ||
480 | |||
481 | /* Handsfree driver switches */ | ||
482 | static const struct snd_kcontrol_new hfl_driver_switch_controls = | ||
483 | SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFLCTL, 4, 1, 0); | ||
484 | |||
485 | static const struct snd_kcontrol_new hfr_driver_switch_controls = | ||
486 | SOC_DAPM_SINGLE("Switch", TWL6040_REG_HFRCTL, 4, 1, 0); | ||
487 | |||
488 | static const struct snd_kcontrol_new ep_driver_switch_controls = | 483 | static const struct snd_kcontrol_new ep_driver_switch_controls = |
489 | SOC_DAPM_SINGLE("Switch", TWL6040_REG_EARCTL, 0, 1, 0); | 484 | SOC_DAPM_SINGLE("Switch", TWL6040_REG_EARCTL, 0, 1, 0); |
490 | 485 | ||
@@ -548,10 +543,14 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = { | |||
548 | TWL6040_REG_DMICBCTL, 4, 0), | 543 | TWL6040_REG_DMICBCTL, 4, 0), |
549 | 544 | ||
550 | /* DACs */ | 545 | /* DACs */ |
551 | SND_SOC_DAPM_DAC("HSDAC Left", "Headset Playback", | 546 | SND_SOC_DAPM_DAC_E("HSDAC Left", "Headset Playback", |
552 | TWL6040_REG_HSLCTL, 0, 0), | 547 | TWL6040_REG_HSLCTL, 0, 0, |
553 | SND_SOC_DAPM_DAC("HSDAC Right", "Headset Playback", | 548 | twl6040_hs_dac_event, |
554 | TWL6040_REG_HSRCTL, 0, 0), | 549 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), |
550 | SND_SOC_DAPM_DAC_E("HSDAC Right", "Headset Playback", | ||
551 | TWL6040_REG_HSRCTL, 0, 0, | ||
552 | twl6040_hs_dac_event, | ||
553 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | ||
555 | SND_SOC_DAPM_DAC_E("HFDAC Left", "Handsfree Playback", | 554 | SND_SOC_DAPM_DAC_E("HFDAC Left", "Handsfree Playback", |
556 | TWL6040_REG_HFLCTL, 0, 0, | 555 | TWL6040_REG_HFLCTL, 0, 0, |
557 | twl6040_power_mode_event, | 556 | twl6040_power_mode_event, |
@@ -571,18 +570,19 @@ static const struct snd_soc_dapm_widget twl6040_dapm_widgets[] = { | |||
571 | SND_SOC_DAPM_SWITCH("HFDAC Right Playback", | 570 | SND_SOC_DAPM_SWITCH("HFDAC Right Playback", |
572 | SND_SOC_NOPM, 0, 0, &hfdacr_switch_controls), | 571 | SND_SOC_NOPM, 0, 0, &hfdacr_switch_controls), |
573 | 572 | ||
574 | SND_SOC_DAPM_SWITCH("Headset Left Driver", | 573 | /* Analog playback drivers */ |
575 | SND_SOC_NOPM, 0, 0, &hsl_driver_switch_controls), | 574 | SND_SOC_DAPM_PGA_E("Handsfree Left Driver", |
576 | SND_SOC_DAPM_SWITCH("Headset Right Driver", | 575 | TWL6040_REG_HFLCTL, 4, 0, NULL, 0, |
577 | SND_SOC_NOPM, 0, 0, &hsr_driver_switch_controls), | ||
578 | SND_SOC_DAPM_SWITCH_E("Handsfree Left Driver", | ||
579 | SND_SOC_NOPM, 0, 0, &hfl_driver_switch_controls, | ||
580 | twl6040_power_mode_event, | 576 | twl6040_power_mode_event, |
581 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | 577 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), |
582 | SND_SOC_DAPM_SWITCH_E("Handsfree Right Driver", | 578 | SND_SOC_DAPM_PGA_E("Handsfree Right Driver", |
583 | SND_SOC_NOPM, 0, 0, &hfr_driver_switch_controls, | 579 | TWL6040_REG_HFRCTL, 4, 0, NULL, 0, |
584 | twl6040_power_mode_event, | 580 | twl6040_power_mode_event, |
585 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), | 581 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD), |
582 | SND_SOC_DAPM_PGA("Headset Left Driver", | ||
583 | TWL6040_REG_HSLCTL, 2, 0, NULL, 0), | ||
584 | SND_SOC_DAPM_PGA("Headset Right Driver", | ||
585 | TWL6040_REG_HSRCTL, 2, 0, NULL, 0), | ||
586 | SND_SOC_DAPM_SWITCH_E("Earphone Driver", | 586 | SND_SOC_DAPM_SWITCH_E("Earphone Driver", |
587 | SND_SOC_NOPM, 0, 0, &ep_driver_switch_controls, | 587 | SND_SOC_NOPM, 0, 0, &ep_driver_switch_controls, |
588 | twl6040_power_mode_event, | 588 | twl6040_power_mode_event, |
@@ -616,8 +616,8 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
616 | {"HSDAC Left Playback", "Switch", "HSDAC Left"}, | 616 | {"HSDAC Left Playback", "Switch", "HSDAC Left"}, |
617 | {"HSDAC Right Playback", "Switch", "HSDAC Right"}, | 617 | {"HSDAC Right Playback", "Switch", "HSDAC Right"}, |
618 | 618 | ||
619 | {"Headset Left Driver", "Switch", "HSDAC Left Playback"}, | 619 | {"Headset Left Driver", NULL, "HSDAC Left Playback"}, |
620 | {"Headset Right Driver", "Switch", "HSDAC Right Playback"}, | 620 | {"Headset Right Driver", NULL, "HSDAC Right Playback"}, |
621 | 621 | ||
622 | {"HSOL", NULL, "Headset Left Driver"}, | 622 | {"HSOL", NULL, "Headset Left Driver"}, |
623 | {"HSOR", NULL, "Headset Right Driver"}, | 623 | {"HSOR", NULL, "Headset Right Driver"}, |