diff mbox

[v2,1/2] ASoC: rt5670: Add runtime PM support

Message ID 1418629354-26948-1-git-send-email-bardliao@realtek.com (mailing list archive)
State Accepted
Commit 64e89e5f55484d289c8b326521e5a12291e2283e
Headers show

Commit Message

Bard Liao Dec. 15, 2014, 7:42 a.m. UTC
This patch adds runtime PM support on rt5670 codec.

Signed-off-by: Lin Mengdong <mengdong.lin@intel.com>
Signed-off-by: Bard Liao <bardliao@realtek.com>
---
* Remove the unused runtime suspend/resume code. We will switch
  the sysclk source on another patch.
---
 sound/soc/codecs/rt5670.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Mark Brown Dec. 22, 2014, 6:44 p.m. UTC | #1
On Mon, Dec 15, 2014 at 03:42:33PM +0800, Bard Liao wrote:
> This patch adds runtime PM support on rt5670 codec.

Applied both, thanks.
diff mbox

Patch

diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
index 09cf100..a8a471b 100644
--- a/sound/soc/codecs/rt5670.c
+++ b/sound/soc/codecs/rt5670.c
@@ -14,6 +14,7 @@ 
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/pm.h>
+#include <linux/pm_runtime.h>
 #include <linux/i2c.h>
 #include <linux/platform_device.h>
 #include <linux/acpi.h>
@@ -2734,18 +2735,26 @@  static int rt5670_i2c_probe(struct i2c_client *i2c,
 
 	}
 
+	pm_runtime_enable(&i2c->dev);
+	pm_request_idle(&i2c->dev);
+
 	ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5670,
 			rt5670_dai, ARRAY_SIZE(rt5670_dai));
 	if (ret < 0)
 		goto err;
 
+	pm_runtime_put(&i2c->dev);
+
 	return 0;
 err:
+	pm_runtime_disable(&i2c->dev);
+
 	return ret;
 }
 
 static int rt5670_i2c_remove(struct i2c_client *i2c)
 {
+	pm_runtime_disable(&i2c->dev);
 	snd_soc_unregister_codec(&i2c->dev);
 
 	return 0;