From ea3fa6bd5d90eabb09f3aa87daf84d35e510ca01 Mon Sep 17 00:00:00 2001 From: swj Date: Tue, 14 Sep 2010 03:23:01 -0700 Subject: [PATCH] modified gsensor for it50 --- arch/arm/mach-rk2818/board-infoit50.c | 1 + arch/arm/mach-rk2818/board-infosdk.c | 1 + arch/arm/mach-rk2818/board-raho.c | 1 + arch/arm/mach-rk2818/include/mach/board.h | 1 + drivers/input/gsensor/mma7660.c | 14 +++++++++++--- 5 files changed, 15 insertions(+), 3 deletions(-) mode change 100644 => 100755 arch/arm/mach-rk2818/board-infoit50.c mode change 100644 => 100755 arch/arm/mach-rk2818/include/mach/board.h diff --git a/arch/arm/mach-rk2818/board-infoit50.c b/arch/arm/mach-rk2818/board-infoit50.c old mode 100644 new mode 100755 index 2b1a8e66a2c3..8f7ccf0c11a5 --- a/arch/arm/mach-rk2818/board-infoit50.c +++ b/arch/arm/mach-rk2818/board-infoit50.c @@ -452,6 +452,7 @@ struct tca6424_platform_data rk2818_tca6424_data={ struct rk2818_gs_platform_data rk2818_gs_platdata = { .gsensor_irq_pin = GS_IRQ_PIN, + .swap_xy = 1, }; /***************************************************************************************** diff --git a/arch/arm/mach-rk2818/board-infosdk.c b/arch/arm/mach-rk2818/board-infosdk.c index 2cb2f0e5bfb0..80b7e5bfb277 100755 --- a/arch/arm/mach-rk2818/board-infosdk.c +++ b/arch/arm/mach-rk2818/board-infosdk.c @@ -468,6 +468,7 @@ struct tca6424_platform_data rk2818_tca6424_data={ struct rk2818_gs_platform_data rk2818_gs_platdata = { .gsensor_irq_pin = GS_IRQ_PIN, + .swap_xy = 0, }; /***************************************************************************************** diff --git a/arch/arm/mach-rk2818/board-raho.c b/arch/arm/mach-rk2818/board-raho.c index c11ab16033c6..f574e11f729d 100755 --- a/arch/arm/mach-rk2818/board-raho.c +++ b/arch/arm/mach-rk2818/board-raho.c @@ -649,6 +649,7 @@ struct lp8725_platform_data rk2818_lp8725_data={ struct rk2818_gs_platform_data rk2818_gs_platdata = { .gsensor_irq_pin = GS_IRQ_PIN, + .swap_xy = 0, }; /***************************************************************************************** diff --git a/arch/arm/mach-rk2818/include/mach/board.h b/arch/arm/mach-rk2818/include/mach/board.h old mode 100644 new mode 100755 index 98e24acf41b1..c2ecd57146b1 --- a/arch/arm/mach-rk2818/include/mach/board.h +++ b/arch/arm/mach-rk2818/include/mach/board.h @@ -184,6 +184,7 @@ struct rk2818_gs_platform_data { int (*io_init)(void); int (*io_deinit)(void); int gsensor_irq_pin; + bool swap_xy; /* swap x and y axes add swj */ }; /*serial*/ diff --git a/drivers/input/gsensor/mma7660.c b/drivers/input/gsensor/mma7660.c index a0c26b0f686d..4ca9a8c55117 100755 --- a/drivers/input/gsensor/mma7660.c +++ b/drivers/input/gsensor/mma7660.c @@ -27,6 +27,7 @@ #include #include #include +#include #ifdef CONFIG_ANDROID_POWER #include #endif @@ -234,7 +235,7 @@ static int mma7660_get_data(struct i2c_client *client) char buffer[3]; int ret; struct mma7660_axis axis; - + struct rk2818_gs_platform_data *pdata = client->dev.platform_data; do { memset(buffer, 0, 3); buffer[0] = MMA7660_REG_X_OUT; @@ -247,8 +248,14 @@ static int mma7660_get_data(struct i2c_client *client) axis.y = -mma7660_convert_to_int(buffer[MMA7660_REG_Y_OUT]); axis.z = -mma7660_convert_to_int(buffer[MMA7660_REG_Z_OUT]); - //rk28printk( "%s: ------------------mma7660_GetData axis = %d %d %d--------------\n", - // __func__, axis.x, axis.y, axis.z); + if(pdata->swap_xy) + { + axis.y = -axis.y; + swap(axis.x,axis.y); + } + + // rk28printk( "%s: ------------------mma7660_GetData axis = %d %d %d--------------\n", + // __func__, axis.x, axis.y, axis.z); //memcpy(sense_data, &axis, sizeof(axis)); mma7660_report_value(client, &axis); @@ -501,6 +508,7 @@ static int mma7660_probe(struct i2c_client *client, const struct i2c_device_id INIT_DELAYED_WORK(&mma7660->delaywork, mma7660_delaywork_func); mma7660->client = client; + //mma7660->swap_xy = i2c_set_clientdata(client, mma7660); this_client = client; -- 2.34.1