Skip to content

Commit 64353af

Browse files
charleskeepaxbroonie
authored andcommitted
ASoC: cs42l43: Add system suspend ops to disable IRQ
The IRQ should be disabled whilst entering and exiting system suspend to avoid the IRQ handler being called whilst the PM runtime is disabled. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20240206113850.719888-2-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent d172205 commit 64353af

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

sound/soc/codecs/cs42l43.c

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,8 +2336,47 @@ static int cs42l43_codec_runtime_resume(struct device *dev)
23362336
return 0;
23372337
}
23382338

2339-
static DEFINE_RUNTIME_DEV_PM_OPS(cs42l43_codec_pm_ops, NULL,
2340-
cs42l43_codec_runtime_resume, NULL);
2339+
static int cs42l43_codec_suspend(struct device *dev)
2340+
{
2341+
struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
2342+
2343+
disable_irq(cs42l43->irq);
2344+
2345+
return 0;
2346+
}
2347+
2348+
static int cs42l43_codec_suspend_noirq(struct device *dev)
2349+
{
2350+
struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
2351+
2352+
enable_irq(cs42l43->irq);
2353+
2354+
return 0;
2355+
}
2356+
2357+
static int cs42l43_codec_resume(struct device *dev)
2358+
{
2359+
struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
2360+
2361+
enable_irq(cs42l43->irq);
2362+
2363+
return 0;
2364+
}
2365+
2366+
static int cs42l43_codec_resume_noirq(struct device *dev)
2367+
{
2368+
struct cs42l43 *cs42l43 = dev_get_drvdata(dev);
2369+
2370+
disable_irq(cs42l43->irq);
2371+
2372+
return 0;
2373+
}
2374+
2375+
static const struct dev_pm_ops cs42l43_codec_pm_ops = {
2376+
SYSTEM_SLEEP_PM_OPS(cs42l43_codec_suspend, cs42l43_codec_resume)
2377+
NOIRQ_SYSTEM_SLEEP_PM_OPS(cs42l43_codec_suspend_noirq, cs42l43_codec_resume_noirq)
2378+
RUNTIME_PM_OPS(NULL, cs42l43_codec_runtime_resume, NULL)
2379+
};
23412380

23422381
static const struct platform_device_id cs42l43_codec_id_table[] = {
23432382
{ "cs42l43-codec", },

0 commit comments

Comments
 (0)