import PULS_20160108
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / misc / mediatek / magnetometer / ami304_auto / ami304.h
1 /* include/linux/ami304.h - AMI304 compass driver
2 *
3 * Copyright (C) 2009 AMIT Technology Inc.
4 * Author: Kyle Chen <sw-support@amit-inc.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
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 */
16
17 /*
18 * Definitions for ami304 compass chip.
19 */
20 #ifndef AMI304_H
21 #define AMI304_H
22
23 #include <linux/ioctl.h>
24 //#include <asm-arm/arch/regs-gpio.h>
25 extern struct mag_hw* ami304_get_cust_mag_hw(void);
26
27 #define AMI304_I2C_ADDRESS 0x1E //new Addr=0x0E(Low), old Addr=0x0F(High)
28
29 /* AMI304 Internal Register Address (Please refer to AMI304 Specifications) */
30 #define AMI304_REG_CTRL1 0x1B
31 #define AMI304_REG_CTRL2 0x1C
32 #define AMI304_REG_CTRL3 0x1D
33 #define AMI304_REG_DATAXH 0x10
34 #define AMI304_REG_DATAXL 0x11
35 #define AMI304_REG_DATAYH 0x12
36 #define AMI304_REG_DATAYL 0x13
37 #define AMI304_REG_DATAZH 0x14
38 #define AMI304_REG_DATAZL 0x15
39 #define AMI304_REG_WIA 0x0F
40
41 /* AMI304 Control Bit (Please refer to AMI304 Specifications) */
42 #define AMI304_CTRL1_PC1 0x80
43 #define AMI304_CTRL1_FS1_NORMAL 0x00 //Normal
44 #define AMI304_CTRL1_FS1_FORCE 0x02 //Force
45 #define AMI304_CTRL1_ODR1 0x10 //20SPS(20HZ)
46 #define AMI304_CTRL2_DREN 0x08
47 #define AMI304_CTRL2_DRP 0x04
48 #define AMI304_CTRL3_NOFORCE_BIT 0x00
49 #define AMI304_CTRL3_FORCE_BIT 0x40
50 #define AMI304_CTRL3_B0_LO_CLR 0x00
51
52 #define AMI304_BUFSIZE 256
53 #define AMI304_NORMAL_MODE 0
54 #define AMI304_FORCE_MODE 1
55 #define AMI304_IRQ IRQ_EINT9
56
57 // conversion of magnetic data to nT units
58 #define CONVERT_M 25
59 #define ORIENTATION_ACCURACY_RATE 10
60
61
62 #endif