1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Copyright (C) 2016 National Instruments Corp.
4 #ifndef __PHY_LED_TRIGGERS
5 #define __PHY_LED_TRIGGERS
9 #ifdef CONFIG_LED_TRIGGER_PHY
11 #include <linux/leds.h>
12 #include <linux/phy.h>
14 #define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 11
16 #define PHY_LINK_LED_TRIGGER_NAME_SIZE (MII_BUS_ID_SIZE + \
17 sizeof_field(struct mdio_device, addr)+\
18 PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE)
20 struct phy_led_trigger {
21 struct led_trigger trigger;
22 char name[PHY_LINK_LED_TRIGGER_NAME_SIZE];
27 extern int phy_led_triggers_register(struct phy_device *phy);
28 extern void phy_led_triggers_unregister(struct phy_device *phy);
29 extern void phy_led_trigger_change_speed(struct phy_device *phy);
33 static inline int phy_led_triggers_register(struct phy_device *phy)
37 static inline void phy_led_triggers_unregister(struct phy_device *phy) { }
38 static inline void phy_led_trigger_change_speed(struct phy_device *phy) { }