Skip to content

Commit 5fa3bbb

Browse files
shumingfanbroonie
authored andcommitted
ASoC: rt5663: cancel the work when system suspends
This patch makes sure that the workqueue is completed before the system suspends. Signed-off-by: Shuming Fan <shumingf@realtek.com> Link: https://lore.kernel.org/r/20231229092922.853-1-shumingf@realtek.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent b6190c4 commit 5fa3bbb

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

sound/soc/codecs/rt5663.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ struct rt5663_priv {
7474
int pll_out;
7575

7676
int jack_type;
77+
unsigned int irq;
7778
};
7879

7980
static const struct reg_sequence rt5663_patch_list[] = {
@@ -3186,6 +3187,12 @@ static int rt5663_suspend(struct snd_soc_component *component)
31863187
{
31873188
struct rt5663_priv *rt5663 = snd_soc_component_get_drvdata(component);
31883189

3190+
if (rt5663->irq)
3191+
disable_irq(rt5663->irq);
3192+
3193+
cancel_delayed_work_sync(&rt5663->jack_detect_work);
3194+
cancel_delayed_work_sync(&rt5663->jd_unplug_work);
3195+
31893196
regcache_cache_only(rt5663->regmap, true);
31903197
regcache_mark_dirty(rt5663->regmap);
31913198

@@ -3201,6 +3208,9 @@ static int rt5663_resume(struct snd_soc_component *component)
32013208

32023209
rt5663_irq(0, rt5663);
32033210

3211+
if (rt5663->irq)
3212+
enable_irq(rt5663->irq);
3213+
32043214
return 0;
32053215
}
32063216
#else
@@ -3686,6 +3696,7 @@ static int rt5663_i2c_probe(struct i2c_client *i2c)
36863696
__func__, ret);
36873697
goto err_enable;
36883698
}
3699+
rt5663->irq = i2c->irq;
36893700
}
36903701

36913702
ret = devm_snd_soc_register_component(&i2c->dev,

0 commit comments

Comments
 (0)