diff options
author | Larry Finger <Larry.Finger@lwfinger.net> | 2007-10-10 23:48:17 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:03:27 -0500 |
commit | 6be50837e303c53b1e5a0138dfed132ccbabcdad (patch) | |
tree | 5664873c9ab28c798e7044adf25e4e6e34da755d /drivers/net/wireless/b43legacy/main.c | |
parent | 93bb7f3a7bb5c95da10242d9763994a466c90b1d (diff) |
b43legacy: Use input-polldev for the rfkill switch
This removes the direct call to rfkill on an rfkill event
and replaces it with an input device. This way userspace is also
notified about the event.
This patch is the port to b43legacy of a patch for b43 by Michael Buesch
<mb@bu3sch.de>.
Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43legacy/main.c')
-rw-r--r-- | drivers/net/wireless/b43legacy/main.c | 49 |
1 files changed, 10 insertions, 39 deletions
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index 04bc3f6c5e63..069abe5fb8ee 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -1975,21 +1975,6 @@ static void b43legacy_mgmtframe_txantenna(struct b43legacy_wldev *dev, | |||
1975 | B43legacy_SHM_SH_PRPHYCTL, tmp); | 1975 | B43legacy_SHM_SH_PRPHYCTL, tmp); |
1976 | } | 1976 | } |
1977 | 1977 | ||
1978 | /* Returns TRUE, if the radio is enabled in hardware. */ | ||
1979 | static bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev) | ||
1980 | { | ||
1981 | if (dev->phy.rev >= 3) { | ||
1982 | if (!(b43legacy_read32(dev, B43legacy_MMIO_RADIO_HWENABLED_HI) | ||
1983 | & B43legacy_MMIO_RADIO_HWENABLED_HI_MASK)) | ||
1984 | return 1; | ||
1985 | } else { | ||
1986 | if (b43legacy_read16(dev, B43legacy_MMIO_RADIO_HWENABLED_LO) | ||
1987 | & B43legacy_MMIO_RADIO_HWENABLED_LO_MASK) | ||
1988 | return 1; | ||
1989 | } | ||
1990 | return 0; | ||
1991 | } | ||
1992 | |||
1993 | /* This is the opposite of b43legacy_chip_init() */ | 1978 | /* This is the opposite of b43legacy_chip_init() */ |
1994 | static void b43legacy_chip_exit(struct b43legacy_wldev *dev) | 1979 | static void b43legacy_chip_exit(struct b43legacy_wldev *dev) |
1995 | { | 1980 | { |
@@ -2146,32 +2131,18 @@ static void b43legacy_periodic_every15sec(struct b43legacy_wldev *dev) | |||
2146 | b43legacy_phy_xmitpower(dev); /* FIXME: unless scanning? */ | 2131 | b43legacy_phy_xmitpower(dev); /* FIXME: unless scanning? */ |
2147 | } | 2132 | } |
2148 | 2133 | ||
2149 | static void b43legacy_periodic_every1sec(struct b43legacy_wldev *dev) | ||
2150 | { | ||
2151 | bool radio_hw_enable; | ||
2152 | |||
2153 | /* check if radio hardware enabled status changed */ | ||
2154 | radio_hw_enable = b43legacy_is_hw_radio_enabled(dev); | ||
2155 | if (unlikely(dev->radio_hw_enable != radio_hw_enable)) { | ||
2156 | dev->radio_hw_enable = radio_hw_enable; | ||
2157 | b43legacy_rfkill_toggled(dev, radio_hw_enable); | ||
2158 | } | ||
2159 | } | ||
2160 | |||
2161 | static void do_periodic_work(struct b43legacy_wldev *dev) | 2134 | static void do_periodic_work(struct b43legacy_wldev *dev) |
2162 | { | 2135 | { |
2163 | unsigned int state; | 2136 | unsigned int state; |
2164 | 2137 | ||
2165 | state = dev->periodic_state; | 2138 | state = dev->periodic_state; |
2166 | if (state % 120 == 0) | 2139 | if (state % 8 == 0) |
2167 | b43legacy_periodic_every120sec(dev); | 2140 | b43legacy_periodic_every120sec(dev); |
2168 | if (state % 60 == 0) | 2141 | if (state % 4 == 0) |
2169 | b43legacy_periodic_every60sec(dev); | 2142 | b43legacy_periodic_every60sec(dev); |
2170 | if (state % 30 == 0) | 2143 | if (state % 2 == 0) |
2171 | b43legacy_periodic_every30sec(dev); | 2144 | b43legacy_periodic_every30sec(dev); |
2172 | if (state % 15 == 0) | 2145 | b43legacy_periodic_every15sec(dev); |
2173 | b43legacy_periodic_every15sec(dev); | ||
2174 | b43legacy_periodic_every1sec(dev); | ||
2175 | } | 2146 | } |
2176 | 2147 | ||
2177 | /* Estimate a "Badness" value based on the periodic work | 2148 | /* Estimate a "Badness" value based on the periodic work |
@@ -2182,13 +2153,11 @@ static int estimate_periodic_work_badness(unsigned int state) | |||
2182 | { | 2153 | { |
2183 | int badness = 0; | 2154 | int badness = 0; |
2184 | 2155 | ||
2185 | if (state % 120 == 0) /* every 120 sec */ | 2156 | if (state % 8 == 0) /* every 120 sec */ |
2186 | badness += 10; | 2157 | badness += 10; |
2187 | if (state % 60 == 0) /* every 60 sec */ | 2158 | if (state % 4 == 0) /* every 60 sec */ |
2188 | badness += 5; | 2159 | badness += 5; |
2189 | if (state % 30 == 0) /* every 30 sec */ | 2160 | if (state % 2 == 0) /* every 30 sec */ |
2190 | badness += 1; | ||
2191 | if (state % 15 == 0) /* every 15 sec */ | ||
2192 | badness += 1; | 2161 | badness += 1; |
2193 | 2162 | ||
2194 | #define BADNESS_LIMIT 4 | 2163 | #define BADNESS_LIMIT 4 |
@@ -2246,7 +2215,7 @@ out_requeue: | |||
2246 | if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST)) | 2215 | if (b43legacy_debug(dev, B43legacy_DBG_PWORK_FAST)) |
2247 | delay = msecs_to_jiffies(50); | 2216 | delay = msecs_to_jiffies(50); |
2248 | else | 2217 | else |
2249 | delay = round_jiffies_relative(HZ); | 2218 | delay = round_jiffies_relative(HZ * 15); |
2250 | queue_delayed_work(dev->wl->hw->workqueue, | 2219 | queue_delayed_work(dev->wl->hw->workqueue, |
2251 | &dev->periodic_work, delay); | 2220 | &dev->periodic_work, delay); |
2252 | out: | 2221 | out: |
@@ -3449,6 +3418,7 @@ static int b43legacy_setup_modes(struct b43legacy_wldev *dev, | |||
3449 | 3418 | ||
3450 | static void b43legacy_wireless_core_detach(struct b43legacy_wldev *dev) | 3419 | static void b43legacy_wireless_core_detach(struct b43legacy_wldev *dev) |
3451 | { | 3420 | { |
3421 | b43legacy_rfkill_free(dev); | ||
3452 | /* We release firmware that late to not be required to re-request | 3422 | /* We release firmware that late to not be required to re-request |
3453 | * is all the time when we reinit the core. */ | 3423 | * is all the time when we reinit the core. */ |
3454 | b43legacy_release_firmware(dev); | 3424 | b43legacy_release_firmware(dev); |
@@ -3530,6 +3500,7 @@ static int b43legacy_wireless_core_attach(struct b43legacy_wldev *dev) | |||
3530 | if (!wl->current_dev) | 3500 | if (!wl->current_dev) |
3531 | wl->current_dev = dev; | 3501 | wl->current_dev = dev; |
3532 | INIT_WORK(&dev->restart_work, b43legacy_chip_reset); | 3502 | INIT_WORK(&dev->restart_work, b43legacy_chip_reset); |
3503 | b43legacy_rfkill_alloc(dev); | ||
3533 | 3504 | ||
3534 | b43legacy_radio_turn_off(dev, 1); | 3505 | b43legacy_radio_turn_off(dev, 1); |
3535 | b43legacy_switch_analog(dev, 0); | 3506 | b43legacy_switch_analog(dev, 0); |