blob: 091a09a20c58a3d33932203936eeafb00bf7bfe9 [file] [log] [blame]
Kim, Milo48a1d032013-03-14 04:29:24 -07001/*
2 * Camera Flash and Torch On/Off Trigger
3 *
4 * based on ledtrig-ide-disk.c
5 *
6 * Copyright 2013 Texas Instruments
7 *
8 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
9 *
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.
Kim, Milo48a1d032013-03-14 04:29:24 -070013 */
14
15#include <linux/module.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/leds.h>
19
20DEFINE_LED_TRIGGER(ledtrig_flash);
21DEFINE_LED_TRIGGER(ledtrig_torch);
22
23void ledtrig_flash_ctrl(bool on)
24{
25 enum led_brightness brt = on ? LED_FULL : LED_OFF;
26
27 led_trigger_event(ledtrig_flash, brt);
28}
29EXPORT_SYMBOL_GPL(ledtrig_flash_ctrl);
30
31void ledtrig_torch_ctrl(bool on)
32{
33 enum led_brightness brt = on ? LED_FULL : LED_OFF;
34
35 led_trigger_event(ledtrig_torch, brt);
36}
37EXPORT_SYMBOL_GPL(ledtrig_torch_ctrl);
38
39static int __init ledtrig_camera_init(void)
40{
41 led_trigger_register_simple("flash", &ledtrig_flash);
42 led_trigger_register_simple("torch", &ledtrig_torch);
43 return 0;
44}
45module_init(ledtrig_camera_init);
46
47static void __exit ledtrig_camera_exit(void)
48{
49 led_trigger_unregister_simple(ledtrig_torch);
50 led_trigger_unregister_simple(ledtrig_flash);
51}
52module_exit(ledtrig_camera_exit);
53
54MODULE_DESCRIPTION("LED Trigger for Camera Flash/Torch Control");
55MODULE_AUTHOR("Milo Kim");
Uwe Kleine-König033692e2018-07-02 22:05:20 +020056MODULE_LICENSE("GPL v2");