mac80211: Remove unused third address from mesh address extension header.
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / net / wireless / rtlwifi / rtl8192ce / rtl8192c-led.c
blob6091084215709049bed7d98149b1fc6d58f46b4a
1 /******************************************************************************
3 * Copyright(c) 2009-2010 Realtek Corporation.
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.
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.
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
18 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
26 * Larry Finger <Larry.Finger@lwfinger.net>
28 *****************************************************************************/
30 #include "../wifi.h"
31 #include "../pci.h"
32 #include "rtl8192c-reg.h"
33 #include "rtl8192c-led.h"
35 void rtl92ce_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
37 u8 ledcfg;
38 struct rtl_priv *rtlpriv = rtl_priv(hw);
40 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD,
41 ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin));
43 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
45 switch (pled->ledpin) {
46 case LED_PIN_GPIO0:
47 break;
48 case LED_PIN_LED0:
49 rtl_write_byte(rtlpriv,
50 REG_LEDCFG2, (ledcfg & 0xf0) | BIT(5) | BIT(6));
51 break;
52 case LED_PIN_LED1:
53 rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg & 0x0f) | BIT(5));
54 break;
55 default:
56 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
57 ("switch case not process\n"));
58 break;
60 pled->b_ledon = true;
63 void rtl92ce_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
65 struct rtl_priv *rtlpriv = rtl_priv(hw);
66 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
67 u8 ledcfg;
69 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD,
70 ("LedAddr:%X ledpin=%d\n", REG_LEDCFG2, pled->ledpin));
72 ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
74 switch (pled->ledpin) {
75 case LED_PIN_GPIO0:
76 break;
77 case LED_PIN_LED0:
78 ledcfg &= 0xf0;
79 if (pcipriv->ledctl.bled_opendrain == true)
80 rtl_write_byte(rtlpriv, REG_LEDCFG2,
81 (ledcfg | BIT(1) | BIT(5) | BIT(6)));
82 else
83 rtl_write_byte(rtlpriv, REG_LEDCFG2,
84 (ledcfg | BIT(3) | BIT(5) | BIT(6)));
85 break;
86 case LED_PIN_LED1:
87 ledcfg &= 0x0f;
88 rtl_write_byte(rtlpriv, REG_LEDCFG2, (ledcfg | BIT(3)));
89 break;
90 default:
91 RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
92 ("switch case not process\n"));
93 break;
95 pled->b_ledon = false;
98 void rtl92ce_init_sw_leds(struct ieee80211_hw *hw)
102 void rtl92ce_deinit_sw_leds(struct ieee80211_hw *hw)
106 void _rtl92ce_sw_led_control(struct ieee80211_hw *hw,
107 enum led_ctl_mode ledaction)
109 struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
110 struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0);
111 switch (ledaction) {
112 case LED_CTL_POWER_ON:
113 case LED_CTL_LINK:
114 case LED_CTL_NO_LINK:
115 rtl92ce_sw_led_on(hw, pLed0);
116 break;
117 case LED_CTL_POWER_OFF:
118 rtl92ce_sw_led_off(hw, pLed0);
119 break;
120 default:
121 break;
125 void rtl92ce_led_control(struct ieee80211_hw *hw,
126 enum led_ctl_mode ledaction)
128 struct rtl_priv *rtlpriv = rtl_priv(hw);
129 struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
131 if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) &&
132 (ledaction == LED_CTL_TX ||
133 ledaction == LED_CTL_RX ||
134 ledaction == LED_CTL_SITE_SURVEY ||
135 ledaction == LED_CTL_LINK ||
136 ledaction == LED_CTL_NO_LINK ||
137 ledaction == LED_CTL_START_TO_LINK ||
138 ledaction == LED_CTL_POWER_ON)) {
139 return;
141 RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD, ("ledaction %d,\n",
142 ledaction));
143 _rtl92ce_sw_led_control(hw, ledaction);