2023-10-05 14:45:46

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 0/2] pwm: add driver for T-THEAD TH1520 SoC

T-HEAD SoCs such as the TH1520 contain a PWM controller used 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.

since v2:
- collect Reviewed-by tag
- add CTRL_ prefix for THEAD_PWM_CTRL register bit macros
- use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() and
check its return value.
- remove unnecessary casts
- call pm_runtime_put_sync() when pwm channel is disabled
- use devm_pm_runtime_enable() and then drop .remove()
- properly consider if pwm is programmed by bootloader or other
pre-linux env.
- simplify thead_pwm_runtime_resume() code as Uwe suggested
- bool ever_started -> u8 channel_ever_started since we have 6 channels
- use 3 for #pwm-cells

since v1:
- update commit msg and yaml filename to address Conor's comment
- use devm_clk_get_enabled() and devm_pwmchip_add()
- implement .get_state()
- properly handle overflow
- introduce thead_pwm_from_chip() inline function
- document Limitations
- address pm_runtime_get/put pingpong comment


Jisheng Zhang (2):
dt-bindings: pwm: Add T-HEAD PWM controller
pwm: add T-HEAD PWM driver

.../bindings/pwm/thead,th1520-pwm.yaml | 44 +++
drivers/pwm/Kconfig | 11 +
drivers/pwm/Makefile | 1 +
drivers/pwm/pwm-thead.c | 270 ++++++++++++++++++
4 files changed, 326 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml
create mode 100644 drivers/pwm/pwm-thead.c

--
2.40.1


2023-10-05 15:58:45

by Jisheng Zhang

[permalink] [raw]
Subject: [PATCH v3 1/2] dt-bindings: pwm: Add T-HEAD PWM controller

T-HEAD SoCs such as the TH1520 contain a PWM controller used
to control the LCD backlight, fan and so on.

Signed-off-by: Jisheng Zhang <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
---
.../bindings/pwm/thead,th1520-pwm.yaml | 44 +++++++++++++++++++
1 file changed, 44 insertions(+)
create mode 100644 Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml

diff --git a/Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml b/Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml
new file mode 100644
index 000000000000..e75d8e9f24c5
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/thead,th1520-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/thead,th1520-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: T-HEAD TH1520 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: 3
+
+required:
+ - compatible
+ - reg
+ - clocks
+
+additionalProperties: false
+
+examples:
+ - |
+
+ pwm@ec01c000 {
+ compatible = "thead,th1520-pwm";
+ reg = <0xec01c000 0x1000>;
+ clocks = <&clk 1>;
+ #pwm-cells = <3>;
+ };
--
2.40.1

2023-11-06 15:02:37

by Jisheng Zhang

[permalink] [raw]
Subject: Re: [PATCH v3 0/2] pwm: add driver for T-THEAD TH1520 SoC

On Thu, Oct 05, 2023 at 09:05:17PM +0800, Jisheng Zhang wrote:
> T-HEAD SoCs such as the TH1520 contain a PWM controller used 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.
>
> since v2:
> - collect Reviewed-by tag
> - add CTRL_ prefix for THEAD_PWM_CTRL register bit macros
> - use pm_runtime_resume_and_get() instead of pm_runtime_get_sync() and
> check its return value.
> - remove unnecessary casts
> - call pm_runtime_put_sync() when pwm channel is disabled
> - use devm_pm_runtime_enable() and then drop .remove()
> - properly consider if pwm is programmed by bootloader or other
> pre-linux env.
> - simplify thead_pwm_runtime_resume() code as Uwe suggested
> - bool ever_started -> u8 channel_ever_started since we have 6 channels
> - use 3 for #pwm-cells
>
> since v1:
> - update commit msg and yaml filename to address Conor's comment
> - use devm_clk_get_enabled() and devm_pwmchip_add()
> - implement .get_state()
> - properly handle overflow
> - introduce thead_pwm_from_chip() inline function
> - document Limitations
> - address pm_runtime_get/put pingpong comment
>
>
> Jisheng Zhang (2):
> dt-bindings: pwm: Add T-HEAD PWM controller
> pwm: add T-HEAD PWM driver

Hi Thierry, Uwe,

Kind ping, is there any chance for this series to be merged for v6.7?

Thanks
>
> .../bindings/pwm/thead,th1520-pwm.yaml | 44 +++
> drivers/pwm/Kconfig | 11 +
> drivers/pwm/Makefile | 1 +
> drivers/pwm/pwm-thead.c | 270 ++++++++++++++++++
> 4 files changed, 326 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/pwm/thead,th1520-pwm.yaml
> create mode 100644 drivers/pwm/pwm-thead.c
>
> --
> 2.40.1
>

2023-11-06 15:44:06

by Uwe Kleine-König

[permalink] [raw]
Subject: Re: [PATCH v3 0/2] pwm: add driver for T-THEAD TH1520 SoC

Hi,

On Mon, Nov 06, 2023 at 10:49:33PM +0800, Jisheng Zhang wrote:
> Kind ping, is there any chance for this series to be merged for v6.7?

I didn't forget about reviewing your driver, but as such a review takes
quite some time I often fail to do the review in a timely manner. Sorry
about that.

Having said that I guess Thierry's tree won't pick up any new patches
given that we already crossed the middle of the merge window and patches
are supposed to be in next for some time before being sent to Linus.

Best regards
Uwe

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


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