mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-10-31 18:09:19 +00:00
962bbe4eaa
The *.c/h source code should not have the execute permission. However, akm8963.c, akm09911.c, akm8975.c, akm09911.h, akm8963.h and akm8975.h have execute permissions after mirrored into the project. Change-Id: I01ddd7338933d49d03dfaca4a631f4427f2adc5e Signed-off-by: Oliver Wang <mengmeng@codeaurora.org>
99 lines
3 KiB
C
99 lines
3 KiB
C
/*
|
|
* Definitions for akm8975 compass chip.
|
|
*/
|
|
#ifndef AKM8975_H
|
|
#define AKM8975_H
|
|
|
|
#include <linux/ioctl.h>
|
|
|
|
/* Device specific constant values */
|
|
#define AK8975_REG_WIA 0x00
|
|
#define AK8975_REG_INFO 0x01
|
|
#define AK8975_REG_ST1 0x02
|
|
#define AK8975_REG_HXL 0x03
|
|
#define AK8975_REG_HXH 0x04
|
|
#define AK8975_REG_HYL 0x05
|
|
#define AK8975_REG_HYH 0x06
|
|
#define AK8975_REG_HZL 0x07
|
|
#define AK8975_REG_HZH 0x08
|
|
#define AK8975_REG_ST2 0x09
|
|
#define AK8975_REG_CNTL 0x0A
|
|
#define AK8975_REG_RSV 0x0B
|
|
#define AK8975_REG_ASTC 0x0C
|
|
#define AK8975_REG_TS1 0x0D
|
|
#define AK8975_REG_TS2 0x0E
|
|
#define AK8975_REG_I2CDIS 0x0F
|
|
|
|
#define AK8975_FUSE_ASAX 0x10
|
|
#define AK8975_FUSE_ASAY 0x11
|
|
#define AK8975_FUSE_ASAZ 0x12
|
|
|
|
#define AK8975_MODE_SNG_MEASURE 0x01
|
|
#define AK8975_MODE_SELF_TEST 0x08
|
|
#define AK8975_MODE_FUSE_ACCESS 0x0F
|
|
#define AK8975_MODE_POWERDOWN 0x00
|
|
#define AK8975_RESET_DATA 0x00
|
|
|
|
#define AK8975_REGS_SIZE 13
|
|
#define AK8975_WIA_VALUE 0x48
|
|
|
|
/* To avoid device dependency, convert to general name */
|
|
#define AKM_I2C_NAME "akm8975"
|
|
#define AKM_MISCDEV_NAME "akm8975_dev"
|
|
#define AKM_SYSCLS_NAME "compass"
|
|
#define AKM_SYSDEV_NAME "akm8975"
|
|
#define AKM_REG_MODE AK8975_REG_CNTL
|
|
#define AKM_REG_RESET 0
|
|
#define AKM_REG_STATUS AK8975_REG_ST1
|
|
#define AKM_MEASURE_TIME_US 10000
|
|
#define AKM_DRDY_IS_HIGH(x) ((x) & 0x01)
|
|
#define AKM_SENSOR_INFO_SIZE 2
|
|
#define AKM_SENSOR_CONF_SIZE 3
|
|
#define AKM_SENSOR_DATA_SIZE 8
|
|
|
|
#define AKM_YPR_DATA_SIZE 16
|
|
#define AKM_RWBUF_SIZE 16
|
|
#define AKM_REGS_SIZE AK8975_REGS_SIZE
|
|
#define AKM_REGS_1ST_ADDR AK8975_REG_WIA
|
|
#define AKM_FUSE_1ST_ADDR AK8975_FUSE_ASAX
|
|
|
|
#define AKM_MODE_SNG_MEASURE AK8975_MODE_SNG_MEASURE
|
|
#define AKM_MODE_SELF_TEST AK8975_MODE_SELF_TEST
|
|
#define AKM_MODE_FUSE_ACCESS AK8975_MODE_FUSE_ACCESS
|
|
#define AKM_MODE_POWERDOWN AK8975_MODE_POWERDOWN
|
|
#define AKM_RESET_DATA AK8975_RESET_DATA
|
|
|
|
#define ACC_DATA_FLAG 0
|
|
#define MAG_DATA_FLAG 1
|
|
#define FUSION_DATA_FLAG 2
|
|
#define AKM_NUM_SENSORS 3
|
|
|
|
#define ACC_DATA_READY (1<<(ACC_DATA_FLAG))
|
|
#define MAG_DATA_READY (1<<(MAG_DATA_FLAG))
|
|
#define FUSION_DATA_READY (1<<(FUSION_DATA_FLAG))
|
|
|
|
#define AKMIO 0xA1
|
|
|
|
/* IOCTLs for AKM library */
|
|
#define ECS_IOCTL_READ _IOWR(AKMIO, 0x01, char)
|
|
#define ECS_IOCTL_WRITE _IOW(AKMIO, 0x02, char)
|
|
#define ECS_IOCTL_RESET _IO(AKMIO, 0x03)
|
|
#define ECS_IOCTL_SET_MODE _IOW(AKMIO, 0x10, char)
|
|
#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x11, int[AKM_YPR_DATA_SIZE])
|
|
#define ECS_IOCTL_GET_INFO _IOR(AKMIO, 0x20, unsigned char[AKM_SENSOR_INFO_SIZE])
|
|
#define ECS_IOCTL_GET_CONF _IOR(AKMIO, 0x21, unsigned char[AKM_SENSOR_CONF_SIZE])
|
|
#define ECS_IOCTL_GET_DATA _IOR(AKMIO, 0x22, unsigned char[AKM_SENSOR_DATA_SIZE])
|
|
#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x23, int)
|
|
#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x24, int)
|
|
#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x25, long long int)
|
|
#define ECS_IOCTL_GET_LAYOUT _IOR(AKMIO, 0x26, char)
|
|
#define ECS_IOCTL_GET_ACCEL _IOR(AKMIO, 0x30, short[3])
|
|
|
|
struct akm8975_platform_data {
|
|
char layout;
|
|
int gpio_DRDY;
|
|
int gpio_RSTN;
|
|
};
|
|
|
|
#endif
|
|
|