Linux Audio

Check our new training course

Loading...
v5.9
 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
 7struct 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
20struct phy_led_trigger {
21	struct led_trigger trigger;
22	char name[PHY_LINK_LED_TRIGGER_NAME_SIZE];
23	unsigned int speed;
24};
25
26
27extern int phy_led_triggers_register(struct phy_device *phy);
28extern void phy_led_triggers_unregister(struct phy_device *phy);
29extern void phy_led_trigger_change_speed(struct phy_device *phy);
30
31#else
32
33static inline int phy_led_triggers_register(struct phy_device *phy)
34{
35	return 0;
36}
37static inline void phy_led_triggers_unregister(struct phy_device *phy) { }
38static inline void phy_led_trigger_change_speed(struct phy_device *phy) { }
39
40#endif
41
42#endif
v4.10.11
 
 1/* Copyright (C) 2016 National Instruments Corp.
 2 *
 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.
 7 *
 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.
12 */
13#ifndef __PHY_LED_TRIGGERS
14#define __PHY_LED_TRIGGERS
15
16struct phy_device;
17
18#ifdef CONFIG_LED_TRIGGER_PHY
19
20#include <linux/leds.h>
21#include <linux/phy.h>
22
23#define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE	10
24
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)
28
29struct phy_led_trigger {
30	struct led_trigger trigger;
31	char name[PHY_LINK_LED_TRIGGER_NAME_SIZE];
32	unsigned int speed;
33};
34
35
36extern int phy_led_triggers_register(struct phy_device *phy);
37extern void phy_led_triggers_unregister(struct phy_device *phy);
38extern void phy_led_trigger_change_speed(struct phy_device *phy);
39
40#else
41
42static inline int phy_led_triggers_register(struct phy_device *phy)
43{
44	return 0;
45}
46static inline void phy_led_triggers_unregister(struct phy_device *phy) { }
47static inline void phy_led_trigger_change_speed(struct phy_device *phy) { }
48
49#endif
50
51#endif