2023-08-22 13:57:17

by Stanley Chang[昌育德]

[permalink] [raw]
Subject: [PATCH v1 2/2] dt-bindings: extcon: Add Realtek DHC RTD SoC Type-C

Document the device-tree bindings for Realtek SoCs Type-C.
Realtek DHC (digital home center) RTD SoCs support a Type-C module.

Signed-off-by: Stanley Chang <[email protected]>
---
.../bindings/extcon/extcon-rtk-type-c.yaml | 77 +++++++++++++++++++
1 file changed, 77 insertions(+)
create mode 100644 Documentation/devicetree/bindings/extcon/extcon-rtk-type-c.yaml

diff --git a/Documentation/devicetree/bindings/extcon/extcon-rtk-type-c.yaml b/Documentation/devicetree/bindings/extcon/extcon-rtk-type-c.yaml
new file mode 100644
index 000000000000..d14b9ee544b9
--- /dev/null
+++ b/Documentation/devicetree/bindings/extcon/extcon-rtk-type-c.yaml
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright 2023 Realtek Semiconductor Corporation
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/extcon/extcon-rtk-type-c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek DHC RTD SoCs USB Type-C detection
+
+maintainers:
+ - Stanley Chang <[email protected]>
+
+description: |
+ Realtek digital home center (DHC) RTD series SoCs include a type c module.
+ This module is able to detect the state of type c connector.
+
+properties:
+ compatible:
+ enum:
+ - realtek,rtd1295-type-c
+ - realtek,rtd1312c-type-c
+ - realtek,rtd1315e-type-c
+ - realtek,rtd1319-type-c
+ - realtek,rtd1319d-type-c
+ - realtek,rtd1395-type-c
+ - realtek,rtd1619-type-c
+ - realtek,rtd1619b-type-c
+
+ reg:
+ maxItems: 1
+ description: Address and length of register set for type-c module.
+
+ interrupts:
+ maxItems: 1
+
+ nvmem-cells:
+ maxItems: 1
+ description:
+ The phandle to nvmem cell that contains the trimming data.
+ If unspecified, default value is used.
+
+ pinctrl-names:
+ const: default
+ description: A pinctrl state names "default" must be defined.
+
+ pinctrl-0:
+ description:
+ Should contain default pinctrl.
+
+ nvmem-cell-names:
+ const: usb-cal
+ description:
+ The type c parameter trimming data specified via efuse.
+
+ realtek,rd-ctrl-gpio:
+ description: The gpio node to control external Rd on board.
+ maxItems: 1
+
+required:
+ - compatible
+ - reg
+ - interrupts
+
+additionalProperties: false
+
+examples:
+ - |
+ type-c@7220 {
+ compatible = "realtek,rtd1619b-type-c";
+ reg = <0x7220 0x20>;
+ interrupts = <0 60 4>;
+
+ pinctrl-names = "default";
+ pinctrl-0 = <&usb_cc1_pins>, <&usb_cc2_pins>;
+ nvmem-cells = <&otp_usb_cal>;
+ nvmem-cell-names = "usb-cal";
+ };
--
2.34.1



2023-08-24 08:49:50

by Stanley Chang[昌育德]

[permalink] [raw]
Subject: RE: [PATCH v1 2/2] dt-bindings: extcon: Add Realtek DHC RTD SoC Type-C

Hi Krzysztof,

> On 22/08/2023 12:28, Stanley Chang wrote:
> > Document the device-tree bindings for Realtek SoCs Type-C.
> > Realtek DHC (digital home center) RTD SoCs support a Type-C module.
> >
> > Signed-off-by: Stanley Chang <[email protected]>
> > ---
> > .../bindings/extcon/extcon-rtk-type-c.yaml | 77 +++++++++++++++++++
> > 1 file changed, 77 insertions(+)
> > create mode 100644
> > Documentation/devicetree/bindings/extcon/extcon-rtk-type-c.yaml
>
> Filename like compatible.

I will rename.

> >
> > diff --git
> > a/Documentation/devicetree/bindings/extcon/extcon-rtk-type-c.yaml
> > b/Documentation/devicetree/bindings/extcon/extcon-rtk-type-c.yaml
> > new file mode 100644
> > index 000000000000..d14b9ee544b9
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/extcon/extcon-rtk-type-c.yaml
> > @@ -0,0 +1,77 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) # Copyright
> > +2023 Realtek Semiconductor Corporation %YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/extcon/extcon-rtk-type-c.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Realtek DHC RTD SoCs USB Type-C detection
>
> Type-c usually go to usb directory.

This binding is not for a type-c controller.
It is an extcon device for type-c connector detection.
So I put it at extcon directory.

And I will add “connector” to the title.
title: Realtek DHC RTD SoCs USB Type-C Connector detection

