]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: rt5651: Enable LDO and micbias1 supplies for jack-type detection
authorHans de Goede <hdegoede@redhat.com>
Sun, 25 Feb 2018 10:46:55 +0000 (11:46 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 1 Mar 2018 19:15:36 +0000 (19:15 +0000)
commit1f854dce5a4e66aa39376d08a07217b5dfa95dee
tree6eae23526b80a37fa74aa54eee6e87fbefe9705b
parent7539645970547ba50cc8e2ad5cfc51a1720f85e4
ASoC: rt5651: Enable LDO and micbias1 supplies for jack-type detection

To determine if a plugged in jack is a headset (speakers + mic) or
headphones (mic contact shorted to ground) we use the micbias1 OVer Current
Detect (OVCD) functionality.

For this to work we need to have a micbias current to actually cause an
overcurrent condition when headphones are plugged in, so jack-type
detection requires both the LDO and micbias1 supplies to be on.

Before this commit there were 2 issues with the handling of this:
1) The LDO supply was force-enabled twice and never disabled again even
though it only needs to be forced on when doing jack-type detection
2) micbias1 was not force-enabled, and thus may be off when doing jack-type
detection

This commit fixes both by force-enabling the LDO and micbias1 supplies
before checking for an overcurrent condition and disabling them afterwards.

Note that both supplies will still get turned on normally (and OVCD will
protect against overcurrent) when the micbias1 is enabled normally because
the user has activated a sound stream recording from the mic.

Tested-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt5651.c