Lines Matching +full:led +full:- +full:s
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com>
10 Abstract: rt2x00 led specific routines.
21 struct rt2x00_led *led = &rt2x00dev->led_qual; in rt2x00leds_led_quality() local
24 if ((led->type != LED_TYPE_QUALITY) || !(led->flags & LED_REGISTERED)) in rt2x00leds_led_quality()
28 * Led handling requires a positive value for the rssi, in rt2x00leds_led_quality()
31 rssi += rt2x00dev->rssi_offset; in rt2x00leds_led_quality()
35 * to a LED value inside the range LED_OFF - LED_FULL. in rt2x00leds_led_quality()
56 if (brightness != led->led_dev.brightness) { in rt2x00leds_led_quality()
57 led->led_dev.brightness_set(&led->led_dev, brightness); in rt2x00leds_led_quality()
58 led->led_dev.brightness = brightness; in rt2x00leds_led_quality()
62 static void rt2x00led_led_simple(struct rt2x00_led *led, bool enabled) in rt2x00led_led_simple() argument
66 if (!(led->flags & LED_REGISTERED)) in rt2x00led_led_simple()
69 led->led_dev.brightness_set(&led->led_dev, brightness); in rt2x00led_led_simple()
70 led->led_dev.brightness = brightness; in rt2x00led_led_simple()
75 if (rt2x00dev->led_qual.type == LED_TYPE_ACTIVITY) in rt2x00led_led_activity()
76 rt2x00led_led_simple(&rt2x00dev->led_qual, enabled); in rt2x00led_led_activity()
81 if (rt2x00dev->led_assoc.type == LED_TYPE_ASSOC) in rt2x00leds_led_assoc()
82 rt2x00led_led_simple(&rt2x00dev->led_assoc, enabled); in rt2x00leds_led_assoc()
87 if (rt2x00dev->led_radio.type == LED_TYPE_RADIO) in rt2x00leds_led_radio()
88 rt2x00led_led_simple(&rt2x00dev->led_radio, enabled); in rt2x00leds_led_radio()
92 struct rt2x00_led *led, in rt2x00leds_register_led() argument
95 struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); in rt2x00leds_register_led()
98 led->led_dev.name = name; in rt2x00leds_register_led()
99 led->led_dev.brightness = LED_OFF; in rt2x00leds_register_led()
101 retval = led_classdev_register(device, &led->led_dev); in rt2x00leds_register_led()
103 rt2x00_err(rt2x00dev, "Failed to register led handler\n"); in rt2x00leds_register_led()
107 led->flags |= LED_REGISTERED; in rt2x00leds_register_led()
118 const char *phy_name = wiphy_name(rt2x00dev->hw->wiphy); in rt2x00leds_register()
120 if (rt2x00dev->led_radio.flags & LED_INITIALIZED) { in rt2x00leds_register()
121 snprintf(name, sizeof(name), "%s-%s::radio", in rt2x00leds_register()
122 rt2x00dev->ops->name, phy_name); in rt2x00leds_register()
125 &rt2x00dev->led_radio, in rt2x00leds_register()
131 if (rt2x00dev->led_assoc.flags & LED_INITIALIZED) { in rt2x00leds_register()
132 snprintf(name, sizeof(name), "%s-%s::assoc", in rt2x00leds_register()
133 rt2x00dev->ops->name, phy_name); in rt2x00leds_register()
136 &rt2x00dev->led_assoc, in rt2x00leds_register()
142 if (rt2x00dev->led_qual.flags & LED_INITIALIZED) { in rt2x00leds_register()
143 snprintf(name, sizeof(name), "%s-%s::quality", in rt2x00leds_register()
144 rt2x00dev->ops->name, phy_name); in rt2x00leds_register()
147 &rt2x00dev->led_qual, in rt2x00leds_register()
158 if (rt2x00dev->led_radio.led_dev.blink_set) { in rt2x00leds_register()
161 rt2x00dev->led_radio.led_dev.blink_set( in rt2x00leds_register()
162 &rt2x00dev->led_radio.led_dev, &on_period, &off_period); in rt2x00leds_register()
171 static void rt2x00leds_unregister_led(struct rt2x00_led *led) in rt2x00leds_unregister_led() argument
173 led_classdev_unregister(&led->led_dev); in rt2x00leds_unregister_led()
177 * suspended the led is already off, and since we haven't in rt2x00leds_unregister_led()
181 if (!(led->led_dev.flags & LED_SUSPENDED)) in rt2x00leds_unregister_led()
182 led->led_dev.brightness_set(&led->led_dev, LED_OFF); in rt2x00leds_unregister_led()
184 led->flags &= ~LED_REGISTERED; in rt2x00leds_unregister_led()
189 if (rt2x00dev->led_qual.flags & LED_REGISTERED) in rt2x00leds_unregister()
190 rt2x00leds_unregister_led(&rt2x00dev->led_qual); in rt2x00leds_unregister()
191 if (rt2x00dev->led_assoc.flags & LED_REGISTERED) in rt2x00leds_unregister()
192 rt2x00leds_unregister_led(&rt2x00dev->led_assoc); in rt2x00leds_unregister()
193 if (rt2x00dev->led_radio.flags & LED_REGISTERED) in rt2x00leds_unregister()
194 rt2x00leds_unregister_led(&rt2x00dev->led_radio); in rt2x00leds_unregister()
197 static inline void rt2x00leds_suspend_led(struct rt2x00_led *led) in rt2x00leds_suspend_led() argument
199 led_classdev_suspend(&led->led_dev); in rt2x00leds_suspend_led()
202 led->led_dev.brightness_set(&led->led_dev, LED_OFF); in rt2x00leds_suspend_led()
203 led->led_dev.brightness = LED_OFF; in rt2x00leds_suspend_led()
208 if (rt2x00dev->led_qual.flags & LED_REGISTERED) in rt2x00leds_suspend()
209 rt2x00leds_suspend_led(&rt2x00dev->led_qual); in rt2x00leds_suspend()
210 if (rt2x00dev->led_assoc.flags & LED_REGISTERED) in rt2x00leds_suspend()
211 rt2x00leds_suspend_led(&rt2x00dev->led_assoc); in rt2x00leds_suspend()
212 if (rt2x00dev->led_radio.flags & LED_REGISTERED) in rt2x00leds_suspend()
213 rt2x00leds_suspend_led(&rt2x00dev->led_radio); in rt2x00leds_suspend()
216 static inline void rt2x00leds_resume_led(struct rt2x00_led *led) in rt2x00leds_resume_led() argument
218 led_classdev_resume(&led->led_dev); in rt2x00leds_resume_led()
221 led->led_dev.brightness_set(&led->led_dev, LED_OFF); in rt2x00leds_resume_led()
222 led->led_dev.brightness = LED_OFF; in rt2x00leds_resume_led()
227 if (rt2x00dev->led_radio.flags & LED_REGISTERED) in rt2x00leds_resume()
228 rt2x00leds_resume_led(&rt2x00dev->led_radio); in rt2x00leds_resume()
229 if (rt2x00dev->led_assoc.flags & LED_REGISTERED) in rt2x00leds_resume()
230 rt2x00leds_resume_led(&rt2x00dev->led_assoc); in rt2x00leds_resume()
231 if (rt2x00dev->led_qual.flags & LED_REGISTERED) in rt2x00leds_resume()
232 rt2x00leds_resume_led(&rt2x00dev->led_qual); in rt2x00leds_resume()