diff options
author | Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> | 2022-06-23 11:25:29 +0200 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-07-08 10:56:45 -0400 |
commit | e3812b5b083e39f3dd11009579cc7d44008adaf5 (patch) | |
tree | fa9d4361561c5522d9ee3e9fc5cbf086c24e66a2 /drivers/led | |
parent | 7886c45d422ca92f86a88580442bd526435bec25 (diff) | |
download | u-boot-e3812b5b083e39f3dd11009579cc7d44008adaf5.zip u-boot-e3812b5b083e39f3dd11009579cc7d44008adaf5.tar.gz u-boot-e3812b5b083e39f3dd11009579cc7d44008adaf5.tar.bz2 |
led: pwm: Use NOP uclass driver for top-level node
The top level DT node of pwm-leds is not a LED itself, bind NOP uclass
driver to it, and bind different LED uclass driver to its subnodes which
represent the actual LEDs. This change removes the top-level node from
the 'led list' command output and is based on the commit 01074697801b
("led: gpio: Use NOP uclass driver for top-level node").
Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com>
Diffstat (limited to 'drivers/led')
-rw-r--r-- | drivers/led/led_pwm.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/led/led_pwm.c b/drivers/led/led_pwm.c index 10bd163..0ebae35 100644 --- a/drivers/led/led_pwm.c +++ b/drivers/led/led_pwm.c @@ -95,27 +95,17 @@ static enum led_state_t led_pwm_get_state(struct udevice *dev) static int led_pwm_probe(struct udevice *dev) { struct led_pwm_priv *priv = dev_get_priv(dev); - struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); - - /* Ignore the top-level LED node */ - if (!uc_plat->label) - return 0; return led_pwm_set_state(dev, (priv->enabled) ? LEDST_ON : LEDST_OFF); } static int led_pwm_of_to_plat(struct udevice *dev) { - struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev); struct led_pwm_priv *priv = dev_get_priv(dev); struct ofnode_phandle_args args; uint def_brightness, max_brightness; int ret; - /* Ignore the top-level LED node */ - if (!uc_plat->label) - return 0; - ret = dev_read_phandle_with_args(dev, "pwms", "#pwm-cells", 0, 0, &args); if (ret) return ret; @@ -173,10 +163,15 @@ static const struct udevice_id led_pwm_ids[] = { U_BOOT_DRIVER(led_pwm) = { .name = LEDS_PWM_DRIVER_NAME, .id = UCLASS_LED, - .of_match = led_pwm_ids, .ops = &led_pwm_ops, .priv_auto = sizeof(struct led_pwm_priv), - .bind = led_pwm_bind, .probe = led_pwm_probe, .of_to_plat = led_pwm_of_to_plat, }; + +U_BOOT_DRIVER(led_pwm_wrap) = { + .name = LEDS_PWM_DRIVER_NAME "_wrap", + .id = UCLASS_NOP, + .of_match = led_pwm_ids, + .bind = led_pwm_bind, +}; |