diff options
author | Michael Buesch <mb@bu3sch.de> | 2007-09-27 09:31:40 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:54:11 -0400 |
commit | 21954c367e4088c491122edd263964345bc1d3bf (patch) | |
tree | 149faa19794ff6834c56f3af4501fe921880092e /drivers/net/wireless/b43/main.c | |
parent | 20405c08412a4d89357870d7220f9fb1c458b286 (diff) |
[B43]: LED triggers support
Drive the LEDs through the generic LED triggers.
Signed-off-by: Michael Buesch <mb@bu3sch.de>
Cc: 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/b43/main.c')
-rw-r--r-- | drivers/net/wireless/b43/main.c | 51 |
1 files changed, 17 insertions, 34 deletions
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 72467c86f8d4..2b81bd6165d8 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -84,10 +84,6 @@ static int modparam_long_retry = B43_DEFAULT_LONG_RETRY_LIMIT; | |||
84 | module_param_named(long_retry, modparam_long_retry, int, 0444); | 84 | module_param_named(long_retry, modparam_long_retry, int, 0444); |
85 | MODULE_PARM_DESC(long_retry, "Long-Retry-Limit (0 - 15)"); | 85 | MODULE_PARM_DESC(long_retry, "Long-Retry-Limit (0 - 15)"); |
86 | 86 | ||
87 | static int modparam_noleds; | ||
88 | module_param_named(noleds, modparam_noleds, int, 0444); | ||
89 | MODULE_PARM_DESC(noleds, "Turn off all LED activity"); | ||
90 | |||
91 | static char modparam_fwpostfix[16]; | 87 | static char modparam_fwpostfix[16]; |
92 | module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); | 88 | module_param_string(fwpostfix, modparam_fwpostfix, 16, 0444); |
93 | MODULE_PARM_DESC(fwpostfix, "Postfix for the .fw files to load."); | 89 | MODULE_PARM_DESC(fwpostfix, "Postfix for the .fw files to load."); |
@@ -1391,7 +1387,7 @@ static void b43_interrupt_tasklet(struct b43_wldev *dev) | |||
1391 | u32 reason; | 1387 | u32 reason; |
1392 | u32 dma_reason[ARRAY_SIZE(dev->dma_reason)]; | 1388 | u32 dma_reason[ARRAY_SIZE(dev->dma_reason)]; |
1393 | u32 merged_dma_reason = 0; | 1389 | u32 merged_dma_reason = 0; |
1394 | int i, activity = 0; | 1390 | int i; |
1395 | unsigned long flags; | 1391 | unsigned long flags; |
1396 | 1392 | ||
1397 | spin_lock_irqsave(&dev->wl->irq_lock, flags); | 1393 | spin_lock_irqsave(&dev->wl->irq_lock, flags); |
@@ -1444,8 +1440,9 @@ static void b43_interrupt_tasklet(struct b43_wldev *dev) | |||
1444 | handle_irq_beacon(dev); | 1440 | handle_irq_beacon(dev); |
1445 | if (reason & B43_IRQ_PMQ) | 1441 | if (reason & B43_IRQ_PMQ) |
1446 | handle_irq_pmq(dev); | 1442 | handle_irq_pmq(dev); |
1447 | if (reason & B43_IRQ_TXFIFO_FLUSH_OK) ; | 1443 | if (reason & B43_IRQ_TXFIFO_FLUSH_OK) |
1448 | /*TODO*/ if (reason & B43_IRQ_NOISESAMPLE_OK) | 1444 | ;/* TODO */ |
1445 | if (reason & B43_IRQ_NOISESAMPLE_OK) | ||
1449 | handle_irq_noise(dev); | 1446 | handle_irq_noise(dev); |
1450 | 1447 | ||
1451 | /* Check the DMA reason registers for received data. */ | 1448 | /* Check the DMA reason registers for received data. */ |
@@ -1454,7 +1451,6 @@ static void b43_interrupt_tasklet(struct b43_wldev *dev) | |||
1454 | b43_pio_rx(dev->pio.queue0); | 1451 | b43_pio_rx(dev->pio.queue0); |
1455 | else | 1452 | else |
1456 | b43_dma_rx(dev->dma.rx_ring0); | 1453 | b43_dma_rx(dev->dma.rx_ring0); |
1457 | /* We intentionally don't set "activity" to 1, here. */ | ||
1458 | } | 1454 | } |
1459 | B43_WARN_ON(dma_reason[1] & B43_DMAIRQ_RX_DONE); | 1455 | B43_WARN_ON(dma_reason[1] & B43_DMAIRQ_RX_DONE); |
1460 | B43_WARN_ON(dma_reason[2] & B43_DMAIRQ_RX_DONE); | 1456 | B43_WARN_ON(dma_reason[2] & B43_DMAIRQ_RX_DONE); |
@@ -1463,19 +1459,13 @@ static void b43_interrupt_tasklet(struct b43_wldev *dev) | |||
1463 | b43_pio_rx(dev->pio.queue3); | 1459 | b43_pio_rx(dev->pio.queue3); |
1464 | else | 1460 | else |
1465 | b43_dma_rx(dev->dma.rx_ring3); | 1461 | b43_dma_rx(dev->dma.rx_ring3); |
1466 | activity = 1; | ||
1467 | } | 1462 | } |
1468 | B43_WARN_ON(dma_reason[4] & B43_DMAIRQ_RX_DONE); | 1463 | B43_WARN_ON(dma_reason[4] & B43_DMAIRQ_RX_DONE); |
1469 | B43_WARN_ON(dma_reason[5] & B43_DMAIRQ_RX_DONE); | 1464 | B43_WARN_ON(dma_reason[5] & B43_DMAIRQ_RX_DONE); |
1470 | 1465 | ||
1471 | if (reason & B43_IRQ_TX_OK) { | 1466 | if (reason & B43_IRQ_TX_OK) |
1472 | handle_irq_transmit_status(dev); | 1467 | handle_irq_transmit_status(dev); |
1473 | activity = 1; | ||
1474 | //TODO: In AP mode, this also causes sending of powersave responses. | ||
1475 | } | ||
1476 | 1468 | ||
1477 | if (!modparam_noleds) | ||
1478 | b43_leds_update(dev, activity); | ||
1479 | b43_interrupt_enable(dev, dev->irq_savedstate); | 1469 | b43_interrupt_enable(dev, dev->irq_savedstate); |
1480 | mmiowb(); | 1470 | mmiowb(); |
1481 | spin_unlock_irqrestore(&dev->wl->irq_lock, flags); | 1471 | spin_unlock_irqrestore(&dev->wl->irq_lock, flags); |
@@ -1927,7 +1917,6 @@ static int b43_gpio_init(struct b43_wldev *dev) | |||
1927 | b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) | 1917 | b43_write32(dev, B43_MMIO_MACCTL, b43_read32(dev, B43_MMIO_MACCTL) |
1928 | & ~B43_MACCTL_GPOUTSMSK); | 1918 | & ~B43_MACCTL_GPOUTSMSK); |
1929 | 1919 | ||
1930 | b43_leds_switch_all(dev, 0); | ||
1931 | b43_write16(dev, B43_MMIO_GPIO_MASK, b43_read16(dev, B43_MMIO_GPIO_MASK) | 1920 | b43_write16(dev, B43_MMIO_GPIO_MASK, b43_read16(dev, B43_MMIO_GPIO_MASK) |
1932 | | 0x000F); | 1921 | | 0x000F); |
1933 | 1922 | ||
@@ -2173,8 +2162,7 @@ static bool b43_is_hw_radio_enabled(struct b43_wldev *dev) | |||
2173 | static void b43_chip_exit(struct b43_wldev *dev) | 2162 | static void b43_chip_exit(struct b43_wldev *dev) |
2174 | { | 2163 | { |
2175 | b43_radio_turn_off(dev); | 2164 | b43_radio_turn_off(dev); |
2176 | if (!modparam_noleds) | 2165 | b43_leds_exit(dev); |
2177 | b43_leds_exit(dev); | ||
2178 | b43_gpio_cleanup(dev); | 2166 | b43_gpio_cleanup(dev); |
2179 | /* firmware is released later */ | 2167 | /* firmware is released later */ |
2180 | } | 2168 | } |
@@ -2202,9 +2190,11 @@ static int b43_chip_init(struct b43_wldev *dev) | |||
2202 | err = b43_gpio_init(dev); | 2190 | err = b43_gpio_init(dev); |
2203 | if (err) | 2191 | if (err) |
2204 | goto out; /* firmware is released later */ | 2192 | goto out; /* firmware is released later */ |
2193 | b43_leds_init(dev); | ||
2194 | |||
2205 | err = b43_upload_initvals(dev); | 2195 | err = b43_upload_initvals(dev); |
2206 | if (err) | 2196 | if (err) |
2207 | goto err_gpio_cleanup; | 2197 | goto err_leds_exit; |
2208 | b43_radio_turn_on(dev); | 2198 | b43_radio_turn_on(dev); |
2209 | 2199 | ||
2210 | b43_write16(dev, 0x03E6, 0x0000); | 2200 | b43_write16(dev, 0x03E6, 0x0000); |
@@ -2275,14 +2265,15 @@ static int b43_chip_init(struct b43_wldev *dev) | |||
2275 | 2265 | ||
2276 | err = 0; | 2266 | err = 0; |
2277 | b43dbg(dev->wl, "Chip initialized\n"); | 2267 | b43dbg(dev->wl, "Chip initialized\n"); |
2278 | out: | 2268 | out: |
2279 | return err; | 2269 | return err; |
2280 | 2270 | ||
2281 | err_radio_off: | 2271 | err_radio_off: |
2282 | b43_radio_turn_off(dev); | 2272 | b43_radio_turn_off(dev); |
2283 | err_gpio_cleanup: | 2273 | err_leds_exit: |
2274 | b43_leds_exit(dev); | ||
2284 | b43_gpio_cleanup(dev); | 2275 | b43_gpio_cleanup(dev); |
2285 | goto out; | 2276 | return err; |
2286 | } | 2277 | } |
2287 | 2278 | ||
2288 | static void b43_periodic_every120sec(struct b43_wldev *dev) | 2279 | static void b43_periodic_every120sec(struct b43_wldev *dev) |
@@ -2369,7 +2360,6 @@ static void b43_periodic_every1sec(struct b43_wldev *dev) | |||
2369 | dev->radio_hw_enable = radio_hw_enable; | 2360 | dev->radio_hw_enable = radio_hw_enable; |
2370 | b43info(dev->wl, "Radio hardware status changed to %s\n", | 2361 | b43info(dev->wl, "Radio hardware status changed to %s\n", |
2371 | radio_hw_enable ? "ENABLED" : "DISABLED"); | 2362 | radio_hw_enable ? "ENABLED" : "DISABLED"); |
2372 | b43_leds_update(dev, 0); | ||
2373 | } | 2363 | } |
2374 | } | 2364 | } |
2375 | 2365 | ||
@@ -3767,18 +3757,13 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
3767 | } else | 3757 | } else |
3768 | have_bphy = 1; | 3758 | have_bphy = 1; |
3769 | 3759 | ||
3770 | /* Initialize LEDs structs. */ | ||
3771 | err = b43_leds_init(dev); | ||
3772 | if (err) | ||
3773 | goto err_powerdown; | ||
3774 | |||
3775 | dev->phy.gmode = (have_gphy || have_bphy); | 3760 | dev->phy.gmode = (have_gphy || have_bphy); |
3776 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; | 3761 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; |
3777 | b43_wireless_core_reset(dev, tmp); | 3762 | b43_wireless_core_reset(dev, tmp); |
3778 | 3763 | ||
3779 | err = b43_phy_versioning(dev); | 3764 | err = b43_phy_versioning(dev); |
3780 | if (err) | 3765 | if (err) |
3781 | goto err_leds_exit; | 3766 | goto err_powerdown; |
3782 | /* Check if this device supports multiband. */ | 3767 | /* Check if this device supports multiband. */ |
3783 | if (!pdev || | 3768 | if (!pdev || |
3784 | (pdev->device != 0x4312 && | 3769 | (pdev->device != 0x4312 && |
@@ -3807,10 +3792,10 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
3807 | 3792 | ||
3808 | err = b43_validate_chipaccess(dev); | 3793 | err = b43_validate_chipaccess(dev); |
3809 | if (err) | 3794 | if (err) |
3810 | goto err_leds_exit; | 3795 | goto err_powerdown; |
3811 | err = b43_setup_modes(dev, have_aphy, have_bphy, have_gphy); | 3796 | err = b43_setup_modes(dev, have_aphy, have_bphy, have_gphy); |
3812 | if (err) | 3797 | if (err) |
3813 | goto err_leds_exit; | 3798 | goto err_powerdown; |
3814 | 3799 | ||
3815 | /* Now set some default "current_dev" */ | 3800 | /* Now set some default "current_dev" */ |
3816 | if (!wl->current_dev) | 3801 | if (!wl->current_dev) |
@@ -3825,8 +3810,6 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
3825 | out: | 3810 | out: |
3826 | return err; | 3811 | return err; |
3827 | 3812 | ||
3828 | err_leds_exit: | ||
3829 | b43_leds_exit(dev); | ||
3830 | err_powerdown: | 3813 | err_powerdown: |
3831 | ssb_bus_may_powerdown(bus); | 3814 | ssb_bus_may_powerdown(bus); |
3832 | return err; | 3815 | return err; |