From f3bd4dde9f048fa711e98626c8c3bc4d1eae3436 Mon Sep 17 00:00:00 2001 From: David Ward Date: Sun, 18 Apr 2021 09:46:56 -0400 Subject: [PATCH] ASoC: rt298: Configure combo jack for headphones During jack detection, the combo jack is configured for a CTIA headset, and then for an OMTP headset, while sensing the mic connection. If a mic is not found in either case, the combo jack should be re-configured for headphones only. This is consistent with the HDA driver behavior. Signed-off-by: David Ward Reviewed-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20210418134658.4333-4-david.ward@gatech.edu Signed-off-by: Mark Brown --- sound/soc/codecs/rt298.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/rt298.c b/sound/soc/codecs/rt298.c index 32cc9b6287d2..c592c40a7ab3 100644 --- a/sound/soc/codecs/rt298.c +++ b/sound/soc/codecs/rt298.c @@ -267,11 +267,16 @@ static int rt298_jack_detect(struct rt298_priv *rt298, bool *hp, bool *mic) msleep(300); regmap_read(rt298->regmap, RT298_CBJ_CTRL2, &val); - if (0x0070 == (val & 0x0070)) + if (0x0070 == (val & 0x0070)) { *mic = true; - else + } else { *mic = false; + regmap_update_bits(rt298->regmap, + RT298_CBJ_CTRL1, + 0xfcc0, 0xc400); + } } + regmap_update_bits(rt298->regmap, RT298_DC_GAIN, 0x200, 0x0); -- 2.11.0