Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 1 | #ifndef B43_LEDS_H_ |
| 2 | #define B43_LEDS_H_ |
| 3 | |
Miguel Boton | e6693ea | 2009-10-09 16:13:53 +0200 | [diff] [blame] | 4 | struct b43_wl; |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 5 | struct b43_wldev; |
| 6 | |
| 7 | #ifdef CONFIG_B43_LEDS |
| 8 | |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 9 | #include <linux/types.h> |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 10 | #include <linux/leds.h> |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 11 | #include <linux/workqueue.h> |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 12 | |
| 13 | |
| 14 | #define B43_LED_MAX_NAME_LEN 31 |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 15 | |
| 16 | struct b43_led { |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 17 | struct b43_wl *wl; |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 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]; |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 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; |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 31 | }; |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 32 | |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 33 | struct 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 Buesch | e899a3f | 2009-09-14 23:22:08 +0200 | [diff] [blame] | 39 | bool stop; |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 40 | struct work_struct work; |
| 41 | }; |
| 42 | |
| 43 | #define B43_MAX_NR_LEDS 4 |
| 44 | |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 45 | #define B43_LED_BEHAVIOUR 0x7F |
| 46 | #define B43_LED_ACTIVELOW 0x80 |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 47 | /* LED behaviour values */ |
| 48 | enum b43_led_behaviour { |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 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, |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 61 | }; |
| 62 | |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 63 | void b43_leds_register(struct b43_wldev *dev); |
Michael Buesch | 727c988 | 2009-10-01 15:54:32 +0200 | [diff] [blame] | 64 | void b43_leds_unregister(struct b43_wl *wl); |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 65 | void b43_leds_init(struct b43_wldev *dev); |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 66 | void b43_leds_exit(struct b43_wldev *dev); |
Albert Herranz | 82905ac | 2009-09-16 00:26:19 +0200 | [diff] [blame] | 67 | void b43_leds_stop(struct b43_wldev *dev); |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 68 | |
| 69 | |
| 70 | #else /* CONFIG_B43_LEDS */ |
| 71 | /* LED support disabled */ |
| 72 | |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 73 | struct b43_leds { |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 74 | /* empty */ |
| 75 | }; |
| 76 | |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 77 | static inline void b43_leds_register(struct b43_wldev *dev) |
| 78 | { |
| 79 | } |
Michael Buesch | 727c988 | 2009-10-01 15:54:32 +0200 | [diff] [blame] | 80 | static inline void b43_leds_unregister(struct b43_wl *wl) |
Michael Buesch | a78b3bb | 2009-09-11 21:44:05 +0200 | [diff] [blame] | 81 | { |
| 82 | } |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 83 | static inline void b43_leds_init(struct b43_wldev *dev) |
| 84 | { |
| 85 | } |
| 86 | static inline void b43_leds_exit(struct b43_wldev *dev) |
| 87 | { |
| 88 | } |
Albert Herranz | 82905ac | 2009-09-16 00:26:19 +0200 | [diff] [blame] | 89 | static inline void b43_leds_stop(struct b43_wldev *dev) |
| 90 | { |
| 91 | } |
Michael Buesch | 21954c3 | 2007-09-27 15:31:40 +0200 | [diff] [blame] | 92 | #endif /* CONFIG_B43_LEDS */ |
Michael Buesch | e4d6b79 | 2007-09-18 15:39:42 -0400 | [diff] [blame] | 93 | |
| 94 | #endif /* B43_LEDS_H_ */ |