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@xxxxxxxxxx> --- drivers/input/rmi4/rmi_smbus.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c index 3ebb2829..cbab388 100644 --- a/drivers/input/rmi4/rmi_smbus.c +++ b/drivers/input/rmi4/rmi_smbus.c @@ -265,10 +265,27 @@ 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; + 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"); + serio_activate(rmi_smb->serio_parent); + } + + return ret; } static const struct rmi_transport_ops rmi_smb_ops = { -- 2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html