summaryrefslogtreecommitdiff
path: root/drivers/staging/media/atomisp/i2c/imx/drv201.h
blob: 8fc0ad1166304d98e2bce7a82f449b3b2914fda7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef __DRV201_H__
#define __DRV201_H__

#include "../../include/linux/atomisp_platform.h"
#include <linux/types.h>
#include <linux/time.h>

#define DRV201_VCM_ADDR	0x0e

/* drv201 device structure */
struct drv201_device {
	const struct camera_af_platform_data *platform_data;
	struct timespec timestamp_t_focus_abs;
	struct timespec focus_time;	/* Time when focus was last time set */
	s32 focus;			/* Current focus value */
	s16 number_of_steps;
	bool initialized;		/* true if drv201 is detected */
};

#define DRV201_INVALID_CONFIG	0xffffffff
#define DRV201_MAX_FOCUS_POS	1023
#define DELAY_PER_STEP_NS	1000000
#define DELAY_MAX_PER_STEP_NS	(1000000 * 1023)

#define DRV201_CONTROL				2
#define DRV201_VCM_CURRENT		3
#define DRV201_STATUS				5
#define DRV201_MODE				6
#define DRV201_VCM_FREQ			7

#define DEFAULT_CONTROL_VAL		2
#define DRV201_RESET				1
#define WAKEUP_DELAY_US			100
#define VCM_CODE_MASK	0x03ff

#endif