2 * Support for dw9719 vcm driver.
4 * Copyright (c) 2014 Intel Corporation. All Rights Reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version
8 * 2 as published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include "../../include/linux/atomisp_platform.h"
26 #include <linux/types.h>
28 #define DW9718_VCM_ADDR (0x18 >> 1)
30 /* dw9718 device structure */
31 struct dw9718_device {
32 struct timespec timestamp_t_focus_abs;
34 bool initialized; /* true if dw9718 is detected */
35 s32 focus; /* Current focus value */
36 struct timespec focus_time; /* Time when focus was last time set */
37 __u8 buffer[4]; /* Used for i2c transactions */
38 const struct camera_af_platform_data *platform_data;
42 #define DW9718_MAX_FOCUS_POS 1023
44 /* Register addresses */
45 #define DW9718_PD 0x00
46 #define DW9718_CONTROL 0x01
47 #define DW9718_DATA_M 0x02
48 #define DW9718_DATA_L 0x03
49 #define DW9718_SW 0x04
50 #define DW9718_SACT 0x05
51 #define DW9718_FLAG 0x10
53 #define DW9718_CONTROL_SW_LINEAR BIT(0)
54 #define DW9718_CONTROL_S_SAC4 (BIT(1) | BIT(3))
55 #define DW9718_CONTROL_OCP_DISABLE BIT(4)
56 #define DW9718_CONTROL_UVLO_DISABLE BIT(5)
58 #define DW9718_SACT_MULT_TWO 0x00
59 #define DW9718_SACT_PERIOD_8_8MS 0x19
60 #define DW9718_SACT_DEFAULT_VAL 0x60
62 #define DW9718_DEFAULT_FOCUS_POSITION 300
64 #endif /* __DW9718_H__ */