GNU Linux-libre 4.14.302-gnu1
[releases.git] / drivers / staging / media / atomisp / i2c / imx / dw9719.h
1 /*
2  * Support for dw9719 vcm driver.
3  *
4  * Copyright (c) 2012 Intel Corporation. All Rights Reserved.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License version
8  * 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18  * 02110-1301, USA.
19  *
20  */
21
22 #ifndef __DW9719_H__
23 #define __DW9719_H__
24
25 #include "../../include/linux/atomisp_platform.h"
26 #include <linux/types.h>
27
28 #define DW9719_VCM_ADDR  (0x18 >> 1)
29
30 /* dw9719 device structure */
31 struct dw9719_device {
32         struct timespec timestamp_t_focus_abs;
33         s16 number_of_steps;
34         bool initialized;               /* true if dw9719 is detected */
35         s32 focus;                      /* Current focus value */
36         struct timespec focus_time;     /* Time when focus was last time set */
37         __u8 buffer[4];                 /* Used for i2c transactions */
38         const struct camera_af_platform_data *platform_data;
39 };
40
41 #define DW9719_INVALID_CONFIG   0xffffffff
42 #define DW9719_MAX_FOCUS_POS    1023
43 #define DELAY_PER_STEP_NS       1000000
44 #define DELAY_MAX_PER_STEP_NS   (1000000 * 1023)
45
46 #define DW9719_INFO                     0
47 #define DW9719_ID                       0xF1
48 #define DW9719_CONTROL                  2
49 #define DW9719_VCM_CURRENT              3
50
51 #define DW9719_MODE                     6
52 #define DW9719_VCM_FREQ                 7
53
54 #define DW9719_MODE_SAC3                0x40
55 #define DW9719_DEFAULT_VCM_FREQ         0x04
56 #define DW9719_ENABLE_RINGING           0x02
57
58 #endif