Commit f2ecf2ef authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: rt5670: Add runtime PM support

This patch adds runtime PM support on rt5670 codec.
Signed-off-by: default avatarLin Mengdong <mengdong.lin@intel.com>
Signed-off-by: default avatarBard Liao <bardliao@realtek.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent a5a41645
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/pm.h> #include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/acpi.h> #include <linux/acpi.h>
...@@ -2734,18 +2735,26 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, ...@@ -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, ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5670,
rt5670_dai, ARRAY_SIZE(rt5670_dai)); rt5670_dai, ARRAY_SIZE(rt5670_dai));
if (ret < 0) if (ret < 0)
goto err; goto err;
pm_runtime_put(&i2c->dev);
return 0; return 0;
err: err:
pm_runtime_disable(&i2c->dev);
return ret; return ret;
} }
static int rt5670_i2c_remove(struct i2c_client *i2c) static int rt5670_i2c_remove(struct i2c_client *i2c)
{ {
pm_runtime_disable(&i2c->dev);
snd_soc_unregister_codec(&i2c->dev); snd_soc_unregister_codec(&i2c->dev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment