netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	Larry Finger <Larry.Finger@lwfinger.net>,
	netdev@vger.kernel.org, jcheung@suse.com, machen@suse.com,
	mmarek@suse.cz
Subject: [RFC/RFT 14/27] rtlwifi: rtl8188ee: Add files for new driver - part 5
Date: Mon, 25 Feb 2013 18:13:26 -0600	[thread overview]
Message-ID: <1361837619-2985-15-git-send-email-Larry.Finger@lwfinger.net> (raw)
In-Reply-To: <1361837619-2985-1-git-send-email-Larry.Finger@lwfinger.net>

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Cc: jcheung@suse.com
Cc: machen@suse.com
Cc: mmarek@suse.cz
---
 drivers/net/wireless/rtlwifi/rtl8188ee/led.c | 158 +++++++++++++++++++++++++++
 drivers/net/wireless/rtlwifi/rtl8188ee/led.h |  38 +++++++
 2 files changed, 196 insertions(+)
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/led.c
 create mode 100644 drivers/net/wireless/rtlwifi/rtl8188ee/led.h

diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/led.c b/drivers/net/wireless/rtlwifi/rtl8188ee/led.c
new file mode 100644
index 0000000..7fac87f
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/led.c
@@ -0,0 +1,158 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2009-2013  Realtek Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ * wlanfae <wlanfae@realtek.com>
+ * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
+ * Hsinchu 300, Taiwan.
+ *
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ *****************************************************************************/
+
+#include "../wifi.h"
+#include "../pci.h"
+#include "reg.h"
+#include "led.h"
+
+static void _rtl88ee_init_led(struct ieee80211_hw *hw,
+			      struct rtl_led *pled, enum rtl_led_pin ledpin)
+{
+	pled->hw = hw;
+	pled->ledpin = ledpin;
+	pled->ledon = false;
+}
+
+void rtl88ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled)
+{
+	u8 ledcfg;
+	struct rtl_priv *rtlpriv = rtl_priv(hw);
+
+	RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD,
+		 "LedAddr:%X ledpin =%d\n", REG_LEDCFG2, pled->ledpin);
+
+
+
+	switch (pled->ledpin) {
+	case LED_PIN_GPIO0:
+		break;
+	case LED_PIN_LED0:
+		ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
+		rtl_write_byte(rtlpriv,
+			       REG_LEDCFG2, (ledcfg & 0xf0) | BIT(5) | BIT(6));
+		break;
+	case LED_PIN_LED1:
+		ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG1);
+		rtl_write_byte(rtlpriv, REG_LEDCFG1, ledcfg & 0x10);
+		break;
+	default:
+		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
+			 "switch case not processed\n");
+		break;
+	}
+	pled->ledon = true;
+}
+
+void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled)
+{
+	struct rtl_priv *rtlpriv = rtl_priv(hw);
+	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
+	u8 ledcfg;
+
+	RT_TRACE(rtlpriv, COMP_LED, DBG_LOUD,
+		 "LedAddr:%X ledpin =%d\n", REG_LEDCFG2, pled->ledpin);
+
+	switch (pled->ledpin) {
+	case LED_PIN_GPIO0:
+		break;
+	case LED_PIN_LED0:
+		ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG2);
+		ledcfg &= 0xf0;
+		if (pcipriv->ledctl.led_opendrain == true) {
+			rtl_write_byte(rtlpriv, REG_LEDCFG2,
+				       (ledcfg | BIT(3) | BIT(5) | BIT(6)));
+			ledcfg = rtl_read_byte(rtlpriv, REG_MAC_PINMUX_CFG);
+			rtl_write_byte(rtlpriv, REG_MAC_PINMUX_CFG,
+				       ledcfg & 0xFE);
+		} else {
+			rtl_write_byte(rtlpriv, REG_LEDCFG2,
+				       (ledcfg | BIT(3) | BIT(5) | BIT(6)));
+		}
+		break;
+	case LED_PIN_LED1:
+		ledcfg = rtl_read_byte(rtlpriv, REG_LEDCFG1);
+		ledcfg &= 0x10;
+		rtl_write_byte(rtlpriv, REG_LEDCFG1, (ledcfg | BIT(3)));
+		break;
+	default:
+		RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
+			 "switch case not processed\n");
+		break;
+	}
+	pled->ledon = false;
+}
+
+void rtl88ee_init_sw_leds(struct ieee80211_hw *hw)
+{
+	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
+	_rtl88ee_init_led(hw, &(pcipriv->ledctl.sw_led0), LED_PIN_LED0);
+	_rtl88ee_init_led(hw, &(pcipriv->ledctl.sw_led1), LED_PIN_LED1);
+}
+
+static void _rtl88ee_sw_led_control(struct ieee80211_hw *hw,
+				    enum led_ctl_mode ledaction)
+{
+	struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw);
+	struct rtl_led *pLed0 = &(pcipriv->ledctl.sw_led0);
+	switch (ledaction) {
+	case LED_CTL_POWER_ON:
+	case LED_CTL_LINK:
+	case LED_CTL_NO_LINK:
+		rtl88ee_sw_led_on(hw, pLed0);
+		break;
+	case LED_CTL_POWER_OFF:
+		rtl88ee_sw_led_off(hw, pLed0);
+		break;
+	default:
+		break;
+	}
+}
+
+void rtl88ee_led_control(struct ieee80211_hw *hw,
+			enum led_ctl_mode ledaction)
+{
+	struct rtl_priv *rtlpriv = rtl_priv(hw);
+	struct rtl_ps_ctl *ppsc = rtl_psc(rtl_priv(hw));
+
+	if ((ppsc->rfoff_reason > RF_CHANGE_BY_PS) &&
+	    (ledaction == LED_CTL_TX ||
+	     ledaction == LED_CTL_RX ||
+	     ledaction == LED_CTL_SITE_SURVEY ||
+	     ledaction == LED_CTL_LINK ||
+	     ledaction == LED_CTL_NO_LINK ||
+	     ledaction == LED_CTL_START_TO_LINK ||
+	     ledaction == LED_CTL_POWER_ON)) {
+		return;
+	}
+	RT_TRACE(rtlpriv, COMP_LED, DBG_TRACE, "ledaction %d,\n",
+		 ledaction);
+	_rtl88ee_sw_led_control(hw, ledaction);
+}
+
diff --git a/drivers/net/wireless/rtlwifi/rtl8188ee/led.h b/drivers/net/wireless/rtlwifi/rtl8188ee/led.h
new file mode 100644
index 0000000..4073f6f
--- /dev/null
+++ b/drivers/net/wireless/rtlwifi/rtl8188ee/led.h
@@ -0,0 +1,38 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2009-2013  Realtek Corporation.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ * wlanfae <wlanfae@realtek.com>
+ * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
+ * Hsinchu 300, Taiwan.
+ *
+ * Larry Finger <Larry.Finger@lwfinger.net>
+ *
+ *****************************************************************************/
+
+#ifndef __RTL92CE_LED_H__
+#define __RTL92CE_LED_H__
+
+void rtl88ee_init_sw_leds(struct ieee80211_hw *hw);
+void rtl88ee_sw_led_on(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl88ee_sw_led_off(struct ieee80211_hw *hw, struct rtl_led *pled);
+void rtl88ee_led_control(struct ieee80211_hw *hw, enum led_ctl_mode ledaction);
+
+#endif
-- 
1.8.1.4

  parent reply	other threads:[~2013-02-26  0:14 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-26  0:13 [RFC/RFT 00/27] Updates for the rtlwifi family of drivers Larry Finger
2013-02-26  0:13 ` [RFC/RFT 01/27] rtlwifi: Modify the master header for for updates to vendor version 2013.02.07 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 03/27] rtlwifi: Modify files for 2013.02.07 vendor version - part 3 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 04/27] rtlwifi: Modify files for 2013.02.07 vendor version - part 4 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 05/27] " Larry Finger
2013-02-26  0:13 ` [RFC/RFT 06/27] rtlwifi: rtl8192se: Update driver to match vendor driver of 2013.02.07 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 08/27] rtlwifi: rtl8192c: rtl8192ce: Update to " Larry Finger
2013-02-26  0:13 ` [RFC/RFT 10/27] rtlwifi: rtl8188ee: Add new driver - part 1 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 12/27] rtlwifi: rtl8188ee: Add new driver files - part 3 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 13/27] rtlwifi: rtl8188ee: Add files for new driver - part 4 Larry Finger
2013-02-26  0:13 ` Larry Finger [this message]
     [not found] ` <1361837619-2985-1-git-send-email-Larry.Finger-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
2013-02-26  0:13   ` [RFC/RFT 02/27] rtlwifi: Modify files for 2013.02.07 vendor version - part 2 Larry Finger
2013-02-26  0:13   ` [RFC/RFT 07/27] rtlwifi: rtl8723ae: Update to vendor driver of 2013.02.07 Larry Finger
2013-02-26  0:13   ` [RFC/RFT 09/27] rtlwifi: Rework rtl_lps_leave() and rtl_lps_enter() to use work queue Larry Finger
2013-02-26  0:13   ` [RFC/RFT 11/27] rtlwifi: rtl8188ee: Add new driver files - part 2 Larry Finger
2013-02-26  0:13   ` [RFC/RFT 15/27] rtlwifi: rtl8188ee: Add files for new driver - part 6 Larry Finger
2013-02-26  0:13   ` [RFC/RFT 20/27] rtlwifi: rtl8188ee: Add files for new driver - part 11 Larry Finger
2013-02-26  0:13   ` [RFC/RFT 27/27] rtlwifi: rtl8188ee: Enable build of new driver Larry Finger
2013-02-26  0:13 ` [RFC/RFT 16/27] rtlwifi: rtl8188ee: Add files for new driver - part 7 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 17/27] rtlwifi: rtl8188ee: Add files for new driver - part 8 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 18/27] rtlwifi: rtl8188ee: Add files for new driver - part 9 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 19/27] rtlwifi: rtl8188ee: Add files for new driver - part 10 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 21/27] rtlwifi: rtl8188ee: Add files for new driver - part 12 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 22/27] rtlwifi: rtl8188ee: Add files for new driver - part 13 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 23/27] rtlwifi: rtl8188ee: Add files for new driver - part 14 Larry Finger
2013-02-26  0:13 ` [RFC/RFT 24/27] rtlwifi: rtl8192c: rtl8192ce: rtl8192cu: rtl8192de: rtl8723ae: Add changes required by adding rtl81988ee Larry Finger
2013-02-26  0:13 ` [RFC/RFT 25/27] rtlwifi: rtl8188ee: Enable recognition of RTL8188EE Larry Finger
2013-02-26  0:13 ` [RFC/RFT 26/27] rtlwifi: rtl8188e: Remove some CamelCase variable names Larry Finger
2013-02-26  2:22 ` [RFC/RFT 00/27] Updates for the rtlwifi family of drivers Joe Perches
2013-02-26  3:04   ` Larry Finger
     [not found]     ` <512C264A.3000104-tQ5ms3gMjBLk1uMJSBkQmQ@public.gmane.org>
2013-02-26  3:26       ` Joe Perches
     [not found]     ` <CALx5=V_Y2=bZWXzc9uQkmTBAECeMLbnPU0VA56Wp2tNeBB3Dqw@mail.gmail.com>
2013-03-07 17:01       ` Larry Finger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1361837619-2985-15-git-send-email-Larry.Finger@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=jcheung@suse.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=machen@suse.com \
    --cc=mmarek@suse.cz \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).