Skip to content

Commit e31b556

Browse files
Romain SioenJiri Kosina
authored andcommitted
HID: mcp2221: cancel last I2C command on read error
When an I2C SMBus read operation fails, the MCP2221 internal state machine may not reset correctly, causing subsequent transactions to fail. By adding a short delay and explicitly cancelling the last command, we ensure the device is ready for the next operation. Fix an issue where i2cdetect was not able to detect all devices correctly on the bus. Signed-off-by: Romain Sioen <romain.sioen@microchip.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 377f8e7 commit e31b556

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/hid/hid-mcp2221.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ static int mcp_i2c_smbus_read(struct mcp2221 *mcp,
353353
usleep_range(90, 100);
354354
retries++;
355355
} else {
356+
usleep_range(980, 1000);
357+
mcp_cancel_last_cmd(mcp);
356358
return ret;
357359
}
358360
} else {

0 commit comments

Comments
 (0)