diff options
author | Peter Ujfalusi <peter.ujfalusi@nokia.com> | 2011-01-10 08:39:49 -0500 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-01-11 19:48:45 -0500 |
commit | 399b82e4930f5f97556c7fd84ea3ef312718adee (patch) | |
tree | f9bfbf8003d7b537640b8ab859b39fb01f12831e /sound | |
parent | a710770e05563fd5add9af686569ee9fa56bbd65 (diff) |
ASoC: tlv320dac33: Add DAPM selection for LOM invert
The L/R LOM line can be invertined side of the
corresponding DAC, or inverted from the corresponding
LOP.
Add control for user space to select the source of the
LOM inversion.
When only the analog bypass is enabled, and the LOM
is inverted from DAC output, we need to power the
corresponding DAC.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/tlv320dac33.c | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c index 13d521cfe39..71d7be8ac48 100644 --- a/sound/soc/codecs/tlv320dac33.c +++ b/sound/soc/codecs/tlv320dac33.c | |||
@@ -298,7 +298,6 @@ static void dac33_init_chip(struct snd_soc_codec *codec) | |||
298 | if (unlikely(!dac33->chip_power)) | 298 | if (unlikely(!dac33->chip_power)) |
299 | return; | 299 | return; |
300 | 300 | ||
301 | /* 44-46: DAC Control Registers */ | ||
302 | /* A : DAC sample rate Fsref/1.5 */ | 301 | /* A : DAC sample rate Fsref/1.5 */ |
303 | dac33_write(codec, DAC33_DAC_CTRL_A, DAC33_DACRATE(0)); | 302 | dac33_write(codec, DAC33_DAC_CTRL_A, DAC33_DACRATE(0)); |
304 | /* B : DAC src=normal, not muted */ | 303 | /* B : DAC src=normal, not muted */ |
@@ -321,6 +320,10 @@ static void dac33_init_chip(struct snd_soc_codec *codec) | |||
321 | dac33_read_reg_cache(codec, DAC33_LINEL_TO_LLO_VOL)); | 320 | dac33_read_reg_cache(codec, DAC33_LINEL_TO_LLO_VOL)); |
322 | dac33_write(codec, DAC33_LINER_TO_RLO_VOL, | 321 | dac33_write(codec, DAC33_LINER_TO_RLO_VOL, |
323 | dac33_read_reg_cache(codec, DAC33_LINER_TO_RLO_VOL)); | 322 | dac33_read_reg_cache(codec, DAC33_LINER_TO_RLO_VOL)); |
323 | |||
324 | dac33_write(codec, DAC33_OUT_AMP_CTRL, | ||
325 | dac33_read_reg_cache(codec, DAC33_OUT_AMP_CTRL)); | ||
326 | |||
324 | } | 327 | } |
325 | 328 | ||
326 | static inline int dac33_read_id(struct snd_soc_codec *codec) | 329 | static inline int dac33_read_id(struct snd_soc_codec *codec) |
@@ -523,6 +526,25 @@ static const struct snd_kcontrol_new dac33_dapm_abypassl_control = | |||
523 | static const struct snd_kcontrol_new dac33_dapm_abypassr_control = | 526 | static const struct snd_kcontrol_new dac33_dapm_abypassr_control = |
524 | SOC_DAPM_SINGLE("Switch", DAC33_LINER_TO_RLO_VOL, 7, 1, 1); | 527 | SOC_DAPM_SINGLE("Switch", DAC33_LINER_TO_RLO_VOL, 7, 1, 1); |
525 | 528 | ||
529 | /* LOP L/R invert selection */ | ||
530 | static const char *dac33_lr_lom_texts[] = {"DAC", "LOP"}; | ||
531 | |||
532 | static const struct soc_enum dac33_left_lom_enum = | ||
533 | SOC_ENUM_SINGLE(DAC33_OUT_AMP_CTRL, 3, | ||
534 | ARRAY_SIZE(dac33_lr_lom_texts), | ||
535 | dac33_lr_lom_texts); | ||
536 | |||
537 | static const struct snd_kcontrol_new dac33_dapm_left_lom_control = | ||
538 | SOC_DAPM_ENUM("Route", dac33_left_lom_enum); | ||
539 | |||
540 | static const struct soc_enum dac33_right_lom_enum = | ||
541 | SOC_ENUM_SINGLE(DAC33_OUT_AMP_CTRL, 2, | ||
542 | ARRAY_SIZE(dac33_lr_lom_texts), | ||
543 | dac33_lr_lom_texts); | ||
544 | |||
545 | static const struct snd_kcontrol_new dac33_dapm_right_lom_control = | ||
546 | SOC_DAPM_ENUM("Route", dac33_right_lom_enum); | ||
547 | |||
526 | static const struct snd_soc_dapm_widget dac33_dapm_widgets[] = { | 548 | static const struct snd_soc_dapm_widget dac33_dapm_widgets[] = { |
527 | SND_SOC_DAPM_OUTPUT("LEFT_LO"), | 549 | SND_SOC_DAPM_OUTPUT("LEFT_LO"), |
528 | SND_SOC_DAPM_OUTPUT("RIGHT_LO"), | 550 | SND_SOC_DAPM_OUTPUT("RIGHT_LO"), |
@@ -539,6 +561,18 @@ static const struct snd_soc_dapm_widget dac33_dapm_widgets[] = { | |||
539 | SND_SOC_DAPM_SWITCH("Analog Right Bypass", SND_SOC_NOPM, 0, 0, | 561 | SND_SOC_DAPM_SWITCH("Analog Right Bypass", SND_SOC_NOPM, 0, 0, |
540 | &dac33_dapm_abypassr_control), | 562 | &dac33_dapm_abypassr_control), |
541 | 563 | ||
564 | SND_SOC_DAPM_MUX("Left LOM Inverted From", SND_SOC_NOPM, 0, 0, | ||
565 | &dac33_dapm_left_lom_control), | ||
566 | SND_SOC_DAPM_MUX("Right LOM Inverted From", SND_SOC_NOPM, 0, 0, | ||
567 | &dac33_dapm_right_lom_control), | ||
568 | /* | ||
569 | * For DAPM path, when only the anlog bypass path is enabled, and the | ||
570 | * LOP inverted from the corresponding DAC side. | ||
571 | * This is needed, so we can attach the DAC power supply in this case. | ||
572 | */ | ||
573 | SND_SOC_DAPM_PGA("Left Bypass PGA", SND_SOC_NOPM, 0, 0, NULL, 0), | ||
574 | SND_SOC_DAPM_PGA("Right Bypass PGA", SND_SOC_NOPM, 0, 0, NULL, 0), | ||
575 | |||
542 | SND_SOC_DAPM_REG(snd_soc_dapm_mixer, "Output Left Amplifier", | 576 | SND_SOC_DAPM_REG(snd_soc_dapm_mixer, "Output Left Amplifier", |
543 | DAC33_OUT_AMP_PWR_CTRL, 6, 3, 3, 0), | 577 | DAC33_OUT_AMP_PWR_CTRL, 6, 3, 3, 0), |
544 | SND_SOC_DAPM_REG(snd_soc_dapm_mixer, "Output Right Amplifier", | 578 | SND_SOC_DAPM_REG(snd_soc_dapm_mixer, "Output Right Amplifier", |
@@ -561,11 +595,22 @@ static const struct snd_soc_dapm_route audio_map[] = { | |||
561 | {"Output Left Amplifier", NULL, "DACL"}, | 595 | {"Output Left Amplifier", NULL, "DACL"}, |
562 | {"Output Right Amplifier", NULL, "DACR"}, | 596 | {"Output Right Amplifier", NULL, "DACR"}, |
563 | 597 | ||
564 | {"Output Left Amplifier", NULL, "Analog Left Bypass"}, | 598 | {"Left Bypass PGA", NULL, "Analog Left Bypass"}, |
565 | {"Output Right Amplifier", NULL, "Analog Right Bypass"}, | 599 | {"Right Bypass PGA", NULL, "Analog Right Bypass"}, |
600 | |||
601 | {"Left LOM Inverted From", "DAC", "Left Bypass PGA"}, | ||
602 | {"Right LOM Inverted From", "DAC", "Right Bypass PGA"}, | ||
603 | {"Left LOM Inverted From", "LOP", "Analog Left Bypass"}, | ||
604 | {"Right LOM Inverted From", "LOP", "Analog Right Bypass"}, | ||
605 | |||
606 | {"Output Left Amplifier", NULL, "Left LOM Inverted From"}, | ||
607 | {"Output Right Amplifier", NULL, "Right LOM Inverted From"}, | ||
608 | |||
609 | {"DACL", NULL, "Left DAC Power"}, | ||
610 | {"DACR", NULL, "Right DAC Power"}, | ||
566 | 611 | ||
567 | {"Output Left Amplifier", NULL, "Left DAC Power"}, | 612 | {"Left Bypass PGA", NULL, "Left DAC Power"}, |
568 | {"Output Right Amplifier", NULL, "Right DAC Power"}, | 613 | {"Right Bypass PGA", NULL, "Right DAC Power"}, |
569 | 614 | ||
570 | /* output */ | 615 | /* output */ |
571 | {"LEFT_LO", NULL, "Output Left Amplifier"}, | 616 | {"LEFT_LO", NULL, "Output Left Amplifier"}, |