leds.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef B43_LEDS_H_
  3. #define B43_LEDS_H_
  4. struct b43_wl;
  5. struct b43_wldev;
  6. #ifdef CONFIG_B43_LEDS
  7. #include <linux/types.h>
  8. #include <linux/leds.h>
  9. #include <linux/workqueue.h>
  10. #define B43_LED_MAX_NAME_LEN 31
  11. struct b43_led {
  12. struct b43_wl *wl;
  13. /* The LED class device */
  14. struct led_classdev led_dev;
  15. /* The index number of the LED. */
  16. u8 index;
  17. /* If activelow is true, the LED is ON if the
  18. * bit is switched off. */
  19. bool activelow;
  20. /* The unique name string for this LED device. */
  21. char name[B43_LED_MAX_NAME_LEN + 1];
  22. /* The current status of the LED. This is updated locklessly. */
  23. atomic_t state;
  24. /* The active state in hardware. */
  25. bool hw_state;
  26. };
  27. struct b43_leds {
  28. struct b43_led led_tx;
  29. struct b43_led led_rx;
  30. struct b43_led led_radio;
  31. struct b43_led led_assoc;
  32. bool stop;
  33. struct work_struct work;
  34. };
  35. #define B43_MAX_NR_LEDS 4
  36. #define B43_LED_BEHAVIOUR 0x7F
  37. #define B43_LED_ACTIVELOW 0x80
  38. /* LED behaviour values */
  39. enum b43_led_behaviour {
  40. B43_LED_OFF,
  41. B43_LED_ON,
  42. B43_LED_ACTIVITY,
  43. B43_LED_RADIO_ALL,
  44. B43_LED_RADIO_A,
  45. B43_LED_RADIO_B,
  46. B43_LED_MODE_BG,
  47. B43_LED_TRANSFER,
  48. B43_LED_APTRANSFER,
  49. B43_LED_WEIRD, //FIXME
  50. B43_LED_ASSOC,
  51. B43_LED_INACTIVE,
  52. };
  53. void b43_leds_register(struct b43_wldev *dev);
  54. void b43_leds_unregister(struct b43_wl *wl);
  55. void b43_leds_init(struct b43_wldev *dev);
  56. void b43_leds_exit(struct b43_wldev *dev);
  57. void b43_leds_stop(struct b43_wldev *dev);
  58. #else /* CONFIG_B43_LEDS */
  59. /* LED support disabled */
  60. struct b43_leds {
  61. /* empty */
  62. };
  63. static inline void b43_leds_register(struct b43_wldev *dev)
  64. {
  65. }
  66. static inline void b43_leds_unregister(struct b43_wl *wl)
  67. {
  68. }
  69. static inline void b43_leds_init(struct b43_wldev *dev)
  70. {
  71. }
  72. static inline void b43_leds_exit(struct b43_wldev *dev)
  73. {
  74. }
  75. static inline void b43_leds_stop(struct b43_wldev *dev)
  76. {
  77. }
  78. #endif /* CONFIG_B43_LEDS */
  79. #endif /* B43_LEDS_H_ */