summaryrefslogtreecommitdiffstats
path: root/drivers/staging/media/atomisp/i2c/imx/dw9719.h
blob: 711f412aef2aa4685018b2b16081e9f05c588b10 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * Support for dw9719 vcm driver.
 *
 * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version
 * 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 * 02110-1301, USA.
 *
 */

#ifndef __DW9719_H__
#define __DW9719_H__

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

#define DW9719_VCM_ADDR	 (0x18 >> 1)

/* dw9719 device structure */
struct dw9719_device {
	struct timespec timestamp_t_focus_abs;
	s16 number_of_steps;
	bool initialized;		/* true if dw9719 is detected */
	s32 focus;			/* Current focus value */
	struct timespec focus_time;	/* Time when focus was last time set */
	__u8 buffer[4];			/* Used for i2c transactions */
	const struct camera_af_platform_data *platform_data;
};

#define DW9719_INVALID_CONFIG	0xffffffff
#define DW9719_MAX_FOCUS_POS	1023
#define DELAY_PER_STEP_NS	1000000
#define DELAY_MAX_PER_STEP_NS	(1000000 * 1023)

#define DW9719_INFO			0
#define DW9719_ID			0xF1
#define DW9719_CONTROL			2
#define DW9719_VCM_CURRENT		3

#define DW9719_MODE			6
#define DW9719_VCM_FREQ			7

#define DW9719_MODE_SAC3		0x40
#define DW9719_DEFAULT_VCM_FREQ		0x04
#define DW9719_ENABLE_RINGING		0x02

#endif
OpenPOWER on IntegriCloud