GNU Linux-libre 4.14.290-gnu1
[releases.git] / include / media / i2c / as3645a.h
1 /*
2  * include/media/i2c/as3645a.h
3  *
4  * Copyright (C) 2008-2011 Nokia Corporation
5  *
6  * Contact: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * version 2 as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  */
18
19 #ifndef __AS3645A_H__
20 #define __AS3645A_H__
21
22 #include <media/v4l2-subdev.h>
23
24 #define AS3645A_NAME                            "as3645a"
25 #define AS3645A_I2C_ADDR                        (0x60 >> 1) /* W:0x60, R:0x61 */
26
27 #define AS3645A_FLASH_TIMEOUT_MIN               100000  /* us */
28 #define AS3645A_FLASH_TIMEOUT_MAX               850000
29 #define AS3645A_FLASH_TIMEOUT_STEP              50000
30
31 #define AS3645A_FLASH_INTENSITY_MIN             200     /* mA */
32 #define AS3645A_FLASH_INTENSITY_MAX_1LED        500
33 #define AS3645A_FLASH_INTENSITY_MAX_2LEDS       400
34 #define AS3645A_FLASH_INTENSITY_STEP            20
35
36 #define AS3645A_TORCH_INTENSITY_MIN             20      /* mA */
37 #define AS3645A_TORCH_INTENSITY_MAX             160
38 #define AS3645A_TORCH_INTENSITY_STEP            20
39
40 #define AS3645A_INDICATOR_INTENSITY_MIN         0       /* uA */
41 #define AS3645A_INDICATOR_INTENSITY_MAX         10000
42 #define AS3645A_INDICATOR_INTENSITY_STEP        2500
43
44 /*
45  * as3645a_platform_data - Flash controller platform data
46  * @set_power:  Set power callback
47  * @vref:       VREF offset (0=0V, 1=+0.3V, 2=-0.3V, 3=+0.6V)
48  * @peak:       Inductor peak current limit (0=1.25A, 1=1.5A, 2=1.75A, 3=2.0A)
49  * @ext_strobe: True if external flash strobe can be used
50  * @flash_max_current:  Max flash current (mA, <= AS3645A_FLASH_INTENSITY_MAX)
51  * @torch_max_current:  Max torch current (mA, >= AS3645A_TORCH_INTENSITY_MAX)
52  * @timeout_max:        Max flash timeout (us, <= AS3645A_FLASH_TIMEOUT_MAX)
53  */
54 struct as3645a_platform_data {
55         int (*set_power)(struct v4l2_subdev *subdev, int on);
56         unsigned int vref;
57         unsigned int peak;
58         bool ext_strobe;
59
60         /* Flash and torch currents and timeout limits */
61         unsigned int flash_max_current;
62         unsigned int torch_max_current;
63         unsigned int timeout_max;
64 };
65
66 #endif /* __AS3645A_H__ */