Re: [PATCH v2 5/5] DTS: Bindings: pca953x: add example how to use interrupt-controller and gpio-controller

From: H. Nikolaus Schaller
Date: Tue Apr 10 2018 - 10:10:43 EST



> Am 10.04.2018 um 15:57 schrieb Rob Herring <robh@xxxxxxxxxx>:
>
> On Wed, Apr 04, 2018 at 09:00:24PM +0200, H. Nikolaus Schaller wrote:
>> It is not completely obvious that these are required as
>> some .dts files don't specify them.
>>
>> Signed-off-by: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
>> ---
>> .../devicetree/bindings/gpio/gpio-pca953x.txt | 33 ++++++++++++++++++++++
>> 1 file changed, 33 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
>> index 6a7cddb187c1..7f3b50a6d681 100644
>> --- a/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
>> +++ b/Documentation/devicetree/bindings/gpio/gpio-pca953x.txt
>> @@ -36,6 +36,10 @@ Optional properties:
>> - reset-gpios: GPIO specification for the RESET input. This is an
>> active low signal to the PCA953x.
>> - vcc-supply: power supply regulator.
>> + - gpio-controller: if used as gpio expander.
>> + - #gpio-cells: if used as gpio expander.
>> + - interrupt-controller: if to be used as interrupt expander.
>> + - #interrupt-cells: if to be used as interrupt expander.
>
> These should be required. It's a mistake if dts files don't have them.

Well, it seems to be a config option if the chip handles interrupts
at all, but I also tend to say they are required.

>
>>
>> Example:
>>
>> @@ -48,3 +52,32 @@ Example:
>> interrupt-parent = <&gpio3>;
>> interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
>> };
>> +
>> +
>> +Example with Interrupts:
>> +
>> +
>> + gpio99: tca6424@22 {
>
> gpio@22

Ok!

>
>> + compatible = "nxp,pcal6524";
>> + reg = <0x22>;
>> + interrupt-parent = <&gpio6>;
>> + interrupts = <1 IRQ_TYPE_EDGE_FALLING>; /* gpio6_161 */
>> + interrupt-controller;
>> + #interrupt-cells = <2>;
>> + vcc-supply = <&vdds_1v8_main>;
>> + gpio-controller;
>> + #gpio-cells = <2>;
>> + gpio-line-names =
>> + "hdmi-ct-hpd", "hdmi.ls-oe", "p02", "p03", "vibra", "fault2", "p06", "p07",
>> + "en-usb", "en-host1", "en-host2", "chg-int", "p14", "p15", "mic-int", "en-modem",
>> + "shdn-hs-amp", "chg-status+red", "green", "blue", "en-esata", "fault1", "p26", "p27";
>> + };
>> +
>> + ts3a227@3b {
>> + compatible = "ti,ts3a227e";
>> + reg = <0x3b>;
>> + interrupt-parent = <&gpio99>;
>> + interrupts = <14 IRQ_TYPE_EDGE_RISING>;
>> + ti,micbias = <0>; /* 2.1V */
>> + };
>> +
>> --
>> 2.12.2
>>

BR and thanks,
Nikolaus