2024-01-18 09:26:47

by Dharma Balasubiramani

[permalink] [raw]
Subject: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

Converted the text bindings to YAML and validated them individually using following commands

$ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
$ make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/

changelogs are available in respective patches.

Dharma Balasubiramani (3):
dt-bindings: display: convert Atmel's HLCDC to DT schema
dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema
dt-bindings: mfd: atmel,hlcdc: Convert to DT schema format

.../atmel/atmel,hlcdc-display-controller.yaml | 84 ++++++++++++++++
.../bindings/display/atmel/hlcdc-dc.txt | 75 --------------
.../devicetree/bindings/mfd/atmel,hlcdc.yaml | 97 +++++++++++++++++++
.../devicetree/bindings/mfd/atmel-hlcdc.txt | 56 -----------
.../bindings/pwm/atmel,hlcdc-pwm.yaml | 44 +++++++++
.../bindings/pwm/atmel-hlcdc-pwm.txt | 29 ------
6 files changed, 225 insertions(+), 160 deletions(-)
create mode 100644 Documentation/devicetree/bindings/display/atmel/atmel,hlcdc-display-controller.yaml
delete mode 100644 Documentation/devicetree/bindings/display/atmel/hlcdc-dc.txt
create mode 100644 Documentation/devicetree/bindings/mfd/atmel,hlcdc.yaml
delete mode 100644 Documentation/devicetree/bindings/mfd/atmel-hlcdc.txt
create mode 100644 Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
delete mode 100644 Documentation/devicetree/bindings/pwm/atmel-hlcdc-pwm.txt

--
2.25.1



2024-01-18 09:27:22

by Dharma Balasubiramani

[permalink] [raw]
Subject: [PATCH v3 1/3] dt-bindings: display: convert Atmel's HLCDC to DT schema

Convert the existing DT binding to DT schema of the Atmel's HLCDC display
controller.

Signed-off-by: Dharma Balasubiramani <[email protected]>
---
changelog
v2 -> v3
- Remove '|' in description, as there is no formatting to preserve.
- Ref video-interfaces as endpoint.
- Remove ref and description for bus-width.
- Add new line before the child node in example.
- Remove 'example 2', as it is not required for just one additional property.
v1 -> v2
- Remove the explicit copyrights.
- Modify filename like compatible.
- Modify title (drop words like binding/driver).
- Modify description actually describing the hardware and not the driver.
- Remove pinctrl properties which aren't required.
- Ref endpoint and not endpoint-base.
- Drop redundant info about bus-width description and add ref to video-interfaces.
- Move 'additionalProperties' after 'Required'.
- Drop parent node and it's other sub-device node which are not related here.
- Add compatible to example 2 and add comments that bus-width is the diff between two examples.
---
.../atmel/atmel,hlcdc-display-controller.yaml | 84 +++++++++++++++++++
.../bindings/display/atmel/hlcdc-dc.txt | 75 -----------------
2 files changed, 84 insertions(+), 75 deletions(-)
create mode 100644 Documentation/devicetree/bindings/display/atmel/atmel,hlcdc-display-controller.yaml
delete mode 100644 Documentation/devicetree/bindings/display/atmel/hlcdc-dc.txt

