Skip to content

Commit ba74e80

Browse files
Kevin LiuSamuel Ortiz
authored andcommitted
mfd: Add pm ops to max8925
Signed-off-by: Kevin Liu <kliu5@marvell.com> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
1 parent 5214e56 commit ba74e80

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

‎drivers/mfd/max8925-i2c.c‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,8 @@ static int __devinit max8925_probe(struct i2c_client *client,
161161
chip->adc = i2c_new_dummy(chip->i2c->adapter, ADC_I2C_ADDR);
162162
i2c_set_clientdata(chip->adc, chip);
163163

164+
device_init_wakeup(&client->dev, 1);
165+
164166
max8925_device_init(chip, pdata);
165167

166168
return 0;
@@ -177,10 +179,35 @@ static int __devexit max8925_remove(struct i2c_client *client)
177179
return 0;
178180
}
179181

182+
#ifdef CONFIG_PM_SLEEP
183+
static int max8925_suspend(struct device *dev)
184+
{
185+
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
186+
struct max8925_chip *chip = i2c_get_clientdata(client);
187+
188+
if (device_may_wakeup(dev) && chip->wakeup_flag)
189+
enable_irq_wake(chip->core_irq);
190+
return 0;
191+
}
192+
193+
static int max8925_resume(struct device *dev)
194+
{
195+
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
196+
struct max8925_chip *chip = i2c_get_clientdata(client);
197+
198+
if (device_may_wakeup(dev) && chip->wakeup_flag)
199+
disable_irq_wake(chip->core_irq);
200+
return 0;
201+
}
202+
#endif
203+
204+
static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume);
205+
180206
static struct i2c_driver max8925_driver = {
181207
.driver = {
182208
.name = "max8925",
183209
.owner = THIS_MODULE,
210+
.pm = &max8925_pm_ops,
184211
},
185212
.probe = max8925_probe,
186213
.remove = __devexit_p(max8925_remove),

‎include/linux/mfd/max8925.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ struct max8925_chip {
206206
int irq_base;
207207
int core_irq;
208208
int tsc_irq;
209+
210+
unsigned int wakeup_flag;
209211
};
210212

211213
struct max8925_backlight_pdata {

0 commit comments

Comments
 (0)