Re: RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-25 Thread Michael Buesch
On Thursday 25 January 2007 04:21, Larry Finger wrote:
 Michael Buesch wrote:
  On Thursday 25 January 2007 00:16, Steve Brown wrote: 
  My understanding of the proposed behavior is:
  Radio on: led on
  Radio off: led off
  Activity: flash on-off-on ...
 
  This is the same behavior as my Buffalo WHR-HP-G54 and seems reasonable.
  
  That's not what is implemented in larry's patch.
  In this patch the activity led does only indicate activity
  and not radio status. (Well, it also indicates a the-card-is-up
  state, but that's not necessarily indicating that the radio
  is switched on).
 
 Actually, it is what is in my patch. The LED is on if the hardware-enable 
 switch is on and the
 interface is up.

The activity LED switches off, if you turn off the rf through rfkill button?
I don't think it does. I'd say it would always stay on, if you
switch rf off.

-- 
Greetings Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-24 Thread Larry Finger
The current bcm43xx-d80211 driver ignores any wireless-enable switches on 
mini-PCI
and mini-PCI-E cards. This patch implements a new routine to interrogate the
radio hardware enabled bit in the interface, logs the initial state and any
changes in the switch (if debugging enabled), activates the LED to show the
state, and changes the periodic work handler to provide 1 second response
to switch changes. The changes in the periodic work specs have not been 
implemented.

This should be applied to http://bu3sch.de/git/wireless-dev.git. 

