diff options
author | Bard Liao <bardliao@realtek.com> | 2014-12-15 02:42:33 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-03-02 11:19:46 -0500 |
commit | 64e89e5f55484d289c8b326521e5a12291e2283e (patch) | |
tree | ea76a19edcc61a3101fc5afddc0c07851f09cc5f | |
parent | 223c055aa0eb7e606eb7132e339ce66bb8d7be0d (diff) |
ASoC: rt5670: Add runtime PM support
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>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/rt5670.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c index cd47ef1f5561..78d85de8af6f 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/pm.h> | 16 | #include <linux/pm.h> |
17 | #include <linux/pm_runtime.h> | ||
17 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/acpi.h> | 20 | #include <linux/acpi.h> |
@@ -2734,18 +2735,26 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, | |||
2734 | 2735 | ||
2735 | } | 2736 | } |
2736 | 2737 | ||
2738 | pm_runtime_enable(&i2c->dev); | ||
2739 | pm_request_idle(&i2c->dev); | ||
2740 | |||
2737 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5670, | 2741 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5670, |
2738 | rt5670_dai, ARRAY_SIZE(rt5670_dai)); | 2742 | rt5670_dai, ARRAY_SIZE(rt5670_dai)); |
2739 | if (ret < 0) | 2743 | if (ret < 0) |
2740 | goto err; | 2744 | goto err; |
2741 | 2745 | ||
2746 | pm_runtime_put(&i2c->dev); | ||
2747 | |||
2742 | return 0; | 2748 | return 0; |
2743 | err: | 2749 | err: |
2750 | pm_runtime_disable(&i2c->dev); | ||
2751 | |||
2744 | return ret; | 2752 | return ret; |
2745 | } | 2753 | } |
2746 | 2754 | ||
2747 | static int rt5670_i2c_remove(struct i2c_client *i2c) | 2755 | static int rt5670_i2c_remove(struct i2c_client *i2c) |
2748 | { | 2756 | { |
2757 | pm_runtime_disable(&i2c->dev); | ||
2749 | snd_soc_unregister_codec(&i2c->dev); | 2758 | snd_soc_unregister_codec(&i2c->dev); |
2750 | 2759 | ||
2751 | return 0; | 2760 | return 0; |