hid-mcp2200: added driver for GPIOs of MCP2200
PATCH 1/1 hid-mcp2200: added driver for GPIOs of MCP2200
Added a gpiochip compatible driver to control the 8 GPIOs of the MCP2200 by using the HID interface.
Using GPIOs with alternative functions (GP0<->SSPND, GP1<->USBCFG, GP6<->RXLED, GP7<->TXLED) will reset the functions, if set (unset by default).
The driver was tested while also using the UART of the chip. Setting and reading the GPIOs has no effect on the UART communication. However, a reset is triggered after the CONFIGURE command. If the GPIO Direction is constantly changed, this will affect the communication at low baud rates. This is a hardware problem of the MCP2200 and is not caused by the driver.
Feedback from reviewers Christophe JAILLET <[email protected]> and Andi Shyti <[email protected]> was added.
--- drivers/hid/Kconfig | 10 + drivers/hid/Makefile | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-mcp2200.c | 416 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 428 insertions(+) create mode 100644 drivers/hid/hid-mcp2200.c
drivers/hid/Kconfig +10 -0
@@ -1283,6 +1283,16 @@ config HID_MCP2221 To compile this driver as a module, choose M here: the module will be called hid-mcp2221.ko. +config HID_MCP2200 + tristate "Microchip MCP2200 HID USB-to-GPIO bridge" + depends on USB_HID + imply GPIOLIB + help + Provides GPIO functionality over USB-HID through MCP2200 device. + + To compile this driver as a module, choose M here: the module + will be called hid-mcp2200.ko. + config HID_KUNIT_TEST tristate "KUnit tests for HID" if !KUNIT_ALL_TESTS depends on KUNIT=y
drivers/hid/Makefile +1 -0
@@ -79,6 +79,7 @@ obj-$(CONFIG_HID_MACALLY) += hid-macally.o obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o obj-$(CONFIG_HID_MALTRON) += hid-maltron.o obj-$(CONFIG_HID_MCP2221) += hid-mcp2221.o +obj-$(CONFIG_HID_MCP2200) += hid-mcp2200.o obj-$(CONFIG_HID_MAYFLASH) += hid-mf.o obj-$(CONFIG_HID_MEGAWORLD_FF) += hid-megaworld.o obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
drivers/hid/hid-ids.h +1 -0
@@ -912,6 +912,7 @@#define USB_DEVICE_ID_PICK16F1454_V2 0xf2f7#define USB_DEVICE_ID_LUXAFOR 0xf372#define USB_DEVICE_ID_MCP2221 0x00dd +#define USB_DEVICE_ID_MCP2200 0x00df#define USB_VENDOR_ID_MICROSOFT 0x045e#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
drivers/hid/hid-mcp2200.c new file +416 -0
416 lines not on this page · raw message
+
Signature · 1 line
2.41.0