All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Keerthy <j-keerthy@ti.com>, Georgi Vlaev <g-vlaev@ti.com>
Subject: [PATCH v2 4/4] arm64: dts: ti: k3-am625-sk: Use pwm-led instead of gpio-led
Date: Mon,  7 Nov 2022 18:35:33 +0200	[thread overview]
Message-ID: <20221107163533.48777-5-tony@atomide.com> (raw)
In-Reply-To: <20221107163533.48777-1-tony@atomide.com>

On am625, pad c17 can be used either in gpio mode or pwm mode to control
the connected led. Let's change to use pwm-led for additional brighness
control.

The pwm controller is dmtimer7 for pad C17. We configure it for 128 Hz
rate (1000000000 / 7812500) similar to what has been done elsewhere for
pwm-leds.

Cc: Keerthy <j-keerthy@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Tested-by: Georgi Vlaev <g-vlaev@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm64/boot/dts/ti/k3-am625-sk.dts | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am625-sk.dts b/arch/arm64/boot/dts/ti/k3-am625-sk.dts
--- a/arch/arm64/boot/dts/ti/k3-am625-sk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am625-sk.dts
@@ -131,18 +131,25 @@ vdd_sd_dv: regulator-4 {
 	};
 
 	leds {
-		compatible = "gpio-leds";
-		pinctrl-names = "default";
-		pinctrl-0 = <&usr_led_pins_default>;
+		compatible = "pwm-leds";
 
 		led-0 {
 			label = "am62-sk:green:heartbeat";
-			gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>;
+			pwms = <&main_pwm7 0 7812500 0>;
+			max-brightness = <255>;
 			linux,default-trigger = "heartbeat";
 			function = LED_FUNCTION_HEARTBEAT;
 			default-state = "off";
 		};
 	};
+
+	main_pwm7: dmtimer-main-pwm-7 {
+		pinctrl-0 = <&usr_led_pins_default>;
+		pinctrl-names = "default";
+		compatible = "ti,omap-dmtimer-pwm";
+		#pwm-cells = <3>;
+		ti,timers = <&main_timer7>;
+	};
 };
 
 &main_pmx0 {
@@ -203,7 +210,7 @@ AM62X_IOPAD(0x240, PIN_INPUT, 0) /* (D17) MMC1_SDCD */
 
 	usr_led_pins_default: usr-led-pins-default {
 		pinctrl-single,pins = <
-			AM62X_IOPAD(0x244, PIN_OUTPUT, 7) /* (C17) MMC1_SDWP.GPIO1_49 */
+			AM62X_IOPAD(0x244, PIN_OUTPUT, 2) /* (C17) MMC1_SDWP.TIMER_IO7 */
 		>;
 	};
 
-- 
2.38.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Tony Lindgren <tony@atomide.com>
To: Nishanth Menon <nm@ti.com>, Vignesh Raghavendra <vigneshr@ti.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	Keerthy <j-keerthy@ti.com>, Georgi Vlaev <g-vlaev@ti.com>
Subject: [PATCH v2 4/4] arm64: dts: ti: k3-am625-sk: Use pwm-led instead of gpio-led
Date: Mon,  7 Nov 2022 18:35:33 +0200	[thread overview]
Message-ID: <20221107163533.48777-5-tony@atomide.com> (raw)
In-Reply-To: <20221107163533.48777-1-tony@atomide.com>

On am625, pad c17 can be used either in gpio mode or pwm mode to control
the connected led. Let's change to use pwm-led for additional brighness
control.

The pwm controller is dmtimer7 for pad C17. We configure it for 128 Hz
rate (1000000000 / 7812500) similar to what has been done elsewhere for
pwm-leds.

Cc: Keerthy <j-keerthy@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Vignesh Raghavendra <vigneshr@ti.com>
Tested-by: Georgi Vlaev <g-vlaev@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm64/boot/dts/ti/k3-am625-sk.dts | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/boot/dts/ti/k3-am625-sk.dts b/arch/arm64/boot/dts/ti/k3-am625-sk.dts
--- a/arch/arm64/boot/dts/ti/k3-am625-sk.dts
+++ b/arch/arm64/boot/dts/ti/k3-am625-sk.dts
@@ -131,18 +131,25 @@ vdd_sd_dv: regulator-4 {
 	};
 
 	leds {
-		compatible = "gpio-leds";
-		pinctrl-names = "default";
-		pinctrl-0 = <&usr_led_pins_default>;
+		compatible = "pwm-leds";
 
 		led-0 {
 			label = "am62-sk:green:heartbeat";
-			gpios = <&main_gpio1 49 GPIO_ACTIVE_HIGH>;
+			pwms = <&main_pwm7 0 7812500 0>;
+			max-brightness = <255>;
 			linux,default-trigger = "heartbeat";
 			function = LED_FUNCTION_HEARTBEAT;
 			default-state = "off";
 		};
 	};
+
+	main_pwm7: dmtimer-main-pwm-7 {
+		pinctrl-0 = <&usr_led_pins_default>;
+		pinctrl-names = "default";
+		compatible = "ti,omap-dmtimer-pwm";
+		#pwm-cells = <3>;
+		ti,timers = <&main_timer7>;
+	};
 };
 
 &main_pmx0 {
@@ -203,7 +210,7 @@ AM62X_IOPAD(0x240, PIN_INPUT, 0) /* (D17) MMC1_SDCD */
 
 	usr_led_pins_default: usr-led-pins-default {
 		pinctrl-single,pins = <
-			AM62X_IOPAD(0x244, PIN_OUTPUT, 7) /* (C17) MMC1_SDWP.GPIO1_49 */
+			AM62X_IOPAD(0x244, PIN_OUTPUT, 2) /* (C17) MMC1_SDWP.TIMER_IO7 */
 		>;
 	};
 
-- 
2.38.1

  parent reply	other threads:[~2022-11-07 16:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 16:35 [PATCH v2 0/4] Collected pending TI dmtimer dts changes Tony Lindgren
2022-11-07 16:35 ` Tony Lindgren
2022-11-07 16:35 ` [PATCH v2 1/4] arm64: dts: ti: k3-am65: Configure pinctrl for timer IO pads Tony Lindgren
2022-11-07 16:35   ` Tony Lindgren
2022-11-07 16:35 ` [PATCH v2 2/4] arm64: dts: ti: k3-am65: Add general purpose timers for am65 Tony Lindgren
2022-11-07 16:35   ` Tony Lindgren
2022-11-07 16:35 ` [PATCH v2 3/4] arm64: dts: ti: k3-am62: Add general purpose timers for am62 Tony Lindgren
2022-11-07 16:35   ` Tony Lindgren
2022-11-15 14:46   ` Nishanth Menon
2022-11-15 14:46     ` Nishanth Menon
2022-11-15 15:40     ` Tony Lindgren
2022-11-15 15:40       ` Tony Lindgren
2022-11-07 16:35 ` Tony Lindgren [this message]
2022-11-07 16:35   ` [PATCH v2 4/4] arm64: dts: ti: k3-am625-sk: Use pwm-led instead of gpio-led Tony Lindgren
2022-11-15 14:47   ` Nishanth Menon
2022-11-15 14:47     ` Nishanth Menon
2022-11-15 15:39     ` Tony Lindgren
2022-11-15 15:39       ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221107163533.48777-5-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=devicetree@vger.kernel.org \
    --cc=g-vlaev@ti.com \
    --cc=j-keerthy@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=nm@ti.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.