mmc: dw_mmc-rockchip: add MMC_CAP_CMD23 capabilities
[firefly-linux-kernel-4.4.55.git] / include / linux / mma7660.h
1 /*
2  * Definitions for mma7660 compass chip.
3  */
4 #ifndef MMA7660_H
5 #define MMA7660_H
6
7 #include <linux/ioctl.h>
8
9
10
11
12 /* Default register settings */
13 #define RBUFF_SIZE              12      /* Rx buffer size */
14
15
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
27
28
29 #define MMAIO                           0xA1
30
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])
37
38 /* IOCTLs for APPs */
39 #define ECS_IOCTL_APP_SET_RATE          _IOW(MMAIO, 0x10, char)
40
41
42 /*rate*/
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
51
52 /*status*/
53 #define MMA7660_OPEN           1
54 #define MMA7660_CLOSE          0
55
56
57
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
65
66
67
68 struct mma7660_platform_data {
69         int reset;
70         int clk_on;
71         int intr;
72 };
73
74 struct mma7660_data {
75     char  status;
76     char  curr_tate;
77         struct input_dev *input_dev;
78         struct i2c_client *client;
79         struct work_struct work;
80         struct delayed_work delaywork;  /*report second event*/
81 };
82
83 struct mma7660_axis {
84         int x;
85         int y;
86         int z;
87 };
88
89 #define  GSENSOR_DEV_PATH    "/dev/mma7660_daemon"
90
91
92 #endif
93