aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43legacy/radio.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2007-09-20 22:11:02 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:52:25 -0400
commit42a9174f541d2338d35b91869415d9ae9312ca0d (patch)
tree34e35b54b63764a39c7e087d184b1e0fca1a9c5f /drivers/net/wireless/b43legacy/radio.c
parentfda9abcf1a5b6b78a4ead25729583541af9876b5 (diff)
[B43LEGACY]: Support for turning the radio off from software.
This adds support for turning the radio off in software. That's useful in environments, where you don't want the RF to radiate any signals, but don't want to bring the interface down. This patch is based on a similar patch of b43 by Michael Buesch. Signed-off-by: Larry Finger <larry.finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/wireless/b43legacy/radio.c')
-rw-r--r--drivers/net/wireless/b43legacy/radio.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/drivers/net/wireless/b43legacy/radio.c b/drivers/net/wireless/b43legacy/radio.c
index 2a11ee63f400..54067f082825 100644
--- a/drivers/net/wireless/b43legacy/radio.c
+++ b/drivers/net/wireless/b43legacy/radio.c
@@ -1767,6 +1767,17 @@ int b43legacy_radio_selectchannel(struct b43legacy_wldev *dev,
1767{ 1767{
1768 struct b43legacy_phy *phy = &dev->phy; 1768 struct b43legacy_phy *phy = &dev->phy;
1769 1769
1770 if (channel == 0xFF) {
1771 switch (phy->type) {
1772 case B43legacy_PHYTYPE_B:
1773 case B43legacy_PHYTYPE_G:
1774 channel = B43legacy_RADIO_DEFAULT_CHANNEL_BG;
1775 break;
1776 default:
1777 B43legacy_WARN_ON(1);
1778 }
1779 }
1780
1770/* TODO: Check if channel is valid - return -EINVAL if not */ 1781/* TODO: Check if channel is valid - return -EINVAL if not */
1771 if (synthetic_pu_workaround) 1782 if (synthetic_pu_workaround)
1772 b43legacy_synth_pu_workaround(dev, channel); 1783 b43legacy_synth_pu_workaround(dev, channel);
@@ -2070,6 +2081,7 @@ void b43legacy_radio_turn_on(struct b43legacy_wldev *dev)
2070{ 2081{
2071 struct b43legacy_phy *phy = &dev->phy; 2082 struct b43legacy_phy *phy = &dev->phy;
2072 int err; 2083 int err;
2084 u8 channel;
2073 2085
2074 might_sleep(); 2086 might_sleep();
2075 2087
@@ -2083,15 +2095,24 @@ void b43legacy_radio_turn_on(struct b43legacy_wldev *dev)
2083 b43legacy_phy_write(dev, 0x0015, 0xCC00); 2095 b43legacy_phy_write(dev, 0x0015, 0xCC00);
2084 b43legacy_phy_write(dev, 0x0015, 2096 b43legacy_phy_write(dev, 0x0015,
2085 (phy->gmode ? 0x00C0 : 0x0000)); 2097 (phy->gmode ? 0x00C0 : 0x0000));
2098 if (phy->radio_off_context.valid) {
2099 /* Restore the RFover values. */
2100 b43legacy_phy_write(dev, B43legacy_PHY_RFOVER,
2101 phy->radio_off_context.rfover);
2102 b43legacy_phy_write(dev, B43legacy_PHY_RFOVERVAL,
2103 phy->radio_off_context.rfoverval);
2104 phy->radio_off_context.valid = 0;
2105 }
2106 channel = phy->channel;
2086 err = b43legacy_radio_selectchannel(dev, 2107 err = b43legacy_radio_selectchannel(dev,
2087 B43legacy_RADIO_DEFAULT_CHANNEL_BG, 1); 2108 B43legacy_RADIO_DEFAULT_CHANNEL_BG, 1);
2088 B43legacy_WARN_ON(err != 0); 2109 err |= b43legacy_radio_selectchannel(dev, channel, 0);
2110 B43legacy_WARN_ON(err);
2089 break; 2111 break;
2090 default: 2112 default:
2091 B43legacy_BUG_ON(1); 2113 B43legacy_BUG_ON(1);
2092 } 2114 }
2093 phy->radio_on = 1; 2115 phy->radio_on = 1;
2094 b43legacydbg(dev->wl, "Radio turned on\n");
2095 b43legacy_leds_update(dev, 0); 2116 b43legacy_leds_update(dev, 0);
2096} 2117}
2097 2118
@@ -2100,10 +2121,16 @@ void b43legacy_radio_turn_off(struct b43legacy_wldev *dev)
2100 struct b43legacy_phy *phy = &dev->phy; 2121 struct b43legacy_phy *phy = &dev->phy;
2101 2122
2102 if (phy->type == B43legacy_PHYTYPE_G && dev->dev->id.revision >= 5) { 2123 if (phy->type == B43legacy_PHYTYPE_G && dev->dev->id.revision >= 5) {
2103 b43legacy_phy_write(dev, 0x0811, b43legacy_phy_read(dev, 0x0811) 2124 u16 rfover, rfoverval;
2104 | 0x008C); 2125
2105 b43legacy_phy_write(dev, 0x0812, b43legacy_phy_read(dev, 0x0812) 2126 rfover = b43legacy_phy_read(dev, B43legacy_PHY_RFOVER);
2106 & 0xFF73); 2127 rfoverval = b43legacy_phy_read(dev, B43legacy_PHY_RFOVERVAL);
2128 phy->radio_off_context.rfover = rfover;
2129 phy->radio_off_context.rfoverval = rfoverval;
2130 phy->radio_off_context.valid = 1;
2131 b43legacy_phy_write(dev, B43legacy_PHY_RFOVER, rfover | 0x008C);
2132 b43legacy_phy_write(dev, B43legacy_PHY_RFOVERVAL,
2133 rfoverval & 0xFF73);
2107 } else 2134 } else
2108 b43legacy_phy_write(dev, 0x0015, 0xAA00); 2135 b43legacy_phy_write(dev, 0x0015, 0xAA00);
2109 phy->radio_on = 0; 2136 phy->radio_on = 0;