> > +maintainers:
> > + - Stanley Chang <[email protected]>
> > +
> > +description: |
>
> Do not need '|' unless you need to preserve formatting.

Ok

> > + Realtek digital home center (DHC) RTD series SoCs include a type c
> module.
> > + This module is able to detect the state of type c connector.
> > +
> > +properties:
> > + compatible:
> > + enum:
> > + - realtek,rtd1295-type-c
> > + - realtek,rtd1312c-type-c
> > + - realtek,rtd1315e-type-c
> > + - realtek,rtd1319-type-c
> > + - realtek,rtd1319d-type-c
> > + - realtek,rtd1395-type-c
> > + - realtek,rtd1619-type-c
> > + - realtek,rtd1619b-type-c
> > +
> > + reg:
> > + maxItems: 1
> > + description: Address and length of register set for type-c module.
>
> Drop description, it's obvious.

Ok.

> > +
> > + interrupts:
> > + maxItems: 1
> > +
> > + nvmem-cells:
> > + maxItems: 1
> > + description:
> > + The phandle to nvmem cell that contains the trimming data.
> > + If unspecified, default value is used.
> > +
> > + pinctrl-names:
> > + const: default
> > + description: A pinctrl state names "default" must be defined.
>
> Drop, property not needed.

Ok

> > +
> > + pinctrl-0:
> > + description:
> > + Should contain default pinctrl.
>
> Drop, property not needed.
>
Ok.
>
> > +
> > + nvmem-cell-names:
> > + const: usb-cal
>
> items:
> - const: usb-cal

>
> and move description to nvmem-cells.
>
> > + description:
> > + The type c parameter trimming data specified via efuse.
>
> Keep same properties next to each other. nvmem-cells should be followed by
> nvmem-cell-names.
>
> > +
> > + realtek,rd-ctrl-gpio:
> > + description: The gpio node to control external Rd on board.
>
> The names are always "gpios".

Do you mean "realtek,rd-ctrl-gpios" ?
>
> > + maxItems: 1
> > +
>
> You miss here connector. Probably also VBUS supply and other supplies.
>
Ok, I will add connector.

