diff mbox series

[1/3] dt-bindings: extcon-usb-gpio: convert to DT schema format

Message ID 20230608081153.441455-1-alexander.stein@ew.tq-group.com
State Changes Requested, archived
Headers show
Series [1/3] dt-bindings: extcon-usb-gpio: convert to DT schema format | expand

Checks

Context Check Description
robh/checkpatch warning total: 0 errors, 2 warnings, 52 lines checked
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Alexander Stein June 8, 2023, 8:11 a.m. UTC
Convert the binding to DT schema format. Change the GPIO properties to new
naming convention using -gpios as well.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 .../bindings/extcon/extcon-usb-gpio.txt       | 21 --------
 .../bindings/extcon/extcon-usb-gpio.yaml      | 52 +++++++++++++++++++
 2 files changed, 52 insertions(+), 21 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
 create mode 100644 Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml

Comments

Heiko Stuebner June 8, 2023, 8:21 a.m. UTC | #1
Am Donnerstag, 8. Juni 2023, 10:11:53 CEST schrieb Alexander Stein:
> Use id-gpios and vbus-gpios instead.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi                 | 2 +-

Acked-by: Heiko Stuebner <heiko@sntech.de> #rockchip


>  23 files changed, 26 insertions(+), 26 deletions(-)

> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
> index aa3e21bd6c8f4..20e3f41efe97f 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
> @@ -27,7 +27,7 @@ module_led: led-0 {
>  
>  	extcon_usb3: extcon-usb3 {
>  		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&usb3_id>;
>  	};
>
Krzysztof Kozlowski June 12, 2023, 8:29 a.m. UTC | #2
On 08/06/2023 10:11, Alexander Stein wrote:
> Convert the binding to DT schema format. Change the GPIO properties to new
> naming convention using -gpios as well.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  .../bindings/extcon/extcon-usb-gpio.txt       | 21 --------
>  .../bindings/extcon/extcon-usb-gpio.yaml      | 52 +++++++++++++++++++
>  2 files changed, 52 insertions(+), 21 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
>  create mode 100644 Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml
> 
> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> deleted file mode 100644
> index dfc14f71e81fb..0000000000000
> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> +++ /dev/null
> @@ -1,21 +0,0 @@
> -USB GPIO Extcon device
> -
> -This is a virtual device used to generate USB cable states from the USB ID pin
> -connected to a GPIO pin.
> -
> -Required properties:
> -- compatible: Should be "linux,extcon-usb-gpio"
> -
> -Either one of id-gpio or vbus-gpio must be present. Both can be present as well.
> -- id-gpio: gpio for USB ID pin. See gpio binding.
> -- vbus-gpio: gpio for USB VBUS pin.
> -
> -Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below:
> -	extcon_usb1 {
> -		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&gpio6 1 GPIO_ACTIVE_HIGH>;
> -	}
> -
> -	&omap_dwc3_1 {
> -		extcon = <&extcon_usb1>;
> -	};
> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml
> new file mode 100644
> index 0000000000000..3a71d848dc7a8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml
> @@ -0,0 +1,52 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/extcon/extcon-usb-gpio.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: USB GPIO Extcon device
> +
> +maintainers:
> +  - Alexander Stein <alexander.stein@ew.tq-group.com>
> +
> +description: |
> +  This is a virtual device used to generate USB cable states from the
> +  USB ID pin connected to a GPIO pin.
> +
> +properties:
> +  compatible:
> +    const: linux,extcon-usb-gpio
> +
> +  id-gpios:
> +    description: An input gpio for USB ID pin.
> +    maxItems: 1
> +
> +  vbus-gpios:
> +    description: An input gpio for USB VBus pin, used to detect presence of
> +      VBUS 5V.
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +
> +anyOf:

oneOf instead

> +  - required:
> +      - id-gpios
> +  - required:
> +      - vbus-gpios
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    extcon_usb1 {

No underscores, generic node names, so just "extcon-usb"

> +      compatible = "linux,extcon-usb-gpio";
> +      id-gpios = <&gpio6 1 GPIO_ACTIVE_HIGH>;
> +      vbus-gpios = <&gpio6 2 GPIO_ACTIVE_HIGH>;
> +    };
> +
> +    usb-controller {
> +      extcon = <&extcon_usb1>;
> +    };

Drop controller, no need to add consumers in a provider's binding.

Best regards,
Krzysztof
Matthias Brugger June 12, 2023, 10:58 a.m. UTC | #3
On 08/06/2023 10:11, Alexander Stein wrote:
> Use id-gpios and vbus-gpios instead.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>   arch/arm64/boot/dts/freescale/imx8mp-msc-sm2s.dtsi            | 2 +-
>   arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts       | 2 +-
>   arch/arm64/boot/dts/mediatek/mt2712-evb.dts                   | 4 ++--
>   arch/arm64/boot/dts/mediatek/mt8173-evb.dts                   | 2 +-

For mediatek:
Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

>   arch/arm64/boot/dts/qcom/apq8016-sbc.dts                      | 2 +-
>   arch/arm64/boot/dts/qcom/apq8096-db820c.dts                   | 4 ++--
>   arch/arm64/boot/dts/qcom/msm8916-acer-a1-724.dts              | 2 +-
>   arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts          | 2 +-
>   arch/arm64/boot/dts/qcom/msm8916-gplus-fl8005a.dts            | 2 +-
>   arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts                | 2 +-
>   arch/arm64/boot/dts/qcom/msm8916-longcheer-l8910.dts          | 2 +-
>   arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts         | 2 +-
>   arch/arm64/boot/dts/qcom/msm8939-sony-xperia-kanuti-tulip.dts | 2 +-
>   arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone-dora.dts    | 2 +-
>   arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone.dtsi        | 2 +-
>   arch/arm64/boot/dts/qcom/msm8998-fxtec-pro1.dts               | 2 +-
>   arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi     | 4 ++--
>   arch/arm64/boot/dts/qcom/sda660-inforce-ifc6560.dts           | 2 +-
>   arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi         | 2 +-
>   arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts           | 2 +-
>   arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts  | 2 +-
>   arch/arm64/boot/dts/qcom/sm6125-xiaomi-laurel-sprout.dts      | 2 +-
>   arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi                 | 2 +-
>   23 files changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx8mp-msc-sm2s.dtsi b/arch/arm64/boot/dts/freescale/imx8mp-msc-sm2s.dtsi
> index 5dbec71747c3b..61c2a63efc6db 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mp-msc-sm2s.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mp-msc-sm2s.dtsi
> @@ -109,7 +109,7 @@ extcon_usb0: extcon-usb0 {
>   		compatible = "linux,extcon-usb-gpio";
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&pinctrl_usb0_extcon>;
> -		id-gpio = <&gpio1 3 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
>   	};
>   };
>   
> diff --git a/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts b/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts
> index d4ae7a3efff87..9e53b214abc85 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts
> +++ b/arch/arm64/boot/dts/freescale/imx8mq-tqma8mq-mba8mx.dts
> @@ -24,7 +24,7 @@ extcon_usbotg: extcon-usbotg0 {
>   		compatible = "linux,extcon-usb-gpio";
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&pinctrl_usbcon0>;
> -		id-gpio = <&gpio1 10 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
>   	};
>   
>   	pcie0_refclk: pcie0-refclk {
> diff --git a/arch/arm64/boot/dts/mediatek/mt2712-evb.dts b/arch/arm64/boot/dts/mediatek/mt2712-evb.dts
> index fffdb7bbf889e..0c38f7b517637 100644
> --- a/arch/arm64/boot/dts/mediatek/mt2712-evb.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt2712-evb.dts
> @@ -43,12 +43,12 @@ cpus_fixed_vproc1: regulator-vproc-buck1 {
>   
>   	extcon_usb: extcon_iddig {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&pio 12 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
>   	};
>   
>   	extcon_usb1: extcon_iddig1 {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&pio 14 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&pio 14 GPIO_ACTIVE_HIGH>;
>   	};
>   
>   	usb_p0_vbus: regulator-usb-p0-vbus {
> diff --git a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
> index 5122963d8743a..607d65ddba9ec 100644
> --- a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
> +++ b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts
> @@ -41,7 +41,7 @@ hdmi_connector_in: endpoint {
>   
>   	extcon_usb: extcon_iddig {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&pio 16 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&pio 16 GPIO_ACTIVE_HIGH>;
>   	};
>   
>   	usb_p1_vbus: regulator@0 {
> diff --git a/arch/arm64/boot/dts/qcom/apq8016-sbc.dts b/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
> index 56dfca61253e6..8b8cb392e851d 100644
> --- a/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
> +++ b/arch/arm64/boot/dts/qcom/apq8016-sbc.dts
> @@ -77,7 +77,7 @@ usb2513 {
>   
>   	usb_id: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 121 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 121 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb_id_default>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/apq8096-db820c.dts b/arch/arm64/boot/dts/qcom/apq8096-db820c.dts
> index b599909c44639..be657df89e734 100644
> --- a/arch/arm64/boot/dts/qcom/apq8096-db820c.dts
> +++ b/arch/arm64/boot/dts/qcom/apq8096-db820c.dts
> @@ -99,14 +99,14 @@ button {
>   
>   	usb2_id: usb2-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&pmi8994_gpios 6 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&pmi8994_gpios 6 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb2_vbus_det_gpio>;
>   	};
>   
>   	usb3_id: usb3-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&pm8994_gpios 22 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&pm8994_gpios 22 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb3_vbus_det_gpio>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8916-acer-a1-724.dts b/arch/arm64/boot/dts/qcom/msm8916-acer-a1-724.dts
> index 5025c08e48173..9b4270ba0652f 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916-acer-a1-724.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8916-acer-a1-724.dts
> @@ -48,7 +48,7 @@ button-volume-up {
>   
>   	usb_id: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 110 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb_id_default>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts b/arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts
> index 7b629243ef0d7..5e69c32c297eb 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8916-alcatel-idol347.dts
> @@ -52,7 +52,7 @@ led-0 {
>   
>   	usb_id: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 69 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 69 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb_id_default>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8916-gplus-fl8005a.dts b/arch/arm64/boot/dts/qcom/msm8916-gplus-fl8005a.dts
> index 56c42b0c97336..ada2eda5dacdb 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916-gplus-fl8005a.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8916-gplus-fl8005a.dts
> @@ -75,7 +75,7 @@ led-green {
>   
>   	usb_id: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 110 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
>   		pinctrl-0 = <&usb_id_default>;
>   		pinctrl-names = "default";
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts b/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
> index 175ca011998c6..f3eb7367db3e0 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8916-huawei-g7.dts
> @@ -80,7 +80,7 @@ led-2 {
>   
>   	usb_id: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 117 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 117 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb_id_default>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8910.dts b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8910.dts
> index f23cfb2bf7934..4c19738af23ea 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8910.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8916-longcheer-l8910.dts
> @@ -68,7 +68,7 @@ led-0 {
>   
>   	usb_id: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 110 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb_id_default>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
> index 733917531218c..27e02021b577a 100644
> --- a/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8916-wingtech-wt88047.dts
> @@ -56,7 +56,7 @@ button-volume-up {
>   
>   	usb_id: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 110 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb_id_default>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8939-sony-xperia-kanuti-tulip.dts b/arch/arm64/boot/dts/qcom/msm8939-sony-xperia-kanuti-tulip.dts
> index 85a8d8fe212ff..ae522f4c0aaec 100644
> --- a/arch/arm64/boot/dts/qcom/msm8939-sony-xperia-kanuti-tulip.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8939-sony-xperia-kanuti-tulip.dts
> @@ -32,7 +32,7 @@ chosen {
>   
>   	usb_id: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 110 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
>   		pinctrl-0 = <&usb_id_default>;
>   		pinctrl-names = "default";
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone-dora.dts b/arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone-dora.dts
> index 4a0645db0ae14..6374c5f53d9a1 100644
> --- a/arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone-dora.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone-dora.dts
> @@ -24,5 +24,5 @@ &usb_detect {
>   };
>   
>   &usb3_id {
> -	id-gpio = <&tlmm 24 GPIO_ACTIVE_LOW>;
> +	id-gpios = <&tlmm 24 GPIO_ACTIVE_LOW>;
>   };
> diff --git a/arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone.dtsi b/arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone.dtsi
> index b4b770a9277dc..d55e4075040ff 100644
> --- a/arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8996-sony-xperia-tone.dtsi
> @@ -71,7 +71,7 @@ panel_tvdd: tvdd-regulator {
>   
>   	usb3_id: usb3-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 25 GPIO_ACTIVE_LOW>;
> +		id-gpios = <&tlmm 25 GPIO_ACTIVE_LOW>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb_detect>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/msm8998-fxtec-pro1.dts b/arch/arm64/boot/dts/qcom/msm8998-fxtec-pro1.dts
> index b35e2d9f428c1..b6a214bea70f5 100644
> --- a/arch/arm64/boot/dts/qcom/msm8998-fxtec-pro1.dts
> +++ b/arch/arm64/boot/dts/qcom/msm8998-fxtec-pro1.dts
> @@ -31,7 +31,7 @@ aliases {
>   	 */
>   	extcon_usb: extcon-usb {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 38 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 38 GPIO_ACTIVE_HIGH>;
>   	};
>   
>   	gpio-hall-sensors {
> diff --git a/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi b/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi
> index 687e96068cb2b..876c6921ddf07 100644
> --- a/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi
> +++ b/arch/arm64/boot/dts/qcom/msm8998-sony-xperia-yoshino.dtsi
> @@ -89,8 +89,8 @@ vph_pwr: vph-pwr-regulator {
>   
>   	extcon_usb: extcon-usb {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 38 GPIO_ACTIVE_HIGH>;
> -		vbus-gpio = <&tlmm 128 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 38 GPIO_ACTIVE_HIGH>;
> +		vbus-gpios = <&tlmm 128 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&cc_dir_default &usb_detect_en>;
>   	};
> diff --git a/arch/arm64/boot/dts/qcom/sda660-inforce-ifc6560.dts b/arch/arm64/boot/dts/qcom/sda660-inforce-ifc6560.dts
> index 7459525d99828..0c1352b8f2645 100644
> --- a/arch/arm64/boot/dts/qcom/sda660-inforce-ifc6560.dts
> +++ b/arch/arm64/boot/dts/qcom/sda660-inforce-ifc6560.dts
> @@ -43,7 +43,7 @@ key-volup {
>   	 */
>   	extcon_usb: extcon-usb {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 58 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>;
>   	};
>   
>   	hdmi-out {
> diff --git a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
> index 3033723fc6ff3..87d0293c728d8 100644
> --- a/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sdm630-sony-xperia-nile.dtsi
> @@ -150,7 +150,7 @@ cont_splash_mem: splash@9d400000 {
>   	 */
>   	extcon_usb: extcon-usb {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 58 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>;
>   	};
>   };
>   
> diff --git a/arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts b/arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts
> index 8fb2d17887424..3c47410ba94c0 100644
> --- a/arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts
> +++ b/arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts
> @@ -85,7 +85,7 @@ framebuffer_mem: memory@9d400000 {
>   	 */
>   	extcon_usb: extcon-usb {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 58 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>;
>   	};
>   };
>   
> diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
> index 9f8a9ef398a26..9353b9b622f6e 100644
> --- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
> +++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts
> @@ -42,7 +42,7 @@ framebuffer0: framebuffer@5c000000 {
>   
>   	extcon_usb: extcon-usb {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 102 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 102 GPIO_ACTIVE_HIGH>;
>   	};
>   
>   	gpio-keys {
> diff --git a/arch/arm64/boot/dts/qcom/sm6125-xiaomi-laurel-sprout.dts b/arch/arm64/boot/dts/qcom/sm6125-xiaomi-laurel-sprout.dts
> index a7f4aeae9c1a5..1b06617ba34a9 100644
> --- a/arch/arm64/boot/dts/qcom/sm6125-xiaomi-laurel-sprout.dts
> +++ b/arch/arm64/boot/dts/qcom/sm6125-xiaomi-laurel-sprout.dts
> @@ -63,7 +63,7 @@ cmdline_mem: memory@ffd00000 {
>   
>   	extcon_usb: usb-id {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&tlmm 102 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&tlmm 102 GPIO_ACTIVE_HIGH>;
>   	};
>   
>   	gpio-keys {
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
> index aa3e21bd6c8f4..20e3f41efe97f 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
> @@ -27,7 +27,7 @@ module_led: led-0 {
>   
>   	extcon_usb3: extcon-usb3 {
>   		compatible = "linux,extcon-usb-gpio";
> -		id-gpio = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
> +		id-gpios = <&gpio1 RK_PC2 GPIO_ACTIVE_HIGH>;
>   		pinctrl-names = "default";
>   		pinctrl-0 = <&usb3_id>;
>   	};
Rob Herring June 14, 2023, 11:15 p.m. UTC | #4
On Mon, Jun 12, 2023 at 10:29:16AM +0200, Krzysztof Kozlowski wrote:
> On 08/06/2023 10:11, Alexander Stein wrote:
> > Convert the binding to DT schema format. Change the GPIO properties to new
> > naming convention using -gpios as well.
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> >  .../bindings/extcon/extcon-usb-gpio.txt       | 21 --------
> >  .../bindings/extcon/extcon-usb-gpio.yaml      | 52 +++++++++++++++++++
> >  2 files changed, 52 insertions(+), 21 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> >  create mode 100644 Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> > deleted file mode 100644
> > index dfc14f71e81fb..0000000000000
> > --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
> > +++ /dev/null
> > @@ -1,21 +0,0 @@
> > -USB GPIO Extcon device
> > -
> > -This is a virtual device used to generate USB cable states from the USB ID pin
> > -connected to a GPIO pin.
> > -
> > -Required properties:
> > -- compatible: Should be "linux,extcon-usb-gpio"
> > -
> > -Either one of id-gpio or vbus-gpio must be present. Both can be present as well.
> > -- id-gpio: gpio for USB ID pin. See gpio binding.
> > -- vbus-gpio: gpio for USB VBUS pin.
> > -
> > -Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below:
> > -	extcon_usb1 {
> > -		compatible = "linux,extcon-usb-gpio";
> > -		id-gpio = <&gpio6 1 GPIO_ACTIVE_HIGH>;
> > -	}
> > -
> > -	&omap_dwc3_1 {
> > -		extcon = <&extcon_usb1>;
> > -	};
> > diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml
> > new file mode 100644
> > index 0000000000000..3a71d848dc7a8
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml
> > @@ -0,0 +1,52 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/extcon/extcon-usb-gpio.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: USB GPIO Extcon device
> > +
> > +maintainers:
> > +  - Alexander Stein <alexander.stein@ew.tq-group.com>
> > +
> > +description: |

Don't need '|'

> > +  This is a virtual device used to generate USB cable states from the
> > +  USB ID pin connected to a GPIO pin.

Please add 'deprecated: true' here. New designs should use a USB 
connector node binding.

> > +
> > +properties:
> > +  compatible:
> > +    const: linux,extcon-usb-gpio
> > +
> > +  id-gpios:
> > +    description: An input gpio for USB ID pin.
> > +    maxItems: 1
> > +
> > +  vbus-gpios:
> > +    description: An input gpio for USB VBus pin, used to detect presence of
> > +      VBUS 5V.
> > +    maxItems: 1
> > +
> > +required:
> > +  - compatible
> > +
> > +anyOf:
> 
> oneOf instead

anyOf is correct. Both can be present.

> 
> > +  - required:
> > +      - id-gpios
> > +  - required:
> > +      - vbus-gpios
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/gpio/gpio.h>
> > +
> > +    extcon_usb1 {
> 
> No underscores, generic node names, so just "extcon-usb"
> 
> > +      compatible = "linux,extcon-usb-gpio";
> > +      id-gpios = <&gpio6 1 GPIO_ACTIVE_HIGH>;
> > +      vbus-gpios = <&gpio6 2 GPIO_ACTIVE_HIGH>;
> > +    };
> > +
> > +    usb-controller {
> > +      extcon = <&extcon_usb1>;
> > +    };
> 
> Drop controller, no need to add consumers in a provider's binding.
> 
> Best regards,
> Krzysztof
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
deleted file mode 100644
index dfc14f71e81fb..0000000000000
--- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt
+++ /dev/null
@@ -1,21 +0,0 @@ 
-USB GPIO Extcon device
-
-This is a virtual device used to generate USB cable states from the USB ID pin
-connected to a GPIO pin.
-
-Required properties:
-- compatible: Should be "linux,extcon-usb-gpio"
-
-Either one of id-gpio or vbus-gpio must be present. Both can be present as well.
-- id-gpio: gpio for USB ID pin. See gpio binding.
-- vbus-gpio: gpio for USB VBUS pin.
-
-Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below:
-	extcon_usb1 {
-		compatible = "linux,extcon-usb-gpio";
-		id-gpio = <&gpio6 1 GPIO_ACTIVE_HIGH>;
-	}
-
-	&omap_dwc3_1 {
-		extcon = <&extcon_usb1>;
-	};
diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml
new file mode 100644
index 0000000000000..3a71d848dc7a8
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.yaml
@@ -0,0 +1,52 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/extcon/extcon-usb-gpio.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: USB GPIO Extcon device
+
+maintainers:
+  - Alexander Stein <alexander.stein@ew.tq-group.com>
+
+description: |
+  This is a virtual device used to generate USB cable states from the
+  USB ID pin connected to a GPIO pin.
+
+properties:
+  compatible:
+    const: linux,extcon-usb-gpio
+
+  id-gpios:
+    description: An input gpio for USB ID pin.
+    maxItems: 1
+
+  vbus-gpios:
+    description: An input gpio for USB VBus pin, used to detect presence of
+      VBUS 5V.
+    maxItems: 1
+
+required:
+  - compatible
+
+anyOf:
+  - required:
+      - id-gpios
+  - required:
+      - vbus-gpios
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    extcon_usb1 {
+      compatible = "linux,extcon-usb-gpio";
+      id-gpios = <&gpio6 1 GPIO_ACTIVE_HIGH>;
+      vbus-gpios = <&gpio6 2 GPIO_ACTIVE_HIGH>;
+    };
+
+    usb-controller {
+      extcon = <&extcon_usb1>;
+    };