@@ -265,10 +265,29 @@ static int rmi_smb_reset(struct rmi_transport_dev *xport, u16 reset_addr)
{
struct rmi_smb_xport *rmi_smb =
container_of(xport, struct rmi_smb_xport, xport);
+ struct i2c_client *client = rmi_smb->client;
+ struct rmi_device_platform_data *pdata;
+ int tries, ret;
rmi_smb_clear_state(rmi_smb);
- return rmi_smb_enable_smbus_mode(rmi_smb);
+ for (tries = 3; tries > 0; tries--) {
+ ret = rmi_smb_enable_smbus_mode(rmi_smb);
+ if (!ret)
+ break;
+
+ /* we failed enabling SMBus, try again later */
+ msleep(500);
+ }
+
+ if (ret < 0) {
+ dev_warn(&client->dev,
+ "failed to enable SMBus mode, giving up.\n");
+ pdata = dev_get_platdata(&rmi_smb->client->dev);
+ rmi_transport_enable(pdata, false);
+ }
+
+ return ret;
}
static const struct rmi_transport_ops rmi_smb_ops = {
In some rare cases, we can't retrieve the SMBus version and so we fail binding the touchpad back. Instead of leaving a touchpad dead, try again to reinitialize it. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> --- drivers/input/rmi4/rmi_smbus.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-)