On 11/30/26 5:01 AM, Andrew Lunn wrote:
>> + if (i == ARRAY_SIZE(as21xxx_led_supported_pattern))
>> + return -EOPNOTSUPP;
>> +
>> return phy_modify_mmd(phydev, MDIO_MMD_VEND1,
>> VEND1_LED_REG(index),
>> VEND1_LED_REG_A_EVENT,
>
> This works, but maybe:
>
> for (i = 0; i < ARRAY_SIZE(as21xxx_led_supported_pattern); i++)
> if (rules == as21xxx_led_supported_pattern[i].pattern) {
> val = as21xxx_led_supported_pattern[i].val;
> return phy_modify_mmd(phydev, MDIO_MMD_VEND1,
> VEND1_LED_REG(index),
> VEND1_LED_REG_A_EVENT,
> FIELD_PREP(VEND1_LED_REG_A_EVENT,
> val));
>
> }
>
> return -EOPNOTSUPP
> }
On upcoming Gen2 PHY the LEDs are meant to be driven by the firmware via IPC
rather than by writing the vendor LED registers directly. The refactored block
will look like this:
info = aeon_led_find_pattern(phydev, rules);
if (!info)
return -EOPNOTSUPP;
return data->led_ops->set_event(phydev, index, info->val);
I'm happy to incorporate your suggestion if you prefer, though it will add some
churn to the diffs.
Cristian