Signed-off-by: Larry Finger [EMAIL PROTECTED]
---



Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
===
--- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
+++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
@@ -238,6 +238,9 @@ enum {
 #define BCM43xx_UCODEFLAG_UNKPACTRL0x0040
 #define BCM43xx_UCODEFLAG_JAPAN0x0080
 
+/* Hardware Radio Enable masks */
+#define BCM43xx_MMIO_RADIO_HWENABLED_HI_MASK (1  16)
+#define BCM43xx_MMIO_RADIO_HWENABLED_LO_MASK (1  4)
 
 /* HostFlags. See bcm43xx_hf_read/write() */
 #define BCM43xx_HF_ANTDIVHELP  0x0001 /* ucode antenna div helper 
*/
@@ -735,7 +738,8 @@ struct bcm43xx_wldev {
reg124_set_0x4:1,   /* Some variable to keep track of IRQ 
stuff. */
short_preamble:1,   /* TRUE, if short preamble is enabled. 
*/
short_slot:1,   /* TRUE, if short slot timing is 
enabled. */
-   firmware_norelease:1;   /* Do not release the firmware. Used on 
suspend. */
+   firmware_norelease:1,   /* Do not release the firmware. Used on 
suspend. */
+   radio_hw_enable:1;  /* saved state of radio hardware 
enabled state */
 
/* PHY/Radio device. */
struct bcm43xx_phy phy;
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_leds.c
===
--- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_leds.c
+++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_leds.c
@@ -27,7 +27,7 @@
 
 #include bcm43xx_leds.h
 #include bcm43xx.h
-
+#include bcm43xx_main.h
 
 static void bcm43xx_led_changestate(struct bcm43xx_led *led)
 {
@@ -108,6 +108,7 @@ static void bcm43xx_led_init_hardcoded(s
switch (led_index) {
case 0:
led-behaviour = BCM43xx_LED_ACTIVITY;
+   led-activelow = 1;
if (bus-board_vendor == PCI_VENDOR_ID_COMPAQ)
led-behaviour = BCM43xx_LED_RADIO_ALL;
break;
@@ -196,18 +197,19 @@ void bcm43xx_leds_update(struct bcm43xx_
turn_on = activity;
break;
case BCM43xx_LED_RADIO_ALL:
-   turn_on = phy-radio_on;
+   turn_on = phy-radio_on  
bcm43xx_is_hw_radio_enabled(dev);
break;
case BCM43xx_LED_RADIO_A:
-   turn_on = (phy-radio_on  phy-type == 
BCM43xx_PHYTYPE_A);
+   turn_on = (phy-radio_on  
bcm43xx_is_hw_radio_enabled(dev)
+   phy-type == BCM43xx_PHYTYPE_A);
break;
case BCM43xx_LED_RADIO_B:
-   turn_on = (phy-radio_on 
+   turn_on = (phy-radio_on  
bcm43xx_is_hw_radio_enabled(dev) 
   (phy-type == BCM43xx_PHYTYPE_B ||
phy-type == BCM43xx_PHYTYPE_G));
break;
case BCM43xx_LED_MODE_BG:
-   if (phy-type == BCM43xx_PHYTYPE_G 
+   if (phy-type == BCM43xx_PHYTYPE_G  
bcm43xx_is_hw_radio_enabled(dev) 
1/*FIXME: using G rates.*/)
turn_on = 1;
break;
Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
===
--- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
+++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_main.c
@@ -2080,6 +2080,9 @@ static int bcm43xx_chip_init(struct bcm4
if (err)
goto err_gpio_cleanup;
bcm43xx_radio_turn_on(dev);
+   dev-radio_hw_enable = bcm43xx_is_hw_radio_enabled(dev);
+   dprintk(KERN_INFO PFX Radio %s by hardware\n,
+   (dev-radio_hw_enable == 0) ? disabled : enabled);
 
bcm43xx_write16(dev, 0x03E6, 0x);
err = bcm43xx_phy_init(dev);
@@ -2226,22 +2229,38 @@ static void bcm43xx_periodic_every15sec(
//TODO for APHY (temperature?)
 }
 
+static void bcm43xx_periodic_every1sec(struct bcm43xx_wldev *dev)
+{
+   int radio_hw_enable;
+
+   /* check if radio hardware enabled status changed */
+   

Re: RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-24 Thread Michael Buesch
On Wednesday 24 January 2007 19:39, Larry Finger wrote:
 The current bcm43xx-d80211 driver ignores any wireless-enable switches on 
 mini-PCI
 and mini-PCI-E cards. This patch implements a new routine to interrogate the
 radio hardware enabled bit in the interface, logs the initial state and any
 changes in the switch (if debugging enabled), activates the LED to show the
 state, and changes the periodic work handler to provide 1 second response
 to switch changes. The changes in the periodic work specs have not been 
 implemented.
 
 This should be applied to http://bu3sch.de/git/wireless-dev.git. 
 
 Signed-off-by: Larry Finger [EMAIL PROTECTED]
 ---
 
 
 
 Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
 ===
 --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx.h
 @@ -238,6 +238,9 @@ enum {
  #define BCM43xx_UCODEFLAG_UNKPACTRL  0x0040
  #define BCM43xx_UCODEFLAG_JAPAN  0x0080
  
 +/* Hardware Radio Enable masks */
 +#define BCM43xx_MMIO_RADIO_HWENABLED_HI_MASK (1  16)
 +#define BCM43xx_MMIO_RADIO_HWENABLED_LO_MASK (1  4)
  
  /* HostFlags. See bcm43xx_hf_read/write() */
  #define BCM43xx_HF_ANTDIVHELP0x0001 /* ucode antenna div 
 helper */
 @@ -735,7 +738,8 @@ struct bcm43xx_wldev {
   reg124_set_0x4:1,   /* Some variable to keep track of IRQ 
 stuff. */
   short_preamble:1,   /* TRUE, if short preamble is enabled. 
 */
   short_slot:1,   /* TRUE, if short slot timing is 
 enabled. */
 - firmware_norelease:1;   /* Do not release the firmware. Used on 
 suspend. */
 + firmware_norelease:1,   /* Do not release the firmware. Used on 
 suspend. */
 + radio_hw_enable:1;  /* saved state of radio hardware 
 enabled state */
  
   /* PHY/Radio device. */
   struct bcm43xx_phy phy;
 Index: wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_leds.c
 ===
 --- wireless-dev.orig/drivers/net/wireless/d80211/bcm43xx/bcm43xx_leds.c
 +++ wireless-dev/drivers/net/wireless/d80211/bcm43xx/bcm43xx_leds.c
 @@ -27,7 +27,7 @@
  
  #include bcm43xx_leds.h
  #include bcm43xx.h
 -
 +#include bcm43xx_main.h
  
  static void bcm43xx_led_changestate(struct bcm43xx_led *led)
  {
 @@ -108,6 +108,7 @@ static void bcm43xx_led_init_hardcoded(s
   switch (led_index) {
   case 0:
   led-behaviour = BCM43xx_LED_ACTIVITY;
 + led-activelow = 1;

Why activelow?

-- 
Greetings Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-24 Thread Larry Finger
Michael Buesch wrote:
 On Wednesday 24 January 2007 19:39, Larry Finger wrote:
  switch (led_index) {
  case 0:
  led-behaviour = BCM43xx_LED_ACTIVITY;
 +led-activelow = 1;
 
 Why activelow?

It makes the light be on when there is no activity and blink off when there is. 
With that behavior,
it is a lot easier to see that the switch is on.

Larry


___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-24 Thread Jory A. Pratt
Michael Buesch wrote:
 On Wednesday 24 January 2007 20:08, Larry Finger wrote:
   
 Michael Buesch wrote:
 
 On Wednesday 24 January 2007 19:39, Larry Finger wrote:
   
switch (led_index) {
case 0:
led-behaviour = BCM43xx_LED_ACTIVITY;
 +  led-activelow = 1;
 
 Why activelow?
   
 It makes the light be on when there is no activity and blink off when there 
 is. With that behavior,
 it is a lot easier to see that the switch is on.
 

 Ah, ok.
 It's debatable if that behaviour is desireable.
 I don't like it, but if people want to have it, we can implement it.

   
I do not think this is what people want. If the radio is off the light
should just be off, when radio is on turn the light on, is a much more
desirable.

Thanks,
-Jory
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-24 Thread Steve Brown
Jory A. Pratt wrote:
 Michael Buesch wrote:
   
 On Wednesday 24 January 2007 20:08, Larry Finger wrote:
   
 
 Michael Buesch wrote:
 
   
 On Wednesday 24 January 2007 19:39, Larry Finger wrote:
   
 
   switch (led_index) {
   case 0:
   led-behaviour = BCM43xx_LED_ACTIVITY;
 + led-activelow = 1;
 
   
 Why activelow?
   
 
 It makes the light be on when there is no activity and blink off when there 
 is. With that behavior,
 it is a lot easier to see that the switch is on.
 
   
 Ah, ok.
 It's debatable if that behaviour is desireable.
 I don't like it, but if people want to have it, we can implement it.

   
 
 I do not think this is what people want. If the radio is off the light
 should just be off, when radio is on turn the light on, is a much more
 desirable.

 Thanks,
 -Jory
 ___
 Bcm43xx-dev mailing list
 Bcm43xx-dev@lists.berlios.de
 https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

 !DSPAM:6251,45b7e6db63428126216758!


   
My understanding of the proposed behavior is:
Radio on: led on
Radio off: led off
Activity: flash on-off-on ...

This is the same behavior as my Buffalo WHR-HP-G54 and seems reasonable.

Steve


___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-24 Thread Michael Buesch
On Thursday 25 January 2007 00:16, Steve Brown wrote: 
 My understanding of the proposed behavior is:
 Radio on: led on
 Radio off: led off
 Activity: flash on-off-on ...
 
 This is the same behavior as my Buffalo WHR-HP-G54 and seems reasonable.

That's not what is implemented in larry's patch.
In this patch the activity led does only indicate activity
and not radio status. (Well, it also indicates a the-card-is-up
state, but that's not necessarily indicating that the radio
is switched on).

-- 
Greetings Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-24 Thread Larry Finger
Michael Buesch wrote:
 On Wednesday 24 January 2007 23:59, Jory A. Pratt wrote:
 Michael Buesch wrote:
 On Wednesday 24 January 2007 20:08, Larry Finger wrote:
   
 Michael Buesch wrote:
 
 On Wednesday 24 January 2007 19:39, Larry Finger wrote:
   
  switch (led_index) {
  case 0:
  led-behaviour = BCM43xx_LED_ACTIVITY;
 +led-activelow = 1;
 
 Why activelow?
   
 It makes the light be on when there is no activity and blink off when 
 there is. With that behavior,
 it is a lot easier to see that the switch is on.
 
 Ah, ok.
 It's debatable if that behaviour is desireable.
 I don't like it, but if people want to have it, we can implement it.

   
 I do not think this is what people want. If the radio is off the light
 should just be off, when radio is on turn the light on, is a much more
 desirable.
 
 Well, we are talking about the activity LED, not about the radio on
 LED. There are many cards out there (including ethernet cards) which
 always have the LED on and flash it for activity. So it's not _that_
 wrong to do it.
 Personally, I think it's more intuitive to have a LED off, when there
 is no activity, but hey... .
 It could also save a little bit of power on notebooks, if we leave
 it activehigh. But on the other side, if someone is concerned about
 the LEDs drawing too much current, he can as well completely disable
 the LEDs with the module parameter.

If the LED that shows the radio switch state were different than the one used 
to show activity, then
I would agree with you; however, it is the same one. If we want the light on 
when the switch is on
(and the interface is up) and I think we do, then we need the behavior I coded.

If there were a way to determine if the hardware-enabled bit were determined by 
a switch, then we
could make activelow conditional, but that is not the case. It doesn't matter 
to me as my switch is
a slide, and I always know if the radio is enabled; however, a lot of them are 
momentary switches
that seem to toggle a bit in the hardware. Those people need positive feedback 
that the radio is
enabled. Without the activelow, their light would be on if the radio were off, 
and vice versa. That
would be too much confusion!

Larry


___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: RFC: bcm43xx-d80211: Add radio hardware switch code to mb tree

2007-01-24 Thread Larry Finger
Michael Buesch wrote:
 On Thursday 25 January 2007 00:16, Steve Brown wrote: 
 My understanding of the proposed behavior is:
 Radio on: led on
 Radio off: led off
 Activity: flash on-off-on ...

 This is the same behavior as my Buffalo WHR-HP-G54 and seems reasonable.
 
 That's not what is implemented in larry's patch.
 In this patch the activity led does only indicate activity
 and not radio status. (Well, it also indicates a the-card-is-up
 state, but that's not necessarily indicating that the radio
 is switched on).

Actually, it is what is in my patch. The LED is on if the hardware-enable 
switch is on and the
interface is up.

Larry


___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev