]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
HID: mcp2221: Add module parameter to enfoce GPIO mode
authorLinus Walleij <linusw@kernel.org>
Wed, 18 Feb 2026 13:44:38 +0000 (14:44 +0100)
committerJiri Kosina <jkosina@suse.com>
Thu, 12 Mar 2026 13:05:20 +0000 (14:05 +0100)
commit200e6c6e94fa786e36e4fe33eebf16b822181b99
tree47d860300b00fd4fa33b9b978c710ebcf693d5b6
parentab05515757fcb77edbbe7c68fbc7c0c930c0f668
HID: mcp2221: Add module parameter to enfoce GPIO mode

Add a module parameter to MCP2221 to enfor GPIO mode on the
general purpose pins GP0 thru GP3.

If I plug a device of this type into my machine, it will use the
GP0, GP1, GP2 and GP3 pins for IIO voltage readings by default
if CONFIG_IIO is set.

However there may be cases where IIO is available but we want to
use the GP0 thru GP3 lines for GPIO anyway.

Example use:

insmode hid-mcp2221.ko gpio_mode_enforce=1

Result in dmesg:
mcp2221 0003:04D8:00DD.0005: GPIO 0 not in gpio mode
mcp2221 0003:04D8:00DD.0005: GPIO 1 not in gpio mode
mcp2221 0003:04D8:00DD.0005: GPIO 2 not in gpio mode
mcp2221 0003:04D8:00DD.0005: GPIO 3 not in gpio mode
mcp2221 0003:04D8:00DD.0005: Set GPIO mode for gpio pin 0!
mcp2221 0003:04D8:00DD.0005: Set GPIO mode for gpio pin 1!
mcp2221 0003:04D8:00DD.0005: Set GPIO mode for gpio pin 2!
mcp2221 0003:04D8:00DD.0005: Set GPIO mode for gpio pin 3!

After this the gpiolib tools such as gpioset can be used to alter
the GPIO line values successfully.

Signed-off-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.com>
drivers/hid/hid-mcp2221.c