diff options
author | Michał Mirosław <mirq-linux@rere.qmqm.pl> | 2019-08-20 07:02:37 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-08-20 13:03:02 -0400 |
commit | 0a05f2e865ad6e461cada8f931b34551287dbba2 (patch) | |
tree | 8aa4fa612d26acd824010aa71a6da50f8a5665e9 | |
parent | 22afe6242387eca1ac3905fbde7bef38deb0357d (diff) |
ASoC: wm8904: implement input mode select as a mux
Make '* Capture Mode' a mux. This makes DAPM know that in single-ended
mode only inverting mux paths need to be enabled.
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/125cd3c9f298da9b08a4d6002d4c00d70a898950.1566298834.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/wm8904.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 525e4ef654a1..bcb3c9d5abf0 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -545,18 +545,6 @@ static const DECLARE_TLV_DB_SCALE(out_tlv, -5700, 100, 0); | |||
545 | static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 300, 0); | 545 | static const DECLARE_TLV_DB_SCALE(sidetone_tlv, -3600, 300, 0); |
546 | static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); | 546 | static const DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); |
547 | 547 | ||
548 | static const char *input_mode_text[] = { | ||
549 | "Single-Ended", "Differential Line", "Differential Mic" | ||
550 | }; | ||
551 | |||
552 | static SOC_ENUM_SINGLE_DECL(lin_mode, | ||
553 | WM8904_ANALOGUE_LEFT_INPUT_1, 0, | ||
554 | input_mode_text); | ||
555 | |||
556 | static SOC_ENUM_SINGLE_DECL(rin_mode, | ||
557 | WM8904_ANALOGUE_RIGHT_INPUT_1, 0, | ||
558 | input_mode_text); | ||
559 | |||
560 | static const char *hpf_mode_text[] = { | 548 | static const char *hpf_mode_text[] = { |
561 | "Hi-fi", "Voice 1", "Voice 2", "Voice 3" | 549 | "Hi-fi", "Voice 1", "Voice 2", "Voice 3" |
562 | }; | 550 | }; |
@@ -591,9 +579,6 @@ static const struct snd_kcontrol_new wm8904_adc_snd_controls[] = { | |||
591 | SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8904_ADC_DIGITAL_VOLUME_LEFT, | 579 | SOC_DOUBLE_R_TLV("Digital Capture Volume", WM8904_ADC_DIGITAL_VOLUME_LEFT, |
592 | WM8904_ADC_DIGITAL_VOLUME_RIGHT, 1, 119, 0, digital_tlv), | 580 | WM8904_ADC_DIGITAL_VOLUME_RIGHT, 1, 119, 0, digital_tlv), |
593 | 581 | ||
594 | SOC_ENUM("Left Capture Mode", lin_mode), | ||
595 | SOC_ENUM("Right Capture Mode", rin_mode), | ||
596 | |||
597 | /* No TLV since it depends on mode */ | 582 | /* No TLV since it depends on mode */ |
598 | SOC_DOUBLE_R("Capture Volume", WM8904_ANALOGUE_LEFT_INPUT_0, | 583 | SOC_DOUBLE_R("Capture Volume", WM8904_ANALOGUE_LEFT_INPUT_0, |
599 | WM8904_ANALOGUE_RIGHT_INPUT_0, 0, 31, 0), | 584 | WM8904_ANALOGUE_RIGHT_INPUT_0, 0, 31, 0), |
@@ -852,6 +837,10 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
852 | return 0; | 837 | return 0; |
853 | } | 838 | } |
854 | 839 | ||
840 | static const char *input_mode_text[] = { | ||
841 | "Single-Ended", "Differential Line", "Differential Mic" | ||
842 | }; | ||
843 | |||
855 | static const char *lin_text[] = { | 844 | static const char *lin_text[] = { |
856 | "IN1L", "IN2L", "IN3L" | 845 | "IN1L", "IN2L", "IN3L" |
857 | }; | 846 | }; |
@@ -868,6 +857,13 @@ static SOC_ENUM_SINGLE_DECL(lin_inv_enum, WM8904_ANALOGUE_LEFT_INPUT_1, 4, | |||
868 | static const struct snd_kcontrol_new lin_inv_mux = | 857 | static const struct snd_kcontrol_new lin_inv_mux = |
869 | SOC_DAPM_ENUM("Left Capture Inverting Mux", lin_inv_enum); | 858 | SOC_DAPM_ENUM("Left Capture Inverting Mux", lin_inv_enum); |
870 | 859 | ||
860 | static SOC_ENUM_SINGLE_DECL(lin_mode_enum, | ||
861 | WM8904_ANALOGUE_LEFT_INPUT_1, 0, | ||
862 | input_mode_text); | ||
863 | |||
864 | static const struct snd_kcontrol_new lin_mode = | ||
865 | SOC_DAPM_ENUM("Left Capture Mode", lin_mode_enum); | ||
866 | |||
871 | static const char *rin_text[] = { | 867 | static const char *rin_text[] = { |
872 | "IN1R", "IN2R", "IN3R" | 868 | "IN1R", "IN2R", "IN3R" |
873 | }; | 869 | }; |
@@ -884,6 +880,13 @@ static SOC_ENUM_SINGLE_DECL(rin_inv_enum, WM8904_ANALOGUE_RIGHT_INPUT_1, 4, | |||
884 | static const struct snd_kcontrol_new rin_inv_mux = | 880 | static const struct snd_kcontrol_new rin_inv_mux = |
885 | SOC_DAPM_ENUM("Right Capture Inverting Mux", rin_inv_enum); | 881 | SOC_DAPM_ENUM("Right Capture Inverting Mux", rin_inv_enum); |
886 | 882 | ||
883 | static SOC_ENUM_SINGLE_DECL(rin_mode_enum, | ||
884 | WM8904_ANALOGUE_RIGHT_INPUT_1, 0, | ||
885 | input_mode_text); | ||
886 | |||
887 | static const struct snd_kcontrol_new rin_mode = | ||
888 | SOC_DAPM_ENUM("Right Capture Mode", rin_mode_enum); | ||
889 | |||
887 | static const char *aif_text[] = { | 890 | static const char *aif_text[] = { |
888 | "Left", "Right" | 891 | "Left", "Right" |
889 | }; | 892 | }; |
@@ -932,9 +935,11 @@ SND_SOC_DAPM_SUPPLY("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0), | |||
932 | SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux), | 935 | SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux), |
933 | SND_SOC_DAPM_MUX("Left Capture Inverting Mux", SND_SOC_NOPM, 0, 0, | 936 | SND_SOC_DAPM_MUX("Left Capture Inverting Mux", SND_SOC_NOPM, 0, 0, |
934 | &lin_inv_mux), | 937 | &lin_inv_mux), |
938 | SND_SOC_DAPM_MUX("Left Capture Mode", SND_SOC_NOPM, 0, 0, &lin_mode), | ||
935 | SND_SOC_DAPM_MUX("Right Capture Mux", SND_SOC_NOPM, 0, 0, &rin_mux), | 939 | SND_SOC_DAPM_MUX("Right Capture Mux", SND_SOC_NOPM, 0, 0, &rin_mux), |
936 | SND_SOC_DAPM_MUX("Right Capture Inverting Mux", SND_SOC_NOPM, 0, 0, | 940 | SND_SOC_DAPM_MUX("Right Capture Inverting Mux", SND_SOC_NOPM, 0, 0, |
937 | &rin_inv_mux), | 941 | &rin_inv_mux), |
942 | SND_SOC_DAPM_MUX("Right Capture Mode", SND_SOC_NOPM, 0, 0, &rin_mode), | ||
938 | 943 | ||
939 | SND_SOC_DAPM_PGA("Left Capture PGA", WM8904_POWER_MANAGEMENT_0, 1, 0, | 944 | SND_SOC_DAPM_PGA("Left Capture PGA", WM8904_POWER_MANAGEMENT_0, 1, 0, |
940 | NULL, 0), | 945 | NULL, 0), |
@@ -1057,6 +1062,12 @@ static const struct snd_soc_dapm_route adc_intercon[] = { | |||
1057 | { "Left Capture Inverting Mux", "IN2L", "IN2L" }, | 1062 | { "Left Capture Inverting Mux", "IN2L", "IN2L" }, |
1058 | { "Left Capture Inverting Mux", "IN3L", "IN3L" }, | 1063 | { "Left Capture Inverting Mux", "IN3L", "IN3L" }, |
1059 | 1064 | ||
1065 | { "Left Capture Mode", "Single-Ended", "Left Capture Inverting Mux" }, | ||
1066 | { "Left Capture Mode", "Differential Line", "Left Capture Mux" }, | ||
1067 | { "Left Capture Mode", "Differential Line", "Left Capture Inverting Mux" }, | ||
1068 | { "Left Capture Mode", "Differential Mic", "Left Capture Mux" }, | ||
1069 | { "Left Capture Mode", "Differential Mic", "Left Capture Inverting Mux" }, | ||
1070 | |||
1060 | { "Right Capture Mux", "IN1R", "IN1R" }, | 1071 | { "Right Capture Mux", "IN1R", "IN1R" }, |
1061 | { "Right Capture Mux", "IN2R", "IN2R" }, | 1072 | { "Right Capture Mux", "IN2R", "IN2R" }, |
1062 | { "Right Capture Mux", "IN3R", "IN3R" }, | 1073 | { "Right Capture Mux", "IN3R", "IN3R" }, |
@@ -1065,11 +1076,14 @@ static const struct snd_soc_dapm_route adc_intercon[] = { | |||
1065 | { "Right Capture Inverting Mux", "IN2R", "IN2R" }, | 1076 | { "Right Capture Inverting Mux", "IN2R", "IN2R" }, |
1066 | { "Right Capture Inverting Mux", "IN3R", "IN3R" }, | 1077 | { "Right Capture Inverting Mux", "IN3R", "IN3R" }, |
1067 | 1078 | ||
1068 | { "Left Capture PGA", NULL, "Left Capture Mux" }, | 1079 | { "Right Capture Mode", "Single-Ended", "Right Capture Inverting Mux" }, |
1069 | { "Left Capture PGA", NULL, "Left Capture Inverting Mux" }, | 1080 | { "Right Capture Mode", "Differential Line", "Right Capture Mux" }, |
1081 | { "Right Capture Mode", "Differential Line", "Right Capture Inverting Mux" }, | ||
1082 | { "Right Capture Mode", "Differential Mic", "Right Capture Mux" }, | ||
1083 | { "Right Capture Mode", "Differential Mic", "Right Capture Inverting Mux" }, | ||
1070 | 1084 | ||
1071 | { "Right Capture PGA", NULL, "Right Capture Mux" }, | 1085 | { "Left Capture PGA", NULL, "Left Capture Mode" }, |
1072 | { "Right Capture PGA", NULL, "Right Capture Inverting Mux" }, | 1086 | { "Right Capture PGA", NULL, "Right Capture Mode" }, |
1073 | 1087 | ||
1074 | { "AIFOUTL Mux", "Left", "ADCL" }, | 1088 | { "AIFOUTL Mux", "Left", "ADCL" }, |
1075 | { "AIFOUTL Mux", "Right", "ADCR" }, | 1089 | { "AIFOUTL Mux", "Right", "ADCR" }, |