diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-04-22 16:36:14 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-04-22 16:37:48 -0400 |
commit | 291ce18ceb84aca79368369885eec2d329ae16c5 (patch) | |
tree | 5008bc92d51ff4423c1b86ce937b651124ca3375 | |
parent | 727fb909e541ebd09d5b552afef02a147978c151 (diff) |
ASoC: Implement WM8903 digital sidetone support
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/wm8903.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c index bec418af97c9..d8a9222fbf74 100644 --- a/sound/soc/codecs/wm8903.c +++ b/sound/soc/codecs/wm8903.c | |||
@@ -533,6 +533,7 @@ static int wm8903_class_w_put(struct snd_kcontrol *kcontrol, | |||
533 | /* ALSA can only do steps of .01dB */ | 533 | /* ALSA can only do steps of .01dB */ |
534 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); | 534 | static const DECLARE_TLV_DB_SCALE(digital_tlv, -7200, 75, 1); |
535 | 535 | ||
536 | static const DECLARE_TLV_DB_SCALE(digital_sidetone_tlv, -3600, 300, 0); | ||
536 | static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); | 537 | static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); |
537 | 538 | ||
538 | static const DECLARE_TLV_DB_SCALE(drc_tlv_thresh, 0, 75, 0); | 539 | static const DECLARE_TLV_DB_SCALE(drc_tlv_thresh, 0, 75, 0); |
@@ -651,6 +652,16 @@ static const struct soc_enum rinput_inv_enum = | |||
651 | SOC_ENUM_SINGLE(WM8903_ANALOGUE_RIGHT_INPUT_1, 4, 3, rinput_mux_text); | 652 | SOC_ENUM_SINGLE(WM8903_ANALOGUE_RIGHT_INPUT_1, 4, 3, rinput_mux_text); |
652 | 653 | ||
653 | 654 | ||
655 | static const char *sidetone_text[] = { | ||
656 | "None", "Left", "Right" | ||
657 | }; | ||
658 | |||
659 | static const struct soc_enum lsidetone_enum = | ||
660 | SOC_ENUM_SINGLE(WM8903_DAC_DIGITAL_0, 2, 3, sidetone_text); | ||
661 | |||
662 | static const struct soc_enum rsidetone_enum = | ||
663 | SOC_ENUM_SINGLE(WM8903_DAC_DIGITAL_0, 0, 3, sidetone_text); | ||
664 | |||
654 | static const struct snd_kcontrol_new wm8903_snd_controls[] = { | 665 | static const struct snd_kcontrol_new wm8903_snd_controls[] = { |
655 | 666 | ||
656 | /* Input PGAs - No TLV since the scale depends on PGA mode */ | 667 | /* Input PGAs - No TLV since the scale depends on PGA mode */ |
@@ -694,6 +705,9 @@ SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8903_ADC_DIGITAL_VOLUME_LEFT, | |||
694 | SOC_ENUM("ADC Companding Mode", adc_companding), | 705 | SOC_ENUM("ADC Companding Mode", adc_companding), |
695 | SOC_SINGLE("ADC Companding Switch", WM8903_AUDIO_INTERFACE_0, 3, 1, 0), | 706 | SOC_SINGLE("ADC Companding Switch", WM8903_AUDIO_INTERFACE_0, 3, 1, 0), |
696 | 707 | ||
708 | SOC_DOUBLE_TLV("Digital Sidetone Volume", WM8903_DAC_DIGITAL_0, 4, 8, | ||
709 | 12, 0, digital_sidetone_tlv), | ||
710 | |||
697 | /* DAC */ | 711 | /* DAC */ |
698 | SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8903_DAC_DIGITAL_VOLUME_LEFT, | 712 | SOC_DOUBLE_R_TLV("Digital Playback Volume", WM8903_DAC_DIGITAL_VOLUME_LEFT, |
699 | WM8903_DAC_DIGITAL_VOLUME_RIGHT, 1, 120, 0, digital_tlv), | 713 | WM8903_DAC_DIGITAL_VOLUME_RIGHT, 1, 120, 0, digital_tlv), |
@@ -756,6 +770,12 @@ static const struct snd_kcontrol_new rinput_mux = | |||
756 | static const struct snd_kcontrol_new rinput_inv_mux = | 770 | static const struct snd_kcontrol_new rinput_inv_mux = |
757 | SOC_DAPM_ENUM("Right Inverting Input Mux", rinput_inv_enum); | 771 | SOC_DAPM_ENUM("Right Inverting Input Mux", rinput_inv_enum); |
758 | 772 | ||
773 | static const struct snd_kcontrol_new lsidetone_mux = | ||
774 | SOC_DAPM_ENUM("DACL Sidetone Mux", lsidetone_enum); | ||
775 | |||
776 | static const struct snd_kcontrol_new rsidetone_mux = | ||
777 | SOC_DAPM_ENUM("DACR Sidetone Mux", rsidetone_enum); | ||
778 | |||
759 | static const struct snd_kcontrol_new left_output_mixer[] = { | 779 | static const struct snd_kcontrol_new left_output_mixer[] = { |
760 | SOC_DAPM_SINGLE("DACL Switch", WM8903_ANALOGUE_LEFT_MIX_0, 3, 1, 0), | 780 | SOC_DAPM_SINGLE("DACL Switch", WM8903_ANALOGUE_LEFT_MIX_0, 3, 1, 0), |
761 | SOC_DAPM_SINGLE("DACR Switch", WM8903_ANALOGUE_LEFT_MIX_0, 2, 1, 0), | 781 | SOC_DAPM_SINGLE("DACR Switch", WM8903_ANALOGUE_LEFT_MIX_0, 2, 1, 0), |
@@ -822,6 +842,9 @@ SND_SOC_DAPM_PGA("Right Input PGA", WM8903_POWER_MANAGEMENT_0, 0, 0, NULL, 0), | |||
822 | SND_SOC_DAPM_ADC("ADCL", "Left HiFi Capture", WM8903_POWER_MANAGEMENT_6, 1, 0), | 842 | SND_SOC_DAPM_ADC("ADCL", "Left HiFi Capture", WM8903_POWER_MANAGEMENT_6, 1, 0), |
823 | SND_SOC_DAPM_ADC("ADCR", "Right HiFi Capture", WM8903_POWER_MANAGEMENT_6, 0, 0), | 843 | SND_SOC_DAPM_ADC("ADCR", "Right HiFi Capture", WM8903_POWER_MANAGEMENT_6, 0, 0), |
824 | 844 | ||
845 | SND_SOC_DAPM_MUX("DACL Sidetone", SND_SOC_NOPM, 0, 0, &lsidetone_mux), | ||
846 | SND_SOC_DAPM_MUX("DACR Sidetone", SND_SOC_NOPM, 0, 0, &rsidetone_mux), | ||
847 | |||
825 | SND_SOC_DAPM_DAC("DACL", "Left Playback", WM8903_POWER_MANAGEMENT_6, 3, 0), | 848 | SND_SOC_DAPM_DAC("DACL", "Left Playback", WM8903_POWER_MANAGEMENT_6, 3, 0), |
826 | SND_SOC_DAPM_DAC("DACR", "Right Playback", WM8903_POWER_MANAGEMENT_6, 2, 0), | 849 | SND_SOC_DAPM_DAC("DACR", "Right Playback", WM8903_POWER_MANAGEMENT_6, 2, 0), |
827 | 850 | ||
@@ -910,7 +933,14 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
910 | { "ADCR", NULL, "Right Input PGA" }, | 933 | { "ADCR", NULL, "Right Input PGA" }, |
911 | { "ADCR", NULL, "CLK_DSP" }, | 934 | { "ADCR", NULL, "CLK_DSP" }, |
912 | 935 | ||
936 | { "DACL Sidetone", "Left", "ADCL" }, | ||
937 | { "DACL Sidetone", "Right", "ADCR" }, | ||
938 | { "DACR Sidetone", "Left", "ADCL" }, | ||
939 | { "DACR Sidetone", "Right", "ADCR" }, | ||
940 | |||
941 | { "DACL", NULL, "DACL Sidetone" }, | ||
913 | { "DACL", NULL, "CLK_DSP" }, | 942 | { "DACL", NULL, "CLK_DSP" }, |
943 | { "DACR", NULL, "DACR Sidetone" }, | ||
914 | { "DACR", NULL, "CLK_DSP" }, | 944 | { "DACR", NULL, "CLK_DSP" }, |
915 | 945 | ||
916 | { "Left Output Mixer", "Left Bypass Switch", "Left Input PGA" }, | 946 | { "Left Output Mixer", "Left Bypass Switch", "Left Input PGA" }, |