ASoC: sun50i-codec-analog: Enable DAPM for line out switch

By including the line out mute switch in the DAPM graph, the
Mixer/DAC inputs can be powered off when the line output is muted.

The line outputs have an unusual routing scheme. The left side mute
switch is between the source selection and the amplifier, as usual.
The right side source selection comes *after* its amplifier (and
after the left side amplifier), and its mute switch controls
whichever source is currently selected. This matches the diagram in
the SoC manual.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Link: https://lore.kernel.org/r/20200726025334.59931-8-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Samuel Holland 2020-07-25 21:53:33 -05:00 committed by Mark Brown
parent dd8286a349
commit 95d34762f2
No known key found for this signature in database
GPG key ID: 24D68B725D5487D0

View file

@ -228,11 +228,6 @@ static const struct snd_kcontrol_new sun50i_a64_codec_controls[] = {
SUN50I_ADDA_LINEOUT_CTRL1_VOL, 0x1f, 0, SUN50I_ADDA_LINEOUT_CTRL1_VOL, 0x1f, 0,
sun50i_codec_lineout_vol_scale), sun50i_codec_lineout_vol_scale),
SOC_DOUBLE("Line Out Playback Switch",
SUN50I_ADDA_LINEOUT_CTRL0,
SUN50I_ADDA_LINEOUT_CTRL0_LEN,
SUN50I_ADDA_LINEOUT_CTRL0_REN, 1, 0),
SOC_SINGLE_TLV("Earpiece Playback Volume", SOC_SINGLE_TLV("Earpiece Playback Volume",
SUN50I_ADDA_EARPIECE_CTRL1, SUN50I_ADDA_EARPIECE_CTRL1,
SUN50I_ADDA_EARPIECE_CTRL1_ESP_VOL, 0x1f, 0, SUN50I_ADDA_EARPIECE_CTRL1_ESP_VOL, 0x1f, 0,
@ -280,6 +275,12 @@ static const struct snd_kcontrol_new sun50i_codec_lineout_src[] = {
sun50i_codec_lineout_src_enum), sun50i_codec_lineout_src_enum),
}; };
static const struct snd_kcontrol_new sun50i_codec_lineout_switch =
SOC_DAPM_DOUBLE("Line Out Playback Switch",
SUN50I_ADDA_LINEOUT_CTRL0,
SUN50I_ADDA_LINEOUT_CTRL0_LEN,
SUN50I_ADDA_LINEOUT_CTRL0_REN, 1, 0);
static const char * const sun50i_codec_earpiece_src_enum_text[] = { static const char * const sun50i_codec_earpiece_src_enum_text[] = {
"DACR", "DACL", "Right Mixer", "Left Mixer", "DACR", "DACL", "Right Mixer", "Left Mixer",
}; };
@ -332,6 +333,10 @@ static const struct snd_soc_dapm_widget sun50i_a64_codec_widgets[] = {
SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src), SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src),
SND_SOC_DAPM_MUX("Right Line Out Source", SND_SOC_DAPM_MUX("Right Line Out Source",
SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src), SND_SOC_NOPM, 0, 0, sun50i_codec_lineout_src),
SND_SOC_DAPM_SWITCH("Left Line Out Switch",
SND_SOC_NOPM, 0, 0, &sun50i_codec_lineout_switch),
SND_SOC_DAPM_SWITCH("Right Line Out Switch",
SND_SOC_NOPM, 0, 0, &sun50i_codec_lineout_switch),
SND_SOC_DAPM_OUTPUT("LINEOUT"), SND_SOC_DAPM_OUTPUT("LINEOUT"),
SND_SOC_DAPM_MUX("Earpiece Source Playback Route", SND_SOC_DAPM_MUX("Earpiece Source Playback Route",
@ -444,10 +449,12 @@ static const struct snd_soc_dapm_route sun50i_a64_codec_routes[] = {
{ "Left Line Out Source", "Stereo", "Left Mixer" }, { "Left Line Out Source", "Stereo", "Left Mixer" },
{ "Left Line Out Source", "Mono Differential", "Left Mixer" }, { "Left Line Out Source", "Mono Differential", "Left Mixer" },
{ "Left Line Out Source", "Mono Differential", "Right Mixer" }, { "Left Line Out Source", "Mono Differential", "Right Mixer" },
{ "LINEOUT", NULL, "Left Line Out Source" }, { "Left Line Out Switch", "Line Out Playback Switch", "Left Line Out Source" },
{ "LINEOUT", NULL, "Left Line Out Switch" },
{ "Right Line Out Source", "Stereo", "Right Mixer" }, { "Right Line Out Switch", "Line Out Playback Switch", "Right Mixer" },
{ "Right Line Out Source", "Mono Differential", "Left Line Out Source" }, { "Right Line Out Source", "Stereo", "Right Line Out Switch" },
{ "Right Line Out Source", "Mono Differential", "Left Line Out Switch" },
{ "LINEOUT", NULL, "Right Line Out Source" }, { "LINEOUT", NULL, "Right Line Out Source" },
/* Earpiece Routes */ /* Earpiece Routes */