T-HEAD SoCs such as the TH1520 contain a PWM controller used
among other things to control the LCD backlight, fan and so on.
Add the PWM driver support for it.
Since the clk part isn't mainlined, so SoC dts(i) changes are not
included in this series. However, it can be tested by using fixed-clock.
Jisheng Zhang (2):
dt-bindings: pwm: Add T-HEAD PWM controller
pwm: add T-HEAD PWM driver
.../devicetree/bindings/pwm/pwm-thead.yaml | 44 +++
MAINTAINERS | 1 +
drivers/pwm/Kconfig | 11 +
drivers/pwm/Makefile | 1 +
drivers/pwm/pwm-thead.c | 289 ++++++++++++++++++
5 files changed, 346 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pwm/pwm-thead.yaml
create mode 100644 drivers/pwm/pwm-thead.c
--
2.40.1
T-HEAD SoCs such as the TH1520 contain a PWM controller used
among other things to control the LCD backlight, fan and so on.
Signed-off-by: Jisheng Zhang <[email protected]>
---
.../devicetree/bindings/pwm/pwm-thead.yaml | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pwm/pwm-thead.yaml
diff --git a/Documentation/devicetree/bindings/pwm/pwm-thead.yaml b/Documentation/devicetree/bindings/pwm/pwm-thead.yaml
new file mode 100644
index 000000000000..8a7cf7129321
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/pwm-thead.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/pwm-thead.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: T-HEAD PWM
+
+maintainers:
+ - Jisheng Zhang <[email protected]>
+
+allOf:
+ - $ref: pwm.yaml#
+
+properties:
+ compatible:
+ enum:
+ - thead,th1520-pwm
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ "#pwm-cells":
+ const: 2
+
+required:
+ - compatible
+ - reg
+ - clocks
+
+additionalProperties: false
+
+examples:
+ - |
+
+ pwm@ec01c000 {
+ compatible = "thead,th1520-pwm";
+ reg = <0xec01c000 0x1000>;
+ clocks = <&clk 1>;
+ #pwm-cells = <2>;
+ };
--
2.40.1
Hey,
On Fri, Sep 29, 2023 at 01:02:53AM +0800, Jisheng Zhang wrote:
> T-HEAD SoCs such as the TH1520 contain a PWM controller used
> among other things to control the LCD backlight, fan and so on.
"such as", are there others?
>
> Signed-off-by: Jisheng Zhang <[email protected]>
> ---
> .../devicetree/bindings/pwm/pwm-thead.yaml | 44 +++++++++++++++++++
> 1 file changed, 44 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/pwm/pwm-thead.yaml
>
> diff --git a/Documentation/devicetree/bindings/pwm/pwm-thead.yaml b/Documentation/devicetree/bindings/pwm/pwm-thead.yaml
> new file mode 100644
> index 000000000000..8a7cf7129321
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pwm/pwm-thead.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/pwm-thead.yaml#
The filename etc should match the compatible, especially when afaict
there's only one applicable SoC.
Otherwise, this looks good to me.
Thanks,
Conor.
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: T-HEAD PWM
> +
> +maintainers:
> + - Jisheng Zhang <[email protected]>
> +
> +allOf:
> + - $ref: pwm.yaml#
> +
> +properties:
> + compatible:
> + enum:
> + - thead,th1520-pwm
> +
> + reg:
> + maxItems: 1
> +
> + clocks:
> + maxItems: 1
> +
> + "#pwm-cells":
> + const: 2
> +
> +required:
> + - compatible
> + - reg
> + - clocks
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> +
> + pwm@ec01c000 {
> + compatible = "thead,th1520-pwm";
> + reg = <0xec01c000 0x1000>;
> + clocks = <&clk 1>;
> + #pwm-cells = <2>;
> + };
> --
> 2.40.1
>