Home | History | Annotate | Download | only in linux
      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 "akm8975"
     10 
     11 #define SENSOR_DATA_SIZE	8
     12 #define YPR_DATA_SIZE		12
     13 #define RWBUF_SIZE			16
     14 
     15 #define ACC_DATA_FLAG		0
     16 #define MAG_DATA_FLAG		1
     17 #define ORI_DATA_FLAG		2
     18 #define AKM_NUM_SENSORS		3
     19 
     20 #define ACC_DATA_READY		(1<<(ACC_DATA_FLAG))
     21 #define MAG_DATA_READY		(1<<(MAG_DATA_FLAG))
     22 #define ORI_DATA_READY		(1<<(ORI_DATA_FLAG))
     23 
     24 /*! \name AK8975 constant definition
     25  \anchor AK8975_Def
     26  Constant definitions of the AK8975.*/
     27 #define AK8975_MEASUREMENT_TIME_US	10000
     28 
     29 /*! \name AK8975 operation mode
     30  \anchor AK8975_Mode
     31  Defines an operation mode of the AK8975.*/
     32 /*! @{*/
     33 #define AK8975_MODE_SNG_MEASURE	0x01
     34 #define	AK8975_MODE_SELF_TEST	0x08
     35 #define	AK8975_MODE_FUSE_ACCESS	0x0F
     36 #define	AK8975_MODE_POWERDOWN	0x00
     37 /*! @}*/
     38 
     39 /*! \name AK8975 register address
     40 \anchor AK8975_REG
     41 Defines a register address of the AK8975.*/
     42 /*! @{*/
     43 #define AK8975_REG_WIA		0x00
     44 #define AK8975_REG_INFO		0x01
     45 #define AK8975_REG_ST1		0x02
     46 #define AK8975_REG_HXL		0x03
     47 #define AK8975_REG_HXH		0x04
     48 #define AK8975_REG_HYL		0x05
     49 #define AK8975_REG_HYH		0x06
     50 #define AK8975_REG_HZL		0x07
     51 #define AK8975_REG_HZH		0x08
     52 #define AK8975_REG_ST2		0x09
     53 #define AK8975_REG_CNTL		0x0A
     54 #define AK8975_REG_RSV		0x0B
     55 #define AK8975_REG_ASTC		0x0C
     56 #define AK8975_REG_TS1		0x0D
     57 #define AK8975_REG_TS2		0x0E
     58 #define AK8975_REG_I2CDIS	0x0F
     59 /*! @}*/
     60 
     61 /*! \name AK8975 fuse-rom address
     62 \anchor AK8975_FUSE
     63 Defines a read-only address of the fuse ROM of the AK8975.*/
     64 /*! @{*/
     65 #define AK8975_FUSE_ASAX	0x10
     66 #define AK8975_FUSE_ASAY	0x11
     67 #define AK8975_FUSE_ASAZ	0x12
     68 /*! @}*/
     69 
     70 #define AKMIO                   0xA1
     71 
     72 /* IOCTLs for AKM library */
     73 #define ECS_IOCTL_READ              _IOWR(AKMIO, 0x01, char*)
     74 #define ECS_IOCTL_WRITE             _IOW(AKMIO, 0x02, char*)
     75 #define ECS_IOCTL_SET_MODE          _IOW(AKMIO, 0x03, short)
     76 #define ECS_IOCTL_GETDATA           _IOR(AKMIO, 0x04, char[SENSOR_DATA_SIZE])
     77 #define ECS_IOCTL_SET_YPR           _IOW(AKMIO, 0x05, int[YPR_DATA_SIZE])
     78 #define ECS_IOCTL_GET_OPEN_STATUS   _IOR(AKMIO, 0x06, int)
     79 #define ECS_IOCTL_GET_CLOSE_STATUS  _IOR(AKMIO, 0x07, int)
     80 #define ECS_IOCTL_GET_DELAY         _IOR(AKMIO, 0x08, long long int[AKM_NUM_SENSORS])
     81 #define ECS_IOCTL_GET_LAYOUT        _IOR(AKMIO, 0x09, char)
     82 #define ECS_IOCTL_GET_ACCEL			_IOR(AKMIO, 0x30, short[3])
     83 
     84 struct akm8975_platform_data {
     85 	char layout;
     86 	int gpio_DRDY;
     87 };
     88 
     89 #endif
     90 
     91