linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryan Lee <ryans.lee@maximintegrated.com>
To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz,
	tiwai@suse.com, ryans.lee@maximintegrated.com,
	kuninori.morimoto.gx@renesas.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Cc: ryan.lee.maxim@gmail.com
Subject: [PATCH 7/9] ASoC: max98927: Added PM suspend and resume function
Date: Mon, 28 Aug 2017 16:30:59 -0700	[thread overview]
Message-ID: <1503963061-14763-7-git-send-email-ryans.lee@maximintegrated.com> (raw)
In-Reply-To: <1503963061-14763-1-git-send-email-ryans.lee@maximintegrated.com>

Signed-off-by: Ryan Lee <ryans.lee@maximintegrated.com>
---
 sound/soc/codecs/max98927.c | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/max98927.c b/sound/soc/codecs/max98927.c
index 3ab8220..5517251 100644
--- a/sound/soc/codecs/max98927.c
+++ b/sound/soc/codecs/max98927.c
@@ -803,6 +803,31 @@ static int max98927_probe(struct snd_soc_codec *codec)
 	return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int max98927_suspend(struct device *dev)
+{
+	struct max98927_priv *max98927 = dev_get_drvdata(dev);
+
+	regcache_cache_only(max98927->regmap, true);
+	regcache_mark_dirty(max98927->regmap);
+	return 0;
+}
+static int max98927_resume(struct device *dev)
+{
+	struct max98927_priv *max98927 = dev_get_drvdata(dev);
+
+	regmap_write(max98927->regmap,
+		MAX98927_R0100_SOFT_RESET, MAX98927_SOFT_RESET);
+	regcache_cache_only(max98927->regmap, false);
+	regcache_sync(max98927->regmap);
+	return 0;
+}
+#endif
+
+static const struct dev_pm_ops max98927_pm = {
+	SET_SYSTEM_SLEEP_PM_OPS(max98927_suspend, max98927_resume)
+};
+
 static const struct snd_soc_codec_driver soc_codec_dev_max98927 = {
 	.probe = max98927_probe,
 	.component_driver = {
@@ -936,7 +961,7 @@ static int max98927_i2c_remove(struct i2c_client *client)
 		.name = "max98927",
 		.of_match_table = of_match_ptr(max98927_of_match),
 		.acpi_match_table = ACPI_PTR(max98927_acpi_match),
-		.pm = NULL,
+		.pm = &max98927_pm,
 	},
 	.probe  = max98927_i2c_probe,
 	.remove = max98927_i2c_remove,
-- 
1.9.1

  parent reply	other threads:[~2017-08-28 23:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28 23:30 [PATCH 1/9] ASoC: max98927: Added support for DSP_A and DSP_B format Ryan Lee
2017-08-28 23:30 ` [PATCH 2/9] ASoC: max98927: Added controls for Envelope tracking Ryan Lee
2017-08-31 11:43   ` Mark Brown
2017-09-01 21:38     ` Ryan Lee
2017-08-28 23:30 ` [PATCH 3/9] ASoC: max98927: Updated volatile register list Ryan Lee
2017-08-28 23:30 ` [PATCH 4/9] ASoC: max98927: Added missing \n to end of dev_err messages Ryan Lee
2017-08-28 23:30 ` [PATCH 5/9] ASoC: max98927: Removed obsolete variables Ryan Lee
2017-08-31 11:53   ` Mark Brown
2017-09-01 21:38     ` Ryan Lee
2017-08-28 23:30 ` [PATCH 6/9] ASoC: max98927: Modified chip default register values Ryan Lee
2017-08-28 23:30 ` Ryan Lee [this message]
2017-08-28 23:31 ` [PATCH 8/9] ASoC: max98927: Modified DAPM widget and map to enable/disable VI sense path Ryan Lee
2017-08-28 23:31 ` [PATCH 9/9] ASoC: max98927: Changed device property read function Ryan Lee
2017-08-29 19:00 ` [PATCH 1/9] ASoC: max98927: Added support for DSP_A and DSP_B format Mark Brown
2017-09-01 21:37   ` Ryan Lee
  -- strict thread matches above, loose matches on Subject: below --
2017-08-26  0:41 [PATCH 1/9] ASoC: max98927: Added TDM support Ryan Lee
2017-08-26  0:41 ` [PATCH 7/9] ASoC: max98927: Added PM suspend and resume function Ryan Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1503963061-14763-7-git-send-email-ryans.lee@maximintegrated.com \
    --to=ryans.lee@maximintegrated.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=ryan.lee.maxim@gmail.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).