1 /*include/linux/leds/rtfled.h
2 *Header of Richtek Flash LED Driver
4 *Copyright (C) 2013 Richtek Technology Corp.
5 *Author: Patrick Chang <patrick_chang@richtek.com>
7 *This program is free software; you can redistribute it and/or modify
8 *it under the terms of the GNU General Public License version 2 as
9 *published by the Free Software Foundation; either version 2
10 *of the License, or (at your option) any later version.
13 #ifndef LINUX_LEDS_RTFLED_H
14 #define LINUX_LEDS_RTFLED_H
15 #include "flashlight.h"
18 typedef int (*rt_hal_fled_init) (struct rt_fled_info *info);
19 typedef int (*rt_hal_fled_suspend) (struct rt_fled_info *info,
21 typedef int (*rt_hal_fled_resume) (struct rt_fled_info *info);
22 typedef int (*rt_hal_fled_set_mode) (struct rt_fled_info *info,
23 flashlight_mode_t mode);
24 typedef int (*rt_hal_fled_get_mode) (struct rt_fled_info *info);
25 typedef int (*rt_hal_fled_strobe) (struct rt_fled_info *info);
28 *Return value : -EINVAL => selector parameter is out of range,
29 *otherwise current in uA
31 typedef int (*rt_hal_fled_torch_current_list) (struct rt_fled_info *info,
33 typedef int (*rt_hal_fled_strobe_current_list) (struct rt_fled_info *info,
35 typedef int (*rt_hal_fled_timeout_level_list) (struct rt_fled_info *info,
38 *Return value : -EINVAL => selector parameter is out of range,
39 *otherwise voltage in mV
41 typedef int (*rt_hal_fled_lv_protection_list) (struct rt_fled_info *info,
44 *Return value : -EINVAL => selector parameter is out of range,
47 typedef int (*rt_hal_fled_strobe_timeout_list) (struct rt_fled_info *info,
49 typedef int (*rt_hal_fled_set_torch_current) (struct rt_fled_info *info,
50 int min_uA, int max_uA,
52 typedef int (*rt_hal_fled_set_strobe_current) (struct rt_fled_info *info,
53 int min_uA, int max_uA,
55 typedef int (*rt_hal_fled_set_timeout_level) (struct rt_fled_info *info,
56 int min_uA, int max_uA,
58 typedef int (*rt_hal_fled_set_lv_protection) (struct rt_fled_info *info,
59 int min_mV, int max_mV,
61 typedef int (*rt_hal_fled_set_strobe_timeout) (struct rt_fled_info *info,
62 int min_ms, int max_ms,
64 typedef int (*rt_hal_fled_set_torch_current_sel) (struct rt_fled_info *info,
66 typedef int (*rt_hal_fled_set_strobe_current_sel) (struct rt_fled_info *info,
68 typedef int (*rt_hal_fled_set_timeout_level_sel) (struct rt_fled_info *info,
70 typedef int (*rt_hal_fled_set_lv_protection_sel) (struct rt_fled_info *info,
72 typedef int (*rt_hal_fled_set_strobe_timeout_sel) (struct rt_fled_info *info,
74 typedef int (*rt_hal_fled_get_torch_current_sel) (struct rt_fled_info *info);
75 typedef int (*rt_hal_fled_get_strobe_current_sel) (struct rt_fled_info *info);
76 typedef int (*rt_hal_fled_get_timeout_level_sel) (struct rt_fled_info *info);
77 typedef int (*rt_hal_fled_get_lv_protection_sel) (struct rt_fled_info *info);
78 typedef int (*rt_hal_fled_get_strobe_timeout_sel) (struct rt_fled_info *info);
79 typedef int (*rt_hal_fled_get_torch_current) (struct rt_fled_info *info);
80 typedef int (*rt_hal_fled_get_strobe_current) (struct rt_fled_info *info);
81 typedef int (*rt_hal_fled_get_timeout_level) (struct rt_fled_info *info);
82 typedef int (*rt_hal_fled_get_lv_protection) (struct rt_fled_info *info);
83 typedef int (*rt_hal_fled_get_strobe_timeout) (struct rt_fled_info *info);
84 typedef void (*rt_hal_fled_shutdown) (struct rt_fled_info *info);
87 rt_hal_fled_init fled_init;
88 rt_hal_fled_suspend fled_suspend;
89 rt_hal_fled_resume fled_resume;
90 rt_hal_fled_set_mode fled_set_mode;
91 rt_hal_fled_get_mode fled_get_mode;
92 rt_hal_fled_strobe fled_strobe;
93 rt_hal_fled_torch_current_list fled_torch_current_list;
94 rt_hal_fled_strobe_current_list fled_strobe_current_list;
95 rt_hal_fled_timeout_level_list fled_timeout_level_list;
96 rt_hal_fled_lv_protection_list fled_lv_protection_list;
97 rt_hal_fled_strobe_timeout_list fled_strobe_timeout_list;
99 rt_hal_fled_set_torch_current_sel fled_set_torch_current_sel;
100 rt_hal_fled_set_strobe_current_sel fled_set_strobe_current_sel;
101 rt_hal_fled_set_timeout_level_sel fled_set_timeout_level_sel;
102 rt_hal_fled_set_lv_protection_sel fled_set_lv_protection_sel;
103 rt_hal_fled_set_strobe_timeout_sel fled_set_strobe_timeout_sel;
104 /*method to set, optional */
105 rt_hal_fled_set_torch_current fled_set_torch_current;
106 rt_hal_fled_set_strobe_current fled_set_strobe_current;
107 rt_hal_fled_set_timeout_level fled_set_timeout_level;
108 rt_hal_fled_set_lv_protection fled_set_lv_protection;
109 rt_hal_fled_set_strobe_timeout fled_set_strobe_timeout;
111 rt_hal_fled_get_torch_current_sel fled_get_torch_current_sel;
112 rt_hal_fled_get_strobe_current_sel fled_get_strobe_current_sel;
113 rt_hal_fled_get_timeout_level_sel fled_get_timeout_level_sel;
114 rt_hal_fled_get_lv_protection_sel fled_get_lv_protection_sel;
115 rt_hal_fled_get_strobe_timeout_sel fled_get_strobe_timeout_sel;
116 /*method to get, optional */
117 rt_hal_fled_get_torch_current fled_get_torch_current;
118 rt_hal_fled_get_strobe_current fled_get_strobe_current;
119 rt_hal_fled_get_timeout_level fled_get_timeout_level;
120 rt_hal_fled_get_lv_protection fled_get_lv_protection;
121 rt_hal_fled_get_strobe_timeout fled_get_strobe_timeout;
122 /*PM shutdown, optional */
123 rt_hal_fled_shutdown fled_shutdown;
126 typedef struct rt_fled_info {
127 struct rt_fled_hal *hal;
128 struct flashlight_device *flashlight_dev;
129 const struct flashlight_properties *init_props;
136 * @name : Flash LED's name;pass NULL menas "rt-flash-led"
139 rt_fled_info_t *rt_fled_get_info_by_name(char *name);
142 *fled_info = rt_fled_get_info_by_name("FlashLED1");
143 *fled_info->hal->fled_set_strobe_current(fled_info,
147 #endif /*LINUX_LEDS_RTFLED_H */