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 DRV201_VCM_ADDR 0x0e
11 /* drv201 device structure */
12 struct drv201_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 */
18 bool initialized; /* true if drv201 is detected */
21 #define DRV201_INVALID_CONFIG 0xffffffff
22 #define DRV201_MAX_FOCUS_POS 1023
23 #define DELAY_PER_STEP_NS 1000000
24 #define DELAY_MAX_PER_STEP_NS (1000000 * 1023)
26 #define DRV201_CONTROL 2
27 #define DRV201_VCM_CURRENT 3
28 #define DRV201_STATUS 5
30 #define DRV201_VCM_FREQ 7
32 #define DEFAULT_CONTROL_VAL 2
33 #define DRV201_RESET 1
34 #define WAKEUP_DELAY_US 100
35 #define VCM_CODE_MASK 0x03ff