Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 1 | #ifndef B43_LEDS_H_ |
| 2 | #define B43_LEDS_H_ |
| 3 | |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 4 | struct b43_wldev; |
| 5 | |
| 6 | #ifdef CONFIG_B43_LEDS |
| 7 | |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 8 | #include <linux/types.h> |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 9 | #include <linux/leds.h> |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 10 | #include <linux/workqueue.h> |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 11 | |
| 12 | |
| 13 | #define B43_LED_MAX_NAME_LEN 31 |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 14 | |
| 15 | struct b43_led { |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 16 | struct b43_wl *wl; |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 17 | /* 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 Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 26 | /* 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 Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 30 | }; |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 31 | |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 32 | struct 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 | |
Michael Buesch | e899a3f | 2009-09-14 23:22:08 +0200 | [diff] [blame^] | 38 | bool stop; |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 39 | struct work_struct work; |
| 40 | }; |
| 41 | |
| 42 | #define B43_MAX_NR_LEDS 4 |
| 43 | |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 44 | #define B43_LED_BEHAVIOUR 0x7F |
| 45 | #define B43_LED_ACTIVELOW 0x80 |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 46 | /* LED behaviour values */ |
| 47 | enum b43_led_behaviour { |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 48 | B43_LED_OFF, |
| 49 | B43_LED_ON, |
| 50 | B43_LED_ACTIVITY, |
| 51 | B43_LED_RADIO_ALL, |
| 52 | B43_LED_RADIO_A, |
| 53 | B43_LED_RADIO_B, |
| 54 | B43_LED_MODE_BG, |
| 55 | B43_LED_TRANSFER, |
| 56 | B43_LED_APTRANSFER, |
| 57 | B43_LED_WEIRD, //FIXME |
| 58 | B43_LED_ASSOC, |
| 59 | B43_LED_INACTIVE, |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 60 | }; |
| 61 | |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 62 | void b43_leds_register(struct b43_wldev *dev); |
| 63 | void b43_leds_unregister(struct b43_wldev *dev); |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 64 | void b43_leds_init(struct b43_wldev *dev); |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 65 | void b43_leds_exit(struct b43_wldev *dev); |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 66 | |
| 67 | |
| 68 | #else /* CONFIG_B43_LEDS */ |
| 69 | /* LED support disabled */ |
| 70 | |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 71 | struct b43_leds { |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 72 | /* empty */ |
| 73 | }; |
| 74 | |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 75 | static inline void b43_leds_register(struct b43_wldev *dev) |
| 76 | { |
| 77 | } |
| 78 | static inline void b43_leds_unregister(struct b43_wldev *dev) |
| 79 | { |
| 80 | } |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 81 | static inline void b43_leds_init(struct b43_wldev *dev) |
| 82 | { |
| 83 | } |
| 84 | static inline void b43_leds_exit(struct b43_wldev *dev) |
| 85 | { |
| 86 | } |
| 87 | #endif /* CONFIG_B43_LEDS */ |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 88 | |
| 89 | #endif /* B43_LEDS_H_ */ |