Merge branch android-common-3.10
[firefly-linux-kernel-4.4.55.git] / drivers / media / video / rk_camsys / ext_flashled_drv / leds-rt8547.h
1 /* include/linux/leds-rt8547.h
2  * Include file of driver to Richtek RT8547 LED Flash IC
3  *
4  * Copyright (C) 2014 Richtek Technology Corporation
5  * Author: CY_Huang <cy_huang@richtek.com>
6  *
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.
10  */
11
12 #ifndef __LINUX_LEDS_RT8547_H
13 #define __LINUX_LEDS_RT8547_H
14
15 #define RT8547_DRV_VER "1.0.2_G"
16
17 enum {
18         RT8547_FLED_REG0 = 0x01,
19         RT8547_FLED_REG1,
20         RT8547_FLED_REG2,
21         RT8547_FLED_REG3,
22         RT8547_FLED_REGMAX,
23 };
24
25 enum {
26         RT8547_LVP_3V,
27         RT8547_LVP_3P1V,
28         RT8547_LVP_3P2V,
29         RT8547_LVP_3P3V,
30         RT8547_LVP_3P4V,
31         RT8547_LVP_3P5V,
32         RT8547_LVP_3P6V,
33         RT8547_LVP_3P7V,
34         RT8547_LVP_3P8V,
35         RT8547_LVP_MAX = RT8547_LVP_3P8V,
36 };
37
38 enum {
39         RT8547_TOL_100mA,
40         RT8547_TOL_150mA,
41         RT8547_TOL_200mA,
42         RT8547_TOL_250mA,
43         RT8547_TOL_300mA,
44         RT8547_TOL_350mA,
45         RT8547_TOL_400mA,
46         RT8547_TOL_MAX = RT8547_TOL_400mA,
47 };
48
49 #define RT8547_STO_MAX 36
50
51 #define RT8547_LVP_MASK 0x0F
52 #define RT8547_TOCLEVEL_MASK 0xE0
53 #define RT8547_TOCLEVEL_SHFT 5
54 #define RT8547_SCLEVEL_MASK 0x1F
55 #define RT8547_SWRST_MASK 0x20
56 #define RT8547_MODESEL_MASK 0x10
57 #define RT8547_TCLEVEL_MASK 0x0F
58 #define RT8547_STO_MASK 0x3F
59
60 struct rt8547_platform_data {
61         int flen_gpio;
62         int flen_active;
63         int ctl_gpio;
64         int ctl_active;
65         int flset_gpio;
66         int flset_active;
67         unsigned char def_lvp:4;
68         unsigned char def_tol:3;
69 };
70
71 /* one wire protocol parameter */
72 #define RT8547_ONEWIRE_ADDR 0x99
73 #define RT8547_LONG_DELAY 9
74 #define RT8547_SHORT_DELAY 4
75 #define RT8547_START_DELAY 10
76 #define RT8547_STOP_DELAY 1500
77
78 #ifdef CONFIG_LEDS_RT8547_DBG
79 #define RT_DBG(fmt, args...) pr_info("%s: " fmt, __func__, ##args)
80 #else
81 #define RT_DBG(fmt, args...)
82 #endif /* #ifdef CONFIG_LEDS_RT8547_DBG */
83
84 #endif /* #ifndef __LINUX_LEDS_RT8547_H */