blob: 5ebd1b2b174991cb6b27e323f7abe3bd3dbde601 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Michael Buesche4d6b792007-09-18 15:39:42 -04002#ifndef B43_LEDS_H_
3#define B43_LEDS_H_
4
Miguel Botone6693ea2009-10-09 16:13:53 +02005struct b43_wl;
Michael Buesch21954c32007-09-27 15:31:40 +02006struct b43_wldev;
7
8#ifdef CONFIG_B43_LEDS
9
Michael Buesche4d6b792007-09-18 15:39:42 -040010#include <linux/types.h>
Michael Buesch21954c32007-09-27 15:31:40 +020011#include <linux/leds.h>
Michael Buescha78b3bb2009-09-11 21:44:05 +020012#include <linux/workqueue.h>
Michael Buesch21954c32007-09-27 15:31:40 +020013
14
15#define B43_LED_MAX_NAME_LEN 31
Michael Buesche4d6b792007-09-18 15:39:42 -040016
17struct b43_led {
Michael Buescha78b3bb2009-09-11 21:44:05 +020018 struct b43_wl *wl;
Michael Buesch21954c32007-09-27 15:31:40 +020019 /* 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];
Michael Buescha78b3bb2009-09-11 21:44:05 +020028 /* The current status of the LED. This is updated locklessly. */
29 atomic_t state;
30 /* The active state in hardware. */
31 bool hw_state;
Michael Buesche4d6b792007-09-18 15:39:42 -040032};
Michael Buesche4d6b792007-09-18 15:39:42 -040033
Michael Buescha78b3bb2009-09-11 21:44:05 +020034struct 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
Michael Buesche899a3f2009-09-14 23:22:08 +020040 bool stop;
Michael Buescha78b3bb2009-09-11 21:44:05 +020041 struct work_struct work;
42};
43
44#define B43_MAX_NR_LEDS 4
45
Michael Buesche4d6b792007-09-18 15:39:42 -040046#define B43_LED_BEHAVIOUR 0x7F
47#define B43_LED_ACTIVELOW 0x80
Michael Buesch21954c32007-09-27 15:31:40 +020048/* LED behaviour values */
49enum b43_led_behaviour {
Michael Buesche4d6b792007-09-18 15:39:42 -040050 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,
Michael Buesche4d6b792007-09-18 15:39:42 -040062};
63
Michael Buescha78b3bb2009-09-11 21:44:05 +020064void b43_leds_register(struct b43_wldev *dev);
Michael Buesch727c9882009-10-01 15:54:32 +020065void b43_leds_unregister(struct b43_wl *wl);
Michael Buesch21954c32007-09-27 15:31:40 +020066void b43_leds_init(struct b43_wldev *dev);
Michael Buesche4d6b792007-09-18 15:39:42 -040067void b43_leds_exit(struct b43_wldev *dev);
Albert Herranz82905ac2009-09-16 00:26:19 +020068void b43_leds_stop(struct b43_wldev *dev);
Michael Buesch21954c32007-09-27 15:31:40 +020069
70
71#else /* CONFIG_B43_LEDS */
72/* LED support disabled */
73
Michael Buescha78b3bb2009-09-11 21:44:05 +020074struct b43_leds {
Michael Buesch21954c32007-09-27 15:31:40 +020075 /* empty */
76};
77
Michael Buescha78b3bb2009-09-11 21:44:05 +020078static inline void b43_leds_register(struct b43_wldev *dev)
79{
80}
Michael Buesch727c9882009-10-01 15:54:32 +020081static inline void b43_leds_unregister(struct b43_wl *wl)
Michael Buescha78b3bb2009-09-11 21:44:05 +020082{
83}
Michael Buesch21954c32007-09-27 15:31:40 +020084static inline void b43_leds_init(struct b43_wldev *dev)
85{
86}
87static inline void b43_leds_exit(struct b43_wldev *dev)
88{
89}
Albert Herranz82905ac2009-09-16 00:26:19 +020090static inline void b43_leds_stop(struct b43_wldev *dev)
91{
92}
Michael Buesch21954c32007-09-27 15:31:40 +020093#endif /* CONFIG_B43_LEDS */
Michael Buesche4d6b792007-09-18 15:39:42 -040094
95#endif /* B43_LEDS_H_ */