1 /* Copyright (C) 2016 National Instruments Corp.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 #ifndef __PHY_LED_TRIGGERS
14 #define __PHY_LED_TRIGGERS
18 #ifdef CONFIG_LED_TRIGGER_PHY
20 #include <linux/leds.h>
21 #include <linux/phy.h>
23 #define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 10
25 #define PHY_LINK_LED_TRIGGER_NAME_SIZE (MII_BUS_ID_SIZE + \
26 FIELD_SIZEOF(struct mdio_device, addr)+\
27 PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE)
29 struct phy_led_trigger
{
30 struct led_trigger trigger
;
31 char name
[PHY_LINK_LED_TRIGGER_NAME_SIZE
];
36 extern int phy_led_triggers_register(struct phy_device
*phy
);
37 extern void phy_led_triggers_unregister(struct phy_device
*phy
);
38 extern void phy_led_trigger_change_speed(struct phy_device
*phy
);
42 static inline int phy_led_triggers_register(struct phy_device
*phy
)
46 static inline void phy_led_triggers_unregister(struct phy_device
*phy
) { }
47 static inline void phy_led_trigger_change_speed(struct phy_device
*phy
) { }