2 * Definitions for mma7660 compass chip.
7 #include <linux/ioctl.h>
12 /* Default register settings */
13 #define RBUFF_SIZE 12 /* Rx buffer size */
16 #define MMA7660_REG_X_OUT 0x0
17 #define MMA7660_REG_Y_OUT 0x1
18 #define MMA7660_REG_Z_OUT 0x2
19 #define MMA7660_REG_TILT 0x3
20 #define MMA7660_REG_SRST 0x4
21 #define MMA7660_REG_SPCNT 0x5
22 #define MMA7660_REG_INTSU 0x6
23 #define MMA7660_REG_MODE 0x7
24 #define MMA7660_REG_SR 0x8
25 #define MMA7660_REG_PDET 0x9
26 #define MMA7660_REG_PD 0xa
31 /* IOCTLs for MMA7660 library */
32 #define ECS_IOCTL_INIT _IO(MMAIO, 0x01)
33 #define ECS_IOCTL_RESET _IO(MMAIO, 0x04)
34 #define ECS_IOCTL_CLOSE _IO(MMAIO, 0x02)
35 #define ECS_IOCTL_START _IO(MMAIO, 0x03)
36 #define ECS_IOCTL_GETDATA _IOR(MMAIO, 0x08, char[RBUFF_SIZE+1])
39 #define ECS_IOCTL_APP_SET_RATE _IOW(MMAIO, 0x10, char)
43 #define MMA7660_RATE_1 1
44 #define MMA7660_RATE_2 2
45 #define MMA7660_RATE_4 4
46 #define MMA7660_RATE_8 8
47 #define MMA7660_RATE_16 16
48 #define MMA7660_RATE_32 32
49 #define MMA7660_RATE_64 64
50 #define MMA7660_RATE_120 128
53 #define MMA7660_OPEN 1
54 #define MMA7660_CLOSE 0
58 #define MMA7660_IIC_ADDR 0x98
59 #define MMA7660_REG_LEN 11
60 #define MMA7660_RANGE 2000000
61 #define MMA7660_PRECISION 6
62 #define MMA7660_BOUNDARY (0x1 << (MMA7660_PRECISION - 1))
63 #define MMA7660_GRAVITY_STEP MMA7660_RANGE/MMA7660_BOUNDARY
64 #define MMA7660_TOTAL_TIME 10
68 struct mma7660_platform_data {
77 struct input_dev *input_dev;
78 struct i2c_client *client;
79 struct work_struct work;
80 struct delayed_work delaywork; /*report second event*/
89 #define GSENSOR_DEV_PATH "/dev/mma7660_daemon"