drivers: led: bcm6753: do not use null label to find the top

This driver considers that a node with an empty label is the top.
But the led class has changed, if a label is not provided for a led,
the label is filed with the node name. So we update this driver
to use a wrapper to manage the top led node.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
This commit is contained in:
Philippe Reynes 2023-06-29 11:25:23 +02:00 committed by Tom Rini
parent 874bf6e0e2
commit 910b01c27c

View file

@ -174,28 +174,6 @@ static const struct led_ops bcm6753_led_ops = {
static int bcm6753_led_probe(struct udevice *dev) static int bcm6753_led_probe(struct udevice *dev)
{ {
struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
/* Top-level LED node */
if (!uc_plat->label) {
void __iomem *regs;
u32 set_bits = 0;
regs = dev_remap_addr(dev);
if (!regs)
return -EINVAL;
if (dev_read_bool(dev, "brcm,serial-led-msb-first"))
set_bits |= CLED_CTRL_SERIAL_LED_MSB_FIRST;
if (dev_read_bool(dev, "brcm,serial-led-en-pol"))
set_bits |= CLED_CTRL_SERIAL_LED_EN_POL;
if (dev_read_bool(dev, "brcm,serial-led-clk-pol"))
set_bits |= CLED_CTRL_SERIAL_LED_CLK_POL;
if (dev_read_bool(dev, "brcm,serial-led-data-ppol"))
set_bits |= CLED_CTRL_SERIAL_LED_DATA_PPOL;
clrsetbits_32(regs + CLED_CTRL_REG, CLED_CTRL_MASK, set_bits);
} else {
struct bcm6753_led_priv *priv = dev_get_priv(dev); struct bcm6753_led_priv *priv = dev_get_priv(dev);
void __iomem *regs; void __iomem *regs;
unsigned int pin; unsigned int pin;
@ -219,12 +197,42 @@ static int bcm6753_led_probe(struct udevice *dev)
clrbits_32(regs + CLED_PLED_OP_PPOL_REG, 1 << pin); clrbits_32(regs + CLED_PLED_OP_PPOL_REG, 1 << pin);
else else
setbits_32(regs + CLED_PLED_OP_PPOL_REG, 1 << pin); setbits_32(regs + CLED_PLED_OP_PPOL_REG, 1 << pin);
}
return 0; return 0;
} }
static int bcm6753_led_bind(struct udevice *parent) U_BOOT_DRIVER(bcm6753_led) = {
.name = "bcm6753-led",
.id = UCLASS_LED,
.probe = bcm6753_led_probe,
.priv_auto = sizeof(struct bcm6753_led_priv),
.ops = &bcm6753_led_ops,
};
static int bcm6753_led_wrap_probe(struct udevice *dev)
{
void __iomem *regs;
u32 set_bits = 0;
regs = dev_remap_addr(dev);
if (!regs)
return -EINVAL;
if (dev_read_bool(dev, "brcm,serial-led-msb-first"))
set_bits |= CLED_CTRL_SERIAL_LED_MSB_FIRST;
if (dev_read_bool(dev, "brcm,serial-led-en-pol"))
set_bits |= CLED_CTRL_SERIAL_LED_EN_POL;
if (dev_read_bool(dev, "brcm,serial-led-clk-pol"))
set_bits |= CLED_CTRL_SERIAL_LED_CLK_POL;
if (dev_read_bool(dev, "brcm,serial-led-data-ppol"))
set_bits |= CLED_CTRL_SERIAL_LED_DATA_PPOL;
clrsetbits_32(regs + CLED_CTRL_REG, CLED_CTRL_MASK, set_bits);
return 0;
}
static int bcm6753_led_wrap_bind(struct udevice *parent)
{ {
ofnode node; ofnode node;
@ -247,12 +255,10 @@ static const struct udevice_id bcm6753_led_ids[] = {
{ /* sentinel */ } { /* sentinel */ }
}; };
U_BOOT_DRIVER(bcm6753_led) = { U_BOOT_DRIVER(bcm6753_led_wrap) = {
.name = "bcm6753-led", .name = "bcm6753_led_wrap",
.id = UCLASS_LED, .id = UCLASS_NOP,
.of_match = bcm6753_led_ids, .of_match = bcm6753_led_ids,
.bind = bcm6753_led_bind, .probe = bcm6753_led_wrap_probe,
.probe = bcm6753_led_probe, .bind = bcm6753_led_wrap_bind,
.priv_auto = sizeof(struct bcm6753_led_priv),
.ops = &bcm6753_led_ops,
}; };