Hi, The mcp2221 driver GPIO input handling does not work well due to incorrect 'struct mcp_get_gpio' declaration. 'direction' and 'value' in 'gpio[]' are reversed order. The correct sequence is pin value first, followed by direction value. See "TABLE 3-35: RESPONSE 1 STRUCTURE", page 48. --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -74,8 +74,8 @@ struct mcp_get_gpio { u8 cmd; u8 dummy; struct { - u8 direction; u8 value; + u8 direction; } gpio[MCP_NGPIO]; } __packed;
FWIW, I responded to the original patch that added struct mcp_get_gpio with a pointer to this bug report. I'm not sure the mcp2221 folks watch the bugzilla. https://lore.kernel.org/all/20221129153933.GA716319@bhelgaas/