diff mbox series

[v2] arm64: dts: rockchip: Convert blue LED to "pwd-leds" for Radxa ROCK 5A/5C

Message ID 20241211063222.57904-1-naoki@radxa.com (mailing list archive)
State New
Headers show
Series [v2] arm64: dts: rockchip: Convert blue LED to "pwd-leds" for Radxa ROCK 5A/5C | expand

Commit Message

FUKAUMI Naoki Dec. 11, 2024, 6:32 a.m. UTC
The pin connected to the blue LED, GPIO3_D5, is not only a GPIO but
also has a PWM function. Using PWM, the user can change the brightness
of the LED.

Convert blue LED from "gpio-leds" to "pwm-leds" and enable related PWM.

Acked-by: Dragan Simic <dsimic@manjaro.org>
Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
---
this patch depends on [1] which depends on [2].

[1] https://patchwork.kernel.org/project/linux-rockchip/cover/20241209132406.4232-1-naoki@radxa.com/
[2] https://patchwork.kernel.org/project/linux-rockchip/cover/20241209125131.4101-1-naoki@radxa.com/
---
Changes in v2:
- Reword commit message
---
 .../boot/dts/rockchip/rk3588s-rock-5.dtsi     | 34 ++++++++++++-------
 1 file changed, 22 insertions(+), 12 deletions(-)

Comments

Alexander Dahl Dec. 11, 2024, 7:36 a.m. UTC | #1
Hello,

there's still a typo in the subject.  It should probably also read
"pwm", right?

Greets
Alex

