14 #include <linux/module.h>
15 #include <linux/kernel.h>
17 #include <linux/device.h>
18 #include <linux/ctype.h>
19 #include <linux/slab.h>
23 #define DEFAULT_DELAY 100
59 ret = kstrtoul(buf, 0, &state);
66 __led_set_brightness(led_cdev,
LED_FULL);
68 __led_set_brightness(led_cdev,
LED_OFF);
88 ret = kstrtoul(buf, 0, &state);
111 ret = kstrtoul(buf, 0, &state);
120 static DEVICE_ATTR(delay_on, 0644, led_delay_on_show, led_delay_on_store);
121 static DEVICE_ATTR(delay_off, 0644, led_delay_off_show, led_delay_off_store);
122 static DEVICE_ATTR(invert, 0644, led_invert_show, led_invert_store);
125 static void oneshot_trig_activate(
struct led_classdev *led_cdev)
130 oneshot_data = kzalloc(
sizeof(*oneshot_data),
GFP_KERNEL);
134 led_cdev->trigger_data = oneshot_data;
138 goto err_out_trig_data;
141 goto err_out_delayon;
144 goto err_out_delayoff;
152 led_cdev->activated =
true;
163 kfree(led_cdev->trigger_data);
166 static void oneshot_trig_deactivate(
struct led_classdev *led_cdev)
170 if (led_cdev->activated) {
176 led_cdev->activated =
false;
183 static struct led_trigger oneshot_led_trigger = {
185 .activate = oneshot_trig_activate,
186 .deactivate = oneshot_trig_deactivate,
189 static int __init oneshot_trig_init(
void)
194 static void __exit oneshot_trig_exit(
void)