> > +required:
> > + - compatible
> > + - reg
> > + - interrupts
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > + - |
> > + type-c@7220 {
> > + compatible = "realtek,rtd1619b-type-c";
> > + reg = <0x7220 0x20>;
> > + interrupts = <0 60 4>;
>
> Use proper defines for common constants.

Ok, I will revise this.

> > +
> > + pinctrl-names = "default";
> > + pinctrl-0 = <&usb_cc1_pins>, <&usb_cc2_pins>;

You mention that the property of pinctrl not need in doc.
Do I need to add the property of pintrl in example?

> > + nvmem-cells = <&otp_usb_cal>;
> > + nvmem-cell-names = "usb-cal";
>
> Type-c without connector? This is incomplete.

Ok, I will add connector.


Thanks,
Stanley

2023-08-24 09:19:31

by Stanley Chang[昌育德]

[permalink] [raw]
Subject: RE: [PATCH v1 2/2] dt-bindings: extcon: Add Realtek DHC RTD SoC Type-C

Hi Krzysztof,

> >>> +
> >>> +title: Realtek DHC RTD SoCs USB Type-C detection
> >>
> >> Type-c usually go to usb directory.
> >
> > This binding is not for a type-c controller.
> > It is an extcon device for type-c connector detection.
> > So I put it at extcon directory.
>
> If this is not a type-c controller, then what is it? Explain me please what is an
> "extcon device" without using any Linux subsystem naming.

Sorry. "extcon device" may be the wrong name I'm using.

As far as I know, type-c controller supports PD detection, role detection, role swap and cc configuration.
But in our SoC, type c module only supports role detection.
So I don't think it's a type-c controller.

I found a similar driver at
drivers/extcon/extcon-usbc-cros-ec.c
It belongs to External Connector, which can detect USB Type C cables.

So our driver is an external connector driver.

> >
> > And I will add “connector” to the title.
> > title: Realtek DHC RTD SoCs USB Type-C Connector detection
>
> So usb...

I refer to this binding, and it is in folder bindings/extcon.
docs/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml
Title: ChromeOS EC USB Type-C Cable and Accessory Detection

Thank,
Stanley

2023-08-24 11:58:54

by Stanley Chang[昌育德]

[permalink] [raw]
Subject: RE: [PATCH v1 2/2] dt-bindings: extcon: Add Realtek DHC RTD SoC Type-C

Hi Krzysztof,



> -----Original Message-----
> From: Krzysztof Kozlowski <[email protected]>
> Sent: Thursday, August 24, 2023 4:43 PM
> To: Stanley Chang[昌育德] <[email protected]>; MyungJoo Ham
> <[email protected]>
> Cc: Chanwoo Choi <[email protected]>; Rob Herring
> <[email protected]>; Krzysztof Kozlowski
> <[email protected]>; Conor Dooley <[email protected]>;
> [email protected]; [email protected]
> Subject: Re: [PATCH v1 2/2] dt-bindings: extcon: Add Realtek DHC RTD SoC
> Type-C
>
>
> External mail.
>
>
>
> On 24/08/2023 09:23, Stanley Chang[昌育德] wrote:
> > Hi Krzysztof,
> >
> >>>>> +
> >>>>> +title: Realtek DHC RTD SoCs USB Type-C detection
> >>>>
> >>>> Type-c usually go to usb directory.
> >>>
> >>> This binding is not for a type-c controller.
> >>> It is an extcon device for type-c connector detection.
> >>> So I put it at extcon directory.
> >>
> >> If this is not a type-c controller, then what is it? Explain me
> >> please what is an "extcon device" without using any Linux subsystem
> naming.
> >
> > Sorry. "extcon device" may be the wrong name I'm using.
> >
> > As far as I know, type-c controller supports PD detection, role detection, role
> swap and cc configuration.
> > But in our SoC, type c module only supports role detection.
> > So I don't think it's a type-c controller.
>
> So module handling some parts of "Type-C" is not a "Type-C controller"
> but if such module handles a bit more, it becomes Type-C?

Due to hardware function limitation, it can't handle the full function of type-c.

> >
> > I found a similar driver at
> > drivers/extcon/extcon-usbc-cros-ec.c
> > It belongs to External Connector, which can detect USB Type C cables.
>
> That's a driver, not a binding...
>
> >
> > So our driver is an external connector driver.
>
> Driver yes, not binding.
>
> >
> >>>
> >>> And I will add “connector” to the title.
> >>> title: Realtek DHC RTD SoCs USB Type-C Connector detection
> >>
> >> So usb...
> >
> > I refer to this binding, and it is in folder bindings/extcon.
> > docs/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml
> > Title: ChromeOS EC USB Type-C Cable and Accessory Detection
>
> So maybe it should be moved as well?
>
> extcon is a Linux framework. If you think extcon is a type of hardware, then
> please tell me what it is exactly. Please define it. And then I wonder why the
> name "extcon" is anyhow connected to Type-C USB.
>

Well, from my point of view. extcon stands for External Connector.
HDMI connector, micro USB connector, type-c connector are all a kind of hardware, they are external connectors.
I think the Type-C connector is a kind of extcon.
Of course, I agree that Type-C is part of USB.

So this binding can be usb or extcon, I don't think it is strictly restricted.

Thanks,
Stanley

2023-08-24 14:34:48

by Stanley Chang[昌育德]

[permalink] [raw]
Subject: RE: [PATCH v1 2/2] dt-bindings: extcon: Add Realtek DHC RTD SoC Type-C

Hi Krzysztof,


> On 24/08/2023 11:23, Stanley Chang[昌育德] wrote:
> >>>
> >>>>>
> >>>>> And I will add “connector” to the title.
> >>>>> title: Realtek DHC RTD SoCs USB Type-C Connector detection
> >>>>
> >>>> So usb...
> >>>
> >>> I refer to this binding, and it is in folder bindings/extcon.
> >>> docs/devicetree/bindings/extcon/extcon-usbc-cros-ec.yaml
> >>> Title: ChromeOS EC USB Type-C Cable and Accessory Detection
> >>
> >> So maybe it should be moved as well?
> >>
> >> extcon is a Linux framework. If you think extcon is a type of
> >> hardware, then please tell me what it is exactly. Please define it.
> >> And then I wonder why the name "extcon" is anyhow connected to Type-C
> USB.
> >>
> >
> > Well, from my point of view. extcon stands for External Connector.
>
> For connectors we have separate directory - connector. So no, it is not an
> external connector.
>
> Anyway type "external connector" to Wikipedia or some hardware
> manufacturer website and find me examples of such hardware. It does not
> exist.
>
> > HDMI connector, micro USB connector, type-c connector are all a kind of
> hardware, they are external connectors.
>
> You did not write here bindings for connector...
>
> > I think the Type-C connector is a kind of extcon.
>
> There is no such thing as extcon. Otherwise please show me datasheets using
> this name. Show me Wikipedia article.
>
> > Of course, I agree that Type-C is part of USB.
> >
> > So this binding can be usb or extcon, I don't think it is strictly restricted.
>

Well~
I have no position to argue this issue.
I agree to move this binding to usb directory
But what's up with this directory "Documentation/devicetree/bindings/extcon/" ?
What binding can be placed in this directory?

Thanks,
Stanley