[alsa-devel] [RFC PATCH 23/34] ASoC: sun8i-codec: Clean up DAC widgets
Samuel Holland
samuel at sholland.org
Mon Feb 17 07:42:39 CET 2020
Again, rename the widgets and controls to match their actual function
(and disambiguate the mixers), then sort the widgets and routes in a
topological sink<-source ordering.
Signed-off-by: Samuel Holland <samuel at sholland.org>
---
sound/soc/sunxi/sun8i-codec.c | 61 ++++++++++++++++++-----------------
1 file changed, 32 insertions(+), 29 deletions(-)
diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c
index 6f589e93850a..5dfaf656b5b1 100644
--- a/sound/soc/sunxi/sun8i-codec.c
+++ b/sound/soc/sunxi/sun8i-codec.c
@@ -384,23 +384,6 @@ static int sun8i_codec_hw_params(struct snd_pcm_substream *substream,
return 0;
}
-static const struct snd_kcontrol_new sun8i_dac_mixer_controls[] = {
- SOC_DAPM_DOUBLE("AIF1 Slot 0 Digital DAC Playback Switch",
- SUN8I_DAC_MXR_SRC,
- SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF1DA0L,
- SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF1DA0R, 1, 0),
- SOC_DAPM_DOUBLE("AIF1 Slot 1 Digital DAC Playback Switch",
- SUN8I_DAC_MXR_SRC,
- SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF1DA1L,
- SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF1DA1R, 1, 0),
- SOC_DAPM_DOUBLE("AIF2 Digital DAC Playback Switch", SUN8I_DAC_MXR_SRC,
- SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF2DACL,
- SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF2DACR, 1, 0),
- SOC_DAPM_DOUBLE("ADC Digital DAC Playback Switch", SUN8I_DAC_MXR_SRC,
- SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_ADCL,
- SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_ADCR, 1, 0),
-};
-
static const struct snd_kcontrol_new sun8i_aif1_ad0_mixer_controls[] = {
SOC_DAPM_DOUBLE("AIF1 AD0 Mixer AIF1 DA0 Capture Switch",
SUN8I_AIF1_MXR_SRC,
@@ -420,6 +403,25 @@ static const struct snd_kcontrol_new sun8i_aif1_ad0_mixer_controls[] = {
SUN8I_AIF1_MXR_SRC_AD0R_MXR_SRC_AIF2DACL, 1, 0),
};
+static const struct snd_kcontrol_new sun8i_dac_mixer_controls[] = {
+ SOC_DAPM_DOUBLE("DAC Mixer AIF1 DA0 Playback Switch",
+ SUN8I_DAC_MXR_SRC,
+ SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF1DA0L,
+ SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF1DA0R, 1, 0),
+ SOC_DAPM_DOUBLE("DAC Mixer AIF1 DA1 Playback Switch",
+ SUN8I_DAC_MXR_SRC,
+ SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF1DA1L,
+ SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF1DA1R, 1, 0),
+ SOC_DAPM_DOUBLE("DAC Mixer AIF2 DAC Playback Switch",
+ SUN8I_DAC_MXR_SRC,
+ SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_AIF2DACL,
+ SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_AIF2DACR, 1, 0),
+ SOC_DAPM_DOUBLE("DAC Mixer ADC Playback Switch",
+ SUN8I_DAC_MXR_SRC,
+ SUN8I_DAC_MXR_SRC_DACL_MXR_SRC_ADCL,
+ SUN8I_DAC_MXR_SRC_DACR_MXR_SRC_ADCR, 1, 0),
+};
+
static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
/* AIF "ADC" Outputs */
SND_SOC_DAPM_AIF_OUT("AIF1 AD0 Left", "Capture", 0,
@@ -450,10 +452,10 @@ static const struct snd_soc_dapm_widget sun8i_codec_dapm_widgets[] = {
SND_SOC_DAPM_SUPPLY("DAC", SUN8I_DAC_DIG_CTRL,
SUN8I_DAC_DIG_CTRL_ENDA, 0, NULL, 0),
- /* DAC and ADC Mixers */
- SOC_MIXER_ARRAY("Left Digital DAC Mixer", SND_SOC_NOPM, 0, 0,
+ /* Main DAC Mixers */
+ SOC_MIXER_ARRAY("DAC Left Mixer", SND_SOC_NOPM, 0, 0,
sun8i_dac_mixer_controls),
- SOC_MIXER_ARRAY("Right Digital DAC Mixer", SND_SOC_NOPM, 0, 0,
+ SOC_MIXER_ARRAY("DAC Right Mixer", SND_SOC_NOPM, 0, 0,
sun8i_dac_mixer_controls),
/* Main ADC Inputs (connected to analog codec DAPM context) */
@@ -505,20 +507,21 @@ static const struct snd_soc_dapm_route sun8i_codec_dapm_routes[] = {
{ "AIF1 DA0 Left", NULL, "AIF1CLK" },
{ "AIF1 DA0 Right", NULL, "AIF1CLK" },
- /* DAC Routes */
- { "DAC Left", NULL, "Left Digital DAC Mixer" },
- { "DAC Right", NULL, "Right Digital DAC Mixer" },
+ /* Main DAC Output Routes */
+ { "DAC Left", NULL, "DAC Left Mixer" },
+ { "DAC Right", NULL, "DAC Right Mixer" },
{ "DAC Left", NULL, "DAC" },
{ "DAC Right", NULL, "DAC" },
- /* DAC Mixer Routes */
- { "Left Digital DAC Mixer", "AIF1 Slot 0 Digital DAC Playback Switch",
- "AIF1 DA0 Left"},
- { "Right Digital DAC Mixer", "AIF1 Slot 0 Digital DAC Playback Switch",
- "AIF1 DA0 Right"},
+ /* Main DAC Mixer Routes */
+ { "DAC Left Mixer", "DAC Mixer AIF1 DA0 Playback Switch", "AIF1 DA0 Left" },
+ { "DAC Left Mixer", "DAC Mixer ADC Playback Switch", "ADC Left" },
+
+ { "DAC Right Mixer", "DAC Mixer AIF1 DA0 Playback Switch", "AIF1 DA0 Right" },
+ { "DAC Right Mixer", "DAC Mixer ADC Playback Switch", "ADC Right" },
- /* ADC Routes */
+ /* Main ADC Input Routes */
{ "ADC Left", NULL, "ADC" },
{ "ADC Right", NULL, "ADC" },
--
2.24.1
More information about the Alsa-devel
mailing list