Skip to content

Commit 68f97fe

Browse files
Jack Yubroonie
authored andcommitted
ASoC: rt5645: fix issue of random interrupt from push-button
Modify register setting sequence of enabling inline command to fix issue of random interrupt from push-button. Signed-off-by: Jack Yu <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 63b47f0 commit 68f97fe

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

sound/soc/codecs/rt5645.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ static const struct reg_sequence init_list[] = {
8181
static const struct reg_sequence rt5650_init_list[] = {
8282
{0xf6, 0x0100},
8383
{RT5645_PWR_ANLG1, 0x02},
84-
{RT5645_IL_CMD3, 0x0018},
84+
{RT5645_IL_CMD3, 0x6728},
8585
};
8686

8787
static const struct reg_default rt5645_reg[] = {
@@ -3130,20 +3130,32 @@ static void rt5645_enable_push_button_irq(struct snd_soc_component *component,
31303130
bool enable)
31313131
{
31323132
struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
3133+
int ret;
31333134

31343135
if (enable) {
31353136
snd_soc_dapm_force_enable_pin(dapm, "ADC L power");
31363137
snd_soc_dapm_force_enable_pin(dapm, "ADC R power");
31373138
snd_soc_dapm_sync(dapm);
31383139

3140+
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2,
3141+
RT5645_EN_4BTN_IL_MASK | RT5645_RST_4BTN_IL_MASK,
3142+
RT5645_EN_4BTN_IL_EN | RT5645_RST_4BTN_IL_RST);
3143+
usleep_range(10000, 15000);
3144+
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2,
3145+
RT5645_EN_4BTN_IL_MASK | RT5645_RST_4BTN_IL_MASK,
3146+
RT5645_EN_4BTN_IL_EN | RT5645_RST_4BTN_IL_NORM);
3147+
msleep(50);
3148+
ret = snd_soc_component_read(component, RT5645_INT_IRQ_ST);
3149+
pr_debug("%s read %x = %x\n", __func__, RT5645_INT_IRQ_ST,
3150+
snd_soc_component_read(component, RT5645_INT_IRQ_ST));
3151+
snd_soc_component_write(component, RT5645_INT_IRQ_ST, ret);
3152+
ret = snd_soc_component_read(component, RT5650_4BTN_IL_CMD1);
3153+
pr_debug("%s read %x = %x\n", __func__, RT5650_4BTN_IL_CMD1,
3154+
snd_soc_component_read(component, RT5650_4BTN_IL_CMD1));
3155+
snd_soc_component_write(component, RT5650_4BTN_IL_CMD1, ret);
31393156
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD1, 0x3, 0x3);
31403157
snd_soc_component_update_bits(component,
31413158
RT5645_INT_IRQ_ST, 0x8, 0x8);
3142-
snd_soc_component_update_bits(component,
3143-
RT5650_4BTN_IL_CMD2, 0x8000, 0x8000);
3144-
snd_soc_component_read(component, RT5650_4BTN_IL_CMD1);
3145-
pr_debug("%s read %x = %x\n", __func__, RT5650_4BTN_IL_CMD1,
3146-
snd_soc_component_read(component, RT5650_4BTN_IL_CMD1));
31473159
} else {
31483160
snd_soc_component_update_bits(component, RT5650_4BTN_IL_CMD2, 0x8000, 0x0);
31493161
snd_soc_component_update_bits(component, RT5645_INT_IRQ_ST, 0x8, 0x0);

sound/soc/codecs/rt5645.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,6 +2011,12 @@
20112011
#define RT5645_ZCD_HP_DIS (0x0 << 15)
20122012
#define RT5645_ZCD_HP_EN (0x1 << 15)
20132013

2014+
/* Buttons Inline Command Function 2 (0xe0) */
2015+
#define RT5645_EN_4BTN_IL_MASK (0x1 << 15)
2016+
#define RT5645_EN_4BTN_IL_EN (0x1 << 15)
2017+
#define RT5645_RST_4BTN_IL_MASK (0x1 << 14)
2018+
#define RT5645_RST_4BTN_IL_RST (0x0 << 14)
2019+
#define RT5645_RST_4BTN_IL_NORM (0x1 << 14)
20142020

20152021
/* Codec Private Register definition */
20162022
/* DAC ADC Digital Volume (0x00) */

0 commit comments

Comments
 (0)