Skip to content

Commit f7d00a9

Browse files
Matthias Kaehlckebroonie
authored andcommitted
SoC: rt5682s: Disable jack detection interrupt during suspend
The rt5682s driver switches its regmap to cache-only when the device suspends and back to regular mode on resume. When the jack detect interrupt fires rt5682s_irq() schedules the jack detect work. This can result in invalid reads from the regmap in cache-only mode if the work runs before the device has resumed: [ 19.672162] rt5682s 2-001a: ASoC: error at soc_component_read_no_lock on rt5682s.2-001a for register: [0x000000f0] -16 Disable the jack detection interrupt during suspend and re-enable it on resume. The driver already schedules the jack detection work on resume, so any state change during suspend is still handled. Signed-off-by: Matthias Kaehlcke <[email protected]> Link: https://lore.kernel.org/r/20230209012002.1.Ib4d6481f1d38a6e7b8c9e04913c02ca88c216cf6@changeid Signed-off-by: Mark Brown <[email protected]>
1 parent d227116 commit f7d00a9

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

sound/soc/codecs/rt5682s.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2895,6 +2895,9 @@ static int rt5682s_suspend(struct snd_soc_component *component)
28952895
{
28962896
struct rt5682s_priv *rt5682s = snd_soc_component_get_drvdata(component);
28972897

2898+
if (rt5682s->irq)
2899+
disable_irq(rt5682s->irq);
2900+
28982901
cancel_delayed_work_sync(&rt5682s->jack_detect_work);
28992902
cancel_delayed_work_sync(&rt5682s->jd_check_work);
29002903

@@ -2919,6 +2922,9 @@ static int rt5682s_resume(struct snd_soc_component *component)
29192922
&rt5682s->jack_detect_work, msecs_to_jiffies(0));
29202923
}
29212924

2925+
if (rt5682s->irq)
2926+
enable_irq(rt5682s->irq);
2927+
29222928
return 0;
29232929
}
29242930
#else
@@ -3259,7 +3265,9 @@ static int rt5682s_i2c_probe(struct i2c_client *i2c)
32593265
ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL, rt5682s_irq,
32603266
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
32613267
"rt5682s", rt5682s);
3262-
if (ret)
3268+
if (!ret)
3269+
rt5682s->irq = i2c->irq;
3270+
else
32633271
dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret);
32643272
}
32653273

sound/soc/codecs/rt5682s.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,6 +1472,7 @@ struct rt5682s_priv {
14721472
int pll_comb;
14731473

14741474
int jack_type;
1475+
unsigned int irq;
14751476
int irq_work_delay_time;
14761477
int wclk_enabled;
14771478
};

0 commit comments

Comments
 (0)