From f083fd3f142086148d11ad450e4d805c9b710733 Mon Sep 17 00:00:00 2001 From: "makarand.karvekar" Date: Thu, 26 Aug 2010 15:15:05 -0500 Subject: [PATCH] magnetometer: akm8975: remove accelerometer and temperature code 8975 does have accelerometer and temperature features. corrected flag values. Change-Id: Ie061bd67ab34fb2da7ddcd7c44d362bfc5016dde Signed-off-by: makarand.karvekar --- drivers/misc/akm8975.c | 63 +++++++++-------------------------------- include/linux/akm8975.h | 6 ---- 2 files changed, 14 insertions(+), 55 deletions(-) diff --git a/drivers/misc/akm8975.c b/drivers/misc/akm8975.c index 962ce4d75a94..c2c2f12b6d69 100644 --- a/drivers/misc/akm8975.c +++ b/drivers/misc/akm8975.c @@ -16,7 +16,7 @@ /* * Revised by AKM 2009/04/02 - * Revised by Motorola 2010/05/27 + * Revised by Motorola 2010/08/16 * */ @@ -36,7 +36,7 @@ #define AK8975DRV_CALL_DBG 0 #if AK8975DRV_CALL_DBG -#define FUNCDBG(msg) pr_err("%s:%s\n", __func__, msg); +#define FUNCDBG(msg) pr_info("%s:%s\n", __func__, msg); #else #define FUNCDBG(msg) #endif @@ -63,8 +63,6 @@ static DECLARE_WAIT_QUEUE_HEAD(open_wq); static atomic_t open_flag; static short m_flag; -static short a_flag; -static short t_flag; static short mv_flag; static short akmd_delay; @@ -159,18 +157,6 @@ static void akm8975_ecs_report_value(struct akm8975_data *akm, short *rbuf) input_report_abs(data->input_dev, ABS_RUDDER, rbuf[4]); } - /* Report acceleration sensor information */ - if (a_flag) { - input_report_abs(data->input_dev, ABS_X, rbuf[6]); - input_report_abs(data->input_dev, ABS_Y, rbuf[7]); - input_report_abs(data->input_dev, ABS_Z, rbuf[8]); - input_report_abs(data->input_dev, ABS_WHEEL, rbuf[5]); - } - - /* Report temperature information */ - if (t_flag) - input_report_abs(data->input_dev, ABS_THROTTLE, rbuf[3]); - if (mv_flag) { input_report_abs(data->input_dev, ABS_HAT0X, rbuf[9]); input_report_abs(data->input_dev, ABS_HAT0Y, rbuf[10]); @@ -185,10 +171,8 @@ static void akm8975_ecs_close_done(struct akm8975_data *akm) { FUNCDBG("called"); mutex_lock(&akm->flags_lock); - m_flag = 1; - a_flag = 1; - t_flag = 1; - mv_flag = 1; + m_flag = 0; + mv_flag = 0; mutex_unlock(&akm->flags_lock); } @@ -230,7 +214,6 @@ static int akm_aot_ioctl(struct inode *inode, struct file *file, switch (cmd) { case ECS_IOCTL_APP_SET_MFLAG: - case ECS_IOCTL_APP_SET_AFLAG: case ECS_IOCTL_APP_SET_MVFLAG: if (copy_from_user(&flag, argp, sizeof(flag))) return -EFAULT; @@ -248,17 +231,11 @@ static int akm_aot_ioctl(struct inode *inode, struct file *file, mutex_lock(&akm->flags_lock); switch (cmd) { case ECS_IOCTL_APP_SET_MFLAG: - m_flag = flag; + m_flag = flag; break; case ECS_IOCTL_APP_GET_MFLAG: flag = m_flag; break; - case ECS_IOCTL_APP_SET_AFLAG: - a_flag = flag; - break; - case ECS_IOCTL_APP_GET_AFLAG: - flag = a_flag; - break; case ECS_IOCTL_APP_SET_MVFLAG: mv_flag = flag; break; @@ -272,13 +249,13 @@ static int akm_aot_ioctl(struct inode *inode, struct file *file, flag = akmd_delay; break; default: + mutex_unlock(&akm->flags_lock); return -ENOTTY; } mutex_unlock(&akm->flags_lock); switch (cmd) { case ECS_IOCTL_APP_GET_MFLAG: - case ECS_IOCTL_APP_GET_AFLAG: case ECS_IOCTL_APP_GET_MVFLAG: case ECS_IOCTL_APP_GET_DELAY: if (copy_to_user(argp, &flag, sizeof(flag))) @@ -474,10 +451,8 @@ static int akm8975_init_client(struct i2c_client *client) init_waitqueue_head(&open_wq); mutex_lock(&data->flags_lock); - m_flag = 1; - a_flag = 1; - t_flag = 1; - mv_flag = 1; + m_flag = 0; + mv_flag = 0; mutex_unlock(&data->flags_lock); return 0; @@ -558,24 +533,16 @@ int akm8975_probe(struct i2c_client *client, set_bit(EV_ABS, akm->input_dev->evbit); - /* yaw */ + /* orientation: yaw */ input_set_abs_params(akm->input_dev, ABS_RX, 0, 23040, 0, 0); - /* pitch */ + /* orientation: pitch */ input_set_abs_params(akm->input_dev, ABS_RY, -11520, 11520, 0, 0); - /* roll */ + /* orientation: roll */ input_set_abs_params(akm->input_dev, ABS_RZ, -5760, 5760, 0, 0); - /* x-axis acceleration */ - input_set_abs_params(akm->input_dev, ABS_X, -5760, 5760, 0, 0); - /* y-axis acceleration */ - input_set_abs_params(akm->input_dev, ABS_Y, -5760, 5760, 0, 0); - /* z-axis acceleration */ - input_set_abs_params(akm->input_dev, ABS_Z, -5760, 5760, 0, 0); - /* temparature */ - input_set_abs_params(akm->input_dev, ABS_THROTTLE, -30, 85, 0, 0); - /* status of magnetic sensor */ + + /* status of orientation sensor */ input_set_abs_params(akm->input_dev, ABS_RUDDER, 0, 3, 0, 0); - /* status of acceleration sensor */ - input_set_abs_params(akm->input_dev, ABS_WHEEL, 0, 3, 0, 0); + /* x-axis of raw magnetic vector */ input_set_abs_params(akm->input_dev, ABS_HAT0X, -20480, 20479, 0, 0); /* y-axis of raw magnetic vector */ @@ -656,13 +623,11 @@ static struct i2c_driver akm8975_driver = { static int __init akm8975_init(void) { pr_info("AK8975 compass driver: init\n"); - FUNCDBG("AK8975 compass driver: init\n"); return i2c_add_driver(&akm8975_driver); } static void __exit akm8975_exit(void) { - FUNCDBG("AK8975 compass driver: exit\n"); i2c_del_driver(&akm8975_driver); } diff --git a/include/linux/akm8975.h b/include/linux/akm8975.h index d4d22bb57257..ef9b8d6e9aa6 100644 --- a/include/linux/akm8975.h +++ b/include/linux/akm8975.h @@ -16,8 +16,6 @@ #define AK8975_MODE_POWER_DOWN 0x00 /*! @}*/ -#define RBUFF_SIZE 8 /* Rx buffer size */ - /*! \name AK8975 register address \anchor AK8975_REG Defines a register address of the AK8975.*/ @@ -54,7 +52,6 @@ Defines a read-only address of the fuse ROM of the AK8975.*/ /* 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) @@ -63,15 +60,12 @@ Defines a read-only address of the fuse ROM of the AK8975.*/ /* 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) #endif -- 2.34.1