diff --git a/Documentation/devicetree/bindings/display/atmel/atmel,hlcdc-display-controller.yaml b/Documentation/devicetree/bindings/display/atmel/atmel,hlcdc-display-controller.yaml
new file mode 100644
index 000000000000..0c0871cb85f1
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/atmel/atmel,hlcdc-display-controller.yaml
@@ -0,0 +1,84 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/atmel/atmel,hlcdc-display-controller.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel's High LCD Controller (HLCDC)
+
+maintainers:
+ - Nicolas Ferre <[email protected]>
+ - Alexandre Belloni <[email protected]>
+ - Claudiu Beznea <[email protected]>
+
+description:
+ The LCD Controller (LCDC) consists of logic for transferring LCD image
+ data from an external display buffer to a TFT LCD panel. The LCDC has one
+ display input buffer per layer that fetches pixels through the single bus
+ host interface and a look-up table to allow palletized display
+ configurations.
+
+properties:
+ compatible:
+ const: atmel,hlcdc-display-controller
+
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 0
+
+ port@0:
+ $ref: /schemas/graph.yaml#/$defs/port-base
+ unevaluatedProperties: false
+ description:
+ Output endpoint of the controller, connecting the LCD panel signals.
+
+ properties:
+ '#address-cells':
+ const: 1
+
+ '#size-cells':
+ const: 0
+
+ reg:
+ maxItems: 1
+
+ endpoint:
+ $ref: /schemas/media/video-interfaces.yaml#
+ unevaluatedProperties: false
+ description:
+ Endpoint connecting the LCD panel signals.
+
+ properties:
+ bus-width:
+ enum: [ 12, 16, 18, 24 ]
+
+required:
+ - '#address-cells'
+ - '#size-cells'
+ - compatible
+ - port@0
+
+additionalProperties: false
+
+examples:
+ - |
+ display-controller {
+ compatible = "atmel,hlcdc-display-controller";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_rgb888>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0>;
+
+ hlcdc_panel_output: endpoint@0 {
+ reg = <0>;
+ remote-endpoint = <&panel_input>;
+ };
+ };
+ };
diff --git a/Documentation/devicetree/bindings/display/atmel/hlcdc-dc.txt b/Documentation/devicetree/bindings/display/atmel/hlcdc-dc.txt
deleted file mode 100644
index 923aea25344c..000000000000
--- a/Documentation/devicetree/bindings/display/atmel/hlcdc-dc.txt
+++ /dev/null
@@ -1,75 +0,0 @@
-Device-Tree bindings for Atmel's HLCDC (High LCD Controller) DRM driver
-
-The Atmel HLCDC Display Controller is subdevice of the HLCDC MFD device.
-See ../../mfd/atmel-hlcdc.txt for more details.
-
-Required properties:
- - compatible: value should be "atmel,hlcdc-display-controller"
- - pinctrl-names: the pin control state names. Should contain "default".
- - pinctrl-0: should contain the default pinctrl states.
- - #address-cells: should be set to 1.
- - #size-cells: should be set to 0.
-
-Required children nodes:
- Children nodes are encoding available output ports and their connections
- to external devices using the OF graph representation (see ../graph.txt).
- At least one port node is required.
-
-Optional properties in grandchild nodes:
- Any endpoint grandchild node may specify a desired video interface
- according to ../../media/video-interfaces.txt, specifically
- - bus-width: recognized values are <12>, <16>, <18> and <24>, and
- override any output mode selection heuristic, forcing "rgb444",
- "rgb565", "rgb666" and "rgb888" respectively.
-
-Example:
-
- hlcdc: hlcdc@f0030000 {
- compatible = "atmel,sama5d3-hlcdc";
- reg = <0xf0030000 0x2000>;
- interrupts = <36 IRQ_TYPE_LEVEL_HIGH 0>;
- clocks = <&lcdc_clk>, <&lcdck>, <&clk32k>;
- clock-names = "periph_clk","sys_clk", "slow_clk";
-
- hlcdc-display-controller {
- compatible = "atmel,hlcdc-display-controller";
- pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_rgb888>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- port@0 {
- #address-cells = <1>;
- #size-cells = <0>;
- reg = <0>;
-
- hlcdc_panel_output: endpoint@0 {
- reg = <0>;
- remote-endpoint = <&panel_input>;
- };
- };
- };
-
- hlcdc_pwm: hlcdc-pwm {
- compatible = "atmel,hlcdc-pwm";
- pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_lcd_pwm>;
- #pwm-cells = <3>;
- };
- };
-
-Example 2: With a video interface override to force rgb565; as above
-but with these changes/additions:
-
- &hlcdc {
- hlcdc-display-controller {
- pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_lcd_base &pinctrl_lcd_rgb565>;
-
- port@0 {
- hlcdc_panel_output: endpoint@0 {
- bus-width = <16>;
- };
- };
- };
- };
--
2.25.1


2024-01-18 09:37:10

by Dharma Balasubiramani

[permalink] [raw]
Subject: [PATCH v3 2/3] dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema

Convert device tree bindings for Atmel's HLCDC PWM controller to YAML
format.

Signed-off-by: Dharma Balasubiramani <[email protected]>
Reviewed-by: Conor Dooley <[email protected]>
---
changelog
v2 -> v3
- Remove '|' in description, as there is no formatting to preserve.
- Delete the description for pwm-cells.
- Drop the label for pwm node as it not used.
v1 -> v2
- Remove the explicit copyrights.
- Modify title (not include words like binding/driver).
- Modify description actually describing the hardware and not the driver.
- Remove pinctrl properties which aren't required.
- Drop parent node and it's other sub-device node which are not related here.
---
.../bindings/pwm/atmel,hlcdc-pwm.yaml | 44 +++++++++++++++++++
.../bindings/pwm/atmel-hlcdc-pwm.txt | 29 ------------
2 files changed, 44 insertions(+), 29 deletions(-)
create mode 100644 Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
delete mode 100644 Documentation/devicetree/bindings/pwm/atmel-hlcdc-pwm.txt

