44 ctl &= ~(1 << led_index);
46 ctl |= (1 << led_index);
48 spin_unlock_irqrestore(&wl->
leds_lock, flags);
61 ctl |= (1 << led_index);
63 ctl &= ~(1 << led_index);
65 spin_unlock_irqrestore(&wl->
leds_lock, flags);
69 static void b43legacy_led_brightness_set(
struct led_classdev *led_dev,
82 if (brightness ==
LED_OFF || !radio_enabled)
83 b43legacy_led_turn_off(dev, led->index, led->activelow);
85 b43legacy_led_turn_on(dev, led->index, led->activelow);
91 const char *default_trigger,
92 u8 led_index,
bool activelow)
96 b43legacy_led_turn_off(dev, led_index, activelow);
102 led->index = led_index;
103 led->activelow = activelow;
104 strncpy(led->name, name,
sizeof(led->name));
106 led->led_dev.name = led->name;
107 led->led_dev.default_trigger = default_trigger;
108 led->led_dev.brightness_set = b43legacy_led_brightness_set;
119 static void b43legacy_unregister_led(
struct b43legacy_led *led)
124 b43legacy_led_turn_off(led->dev, led->index, led->activelow);
130 enum b43legacy_led_behaviour behaviour,
134 char name[B43legacy_LED_MAX_NAME_LEN + 1];
139 case B43legacy_LED_INACTIVE:
141 case B43legacy_LED_OFF:
142 b43legacy_led_turn_off(dev, led_index, activelow);
144 case B43legacy_LED_ON:
145 b43legacy_led_turn_on(dev, led_index, activelow);
147 case B43legacy_LED_ACTIVITY:
148 case B43legacy_LED_TRANSFER:
149 case B43legacy_LED_APTRANSFER:
151 "b43legacy-%s::tx", wiphy_name(hw->
wiphy));
152 b43legacy_register_led(dev, &dev->
led_tx, name,
153 ieee80211_get_tx_led_name(hw),
154 led_index, activelow);
156 "b43legacy-%s::rx", wiphy_name(hw->
wiphy));
157 b43legacy_register_led(dev, &dev->
led_rx, name,
158 ieee80211_get_rx_led_name(hw),
159 led_index, activelow);
161 case B43legacy_LED_RADIO_ALL:
162 case B43legacy_LED_RADIO_A:
163 case B43legacy_LED_RADIO_B:
164 case B43legacy_LED_MODE_BG:
166 "b43legacy-%s::radio", wiphy_name(hw->
wiphy));
167 b43legacy_register_led(dev, &dev->
led_radio, name,
168 ieee80211_get_radio_led_name(hw),
169 led_index, activelow);
172 b43legacy_led_turn_on(dev, led_index, activelow);
174 case B43legacy_LED_WEIRD:
175 case B43legacy_LED_ASSOC:
177 "b43legacy-%s::assoc", wiphy_name(hw->
wiphy));
178 b43legacy_register_led(dev, &dev->
led_assoc, name,
179 ieee80211_get_assoc_led_name(hw),
180 led_index, activelow);
194 enum b43legacy_led_behaviour behaviour;
197 sprom[0] = bus->
sprom.gpio0;
198 sprom[1] = bus->
sprom.gpio1;
199 sprom[2] = bus->
sprom.gpio2;
200 sprom[3] = bus->
sprom.gpio3;
202 for (i = 0; i < 4; i++) {
203 if (sprom[i] == 0xFF) {
209 behaviour = B43legacy_LED_ACTIVITY;
212 behaviour = B43legacy_LED_RADIO_ALL;
215 behaviour = B43legacy_LED_RADIO_B;
217 behaviour = B43legacy_LED_ASSOC;
220 behaviour = B43legacy_LED_RADIO_A;
223 behaviour = B43legacy_LED_OFF;
230 behaviour = sprom[
i] & B43legacy_LED_BEHAVIOUR;
231 activelow = !!(sprom[
i] & B43legacy_LED_ACTIVELOW);
233 b43legacy_map_led(dev, i, behaviour, activelow);
239 b43legacy_unregister_led(&dev->
led_tx);
240 b43legacy_unregister_led(&dev->
led_rx);
241 b43legacy_unregister_led(&dev->
led_assoc);
242 b43legacy_unregister_led(&dev->
led_radio);