blob: 32b66d53cdac4579100af72cf8a92b784545b37b [file] [log] [blame]
Michael Buesche4d6b792007-09-18 15:39:42 -04001#ifndef B43_LEDS_H_
2#define B43_LEDS_H_
3
Miguel Botone6693ea2009-10-09 16:13:53 +02004struct b43_wl;
Michael Buesch21954c32007-09-27 15:31:40 +02005struct b43_wldev;
6
7#ifdef CONFIG_B43_LEDS
8
Michael Buesche4d6b792007-09-18 15:39:42 -04009#include <linux/types.h>
Michael Buesch21954c32007-09-27 15:31:40 +020010#include <linux/leds.h>
Michael Buescha78b3bb2009-09-11 21:44:05 +020011#include <linux/workqueue.h>
Michael Buesch21954c32007-09-27 15:31:40 +020012
13
14#define B43_LED_MAX_NAME_LEN 31
Michael Buesche4d6b792007-09-18 15:39:42 -040015
16struct b43_led {
Michael Buescha78b3bb2009-09-11 21:44:05 +020017 struct b43_wl *wl;
Michael Buesch21954c32007-09-27 15:31:40 +020018 /* 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];
Michael Buescha78b3bb2009-09-11 21:44:05 +020027 /* The current status of the LED. This is updated locklessly. */
28 atomic_t state;
29 /* The active state in hardware. */
30 bool hw_state;
Michael Buesche4d6b792007-09-18 15:39:42 -040031};
Michael Buesche4d6b792007-09-18 15:39:42 -040032
Michael Buescha78b3bb2009-09-11 21:44:05 +020033struct 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
Michael Buesche899a3f2009-09-14 23:22:08 +020039 bool stop;
Michael Buescha78b3bb2009-09-11 21:44:05 +020040 struct work_struct work;
41};
42
43#define B43_MAX_NR_LEDS 4
44
Michael Buesche4d6b792007-09-18 15:39:42 -040045#define B43_LED_BEHAVIOUR 0x7F
46#define B43_LED_ACTIVELOW 0x80
Michael Buesch21954c32007-09-27 15:31:40 +020047/* LED behaviour values */
48enum b43_led_behaviour {
Michael Buesche4d6b792007-09-18 15:39:42 -040049 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,
Michael Buesche4d6b792007-09-18 15:39:42 -040061};
62
Michael Buescha78b3bb2009-09-11 21:44:05 +020063void b43_leds_register(struct b43_wldev *dev);
Michael Buesch727c9882009-10-01 15:54:32 +020064void b43_leds_unregister(struct b43_wl *wl);
Michael Buesch21954c32007-09-27 15:31:40 +020065void b43_leds_init(struct b43_wldev *dev);
Michael Buesche4d6b792007-09-18 15:39:42 -040066void b43_leds_exit(struct b43_wldev *dev);
Albert Herranz82905ac2009-09-16 00:26:19 +020067void b43_leds_stop(struct b43_wldev *dev);
Michael Buesch21954c32007-09-27 15:31:40 +020068
69
70#else /* CONFIG_B43_LEDS */
71/* LED support disabled */
72
Michael Buescha78b3bb2009-09-11 21:44:05 +020073struct b43_leds {
Michael Buesch21954c32007-09-27 15:31:40 +020074 /* empty */
75};
76
Michael Buescha78b3bb2009-09-11 21:44:05 +020077static inline void b43_leds_register(struct b43_wldev *dev)
78{
79}
Michael Buesch727c9882009-10-01 15:54:32 +020080static inline void b43_leds_unregister(struct b43_wl *wl)
Michael Buescha78b3bb2009-09-11 21:44:05 +020081{
82}
Michael Buesch21954c32007-09-27 15:31:40 +020083static inline void b43_leds_init(struct b43_wldev *dev)
84{
85}
86static inline void b43_leds_exit(struct b43_wldev *dev)
87{
88}
Albert Herranz82905ac2009-09-16 00:26:19 +020089static inline void b43_leds_stop(struct b43_wldev *dev)
90{
91}
Michael Buesch21954c32007-09-27 15:31:40 +020092#endif /* CONFIG_B43_LEDS */
Michael Buesche4d6b792007-09-18 15:39:42 -040093
94#endif /* B43_LEDS_H_ */