linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] pwm: meson: add pwm support for A1
@ 2024-07-02 12:34 George Stark
  2024-07-02 12:34 ` [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM George Stark
  2024-07-02 12:34 ` [PATCH v3 2/2] arm64: dts: meson: a1: add definitions for meson PWM George Stark
  0 siblings, 2 replies; 6+ messages in thread
From: George Stark @ 2024-07-02 12:34 UTC (permalink / raw)
  To: ukleinek, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	jbrunet, martin.blumenstingl, hkallweit1
  Cc: linux-pwm, devicetree, linux-amlogic, linux-arm-kernel,
	linux-kernel, kernel, George Stark

Add support for Amlogic meson A1 SoC family PWM

Changes in v2:
  add patch with optional power-domains to pwm bindings;
  fix syntax in a1 bindigns patch:
  - use enum over const for amlogic,meson-a1-pwm beacuse adding more devices here
    are expected
  - leave only base compatible amlogic,meson-s4-pwm in check section
  dt_binding_check and dtbs_check run ok now;
  previous version: [1]

Changes in v3:
  squash power-domains patch into main bindigns patch
  add conditional to bindings that power-domains property is required only for a1
  previous version: [2]

[1] https://lore.kernel.org/lkml/20240701130113.433169-3-gnstark@salutedevices.com/T/
[2] https://lore.kernel.org/lkml/20240701172016.523402-1-gnstark@salutedevices.com/T/

George Stark (2):
  dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM
  arm64: dts: meson: a1: add definitions for meson PWM

 .../devicetree/bindings/pwm/pwm-amlogic.yaml  |  17 ++
 arch/arm64/boot/dts/amlogic/meson-a1.dtsi     | 215 ++++++++++++++++++
 2 files changed, 232 insertions(+)

--
2.25.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM
  2024-07-02 12:34 [PATCH v3 0/2] pwm: meson: add pwm support for A1 George Stark
@ 2024-07-02 12:34 ` George Stark
  2024-07-02 14:48   ` Conor Dooley
  2024-07-08 13:11   ` Jerome Brunet
  2024-07-02 12:34 ` [PATCH v3 2/2] arm64: dts: meson: a1: add definitions for meson PWM George Stark
  1 sibling, 2 replies; 6+ messages in thread
From: George Stark @ 2024-07-02 12:34 UTC (permalink / raw)
  To: ukleinek, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	jbrunet, martin.blumenstingl, hkallweit1
  Cc: linux-pwm, devicetree, linux-amlogic, linux-arm-kernel,
	linux-kernel, kernel, George Stark, Dmitry Rokosov

The chip has 3 dual-channel PWM modules PWM_AB, PWM_CD, PWM_EF.

Signed-off-by: George Stark <gnstark@salutedevices.com>
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
 .../devicetree/bindings/pwm/pwm-amlogic.yaml    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
index 1d71d4f8f328..e021cf59421a 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
+++ b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
@@ -37,6 +37,10 @@ properties:
       - enum:
           - amlogic,meson8-pwm-v2
           - amlogic,meson-s4-pwm
+      - items:
+          - enum:
+              - amlogic,meson-a1-pwm
+          - const: amlogic,meson-s4-pwm
       - items:
           - enum:
               - amlogic,meson8b-pwm-v2
@@ -56,6 +60,9 @@ properties:
     minItems: 1
     maxItems: 2
 
+  power-domains:
+    maxItems: 1
+
   "#pwm-cells":
     const: 3
 
@@ -136,6 +143,16 @@ allOf:
       required:
         - clocks
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - amlogic,meson-a1-pwm
+    then:
+      required:
+        - power-domains
+
 additionalProperties: false
 
 examples:
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v3 2/2] arm64: dts: meson: a1: add definitions for meson PWM
  2024-07-02 12:34 [PATCH v3 0/2] pwm: meson: add pwm support for A1 George Stark
  2024-07-02 12:34 ` [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM George Stark
@ 2024-07-02 12:34 ` George Stark
  1 sibling, 0 replies; 6+ messages in thread
From: George Stark @ 2024-07-02 12:34 UTC (permalink / raw)
  To: ukleinek, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	jbrunet, martin.blumenstingl, hkallweit1
  Cc: linux-pwm, devicetree, linux-amlogic, linux-arm-kernel,
	linux-kernel, kernel, George Stark, Dmitry Rokosov

From: George Stark <GNStark@sberdevices.ru>

