[ar71xx] create firmware image for the Ubiquiti LS-SR71 board
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1004-asoc-neo1973_wm8753-power.patch.patch
1 From dee63031aaa4377dea64113b0f6789ea053087fd Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Fri, 4 Apr 2008 11:29:38 +0100
4 Subject: [PATCH] asoc-neo1973_wm8753-power.patch
5
6 ---
7  sound/soc/s3c24xx/neo1973_wm8753.c |   32 ++++++++++++++++++++++++++++++++
8  1 files changed, 32 insertions(+), 0 deletions(-)
9
10 diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
11 index 679b99d..0289d1d 100644
12 --- a/sound/soc/s3c24xx/neo1973_wm8753.c
13 +++ b/sound/soc/s3c24xx/neo1973_wm8753.c
14 @@ -617,6 +617,35 @@ static int lm4857_i2c_attach(struct i2c_adapter *adap)
15         return i2c_probe(adap, &addr_data, lm4857_amp_probe);
16  }
17  
18 +static u8 lm4857_state;
19 +
20 +static int lm4857_suspend(struct i2c_client *dev, pm_message_t state)
21 +{
22 +       dev_dbg(&dev->dev, "lm4857_suspend\n");
23 +       lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf;
24 +       if (lm4857_state) {
25 +               lm4857_regs[LM4857_CTRL] &= 0xf0;
26 +               lm4857_write_regs();
27 +       }
28 +       return 0;
29 +}
30 +
31 +static int lm4857_resume(struct i2c_client *dev)
32 +{
33 +       if (lm4857_state) {
34 +               lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f);
35 +               lm4857_write_regs();
36 +       }
37 +       return 0;
38 +}
39 +
40 +static void lm4857_shutdown(struct i2c_client *dev)
41 +{
42 +       dev_dbg(&dev->dev, "lm4857_shutdown\n");
43 +       lm4857_regs[LM4857_CTRL] &= 0xf0;
44 +       lm4857_write_regs();
45 +}
46 +
47  /* corgi i2c codec control layer */
48  static struct i2c_driver lm4857_i2c_driver = {
49         .driver = {
50 @@ -624,6 +653,9 @@ static struct i2c_driver lm4857_i2c_driver = {
51                 .owner = THIS_MODULE,
52         },
53         .id =             I2C_DRIVERID_LM4857,
54 +       .suspend =        lm4857_suspend,
55 +       .resume =         lm4857_resume,
56 +       .shutdown =       lm4857_shutdown,
57         .attach_adapter = lm4857_i2c_attach,
58         .detach_client =  lm4857_i2c_detach,
59         .command =        NULL,
60 -- 
61 1.5.6.5
62