]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
HID: mcp2221: Fix GPIO output handling
authorLars Povlsen <lars.povlsen@microchip.com>
Wed, 4 Nov 2020 22:02:23 +0000 (23:02 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 24 Nov 2020 12:39:07 +0000 (13:39 +0100)
commita28d47bd930db08bf21f63193e8ad93a5ce9f7f6
treed5c8a7c7578996f9424cb06219c9487289f56437
parent646e5ab6b8dce76ffc52dd7441dddf046eb9ac31
HID: mcp2221: Fix GPIO output handling

[ Upstream commit 567b8e9fed8add9e20885be38ecd73bb0e07406b ]

The mcp2221 driver GPIO output handling has has several issues.

* A wrong value is used for the GPIO direction.

* Wrong offsets are calculated for some GPIO set value/set direction
  operations, when offset is larger than 0.

This has been fixed by introducing proper manifest constants for the
direction encoding, and using 'offsetof' when calculating GPIO
register offsets.

The updated driver has been tested with the Sparx5 pcb134/pcb135
board, which has the mcp2221 device with several (output) GPIO's.

Fixes: 328de1c519c5c092 ("HID: mcp2221: add GPIO functionality support")
Reviewed-by: Rishi Gupta <gupt21@gmail.com>
Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/hid/hid-mcp2221.c