Merge tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / drivers / staging / media / atomisp / i2c / imx / ad5816g.h
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __AD5816G_H__
3 #define __AD5816G_H__
4
5 #include "../../include/linux/atomisp_platform.h"
6 #include <linux/types.h>
7 #include <linux/time.h>
8
9 #define AD5816G_VCM_ADDR        0x0e
10
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 */
17         s16 number_of_steps;
18 };
19
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)
24
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
35
36 /* ARC MODE ENABLE */
37 #define AD5816G_ARC_EN                  0x02
38 /* ARC RES2 MODE */
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
46
47 #define AD5816G_MODE_2_5M_SWITCH_CLOCK  0x14
48
49 #endif
50