Skip to content

Commit

Permalink
ASoC: cs42l43: Add system suspend ops to disable IRQ
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Charles Keepax authored and Mark Brown committed Feb 7, 2024
1 parent d172205 commit 64353af
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions sound/soc/codecs/cs42l43.c
Original file line number Diff line number Diff line change
Expand Up @@ -2336,8 +2336,47 @@ static int cs42l43_codec_runtime_resume(struct device *dev)
return 0;
}

static DEFINE_RUNTIME_DEV_PM_OPS(cs42l43_codec_pm_ops, NULL,
cs42l43_codec_runtime_resume, NULL);
static int cs42l43_codec_suspend(struct device *dev)
{
struct cs42l43 *cs42l43 = dev_get_drvdata(dev);

disable_irq(cs42l43->irq);

return 0;
}

static int cs42l43_codec_suspend_noirq(struct device *dev)
{
struct cs42l43 *cs42l43 = dev_get_drvdata(dev);

enable_irq(cs42l43->irq);

return 0;
}

static int cs42l43_codec_resume(struct device *dev)
{
struct cs42l43 *cs42l43 = dev_get_drvdata(dev);

enable_irq(cs42l43->irq);

return 0;
}

static int cs42l43_codec_resume_noirq(struct device *dev)
{
struct cs42l43 *cs42l43 = dev_get_drvdata(dev);

disable_irq(cs42l43->irq);

return 0;
}

static const struct dev_pm_ops cs42l43_codec_pm_ops = {
SYSTEM_SLEEP_PM_OPS(cs42l43_codec_suspend, cs42l43_codec_resume)
NOIRQ_SYSTEM_SLEEP_PM_OPS(cs42l43_codec_suspend_noirq, cs42l43_codec_resume_noirq)
RUNTIME_PM_OPS(NULL, cs42l43_codec_runtime_resume, NULL)
};

static const struct platform_device_id cs42l43_codec_id_table[] = {
{ "cs42l43-codec", },
Expand Down

0 comments on commit 64353af

Please sign in to comment.