input: touchscreen: add touch screen of gslx680 for rk3399-firefly-edp
[firefly-linux-kernel-4.4.55.git] / drivers / input / magnetometer / ak8975.h
1 /*
2  * Definitions for akm8975 compass chip.
3  */
4 #ifndef AKM8975_H
5 #define AKM8975_H
6
7 #include <linux/ioctl.h>
8
9 #define AKM8975_I2C_NAME "ak8975"
10
11 /*! \name AK8975 operation mode
12  \anchor AK8975_Mode
13  Defines an operation mode of the AK8975.*/
14 /*! @{*/
15 #define AK8975_MODE_SNG_MEASURE 0x01
16 #define AK8975_MODE_SELF_TEST   0x08
17 #define AK8975_MODE_FUSE_ACCESS 0x0F
18 #define AK8975_MODE_POWERDOWN   0x00
19 /*! @}*/
20
21 #define SENSOR_DATA_SIZE                8       /* Rx buffer size, i.e from ST1 to ST2 */
22 #define RWBUF_SIZE                              16      /* Read/Write buffer size.*/
23
24
25 /*! \name AK8975 register address
26 \anchor AK8975_REG
27 Defines a register address of the AK8975.*/
28 /*! @{*/
29 #define AK8975_REG_WIA          0x00
30 #define AK8975_REG_INFO         0x01
31 #define AK8975_REG_ST1          0x02
32 #define AK8975_REG_HXL          0x03
33 #define AK8975_REG_HXH          0x04
34 #define AK8975_REG_HYL          0x05
35 #define AK8975_REG_HYH          0x06
36 #define AK8975_REG_HZL          0x07
37 #define AK8975_REG_HZH          0x08
38 #define AK8975_REG_ST2          0x09
39 #define AK8975_REG_CNTL         0x0A
40 #define AK8975_REG_RSV          0x0B
41 #define AK8975_REG_ASTC         0x0C
42 #define AK8975_REG_TS1          0x0D
43 #define AK8975_REG_TS2          0x0E
44 #define AK8975_REG_I2CDIS       0x0F
45 /*! @}*/
46
47 /*! \name AK8975 fuse-rom address
48 \anchor AK8975_FUSE
49 Defines a read-only address of the fuse ROM of the AK8975.*/
50 /*! @{*/
51 #define AK8975_FUSE_ASAX        0x10
52 #define AK8975_FUSE_ASAY        0x11
53 #define AK8975_FUSE_ASAZ        0x12
54 /*! @}*/
55
56 #define AKMIO                   0xA1
57
58 /* IOCTLs for AKM library */
59 #define ECS_IOCTL_WRITE                 _IOW(AKMIO, 0x01, char*)
60 #define ECS_IOCTL_READ                  _IOWR(AKMIO, 0x02, char*)
61 #define ECS_IOCTL_RESET                 _IO(AKMIO, 0x03) /* NOT used in AK8975 */
62 #define ECS_IOCTL_SET_MODE              _IOW(AKMIO, 0x04, short)
63 #define ECS_IOCTL_GETDATA               _IOR(AKMIO, 0x05, char[SENSOR_DATA_SIZE])
64 #define ECS_IOCTL_SET_YPR               _IOW(AKMIO, 0x06, short[12])
65 #define ECS_IOCTL_GET_OPEN_STATUS       _IOR(AKMIO, 0x07, int)
66 #define ECS_IOCTL_GET_CLOSE_STATUS      _IOR(AKMIO, 0x08, int)
67 #define ECS_IOCTL_GET_DELAY             _IOR(AKMIO, 0x30, short)
68 #define ECS_IOCTL_GET_PROJECT_NAME      _IOR(AKMIO, 0x0D, char[64])
69 #define ECS_IOCTL_GET_MATRIX            _IOR(AKMIO, 0x0E, short [4][3][3])
70 #define ECS_IOCTL_GET_PLATFORM_DATA     _IOR(AKMIO, 0x0E, struct akm8975_platform_data)
71
72
73 /* IOCTLs for APPs */
74 #define ECS_IOCTL_APP_SET_MODE          _IOW(AKMIO, 0x10, short)
75 #define ECS_IOCTL_APP_SET_MFLAG         _IOW(AKMIO, 0x11, short)
76 #define ECS_IOCTL_APP_GET_MFLAG         _IOW(AKMIO, 0x12, short)
77 #define ECS_IOCTL_APP_SET_AFLAG         _IOW(AKMIO, 0x13, short)
78 #define ECS_IOCTL_APP_GET_AFLAG         _IOR(AKMIO, 0x14, short)
79 #define ECS_IOCTL_APP_SET_TFLAG         _IOR(AKMIO, 0x15, short)/* NOT use */
80 #define ECS_IOCTL_APP_GET_TFLAG         _IOR(AKMIO, 0x16, short)/* NOT use */
81 #define ECS_IOCTL_APP_RESET_PEDOMETER   _IO(AKMIO, 0x17)        /* NOT use */
82 #define ECS_IOCTL_APP_SET_DELAY         _IOW(AKMIO, 0x18, short)
83 #define ECS_IOCTL_APP_GET_DELAY         ECS_IOCTL_GET_DELAY
84 #define ECS_IOCTL_APP_SET_MVFLAG        _IOW(AKMIO, 0x19, short)
85 #define ECS_IOCTL_APP_GET_MVFLAG        _IOR(AKMIO, 0x1A, short)
86
87 struct akm8975_platform_data {
88         short m_layout[4][3][3];
89         char project_name[64];
90         int gpio_DRDY;
91 };
92
93
94
95 #endif
96