Lines Matching +full:led +full:- +full:backlight

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Backlight emulation LED trigger
21 struct led_classdev *led; member
33 struct led_classdev *led = n->led; in fb_notifier_callback() local
42 blank = fb_event->data; in fb_notifier_callback()
45 if (new_status == n->old_status) in fb_notifier_callback()
48 if ((n->old_status == UNBLANK) ^ n->invert) { in fb_notifier_callback()
49 n->brightness = led->brightness; in fb_notifier_callback()
50 led_set_brightness_nosleep(led, LED_OFF); in fb_notifier_callback()
52 led_set_brightness_nosleep(led, n->brightness); in fb_notifier_callback()
55 n->old_status = new_status; in fb_notifier_callback()
65 return sprintf(buf, "%u\n", n->invert); in bl_trig_invert_show()
71 struct led_classdev *led = led_trigger_get_led(dev); in bl_trig_invert_store() local
81 return -EINVAL; in bl_trig_invert_store()
83 n->invert = invert; in bl_trig_invert_store()
85 /* After inverting, we need to update the LED. */ in bl_trig_invert_store()
86 if ((n->old_status == BLANK) ^ n->invert) in bl_trig_invert_store()
87 led_set_brightness_nosleep(led, LED_OFF); in bl_trig_invert_store()
89 led_set_brightness_nosleep(led, n->brightness); in bl_trig_invert_store()
101 static int bl_trig_activate(struct led_classdev *led) in bl_trig_activate() argument
109 return -ENOMEM; in bl_trig_activate()
110 led_set_trigger_data(led, n); in bl_trig_activate()
112 n->led = led; in bl_trig_activate()
113 n->brightness = led->brightness; in bl_trig_activate()
114 n->old_status = UNBLANK; in bl_trig_activate()
115 n->notifier.notifier_call = fb_notifier_callback; in bl_trig_activate()
117 ret = fb_register_client(&n->notifier); in bl_trig_activate()
119 dev_err(led->dev, "unable to register backlight trigger\n"); in bl_trig_activate()
124 static void bl_trig_deactivate(struct led_classdev *led) in bl_trig_deactivate() argument
126 struct bl_trig_notifier *n = led_get_trigger_data(led); in bl_trig_deactivate()
128 fb_unregister_client(&n->notifier); in bl_trig_deactivate()
133 .name = "backlight",
141 MODULE_DESCRIPTION("Backlight emulation LED trigger");