Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: rt5645: improve the depop sequences of CBJ detection

This patch will improve the depop function of CBJ detection before the headphone playback
when the system resumes.
We also want to complete the CBJ detection in the system-level resume function.
It could avoid triggering the detection at the playing state of headphones.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20230818023732.2153170-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Shuming Fan and committed by
Mark Brown
aa98697c cfee987c

+12 -6
+12 -6
sound/soc/codecs/rt5645.c
··· 80 80 81 81 static const struct reg_sequence rt5650_init_list[] = { 82 82 {0xf6, 0x0100}, 83 + {RT5645_PWR_ANLG1, 0x02}, 83 84 }; 84 85 85 86 static const struct reg_default rt5645_reg[] = { ··· 1697 1696 regmap_write(rt5645->regmap, RT5645_PR_BASE + 1698 1697 RT5645_MAMP_INT_REG2, 0xfc00); 1699 1698 snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140); 1699 + snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, 1700 + RT5645_PWR_HP_L | RT5645_PWR_HP_R, 1701 + RT5645_PWR_HP_L | RT5645_PWR_HP_R); 1700 1702 msleep(90); 1701 1703 } else { 1702 1704 /* depop parameters */ ··· 1747 1743 snd_soc_component_write(component, RT5645_DEPOP_M2, 0x1140); 1748 1744 msleep(100); 1749 1745 snd_soc_component_write(component, RT5645_DEPOP_M1, 0x0001); 1750 - 1746 + snd_soc_component_update_bits(component, RT5645_PWR_ANLG1, 1747 + RT5645_PWR_HP_L | RT5645_PWR_HP_R, 0); 1751 1748 } else { 1752 1749 snd_soc_component_update_bits(component, RT5645_DEPOP_M1, 1753 1750 RT5645_HP_SG_MASK | ··· 3155 3150 unsigned int val; 3156 3151 3157 3152 if (jack_insert) { 3158 - regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0e06); 3153 + regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0206); 3159 3154 3160 3155 /* for jack type detect */ 3161 3156 snd_soc_dapm_force_enable_pin(dapm, "LDO2"); ··· 3200 3195 if (rt5645->pdata.level_trigger_irq) 3201 3196 regmap_update_bits(rt5645->regmap, RT5645_IRQ_CTRL2, 3202 3197 RT5645_JD_1_1_MASK, RT5645_JD_1_1_NOR); 3198 + 3199 + regmap_write(rt5645->regmap, RT5645_CHARGE_PUMP, 0x0e06); 3203 3200 } else { /* jack out */ 3204 3201 rt5645->jack_type = 0; 3205 3202 ··· 4010 4003 4011 4004 regmap_write(rt5645->regmap, RT5645_AD_DA_MIXER, 0x8080); 4012 4005 4013 - ret = regmap_register_patch(rt5645->regmap, init_list, 4006 + ret = regmap_multi_reg_write(rt5645->regmap, init_list, 4014 4007 ARRAY_SIZE(init_list)); 4015 4008 if (ret != 0) 4016 4009 dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); 4017 4010 4018 4011 if (rt5645->codec_type == CODEC_TYPE_RT5650) { 4019 - ret = regmap_register_patch(rt5645->regmap, rt5650_init_list, 4012 + ret = regmap_multi_reg_write(rt5645->regmap, rt5650_init_list, 4020 4013 ARRAY_SIZE(rt5650_init_list)); 4021 4014 if (ret != 0) 4022 4015 dev_warn(&i2c->dev, "Apply rt5650 patch failed: %d\n", ··· 4227 4220 4228 4221 if (rt5645->hp_jack) { 4229 4222 rt5645->jack_type = 0; 4230 - queue_delayed_work(system_power_efficient_wq, 4231 - &rt5645->jack_detect_work, msecs_to_jiffies(0)); 4223 + rt5645_jack_detect_work(&rt5645->jack_detect_work.work); 4232 4224 } 4233 4225 return 0; 4234 4226 }