mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 14:42:37 +02:00
rk3188 ds1006h: add akm8963
This commit is contained in:
parent
38abf57a8d
commit
6fe30df1fe
|
|
@ -253,6 +253,17 @@ static struct sensor_platform_data lis3dh_info = {
|
|||
.orientation = {-1, 0, 0, 0, 0, -1, 0, 1, 0},
|
||||
};
|
||||
#endif
|
||||
|
||||
#if (defined(CONFIG_SENSORS_AK8963) || defined(CONFIG_SENSORS_AK8963_MODULE))
|
||||
static struct akm8963_platform_data akm_platform_data_8963 = {
|
||||
.gpio_DRDY = RK30_PIN3_PD7,
|
||||
.gpio_RST = 0,
|
||||
.layout = 3,
|
||||
.outbit = 1,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (CONFIG_COMPASS_AK8975)
|
||||
static struct sensor_platform_data akm8975_info =
|
||||
{
|
||||
|
|
@ -1151,6 +1162,17 @@ static struct i2c_board_info __initdata i2c0_info[] = {
|
|||
.platform_data = &lis3dh_info,
|
||||
},
|
||||
#endif
|
||||
#if defined (CONFIG_SENSORS_AK8963)
|
||||
{
|
||||
.type = "akm8963",
|
||||
.addr = 0x0d,
|
||||
.flags = I2C_CLIENT_WAKE,
|
||||
.irq = RK30_PIN3_PD7,
|
||||
.platform_data = &akm_platform_data_8963,
|
||||
},
|
||||
#endif
|
||||
|
||||
|
||||
#if defined (CONFIG_COMPASS_AK8975)
|
||||
{
|
||||
.type = "ak8975",
|
||||
|
|
|
|||
|
|
@ -18,6 +18,14 @@ enum {
|
|||
I2C_SCL_LOW,
|
||||
BOTH_LOW,
|
||||
};
|
||||
|
||||
struct akm8963_platform_data {
|
||||
int gpio_DRDY;
|
||||
int gpio_RST;
|
||||
char layout;
|
||||
char outbit;
|
||||
};
|
||||
|
||||
struct rk30_i2c_platform_data {
|
||||
char *name;
|
||||
int bus_num;
|
||||
|
|
|
|||
|
|
@ -399,6 +399,15 @@ config SENSORS_AK8975
|
|||
If you say yes here you get support for Asahi Kasei's
|
||||
orientation sensor AK8975.
|
||||
|
||||
config SENSORS_AK8963
|
||||
tristate "AK8963 compass support"
|
||||
default n
|
||||
depends on I2C
|
||||
help
|
||||
If you say yes here you get support for Asahi Kasei's
|
||||
orientation sensor AK8963.
|
||||
|
||||
|
||||
config EP93XX_PWM
|
||||
tristate "EP93xx PWM support"
|
||||
depends on ARCH_EP93XX
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ obj-y += carma/
|
|||
obj-$(CONFIG_WL127X_RFKILL) += wl127x-rfkill.o
|
||||
obj-$(CONFIG_APANIC) += apanic.o
|
||||
obj-$(CONFIG_SENSORS_AK8975) += akm8975.o
|
||||
obj-$(CONFIG_SENSORS_AK8963) += akm8963.o
|
||||
obj-$(CONFIG_MTK23D) += mtk23d.o
|
||||
obj-$(CONFIG_FM580X) += fm580x.o
|
||||
obj-$(CONFIG_RK29_SUPPORT_MODEM) += rk29_modem/
|
||||
|
|
|
|||
1466
drivers/misc/akm8963.c
Normal file
1466
drivers/misc/akm8963.c
Normal file
File diff suppressed because it is too large
Load Diff
95
include/linux/akm8963.h
Normal file
95
include/linux/akm8963.h
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Definitions for akm8963 compass chip.
|
||||
*/
|
||||
#ifndef AKM8963_H
|
||||
#define AKM8963_H
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define AKM8963_I2C_NAME "akm8963"
|
||||
|
||||
#define SENSOR_DATA_SIZE 8
|
||||
#define YPR_DATA_SIZE 12
|
||||
#define RWBUF_SIZE 16
|
||||
|
||||
#define ACC_DATA_FLAG 0
|
||||
#define MAG_DATA_FLAG 1
|
||||
#define ORI_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 ORI_DATA_READY (1<<(ORI_DATA_FLAG))
|
||||
|
||||
/*! \name AK8963 constant definition
|
||||
\anchor AK8963_Def
|
||||
Constant definitions of the AK8963.*/
|
||||
#define AK8963_MEASUREMENT_TIME_US 10000
|
||||
|
||||
/*! \name AK8963 operation mode
|
||||
\anchor AK8963_Mode
|
||||
Defines an operation mode of the AK8963.*/
|
||||
/*! @{*/
|
||||
#define AK8963_MODE_SNG_MEASURE 0x01
|
||||
#define AK8963_MODE_SELF_TEST 0x08
|
||||
#define AK8963_MODE_FUSE_ACCESS 0x0F
|
||||
#define AK8963_MODE_POWERDOWN 0x00
|
||||
|
||||
/*! @}*/
|
||||
|
||||
/*! \name AK8963 register address
|
||||
\anchor AK8963_REG
|
||||
Defines a register address of the AK8963.*/
|
||||
/*! @{*/
|
||||
#define AK8963_REG_WIA 0x00
|
||||
#define AK8963_REG_INFO 0x01
|
||||
#define AK8963_REG_ST1 0x02
|
||||
#define AK8963_REG_HXL 0x03
|
||||
#define AK8963_REG_HXH 0x04
|
||||
#define AK8963_REG_HYL 0x05
|
||||
#define AK8963_REG_HYH 0x06
|
||||
#define AK8963_REG_HZL 0x07
|
||||
#define AK8963_REG_HZH 0x08
|
||||
#define AK8963_REG_ST2 0x09
|
||||
#define AK8963_REG_CNTL1 0x0A
|
||||
#define AK8963_REG_CNTL2 0x0B
|
||||
#define AK8963_REG_ASTC 0x0C
|
||||
#define AK8963_REG_TS1 0x0D
|
||||
#define AK8963_REG_TS2 0x0E
|
||||
#define AK8963_REG_I2CDIS 0x0F
|
||||
/*! @}*/
|
||||
|
||||
/*! \name AK8963 fuse-rom address
|
||||
\anchor AK8963_FUSE
|
||||
Defines a read-only address of the fuse ROM of the AK8963.*/
|
||||
/*! @{*/
|
||||
#define AK8963_FUSE_ASAX 0x10
|
||||
#define AK8963_FUSE_ASAY 0x11
|
||||
#define AK8963_FUSE_ASAZ 0x12
|
||||
/*! @}*/
|
||||
|
||||
#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_SET_MODE _IOW(AKMIO, 0x03, short)
|
||||
#define ECS_IOCTL_GETDATA _IOR(AKMIO, 0x04, char[SENSOR_DATA_SIZE])
|
||||
#define ECS_IOCTL_SET_YPR _IOW(AKMIO, 0x05, int[YPR_DATA_SIZE])
|
||||
#define ECS_IOCTL_GET_OPEN_STATUS _IOR(AKMIO, 0x06, int)
|
||||
#define ECS_IOCTL_GET_CLOSE_STATUS _IOR(AKMIO, 0x07, int)
|
||||
#define ECS_IOCTL_GET_DELAY _IOR(AKMIO, 0x08, long long int[AKM_NUM_SENSORS])
|
||||
#define ECS_IOCTL_GET_LAYOUT _IOR(AKMIO, 0x09, char)
|
||||
#define ECS_IOCTL_GET_OUTBIT _IOR(AKMIO, 0x0B, char)
|
||||
#define ECS_IOCTL_RESET _IO(AKMIO, 0x0C)
|
||||
#define ECS_IOCTL_GET_ACCEL _IOR(AKMIO, 0x30, short[3])
|
||||
|
||||
struct akm8963_platform_data {
|
||||
char layout;
|
||||
char outbit;
|
||||
int gpio_DRDY;
|
||||
int gpio_RST;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user