Skip to content

Commit 8b27137

Browse files
Matthias Kaehlckebroonie
authored andcommitted
ASoC: rt5682: Disable jack detection interrupt during suspend
The rt5682 driver switches its regmap to cache-only when the device suspends and back to regular mode on resume. When the jack detect interrupt fires rt5682_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: [ 56.245502] rt5682 9-001a: ASoC: error at soc_component_read_no_lock on rt5682.9-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. This is essentially the same as commit f7d00a9 ("SoC: rt5682s: Disable jack detection interrupt during suspend") for the rt5682s. Cc: [email protected] Signed-off-by: Matthias Kaehlcke <[email protected] Reviewed-by: Douglas Anderson <[email protected] Reviewed-by: Stephen Boyd <[email protected] Link: https://lore.kernel.org/r/20230516164629.1.Ibf79e94b3442eecc0054d2b478779cc512d967fc@changeid Signed-off-by: Mark Brown <[email protected]
1 parent 75e5fab commit 8b27137

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

sound/soc/codecs/rt5682-i2c.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,9 @@ static int rt5682_i2c_probe(struct i2c_client *i2c)
267267
ret = devm_request_threaded_irq(&i2c->dev, i2c->irq, NULL,
268268
rt5682_irq, IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING
269269
| IRQF_ONESHOT, "rt5682", rt5682);
270-
if (ret)
270+
if (!ret)
271+
rt5682->irq = i2c->irq;
272+
else
271273
dev_err(&i2c->dev, "Failed to reguest IRQ: %d\n", ret);
272274
}
273275

sound/soc/codecs/rt5682.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2959,6 +2959,9 @@ static int rt5682_suspend(struct snd_soc_component *component)
29592959
if (rt5682->is_sdw)
29602960
return 0;
29612961

2962+
if (rt5682->irq)
2963+
disable_irq(rt5682->irq);
2964+
29622965
cancel_delayed_work_sync(&rt5682->jack_detect_work);
29632966
cancel_delayed_work_sync(&rt5682->jd_check_work);
29642967
if (rt5682->hs_jack && (rt5682->jack_type & SND_JACK_HEADSET) == SND_JACK_HEADSET) {
@@ -3027,6 +3030,9 @@ static int rt5682_resume(struct snd_soc_component *component)
30273030
mod_delayed_work(system_power_efficient_wq,
30283031
&rt5682->jack_detect_work, msecs_to_jiffies(0));
30293032

3033+
if (rt5682->irq)
3034+
enable_irq(rt5682->irq);
3035+
30303036
return 0;
30313037
}
30323038
#else

sound/soc/codecs/rt5682.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,7 @@ struct rt5682_priv {
14621462
int pll_out[RT5682_PLLS];
14631463

14641464
int jack_type;
1465+
int irq;
14651466
int irq_work_delay_time;
14661467
};
14671468

0 commit comments

Comments
 (0)