usb/gpio/i2c: Add Intel USBIO USB IO-expander drivers
Hans de Goede
maintainerv6 cover usb/gpio/i2c: Add Intel USBIO USB IO-expander drivers
Hi All,
Here is v6 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 v6:
- Drop I2C_FUNC_10BIT_ADDR from advertised I2C functionality
- Add Bart's Acked-by to the GPIO driver
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 v6 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
@@ -12694,6 +12694,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 v6 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
@@ -12699,6 +12699,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
Hans de Goede
maintainerPATCH v6 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 v6:
- Drop I2C_FUNC_10BIT_ADDR from advertised functionality
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
@@ -12700,6 +12700,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
Re: [PATCH v6 3/3] i2c: Add Intel USBIO I2C driver
Quoted 9 lines · Hans de Goede
From: 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.
Co-developed-by Hans de Goede <[email protected]>Signed-off-by Hans de Goede <[email protected]>Signed-off-by Israel Cepeda <[email protected]>
Hans de Goede
maintainerRe: [PATCH v6 3/3] i2c: Add Intel USBIO I2C driver
Hi Wolfram,
Quoted 7 lines · Wolfram Sang
Quoted 6 lines · Hans de Goede
From: 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.
Quoted 5 lines
Quoted 3 lines
Co-developed-by Hans de Goede <[email protected]>Signed-off-by Hans de Goede <[email protected]>Signed-off-by Israel Cepeda <[email protected]>Reviewed-by Wolfram Sang <[email protected]>
Thank you.
Is it ok if Greg picks this up together with the rest of the series?
Regards,
Hans
Re: [PATCH v6 3/3] i2c: Add Intel USBIO I2C driver
Quoted 7 lines
Quoted 2 lines
Reviewed-by Wolfram Sang <[email protected]>Thank you.
Is it ok if Greg picks this up together with the rest of the series?
Yes.
Greg Kroah-Hartman
maintainerRe: [PATCH v6 3/3] i2c: Add Intel USBIO I2C driver
Quoted 9 lines · Wolfram Sang
Quoted 7 lines
Quoted 2 lines
Reviewed-by Wolfram Sang <[email protected]>Thank you.
Is it ok if Greg picks this up together with the rest of the series?
Yes.
Great, I'll go queue it up in a bit, thanks!
greg k-h
Hi Hans,
Quoted 5 lines · Hans de Goede
Hi All,
Here is v6 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.
For the set:
Signature · 3 lines
Kind regards, Sakari Ailus