WIP FPC-III support
[linux/fpc-iii.git] / drivers / leds / trigger / ledtrig-camera.c
blobab1c410872ffbf077a87e47106192caecaafb2d6
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Camera Flash and Torch On/Off Trigger
5 * based on ledtrig-ide-disk.c
7 * Copyright 2013 Texas Instruments
9 * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/leds.h>
17 DEFINE_LED_TRIGGER(ledtrig_flash);
18 DEFINE_LED_TRIGGER(ledtrig_torch);
20 void ledtrig_flash_ctrl(bool on)
22 enum led_brightness brt = on ? LED_FULL : LED_OFF;
24 led_trigger_event(ledtrig_flash, brt);
26 EXPORT_SYMBOL_GPL(ledtrig_flash_ctrl);
28 void ledtrig_torch_ctrl(bool on)
30 enum led_brightness brt = on ? LED_FULL : LED_OFF;
32 led_trigger_event(ledtrig_torch, brt);
34 EXPORT_SYMBOL_GPL(ledtrig_torch_ctrl);
36 static int __init ledtrig_camera_init(void)
38 led_trigger_register_simple("flash", &ledtrig_flash);
39 led_trigger_register_simple("torch", &ledtrig_torch);
40 return 0;
42 module_init(ledtrig_camera_init);
44 static void __exit ledtrig_camera_exit(void)
46 led_trigger_unregister_simple(ledtrig_torch);
47 led_trigger_unregister_simple(ledtrig_flash);
49 module_exit(ledtrig_camera_exit);
51 MODULE_DESCRIPTION("LED Trigger for Camera Flash/Torch Control");
52 MODULE_AUTHOR("Milo Kim");
53 MODULE_LICENSE("GPL v2");