Lines Matching +full:activate +full:- +full:to +full:- +full:activate

1 // SPDX-License-Identifier: GPL-2.0
5 // Transient trigger allows one shot timer activation. Please refer to
6 // Documentation/leds/ledtrig-transient.rst for details
9 // Based on Richard Purdie's ledtrig-timer.c and Atsushi Nemoto's
10 // ledtrig-heartbeat.c
11 // Design and use-case input from Jonas Bonn <jonas@southpole.se> and
24 int activate; member
36 struct led_classdev *led_cdev = transient_data->led_cdev; in transient_timer_function()
38 transient_data->activate = 0; in transient_timer_function()
39 led_set_brightness_nosleep(led_cdev, transient_data->restore_state); in transient_timer_function()
48 return sprintf(buf, "%d\n", transient_data->activate); in transient_activate_show()
65 return -EINVAL; in transient_activate_store()
68 if (state == 0 && transient_data->activate == 1) { in transient_activate_store()
69 del_timer(&transient_data->timer); in transient_activate_store()
70 transient_data->activate = state; in transient_activate_store()
72 transient_data->restore_state); in transient_activate_store()
77 if (state == 1 && transient_data->activate == 0 && in transient_activate_store()
78 transient_data->duration != 0) { in transient_activate_store()
79 transient_data->activate = state; in transient_activate_store()
80 led_set_brightness_nosleep(led_cdev, transient_data->state); in transient_activate_store()
81 transient_data->restore_state = in transient_activate_store()
82 (transient_data->state == LED_FULL) ? LED_OFF : LED_FULL; in transient_activate_store()
83 mod_timer(&transient_data->timer, in transient_activate_store()
84 jiffies + msecs_to_jiffies(transient_data->duration)); in transient_activate_store()
87 /* state == 0 && transient_data->activate == 0 in transient_activate_store()
88 timer is not active - just return */ in transient_activate_store()
89 /* state == 1 && transient_data->activate == 1 in transient_activate_store()
90 timer is already active - just return */ in transient_activate_store()
100 return sprintf(buf, "%lu\n", transient_data->duration); in transient_duration_show()
115 transient_data->duration = state; in transient_duration_store()
126 state = (transient_data->state == LED_FULL) ? 1 : 0; in transient_state_show()
143 return -EINVAL; in transient_state_store()
145 transient_data->state = (state == 1) ? LED_FULL : LED_OFF; in transient_state_store()
149 static DEVICE_ATTR(activate, 0644, transient_activate_show,
169 return -ENOMEM; in transient_trig_activate()
172 tdata->led_cdev = led_cdev; in transient_trig_activate()
174 timer_setup(&tdata->timer, transient_timer_function, 0); in transient_trig_activate()
183 timer_shutdown_sync(&transient_data->timer); in transient_trig_deactivate()
184 led_set_brightness_nosleep(led_cdev, transient_data->restore_state); in transient_trig_deactivate()
190 .activate = transient_trig_activate,