Skip to content

Commit

Permalink
i2c: designware: Fix runtime PM for I2C slave mode
Browse files Browse the repository at this point in the history
I2C slave controller must be powered and active all the time when I2C
slave backend is registered in order to let master address and
communicate with us.

Now if the controller is runtime PM capable it will be suspended after
probe and cannot ever respond to the master or generate interrupts.

Fix this by resuming the controller when I2C slave backend is registered
and let it suspend after unregistering.

Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
Jarkko Nikula authored and Wolfram Sang committed Aug 17, 2017
1 parent 733f656 commit 2a86cdd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/i2c/busses/i2c-designware-slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ static int i2c_dw_reg_slave(struct i2c_client *slave)
return -EBUSY;
if (slave->flags & I2C_CLIENT_TEN)
return -EAFNOSUPPORT;
pm_runtime_get_sync(dev->dev);

/*
* Set slave address in the IC_SAR register,
* the address to which the DW_apb_i2c responds.
Expand Down Expand Up @@ -205,6 +207,7 @@ static int i2c_dw_unreg_slave(struct i2c_client *slave)
dev->disable_int(dev);
dev->disable(dev);
dev->slave = NULL;
pm_runtime_put(dev->dev);

return 0;
}
Expand Down

0 comments on commit 2a86cdd

Please sign in to comment.