Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /******************************************************************************
0003  *
0004  * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
0005  *
0006  * Modifications for inclusion into the Linux staging tree are
0007  * Copyright(c) 2010 Larry Finger. All rights reserved.
0008  *
0009  * Contact information:
0010  * WLAN FAE <wlanfae@realtek.com>
0011  * Larry Finger <Larry.Finger@lwfinger.net>
0012  *
0013  ******************************************************************************/
0014 #ifndef __RTL8712_LED_H
0015 #define __RTL8712_LED_H
0016 
0017 #include "osdep_service.h"
0018 #include "drv_types.h"
0019 
0020 /*===========================================================================
0021  * LED customization.
0022  *===========================================================================
0023  */
0024 enum LED_CTL_MODE {
0025     LED_CTL_POWER_ON = 1,
0026     LED_CTL_LINK = 2,
0027     LED_CTL_NO_LINK = 3,
0028     LED_CTL_TX = 4,
0029     LED_CTL_RX = 5,
0030     LED_CTL_SITE_SURVEY = 6,
0031     LED_CTL_POWER_OFF = 7,
0032     LED_CTL_START_TO_LINK = 8,
0033     LED_CTL_START_WPS = 9,
0034     LED_CTL_STOP_WPS = 10,
0035     LED_CTL_START_WPS_BOTTON = 11,
0036     LED_CTL_STOP_WPS_FAIL = 12,
0037     LED_CTL_STOP_WPS_FAIL_OVERLAP = 13,
0038 };
0039 
0040 #define IS_LED_WPS_BLINKING(_LED_871x)  \
0041     (((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS \
0042     || ((struct LED_871x *)_LED_871x)->CurrLedState == LED_BLINK_WPS_STOP \
0043     || ((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress)
0044 
0045 #define IS_LED_BLINKING(_LED_871x)  \
0046         (((struct LED_871x *)_LED_871x)->bLedWPSBlinkInProgress \
0047         || ((struct LED_871x *)_LED_871x)->bLedScanBlinkInProgress)
0048 
0049 enum LED_PIN_871x {
0050     LED_PIN_GPIO0,
0051     LED_PIN_LED0,
0052     LED_PIN_LED1
0053 };
0054 
0055 /*===========================================================================
0056  * LED customization.
0057  *===========================================================================
0058  */
0059 enum LED_STRATEGY_871x {
0060     SW_LED_MODE0, /* SW control 1 LED via GPIO0. It is default option. */
0061     SW_LED_MODE1, /* 2 LEDs, through LED0 and LED1. For ALPHA. */
0062     SW_LED_MODE2, /* SW control 1 LED via GPIO0,
0063                * custom for AzWave 8187 minicard.
0064                */
0065     SW_LED_MODE3, /* SW control 1 LED via GPIO0,
0066                * customized for Sercomm Printer Server case.
0067                */
0068     SW_LED_MODE4, /*for Edimax / Belkin*/
0069     SW_LED_MODE5, /*for Sercomm / Belkin*/
0070     SW_LED_MODE6, /*for WNC / Corega*/
0071     HW_LED, /* HW control 2 LEDs, LED0 and LED1 (there are 4 different
0072          * control modes, see MAC.CONFIG1 for details.)
0073          */
0074 };
0075 
0076 struct LED_871x {
0077     struct _adapter     *padapter;
0078     enum LED_PIN_871x   LedPin; /* Implementation for this SW led. */
0079     u32         CurrLedState; /* Current LED state. */
0080     u8          bLedOn; /* true if LED is ON */
0081     u8          bSWLedCtrl;
0082     u8          bLedBlinkInProgress; /*true if blinking */
0083     u8          bLedNoLinkBlinkInProgress;
0084     u8          bLedLinkBlinkInProgress;
0085     u8          bLedStartToLinkBlinkInProgress;
0086     u8          bLedScanBlinkInProgress;
0087     u8          bLedWPSBlinkInProgress;
0088     u32         BlinkTimes; /* No. times to toggle for blink.*/
0089     u32         BlinkingLedState; /* Next state for blinking,
0090                            * either LED_ON or OFF.
0091                            */
0092 
0093     struct timer_list   BlinkTimer; /* Timer object for led blinking.*/
0094     struct work_struct  BlinkWorkItem; /* Workitem used by BlinkTimer */
0095 };
0096 
0097 struct led_priv {
0098     /* add for led control */
0099     struct LED_871x     SwLed0;
0100     struct LED_871x     SwLed1;
0101     enum LED_STRATEGY_871x  LedStrategy;
0102     u8          bRegUseLed;
0103     void (*LedControlHandler)(struct _adapter *padapter,
0104                   enum LED_CTL_MODE LedAction);
0105     /* add for led control */
0106 };
0107 
0108 /*===========================================================================
0109  * Interface to manipulate LED objects.
0110  *===========================================================================
0111  */
0112 void r8712_InitSwLeds(struct _adapter *padapter);
0113 void r8712_DeInitSwLeds(struct _adapter *padapter);
0114 void LedControl871x(struct _adapter *padapter, enum LED_CTL_MODE LedAction);
0115 void r8712_flush_led_works(struct _adapter *padapter);
0116 
0117 #endif
0118