Message ID | 20220629143046.213584-5-aidanmacdonald.0x0@gmail.com (mailing list archive) |
---|---|
State | Handled Elsewhere |
Headers | show |
Series | Add support for AXP192 PMIC | expand |
On 29/06/2022 16:30, Aidan MacDonald wrote: > The AXP192 PMIC is different enough from the PMICs supported by > the AXP20x GPIO driver to warrant a separate driver. The AXP192 > driver also supports interrupts and pinconf settings. > > Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> > --- > .../bindings/gpio/x-powers,axp192-gpio.yaml | 68 +++++++++++++++++++ > 1 file changed, 68 insertions(+) > create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml > > diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml > new file mode 100644 > index 000000000000..ceb94aa2bc97 > --- /dev/null > +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml > @@ -0,0 +1,68 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: "http://devicetree.org/schemas/gpio/x-powers,axp192-gpio.yaml#" > +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > + If there is going to be next version, please drop the quotes for these two. In every patch. Anyway: Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
On 6/29/22 9:30 AM, Aidan MacDonald wrote: > The AXP192 PMIC is different enough from the PMICs supported by > the AXP20x GPIO driver to warrant a separate driver. The AXP192 > driver also supports interrupts and pinconf settings. > > Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> > --- > .../bindings/gpio/x-powers,axp192-gpio.yaml | 68 +++++++++++++++++++ > 1 file changed, 68 insertions(+) > create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml > > diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml > new file mode 100644 > index 000000000000..ceb94aa2bc97 > --- /dev/null > +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml > [...] > + > +required: > + - compatible > + - "#gpio-cells" > + - gpio-controller > + - gpio-ranges By requiring the gpio-ranges property, you will not be able to convert the existing driver, as existing devicetrees do not have it. If you instead call pinctrl_add_gpio_range() from the driver, you can maintain compatibility with the existing binding. Regards, Samuel
Samuel Holland <samuel@sholland.org> writes: > On 6/29/22 9:30 AM, Aidan MacDonald wrote: >> The AXP192 PMIC is different enough from the PMICs supported by >> the AXP20x GPIO driver to warrant a separate driver. The AXP192 >> driver also supports interrupts and pinconf settings. >> >> Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> >> --- >> .../bindings/gpio/x-powers,axp192-gpio.yaml | 68 +++++++++++++++++++ >> 1 file changed, 68 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml >> >> diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml >> b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml >> new file mode 100644 >> index 000000000000..ceb94aa2bc97 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml >> [...] >> + >> +required: >> + - compatible >> + - "#gpio-cells" >> + - gpio-controller >> + - gpio-ranges > > By requiring the gpio-ranges property, you will not be able to convert the > existing driver, as existing devicetrees do not have it. > > If you instead call pinctrl_add_gpio_range() from the driver, you can maintain > compatibility with the existing binding. > > Regards, > Samuel Originally I did use pinctrl_add_gpio_range(), but calling that from a pin control driver is apparently deprecated. It can be done from ->of_gpio_ranges_fallback to deal with old device trees, though.
diff --git a/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml new file mode 100644 index 000000000000..ceb94aa2bc97 --- /dev/null +++ b/Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml @@ -0,0 +1,68 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/gpio/x-powers,axp192-gpio.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: X-Powers AXP192 GPIO Device Tree Bindings + +maintainers: + - Chen-Yu Tsai <wens@csie.org> + +properties: + compatible: + const: x-powers,axp192-gpio + + gpio-controller: true + + "#gpio-cells": + const: 2 + description: > + The first cell is the pin number and the second is the GPIO flags. + + gpio-ranges: + maxItems: 1 + +patternProperties: + "-pins$": + $ref: /schemas/pinctrl/pinmux-node.yaml# + + properties: + pins: + items: + enum: + - GPIO0 + - GPIO1 + - GPIO2 + - GPIO3 + - GPIO4 + - N_RSTO + + function: + enum: + - output + - input + - ldo + - pwm + - adc + - low_output + - floating + - ext_chg_ctl + - ldo_status + +required: + - compatible + - "#gpio-cells" + - gpio-controller + - gpio-ranges + +additionalProperties: false + +examples: + - | + pinctrl0: gpio { + compatible = "x-powers,axp192-gpio"; + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&pinctrl0 0 0 6>; + };
The AXP192 PMIC is different enough from the PMICs supported by the AXP20x GPIO driver to warrant a separate driver. The AXP192 driver also supports interrupts and pinconf settings. Signed-off-by: Aidan MacDonald <aidanmacdonald.0x0@gmail.com> --- .../bindings/gpio/x-powers,axp192-gpio.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/x-powers,axp192-gpio.yaml