1 /* SPDX-License-Identifier: GPL-2.0 */
5 #include "../../include/linux/atomisp_platform.h"
6 #include <linux/types.h>
7 #include <linux/time.h>
9 #define AD5816G_VCM_ADDR 0x0e
11 /* ad5816g device structure */
12 struct ad5816g_device {
13 const struct camera_af_platform_data *platform_data;
14 struct timespec timestamp_t_focus_abs;
15 struct timespec focus_time; /* Time when focus was last time set */
16 s32 focus; /* Current focus value */
20 #define AD5816G_INVALID_CONFIG 0xffffffff
21 #define AD5816G_MAX_FOCUS_POS 1023
22 #define DELAY_PER_STEP_NS 1000000
23 #define DELAY_MAX_PER_STEP_NS (1000000 * 1023)
25 /* Register Definitions */
26 #define AD5816G_IC_INFO 0x00
27 #define AD5816G_IC_VERSION 0x01
28 #define AD5816G_CONTROL 0x02
29 #define AD5816G_VCM_CODE_MSB 0x03
30 #define AD5816G_VCM_CODE_LSB 0x04
31 #define AD5816G_STATUS 0x05
32 #define AD5816G_MODE 0x06
33 #define AD5816G_VCM_FREQ 0x07
34 #define AD5816G_VCM_THRESHOLD 0x08
37 #define AD5816G_ARC_EN 0x02
39 #define AD5816G_ARC_RES2 0x01
40 /* ARC VCM FREQ - 78.1Hz */
41 #define AD5816G_DEF_FREQ 0x7a
42 /* ARC VCM THRESHOLD - 0x08 << 1 */
43 #define AD5816G_DEF_THRESHOLD 0x64
44 #define AD5816G_ID 0x24
45 #define VCM_CODE_MASK 0x03ff
47 #define AD5816G_MODE_2_5M_SWITCH_CLOCK 0x14