@@ -3351,7 +3351,12 @@ static int of_phy_led(struct phy_device *phydev,
cdev->hw_control_get_device = phy_led_hw_control_get_device;
#endif
- cdev->max_brightness = 1;
+ if (phydev->drv->led_max_brightness)
+ cdev->max_brightness =
+ phydev->drv->led_max_brightness(phydev, index);
+ else
+ cdev->max_brightness = 1;
+
init_data.devicename = dev_name(&phydev->mdio.dev);
init_data.fwnode = of_fwnode_handle(led);
init_data.devname_mandatory = true;
@@ -1216,6 +1216,13 @@ struct phy_driver {
int (*led_brightness_set)(struct phy_device *dev,
u8 index, enum led_brightness value);
+ /**
+ * &led_max_brightness: Maximum number of brightness levels
+ * supported by hardware. When only two levels are supported
+ * i.e. LED_ON and LED_OFF the function can be omitted.
+ */
+ int (*led_max_brightness)(struct phy_device *dev, u8 index);
+
/**
* @led_blink_set: Set a PHY LED blinking. Index indicates
* which of the PHYs led should be configured to blink. Delays