pinctrl: Add Cypress cy8c95x0
Subsystems (4)
Patrick Rudolph
maintainerv2 cover pinctrl: Add Cypress cy8c95x0
Add Cypress cy8c95x0 pinctrl support.
v2:
- Update DT binding
- Support output pincfg through DT
- Always expose all GPIOs and ignore ngpios property
Patrick Rudolph (2):
dt-binding: Add cypress,cy8c95x0 binding
pinctrl: Add Cypress cy8c95x0 support
.../bindings/pinctrl/cypress,cy8c95x0.yaml | 131 ++ MAINTAINERS | 6 + drivers/pinctrl/Kconfig | 14 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-cy8c95x0.c | 1380 +++++++++++++++++ 5 files changed, 1532 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml create mode 100644 drivers/pinctrl/pinctrl-cy8c95x0.c
Signature · 1 line
2.35.3
Patrick Rudolph
maintainerPATCH v2 1/2 dt-binding: Add cypress,cy8c95x0 binding
Added device tree binding documentation for
Cypress CY8C95x0 I2C pin-controller.
--- .../bindings/pinctrl/cypress,cy8c95x0.yaml | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml new file +131 -0
@@ -0,0 +1,131 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/cypress,cy8c95x0.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cypress CY8C95X0 I2C GPIO expander + +maintainers: + - Patrick Rudolph <[email protected]> + +description: | + This supports the 20/40/60 pin Cypress CYC95x0 GPIO I2C expanders. + Pin function configuration is performed on a per-pin basis. + +properties: + compatible: + enum: + - cypress,cy8c9520 + - cypress,cy8c9540 + - cypress,cy8c9560 + + reg: + maxItems: 1 + + gpio-controller: true + + '#gpio-cells': + description: + The first cell is the GPIO number and the second cell specifies GPIO + flags, as defined in <dt-bindings/gpio/gpio.h>. + const: 2 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + '#interrupt-cells': + const: 2 + + gpio-line-names: true + + gpio-ranges: + maxItems: 1 + + gpio-reserved-ranges: + maxItems: 1 + + vdd-supply: + description: + Optional power supply. + +patternProperties: + '-pins$': + type: object + description: + Pinctrl node's client devices use subnodes for desired pin configuration. + Client device subnodes use below standard properties. + $ref: "/schemas/pinctrl/pincfg-node.yaml" + + properties: + pins: + description: + List of gpio pins affected by the properties specified in this + subnode. + items: + - pattern: "^gp([0-7][0-7])$" + function: + description: + Specify the alternative function to be configured for the specified + pins. + enum: [ gpio, pwm ] + + bias-pull-down: true + + bias-pull-up: true + + bias-disable: true + + output-high: true + + output-low: true + + drive-push-pull: true + + drive-open-drain: true + + drive-open-source: true + + required: + - pins + - function + + additionalProperties: false + +required: + - compatible + - reg + - interrupts + - interrupt-controller + - '#interrupt-cells' + - gpio-controller + - '#gpio-cells' + +additionalProperties: false + +allOf: + - $ref: "pinctrl.yaml#" + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + pinctrl@20 { + compatible = "cypress,cy8c9520"; + reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + #interrupt-cells = <2>; + interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + vdd-supply = <&p3v3>; + gpio-reserved-ranges = <5 1>; + }; + };
Signature · 1 line
2.35.3
Re: [PATCH v2 1/2] dt-binding: Add cypress,cy8c95x0 binding
Quoted 4 lines · Patrick Rudolph
Added device tree binding documentation for
Cypress CY8C95x0 I2C pin-controller.Signed-off-by Patrick Rudolph <[email protected]>
The subject is still wrong. You need subsystem prefix (pinctrl) and you can skip final "binding" word, as it is implied by dt-bindings.
Quoted 61 lines
--- .../bindings/pinctrl/cypress,cy8c95x0.yaml | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yamlDocumentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml new file +50
-0@@ -0,0 +1,131 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pinctrl/cypress,cy8c95x0.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Cypress CY8C95X0 I2C GPIO expander + +maintainers: + - Patrick Rudolph <[email protected]> + +description: | + This supports the 20/40/60 pin Cypress CYC95x0 GPIO I2C expanders. + Pin function configuration is performed on a per-pin basis. + +properties: + compatible: + enum: + - cypress,cy8c9520 + - cypress,cy8c9540 + - cypress,cy8c9560 + + reg: + maxItems: 1 + + gpio-controller: true + + '#gpio-cells': + description: + The first cell is the GPIO number and the second cell specifies GPIO + flags, as defined in <dt-bindings/gpio/gpio.h>. + const: 2 + + interrupts: + maxItems: 1 + + interrupt-controller: true + + '#interrupt-cells': + const: 2 + + gpio-line-names: true + + gpio-ranges: + maxItems: 1 + + gpio-reserved-ranges: + maxItems: 1 + + vdd-supply:
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml line 60
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml new file +10
-0+ description: + Optional power supply. + +patternProperties: + '-pins$': + type: object + description: + Pinctrl node's client devices use subnodes for desired pin configuration. + Client device subnodes use below standard properties. + $ref: "/schemas/pinctrl/pincfg-node.yaml"
Skip quotes.
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml line 68
Quoted 8 lines
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml new file +8
-0+ + properties: + pins: + description: + List of gpio pins affected by the properties specified in this + subnode. + items: + - pattern: "^gp([0-7][0-7])$"
Use the same type of quotes everywhere - either ' or ". Does it actually work? It looks like you allow here only one pin but the description suggests it is a list of pins. I think you wanted here just "pattern:
..." without leading minus. Then you need also min and maxItems.
Why blank line here disappeared? My comment was in different place.
Quoted 38 lines
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml new file +38
-0+ function: + description: + Specify the alternative function to be configured for the specified + pins. + enum: [ gpio, pwm ] + + bias-pull-down: true + + bias-pull-up: true + + bias-disable: true + + output-high: true + + output-low: true + + drive-push-pull: true + + drive-open-drain: true + + drive-open-source: true + + required: + - pins + - function + + additionalProperties: false + +required: + - compatible + - reg + - interrupts + - interrupt-controller + - '#interrupt-cells' + - gpio-controller + - '#gpio-cells' + +additionalProperties: false
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml line 116
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml new file +10
-0+ +allOf: + - $ref: "pinctrl.yaml#" + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/interrupt-controller/irq.h> + + i2c0 {
Just "i2c".
Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml new file +5
-0+ #address-cells = <1>; + #size-cells = <0>; + + pinctrl@20 { + compatible = "cypress,cy8c9520";
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml line 131
Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml new file +10
-0+ reg = <0x20>; + gpio-controller; + #gpio-cells = <2>; + #interrupt-cells = <2>; + interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; + interrupt-controller; + vdd-supply = <&p3v3>; + gpio-reserved-ranges = <5 1>; + }; + };
Best regards,
Krzysztof
Patrick Rudolph
maintainerPATCH v2 2/2 pinctrl: Add Cypress cy8c95x0 support
In reply to Patrick RudolphAdd support for cypress I2C GPIO expanders cy8c9520, cy8c9540 and cy8c9560. The GPIO expanders feature a PWM mode, thus add it as pinctrl driver.
The chip features multiple drive modes for each pin when configured as output and multiple bias settings when configured as input.
Tested all three components and verified that all functionality is fully working.
Datasheet: https://www.cypress.com/file/37971/download
--- MAINTAINERS | 6 + drivers/pinctrl/Kconfig | 14 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-cy8c95x0.c | 1380 ++++++++++++++++++++++++++++ 4 files changed, 1401 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-cy8c95x0.c
MAINTAINERS +6 -0
@@ -5393,6 +5393,12 @@ Q: http://patchwork.linuxtv.org/project/linux-media/list/ T: git git://linuxtv.org/anttip/media_tree.git F: drivers/media/common/cypress_firmware* +CYPRESS CY8C95X0 PINCTRL DRIVER +M: Patrick Rudolph <[email protected]> +L: [email protected] +S: Maintained +F: drivers/pinctrl/pinctrl-cy8c95x0.c + CYPRESS CY8CTMA140 TOUCHSCREEN DRIVER M: Linus Walleij <[email protected]> L: [email protected]
drivers/pinctrl/Kconfig +14 -0
@@ -135,6 +135,20 @@ config PINCTRL_BM1880 help Pinctrl driver for Bitmain BM1880 SoC. +config PINCTRL_CY8C95X0 + tristate "Cypress CY8C95X0 I2C pinctrl and GPIO driver" + depends on I2C && OF + select GPIOLIB + select GPIOLIB_IRQCHIP + select PINMUX + select PINCONF + select GENERIC_PINCONF + select REGMAP_I2C + help + Support for 20/40/60 pin Cypress Cy8C95x0 pinctrl/gpio I2C expander. + This driver can also be built as a module. If so, the module will be + called pinctrl-cy8c95x0. + config PINCTRL_DA850_PUPD tristate "TI DA850/OMAP-L138/AM18XX pull-up and pull-down groups" depends on OF && (ARCH_DAVINCI_DA850 || COMPILE_TEST)
drivers/pinctrl/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o obj-$(CONFIG_PINCTRL_AT91PIO4) += pinctrl-at91-pio4.o obj-$(CONFIG_PINCTRL_AXP209) += pinctrl-axp209.o obj-$(CONFIG_PINCTRL_BM1880) += pinctrl-bm1880.o +obj-$(CONFIG_PINCTRL_CY8C95X0) += pinctrl-cy8c95x0.o obj-$(CONFIG_PINCTRL_DA850_PUPD) += pinctrl-da850-pupd.o obj-$(CONFIG_PINCTRL_DA9062) += pinctrl-da9062.o obj-$(CONFIG_PINCTRL_DIGICOLOR) += pinctrl-digicolor.o
drivers/pinctrl/pinctrl-cy8c95x0.c new file +1380 -0
1,380 lines not on this page · raw message
Signature · 1 line
2.35.3
Re: [PATCH v2 2/2] pinctrl: Add Cypress cy8c95x0 support
Quoted 7 lines · Patrick Rudolph
Add support for cypress I2C GPIO expanders cy8c9520, cy8c9540 and cy8c9560. The GPIO expanders feature a PWM mode, thus add it as pinctrl driver.
The chip features multiple drive modes for each pin when configured as output and multiple bias settings when configured as input.
Quoted 6 lines
Tested all three components and verified that all functionality is fully working.
Datasheet: https://www.cypress.com/file/37971/download
Signed-off-by Patrick Rudolph <[email protected]>Signed-off-by Naresh Solanki <[email protected]>
Looks good to me, I see there are still some comments on the bindings, once that is fixed this is good to go.
Yours,
Linus Walleij