aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s3c24xx
diff options
context:
space:
mode:
authorGraeme Gregory <graeme@openmoko.org>2008-04-30 14:26:45 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-30 13:38:34 -0400
commitfd403dc84f29aee613d13bde5656ba74cdee1e7b (patch)
tree44e318e8e62f7c5f03c3d06a577bf1dd48cdd54c /sound/soc/s3c24xx
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/s3c24xx')
-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 c8caddffc42d..0e9d1c5f2484 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)
616 return i2c_probe(adap, &addr_data, lm4857_amp_probe); 616 return i2c_probe(adap, &addr_data, lm4857_amp_probe);
617} 617}
618 618
619static u8 lm4857_state;
620
621static int lm4857_suspend(struct i2c_client *dev, pm_message_t state)
622{
623 dev_dbg(&dev->dev, "lm4857_suspend\n");
624 lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf;
625 if (lm4857_state) {
626 lm4857_regs[LM4857_CTRL] &= 0xf0;
627 lm4857_write_regs();
628 }
629 return 0;
630}
631
632static int lm4857_resume(struct i2c_client *dev)
633{
634 if (lm4857_state) {
635 lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f);
636 lm4857_write_regs();
637 }
638 return 0;
639}
640
641static void lm4857_shutdown(struct i2c_client *dev)
642{
643 dev_dbg(&dev->dev, "lm4857_shutdown\n");
644 lm4857_regs[LM4857_CTRL] &= 0xf0;
645 lm4857_write_regs();
646}
647
619/* corgi i2c codec control layer */ 648/* corgi i2c codec control layer */
620static struct i2c_driver lm4857_i2c_driver = { 649static struct i2c_driver lm4857_i2c_driver = {
621 .driver = { 650 .driver = {
@@ -623,6 +652,9 @@ static struct i2c_driver lm4857_i2c_driver = {
623 .owner = THIS_MODULE, 652 .owner = THIS_MODULE,
624 }, 653 },
625 .id = I2C_DRIVERID_LM4857, 654 .id = I2C_DRIVERID_LM4857,
655 .suspend = lm4857_suspend,
656 .resume = lm4857_resume,
657 .shutdown = lm4857_shutdown,
626 .attach_adapter = lm4857_i2c_attach, 658 .attach_adapter = lm4857_i2c_attach,
627 .detach_client = lm4857_i2c_detach, 659 .detach_client = lm4857_i2c_detach,
628 .command = NULL, 660 .command = NULL,