Lines Matching +full:led +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 LED control
7 Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>,
9 Copyright (c) 2005-2007 Michael Buesch <m@bues.ch>
24 struct b43legacy_wl *wl = dev->wl; in b43legacy_led_turn_on()
28 spin_lock_irqsave(&wl->leds_lock, flags); in b43legacy_led_turn_on()
31 ctl &= ~(1 << led_index); in b43legacy_led_turn_on()
33 ctl |= (1 << led_index); in b43legacy_led_turn_on()
35 spin_unlock_irqrestore(&wl->leds_lock, flags); in b43legacy_led_turn_on()
41 struct b43legacy_wl *wl = dev->wl; in b43legacy_led_turn_off()
45 spin_lock_irqsave(&wl->leds_lock, flags); in b43legacy_led_turn_off()
48 ctl |= (1 << led_index); in b43legacy_led_turn_off()
50 ctl &= ~(1 << led_index); in b43legacy_led_turn_off()
52 spin_unlock_irqrestore(&wl->leds_lock, flags); in b43legacy_led_turn_off()
55 /* Callback from the LED subsystem. */
59 struct b43legacy_led *led = container_of(led_dev, struct b43legacy_led, in b43legacy_led_brightness_set() local
61 struct b43legacy_wldev *dev = led->dev; in b43legacy_led_brightness_set()
64 /* Checking the radio-enabled status here is slightly racy, in b43legacy_led_brightness_set()
66 * whether the LED has the wrong state for a second. */ in b43legacy_led_brightness_set()
67 radio_enabled = (dev->phy.radio_on && dev->radio_hw_enable); in b43legacy_led_brightness_set()
70 b43legacy_led_turn_off(dev, led->index, led->activelow); in b43legacy_led_brightness_set()
72 b43legacy_led_turn_on(dev, led->index, led->activelow); in b43legacy_led_brightness_set()
76 struct b43legacy_led *led, in b43legacy_register_led() argument
84 if (led->dev) in b43legacy_register_led()
85 return -EEXIST; in b43legacy_register_led()
87 return -EINVAL; in b43legacy_register_led()
88 led->dev = dev; in b43legacy_register_led()
89 led->index = led_index; in b43legacy_register_led()
90 led->activelow = activelow; in b43legacy_register_led()
91 strlcpy(led->name, name, sizeof(led->name)); in b43legacy_register_led()
93 led->led_dev.name = led->name; in b43legacy_register_led()
94 led->led_dev.default_trigger = default_trigger; in b43legacy_register_led()
95 led->led_dev.brightness_set = b43legacy_led_brightness_set; in b43legacy_register_led()
97 err = led_classdev_register(dev->dev->dev, &led->led_dev); in b43legacy_register_led()
99 b43legacywarn(dev->wl, "LEDs: Failed to register %s\n", name); in b43legacy_register_led()
100 led->dev = NULL; in b43legacy_register_led()
106 static void b43legacy_unregister_led(struct b43legacy_led *led) in b43legacy_unregister_led() argument
108 if (!led->dev) in b43legacy_unregister_led()
110 led_classdev_unregister(&led->led_dev); in b43legacy_unregister_led()
111 b43legacy_led_turn_off(led->dev, led->index, led->activelow); in b43legacy_unregister_led()
112 led->dev = NULL; in b43legacy_unregister_led()
120 struct ieee80211_hw *hw = dev->wl->hw; in b43legacy_map_led()
121 char name[B43legacy_LED_MAX_NAME_LEN + 1]; in b43legacy_map_led()
123 /* Map the b43 specific LED behaviour value to the in b43legacy_map_led()
124 * generic LED triggers. */ in b43legacy_map_led()
138 "b43legacy-%s::tx", wiphy_name(hw->wiphy)); in b43legacy_map_led()
139 b43legacy_register_led(dev, &dev->led_tx, name, in b43legacy_map_led()
143 "b43legacy-%s::rx", wiphy_name(hw->wiphy)); in b43legacy_map_led()
144 b43legacy_register_led(dev, &dev->led_rx, name, in b43legacy_map_led()
153 "b43legacy-%s::radio", wiphy_name(hw->wiphy)); in b43legacy_map_led()
154 b43legacy_register_led(dev, &dev->led_radio, name, in b43legacy_map_led()
157 /* Sync the RF-kill LED state with radio and switch states. */ in b43legacy_map_led()
158 if (dev->phy.radio_on && b43legacy_is_hw_radio_enabled(dev)) in b43legacy_map_led()
164 "b43legacy-%s::assoc", wiphy_name(hw->wiphy)); in b43legacy_map_led()
165 b43legacy_register_led(dev, &dev->led_assoc, name, in b43legacy_map_led()
170 b43legacywarn(dev->wl, "LEDs: Unknown behaviour 0x%02X\n", in b43legacy_map_led()
178 struct ssb_bus *bus = dev->dev->bus; in b43legacy_leds_init()
184 sprom[0] = bus->sprom.gpio0; in b43legacy_leds_init()
185 sprom[1] = bus->sprom.gpio1; in b43legacy_leds_init()
186 sprom[2] = bus->sprom.gpio2; in b43legacy_leds_init()
187 sprom[3] = bus->sprom.gpio3; in b43legacy_leds_init()
191 /* There is no LED information in the SPROM in b43legacy_leds_init()
192 * for this LED. Hardcode it here. */ in b43legacy_leds_init()
198 if (bus->boardinfo.vendor == PCI_VENDOR_ID_COMPAQ) in b43legacy_leds_init()
201 case 1: in b43legacy_leds_init()
203 if (bus->boardinfo.vendor == PCI_VENDOR_ID_ASUSTEK) in b43legacy_leds_init()
213 B43legacy_WARN_ON(1); in b43legacy_leds_init()
226 b43legacy_unregister_led(&dev->led_tx); in b43legacy_leds_exit()
227 b43legacy_unregister_led(&dev->led_rx); in b43legacy_leds_exit()
228 b43legacy_unregister_led(&dev->led_assoc); in b43legacy_leds_exit()
229 b43legacy_unregister_led(&dev->led_radio); in b43legacy_leds_exit()