linux/drivers/staging/rtl8712/rtl871x_led.h
<<
>>
Prefs
   1/* SPDX-License-Identifier: GPL-2.0 */
   2/******************************************************************************
   3 *
   4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
   5 *
   6 * Modifications for inclusion into the Linux staging tree are
   7 * Copyright(c) 2010 Larry Finger. All rights reserved.
   8 *
   9 * Contact information:
  10 * WLAN FAE <wlanfae@realtek.com>
  11 * Larry Finger <Larry.Finger@lwfinger.net>
  12 *
  13 ******************************************************************************/
  14#ifndef __RTL8712_LED_H
  15#define __RTL8712_LED_H
  16
  17#include "osdep_service.h"
  18#include "drv_types.h"
  19
  20/*===========================================================================
  21 * LED customization.
  22 *===========================================================================
  23 */
  24enum LED_CTL_MODE {
  25        LED_CTL_POWER_ON = 1,
  26        LED_CTL_LINK = 2,
  27        LED_CTL_NO_LINK = 3,
  28        LED_CTL_TX = 4,
  29        LED_CTL_RX = 5,
  30        LED_CTL_SITE_SURVEY = 6,
  31        LED_CTL_POWER_OFF = 7,
  32        LED_CTL_START_TO_LINK = 8,
  33        LED_CTL_START_WPS = 9,
  34        LED_CTL_STOP_WPS = 10,
  35        LED_CTL_START_WPS_BOTTON = 11,
  36        LED_CTL_STOP_WPS_FAIL = 12,
  37        LED_CTL_STOP_WPS_FAIL_OVERLAP = 13,
  38};
  39
  40#define IS_LED_WPS_BLINKING(_LED_871x)  \
  41        (((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS \
  42        || ((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP \
  43        || ((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress)
  44
  45#define IS_LED_BLINKING(_LED_871x)      \
  46                (((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress \
  47                || ((struct LED_871x *)_LED_871x)->bLedScanBlinkInProgress)
  48
  49enum LED_PIN_871x {
  50        LED_PIN_GPIO0,
  51        LED_PIN_LED0,
  52        LED_PIN_LED1
  53};
  54
  55/*===========================================================================
  56 * LED customization.
  57 *===========================================================================
  58 */
  59enum LED_STRATEGY_871x {
  60        SW_LED_MODE0, /* SW control 1 LED via GPIO0. It is default option. */
  61        SW_LED_MODE1, /* 2 LEDs, through LED0 and LED1. For ALPHA. */
  62        SW_LED_MODE2, /* SW control 1 LED via GPIO0,
  63                       * custom for AzWave 8187 minicard.
  64                       */
  65        SW_LED_MODE3, /* SW control 1 LED via GPIO0,
  66                       * customized for Sercomm Printer Server case.
  67                       */
  68        SW_LED_MODE4, /*for Edimax / Belkin*/
  69        SW_LED_MODE5, /*for Sercomm / Belkin*/
  70        SW_LED_MODE6, /*for WNC / Corega*/
  71        HW_LED, /* HW control 2 LEDs, LED0 and LED1 (there are 4 different
  72                 * control modes, see MAC.CONFIG1 for details.)
  73                 */
  74};
  75
  76struct LED_871x {
  77        struct _adapter         *padapter;
  78        enum LED_PIN_871x       LedPin; /* Implementation for this SW led. */
  79        u32                     CurrLedState; /* Current LED state. */
  80        u8                      bLedOn; /* true if LED is ON */
  81        u8                      bSWLedCtrl;
  82        u8                      bLedBlinkInProgress; /*true if blinking */
  83        u8                      bLedNoLinkBlinkInProgress;
  84        u8                      bLedLinkBlinkInProgress;
  85        u8                      bLedStartToLinkBlinkInProgress;
  86        u8                      bLedScanBlinkInProgress;
  87        u8                      bLedWPSBlinkInProgress;
  88        u32                     BlinkTimes; /* No. times to toggle for blink.*/
  89        u32                     BlinkingLedState; /* Next state for blinking,
  90                                                   * either LED_ON or OFF.
  91                                                   */
  92
  93        struct timer_list       BlinkTimer; /* Timer object for led blinking.*/
  94        struct work_struct      BlinkWorkItem; /* Workitem used by BlinkTimer */
  95};
  96
  97struct led_priv {
  98        /* add for led control */
  99        struct LED_871x         SwLed0;
 100        struct LED_871x         SwLed1;
 101        enum LED_STRATEGY_871x  LedStrategy;
 102        u8                      bRegUseLed;
 103        void (*LedControlHandler)(struct _adapter *padapter,
 104                                  enum LED_CTL_MODE LedAction);
 105        /* add for led control */
 106};
 107
 108/*===========================================================================
 109 * Interface to manipulate LED objects.
 110 *===========================================================================
 111 */
 112void r8712_InitSwLeds(struct _adapter *padapter);
 113void r8712_DeInitSwLeds(struct _adapter *padapter);
 114void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction);
 115void r8712_flush_led_works(struct _adapter *padapter);
 116
 117#endif
 118
 119