1
2
3
4
5
6
7
8
9
10
11 #ifndef __LM3560_H__
12 #define __LM3560_H__
13
14 #include <media/v4l2-subdev.h>
15
16 #define LM3559_NAME "lm3559"
17 #define LM3560_NAME "lm3560"
18 #define LM3560_I2C_ADDR (0x53)
19
20
21
22
23 #define LM3560_FLASH_BRT_MIN 62500
24 #define LM3560_FLASH_BRT_STEP 62500
25 #define LM3560_FLASH_BRT_MAX 1000000
26 #define LM3560_FLASH_BRT_uA_TO_REG(a) \
27 ((a) < LM3560_FLASH_BRT_MIN ? 0 : \
28 (((a) - LM3560_FLASH_BRT_MIN) / LM3560_FLASH_BRT_STEP))
29 #define LM3560_FLASH_BRT_REG_TO_uA(a) \
30 ((a) * LM3560_FLASH_BRT_STEP + LM3560_FLASH_BRT_MIN)
31
32
33
34
35 #define LM3560_FLASH_TOUT_MIN 32
36 #define LM3560_FLASH_TOUT_STEP 32
37 #define LM3560_FLASH_TOUT_MAX 1024
38 #define LM3560_FLASH_TOUT_ms_TO_REG(a) \
39 ((a) < LM3560_FLASH_TOUT_MIN ? 0 : \
40 (((a) - LM3560_FLASH_TOUT_MIN) / LM3560_FLASH_TOUT_STEP))
41 #define LM3560_FLASH_TOUT_REG_TO_ms(a) \
42 ((a) * LM3560_FLASH_TOUT_STEP + LM3560_FLASH_TOUT_MIN)
43
44
45
46
47 #define LM3560_TORCH_BRT_MIN 31250
48 #define LM3560_TORCH_BRT_STEP 31250
49 #define LM3560_TORCH_BRT_MAX 250000
50 #define LM3560_TORCH_BRT_uA_TO_REG(a) \
51 ((a) < LM3560_TORCH_BRT_MIN ? 0 : \
52 (((a) - LM3560_TORCH_BRT_MIN) / LM3560_TORCH_BRT_STEP))
53 #define LM3560_TORCH_BRT_REG_TO_uA(a) \
54 ((a) * LM3560_TORCH_BRT_STEP + LM3560_TORCH_BRT_MIN)
55
56 enum lm3560_led_id {
57 LM3560_LED0 = 0,
58 LM3560_LED1,
59 LM3560_LED_MAX
60 };
61
62 enum lm3560_peak_current {
63 LM3560_PEAK_1600mA = 0x00,
64 LM3560_PEAK_2300mA = 0x20,
65 LM3560_PEAK_3000mA = 0x40,
66 LM3560_PEAK_3600mA = 0x60
67 };
68
69
70
71
72
73
74
75
76 struct lm3560_platform_data {
77 enum lm3560_peak_current peak;
78
79 u32 max_flash_timeout;
80 u32 max_flash_brt[LM3560_LED_MAX];
81 u32 max_torch_brt[LM3560_LED_MAX];
82 };
83
84 #endif