On Tue, Feb 20, 2018 at 11:15:03PM +0100, Hans de Goede wrote:
Overcurrent detection (ovcd) requires the following to be on:
- The LDO supply
- The micbias1 supply
- General analog voltages such as vref aka a bias_level of standby
Before this commit deps 2. and 3. were not met (unless a stream recording from the mic was active).
What does the overcurrent detection detect overcurrent on?
- Is not met because rt5651_set_bias_level() was only enabling this when
reaching a bias level of prepared instead of doing this in the normal standby bias level, which the dapm core will select as soon as any pins / supplies are on. This commit fixes by making rt5651_set_bias_level() behave as a normal set_bias function for other codecs and already enabling these things at standby level.
...
- is fixed by simply force-enabling "micbias1" when doing ovcd, this
commit also adds code to turn both the micbias1 and the LDO supplies of again when we're done, note they will only really get turned off if the ovcd was the only user.
The snd_soc_codec_force_bias_level(BIAS_OFF) call done in rt5651_probe() will now turn off PWR_ANLG1, so the programming of PWR_ANLG1 before the snd_soc_codec_force_bias_level() now is a no-op and can be removed.
This is two or three changes combined into a single commit which makes it harder to review :(
@@ -1811,8 +1795,11 @@ static int rt5651_jack_detect(struct snd_soc_codec *codec, int jack_insert) int jack_type;
if (jack_insert) {
snd_soc_dapm_force_enable_pin(dapm, "LDO");
snd_soc_dapm_sync(dapm);
snd_soc_dapm_mutex_lock(dapm);
snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO");
snd_soc_dapm_force_enable_pin_unlocked(dapm, "micbias1");
snd_soc_dapm_sync_unlocked(dapm);
snd_soc_dapm_mutex_unlock(dapm);
snd_soc_update_bits(codec, RT5651_MICBIAS, RT5651_MIC1_OVCD_MASK |
This is now only enabling the LDO and bias when the jack is inserted - is that enough? The changelog isn't very clear about what is going on here.