2 * Camera Flash and Torch On/Off Trigger
4 * based on ledtrig-ide-disk.c
6 * Copyright 2013 Texas Instruments
8 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/init.h>
18 #include <linux/leds.h>
20 DEFINE_LED_TRIGGER(ledtrig_flash
);
21 DEFINE_LED_TRIGGER(ledtrig_torch
);
23 void ledtrig_flash_ctrl(bool on
)
25 enum led_brightness brt
= on
? LED_FULL
: LED_OFF
;
27 led_trigger_event(ledtrig_flash
, brt
);
29 EXPORT_SYMBOL_GPL(ledtrig_flash_ctrl
);
31 void ledtrig_torch_ctrl(bool on
)
33 enum led_brightness brt
= on
? LED_FULL
: LED_OFF
;
35 led_trigger_event(ledtrig_torch
, brt
);
37 EXPORT_SYMBOL_GPL(ledtrig_torch_ctrl
);
39 static int __init
ledtrig_camera_init(void)
41 led_trigger_register_simple("flash", &ledtrig_flash
);
42 led_trigger_register_simple("torch", &ledtrig_torch
);
45 module_init(ledtrig_camera_init
);
47 static void __exit
ledtrig_camera_exit(void)
49 led_trigger_unregister_simple(ledtrig_torch
);
50 led_trigger_unregister_simple(ledtrig_flash
);
52 module_exit(ledtrig_camera_exit
);
54 MODULE_DESCRIPTION("LED Trigger for Camera Flash/Torch Control");
55 MODULE_AUTHOR("Milo Kim");
56 MODULE_LICENSE("GPL v2");