From 0e7187a98eda0cfbdb86437810bd7fae47948b1c Mon Sep 17 00:00:00 2001 From: "lw@rock-chips.com" Date: Tue, 20 Dec 2011 19:29:30 +0800 Subject: [PATCH] td8801:modify gsensor event value --- arch/arm/mach-rk29/board-rk29-td8801_v2.c | 4 ++-- drivers/input/gsensor/bma023.c | 20 +++++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-rk29/board-rk29-td8801_v2.c b/arch/arm/mach-rk29/board-rk29-td8801_v2.c index 1ed581dfa676..7ea58e57da23 100755 --- a/arch/arm/mach-rk29/board-rk29-td8801_v2.c +++ b/arch/arm/mach-rk29/board-rk29-td8801_v2.c @@ -700,8 +700,8 @@ static struct akm8975_platform_data akm8975_info = }, { - {-1, 0, 0 }, - {0, -1, 0 }, + {1, 0, 0 }, + {0, 1, 0 }, {0, 0, 1 }, }, diff --git a/drivers/input/gsensor/bma023.c b/drivers/input/gsensor/bma023.c index fe2ab2ecd02c..4fe4f4979d60 100755 --- a/drivers/input/gsensor/bma023.c +++ b/drivers/input/gsensor/bma023.c @@ -461,12 +461,14 @@ static void bma150_work_func(struct work_struct *work) y = acc.y; z = acc.z; } - input_report_abs(bma150->input, ABS_X, x); - input_report_abs(bma150->input, ABS_Y, y); - input_report_abs(bma150->input, ABS_Z, z); + input_report_abs(bma150->input, ABS_X, x<<2); + input_report_abs(bma150->input, ABS_Y, y<<2); + input_report_abs(bma150->input, ABS_Z, z<<2); input_sync(bma150->input); mutex_lock(&bma150->value_mutex); - bma150->value = acc; + bma150->value.x = x; + bma150->value.y = y; + bma150->value.z = z; mutex_unlock(&bma150->value_mutex); DBG("bma150_work_func acc.x=%d,acc.y=%d,acc.z=%d\n",acc.x,acc.y,acc.z); schedule_delayed_work(&bma150->work, delay); @@ -811,11 +813,11 @@ static long bma023_ioctl( struct file *file, unsigned int cmd, unsigned long arg case BMA_IOCTL_GETDATA: mutex_lock(&bma150->value_mutex); if(abs(sense_data.x-bma150->value.x)>10)//·À¶¶¶¯ - sense_data.x=(bma150->value.x*1000)>>8; - if(abs(sense_data.y+(bma150->value.z))>10)//·À¶¶¶¯ - sense_data.y=(bma150->value.z*1000)>>8; - if(abs(sense_data.z+(bma150->value.y))>10)//·À¶¶¶¯ - sense_data.z=(bma150->value.y*1000)>>8; + sense_data.x=bma150->value.x<<2; + if(abs(sense_data.y-(bma150->value.y))>10)//·À¶¶¶¯ + sense_data.y=bma150->value.y<<2; + if(abs(sense_data.z-(bma150->value.z))>10)//·À¶¶¶¯ + sense_data.z=bma150->value.z<<2; //bma150->value = acc; mutex_unlock(&bma150->value_mutex); -- 2.34.1