rtl871x_led.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /******************************************************************************
  2. *
  3. * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
  4. *
  5. * This program is free software; you can redistribute it and/or modify it
  6. * under the terms of version 2 of the GNU General Public License as
  7. * published by the Free Software Foundation.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc.,
  16. * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17. *
  18. * Modifications for inclusion into the Linux staging tree are
  19. * Copyright(c) 2010 Larry Finger. All rights reserved.
  20. *
  21. * Contact information:
  22. * WLAN FAE <wlanfae@realtek.com>
  23. * Larry Finger <Larry.Finger@lwfinger.net>
  24. *
  25. ******************************************************************************/
  26. #ifndef __RTL8712_LED_H
  27. #define __RTL8712_LED_H
  28. #include "osdep_service.h"
  29. #include "drv_types.h"
  30. /*===========================================================================
  31. * LED customization.
  32. *===========================================================================
  33. */
  34. enum LED_CTL_MODE {
  35. LED_CTL_POWER_ON = 1,
  36. LED_CTL_LINK = 2,
  37. LED_CTL_NO_LINK = 3,
  38. LED_CTL_TX = 4,
  39. LED_CTL_RX = 5,
  40. LED_CTL_SITE_SURVEY = 6,
  41. LED_CTL_POWER_OFF = 7,
  42. LED_CTL_START_TO_LINK = 8,
  43. LED_CTL_START_WPS = 9,
  44. LED_CTL_STOP_WPS = 10,
  45. LED_CTL_START_WPS_BOTTON = 11,
  46. LED_CTL_STOP_WPS_FAIL = 12,
  47. LED_CTL_STOP_WPS_FAIL_OVERLAP = 13,
  48. };
  49. #define IS_LED_WPS_BLINKING(_LED_871x) \
  50. (((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS \
  51. || ((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP \
  52. || ((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress)
  53. #define IS_LED_BLINKING(_LED_871x) \
  54. (((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress \
  55. || ((struct LED_871x *)_LED_871x)->bLedScanBlinkInProgress)
  56. enum LED_PIN_871x {
  57. LED_PIN_GPIO0,
  58. LED_PIN_LED0,
  59. LED_PIN_LED1
  60. };
  61. /*===========================================================================
  62. * LED customization.
  63. *===========================================================================
  64. */
  65. enum LED_STRATEGY_871x {
  66. SW_LED_MODE0, /* SW control 1 LED via GPIO0. It is default option. */
  67. SW_LED_MODE1, /* 2 LEDs, through LED0 and LED1. For ALPHA. */
  68. SW_LED_MODE2, /* SW control 1 LED via GPIO0,
  69. * custom for AzWave 8187 minicard. */
  70. SW_LED_MODE3, /* SW control 1 LED via GPIO0,
  71. * customized for Sercomm Printer Server case.*/
  72. SW_LED_MODE4, /*for Edimax / Belkin*/
  73. SW_LED_MODE5, /*for Sercomm / Belkin*/
  74. SW_LED_MODE6, /*for WNC / Corega*/
  75. HW_LED, /* HW control 2 LEDs, LED0 and LED1 (there are 4 different
  76. * control modes, see MAC.CONFIG1 for details.)*/
  77. };
  78. struct LED_871x {
  79. struct _adapter *padapter;
  80. enum LED_PIN_871x LedPin; /* Implementation for this SW led. */
  81. u32 CurrLedState; /* Current LED state. */
  82. u8 bLedOn; /* true if LED is ON */
  83. u8 bSWLedCtrl;
  84. u8 bLedBlinkInProgress; /*true if blinking */
  85. u8 bLedNoLinkBlinkInProgress;
  86. u8 bLedLinkBlinkInProgress;
  87. u8 bLedStartToLinkBlinkInProgress;
  88. u8 bLedScanBlinkInProgress;
  89. u8 bLedWPSBlinkInProgress;
  90. u32 BlinkTimes; /* No. times to toggle for blink.*/
  91. u32 BlinkingLedState; /* Next state for blinking,
  92. * either LED_ON or OFF.*/
  93. struct timer_list BlinkTimer; /* Timer object for led blinking.*/
  94. struct work_struct BlinkWorkItem; /* Workitem used by BlinkTimer */
  95. };
  96. struct led_priv {
  97. /* add for led control */
  98. struct LED_871x SwLed0;
  99. struct LED_871x SwLed1;
  100. enum LED_STRATEGY_871x LedStrategy;
  101. u8 bRegUseLed;
  102. void (*LedControlHandler)(struct _adapter *padapter,
  103. enum LED_CTL_MODE LedAction);
  104. /* add for led control */
  105. };
  106. /*===========================================================================
  107. * Interface to manipulate LED objects.
  108. *===========================================================================*/
  109. void r8712_InitSwLeds(struct _adapter *padapter);
  110. void r8712_DeInitSwLeds(struct _adapter *padapter);
  111. void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction);
  112. #endif