diff mbox series

[v1,1/2] leds: pca9532: read pwm settings from device tree

Message ID 198551419.101933.1600803075307@mail.vodafone.de
State New
Headers show
Series [v1,1/2] leds: pca9532: read pwm settings from device tree | expand

Commit Message

Markus Moll Sept. 22, 2020, 7:31 p.m. UTC
While the two pca9532 pwms can be configured in the platform data
struct, there was no corresponding dt binding. Users need to configure
the pwm if some leds should blink or continue blinking during boot.

Signed-off-by: Markus Moll <mmoll@de.pepperl-fuchs.com>
---
 drivers/leds/leds-pca9532.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Pavel Machek Sept. 24, 2020, 12:24 p.m. UTC | #1
On Tue 2020-09-22 21:31:15, Markus Moll wrote:
> While the two pca9532 pwms can be configured in the platform data

> struct, there was no corresponding dt binding. Users need to configure

> the pwm if some leds should blink or continue blinking during boot.

> 

> Signed-off-by: Markus Moll <mmoll@de.pepperl-fuchs.com>


Thanks, applied.

Best regards,
									Pavel

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Marek BehĂșn Sept. 24, 2020, 3:57 p.m. UTC | #2
On Tue, 22 Sep 2020 21:31:15 +0200 (CEST)
Markus Moll <moll.markus@arcor.de> wrote:

> While the two pca9532 pwms can be configured in the platform data
> struct, there was no corresponding dt binding. Users need to configure
> the pwm if some leds should blink or continue blinking during boot.
> 
> Signed-off-by: Markus Moll <mmoll@de.pepperl-fuchs.com>
> ---

> +	of_property_read_u8_array(np, "nxp,pwm", &pdata->pwm[0],
> +				  ARRAY_SIZE(pdata->pwm));
> +	of_property_read_u8_array(np, "nxp,psc", &pdata->psc[0],
> +				  ARRAY_SIZE(pdata->psc));
> +

This properties are not documented in device tree bindings.

Moreover there are pwm-dutycycle-unit and pwm-dutycycle-range
properties documented for pwm-regulator. Maybe these should be used?

Marek
diff mbox series

Patch

diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index d37fd9577d4..27d02716547 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -480,6 +480,11 @@  pca9532_of_populate_pdata(struct device *dev, struct device_node *np)
 	if (!pdata)
 		return ERR_PTR(-ENOMEM);
 
+	of_property_read_u8_array(np, "nxp,pwm", &pdata->pwm[0],
+				  ARRAY_SIZE(pdata->pwm));
+	of_property_read_u8_array(np, "nxp,psc", &pdata->psc[0],
+				  ARRAY_SIZE(pdata->psc));
+
 	for_each_available_child_of_node(np, child) {
 		if (of_property_read_string(child, "label",
 					    &pdata->leds[i].name))