• Home
  • Raw
  • Download

Lines Matching full:data

57 static int system76_get(struct system76_data *data, char *method)  in system76_get()  argument
63 handle = acpi_device_handle(data->acpi_dev); in system76_get()
72 static int system76_set(struct system76_data *data, char *method, int value) in system76_set() argument
83 handle = acpi_device_handle(data->acpi_dev); in system76_set()
94 struct system76_data *data; in ap_led_get() local
97 data = container_of(led, struct system76_data, ap_led); in ap_led_get()
98 value = system76_get(data, "GAPL"); in ap_led_get()
108 struct system76_data *data; in ap_led_set() local
110 data = container_of(led, struct system76_data, ap_led); in ap_led_set()
111 return system76_set(data, "SAPL", value == LED_OFF ? 0 : 1); in ap_led_set()
117 struct system76_data *data; in kb_led_get() local
119 data = container_of(led, struct system76_data, kb_led); in kb_led_get()
120 return data->kb_brightness; in kb_led_get()
126 struct system76_data *data; in kb_led_set() local
128 data = container_of(led, struct system76_data, kb_led); in kb_led_set()
129 data->kb_brightness = value; in kb_led_set()
130 return system76_set(data, "SKBL", (int)data->kb_brightness); in kb_led_set()
140 struct system76_data *data; in kb_led_color_show() local
143 data = container_of(led, struct system76_data, kb_led); in kb_led_color_show()
144 return sprintf(buf, "%06X\n", data->kb_color); in kb_led_color_show()
155 struct system76_data *data; in kb_led_color_store() local
160 data = container_of(led, struct system76_data, kb_led); in kb_led_color_store()
166 data->kb_color = (int)val; in kb_led_color_store()
167 system76_set(data, "SKBC", data->kb_color); in kb_led_color_store()
182 static void kb_led_notify(struct system76_data *data) in kb_led_notify() argument
185 &data->kb_led, in kb_led_notify()
186 data->kb_brightness in kb_led_notify()
191 static void kb_led_hotkey_hardware(struct system76_data *data) in kb_led_hotkey_hardware() argument
195 value = system76_get(data, "GKBL"); in kb_led_hotkey_hardware()
198 data->kb_brightness = value; in kb_led_hotkey_hardware()
199 kb_led_notify(data); in kb_led_hotkey_hardware()
203 static void kb_led_hotkey_toggle(struct system76_data *data) in kb_led_hotkey_toggle() argument
205 if (data->kb_brightness > 0) { in kb_led_hotkey_toggle()
206 data->kb_toggle_brightness = data->kb_brightness; in kb_led_hotkey_toggle()
207 kb_led_set(&data->kb_led, 0); in kb_led_hotkey_toggle()
209 kb_led_set(&data->kb_led, data->kb_toggle_brightness); in kb_led_hotkey_toggle()
211 kb_led_notify(data); in kb_led_hotkey_toggle()
215 static void kb_led_hotkey_down(struct system76_data *data) in kb_led_hotkey_down() argument
219 if (data->kb_brightness > 0) { in kb_led_hotkey_down()
221 if (kb_levels[i - 1] < data->kb_brightness) { in kb_led_hotkey_down()
222 kb_led_set(&data->kb_led, kb_levels[i - 1]); in kb_led_hotkey_down()
227 kb_led_set(&data->kb_led, data->kb_toggle_brightness); in kb_led_hotkey_down()
229 kb_led_notify(data); in kb_led_hotkey_down()
233 static void kb_led_hotkey_up(struct system76_data *data) in kb_led_hotkey_up() argument
237 if (data->kb_brightness > 0) { in kb_led_hotkey_up()
239 if (kb_levels[i] > data->kb_brightness) { in kb_led_hotkey_up()
240 kb_led_set(&data->kb_led, kb_levels[i]); in kb_led_hotkey_up()
245 kb_led_set(&data->kb_led, data->kb_toggle_brightness); in kb_led_hotkey_up()
247 kb_led_notify(data); in kb_led_hotkey_up()
251 static void kb_led_hotkey_color(struct system76_data *data) in kb_led_hotkey_color() argument
255 if (data->kb_color < 0) in kb_led_hotkey_color()
257 if (data->kb_brightness > 0) { in kb_led_hotkey_color()
259 if (kb_colors[i] == data->kb_color) in kb_led_hotkey_color()
265 data->kb_color = kb_colors[i]; in kb_led_hotkey_color()
266 system76_set(data, "SKBC", data->kb_color); in kb_led_hotkey_color()
268 kb_led_set(&data->kb_led, data->kb_toggle_brightness); in kb_led_hotkey_color()
270 kb_led_notify(data); in kb_led_hotkey_color()
276 struct system76_data *data; in system76_notify() local
278 data = acpi_driver_data(acpi_dev); in system76_notify()
281 kb_led_hotkey_hardware(data); in system76_notify()
284 kb_led_hotkey_toggle(data); in system76_notify()
287 kb_led_hotkey_down(data); in system76_notify()
290 kb_led_hotkey_up(data); in system76_notify()
293 kb_led_hotkey_color(data); in system76_notify()
301 struct system76_data *data; in system76_add() local
304 data = devm_kzalloc(&acpi_dev->dev, sizeof(*data), GFP_KERNEL); in system76_add()
305 if (!data) in system76_add()
307 acpi_dev->driver_data = data; in system76_add()
308 data->acpi_dev = acpi_dev; in system76_add()
310 err = system76_get(data, "INIT"); in system76_add()
313 data->ap_led.name = "system76_acpi::airplane"; in system76_add()
314 data->ap_led.flags = LED_CORE_SUSPENDRESUME; in system76_add()
315 data->ap_led.brightness_get = ap_led_get; in system76_add()
316 data->ap_led.brightness_set_blocking = ap_led_set; in system76_add()
317 data->ap_led.max_brightness = 1; in system76_add()
318 data->ap_led.default_trigger = "rfkill-none"; in system76_add()
319 err = devm_led_classdev_register(&acpi_dev->dev, &data->ap_led); in system76_add()
323 data->kb_led.name = "system76_acpi::kbd_backlight"; in system76_add()
324 data->kb_led.flags = LED_BRIGHT_HW_CHANGED | LED_CORE_SUSPENDRESUME; in system76_add()
325 data->kb_led.brightness_get = kb_led_get; in system76_add()
326 data->kb_led.brightness_set_blocking = kb_led_set; in system76_add()
327 if (acpi_has_method(acpi_device_handle(data->acpi_dev), "SKBC")) { in system76_add()
328 data->kb_led.max_brightness = 255; in system76_add()
329 data->kb_toggle_brightness = 72; in system76_add()
330 data->kb_color = 0xffffff; in system76_add()
331 system76_set(data, "SKBC", data->kb_color); in system76_add()
333 data->kb_led.max_brightness = 5; in system76_add()
334 data->kb_color = -1; in system76_add()
336 err = devm_led_classdev_register(&acpi_dev->dev, &data->kb_led); in system76_add()
340 if (data->kb_color >= 0) { in system76_add()
342 data->kb_led.dev, in system76_add()
355 struct system76_data *data; in system76_remove() local
357 data = acpi_driver_data(acpi_dev); in system76_remove()
358 if (data->kb_color >= 0) in system76_remove()
359 device_remove_file(data->kb_led.dev, &kb_led_color_dev_attr); in system76_remove()
361 devm_led_classdev_unregister(&acpi_dev->dev, &data->ap_led); in system76_remove()
363 devm_led_classdev_unregister(&acpi_dev->dev, &data->kb_led); in system76_remove()
365 system76_get(data, "FINI"); in system76_remove()