Am Wed, Dec 11, 2024 at 06:32:22AM +0000 schrieb FUKAUMI Naoki:
> The pin connected to the blue LED, GPIO3_D5, is not only a GPIO but
> also has a PWM function. Using PWM, the user can change the brightness
> of the LED.
> 
> Convert blue LED from "gpio-leds" to "pwm-leds" and enable related PWM.
> 
> Acked-by: Dragan Simic <dsimic@manjaro.org>
> Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
> ---
> this patch depends on [1] which depends on [2].
> 
> [1] https://patchwork.kernel.org/project/linux-rockchip/cover/20241209132406.4232-1-naoki@radxa.com/
> [2] https://patchwork.kernel.org/project/linux-rockchip/cover/20241209125131.4101-1-naoki@radxa.com/
> ---
> Changes in v2:
> - Reword commit message
> ---
>  .../boot/dts/rockchip/rk3588s-rock-5.dtsi     | 34 ++++++++++++-------
>  1 file changed, 22 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
> index d0b9513d56a7..d72314d917da 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
> @@ -46,7 +46,7 @@ hdmi0_con_in: endpoint {
>  	leds {
>  		compatible = "gpio-leds";
>  		pinctrl-names = "default";
> -		pinctrl-0 = <&led_pins>;
> +		pinctrl-0 = <&led_pin>;
>  
>  		led-0 {
>  			color = <LED_COLOR_ID_GREEN>;
> @@ -54,14 +54,6 @@ led-0 {
>  			function = LED_FUNCTION_POWER;
>  			gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
>  		};
> -
> -		led-1 {
> -			color = <LED_COLOR_ID_BLUE>;
> -			default-state = "on";
> -			function = LED_FUNCTION_STATUS;
> -			gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
> -			linux,default-trigger = "heartbeat";
> -		};
>  	};
>  
>  	fan: pwm-fan {
> @@ -72,6 +64,19 @@ fan: pwm-fan {
>  		pwms = <&pwm3 0 60000 0>;
>  	};
>  
> +	pwm-leds {
> +		compatible = "pwm-leds";
> +
> +		led-1 {
> +			color = <LED_COLOR_ID_BLUE>;
> +			default-state = "on";
> +			function = LED_FUNCTION_STATUS;
> +			linux,default-trigger = "heartbeat";
> +			pwms = <&pwm11 0 1000000 0>;
> +			max-brightness = <255>;
> +		};
> +	};
> +
>  	vbus_typec: regulator-vbus-typec {
>  		compatible = "regulator-fixed";
>  		regulator-name = "vbus_typec";
> @@ -422,9 +427,8 @@ &pcie2x1l2 {
>  
>  &pinctrl {
>  	leds {
> -		led_pins: led-pins {
> -			rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>,
> -					<3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
> +		led_pin: led-pin {
> +			rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
>  		};
>  	};
>  
> @@ -467,6 +471,12 @@ &pwm3 {
>  	status = "okay";
>  };
>  
> +&pwm11 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pwm11m3_pins>;
> +	status = "okay";
> +};
> +
>  &saradc {
>  	vref-supply = <&vcca_1v8_s0>;
>  	status = "okay";
> -- 
> 2.43.0
> 
>
Dragan Simic Dec. 11, 2024, 7:45 a.m. UTC | #2
Hello Alexander and Fukaumi,

On 2024-12-11 08:36, Alexander Dahl wrote:
> there's still a typo in the subject.  It should probably also read
> "pwm", right?

Indeed.  Here's how the patch summary could be worded instead:

   arm64: dts: rockchip: Use PWM to drive blue LED on ROCK 5A/5C

Simplified and less wordy, but still descriptive enough. :)

> Am Wed, Dec 11, 2024 at 06:32:22AM +0000 schrieb FUKAUMI Naoki:
>> The pin connected to the blue LED, GPIO3_D5, is not only a GPIO but
>> also has a PWM function. Using PWM, the user can change the brightness
>> of the LED.
>> 
>> Convert blue LED from "gpio-leds" to "pwm-leds" and enable related 
>> PWM.
>> 
>> Acked-by: Dragan Simic <dsimic@manjaro.org>
>> Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
>> ---
>> this patch depends on [1] which depends on [2].
>> 
>> [1] 
>> https://patchwork.kernel.org/project/linux-rockchip/cover/20241209132406.4232-1-naoki@radxa.com/
>> [2] 
>> https://patchwork.kernel.org/project/linux-rockchip/cover/20241209125131.4101-1-naoki@radxa.com/
>> ---
>> Changes in v2:
>> - Reword commit message
>> ---
>>  .../boot/dts/rockchip/rk3588s-rock-5.dtsi     | 34 
>> ++++++++++++-------
>>  1 file changed, 22 insertions(+), 12 deletions(-)
>> 
>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi 
>> b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
>> index d0b9513d56a7..d72314d917da 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
>> @@ -46,7 +46,7 @@ hdmi0_con_in: endpoint {
>>  	leds {
>>  		compatible = "gpio-leds";
>>  		pinctrl-names = "default";
>> -		pinctrl-0 = <&led_pins>;
>> +		pinctrl-0 = <&led_pin>;
>> 
>>  		led-0 {
>>  			color = <LED_COLOR_ID_GREEN>;
>> @@ -54,14 +54,6 @@ led-0 {
>>  			function = LED_FUNCTION_POWER;
>>  			gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
>>  		};
>> -
>> -		led-1 {
>> -			color = <LED_COLOR_ID_BLUE>;
>> -			default-state = "on";
>> -			function = LED_FUNCTION_STATUS;
>> -			gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
>> -			linux,default-trigger = "heartbeat";
>> -		};
>>  	};
>> 
>>  	fan: pwm-fan {
>> @@ -72,6 +64,19 @@ fan: pwm-fan {
>>  		pwms = <&pwm3 0 60000 0>;
>>  	};
>> 
>> +	pwm-leds {
>> +		compatible = "pwm-leds";
>> +
>> +		led-1 {
>> +			color = <LED_COLOR_ID_BLUE>;
>> +			default-state = "on";
>> +			function = LED_FUNCTION_STATUS;
>> +			linux,default-trigger = "heartbeat";
>> +			pwms = <&pwm11 0 1000000 0>;
>> +			max-brightness = <255>;
>> +		};
>> +	};
>> +
>>  	vbus_typec: regulator-vbus-typec {
>>  		compatible = "regulator-fixed";
>>  		regulator-name = "vbus_typec";
>> @@ -422,9 +427,8 @@ &pcie2x1l2 {
>> 
>>  &pinctrl {
>>  	leds {
>> -		led_pins: led-pins {
>> -			rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>,
>> -					<3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
>> +		led_pin: led-pin {
>> +			rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
>>  		};
>>  	};
>> 
>> @@ -467,6 +471,12 @@ &pwm3 {
>>  	status = "okay";
>>  };
>> 
>> +&pwm11 {
>> +	pinctrl-names = "default";
>> +	pinctrl-0 = <&pwm11m3_pins>;
>> +	status = "okay";
>> +};
>> +
>>  &saradc {
>>  	vref-supply = <&vcca_1v8_s0>;
>>  	status = "okay";
>> --
>> 2.43.0
FUKAUMI Naoki Dec. 11, 2024, 7:56 a.m. UTC | #3
Hi Alexander and Dragan,

On 12/11/24 16:45, Dragan Simic wrote:
> Hello Alexander and Fukaumi,
> 
> On 2024-12-11 08:36, Alexander Dahl wrote:
>> there's still a typo in the subject.  It should probably also read
>> "pwm", right?
> 
> Indeed.  Here's how the patch summary could be worded instead:
> 
>    arm64: dts: rockchip: Use PWM to drive blue LED on ROCK 5A/5C
> 
> Simplified and less wordy, but still descriptive enough. :)


yes, it's typo... thanks for pointing and fixing.

Best regards,

--
FUKAUMI Naoki
Radxa Computer (Shenzhen) Co., Ltd.

>> Am Wed, Dec 11, 2024 at 06:32:22AM +0000 schrieb FUKAUMI Naoki:
>>> The pin connected to the blue LED, GPIO3_D5, is not only a GPIO but
>>> also has a PWM function. Using PWM, the user can change the brightness
>>> of the LED.
>>>
>>> Convert blue LED from "gpio-leds" to "pwm-leds" and enable related PWM.
>>>
>>> Acked-by: Dragan Simic <dsimic@manjaro.org>
>>> Signed-off-by: FUKAUMI Naoki <naoki@radxa.com>
>>> ---
>>> this patch depends on [1] which depends on [2].
>>>
>>> [1] https://patchwork.kernel.org/project/linux-rockchip/ 
>>> cover/20241209132406.4232-1-naoki@radxa.com/
>>> [2] https://patchwork.kernel.org/project/linux-rockchip/ 
>>> cover/20241209125131.4101-1-naoki@radxa.com/
>>> ---
>>> Changes in v2:
>>> - Reword commit message
>>> ---
>>>  .../boot/dts/rockchip/rk3588s-rock-5.dtsi     | 34 ++++++++++++-------
>>>  1 file changed, 22 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi b/arch/ 
>>> arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
>>> index d0b9513d56a7..d72314d917da 100644
>>> --- a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
>>> +++ b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
>>> @@ -46,7 +46,7 @@ hdmi0_con_in: endpoint {
>>>      leds {
>>>          compatible = "gpio-leds";
>>>          pinctrl-names = "default";
>>> -        pinctrl-0 = <&led_pins>;
>>> +        pinctrl-0 = <&led_pin>;
>>>
>>>          led-0 {
>>>              color = <LED_COLOR_ID_GREEN>;
>>> @@ -54,14 +54,6 @@ led-0 {
>>>              function = LED_FUNCTION_POWER;
>>>              gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
>>>          };
>>> -
>>> -        led-1 {
>>> -            color = <LED_COLOR_ID_BLUE>;
>>> -            default-state = "on";
>>> -            function = LED_FUNCTION_STATUS;
>>> -            gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
>>> -            linux,default-trigger = "heartbeat";
>>> -        };
>>>      };
>>>
>>>      fan: pwm-fan {
>>> @@ -72,6 +64,19 @@ fan: pwm-fan {
>>>          pwms = <&pwm3 0 60000 0>;
>>>      };
>>>
>>> +    pwm-leds {
>>> +        compatible = "pwm-leds";
>>> +
>>> +        led-1 {
>>> +            color = <LED_COLOR_ID_BLUE>;
>>> +            default-state = "on";
>>> +            function = LED_FUNCTION_STATUS;
>>> +            linux,default-trigger = "heartbeat";
>>> +            pwms = <&pwm11 0 1000000 0>;
>>> +            max-brightness = <255>;
>>> +        };
>>> +    };
>>> +
>>>      vbus_typec: regulator-vbus-typec {
>>>          compatible = "regulator-fixed";
>>>          regulator-name = "vbus_typec";
>>> @@ -422,9 +427,8 @@ &pcie2x1l2 {
>>>
>>>  &pinctrl {
>>>      leds {
>>> -        led_pins: led-pins {
>>> -            rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>,
>>> -                    <3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
>>> +        led_pin: led-pin {
>>> +            rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
>>>          };
>>>      };
>>>
>>> @@ -467,6 +471,12 @@ &pwm3 {
>>>      status = "okay";
>>>  };
>>>
>>> +&pwm11 {
>>> +    pinctrl-names = "default";
>>> +    pinctrl-0 = <&pwm11m3_pins>;
>>> +    status = "okay";
>>> +};
>>> +
>>>  &saradc {
>>>      vref-supply = <&vcca_1v8_s0>;
>>>      status = "okay";
>>> -- 
>>> 2.43.0
>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
index d0b9513d56a7..d72314d917da 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3588s-rock-5.dtsi
@@ -46,7 +46,7 @@  hdmi0_con_in: endpoint {
 	leds {
 		compatible = "gpio-leds";
 		pinctrl-names = "default";
-		pinctrl-0 = <&led_pins>;
+		pinctrl-0 = <&led_pin>;
 
 		led-0 {
 			color = <LED_COLOR_ID_GREEN>;
@@ -54,14 +54,6 @@  led-0 {
 			function = LED_FUNCTION_POWER;
 			gpios = <&gpio3 RK_PC4 GPIO_ACTIVE_HIGH>;
 		};
-
-		led-1 {
-			color = <LED_COLOR_ID_BLUE>;
-			default-state = "on";
-			function = LED_FUNCTION_STATUS;
-			gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_HIGH>;
-			linux,default-trigger = "heartbeat";
-		};
 	};
 
 	fan: pwm-fan {
@@ -72,6 +64,19 @@  fan: pwm-fan {
 		pwms = <&pwm3 0 60000 0>;
 	};
 
+	pwm-leds {
+		compatible = "pwm-leds";
+
+		led-1 {
+			color = <LED_COLOR_ID_BLUE>;
+			default-state = "on";
+			function = LED_FUNCTION_STATUS;
+			linux,default-trigger = "heartbeat";
+			pwms = <&pwm11 0 1000000 0>;
+			max-brightness = <255>;
+		};
+	};
+
 	vbus_typec: regulator-vbus-typec {
 		compatible = "regulator-fixed";
 		regulator-name = "vbus_typec";
@@ -422,9 +427,8 @@  &pcie2x1l2 {
 
 &pinctrl {
 	leds {
-		led_pins: led-pins {
-			rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>,
-					<3 RK_PD5 RK_FUNC_GPIO &pcfg_pull_none>;
+		led_pin: led-pin {
+			rockchip,pins = <3 RK_PC4 RK_FUNC_GPIO &pcfg_pull_none>;
 		};
 	};
 
@@ -467,6 +471,12 @@  &pwm3 {
 	status = "okay";
 };
 
+&pwm11 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm11m3_pins>;
+	status = "okay";
+};
+
 &saradc {
 	vref-supply = <&vcca_1v8_s0>;
 	status = "okay";