rt2x00: Add link tuner safe RX toggle states
authorIvo van Doorn <ivdoorn@gmail.com>
Mon, 25 Feb 2008 22:15:05 +0000 (23:15 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Thu, 28 Feb 2008 14:13:09 +0000 (09:13 -0500)
This adds 2 new states which both are used to toggle
the RX. These new states are required for usage
inside the link tuner thread, because the normal
RX toggling will stop the link tuner thread.
While it is possible that the link tuner thread itself
is the caller of the RX toggle (when using software
antenna diversity).

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2x00config.c
drivers/net/wireless/rt2x00/rt2x00reg.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index d6cba138c7ab7723cd5b039c18ebb6e5e9ce4010..c69f85ed766917e728fed93f4092e37d6bdca1cd 100644 (file)
@@ -960,8 +960,12 @@ static int rt2400pci_set_device_state(struct rt2x00_dev *rt2x00dev,
                rt2400pci_disable_radio(rt2x00dev);
                break;
        case STATE_RADIO_RX_ON:
+       case STATE_RADIO_RX_ON_LINK:
+               rt2400pci_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
+               break;
        case STATE_RADIO_RX_OFF:
-               rt2400pci_toggle_rx(rt2x00dev, state);
+       case STATE_RADIO_RX_OFF_LINK:
+               rt2400pci_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
                break;
        case STATE_DEEP_SLEEP:
        case STATE_SLEEP:
index e874fdcae20450d015cea1fd23fa8dc3d03a1cd1..91e87b53374f3f7138bea4c01764545ec07c0117 100644 (file)
@@ -1112,8 +1112,12 @@ static int rt2500pci_set_device_state(struct rt2x00_dev *rt2x00dev,
                rt2500pci_disable_radio(rt2x00dev);
                break;
        case STATE_RADIO_RX_ON:
+       case STATE_RADIO_RX_ON_LINK:
+               rt2500pci_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
+               break;
        case STATE_RADIO_RX_OFF:
-               rt2500pci_toggle_rx(rt2x00dev, state);
+       case STATE_RADIO_RX_OFF_LINK:
+               rt2500pci_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
                break;
        case STATE_DEEP_SLEEP:
        case STATE_SLEEP:
index 4ca9730e5e92f360074e4b08b5b2e05f50460ec9..638c3d243108c5eb1bfdcdae6f4bb664b654702a 100644 (file)
@@ -1001,8 +1001,12 @@ static int rt2500usb_set_device_state(struct rt2x00_dev *rt2x00dev,
                rt2500usb_disable_radio(rt2x00dev);
                break;
        case STATE_RADIO_RX_ON:
+       case STATE_RADIO_RX_ON_LINK:
+               rt2500usb_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
+               break;
        case STATE_RADIO_RX_OFF:
-               rt2500usb_toggle_rx(rt2x00dev, state);
+       case STATE_RADIO_RX_OFF_LINK:
+               rt2500usb_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
                break;
        case STATE_DEEP_SLEEP:
        case STATE_SLEEP:
index 72cfe00c1ed7385834e2574fe1e24349785d7dd2..0d57d7f67837d9ab67c2224f0ab69d8ed514d40d 100644 (file)
@@ -102,7 +102,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
         * else the changes will be ignored by the device.
         */
        if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
-               rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
+               rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF_LINK);
 
        /*
         * Write new antenna setup to device and reset the link tuner.
@@ -116,7 +116,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
        rt2x00dev->link.ant.active.tx = libconf.ant.tx;
 
        if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
-               rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
+               rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK);
 }
 
 void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
index 838421216da0d52a0d7aedd0f78ec56a09ec9756..b1915dc7dda18e25f48e19b84f5d4c84c3c49152 100644 (file)
@@ -85,6 +85,8 @@ enum dev_state {
        STATE_RADIO_OFF,
        STATE_RADIO_RX_ON,
        STATE_RADIO_RX_OFF,
+       STATE_RADIO_RX_ON_LINK,
+       STATE_RADIO_RX_OFF_LINK,
        STATE_RADIO_IRQ_ON,
        STATE_RADIO_IRQ_OFF,
 };
index b31f0c26c32b7bb889ba789a562aeb7ae3f889ba..e808db98f2f57b09c3815fb7cb07be91386b09eb 100644 (file)
@@ -1482,8 +1482,12 @@ static int rt61pci_set_device_state(struct rt2x00_dev *rt2x00dev,
                rt61pci_disable_radio(rt2x00dev);
                break;
        case STATE_RADIO_RX_ON:
+       case STATE_RADIO_RX_ON_LINK:
+               rt61pci_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
+               break;
        case STATE_RADIO_RX_OFF:
-               rt61pci_toggle_rx(rt2x00dev, state);
+       case STATE_RADIO_RX_OFF_LINK:
+               rt61pci_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
                break;
        case STATE_DEEP_SLEEP:
        case STATE_SLEEP:
index 4d576ab3e7f984f503608696d2112eb7d1793f54..4fac2d414d845401067120dbe72ea3af9a13f9c8 100644 (file)
@@ -1208,8 +1208,12 @@ static int rt73usb_set_device_state(struct rt2x00_dev *rt2x00dev,
                rt73usb_disable_radio(rt2x00dev);
                break;
        case STATE_RADIO_RX_ON:
+       case STATE_RADIO_RX_ON_LINK:
+               rt73usb_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON);
+               break;
        case STATE_RADIO_RX_OFF:
-               rt73usb_toggle_rx(rt2x00dev, state);
+       case STATE_RADIO_RX_OFF_LINK:
+               rt73usb_toggle_rx(rt2x00dev, STATE_RADIO_RX_OFF);
                break;
        case STATE_DEEP_SLEEP:
        case STATE_SLEEP: