2 * Support for dw9719 vcm driver.
4 * Copyright (c) 2012 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 DW9719_VCM_ADDR (0x18 >> 1)
30 /* dw9719 device structure */
31 struct dw9719_device {
32 struct timespec timestamp_t_focus_abs;
34 bool initialized; /* true if dw9719 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;
41 #define DW9719_INVALID_CONFIG 0xffffffff
42 #define DW9719_MAX_FOCUS_POS 1023
43 #define DELAY_PER_STEP_NS 1000000
44 #define DELAY_MAX_PER_STEP_NS (1000000 * 1023)
47 #define DW9719_ID 0xF1
48 #define DW9719_CONTROL 2
49 #define DW9719_VCM_CURRENT 3
52 #define DW9719_VCM_FREQ 7
54 #define DW9719_MODE_SAC3 0x40
55 #define DW9719_DEFAULT_VCM_FREQ 0x04
56 #define DW9719_ENABLE_RINGING 0x02