Skip to content

Commit 20bb907

Browse files
akemnadeLee Jones
authored andcommitted
mfd: twl-core: Disable IRQ while suspended
Since commit 6e2bd956936 ("i2c: omap: Use noirq system sleep pm ops to idle device for suspend") on gta04 we have handle_twl4030_pih() called in situations where pm_runtime_get() in i2c-omap.c returns -EACCES. [ 86.474365] Freezing remaining freezable tasks ... (elapsed 0.002 seconds) done. [ 86.485473] printk: Suspending console(s) (use no_console_suspend to debug) [ 86.555572] Disabling non-boot CPUs ... [ 86.555664] Successfully put all powerdomains to target state [ 86.563720] twl: Read failed (mod 1, reg 0x01 count 1) [ 86.563751] twl4030: I2C error -13 reading PIH ISR [ 86.563812] twl: Read failed (mod 1, reg 0x01 count 1) [ 86.563812] twl4030: I2C error -13 reading PIH ISR [ 86.563873] twl: Read failed (mod 1, reg 0x01 count 1) [ 86.563903] twl4030: I2C error -13 reading PIH ISR This happens when we wakeup via something behing twl4030 (powerbutton or rtc alarm). This goes on for minutes until the system is finally resumed. Disable the irq on suspend and enable it on resume to avoid having i2c access problems when the irq registers are checked. Fixes: 6e2bd956936 ("i2c: omap: Use noirq system sleep pm ops to idle device for suspend") Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
1 parent 9e98c67 commit 20bb907

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/mfd/twl-core.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,28 @@ twl_probe(struct i2c_client *client, const struct i2c_device_id *id)
12451245
return status;
12461246
}
12471247

1248+
static int __maybe_unused twl_suspend(struct device *dev)
1249+
{
1250+
struct i2c_client *client = to_i2c_client(dev);
1251+
1252+
if (client->irq)
1253+
disable_irq(client->irq);
1254+
1255+
return 0;
1256+
}
1257+
1258+
static int __maybe_unused twl_resume(struct device *dev)
1259+
{
1260+
struct i2c_client *client = to_i2c_client(dev);
1261+
1262+
if (client->irq)
1263+
enable_irq(client->irq);
1264+
1265+
return 0;
1266+
}
1267+
1268+
static SIMPLE_DEV_PM_OPS(twl_dev_pm_ops, twl_suspend, twl_resume);
1269+
12481270
static const struct i2c_device_id twl_ids[] = {
12491271
{ "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */
12501272
{ "twl5030", 0 }, /* T2 updated */
@@ -1262,6 +1284,7 @@ static const struct i2c_device_id twl_ids[] = {
12621284
/* One Client Driver , 4 Clients */
12631285
static struct i2c_driver twl_driver = {
12641286
.driver.name = DRIVER_NAME,
1287+
.driver.pm = &twl_dev_pm_ops,
12651288
.id_table = twl_ids,
12661289
.probe = twl_probe,
12671290
.remove = twl_remove,

0 commit comments

Comments
 (0)