summaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorGraeme Gregory <graeme@openmoko.org>2008-04-30 20:26:45 +0200
committerTakashi Iwai <tiwai@suse.de>2008-04-30 19:38:34 +0200
commitfd403dc84f29aee613d13bde5656ba74cdee1e7b (patch)
tree44e318e8e62f7c5f03c3d06a577bf1dd48cdd54c /sound/soc
parent443590e6f1823cd4bc1199cc658074bc3e30acbf (diff)
[ALSA] soc - neo1973_wm8753.c add suspend and shutdown hooks for lm4857 chip
Patch taken from the openmoko bugtracker http://bugzilla.openmoko.org/cgi-bin/bugzilla/show_bug.cgi?id=781 This patch adds Suspend/Resume and Shutdown support for the lm4857 to the driver. Signed-off-by: Graeme Gregory <graeme@openmoko.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/s3c24xx/neo1973_wm8753.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
index c8caddffc42..0e9d1c5f248 100644
--- a/sound/soc/s3c24xx/neo1973_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -616,6 +616,35 @@ static int lm4857_i2c_attach(struct i2c_adapter *adap)
return i2c_probe(adap, &addr_data, lm4857_amp_probe);
}
+static u8 lm4857_state;
+
+static int lm4857_suspend(struct i2c_client *dev, pm_message_t state)
+{
+ dev_dbg(&dev->dev, "lm4857_suspend\n");
+ lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf;
+ if (lm4857_state) {
+ lm4857_regs[LM4857_CTRL] &= 0xf0;
+ lm4857_write_regs();
+ }
+ return 0;
+}
+
+static int lm4857_resume(struct i2c_client *dev)
+{
+ if (lm4857_state) {
+ lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f);
+ lm4857_write_regs();
+ }
+ return 0;
+}
+
+static void lm4857_shutdown(struct i2c_client *dev)
+{
+ dev_dbg(&dev->dev, "lm4857_shutdown\n");
+ lm4857_regs[LM4857_CTRL] &= 0xf0;
+ lm4857_write_regs();
+}
+
/* corgi i2c codec control layer */
static struct i2c_driver lm4857_i2c_driver = {
.driver = {
@@ -623,6 +652,9 @@ static struct i2c_driver lm4857_i2c_driver = {
.owner = THIS_MODULE,
},
.id = I2C_DRIVERID_LM4857,
+ .suspend = lm4857_suspend,
+ .resume = lm4857_resume,
+ .shutdown = lm4857_shutdown,
.attach_adapter = lm4857_i2c_attach,
.detach_client = lm4857_i2c_detach,
.command = NULL,