2 * Copyright (C) 2010 MEMSIC, Inc.
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.
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.
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
25 * Definitions for mmc328x magnetic sensor chip.
30 #include <linux/ioctl.h>
32 #define MMC328X_I2C_NAME "mmc328x"
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.
47 #define MMC328X_I2C_ADDR 0x30
49 /* MMC328X register address */
50 #define MMC328X_REG_CTRL 0x07
51 #define MMC328X_REG_DATA 0x00
52 #define MMC328X_REG_DS 0x06
54 /* MMC328X control bit */
55 #define MMC328X_CTRL_TM 0x01
56 #define MMC328X_CTRL_RM 0x20
58 /* Use 'm' as magic number */
59 #define MMC328X_IOM 'm'
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])
67 #endif /* __MMC328X_H__ */