From 76f521a5ef814ad208c5861b04b7816df04d70e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=E6=9D=A8=E4=BA=91?= Date: Mon, 30 Jan 2012 18:30:13 +0800 Subject: [PATCH] alter gsensor orientation of mma8452 --- arch/arm/mach-rk29/board-rk29-ddr3sdk.c | 2 +- drivers/input/gsensor/mma8452.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c index c357c58e344f..7dc556150064 100755 --- a/arch/arm/mach-rk29/board-rk29-ddr3sdk.c +++ b/arch/arm/mach-rk29/board-rk29-ddr3sdk.c @@ -990,7 +990,7 @@ static int mma8452_init_platform_hw(void) static struct mma8452_platform_data mma8452_info = { .model= 8452, - .swap_xy = 0, + .swap_xy = 1, .init_platform_hw= mma8452_init_platform_hw, }; diff --git a/drivers/input/gsensor/mma8452.c b/drivers/input/gsensor/mma8452.c index 1b2247062026..0b3a789891bd 100755 --- a/drivers/input/gsensor/mma8452.c +++ b/drivers/input/gsensor/mma8452.c @@ -390,8 +390,9 @@ static int mma8452_get_data(struct i2c_client *client) if(pdata->swap_xy) { - axis.x = -axis.x; - swap(axis.x,axis.y); + axis.x = -x; + axis.y = z; + axis.z = -y; } mmaprintkd( "%s: ------------------mma8452_GetData axis = %d %d %d--------------\n", -- 2.34.1