diff --git a/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml b/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
new file mode 100644
index 000000000000..4f4cc21fe4f7
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/atmel,hlcdc-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Atmel's HLCDC's PWM controller
+
+maintainers:
+ - Nicolas Ferre <[email protected]>
+ - Alexandre Belloni <[email protected]>
+ - Claudiu Beznea <[email protected]>
+
+description:
+ The LCDC integrates a Pulse Width Modulation (PWM) Controller. This block
+ generates the LCD contrast control signal (LCD_PWM) that controls the
+ display's contrast by software. LCDC_PWM is an 8-bit PWM signal that can be
+ converted to an analog voltage with a simple passive filter. LCD display
+ panels have different backlight specifications in terms of minimum/maximum
+ values for PWM frequency. If the LCDC PWM frequency range does not match the
+ LCD display panel, it is possible to use the standalone PWM Controller to
+ drive the backlight.
+
+properties:
+ compatible:
+ const: atmel,hlcdc-pwm
+
+ "#pwm-cells":
+ const: 3
+
+required:
+ - compatible
+ - "#pwm-cells"
+
+additionalProperties: false
+
+examples:
+ - |
+ pwm {
+ compatible = "atmel,hlcdc-pwm";
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_lcd_pwm>;
+ #pwm-cells = <3>;
+ };
diff --git a/Documentation/devicetree/bindings/pwm/atmel-hlcdc-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-hlcdc-pwm.txt
deleted file mode 100644
index afa501bf7f94..000000000000
--- a/Documentation/devicetree/bindings/pwm/atmel-hlcdc-pwm.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-Device-Tree bindings for Atmel's HLCDC (High-end LCD Controller) PWM driver
-
-The Atmel HLCDC PWM is subdevice of the HLCDC MFD device.
-See ../mfd/atmel-hlcdc.txt for more details.
-
-Required properties:
- - compatible: value should be one of the following:
- "atmel,hlcdc-pwm"
- - pinctr-names: the pin control state names. Should contain "default".
- - pinctrl-0: should contain the pinctrl states described by pinctrl
- default.
- - #pwm-cells: should be set to 3. This PWM chip use the default 3 cells
- bindings defined in pwm.yaml in this directory.
-
-Example:
-
- hlcdc: hlcdc@f0030000 {
- compatible = "atmel,sama5d3-hlcdc";
- reg = <0xf0030000 0x2000>;
- clocks = <&lcdc_clk>, <&lcdck>, <&clk32k>;
- clock-names = "periph_clk","sys_clk", "slow_clk";
-
- hlcdc_pwm: hlcdc-pwm {
- compatible = "atmel,hlcdc-pwm";
- pinctrl-names = "default";
- pinctrl-0 = <&pinctrl_lcd_pwm>;
- #pwm-cells = <3>;
- };
- };
--
2.25.1


2024-01-18 10:17:20

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema

Hello,

On Thu, Jan 18, 2024 at 02:56:11PM +0530, Dharma Balasubiramani wrote:
> Convert device tree bindings for Atmel's HLCDC PWM controller to YAML
> format.
>
> Signed-off-by: Dharma Balasubiramani <[email protected]>
> Reviewed-by: Conor Dooley <[email protected]>

Reviewed-by: Uwe Kleine-K?nig <[email protected]>

I will update the short log to

dt-bindings: pwm: atmel,hlcdc: Convert bindings to json-schema

to match my preferences (unless you object) and apply for next after the
merge window.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (731.00 B)
signature.asc (499.00 B)
Download all attachments

2024-01-18 15:33:19

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] dt-bindings: display: convert Atmel's HLCDC to DT schema

On Thu, Jan 18, 2024 at 02:56:10PM +0530, Dharma Balasubiramani wrote:
> Convert the existing DT binding to DT schema of the Atmel's HLCDC display
> controller.
>
> Signed-off-by: Dharma Balasubiramani <[email protected]>
> ---
> changelog
> v2 -> v3
> - Remove '|' in description, as there is no formatting to preserve.
> - Ref video-interfaces as endpoint.
> - Remove ref and description for bus-width.
> - Add new line before the child node in example.

> - Remove 'example 2', as it is not required for just one additional property.

Rob's comment on the previous version was:
| Just 1 extra property doesn't justify 2 examples.
|
| In any case, drop the partial examples and just have 1 complete example
| in the MFD binding schema.


Attachments:
(No filename) (768.00 B)
signature.asc (235.00 B)
Download all attachments

2024-01-18 23:16:20

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

Hi Dharma et al.

On Thu, Jan 18, 2024 at 02:56:09PM +0530, Dharma Balasubiramani wrote:
> Converted the text bindings to YAML and validated them individually using following commands
>
> $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
> $ make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
>
> changelogs are available in respective patches.
>
> Dharma Balasubiramani (3):
> dt-bindings: display: convert Atmel's HLCDC to DT schema
> dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema
> dt-bindings: mfd: atmel,hlcdc: Convert to DT schema format

I know this is a bit late to ask - sorry in advance.

The binding describes the single IP block as a multi functional device,
but it is a single IP block that includes the display controller and a
simple pwm that can be used for contrast or backlight.

