Unverified Commit aa18457c authored by Stefan Binding's avatar Stefan Binding Committed by Mark Brown
Browse files

ASoC: cs42l42: Ensure 0dB full scale volume is used for headsets



Ensure the default 0dB playback path is always used.

The code that set FULL_SCALE_VOL based on LOAD_DET_RCSTAT was
spurious, and resulted in a -6dB attenuation being accidentally
inserted into the playback path.

Signed-off-by: default avatarStefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211011144903.28915-1-rf@opensource.cirrus.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent c448b7aa
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -922,7 +922,6 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
	struct snd_soc_component *component = dai->component;
	struct cs42l42_private *cs42l42 = snd_soc_component_get_drvdata(component);
	unsigned int regval;
	u8 fullScaleVol;
	int ret;

	if (mute) {
@@ -993,20 +992,11 @@ static int cs42l42_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
		cs42l42->stream_use |= 1 << stream;

		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
			/* Read the headphone load */
			regval = snd_soc_component_read(component, CS42L42_LOAD_DET_RCSTAT);
			if (((regval & CS42L42_RLA_STAT_MASK) >> CS42L42_RLA_STAT_SHIFT) ==
			    CS42L42_RLA_STAT_15_OHM) {
				fullScaleVol = CS42L42_HP_FULL_SCALE_VOL_MASK;
			} else {
				fullScaleVol = 0;
			}

			/* Un-mute the headphone, set the full scale volume flag */
			/* Un-mute the headphone */
			snd_soc_component_update_bits(component, CS42L42_HP_CTL,
						      CS42L42_HP_ANA_AMUTE_MASK |
						      CS42L42_HP_ANA_BMUTE_MASK |
						      CS42L42_HP_FULL_SCALE_VOL_MASK, fullScaleVol);
						      CS42L42_HP_ANA_BMUTE_MASK,
						      0);
		}
	}