blob: 5075496d2c9e83e76d92f51a5957e65cdea22f3f [file] [log] [blame]
Laurent Pinchart22db44c2011-05-05 15:39:25 -03001/*
2 * include/media/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 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA
21 *
22 */
23
24#ifndef __AS3645A_H__
25#define __AS3645A_H__
26
27#include <media/v4l2-subdev.h>
28
29#define AS3645A_NAME "as3645a"
30#define AS3645A_I2C_ADDR (0x60 >> 1) /* W:0x60, R:0x61 */
31
32#define AS3645A_FLASH_TIMEOUT_MIN 100000 /* us */
33#define AS3645A_FLASH_TIMEOUT_MAX 850000
34#define AS3645A_FLASH_TIMEOUT_STEP 50000
35
36#define AS3645A_FLASH_INTENSITY_MIN 200 /* mA */
37#define AS3645A_FLASH_INTENSITY_MAX_1LED 500
38#define AS3645A_FLASH_INTENSITY_MAX_2LEDS 400
39#define AS3645A_FLASH_INTENSITY_STEP 20
40
41#define AS3645A_TORCH_INTENSITY_MIN 20 /* mA */
42#define AS3645A_TORCH_INTENSITY_MAX 160
43#define AS3645A_TORCH_INTENSITY_STEP 20
44
45#define AS3645A_INDICATOR_INTENSITY_MIN 0 /* uA */
46#define AS3645A_INDICATOR_INTENSITY_MAX 10000
47#define AS3645A_INDICATOR_INTENSITY_STEP 2500
48
49/*
50 * as3645a_platform_data - Flash controller platform data
51 * @set_power: Set power callback
52 * @vref: VREF offset (0=0V, 1=+0.3V, 2=-0.3V, 3=+0.6V)
53 * @peak: Inductor peak current limit (0=1.25A, 1=1.5A, 2=1.75A, 3=2.0A)
54 * @ext_strobe: True if external flash strobe can be used
55 * @flash_max_current: Max flash current (mA, <= AS3645A_FLASH_INTENSITY_MAX)
56 * @torch_max_current: Max torch current (mA, >= AS3645A_TORCH_INTENSITY_MAX)
57 * @timeout_max: Max flash timeout (us, <= AS3645A_FLASH_TIMEOUT_MAX)
58 */
59struct as3645a_platform_data {
60 int (*set_power)(struct v4l2_subdev *subdev, int on);
61 unsigned int vref;
62 unsigned int peak;
63 bool ext_strobe;
64
65 /* Flash and torch currents and timeout limits */
66 unsigned int flash_max_current;
67 unsigned int torch_max_current;
68 unsigned int timeout_max;
69};
70
71#endif /* __AS3645A_H__ */