diff mbox series

[1/2] dt-bindings: power/supply: Document generic USB charger

Message ID 20191103220801.10666-1-paul@crapouillou.net (mailing list archive)
State Not Applicable, archived
Headers show
Series [1/2] dt-bindings: power/supply: Document generic USB charger | expand

Commit Message

Paul Cercueil Nov. 3, 2019, 10:08 p.m. UTC
Add documentation about the devicetree bindings for the generic USB
charger.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
---
 .../bindings/power/supply/usb-charger.txt     | 24 +++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/usb-charger.txt

Comments

Rob Herring Nov. 4, 2019, 1:52 p.m. UTC | #1
On Sun, Nov 3, 2019 at 4:08 PM Paul Cercueil <paul@crapouillou.net> wrote:
>
> Add documentation about the devicetree bindings for the generic USB
> charger.

What makes it generic?

>
> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> ---
>  .../bindings/power/supply/usb-charger.txt     | 24 +++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/supply/usb-charger.txt
>
> diff --git a/Documentation/devicetree/bindings/power/supply/usb-charger.txt b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
> new file mode 100644
> index 000000000000..fd46734cb0e5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
> @@ -0,0 +1,24 @@
> +Generic USB charger bindings
> +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> +
> +Required properties :
> + - compatible : should be "usb-charger"
> + - phys: phandle to the USB PHY
> +
> +Example:
> +
> +usb_con: extcon {
> +       compatible = "linux,extcon-usb-gpio";
> +       vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>;
> +};
> +
> +usb_phy: usb-phy@0 {
> +       compatible = "usb-nop-xceiv";
> +       #phy-cells = <0>;
> +       extcon = <&usb_con>;

extcon is deprecated in favor of usb-connector binding. See
.../bindings/connector/usb-connector.txt. There's also some pending
patches for adding GPIO based connector controls including Vbus sense
(GPIO input) and control (regulator via a GPIO).

Rob
Paul Cercueil Nov. 5, 2019, 9:16 a.m. UTC | #2
Hi Rob,


Le lun., nov. 4, 2019 at 07:52, Rob Herring <robh+dt@kernel.org> a 
écrit :
> On Sun, Nov 3, 2019 at 4:08 PM Paul Cercueil <paul@crapouillou.net> 
> wrote:
>> 
>>  Add documentation about the devicetree bindings for the generic USB
>>  charger.
> 
> What makes it generic?

It only uses the USB PHY subsystem, which already has some half-baked 
support for chargers but not bound to the power-supply subsystem.


>> 
>>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  ---
>>   .../bindings/power/supply/usb-charger.txt     | 24 
>> +++++++++++++++++++
>>   1 file changed, 24 insertions(+)
>>   create mode 100644 
>> Documentation/devicetree/bindings/power/supply/usb-charger.txt
>> 
>>  diff --git 
>> a/Documentation/devicetree/bindings/power/supply/usb-charger.txt 
>> b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
>>  new file mode 100644
>>  index 000000000000..fd46734cb0e5
>>  --- /dev/null
>>  +++ b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
>>  @@ -0,0 +1,24 @@
>>  +Generic USB charger bindings
>>  +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>  +
>>  +Required properties :
>>  + - compatible : should be "usb-charger"
>>  + - phys: phandle to the USB PHY
>>  +
>>  +Example:
>>  +
>>  +usb_con: extcon {
>>  +       compatible = "linux,extcon-usb-gpio";
>>  +       vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>;
>>  +};
>>  +
>>  +usb_phy: usb-phy@0 {
>>  +       compatible = "usb-nop-xceiv";
>>  +       #phy-cells = <0>;
>>  +       extcon = <&usb_con>;
> 
> extcon is deprecated in favor of usb-connector binding. See
> .../bindings/connector/usb-connector.txt. There's also some pending
> patches for adding GPIO based connector controls including Vbus sense
> (GPIO input) and control (regulator via a GPIO).
> 
> Rob

I understand that the usb-connector binding is better, but the current 
code doesn't integrate at all with the USB PHY subsystem, which has its 
own code to handle ID and VBUS GPIOs and supports notifiers. Is that 
deprecated then?

What's the big picture here?

Thanks,
-Paul
Rob Herring Nov. 5, 2019, 1:48 p.m. UTC | #3
On Tue, Nov 5, 2019 at 3:16 AM Paul Cercueil <paul@crapouillou.net> wrote:
>
> Hi Rob,
>
>
> Le lun., nov. 4, 2019 at 07:52, Rob Herring <robh+dt@kernel.org> a
> écrit :
> > On Sun, Nov 3, 2019 at 4:08 PM Paul Cercueil <paul@crapouillou.net>
> > wrote:
> >>
> >>  Add documentation about the devicetree bindings for the generic USB
> >>  charger.
> >
> > What makes it generic?
>
> It only uses the USB PHY subsystem, which already has some half-baked
> support for chargers but not bound to the power-supply subsystem.
>
>
> >>
> >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
> >>  ---
> >>   .../bindings/power/supply/usb-charger.txt     | 24
> >> +++++++++++++++++++
> >>   1 file changed, 24 insertions(+)
> >>   create mode 100644
> >> Documentation/devicetree/bindings/power/supply/usb-charger.txt
> >>
> >>  diff --git
> >> a/Documentation/devicetree/bindings/power/supply/usb-charger.txt
> >> b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
> >>  new file mode 100644
> >>  index 000000000000..fd46734cb0e5
> >>  --- /dev/null
> >>  +++ b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
> >>  @@ -0,0 +1,24 @@
> >>  +Generic USB charger bindings
> >>  +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >>  +
> >>  +Required properties :
> >>  + - compatible : should be "usb-charger"
> >>  + - phys: phandle to the USB PHY
> >>  +
> >>  +Example:
> >>  +
> >>  +usb_con: extcon {
> >>  +       compatible = "linux,extcon-usb-gpio";
> >>  +       vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>;
> >>  +};
> >>  +
> >>  +usb_phy: usb-phy@0 {
> >>  +       compatible = "usb-nop-xceiv";
> >>  +       #phy-cells = <0>;
> >>  +       extcon = <&usb_con>;
> >
> > extcon is deprecated in favor of usb-connector binding. See
> > .../bindings/connector/usb-connector.txt. There's also some pending
> > patches for adding GPIO based connector controls including Vbus sense
> > (GPIO input) and control (regulator via a GPIO).
> >
> > Rob
>
> I understand that the usb-connector binding is better, but the current
> code doesn't integrate at all with the USB PHY subsystem, which has its
> own code to handle ID and VBUS GPIOs and supports notifiers. Is that
> deprecated then?
>
> What's the big picture here?

Does this series work for you?:

https://patchwork.kernel.org/cover/11120707/
Paul Cercueil Nov. 5, 2019, 11:16 p.m. UTC | #4
Le mar., nov. 5, 2019 at 07:48, Rob Herring <robh+dt@kernel.org> a 
écrit :
> On Tue, Nov 5, 2019 at 3:16 AM Paul Cercueil <paul@crapouillou.net> 
> wrote:
>> 
>>  Hi Rob,
>> 
>> 
>>  Le lun., nov. 4, 2019 at 07:52, Rob Herring <robh+dt@kernel.org> a
>>  écrit :
>>  > On Sun, Nov 3, 2019 at 4:08 PM Paul Cercueil 
>> <paul@crapouillou.net>
>>  > wrote:
>>  >>
>>  >>  Add documentation about the devicetree bindings for the generic 
>> USB
>>  >>  charger.
>>  >
>>  > What makes it generic?
>> 
>>  It only uses the USB PHY subsystem, which already has some 
>> half-baked
>>  support for chargers but not bound to the power-supply subsystem.
>> 
>> 
>>  >>
>>  >>  Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>>  >>  ---
>>  >>   .../bindings/power/supply/usb-charger.txt     | 24
>>  >> +++++++++++++++++++
>>  >>   1 file changed, 24 insertions(+)
>>  >>   create mode 100644
>>  >> Documentation/devicetree/bindings/power/supply/usb-charger.txt
>>  >>
>>  >>  diff --git
>>  >> a/Documentation/devicetree/bindings/power/supply/usb-charger.txt
>>  >> b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
>>  >>  new file mode 100644
>>  >>  index 000000000000..fd46734cb0e5
>>  >>  --- /dev/null
>>  >>  +++ 
>> b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
>>  >>  @@ -0,0 +1,24 @@
>>  >>  +Generic USB charger bindings
>>  >>  +~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>  >>  +
>>  >>  +Required properties :
>>  >>  + - compatible : should be "usb-charger"
>>  >>  + - phys: phandle to the USB PHY
>>  >>  +
>>  >>  +Example:
>>  >>  +
>>  >>  +usb_con: extcon {
>>  >>  +       compatible = "linux,extcon-usb-gpio";
>>  >>  +       vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>;
>>  >>  +};
>>  >>  +
>>  >>  +usb_phy: usb-phy@0 {
>>  >>  +       compatible = "usb-nop-xceiv";
>>  >>  +       #phy-cells = <0>;
>>  >>  +       extcon = <&usb_con>;
>>  >
>>  > extcon is deprecated in favor of usb-connector binding. See
>>  > .../bindings/connector/usb-connector.txt. There's also some 
>> pending
>>  > patches for adding GPIO based connector controls including Vbus 
>> sense
>>  > (GPIO input) and control (regulator via a GPIO).
>>  >
>>  > Rob
>> 
>>  I understand that the usb-connector binding is better, but the 
>> current
>>  code doesn't integrate at all with the USB PHY subsystem, which has 
>> its
>>  own code to handle ID and VBUS GPIOs and supports notifiers. Is that
>>  deprecated then?
>> 
>>  What's the big picture here?
> 
> Does this series work for you?:
> 
> https://patchwork.kernel.org/cover/11120707/

I had to do some changes to my musb and PHY drivers but it works, yes.

The good thing is that I didn't have to change this driver, so I'll 
wait for feedback on patch 2/2 then post a v2 with a fixed devicetree 
example.

Thanks,
-Paul
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/power/supply/usb-charger.txt b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
new file mode 100644
index 000000000000..fd46734cb0e5
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/usb-charger.txt
@@ -0,0 +1,24 @@ 
+Generic USB charger bindings
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Required properties :
+ - compatible : should be "usb-charger"
+ - phys: phandle to the USB PHY
+
+Example:
+
+usb_con: extcon {
+	compatible = "linux,extcon-usb-gpio";
+	vbus-gpios = <&gpb 5 GPIO_ACTIVE_HIGH>;
+};
+
+usb_phy: usb-phy@0 {
+	compatible = "usb-nop-xceiv";
+	#phy-cells = <0>;
+	extcon = <&usb_con>;
+};
+
+usb_charger: usb-charger {
+	compatible = "usb-charger";
+	phys = <&usb_phy>;
+};