Thomas Gleixner | c942fdd | 2019-05-27 08:55:06 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Zach Brown | 2e0bc45 | 2016-10-17 10:49:55 -0500 | [diff] [blame] | 2 | /* Copyright (C) 2016 National Instruments Corp. |
Zach Brown | 2e0bc45 | 2016-10-17 10:49:55 -0500 | [diff] [blame] | 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> |
Geert Uytterhoeven | 3c880eb | 2017-01-25 11:39:50 +0100 | [diff] [blame] | 12 | #include <linux/phy.h> |
Zach Brown | 2e0bc45 | 2016-10-17 10:49:55 -0500 | [diff] [blame] | 13 | |
Kyle Roeschley | 457937b | 2018-11-09 12:48:03 -0600 | [diff] [blame] | 14 | #define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 11 |
Zach Brown | 2e0bc45 | 2016-10-17 10:49:55 -0500 | [diff] [blame] | 15 | |
Geert Uytterhoeven | 3c880eb | 2017-01-25 11:39:50 +0100 | [diff] [blame] | 16 | #define PHY_LINK_LED_TRIGGER_NAME_SIZE (MII_BUS_ID_SIZE + \ |
Pankaj Bharadiya | c593642 | 2019-12-09 10:31:43 -0800 | [diff] [blame] | 17 | sizeof_field(struct mdio_device, addr)+\ |
Zach Brown | 2e0bc45 | 2016-10-17 10:49:55 -0500 | [diff] [blame] | 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 | |
| 33 | static inline int phy_led_triggers_register(struct phy_device *phy) |
| 34 | { |
| 35 | return 0; |
| 36 | } |
| 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) { } |
| 39 | |
| 40 | #endif |
| 41 | |
| 42 | #endif |