On Tue, 28 Jul 2020 18:18:00 +0200
Andrew Lunn <[email protected]> wrote:
> > +static int of_phy_register_led(struct phy_device *phydev, struct
> > device_node *np)
> > +{
> > + struct led_init_data init_data = {};
> > + struct phy_device_led *led;
> > + u32 reg;
> > + int ret;
> > +
> > + ret = of_property_read_u32(np, "reg", ®);
> > + if (ret < 0)
> > + return ret;
> > +
> > + led = devm_kzalloc(&phydev->mdio.dev, sizeof(struct phy_device_led),
> > GFP_KERNEL);
> > + if (!led)
> > + return -ENOMEM;
> > +
> > + led->cdev.brightness_set_blocking = phy_led_brightness_set;
> > + led->cdev.trigger_type = &phy_hw_led_trig_type;
> > + led->addr = reg;
> > +
> > + of_property_read_string(np, "linux,default-trigger",
> > &led->cdev.default_trigger);
>
> Hi Marek
>
> I think we need one more optional property. If the trigger has been
> set to the PHY hardware trigger, we then should be able to set which
> of the different blink patterns we want the LED to use. I guess most
> users will never actually make use of the sys/class/led interface, if
> the default in device tree is sensible. But that requires DT can fully
> configure the LED.
>
> Andrew
Yes, I also thought about that. We have the linux,default-trigger
property, so maybe we could add linux,default-hw-control-mode property
as well.
Marek