The chip has 3 dual-channel PWM modules PWM_AB, PWM_CD, PWM_EF those
can be connected to various digital I/O pins.

Each of 6 PWM is driven by individually selected clock parent and
8-bit divider. The PWM signal is generated using two 16-bit counters.

Signed-off-by: George Stark <GNStark@sberdevices.ru>
Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
---
 arch/arm64/boot/dts/amlogic/meson-a1.dtsi | 215 ++++++++++++++++++++++
 1 file changed, 215 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
index 2a69e1e41bdc..d93b10bd156b 100644
--- a/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-a1.dtsi
@@ -307,6 +307,188 @@ mux {
 					};
 				};
 
+				pwm_a_pins1: pwm-a-pins1 {
+					mux {
+						groups = "pwm_a_x6";
+						function = "pwm_a";
+					};
+				};
+
+				pwm_a_pins2: pwm-a-pins2 {
+					mux {
+						groups = "pwm_a_x7";
+						function = "pwm_a";
+					};
+				};
+
+				pwm_a_pins3: pwm-a-pins3 {
+					mux {
+						groups = "pwm_a_f10";
+						function = "pwm_a";
+					};
+				};
+
+				pwm_a_pins4: pwm-a-pins4 {
+					mux {
+						groups = "pwm_a_f6";
+						function = "pwm_a";
+					};
+				};
+
+				pwm_a_pins5: pwm-a-pins5 {
+					mux {
+						groups = "pwm_a_a";
+						function = "pwm_a";
+					};
+				};
+
+				pwm_b_pins1: pwm-b-pins1 {
+					mux {
+						groups = "pwm_b_x";
+						function = "pwm_b";
+					};
+				};
+
+				pwm_b_pins2: pwm-b-pins2 {
+					mux {
+						groups = "pwm_b_f";
+						function = "pwm_b";
+					};
+				};
+
+				pwm_b_pins3: pwm-b-pins3 {
+					mux {
+						groups = "pwm_b_a";
+						function = "pwm_b";
+					};
+				};
+
+				pwm_c_pins1: pwm-c-pins1 {
+					mux {
+						groups = "pwm_c_x";
+						function = "pwm_c";
+					};
+				};
+
+				pwm_c_pins2: pwm-c-pins2 {
+					mux {
+						groups = "pwm_c_f3";
+						function = "pwm_c";
+					};
+				};
+
+				pwm_c_pins3: pwm-c-pins3 {
+					mux {
+						groups = "pwm_c_f8";
+						function = "pwm_c";
+					};
+				};
+
+				pwm_c_pins4: pwm-c-pins4 {
+					mux {
+						groups = "pwm_c_a";
+						function = "pwm_c";
+					};
+				};
+
+				pwm_d_pins1: pwm-d-pins1 {
+					mux {
+						groups = "pwm_d_x15";
+						function = "pwm_d";
+					};
+				};
+
+				pwm_d_pins2: pwm-d-pins2 {
+					mux {
+						groups = "pwm_d_x13";
+						function = "pwm_d";
+					};
+				};
+
+				pwm_d_pins3: pwm-d-pins3 {
+					mux {
+						groups = "pwm_d_x10";
+						function = "pwm_d";
+					};
+				};
+
+				pwm_d_pins4: pwm-d-pins4 {
+					mux {
+						groups = "pwm_d_f";
+						function = "pwm_d";
+					};
+				};
+
+				pwm_e_pins1: pwm-e-pins1 {
+					mux {
+						groups = "pwm_e_p";
+						function = "pwm_e";
+					};
+				};
+
+				pwm_e_pins2: pwm-e-pins2 {
+					mux {
+						groups = "pwm_e_x16";
+						function = "pwm_e";
+					};
+				};
+
+				pwm_e_pins3: pwm-e-pins3 {
+					mux {
+						groups = "pwm_e_x14";
+						function = "pwm_e";
+					};
+				};
+
+				pwm_e_pins4: pwm-e-pins4 {
+					mux {
+						groups = "pwm_e_x2";
+						function = "pwm_e";
+					};
+				};
+
+				pwm_e_pins5: pwm-e-pins5 {
+					mux {
+						groups = "pwm_e_f";
+						function = "pwm_e";
+					};
+				};
+
+				pwm_e_pins6: pwm-e-pins6 {
+					mux {
+						groups = "pwm_e_a";
+						function = "pwm_e";
+					};
+				};
+
+				pwm_f_pins1: pwm-f-pins1 {
+					mux {
+						groups = "pwm_f_b";
+						function = "pwm_f";
+					};
+				};
+
+				pwm_f_pins2: pwm-f-pins2 {
+					mux {
+						groups = "pwm_f_x";
+						function = "pwm_f";
+					};
+				};
+
+				pwm_f_pins3: pwm-f-pins3 {
+					mux {
+						groups = "pwm_f_f4";
+						function = "pwm_f";
+					};
+				};
+
+				pwm_f_pins4: pwm-f-pins4 {
+					mux {
+						groups = "pwm_f_f12";
+						function = "pwm_f";
+					};
+				};
+
 				sdio_pins: sdio {
 					mux0 {
 						groups = "sdcard_d0_x",
@@ -648,6 +830,28 @@ uart_AO_B: serial@2000 {
 				status = "disabled";
 			};
 
+			pwm_ab: pwm@2400 {
+				compatible = "amlogic,meson-a1-pwm",
+					     "amlogic,meson-s4-pwm";
+				reg = <0x0 0x2400 0x0 0x24>;
+				#pwm-cells = <3>;
+				clocks = <&clkc_periphs CLKID_PWM_A>,
+					 <&clkc_periphs CLKID_PWM_B>;
+				power-domains = <&pwrc PWRC_I2C_ID>;
+				status = "disabled";
+			};
+
+			pwm_cd: pwm@2800 {
+				compatible = "amlogic,meson-a1-pwm",
+					     "amlogic,meson-s4-pwm";
+				reg = <0x0 0x2800 0x0 0x24>;
+				#pwm-cells = <3>;
+				clocks = <&clkc_periphs CLKID_PWM_C>,
+					 <&clkc_periphs CLKID_PWM_D>;
+				power-domains = <&pwrc PWRC_I2C_ID>;
+				status = "disabled";
+			};
+
 			saradc: adc@2c00 {
 				compatible = "amlogic,meson-g12a-saradc",
 					"amlogic,meson-saradc";
@@ -731,6 +935,17 @@ sec_AO: ao-secure@5a20 {
 				amlogic,has-chip-id;
 			};
 
+			pwm_ef: pwm@5400 {
+				compatible = "amlogic,meson-a1-pwm",
+					     "amlogic,meson-s4-pwm";
+				reg = <0x0 0x5400 0x0 0x24>;
+				#pwm-cells = <3>;
+				clocks = <&clkc_periphs CLKID_PWM_E>,
+					 <&clkc_periphs CLKID_PWM_F>;
+				power-domains = <&pwrc PWRC_I2C_ID>;
+				status = "disabled";
+			};
+
 			clkc_pll: pll-clock-controller@7c80 {
 				compatible = "amlogic,a1-pll-clkc";
 				reg = <0 0x7c80 0 0x18c>;
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM
  2024-07-02 12:34 ` [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM George Stark
@ 2024-07-02 14:48   ` Conor Dooley
  2024-07-08 13:11   ` Jerome Brunet
  1 sibling, 0 replies; 6+ messages in thread
From: Conor Dooley @ 2024-07-02 14:48 UTC (permalink / raw)
  To: George Stark
  Cc: ukleinek, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	jbrunet, martin.blumenstingl, hkallweit1, linux-pwm, devicetree,
	linux-amlogic, linux-arm-kernel, linux-kernel, kernel,
	Dmitry Rokosov

[-- Attachment #1: Type: text/plain, Size: 311 bytes --]

On Tue, Jul 02, 2024 at 03:34:24PM +0300, George Stark wrote:
> The chip has 3 dual-channel PWM modules PWM_AB, PWM_CD, PWM_EF.
> 
> Signed-off-by: George Stark <gnstark@salutedevices.com>
> Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM
  2024-07-02 12:34 ` [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM George Stark
  2024-07-02 14:48   ` Conor Dooley
@ 2024-07-08 13:11   ` Jerome Brunet
  2024-07-08 15:37     ` George Stark
  1 sibling, 1 reply; 6+ messages in thread
From: Jerome Brunet @ 2024-07-08 13:11 UTC (permalink / raw)
  To: George Stark
  Cc: ukleinek, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	martin.blumenstingl, hkallweit1, linux-pwm, devicetree,
	linux-amlogic, linux-arm-kernel, linux-kernel, kernel,
	Dmitry Rokosov

On Tue 02 Jul 2024 at 15:34, George Stark <gnstark@salutedevices.com> wrote:

> The chip has 3 dual-channel PWM modules PWM_AB, PWM_CD, PWM_EF.
>
> Signed-off-by: George Stark <gnstark@salutedevices.com>
> Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
> ---
>  .../devicetree/bindings/pwm/pwm-amlogic.yaml    | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
> index 1d71d4f8f328..e021cf59421a 100644
> --- a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
> +++ b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
> @@ -37,6 +37,10 @@ properties:
>        - enum:
>            - amlogic,meson8-pwm-v2
>            - amlogic,meson-s4-pwm
> +      - items:
> +          - enum:
> +              - amlogic,meson-a1-pwm
> +          - const: amlogic,meson-s4-pwm
>        - items:
>            - enum:
>                - amlogic,meson8b-pwm-v2
> @@ -56,6 +60,9 @@ properties:
>      minItems: 1
>      maxItems: 2
>  
> +  power-domains:
> +    maxItems: 1
> +

The change is not only introducing a1 compatibility but also allowing a
power-domain for the other SoC, even if optional.

If that is intended, it should be stated in the description and probably
a separate change.

>    "#pwm-cells":
>      const: 3
>  
> @@ -136,6 +143,16 @@ allOf:
>        required:
>          - clocks
>  
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - amlogic,meson-a1-pwm
> +    then:
> +      required:
> +        - power-domains
> +
>  additionalProperties: false
>  
>  examples:

-- 
Jerome


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM
  2024-07-08 13:11   ` Jerome Brunet
@ 2024-07-08 15:37     ` George Stark
  0 siblings, 0 replies; 6+ messages in thread
From: George Stark @ 2024-07-08 15:37 UTC (permalink / raw)
  To: Jerome Brunet
  Cc: ukleinek, robh, krzk+dt, conor+dt, neil.armstrong, khilman,
	martin.blumenstingl, hkallweit1, linux-pwm, devicetree,
	linux-amlogic, linux-arm-kernel, linux-kernel, kernel,
	Dmitry Rokosov

Hello Jerome

Thanks for the review

On 7/8/24 16:11, Jerome Brunet wrote:
> On Tue 02 Jul 2024 at 15:34, George Stark <gnstark@salutedevices.com> wrote:
> 
>> The chip has 3 dual-channel PWM modules PWM_AB, PWM_CD, PWM_EF.
>>
>> Signed-off-by: George Stark <gnstark@salutedevices.com>
>> Signed-off-by: Dmitry Rokosov <ddrokosov@salutedevices.com>
>> ---
>>   .../devicetree/bindings/pwm/pwm-amlogic.yaml    | 17 +++++++++++++++++
>>   1 file changed, 17 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
>> index 1d71d4f8f328..e021cf59421a 100644
>> --- a/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml
>> +++ b/Documentation/devicetree/bindings/pwm/pwm-amlogic.yaml

...

> 
> The change is not only introducing a1 compatibility but also allowing a
> power-domain for the other SoC, even if optional.
> 
> If that is intended, it should be stated in the description and probably
> a separate change.

AFAIK the only SoC with a separate PD for PWM is A1 (currently). I added 
PD to bindings by an independent change in series #2 [1] but Rob
proposed it should be squashed into compatible patch. The only thing 
missed in series #2 was the conditional schema making PD required for A1.

I personally would prefer to add PD as a separate change.
I'll give it a try.

[1] 
https://lore.kernel.org/lkml/20240701172016.523402-1-gnstark@salutedevices.com/T/#m0e004fc0d22e205aa3bf6bdd0284d251f26eb0f3


> 
>>     "#pwm-cells":
>>       const: 3
>>   
>> @@ -136,6 +143,16 @@ allOf:
>>         required:
>>           - clocks
>>   
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          contains:
>> +            enum:
>> +              - amlogic,meson-a1-pwm
>> +    then:
>> +      required:
>> +        - power-domains
>> +
>>   additionalProperties: false
>>   
>>   examples:
> 

-- 
Best regards
George


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-07-08 15:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-02 12:34 [PATCH v3 0/2] pwm: meson: add pwm support for A1 George Stark
2024-07-02 12:34 ` [PATCH v3 1/2] dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM George Stark
2024-07-02 14:48   ` Conor Dooley
2024-07-08 13:11   ` Jerome Brunet
2024-07-08 15:37     ` George Stark
2024-07-02 12:34 ` [PATCH v3 2/2] arm64: dts: meson: a1: add definitions for meson PWM George Stark

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).