Part Number: AM3351
Other Parts Discussed in Thread: SYSCONFIG
Tool/software: Linux
Hi,
We have custom board based on AM3351 and bq27421 fuel gas gauge sensor. In that, GPIO bank 0 is used as wakeup source and we are using wake up GPIO button, which is connected bank 0 for wake up purpose. Also we have connected fuel gas guage interrupt to GPIO bank 0. Because of this, it is automatically wake up the device from sleep mode(due to feul gas guage interrupt), even though we are not pressing wakeup gpio button. I have added disable/enable irq in suspend/resume function of fuel gauge driver in order to disable fuel gas gauge interrupt during sleep mode. But still fuel gauge interrupt wake up the device from sleep mode. Below is the code I have added.
static int bq27421_pm_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct bq27421_device_info *di = i2c_get_clientdata(client);
if (client->irq) {
if (device_may_wakeup(dev))
disable_irq_wake(client->irq);
disable_irq(client->irq);
}
cancel_delayed_work_sync(&di->work);
return 0;
}
static int bq27421_pm_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct bq27421_device_info *di = i2c_get_clientdata(client);
if (client->irq) {
if (device_may_wakeup(dev))
enable_irq_wake(client->irq);
enable_irq(client->irq);
}
schedule_delayed_work(&di->work, poll_interval * HZ);
return 0;
}