usb/gpio/i2c: Add Intel USBIO USB IO-expander drivers
Hans de Goede
maintainerv5 cover usb/gpio/i2c: Add Intel USBIO USB IO-expander drivers
Hi All,
Here is v5 of the patch series to add support for the Intel USBIO USB IO-expander used by the MIPI cameras on various new (Meteor Lake and later) Intel laptops.
Changes in v5:
- GPIO: Move GPIO_USBIO Kconfig option under 'menu "USB GPIO expanders"'
- I2C: Drop some unnecessary dev_dbg() messages
- I2C: Add I2C_AQ_NO_ZERO_LEN to the adapter quirks
Changes in v4:
- GPIO: Drop include <linux/dev_printk.h>, unneeded auxiliary_set_drvdata()
Changes in v3:
- Drop (offset >= gc->ngpio) check and make usbio_gpio_get_bank_and_pin() return void
- Propagate usbio_gpio_set() ret val in usbio_gpio_direction_output()
- Use devm_gpiochip_add_data() and drop auxiliary_driver remove() callback
Changes in v2:
- Split usbio-bridge mutex into ctrl_mutex and bulk_mutex
- Drop SPI support since this is not used on devices in the field
- Rework disconnect handling to be more robust
- Several different revisions need special casing add a quirks mechanism for this
- Stop using stdint.h (uintX_t) types
- Use __le16, __le32 type + cpu_to_le16() and friends for on wire words
- Properly check auxiliary_device_add() return value
- Add a mutex to the GPIO driver to protect usbio_gpio_update_config() calls, which read-modify-write banks[x].config, racing with each other
- Adjust usbio_gpio_get() to have an int return value and propagate the usbio_control_msg() return value
- Various (small) style fixes from Sakari's review of all 3 patches
The first patch adds an USB bridge driver which registers auxbus children for the GPIO and I2C functions of the USBIO chip.
The second and third patch add a GPIO resp. an I2C driver for the auxbus children using the IO functions exported by the USB bridge driver.
The second and third patch depend on the IO functions exported by the first patch. So to merge this we will need either an immutable tag on the USB tree.
Regards,
Hans
Israel Cepeda (3):
usb: misc: Add Intel USBIO bridge driver
gpio: Add Intel USBIO GPIO driver
i2c: Add Intel USBIO I2C driver
MAINTAINERS | 10 + drivers/gpio/Kconfig | 11 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-usbio.c | 247 +++++++++++ drivers/i2c/busses/Kconfig | 11 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-usbio.c | 320 ++++++++++++++ drivers/usb/misc/Kconfig | 14 + drivers/usb/misc/Makefile | 1 + drivers/usb/misc/usbio.c | 749 +++++++++++++++++++++++++++++++++ include/linux/usb/usbio.h | 177 ++++++++ 11 files changed, 1542 insertions(+) create mode 100644 drivers/gpio/gpio-usbio.c create mode 100644 drivers/i2c/busses/i2c-usbio.c create mode 100644 drivers/usb/misc/usbio.c create mode 100644 include/linux/usb/usbio.h
Signature · 1 line
2.51.0
Hans de Goede
maintainerPATCH v5 1/3 usb: misc: Add Intel USBIO bridge driver
From: Israel Cepeda <[email protected]>
Add a driver for the Intel USBIO USB IO-expander used by the MIPI cameras on various new (Meteor Lake and later) Intel laptops.
This is an USB bridge driver which adds auxbus child devices for the GPIO, I2C and SPI functions of the USBIO chip and which exports IO-functions for the drivers for the auxbus child devices to communicate with the USBIO device's firmware.
---
Changes in v2:
- Split usbio-bridge mutex into ctrl_mutex and bulk_mutex
- Drop SPI support since this is not used on devices in the field
- Rework disconnect handling to be more robust
- Several different revisions need special casing add a quirks mechanism for this
- Stop using stdint.h (uintX_t) types
- Use __le16, __le32 type + cpu_to_le16() and friends for on wire words
- Properly check auxiliary_device_add() return value
- Some small style fixes from Sakari's review
--- MAINTAINERS | 8 + drivers/usb/misc/Kconfig | 14 + drivers/usb/misc/Makefile | 1 + drivers/usb/misc/usbio.c | 749 ++++++++++++++++++++++++++++++++++++++ include/linux/usb/usbio.h | 177 +++++++++ 5 files changed, 949 insertions(+) create mode 100644 drivers/usb/misc/usbio.c create mode 100644 include/linux/usb/usbio.h
MAINTAINERS +8 -0
@@ -12700,6 +12700,14 @@ S: Maintained F: Documentation/admin-guide/pm/intel_uncore_frequency_scaling.rst F: drivers/platform/x86/intel/uncore-frequency/ +INTEL USBIO USB I/O EXPANDER DRIVERS +M: Israel Cepeda <[email protected]> +M: Hans de Goede <[email protected]> +R: Sakari Ailus <[email protected]> +S: Maintained +F: drivers/usb/misc/usbio.c +F: include/linux/usb/usbio.h + INTEL VENDOR SPECIFIC EXTENDED CAPABILITIES DRIVER M: David E. Box <[email protected]> S: Supported
drivers/usb/misc/Kconfig +14 -0
@@ -178,6 +178,20 @@ config USB_LJCA This driver can also be built as a module. If so, the module will be called usb-ljca. +config USB_USBIO + tristate "Intel USBIO Bridge support" + depends on USB && ACPI + select AUXILIARY_BUS + help + This adds support for Intel USBIO drivers. + This enables the USBIO bridge driver module in charge to talk + to the USB device. Additional drivers such as GPIO_USBIO and + I2C_USBIO must be enabled in order to use the device's full + functionality. + + This driver can also be built as a module. If so, the module + will be called usbio. + source "drivers/usb/misc/sisusbvga/Kconfig" config USB_LD
drivers/usb/misc/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_USB_EMI62) += emi62.o obj-$(CONFIG_USB_EZUSB_FX2) += ezusb.o obj-$(CONFIG_APPLE_MFI_FASTCHARGE) += apple-mfi-fastcharge.o obj-$(CONFIG_USB_LJCA) += usb-ljca.o +obj-$(CONFIG_USB_USBIO) += usbio.o obj-$(CONFIG_USB_IDMOUSE) += idmouse.o obj-$(CONFIG_USB_IOWARRIOR) += iowarrior.o obj-$(CONFIG_USB_ISIGHTFW) += isight_firmware.o
drivers/usb/misc/usbio.c new file +749 -0
749 lines not on this page · raw message
include/linux/usb/usbio.h new file +177 -0
177 lines not on this page · raw message
Signature · 1 line
2.51.0
Hans de Goede
maintainerPATCH v5 2/3 gpio: Add Intel USBIO GPIO driver
In reply to Hans de GoedeFrom: Israel Cepeda <[email protected]>
Add a a driver for the GPIO auxbus child device of the Intel USBIO USB IO-expander used by the MIPI cameras on various new (Meteor Lake and later) Intel laptops.
---
Changes in v5:
- Move GPIO_USBIO Kconfig option under 'menu "USB GPIO expanders"'
Changes in v4:
- Drop include <linux/dev_printk.h>, unneeded auxiliary_set_drvdata()
Changes in v3:
- Drop (offset >= gc->ngpio) check and make usbio_gpio_get_bank_and_pin() return void
- Propagate usbio_gpio_set() ret val in usbio_gpio_direction_output()
- Use devm_gpiochip_add_data() and drop auxiliary_driver remove() callback
Changes in v2:
- Add a config_mutex protect usbio_gpio_update_config() calls, which read-modify-write banks[x].config, racing with each other
- Adjust usbio_gpio_get() to have an int return value and propagate the usbio_control_msg() return value
- Use __le16, __le32 type + cpu_to_le16() and friends for on wire words
- Some small style fixes from Sakari's review
--- MAINTAINERS | 1 + drivers/gpio/Kconfig | 11 ++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-usbio.c | 247 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 260 insertions(+) create mode 100644 drivers/gpio/gpio-usbio.c
MAINTAINERS +1 -0
@@ -12705,6 +12705,7 @@ M: Israel Cepeda <[email protected]> M: Hans de Goede <[email protected]> R: Sakari Ailus <[email protected]> S: Maintained +F: drivers/gpio/gpio-usbio.c F: drivers/usb/misc/usbio.c F: include/linux/usb/usbio.h
drivers/gpio/Kconfig +11 -0
@@ -1923,6 +1923,17 @@ config GPIO_MPSSE GPIO driver for FTDI's MPSSE interface. These can do input and output. Each MPSSE provides 16 IO pins. +config GPIO_USBIO + tristate "Intel USBIO GPIO support" + depends on USB_USBIO + default USB_USBIO + help + Select this option to enable GPIO driver for the INTEL + USBIO driver stack. + + This driver can also be built as a module. If so, the module + will be called gpio_usbio. + endmenu menu "Virtual GPIO drivers"
drivers/gpio/Makefile +1 -0
@@ -192,6 +192,7 @@ obj-$(CONFIG_GPIO_TS5500) += gpio-ts5500.o obj-$(CONFIG_GPIO_TWL4030) += gpio-twl4030.o obj-$(CONFIG_GPIO_TWL6040) += gpio-twl6040.o obj-$(CONFIG_GPIO_UNIPHIER) += gpio-uniphier.o +obj-$(CONFIG_GPIO_USBIO) += gpio-usbio.o obj-$(CONFIG_GPIO_VF610) += gpio-vf610.o obj-$(CONFIG_GPIO_VIPERBOARD) += gpio-viperboard.o obj-$(CONFIG_GPIO_VIRTUSER) += gpio-virtuser.o
drivers/gpio/gpio-usbio.c new file +247 -0
247 lines not on this page · raw message
Signature · 1 line
2.51.0
Re: [PATCH v5 2/3] gpio: Add Intel USBIO GPIO driver
Quoted 23 lines · Hans de Goede
From: Israel Cepeda <[email protected]>
Add a a driver for the GPIO auxbus child device of the Intel USBIO USB IO-expander used by the MIPI cameras on various new (Meteor Lake and later) Intel laptops.
Reviewed-by Linus Walleij <[email protected]>Co-developed-by Hans de Goede <[email protected]>Signed-off-by Hans de Goede <[email protected]>Signed-off-by Israel Cepeda <[email protected]>---
Changes in v5:
- MoveGPIO_USBIOKconfigoption under 'menu "USB GPIO expanders"'Changes in v4:
- Drop include <linux/dev_printk.h>, unneededauxiliary_set_drvdata()Changes in v3:
- Drop (offset >=gc->ngpio) check and makeusbio_gpio_get_bank_and_pin()return void
- Propagateusbio_gpio_set()ret val inusbio_gpio_direction_output()
- Usedevm_gpiochip_add_data()and dropauxiliary_driverremove()callback
Quoted 7 lines
Changes in v2:
- Add aconfig_mutexprotectusbio_gpio_update_config()calls, which read-modify-write banks[x].config, racing with each other
- Adjustusbio_gpio_get()to have an int return value and propagate theusbio_control_msg()return value
- Use__le16,__le32type +cpu_to_le16()and friends for on wire words
- Some small style fixes from Sakari's review
If Greg wants to take it:
or I can take it once patch 1/3 is in an immutable branch.
I'm fine either way.
Bartosz
Greg Kroah-Hartman
maintainerRe: [PATCH v5 2/3] gpio: Add Intel USBIO GPIO driver
Quoted 32 lines · Bartosz Golaszewski
Quoted 23 lines · Hans de Goede
From: Israel Cepeda <[email protected]>
Add a a driver for the GPIO auxbus child device of the Intel USBIO USB IO-expander used by the MIPI cameras on various new (Meteor Lake and later) Intel laptops.
Reviewed-by Linus Walleij <[email protected]>Co-developed-by Hans de Goede <[email protected]>Signed-off-by Hans de Goede <[email protected]>Signed-off-by Israel Cepeda <[email protected]>---
Changes in v5:
- MoveGPIO_USBIOKconfigoption under 'menu "USB GPIO expanders"'Changes in v4:
- Drop include <linux/dev_printk.h>, unneededauxiliary_set_drvdata()Changes in v3:
- Drop (offset >=gc->ngpio) check and makeusbio_gpio_get_bank_and_pin()return void
- Propagateusbio_gpio_set()ret val inusbio_gpio_direction_output()
- Usedevm_gpiochip_add_data()and dropauxiliary_driverremove()callbackQuoted 7 lines
Changes in v2:
- Add aconfig_mutexprotectusbio_gpio_update_config()calls, which read-modify-write banks[x].config, racing with each other
- Adjustusbio_gpio_get()to have an int return value and propagate theusbio_control_msg()return value
- Use__le16,__le32type +cpu_to_le16()and friends for on wire words
- Some small style fixes from Sakari's review
Quoted 5 lines
If Greg wants to take it:
or I can take it once patch 1/3 is in an immutable branch.
I'll just take it, simpler that way, thanks!
greg k-h
Hans de Goede
maintainerPATCH v5 3/3 i2c: Add Intel USBIO I2C driver
In reply to Hans de GoedeFrom: Israel Cepeda <[email protected]>
Add a a driver for the I2C auxbus child device of the Intel USBIO USB IO-expander used by the MIPI cameras on various new (Meteor Lake and later) Intel laptops.
---
Changes in v5:
- Drop some unnecessary dev_dbg() messages
- Add I2C_AQ_NO_ZERO_LEN to the adapter quirks
Changes in v2:
- Use new quirks mechanism to treat various revisions differently
- Use __le16, __le32 type + cpu_to_le16() and friends for on wire words
- Some small style fixes from Sakari's review
--- MAINTAINERS | 1 + drivers/i2c/busses/Kconfig | 11 ++ drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-usbio.c | 320 +++++++++++++++++++++++++++++++++ 4 files changed, 333 insertions(+) create mode 100644 drivers/i2c/busses/i2c-usbio.c
MAINTAINERS +1 -0
@@ -12706,6 +12706,7 @@ M: Hans de Goede <[email protected]> R: Sakari Ailus <[email protected]> S: Maintained F: drivers/gpio/gpio-usbio.c +F: drivers/i2c/busses/i2c-usbio.c F: drivers/usb/misc/usbio.c F: include/linux/usb/usbio.h
drivers/i2c/busses/Kconfig +11 -0
@@ -1357,6 +1357,17 @@ config I2C_LJCA This driver can also be built as a module. If so, the module will be called i2c-ljca. +config I2C_USBIO + tristate "Intel USBIO I2C Adapter support" + depends on USB_USBIO + default USB_USBIO + help + Select this option to enable I2C driver for the INTEL + USBIO driver stack. + + This driver can also be built as a module. If so, the module + will be called i2c_usbio. + config I2C_CP2615 tristate "Silicon Labs CP2615 USB sound card and I2C adapter" depends on USB
drivers/i2c/busses/Makefile +1 -0
@@ -135,6 +135,7 @@ obj-$(CONFIG_I2C_GXP) += i2c-gxp.o obj-$(CONFIG_I2C_DIOLAN_U2C) += i2c-diolan-u2c.o obj-$(CONFIG_I2C_DLN2) += i2c-dln2.o obj-$(CONFIG_I2C_LJCA) += i2c-ljca.o +obj-$(CONFIG_I2C_USBIO) += i2c-usbio.o obj-$(CONFIG_I2C_CP2615) += i2c-cp2615.o obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o obj-$(CONFIG_I2C_PCI1XXXX) += i2c-mchp-pci1xxxx.o
drivers/i2c/busses/i2c-usbio.c new file +320 -0
320 lines not on this page · raw message
Signature · 1 line
2.51.0