If we ignore the fact that the current drivers for hlcdc uses an mfd
abstraction, is this then the optimal way to describe the HW?


In one of my stale git tree I converted atmel lcdc to DT, and here
I used:

+ "#pwm-cells":
+ description:
+ This PWM chip use the default 3 cells bindings
+ defined in ../../pwm/pwm.yaml.
+ const: 3
+
+ clocks:
+ maxItems: 2
+
+ clock-names:
+ maxItems: 2
+ items:
+ - const: lcdc_clk
+ - const: hclk

This proved to be a simple way to describe the HW.

To make the DT binding backward compatible you likely need to add a few
compatible that otherwise would have been left out - but that should do
the trick.

The current atmel hlcdc driver that is split in three is IMO an
over-engineering, and the driver could benefit merging it all in one.
And the binding should not prevent this.

Sam

2024-01-19 02:52:55

by Dharma Balasubiramani

[permalink] [raw]
Subject: Re: [PATCH v3 1/3] dt-bindings: display: convert Atmel's HLCDC to DT schema

On 18/01/24 9:01 pm, Conor Dooley wrote:
> On Thu, Jan 18, 2024 at 02:56:10PM +0530, Dharma Balasubiramani wrote:
>> Convert the existing DT binding to DT schema of the Atmel's HLCDC display
>> controller.
>>
>> Signed-off-by: Dharma Balasubiramani<[email protected]>
>> ---
>> changelog
>> v2 -> v3
>> - Remove '|' in description, as there is no formatting to preserve.
>> - Ref video-interfaces as endpoint.
>> - Remove ref and description for bus-width.
>> - Add new line before the child node in example.
>> - Remove 'example 2', as it is not required for just one additional property.
> Rob's comment on the previous version was:
> | Just 1 extra property doesn't justify 2 examples.
> |
> | In any case, drop the partial examples and just have 1 complete example
> | in the MFD binding schema.
>
Okay understood, I will include the 'bus-width' in the example.
--
With Best Regards,
Dharma B.

2024-01-19 08:41:30

by Dharma Balasubiramani

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

