Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 9e179592 authored by Hans de Goede's avatar Hans de Goede Committed by Mark Brown
Browse files

ASoC: rt5651: Only configure OVCD once at set_jack time



Only configure OVCD once at set_jack time, rather then configuring
it on every jack-insertion event and switch to using bit field defines
instead of hardcoding a magic value.

Tested-by: default avatarCarlo Caione <carlo@endlessm.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1310e737
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -1637,7 +1637,15 @@ static int rt5651_set_jack(struct snd_soc_component *component,
	snd_soc_component_update_bits(component, RT5651_PWR_ANLG2,
		RT5651_PWR_JD_M, RT5651_PWR_JD_M);

	snd_soc_component_update_bits(component, RT5651_MICBIAS, 0x38, 0x38);
	snd_soc_component_update_bits(component, RT5651_MICBIAS,
				      RT5651_MIC1_OVCD_MASK |
				      RT5651_MIC1_OVTH_MASK |
				      RT5651_PWR_CLK12M_MASK |
				      RT5651_PWR_MB_MASK,
				      RT5651_MIC1_OVCD_DIS |
				      RT5651_MIC1_OVTH_600UA |
				      RT5651_PWR_MB_PU |
				      RT5651_PWR_CLK12M_PU);

	rt5651->hp_jack = hp_jack;

@@ -1842,14 +1850,8 @@ static int rt5651_jack_detect(struct snd_soc_component *component, int jack_inse
	if (jack_insert) {
		rt5651_enable_micbias1_for_ovcd(component);
		snd_soc_component_update_bits(component, RT5651_MICBIAS,
				    RT5651_MIC1_OVCD_MASK |
				    RT5651_MIC1_OVTH_MASK |
				    RT5651_PWR_CLK12M_MASK |
				    RT5651_PWR_MB_MASK,
				    RT5651_MIC1_OVCD_EN |
				    RT5651_MIC1_OVTH_600UA |
				    RT5651_PWR_MB_PU |
				    RT5651_PWR_CLK12M_PU);
				    RT5651_MIC1_OVCD_MASK,
				    RT5651_MIC1_OVCD_EN);
		msleep(100);
		if (snd_soc_component_read32(component, RT5651_IRQ_CTRL2) & RT5651_MB1_OC_CLR)
			jack_type = SND_JACK_HEADPHONE;