input: ewtzmu2: Add Panasonic gyroscope for HTC
Includes AKM8975 compass/gyroscope code
HTC kernel version: villeu-jb-crc-3.4.10-ae8b65e
akm8975_pana_gyro.c
ewtzmu2.c
HTC kernel version: evitaul-jb-crc-3.4.10-ec474a3
akm8975.c
Change-Id: I9f3c099d8d78da8331863ddc44fa2a5953379814
diff --git a/include/linux/akm8975.h b/include/linux/akm8975.h
index 6a7c432..ac8d046 100644
--- a/include/linux/akm8975.h
+++ b/include/linux/akm8975.h
@@ -1,27 +1,11 @@
-/*
- * Definitions for akm8975 compass chip.
- */
#ifndef AKM8975_H
#define AKM8975_H
#include <linux/ioctl.h>
-/*! \name AK8975 operation mode
- \anchor AK8975_Mode
- Defines an operation mode of the AK8975.*/
-/*! @{*/
-#define AK8975_MODE_SNG_MEASURE 0x01
-#define AK8975_MODE_SELF_TEST 0x08
-#define AK8975_MODE_FUSE_ACCESS 0x0F
-#define AK8975_MODE_POWER_DOWN 0x00
-/*! @}*/
+#define AKM8975_I2C_NAME "akm8975"
-#define RBUFF_SIZE 8 /* Rx buffer size */
-/*! \name AK8975 register address
-\anchor AK8975_REG
-Defines a register address of the AK8975.*/
-/*! @{*/
#define AK8975_REG_WIA 0x00
#define AK8975_REG_INFO 0x01
#define AK8975_REG_ST1 0x02
@@ -38,50 +22,61 @@
#define AK8975_REG_TS1 0x0D
#define AK8975_REG_TS2 0x0E
#define AK8975_REG_I2CDIS 0x0F
-/*! @}*/
-/*! \name AK8975 fuse-rom address
-\anchor AK8975_FUSE
-Defines a read-only address of the fuse ROM of the AK8975.*/
-/*! @{*/
+
+
#define AK8975_FUSE_ASAX 0x10
#define AK8975_FUSE_ASAY 0x11
#define AK8975_FUSE_ASAZ 0x12
-/*! @}*/
-#define AKMIO 0xA1
-/* IOCTLs for AKM library */
-#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char[5])
-#define ECS_IOCTL_READ _IOWR(AKMIO, 0x03, char[5])
-#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x08, char[RBUFF_SIZE])
-#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x0C, short[12])
-#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x0D, int)
-#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x0E, int)
-#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short)
+#define AK8975_CNTL_SNG_MEASURE 0x01
+#define AK8975_CNTL_CONT_MEASURE 0x02
+#define AK8975_CNTL_TRIG_MEASURE 0x04
+#define AK8975_CNTL_SELF_TEST 0x08
+#define AK8975_CNTL_FUSE_ACCESS 0x0F
+#define AK8975_CNTL_POWER_DOWN 0x00
-/* IOCTLs for APPs */
-#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
-#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
-#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
-#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
-#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short)
-#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
-/* Set raw magnetic vector flag */
-#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
-/* Get raw magnetic vector flag */
-#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
-#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)
+#define RBUFF_SIZE_8975 8
+#define AKMIO 0xA1
+
+#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x01, char[5])
+#define ECS_IOCTL_READ _IOWR(AKMIO, 0x02, char[5])
+#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x0F, short)
+#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x05, char[RBUFF_SIZE_8975+1])
+#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x06, short[12])
+#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x07, int)
+#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x08, int)
+#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x30, short)
+#define ECS_IOCTL_GET_MATRIX _IOR(AKMIO, 0x0E, short [4][3][3])
+#define ECS_IOCTL_GET_DATA_FOR_GYRO _IOR(AKMIO, 0x31, short[12])
+#define ECS_IOCTL_GET_COMP_FLAG _IOR(AKMIO, 0x32, int)
+
+#define ECS_IOCTL_APP_SET_MODE _IOW(AKMIO, 0x10, short)
+#define ECS_IOCTL_APP_SET_MFLAG _IOW(AKMIO, 0x11, short)
+#define ECS_IOCTL_APP_GET_MFLAG _IOW(AKMIO, 0x12, short)
+#define ECS_IOCTL_APP_SET_AFLAG _IOW(AKMIO, 0x13, short)
+#define ECS_IOCTL_APP_GET_AFLAG _IOR(AKMIO, 0x14, short)
+#define ECS_IOCTL_APP_SET_TFLAG _IOR(AKMIO, 0x15, short)
+#define ECS_IOCTL_APP_GET_TFLAG _IOR(AKMIO, 0x16, short)
+#define ECS_IOCTL_APP_RESET_PEDOMETER _IO(AKMIO, 0x17)
+#define ECS_IOCTL_APP_SET_DELAY _IOW(AKMIO, 0x18, short)
+#define ECS_IOCTL_APP_GET_DELAY ECS_IOCTL_GET_DELAY
+
+#define ECS_IOCTL_APP_SET_MVFLAG _IOW(AKMIO, 0x19, short)
+
+#define ECS_IOCTL_APP_GET_MVFLAG _IOR(AKMIO, 0x1A, short)
struct akm8975_platform_data {
- int intr;
-
- int (*init)(void);
- void (*exit)(void);
- int (*power_on)(void);
- int (*power_off)(void);
+ short layouts[4][3][3];
+ short irq_trigger;
+ int use_pana_gyro;
};
+void akm_get_akmd_data(short *getdata);
+int akm_get_akmd_ready(void);
+extern int EWTZMU2_Report_Value(void);
+extern int EWTZMU2_Report_Value_akm(int ifirst, int x, int y, int z);
#endif