Hi Sam,
On 19/01/24 1:00 am, Sam Ravnborg wrote:
> [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Hi Dharma et al.
>
> On Thu, Jan 18, 2024 at 02:56:09PM +0530, Dharma Balasubiramani wrote:
>> Converted the text bindings to YAML and validated them individually using following commands
>>
>> $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
>> $ make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
>>
>> changelogs are available in respective patches.
>>
>> Dharma Balasubiramani (3):
>> dt-bindings: display: convert Atmel's HLCDC to DT schema
>> dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema
>> dt-bindings: mfd: atmel,hlcdc: Convert to DT schema format
>
> I know this is a bit late to ask - sorry in advance.
>
> The binding describes the single IP block as a multi functional device,
> but it is a single IP block that includes the display controller and a
> simple pwm that can be used for contrast or backlight.
yes.
>
> If we ignore the fact that the current drivers for hlcdc uses an mfd
> abstraction, is this then the optimal way to describe the HW?
>
>
> In one of my stale git tree I converted atmel lcdc to DT, and here
Are you referring the "bindings/display/atmel,lcdc.txt"?
> I used:
>
> + "#pwm-cells":
> + description:
> + This PWM chip use the default 3 cells bindings
> + defined in ../../pwm/pwm.yaml.
> + const: 3
> +
> + clocks:
> + maxItems: 2
> +
> + clock-names:
> + maxItems: 2
> + items:
> + - const: lcdc_clk
> + - const: hclk
>
> This proved to be a simple way to describe the HW.
>
> To make the DT binding backward compatible you likely need to add a few
> compatible that otherwise would have been left out - but that should do
> the trick.
again you mean the compatibles from atmel,lcdc binding?
>
> The current atmel hlcdc driver that is split in three is IMO an
> over-engineering, and the driver could benefit merging it all in one.
> And the binding should not prevent this.
could you please confirm if my understanding is correct: you want a
unified display binding that encompasses the properties of the two
subdevices (display controller and pwm), eliminating the need to
reference them in additional bindings?
>
> Sam

--
With Best Regards,
Dharma B.

2024-01-19 19:45:46

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema

On Thu, Jan 18, 2024 at 02:56:11PM +0530, Dharma Balasubiramani wrote:
> Convert device tree bindings for Atmel's HLCDC PWM controller to YAML
> format.
>
> Signed-off-by: Dharma Balasubiramani <[email protected]>
> Reviewed-by: Conor Dooley <[email protected]>
> ---
> changelog
> v2 -> v3
> - Remove '|' in description, as there is no formatting to preserve.
> - Delete the description for pwm-cells.
> - Drop the label for pwm node as it not used.
> v1 -> v2
> - Remove the explicit copyrights.
> - Modify title (not include words like binding/driver).
> - Modify description actually describing the hardware and not the driver.
> - Remove pinctrl properties which aren't required.
> - Drop parent node and it's other sub-device node which are not related here.
> ---
> .../bindings/pwm/atmel,hlcdc-pwm.yaml | 44 +++++++++++++++++++
> .../bindings/pwm/atmel-hlcdc-pwm.txt | 29 ------------
> 2 files changed, 44 insertions(+), 29 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
> delete mode 100644 Documentation/devicetree/bindings/pwm/atmel-hlcdc-pwm.txt
>
> diff --git a/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml b/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
> new file mode 100644
> index 000000000000..4f4cc21fe4f7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
> @@ -0,0 +1,44 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/pwm/atmel,hlcdc-pwm.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Atmel's HLCDC's PWM controller
> +
> +maintainers:
> + - Nicolas Ferre <[email protected]>
> + - Alexandre Belloni <[email protected]>
> + - Claudiu Beznea <[email protected]>
> +
> +description:
> + The LCDC integrates a Pulse Width Modulation (PWM) Controller. This block
> + generates the LCD contrast control signal (LCD_PWM) that controls the
> + display's contrast by software. LCDC_PWM is an 8-bit PWM signal that can be
> + converted to an analog voltage with a simple passive filter. LCD display
> + panels have different backlight specifications in terms of minimum/maximum
> + values for PWM frequency. If the LCDC PWM frequency range does not match the
> + LCD display panel, it is possible to use the standalone PWM Controller to
> + drive the backlight.
> +
> +properties:
> + compatible:
> + const: atmel,hlcdc-pwm
> +
> + "#pwm-cells":
> + const: 3
> +
> +required:
> + - compatible
> + - "#pwm-cells"
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + pwm {
> + compatible = "atmel,hlcdc-pwm";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_lcd_pwm>;
> + #pwm-cells = <3>;
> + };

Move the example to the MFD schema. Or just drop if already there.

Rob

2024-01-19 19:52:02

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

On Thu, Jan 18, 2024 at 08:30:40PM +0100, Sam Ravnborg wrote:
> Hi Dharma et al.
>
> On Thu, Jan 18, 2024 at 02:56:09PM +0530, Dharma Balasubiramani wrote:
> > Converted the text bindings to YAML and validated them individually using following commands
> >
> > $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
> > $ make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
> >
> > changelogs are available in respective patches.
> >
> > Dharma Balasubiramani (3):
> > dt-bindings: display: convert Atmel's HLCDC to DT schema
> > dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema
> > dt-bindings: mfd: atmel,hlcdc: Convert to DT schema format
>
> I know this is a bit late to ask - sorry in advance.
>
> The binding describes the single IP block as a multi functional device,
> but it is a single IP block that includes the display controller and a
> simple pwm that can be used for contrast or backlight.
>
> If we ignore the fact that the current drivers for hlcdc uses an mfd
> abstraction, is this then the optimal way to describe the HW?
>
>
> In one of my stale git tree I converted atmel lcdc to DT, and here
> I used:
>
> + "#pwm-cells":
> + description:
> + This PWM chip use the default 3 cells bindings
> + defined in ../../pwm/pwm.yaml.
> + const: 3
> +
> + clocks:
> + maxItems: 2
> +
> + clock-names:
> + maxItems: 2
> + items:
> + - const: lcdc_clk
> + - const: hclk
>
> This proved to be a simple way to describe the HW.
>
> To make the DT binding backward compatible you likely need to add a few
> compatible that otherwise would have been left out - but that should do
> the trick.
>
> The current atmel hlcdc driver that is split in three is IMO an
> over-engineering, and the driver could benefit merging it all in one.
> And the binding should not prevent this.

I agree on all this, but a conversion is not really the time to redesign
things. Trust me, I've wanted to on lots of conversions. It should be
possible to simplify the driver side while keeping the DT as-is. Just
make the display driver bind to the MFD node instead. After that, then
one could look at flattening everything to 1 node.

Rob

2024-01-19 22:51:07

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

Hi Dharma,

On Fri, Jan 19, 2024 at 08:41:04AM +0000, [email protected] wrote:
> Hi Sam,
> On 19/01/24 1:00 am, Sam Ravnborg wrote:
> > [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> >
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> > Hi Dharma et al.
> >
> > On Thu, Jan 18, 2024 at 02:56:09PM +0530, Dharma Balasubiramani wrote:
> >> Converted the text bindings to YAML and validated them individually using following commands
> >>
> >> $ make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
> >> $ make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/
> >>
> >> changelogs are available in respective patches.
> >>
> >> Dharma Balasubiramani (3):
> >> dt-bindings: display: convert Atmel's HLCDC to DT schema
> >> dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema
> >> dt-bindings: mfd: atmel,hlcdc: Convert to DT schema format
> >
> > I know this is a bit late to ask - sorry in advance.
> >
> > The binding describes the single IP block as a multi functional device,
> > but it is a single IP block that includes the display controller and a
> > simple pwm that can be used for contrast or backlight.
> yes.
> >
> > If we ignore the fact that the current drivers for hlcdc uses an mfd
> > abstraction, is this then the optimal way to describe the HW?
> >
> >
> > In one of my stale git tree I converted atmel lcdc to DT, and here
> Are you referring the "bindings/display/atmel,lcdc.txt"?
Correct.

> > I used:
> >
> > + "#pwm-cells":
> > + description:
> > + This PWM chip use the default 3 cells bindings
> > + defined in ../../pwm/pwm.yaml.
> > + const: 3
> > +
> > + clocks:
> > + maxItems: 2
> > +
> > + clock-names:
> > + maxItems: 2
> > + items:
> > + - const: lcdc_clk
> > + - const: hclk
> >
> > This proved to be a simple way to describe the HW.
> >
> > To make the DT binding backward compatible you likely need to add a few
> > compatible that otherwise would have been left out - but that should do
> > the trick.
> again you mean the compatibles from atmel,lcdc binding?

If the new binding describes the full IP, as I suggest, then I assume
you need to add the compatible "atmel,hlcdc-pwm" to be backward
compatible. Otherwise users assuming the old binding will fail to find
the pwm info. I am not sure how important this is - but at least then
the device trees can be updated out of sync with the current users.

I hope this explains what I tried to say, otherwise do not hesitate to
get back to me.

Sam

2024-01-20 10:04:45

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema

Hello,

On Thu, Jan 18, 2024 at 11:16:49AM +0100, Uwe Kleine-K?nig wrote:
> On Thu, Jan 18, 2024 at 02:56:11PM +0530, Dharma Balasubiramani wrote:
> > Convert device tree bindings for Atmel's HLCDC PWM controller to YAML
> > format.
> >
> > Signed-off-by: Dharma Balasubiramani <[email protected]>
> > Reviewed-by: Conor Dooley <[email protected]>
>
> Reviewed-by: Uwe Kleine-K?nig <[email protected]>
>
> I will update the short log to
>
> dt-bindings: pwm: atmel,hlcdc: Convert bindings to json-schema
>
> to match my preferences (unless you object) and apply for next after the
> merge window.

Dropped from my todo-list after Rob's feedback.

Best regards
Uwe


--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | https://www.pengutronix.de/ |


Attachments:
(No filename) (881.00 B)
signature.asc (499.00 B)
Download all attachments

2024-01-20 13:24:14

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

Hi Dharma & Rob.

> > To make the DT binding backward compatible you likely need to add a few
> > compatible that otherwise would have been left out - but that should do
> > the trick.
> >
> > The current atmel hlcdc driver that is split in three is IMO an
> > over-engineering, and the driver could benefit merging it all in one.
> > And the binding should not prevent this.
>
> I agree on all this, but a conversion is not really the time to redesign
> things. Trust me, I've wanted to on lots of conversions. It should be
> possible to simplify the driver side while keeping the DT as-is. Just
> make the display driver bind to the MFD node instead. After that, then
> one could look at flattening everything to 1 node.

Understood and thinking a bit about it fully agreed as well.
Dharma - please see my comments only as ideas for the future, and
ignore them in this fine rewrite you do.

Sam

2024-01-22 03:53:04

by Dharma Balasubiramani

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

On 20/01/24 6:53 pm, Sam Ravnborg wrote:
> [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> Hi Sam & Rob,
> Hi Dharma & Rob.
>
>>> To make the DT binding backward compatible you likely need to add a few
>>> compatible that otherwise would have been left out - but that should do
>>> the trick.
>>>
>>> The current atmel hlcdc driver that is split in three is IMO an
>>> over-engineering, and the driver could benefit merging it all in one.
>>> And the binding should not prevent this.
>>
>> I agree on all this, but a conversion is not really the time to redesign
>> things. Trust me, I've wanted to on lots of conversions. It should be
>> possible to simplify the driver side while keeping the DT as-is. Just
>> make the display driver bind to the MFD node instead. After that, then
>> one could look at flattening everything to 1 node.
>
> Understood and thinking a bit about it fully agreed as well.
> Dharma - please see my comments only as ideas for the future, and
> ignore them in this fine rewrite you do.
>
> Sam
Based on your insights, I'm contemplating the decision to merge Patch 2
[PWM binding] with Patch 3[MFD binding]. It seems redundant given that
we already have a PWM node example in the MFD binding.

Instead of introducing a new PWM binding,
pwm:
$ref: /schemas/pwm/atmel,hlcdc-pwm.yaml

I will update the existing MFD binding as follows:

properties:
compatible:
const: atmel,hlcdc-pwm

"#pwm-cells":
const: 3

required:
- compatible
- "#pwm-cells"

--
With Best Regards,
Dharma B.

2024-01-22 20:07:06

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

Hi Dharma
On Mon, Jan 22, 2024 at 03:52:17AM +0000, [email protected] wrote:
> On 20/01/24 6:53 pm, Sam Ravnborg wrote:
> > [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> >
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > Hi Sam & Rob,
> > Hi Dharma & Rob.
> >
> >>> To make the DT binding backward compatible you likely need to add a few
> >>> compatible that otherwise would have been left out - but that should do
> >>> the trick.
> >>>
> >>> The current atmel hlcdc driver that is split in three is IMO an
> >>> over-engineering, and the driver could benefit merging it all in one.
> >>> And the binding should not prevent this.
> >>
> >> I agree on all this, but a conversion is not really the time to redesign
> >> things. Trust me, I've wanted to on lots of conversions. It should be
> >> possible to simplify the driver side while keeping the DT as-is. Just
> >> make the display driver bind to the MFD node instead. After that, then
> >> one could look at flattening everything to 1 node.
> >
> > Understood and thinking a bit about it fully agreed as well.
> > Dharma - please see my comments only as ideas for the future, and
> > ignore them in this fine rewrite you do.
> >
> > Sam
> Based on your insights, I'm contemplating the decision to merge Patch 2
> [PWM binding] with Patch 3[MFD binding]. It seems redundant given that
> we already have a PWM node example in the MFD binding.
>
> Instead of introducing a new PWM binding,
> pwm:
> $ref: /schemas/pwm/atmel,hlcdc-pwm.yaml
>
> I will update the existing MFD binding as follows:
>
> properties:
> compatible:
> const: atmel,hlcdc-pwm
>
> "#pwm-cells":
> const: 3
>
> required:
> - compatible
> - "#pwm-cells"
>
Good idea, this looks like a nice simplification.

Sam

2024-01-22 23:22:13

by Sam Ravnborg

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

Hi Dharma,
On Mon, Jan 22, 2024 at 03:52:17AM +0000, [email protected] wrote:
> On 20/01/24 6:53 pm, Sam Ravnborg wrote:
> > [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> >
> > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> > Hi Sam & Rob,
> > Hi Dharma & Rob.
> >
> >>> To make the DT binding backward compatible you likely need to add a few
> >>> compatible that otherwise would have been left out - but that should do
> >>> the trick.
> >>>
> >>> The current atmel hlcdc driver that is split in three is IMO an
> >>> over-engineering, and the driver could benefit merging it all in one.
> >>> And the binding should not prevent this.
> >>
> >> I agree on all this, but a conversion is not really the time to redesign
> >> things. Trust me, I've wanted to on lots of conversions. It should be
> >> possible to simplify the driver side while keeping the DT as-is. Just
> >> make the display driver bind to the MFD node instead. After that, then
> >> one could look at flattening everything to 1 node.
> >
> > Understood and thinking a bit about it fully agreed as well.
> > Dharma - please see my comments only as ideas for the future, and
> > ignore them in this fine rewrite you do.
> >
> > Sam
> Based on your insights, I'm contemplating the decision to merge Patch 2
> [PWM binding] with Patch 3[MFD binding]. It seems redundant given that
> we already have a PWM node example in the MFD binding.
>
> Instead of introducing a new PWM binding,
> pwm:
> $ref: /schemas/pwm/atmel,hlcdc-pwm.yaml
>
> I will update the existing MFD binding as follows:
>
> properties:
> compatible:
> const: atmel,hlcdc-pwm
>
> "#pwm-cells":
> const: 3
>
> required:
> - compatible
> - "#pwm-cells"
>
As already commented, this looks nice.
But as Rob said, this should be a 1:1 conversion from text to yaml,
and then clean-up can come in the second step.

Sam

2024-01-24 08:56:10

by Dharma Balasubiramani

[permalink] [raw]
Subject: Re: [PATCH v3 0/3] Convert Microchip's HLCDC Text based DT bindings to JSON schema

On 22/01/24 9:34 pm, Sam Ravnborg wrote:
> [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Hi Dharma,
> On Mon, Jan 22, 2024 at 03:52:17AM +0000, [email protected] wrote:
>> On 20/01/24 6:53 pm, Sam Ravnborg wrote:
>>> [You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>>>
>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>> Hi Sam & Rob,
>>> Hi Dharma & Rob.
>>>
>>>>> To make the DT binding backward compatible you likely need to add a few
>>>>> compatible that otherwise would have been left out - but that should do
>>>>> the trick.
>>>>>
>>>>> The current atmel hlcdc driver that is split in three is IMO an
>>>>> over-engineering, and the driver could benefit merging it all in one.
>>>>> And the binding should not prevent this.
>>>>
>>>> I agree on all this, but a conversion is not really the time to redesign
>>>> things. Trust me, I've wanted to on lots of conversions. It should be
>>>> possible to simplify the driver side while keeping the DT as-is. Just
>>>> make the display driver bind to the MFD node instead. After that, then
>>>> one could look at flattening everything to 1 node.
>>>
>>> Understood and thinking a bit about it fully agreed as well.
>>> Dharma - please see my comments only as ideas for the future, and
>>> ignore them in this fine rewrite you do.
>>>
>>> Sam
>> Based on your insights, I'm contemplating the decision to merge Patch 2
>> [PWM binding] with Patch 3[MFD binding]. It seems redundant given that
>> we already have a PWM node example in the MFD binding.
>>
>> Instead of introducing a new PWM binding,
>> pwm:
>> $ref: /schemas/pwm/atmel,hlcdc-pwm.yaml
>>
>> I will update the existing MFD binding as follows:
>>
>> properties:
>> compatible:
>> const: atmel,hlcdc-pwm
>>
>> "#pwm-cells":
>> const: 3
>>
>> required:
>> - compatible
>> - "#pwm-cells"
>>
> As already commented, this looks nice.
> But as Rob said, this should be a 1:1 conversion from text to yaml,
> and then clean-up can come in the second step.

Fine, I will send v4 with no changes in [PATCH 2] PWM binding, I will
send another separate patch for this clean up.

--
Thanks,
Dharma B.

>
> Sam



2024-01-24 09:59:44

by Dharma Balasubiramani

[permalink] [raw]
Subject: Re: [PATCH v3 2/3] dt-bindings: atmel,hlcdc: convert pwm bindings to json-schema

Hi Rob,
On 20/01/24 1:15 am, Rob Herring wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> On Thu, Jan 18, 2024 at 02:56:11PM +0530, Dharma Balasubiramani wrote:
>> Convert device tree bindings for Atmel's HLCDC PWM controller to YAML
>> format.
>>
>> Signed-off-by: Dharma Balasubiramani <[email protected]>
>> Reviewed-by: Conor Dooley <[email protected]>
>> ---
>> changelog
>> v2 -> v3
>> - Remove '|' in description, as there is no formatting to preserve.
>> - Delete the description for pwm-cells.
>> - Drop the label for pwm node as it not used.
>> v1 -> v2
>> - Remove the explicit copyrights.
>> - Modify title (not include words like binding/driver).
>> - Modify description actually describing the hardware and not the driver.
>> - Remove pinctrl properties which aren't required.
>> - Drop parent node and it's other sub-device node which are not related here.
>> ---
>> .../bindings/pwm/atmel,hlcdc-pwm.yaml | 44 +++++++++++++++++++
>> .../bindings/pwm/atmel-hlcdc-pwm.txt | 29 ------------
>> 2 files changed, 44 insertions(+), 29 deletions(-)
>> create mode 100644 Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
>> delete mode 100644 Documentation/devicetree/bindings/pwm/atmel-hlcdc-pwm.txt
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml b/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
>> new file mode 100644
>> index 000000000000..4f4cc21fe4f7
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/pwm/atmel,hlcdc-pwm.yaml
>> @@ -0,0 +1,44 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/pwm/atmel,hlcdc-pwm.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Atmel's HLCDC's PWM controller
>> +
>> +maintainers:
>> + - Nicolas Ferre <[email protected]>
>> + - Alexandre Belloni <[email protected]>
>> + - Claudiu Beznea <[email protected]>
>> +
>> +description:
>> + The LCDC integrates a Pulse Width Modulation (PWM) Controller. This block
>> + generates the LCD contrast control signal (LCD_PWM) that controls the
>> + display's contrast by software. LCDC_PWM is an 8-bit PWM signal that can be
>> + converted to an analog voltage with a simple passive filter. LCD display
>> + panels have different backlight specifications in terms of minimum/maximum
>> + values for PWM frequency. If the LCDC PWM frequency range does not match the
>> + LCD display panel, it is possible to use the standalone PWM Controller to
>> + drive the backlight.
>> +
>> +properties:
>> + compatible:
>> + const: atmel,hlcdc-pwm
>> +
>> + "#pwm-cells":
>> + const: 3
>> +
>> +required:
>> + - compatible
>> + - "#pwm-cells"
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> + - |
>> + pwm {
>> + compatible = "atmel,hlcdc-pwm";
>> + pinctrl-names = "default";
>> + pinctrl-0 = <&pinctrl_lcd_pwm>;
>> + #pwm-cells = <3>;
>> + };
>
> Move the example to the MFD schema. Or just drop if already there.

As Sam suggested I will send v4 series with this binding as it is and
will send the clean up patch later.

--
Thanks,
Dharma B.
>
> Rob