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

Message ID 4d00318d00bf0c946ee9b83e30e38d3b7a636183.1522868423.git.hns@goldelico.com
State New
Headers show
Series
  • none
Related show

Commit Message

H. Nikolaus Schaller April 4, 2018, 7 p.m.
It is not completely obvious that these are required as
some .dts files don't specify them.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
---
 .../devicetree/bindings/gpio/gpio-pca953x.txt      | 33 ++++++++++++++++++++++
 1 file changed, 33 insertions(+)

Comments

Rob Herring April 10, 2018, 1:57 p.m. | #1
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@goldelico.com>
> ---
>  .../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.

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

gpio@22

> +		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
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
H. Nikolaus Schaller April 10, 2018, 2:10 p.m. | #2
> Am 10.04.2018 um 15:57 schrieb Rob Herring <robh@kernel.org>:
> 
> 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@goldelico.com>
>> ---
>> .../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

--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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.
 
 Example:
 
@@ -48,3 +52,32 @@  Example:
 		interrupt-parent = <&gpio3>;
 		interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
 	};
+
+
+Example with Interrupts:
+
+
+	gpio99: tca6424@22 {
+		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 */
+	};
+