Linux wireless drivers development
 help / color / mirror / Atom feed
From: Zhu Yi <yi.zhu@intel.com>
To: linville@tuxdriver.com
Cc: linux-wireless@vger.kernel.org,
	Esti Kummer <ester.kummer@intel.com>,
	Tomas Winkler <tomas.winkler@intel.com>,
	Zhu Yi <yi.zhu@intel.com>
Subject: [PATCH 11/13] iwlwifi: set led register in disassociation
Date: Fri, 18 Jul 2008 13:53:07 +0800	[thread overview]
Message-ID: <1216360389-5352-12-git-send-email-yi.zhu@intel.com> (raw)
In-Reply-To: <1216360389-5352-11-git-send-email-yi.zhu@intel.com>

From: Esti Kummer <ester.kummer@intel.com>

This patch sets the led register in disassociation flow according to
rf-kill state : off - in case of rf_kill, on - otherwise.

Signed-off-by: Esti Kummer <ester.kummer@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
 drivers/net/wireless/iwlwifi/iwl-led.c |   40 +++++++++++++++++++------------
 1 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/drivers/net/wireless/iwlwifi/iwl-led.c b/drivers/net/wireless/iwlwifi/iwl-led.c
index 899d7a2..311be39 100644
--- a/drivers/net/wireless/iwlwifi/iwl-led.c
+++ b/drivers/net/wireless/iwlwifi/iwl-led.c
@@ -161,12 +161,32 @@ int iwl4965_led_off(struct iwl_priv *priv, int led_id)
 /* Set led register off */
 static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id)
 {
-	IWL_DEBUG_LED("radio off\n");
+	IWL_DEBUG_LED("LED Reg off\n");
 	iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF);
 	return 0;
 }
 
 /*
+ * Set led register in case of disassociation according to rfkill state
+ */
+static int iwl_led_associate(struct iwl_priv *priv, int led_id)
+{
+	IWL_DEBUG_LED("Associated\n");
+	priv->allow_blinking = 1;
+	return iwl4965_led_on_reg(priv, led_id);
+}
+static int iwl_led_disassociate(struct iwl_priv *priv, int led_id)
+{
+	priv->allow_blinking = 0;
+	if (iwl_is_rfkill(priv))
+		iwl4965_led_off_reg(priv, led_id);
+	else
+		iwl4965_led_on_reg(priv, led_id);
+
+	return 0;
+}
+
+/*
  * brightness call back function for Tx/Rx LED
  */
 static int iwl_led_associated(struct iwl_priv *priv, int led_id)
@@ -199,16 +219,10 @@ static void iwl_led_brightness_set(struct led_classdev *led_cdev,
 			led_type_str[led->type], brightness);
 	switch (brightness) {
 	case LED_FULL:
-		if (led->type == IWL_LED_TRG_ASSOC)
-			priv->allow_blinking = 1;
-
 		if (led->led_on)
 			led->led_on(priv, IWL_LED_LINK);
 		break;
 	case LED_OFF:
-		if (led->type == IWL_LED_TRG_ASSOC)
-			priv->allow_blinking = 0;
-
 		if (led->led_off)
 			led->led_off(priv, IWL_LED_LINK);
 		break;
@@ -282,12 +296,6 @@ static int iwl_get_blink_rate(struct iwl_priv *priv)
 	return i;
 }
 
-static inline int is_rf_kill(struct iwl_priv *priv)
-{
-	return test_bit(STATUS_RF_KILL_HW, &priv->status) ||
-		test_bit(STATUS_RF_KILL_SW, &priv->status);
-}
-
 /*
  * this function called from handler. Since setting Led command can
  * happen very frequent we postpone led command to be called from
@@ -301,7 +309,7 @@ void iwl_leds_background(struct iwl_priv *priv)
 		priv->last_blink_time = 0;
 		return;
 	}
-	if (is_rf_kill(priv)) {
+	if (iwl_is_rfkill(priv)) {
 		priv->last_blink_time = 0;
 		return;
 	}
@@ -364,8 +372,8 @@ int iwl_leds_register(struct iwl_priv *priv)
 				   IWL_LED_TRG_ASSOC, 0, name, trigger);
 
 	/* for assoc always turn led on */
-	priv->led[IWL_LED_TRG_ASSOC].led_on = iwl4965_led_on_reg;
-	priv->led[IWL_LED_TRG_ASSOC].led_off = iwl4965_led_on_reg;
+	priv->led[IWL_LED_TRG_ASSOC].led_on = iwl_led_associate;
+	priv->led[IWL_LED_TRG_ASSOC].led_off = iwl_led_disassociate;
 	priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL;
 
 	if (ret)
-- 
1.5.3.6


  reply	other threads:[~2008-07-18  5:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-18  5:52 [PATCH 00/13] iwlwifi driver 07/18 updates Zhu Yi
2008-07-18  5:52 ` [PATCH 01/13] iwlwifi: add power save to 5000 HW Zhu Yi
2008-07-18  5:52   ` [PATCH 02/13] iwlwifi: corrects power_level in sysfs Zhu Yi
2008-07-18  5:52     ` [PATCH 03/13] mac80211: pass dtim_period to low level driver Zhu Yi
2008-07-18  5:53       ` [PATCH 04/13] mac80211: make listen_interval be limited by " Zhu Yi
2008-07-18  5:53         ` [PATCH 05/13] iwlwifi: use dtim_period from association, and set listen_interval Zhu Yi
2008-07-18  5:53           ` [PATCH 06/13] iwlwifi: move iwl4965_mac_ampdu_action to iwl4965-base.c Zhu Yi
2008-07-18  5:53             ` [PATCH 07/13] iwlwifi: move beacon handling " Zhu Yi
2008-07-18  5:53               ` [PATCH 08/13] iwlwifi: move iwl4965_set_pwr_src " Zhu Yi
2008-07-18  5:53                 ` [PATCH 09/13] iwlwifi: rename iwl-4695-rs to iwl-agn-rs Zhu Yi
2008-07-18  5:53                   ` [PATCH 10/13] iwlwifi: kill iwl4965_fill_rs_info Zhu Yi
2008-07-18  5:53                     ` Zhu Yi [this message]
2008-07-18  5:53                       ` [PATCH 12/13] mac80211: remove unused variable agg_queue Zhu Yi
2008-07-18  5:53                         ` [PATCH 13/13] iwlwifi: bug fix in AGG flow - cast const to ULL Zhu Yi
2008-07-18  8:23           ` [PATCH 05/13] iwlwifi: use dtim_period from association, and set listen_interval Johannes Berg
2008-07-18  8:53             ` Tomas Winkler

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=1216360389-5352-12-git-send-email-yi.zhu@intel.com \
    --to=yi.zhu@intel.com \
    --cc=ester.kummer@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=tomas.winkler@intel.com \
    /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