diff options
Diffstat (limited to 'sound/soc/codecs/cs4270.c')
-rw-r--r-- | sound/soc/codecs/cs4270.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c index a32b8226c8a4..ca1e24a8f12a 100644 --- a/sound/soc/codecs/cs4270.c +++ b/sound/soc/codecs/cs4270.c | |||
@@ -806,15 +806,30 @@ static int cs4270_i2c_suspend(struct i2c_client *client, pm_message_t mesg) | |||
806 | { | 806 | { |
807 | struct cs4270_private *cs4270 = i2c_get_clientdata(client); | 807 | struct cs4270_private *cs4270 = i2c_get_clientdata(client); |
808 | struct snd_soc_codec *codec = &cs4270->codec; | 808 | struct snd_soc_codec *codec = &cs4270->codec; |
809 | int reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL; | ||
810 | 809 | ||
811 | return snd_soc_write(codec, CS4270_PWRCTL, reg); | 810 | return snd_soc_suspend_device(codec->dev); |
812 | } | 811 | } |
813 | 812 | ||
814 | static int cs4270_i2c_resume(struct i2c_client *client) | 813 | static int cs4270_i2c_resume(struct i2c_client *client) |
815 | { | 814 | { |
816 | struct cs4270_private *cs4270 = i2c_get_clientdata(client); | 815 | struct cs4270_private *cs4270 = i2c_get_clientdata(client); |
817 | struct snd_soc_codec *codec = &cs4270->codec; | 816 | struct snd_soc_codec *codec = &cs4270->codec; |
817 | |||
818 | return snd_soc_resume_device(codec->dev); | ||
819 | } | ||
820 | |||
821 | static int cs4270_soc_suspend(struct platform_device *pdev, pm_message_t mesg) | ||
822 | { | ||
823 | struct snd_soc_codec *codec = cs4270_codec; | ||
824 | int reg = snd_soc_read(codec, CS4270_PWRCTL) | CS4270_PWRCTL_PDN_ALL; | ||
825 | |||
826 | return snd_soc_write(codec, CS4270_PWRCTL, reg); | ||
827 | } | ||
828 | |||
829 | static int cs4270_soc_resume(struct platform_device *pdev) | ||
830 | { | ||
831 | struct snd_soc_codec *codec = cs4270_codec; | ||
832 | struct i2c_client *i2c_client = codec->control_data; | ||
818 | int reg; | 833 | int reg; |
819 | 834 | ||
820 | /* In case the device was put to hard reset during sleep, we need to | 835 | /* In case the device was put to hard reset during sleep, we need to |
@@ -825,7 +840,7 @@ static int cs4270_i2c_resume(struct i2c_client *client) | |||
825 | for (reg = CS4270_FIRSTREG; reg <= CS4270_LASTREG; reg++) { | 840 | for (reg = CS4270_FIRSTREG; reg <= CS4270_LASTREG; reg++) { |
826 | u8 val = snd_soc_read(codec, reg); | 841 | u8 val = snd_soc_read(codec, reg); |
827 | 842 | ||
828 | if (i2c_smbus_write_byte_data(client, reg, val)) { | 843 | if (i2c_smbus_write_byte_data(i2c_client, reg, val)) { |
829 | dev_err(codec->dev, "i2c write failed\n"); | 844 | dev_err(codec->dev, "i2c write failed\n"); |
830 | return -EIO; | 845 | return -EIO; |
831 | } | 846 | } |
@@ -840,6 +855,8 @@ static int cs4270_i2c_resume(struct i2c_client *client) | |||
840 | #else | 855 | #else |
841 | #define cs4270_i2c_suspend NULL | 856 | #define cs4270_i2c_suspend NULL |
842 | #define cs4270_i2c_resume NULL | 857 | #define cs4270_i2c_resume NULL |
858 | #define cs4270_soc_suspend NULL | ||
859 | #define cs4270_soc_resume NULL | ||
843 | #endif /* CONFIG_PM */ | 860 | #endif /* CONFIG_PM */ |
844 | 861 | ||
845 | /* | 862 | /* |
@@ -868,7 +885,9 @@ static struct i2c_driver cs4270_i2c_driver = { | |||
868 | */ | 885 | */ |
869 | struct snd_soc_codec_device soc_codec_device_cs4270 = { | 886 | struct snd_soc_codec_device soc_codec_device_cs4270 = { |
870 | .probe = cs4270_probe, | 887 | .probe = cs4270_probe, |
871 | .remove = cs4270_remove | 888 | .remove = cs4270_remove, |
889 | .suspend = cs4270_soc_suspend, | ||
890 | .resume = cs4270_soc_resume, | ||
872 | }; | 891 | }; |
873 | EXPORT_SYMBOL_GPL(soc_codec_device_cs4270); | 892 | EXPORT_SYMBOL_GPL(soc_codec_device_cs4270); |
874 | 893 | ||