diff options
Diffstat (limited to 'include/linux/akm8975.h')
-rw-r--r-- | include/linux/akm8975.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/include/linux/akm8975.h b/include/linux/akm8975.h new file mode 100644 index 00000000000..6a7c4326001 --- /dev/null +++ b/include/linux/akm8975.h | |||
@@ -0,0 +1,87 @@ | |||
1 | /* | ||
2 | * Definitions for akm8975 compass chip. | ||
3 | */ | ||
4 | #ifndef AKM8975_H | ||
5 | #define AKM8975_H | ||
6 | |||
7 | #include <linux/ioctl.h> | ||
8 | |||
9 | /*! \name AK8975 operation mode | ||
10 | \anchor AK8975_Mode | ||
11 | Defines an operation mode of the AK8975.*/ | ||
12 | /*! @{*/ | ||
13 | #define AK8975_MODE_SNG_MEASURE 0x01 | ||
14 | #define AK8975_MODE_SELF_TEST 0x08 | ||
15 | #define AK8975_MODE_FUSE_ACCESS 0x0F | ||
16 | #define AK8975_MODE_POWER_DOWN 0x00 | ||
17 | /*! @}*/ | ||
18 | |||
19 | #define RBUFF_SIZE 8 /* Rx buffer size */ | ||
20 | |||
21 | /*! \name AK8975 register address | ||
22 | \anchor AK8975_REG | ||
23 | Defines a register address of the AK8975.*/ | ||
24 | /*! @{*/ | ||
25 | #define AK8975_REG_WIA 0x00 | ||
26 | #define AK8975_REG_INFO 0x01 | ||
27 | #define AK8975_REG_ST1 0x02 | ||
28 | #define AK8975_REG_HXL 0x03 | ||
29 | #define AK8975_REG_HXH 0x04 | ||
30 | #define AK8975_REG_HYL 0x05 | ||
31 | #define AK8975_REG_HYH 0x06 | ||
32 | #define AK8975_REG_HZL 0x07 | ||
33 | #define AK8975_REG_HZH 0x08 | ||
34 | #define AK8975_REG_ST2 0x09 | ||
35 | #define AK8975_REG_CNTL 0x0A | ||
36 | #define AK8975_REG_RSV 0x0B | ||
37 | #define AK8975_REG_ASTC 0x0C | ||
38 | #define AK8975_REG_TS1 0x0D | ||
39 | #define AK8975_REG_TS2 0x0E | ||
40 | #define AK8975_REG_I2CDIS 0x0F | ||
41 | /*! @}*/ | ||
42 | |||
43 | /*! \name AK8975 fuse-rom address | ||
44 | \anchor AK8975_FUSE | ||
45 | Defines a read-only address of the fuse ROM of the AK8975.*/ | ||
46 | /*! @{*/ | ||
47 | #define AK8975_FUSE_ASAX 0x10 | ||
48 | #define AK8975_FUSE_ASAY 0x11 | ||
49 | #define AK8975_FUSE_ASAZ 0x12 | ||
50 | /*! @}*/ | ||
51 | |||
52 | #define AKMIO 0xA1 | ||
53 | |||
54 | /* IOCTLs for AKM library */ | ||
55 | #define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char[5]) | ||
56 | #define ECS_IOCTL_READ _IOWR(AKMIO, 0x03, char[5]) | ||
57 | #define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x08, char[RBUFF_SIZE]) | ||
58 | #define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x0C, short[12]) | ||
59 | #define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x0D, int) | ||
60 | #define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x0E, int) | ||
61 | #define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short) | ||
62 | |||
63 | /* IOCTLs for APPs */ | ||
64 | #define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short) | ||
65 | #define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short) | ||
66 | #define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short) | ||
67 | #define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short) | ||
68 | #define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short) | ||
69 | #define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY | ||
70 | /* Set raw magnetic vector flag */ | ||
71 | #define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short) | ||
72 | /* Get raw magnetic vector flag */ | ||
73 | #define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short) | ||
74 | #define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short) | ||
75 | |||
76 | |||
77 | struct akm8975_platform_data { | ||
78 | int intr; | ||
79 | |||
80 | int (*init)(void); | ||
81 | void (*exit)(void); | ||
82 | int (*power_on)(void); | ||
83 | int (*power_off)(void); | ||
84 | }; | ||
85 | |||
86 | #endif | ||
87 | |||