blob: f105b74af1f6cd138aaf73b4a375fca2bb297ca1 [file] [log] [blame]
Franz Geiger78a06012014-07-28 09:54:13 +09001/*
2 * include/media/lm3644.h
3 *
4 * Copyright (C) 2014 Texas Instruments
5 *
6 * Contact: Daniel Jeong <gshark.jeong@gmail.com>
7 * Ldd-Mlp <ldd-mlp@list.ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 */
18
19#ifndef __LM3644_H__
20#define __LM3644_H__
21
22#include <media/v4l2-subdev.h>
23
24#define LM3644_NAME "lm3644"
25#define LM3644_I2C_ADDR (0x63)
26
27/* FLASH Brightness
28 * min 11310uA, step 11720uA, max 1500000uA
29 */
30#define LM3644_FLASH_BRT_MIN 11310
31#define LM3644_FLASH_BRT_STEP 11720
32#define LM3644_FLASH_BRT_MAX 1500000
33#define LM3644_FLASH_BRT_uA_TO_REG(a) \
34 ((a) < LM3644_FLASH_BRT_MIN ? 0 : \
35 (((a) - LM3644_FLASH_BRT_MIN) / LM3644_FLASH_BRT_STEP))
36
37/* TORCH BRT
38 * min 1060uA, step 1460uA, max 187000uA
39 */
40#define LM3644_TORCH_BRT_MIN 1060
41#define LM3644_TORCH_BRT_STEP 1460
42#define LM3644_TORCH_BRT_MAX 187000
43#define LM3644_TORCH_BRT_uA_TO_REG(a) \
44 ((a) < LM3644_TORCH_BRT_MIN ? 0 : \
45 (((a) - LM3644_TORCH_BRT_MIN) / LM3644_TORCH_BRT_STEP))
46
47/* FLASH TIMEOUT DURATION
48 * min 10ms, max 400ms
49 * step 10ms in range from 10ms to 100ms
50 * setp 50ms in range from 100ms to 400ms
51 */
52#define LM3644_FLASH_TOUT_MIN 10
53#define LM3644_FLASH_TOUT_LOW_STEP 10
54#define LM3644_FLASH_TOUT_LOW_MAX 100
55#define LM3644_FLASH_TOUT_HIGH_STEP 50
56#define LM3644_FLASH_TOUT_MAX 400
57#define LM3644_FLASH_TOUT_ms_TO_REG(a) \
58 ((a) < LM3644_FLASH_TOUT_MIN ? 0 : \
59 ((a) <= LM3644_FLASH_TOUT_LOW_MAX ? \
60 (((a) - LM3644_FLASH_TOUT_MIN) / LM3644_FLASH_TOUT_LOW_STEP) : \
61 ((((a) - LM3644_FLASH_TOUT_LOW_MAX) / LM3644_FLASH_TOUT_HIGH_STEP) \
62 +((LM3644_FLASH_TOUT_LOW_MAX - LM3644_FLASH_TOUT_MIN) \
63 / LM3644_FLASH_TOUT_LOW_STEP))))
64
65enum lm3644_led_id {
66 LM3644_LED0 = 0,
67 LM3644_LED1,
68 LM3644_LED_MAX
69};
70
71/*
72 * struct lm3644_platform_data
73 * @led0_enable : led0 enable
74 * @led1_enable : led1 enable
75 * @flash1_override : led1 flash current override
76 * @torch1_override : led1 torch current override
77 */
78struct lm3644_platform_data {
79
80 u8 led0_enable;
81 u8 led1_enable;
82 u8 flash1_override;
83 u8 torch1_override;
84};
85
86#endif /* __LM3644_H__ */