Re: [PATCH v2] pinctrl: Add SX150X GPIO Extender Pinctrl Driver
On Tue, Sep 27, 2016 at 5:48 PM, Neil Armstrong wrote: > Since the I2C sx150x GPIO expander driver uses platform_data to manage > the pins configurations, rewrite the driver as a pinctrl driver using > pinconf to get/set pin configurations from DT or debugfs. > > The pinctrl driver is functionnally equivalent as the gpio-only driver > and can use DT for pinconf. The platform_data confirmation is dropped. > > This patchset removed the gpio-only driver and selects the Pinctrl driver > config instead. This patchset also migrates the gpio dt-bindings to pinctrl > and add the pinctrl optional properties. > > The driver was tested with a SX1509 device on a BeagleBone black with > interrupt support and on an X86_64 machine over an I2C to USB converter. > > Signed-off-by: Neil Armstrong I think we're ready to apply this to the GPIO and pinctrl trees. Could you: - Rebase on top of v4.9-rc1 (fails to apply for me) - Add the collected ACKs - See if Andrey can provide an additional Test tag - Resend Also please look at Andreys patches to see if there is some good inspiration for further cleanups. Yours, Linus Walleij
Re: [PATCH v2] pinctrl: Add SX150X GPIO Extender Pinctrl Driver
On Tue, Sep 27, 2016 at 05:48:45PM +0200, Neil Armstrong wrote: > Since the I2C sx150x GPIO expander driver uses platform_data to manage > the pins configurations, rewrite the driver as a pinctrl driver using > pinconf to get/set pin configurations from DT or debugfs. > > The pinctrl driver is functionnally equivalent as the gpio-only driver > and can use DT for pinconf. The platform_data confirmation is dropped. > > This patchset removed the gpio-only driver and selects the Pinctrl driver > config instead. This patchset also migrates the gpio dt-bindings to pinctrl > and add the pinctrl optional properties. > > The driver was tested with a SX1509 device on a BeagleBone black with > interrupt support and on an X86_64 machine over an I2C to USB converter. > > Signed-off-by: Neil Armstrong > --- > This is a fixed version that builds and runs on non-OF platforms and on > arm based OF. The GPIO version is removed and the bindings are also moved > to the pinctrl bindings. > > One remaining question, should i2c_driver remove be implemented ? > It would be quite hard to implement due to the interrupt controller. > > Changes since v1 at > http://lkml.kernel.org/r/1473166599-29266-1-git-send-email-narmstr...@baylibre.com: > - Fix Kconfig descriptions on pinctrl and gpio > - Fix Kconfig dependency > - Remove oscio support for non-789 devices > - correct typo in dt bindings > - remove probe reset for non-789 devices > > Changes since RFC at > http://lkml.kernel.org/r/1472130692-14404-1-git-send-email-narmstr...@baylibre.com: > - Put #ifdef CONFIG_OF/CONFIG_OF_GPIO to remove OF code for non-of platforms > - No more rely on OF_GPIO config > - Moved and enhanced bindings to pinctrl bindings > - Removed gpio-sx150x.c > - Temporary select PINCTRL_SX150X when GPIO_SX150X > - Temporary mark GPIO_SX150X as deprecated > > > .../gpio-sx150x.txt => pinctrl/pinctrl-sx150x.txt} | 46 +- Acked-by: Rob Herring > drivers/gpio/Kconfig | 13 +- > drivers/gpio/Makefile |1 - > drivers/pinctrl/Kconfig| 14 + > drivers/pinctrl/Makefile |1 + > .../gpio-sx150x.c => pinctrl/pinctrl-sx150x.c} | 1179 > > 6 files changed, 782 insertions(+), 472 deletions(-) > rename Documentation/devicetree/bindings/{gpio/gpio-sx150x.txt => > pinctrl/pinctrl-sx150x.txt} (40%) > rename drivers/{gpio/gpio-sx150x.c => pinctrl/pinctrl-sx150x.c} (24%)
Re: [PATCH v2] pinctrl: Add SX150X GPIO Extender Pinctrl Driver
On 2016-09-27 17:48, Neil Armstrong wrote: > Since the I2C sx150x GPIO expander driver uses platform_data to manage > the pins configurations, rewrite the driver as a pinctrl driver using > pinconf to get/set pin configurations from DT or debugfs. > > The pinctrl driver is functionnally equivalent as the gpio-only driver > and can use DT for pinconf. The platform_data confirmation is dropped. > > This patchset removed the gpio-only driver and selects the Pinctrl driver > config instead. This patchset also migrates the gpio dt-bindings to pinctrl > and add the pinctrl optional properties. > > The driver was tested with a SX1509 device on a BeagleBone black with > interrupt support and on an X86_64 machine over an I2C to USB converter. > > Signed-off-by: Neil Armstrong Works here for sx1502 (without interrupts) on a custom arm board (SAMA5D3). Tested-by: Peter Rosin Cheers, Peter
[PATCH v2] pinctrl: Add SX150X GPIO Extender Pinctrl Driver
Since the I2C sx150x GPIO expander driver uses platform_data to manage the pins configurations, rewrite the driver as a pinctrl driver using pinconf to get/set pin configurations from DT or debugfs. The pinctrl driver is functionnally equivalent as the gpio-only driver and can use DT for pinconf. The platform_data confirmation is dropped. This patchset removed the gpio-only driver and selects the Pinctrl driver config instead. This patchset also migrates the gpio dt-bindings to pinctrl and add the pinctrl optional properties. The driver was tested with a SX1509 device on a BeagleBone black with interrupt support and on an X86_64 machine over an I2C to USB converter. Signed-off-by: Neil Armstrong --- This is a fixed version that builds and runs on non-OF platforms and on arm based OF. The GPIO version is removed and the bindings are also moved to the pinctrl bindings. One remaining question, should i2c_driver remove be implemented ? It would be quite hard to implement due to the interrupt controller. Changes since v1 at http://lkml.kernel.org/r/1473166599-29266-1-git-send-email-narmstr...@baylibre.com: - Fix Kconfig descriptions on pinctrl and gpio - Fix Kconfig dependency - Remove oscio support for non-789 devices - correct typo in dt bindings - remove probe reset for non-789 devices Changes since RFC at http://lkml.kernel.org/r/1472130692-14404-1-git-send-email-narmstr...@baylibre.com: - Put #ifdef CONFIG_OF/CONFIG_OF_GPIO to remove OF code for non-of platforms - No more rely on OF_GPIO config - Moved and enhanced bindings to pinctrl bindings - Removed gpio-sx150x.c - Temporary select PINCTRL_SX150X when GPIO_SX150X - Temporary mark GPIO_SX150X as deprecated .../gpio-sx150x.txt => pinctrl/pinctrl-sx150x.txt} | 46 +- drivers/gpio/Kconfig | 13 +- drivers/gpio/Makefile |1 - drivers/pinctrl/Kconfig| 14 + drivers/pinctrl/Makefile |1 + .../gpio-sx150x.c => pinctrl/pinctrl-sx150x.c} | 1179 6 files changed, 782 insertions(+), 472 deletions(-) rename Documentation/devicetree/bindings/{gpio/gpio-sx150x.txt => pinctrl/pinctrl-sx150x.txt} (40%) rename drivers/{gpio/gpio-sx150x.c => pinctrl/pinctrl-sx150x.c} (24%) diff --git a/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt b/Documentation/devicetree/bindings/pinctrl/pinctrl-sx150x.txt similarity index 40% rename from Documentation/devicetree/bindings/gpio/gpio-sx150x.txt rename to Documentation/devicetree/bindings/pinctrl/pinctrl-sx150x.txt index c809acb..c293c8a 100644 --- a/Documentation/devicetree/bindings/gpio/gpio-sx150x.txt +++ b/Documentation/devicetree/bindings/pinctrl/pinctrl-sx150x.txt @@ -1,34 +1,54 @@ SEMTECH SX150x GPIO expander bindings +Please refer to pinctrl-bindings.txt, ../gpio/gpio.txt, and +../interrupt-controller/interrupts.txt for generic information regarding +pin controller, GPIO, and interrupt bindings. Required properties: - -- compatible: should be "semtech,sx1506q", +- compatible: should be one of : + "semtech,sx1506q", "semtech,sx1508q", "semtech,sx1509q", "semtech,sx1502q". - reg: The I2C slave address for this device. -- interrupt-parent: phandle of the parent interrupt controller. - -- interrupts: Interrupt specifier for the controllers interrupt. - - #gpio-cells: Should be 2. The first cell is the GPIO number and the second cell is used to specify optional parameters: bit 0: polarity (0: normal, 1: inverted) - gpio-controller: Marks the device as a GPIO controller. +Optional properties : +- interrupt-parent: phandle of the parent interrupt controller. + +- interrupts: Interrupt specifier for the controllers interrupt. + - interrupt-controller: Marks the device as a interrupt controller. +- semtech,probe-reset: Will trigger a reset of the GPIO expander on probe, + only for sx1508q and sx1509q + The GPIO expander can optionally be used as an interrupt controller, in -which case it uses the default two cell specifier as described in -Documentation/devicetree/bindings/interrupt-controller/interrupts.txt. +which case it uses the default two cell specifier. + +Required properties for pin configuration sub-nodes: + - pins: List of pins to which the configuration applies. + +Optional properties for pin configuration sub-nodes: + + - bias-disable: disable any pin bias, except the OSCIO pin + - bias-pull-up: pull up the pin, except the OSCIO pin + - bias-pull-down: pull down the pin, except the OSCIO pin + - bias-pull-pin-default: use pin-default pull state, except the OSCIO pin + - drive-push-pull: drive actively high and low + - drive-open-drain: drive with open drain only for sx1508q and sx1509q and except the OSCIO pin + - output-low: set