]> git.baikalelectronics.ru Git - kernel.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)
committerJiri Kosina <jkosina@suse.cz>
Thu, 5 Nov 2020 10:16:53 +0000 (11:16 +0100)
commit1f5a1d7ba2dd23dabdadff8454601ec49de82511
treea0dbb9f850fecb0e5891208c59eec6b8edb52eab
parentf22c6eaec341db6ad6bd4e169b03b61f919ed091
HID: mcp2221: Fix GPIO output handling

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: 7de68b00b41dfcc0 ("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>
drivers/hid/hid-mcp2221.c