Skip to content

Commit a2ebd58

Browse files
Peter Ujfalusibroonie
authored andcommitted
ASoC: ak4642: Implement suspend callback
Add the suspend callback to accompany the existing resume operation. With the suspend/resume callbacks the regmap (regcache) state handling can follow the recommended sequence. Signed-off-by: Peter Ujfalusi <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent 1a695a9 commit a2ebd58

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sound/soc/codecs/ak4642.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,15 +523,23 @@ static struct snd_soc_dai_driver ak4642_dai = {
523523
.symmetric_rates = 1,
524524
};
525525

526-
static int ak4642_resume(struct snd_soc_codec *codec)
526+
static int ak4642_suspend(struct snd_soc_codec *codec)
527527
{
528528
struct regmap *regmap = dev_get_regmap(codec->dev, NULL);
529529

530+
regcache_cache_only(regmap, true);
530531
regcache_mark_dirty(regmap);
531-
regcache_sync(regmap);
532532
return 0;
533533
}
534534

535+
static int ak4642_resume(struct snd_soc_codec *codec)
536+
{
537+
struct regmap *regmap = dev_get_regmap(codec->dev, NULL);
538+
539+
regcache_cache_only(regmap, false);
540+
regcache_sync(regmap);
541+
return 0;
542+
}
535543
static int ak4642_probe(struct snd_soc_codec *codec)
536544
{
537545
struct ak4642_priv *priv = snd_soc_codec_get_drvdata(codec);
@@ -544,6 +552,7 @@ static int ak4642_probe(struct snd_soc_codec *codec)
544552

545553
static struct snd_soc_codec_driver soc_codec_dev_ak4642 = {
546554
.probe = ak4642_probe,
555+
.suspend = ak4642_suspend,
547556
.resume = ak4642_resume,
548557
.set_bias_level = ak4642_set_bias_level,
549558
.controls = ak4642_snd_controls,

0 commit comments

Comments
 (0)