Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef B43_LEDS_H_
3#define B43_LEDS_H_
4
5struct b43_wl;
6struct b43_wldev;
7
8#ifdef CONFIG_B43_LEDS
9
10#include <linux/types.h>
11#include <linux/leds.h>
12#include <linux/workqueue.h>
13
14
15#define B43_LED_MAX_NAME_LEN 31
16
17struct b43_led {
18 struct b43_wl *wl;
19 /* The LED class device */
20 struct led_classdev led_dev;
21 /* The index number of the LED. */
22 u8 index;
23 /* If activelow is true, the LED is ON if the
24 * bit is switched off. */
25 bool activelow;
26 /* The unique name string for this LED device. */
27 char name[B43_LED_MAX_NAME_LEN + 1];
28 /* The current status of the LED. This is updated locklessly. */
29 atomic_t state;
30 /* The active state in hardware. */
31 bool hw_state;
32};
33
34struct b43_leds {
35 struct b43_led led_tx;
36 struct b43_led led_rx;
37 struct b43_led led_radio;
38 struct b43_led led_assoc;
39
40 bool stop;
41 struct work_struct work;
42};
43
44#define B43_MAX_NR_LEDS 4
45
46#define B43_LED_BEHAVIOUR 0x7F
47#define B43_LED_ACTIVELOW 0x80
48/* LED behaviour values */
49enum b43_led_behaviour {
50 B43_LED_OFF,
51 B43_LED_ON,
52 B43_LED_ACTIVITY,
53 B43_LED_RADIO_ALL,
54 B43_LED_RADIO_A,
55 B43_LED_RADIO_B,
56 B43_LED_MODE_BG,
57 B43_LED_TRANSFER,
58 B43_LED_APTRANSFER,
59 B43_LED_WEIRD, //FIXME
60 B43_LED_ASSOC,
61 B43_LED_INACTIVE,
62};
63
64void b43_leds_register(struct b43_wldev *dev);
65void b43_leds_unregister(struct b43_wl *wl);
66void b43_leds_init(struct b43_wldev *dev);
67void b43_leds_exit(struct b43_wldev *dev);
68void b43_leds_stop(struct b43_wldev *dev);
69
70
71#else /* CONFIG_B43_LEDS */
72/* LED support disabled */
73
74struct b43_leds {
75 /* empty */
76};
77
78static inline void b43_leds_register(struct b43_wldev *dev)
79{
80}
81static inline void b43_leds_unregister(struct b43_wl *wl)
82{
83}
84static inline void b43_leds_init(struct b43_wldev *dev)
85{
86}
87static inline void b43_leds_exit(struct b43_wldev *dev)
88{
89}
90static inline void b43_leds_stop(struct b43_wldev *dev)
91{
92}
93#endif /* CONFIG_B43_LEDS */
94
95#endif /* B43_LEDS_H_ */
1#ifndef B43_LEDS_H_
2#define B43_LEDS_H_
3
4struct b43_wl;
5struct b43_wldev;
6
7#ifdef CONFIG_B43_LEDS
8
9#include <linux/types.h>
10#include <linux/leds.h>
11#include <linux/workqueue.h>
12
13
14#define B43_LED_MAX_NAME_LEN 31
15
16struct b43_led {
17 struct b43_wl *wl;
18 /* The LED class device */
19 struct led_classdev led_dev;
20 /* The index number of the LED. */
21 u8 index;
22 /* If activelow is true, the LED is ON if the
23 * bit is switched off. */
24 bool activelow;
25 /* The unique name string for this LED device. */
26 char name[B43_LED_MAX_NAME_LEN + 1];
27 /* The current status of the LED. This is updated locklessly. */
28 atomic_t state;
29 /* The active state in hardware. */
30 bool hw_state;
31};
32
33struct b43_leds {
34 struct b43_led led_tx;
35 struct b43_led led_rx;
36 struct b43_led led_radio;
37 struct b43_led led_assoc;
38
39 bool stop;
40 struct work_struct work;
41};
42
43#define B43_MAX_NR_LEDS 4
44
45#define B43_LED_BEHAVIOUR 0x7F
46#define B43_LED_ACTIVELOW 0x80
47/* LED behaviour values */
48enum b43_led_behaviour {
49 B43_LED_OFF,
50 B43_LED_ON,
51 B43_LED_ACTIVITY,
52 B43_LED_RADIO_ALL,
53 B43_LED_RADIO_A,
54 B43_LED_RADIO_B,
55 B43_LED_MODE_BG,
56 B43_LED_TRANSFER,
57 B43_LED_APTRANSFER,
58 B43_LED_WEIRD, //FIXME
59 B43_LED_ASSOC,
60 B43_LED_INACTIVE,
61};
62
63void b43_leds_register(struct b43_wldev *dev);
64void b43_leds_unregister(struct b43_wl *wl);
65void b43_leds_init(struct b43_wldev *dev);
66void b43_leds_exit(struct b43_wldev *dev);
67void b43_leds_stop(struct b43_wldev *dev);
68
69
70#else /* CONFIG_B43_LEDS */
71/* LED support disabled */
72
73struct b43_leds {
74 /* empty */
75};
76
77static inline void b43_leds_register(struct b43_wldev *dev)
78{
79}
80static inline void b43_leds_unregister(struct b43_wl *wl)
81{
82}
83static inline void b43_leds_init(struct b43_wldev *dev)
84{
85}
86static inline void b43_leds_exit(struct b43_wldev *dev)
87{
88}
89static inline void b43_leds_stop(struct b43_wldev *dev)
90{
91}
92#endif /* CONFIG_B43_LEDS */
93
94#endif /* B43_LEDS_H_ */