blob: c4a58a0fc1d563648dc0ede780613ab2db83f73b [file] [log] [blame]
Michael Buesche4d6b792007-09-18 15:39:42 -04001#ifndef B43_LEDS_H_
2#define B43_LEDS_H_
3
Michael Buesch21954c32007-09-27 15:31:40 +02004struct b43_wldev;
5
6#ifdef CONFIG_B43_LEDS
7
Michael Buesche4d6b792007-09-18 15:39:42 -04008#include <linux/types.h>
Michael Buesch21954c32007-09-27 15:31:40 +02009#include <linux/leds.h>
Michael Buescha78b3bb2009-09-11 21:44:05 +020010#include <linux/workqueue.h>
Michael Buesch21954c32007-09-27 15:31:40 +020011
12
13#define B43_LED_MAX_NAME_LEN 31
Michael Buesche4d6b792007-09-18 15:39:42 -040014
15struct b43_led {
Michael Buescha78b3bb2009-09-11 21:44:05 +020016 struct b43_wl *wl;
Michael Buesch21954c32007-09-27 15:31:40 +020017 /* The LED class device */
18 struct led_classdev led_dev;
19 /* The index number of the LED. */
20 u8 index;
21 /* If activelow is true, the LED is ON if the
22 * bit is switched off. */
23 bool activelow;
24 /* The unique name string for this LED device. */
25 char name[B43_LED_MAX_NAME_LEN + 1];
Michael Buescha78b3bb2009-09-11 21:44:05 +020026 /* The current status of the LED. This is updated locklessly. */
27 atomic_t state;
28 /* The active state in hardware. */
29 bool hw_state;
Michael Buesche4d6b792007-09-18 15:39:42 -040030};
Michael Buesche4d6b792007-09-18 15:39:42 -040031
Michael Buescha78b3bb2009-09-11 21:44:05 +020032struct b43_leds {
33 struct b43_led led_tx;
34 struct b43_led led_rx;
35 struct b43_led led_radio;
36 struct b43_led led_assoc;
37
38 struct work_struct work;
39};
40
41#define B43_MAX_NR_LEDS 4
42
Michael Buesche4d6b792007-09-18 15:39:42 -040043#define B43_LED_BEHAVIOUR 0x7F
44#define B43_LED_ACTIVELOW 0x80
Michael Buesch21954c32007-09-27 15:31:40 +020045/* LED behaviour values */
46enum b43_led_behaviour {
Michael Buesche4d6b792007-09-18 15:39:42 -040047 B43_LED_OFF,
48 B43_LED_ON,
49 B43_LED_ACTIVITY,
50 B43_LED_RADIO_ALL,
51 B43_LED_RADIO_A,
52 B43_LED_RADIO_B,
53 B43_LED_MODE_BG,
54 B43_LED_TRANSFER,
55 B43_LED_APTRANSFER,
56 B43_LED_WEIRD, //FIXME
57 B43_LED_ASSOC,
58 B43_LED_INACTIVE,
Michael Buesche4d6b792007-09-18 15:39:42 -040059};
60
Michael Buescha78b3bb2009-09-11 21:44:05 +020061void b43_leds_register(struct b43_wldev *dev);
62void b43_leds_unregister(struct b43_wldev *dev);
Michael Buesch21954c32007-09-27 15:31:40 +020063void b43_leds_init(struct b43_wldev *dev);
Michael Buesche4d6b792007-09-18 15:39:42 -040064void b43_leds_exit(struct b43_wldev *dev);
Michael Buesch21954c32007-09-27 15:31:40 +020065
66
67#else /* CONFIG_B43_LEDS */
68/* LED support disabled */
69
Michael Buescha78b3bb2009-09-11 21:44:05 +020070struct b43_leds {
Michael Buesch21954c32007-09-27 15:31:40 +020071 /* empty */
72};
73
Michael Buescha78b3bb2009-09-11 21:44:05 +020074static inline void b43_leds_register(struct b43_wldev *dev)
75{
76}
77static inline void b43_leds_unregister(struct b43_wldev *dev)
78{
79}
Michael Buesch21954c32007-09-27 15:31:40 +020080static inline void b43_leds_init(struct b43_wldev *dev)
81{
82}
83static inline void b43_leds_exit(struct b43_wldev *dev)
84{
85}
86#endif /* CONFIG_B43_LEDS */
Michael Buesche4d6b792007-09-18 15:39:42 -040087
88#endif /* B43_LEDS_H_ */