1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /* Copyright (C) 2016 National Instruments Corp.
3  */
4 #ifndef __PHY_LED_TRIGGERS
5 #define __PHY_LED_TRIGGERS
6 
7 struct phy_device;
8 
9 #ifdef CONFIG_LED_TRIGGER_PHY
10 
11 #include <linux/leds.h>
12 #include <linux/phy.h>
13 
14 #define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE	11
15 
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)
19 
20 struct phy_led_trigger {
21 	struct led_trigger trigger;
22 	char name[PHY_LINK_LED_TRIGGER_NAME_SIZE];
23 	unsigned int speed;
24 };
25 
26 
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);
30 
31 #else
32 
phy_led_triggers_register(struct phy_device * phy)33 static inline int phy_led_triggers_register(struct phy_device *phy)
34 {
35 	return 0;
36 }
phy_led_triggers_unregister(struct phy_device * phy)37 static inline void phy_led_triggers_unregister(struct phy_device *phy) { }
phy_led_trigger_change_speed(struct phy_device * phy)38 static inline void phy_led_trigger_change_speed(struct phy_device *phy) { }
39 
40 #endif
41 
42 #endif
43