]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: mcp2221: Don't set bus speed on every transfer
authorHamish Martin <hamish.martin@alliedtelesis.co.nz>
Wed, 25 Oct 2023 03:55:13 +0000 (16:55 +1300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Sep 2025 13:30:28 +0000 (15:30 +0200)
commit5a809b34250cef465df5d4371b75e27e93fc8eb4
tree25e9122481aea45d2e4ce21c3a08bd3881a19c81
parent1b3ccc39480722fc0c11537858a47e0c8cc9ad3c
HID: mcp2221: Don't set bus speed on every transfer

commit 02a46753601a24e1673d9c28173121055e8e6cc9 upstream.

Since the initial commit of this driver the I2C bus speed has been
reconfigured for every single transfer. This is despite the fact that we
never change the speed and it is never "lost" by the chip.
Upon investigation we find that what was really happening was that the
setting of the bus speed had the side effect of cancelling a previous
failed command if there was one, thereby freeing the bus. This is the
part that was actually required to keep the bus operational in the face
of failed commands.

Instead of always setting the speed, we now correctly cancel any failed
commands as they are detected. This means we can just set the bus speed
at probe time and remove the previous speed sets on each transfer.
This has the effect of improving performance and reducing the number of
commands required to complete transfers.

Signed-off-by: Hamish Martin <hamish.martin@alliedtelesis.co.nz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Fixes: 67a95c21463d ("HID: mcp2221: add usb to i2c-smbus host bridge")
[romain.sioen@microchip.com: backport to stable, up to 6.8. Add "Fixes" tag]
Signed-off-by: Romain Sioen <romain.sioen@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hid/hid-mcp2221.c