Merge remote-tracking branch 'origin/upstream/linux-linaro-lsk-v3.10-android' into...
[firefly-linux-kernel-4.4.55.git] / drivers / input / magnetometer / mmc328x.h
1 /*
2  * Copyright (C) 2010 MEMSIC, Inc.
3  *
4  * Initial Code:
5  *      Robbie Cao
6  *      Dale Hou
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21  *
22  */
23
24 /*
25  * Definitions for mmc328x magnetic sensor chip.
26  */
27 #ifndef __MMC328X_H__
28 #define __MMC328X_H__
29
30 #include <linux/ioctl.h>
31
32 #define MMC328X_I2C_NAME                "mmc328x"
33
34 /*
35  * This address comes must match the part# on your target.
36  * Address to the sensor part# support as following list:
37  *      MMC3280MS - 0110000b
38  *      MMC3281MS - 0110001b
39  *      MMC3282MS - 0110010b
40  *      MMC3283MS - 0110011b
41  *      MMC3284MS - 0110100b
42  *      MMC3285MS - 0110101b
43  *      MMC3286MS - 0110110b
44  *      MMC3287MS - 0110111b
45  * Please refer to sensor datasheet for detail.
46  */
47 #define MMC328X_I2C_ADDR                0x30
48
49 /* MMC328X register address */
50 #define MMC328X_REG_CTRL                0x07
51 #define MMC328X_REG_DATA                0x00
52 #define MMC328X_REG_DS                  0x06
53
54 /* MMC328X control bit */
55 #define MMC328X_CTRL_TM                 0x01
56 #define MMC328X_CTRL_RM                 0x20
57
58 /* Use 'm' as magic number */
59 #define MMC328X_IOM                     'm'
60
61 /* IOCTLs for MMC328X device */
62 #define MMC328X_IOC_TM                  _IO (MMC328X_IOM, 0x00)
63 #define MMC328X_IOC_RM                  _IO (MMC328X_IOM, 0x01)
64 #define MMC328X_IOC_READ                _IOR(MMC328X_IOM, 0x02, int[3])
65 #define MMC328X_IOC_READXYZ             _IOR(MMC328X_IOM, 0x03, int[3])
66
67 #endif /* __MMC328X_H__ */
68