mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
net: phy: phy_device: Call into the PHY driver to set LED brightness
Linux LEDs can be software controlled via the brightness file in /sys. LED drivers need to implement a brightness_set function which the core will call. Implement an intermediary in phy_device, which will call into the phy driver if it implements the necessary function. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
01e5b728e9
commit
684818189b
@@ -841,15 +841,19 @@ struct phy_plca_status {
|
||||
* struct phy_led: An LED driven by the PHY
|
||||
*
|
||||
* @list: List of LEDs
|
||||
* @phydev: PHY this LED is attached to
|
||||
* @led_cdev: Standard LED class structure
|
||||
* @index: Number of the LED
|
||||
*/
|
||||
struct phy_led {
|
||||
struct list_head list;
|
||||
struct phy_device *phydev;
|
||||
struct led_classdev led_cdev;
|
||||
u8 index;
|
||||
};
|
||||
|
||||
#define to_phy_led(d) container_of(d, struct phy_led, led_cdev)
|
||||
|
||||
/**
|
||||
* struct phy_driver - Driver structure for a particular PHY type
|
||||
*
|
||||
@@ -1072,6 +1076,15 @@ struct phy_driver {
|
||||
/** @get_plca_status: Return the current PLCA status info */
|
||||
int (*get_plca_status)(struct phy_device *dev,
|
||||
struct phy_plca_status *plca_st);
|
||||
|
||||
/**
|
||||
* @led_brightness_set: Set a PHY LED brightness. Index
|
||||
* indicates which of the PHYs led should be set. Value
|
||||
* follows the standard LED class meaning, e.g. LED_OFF,
|
||||
* LED_HALF, LED_FULL.
|
||||
*/
|
||||
int (*led_brightness_set)(struct phy_device *dev,
|
||||
u8 index, enum led_brightness value);
|
||||
};
|
||||
#define to_phy_driver(d) container_of(to_mdio_common_driver(d), \
|
||||
struct phy_driver, mdiodrv)
|
||||
|
||||
Reference in New Issue
Block a user