modified gsensor for it50
authorswj <swj@rock-chips.com>
Tue, 14 Sep 2010 10:23:01 +0000 (03:23 -0700)
committerswj <swj@rock-chips.com>
Tue, 14 Sep 2010 10:23:01 +0000 (03:23 -0700)
arch/arm/mach-rk2818/board-infoit50.c [changed mode: 0644->0755]
arch/arm/mach-rk2818/board-infosdk.c
arch/arm/mach-rk2818/board-raho.c
arch/arm/mach-rk2818/include/mach/board.h [changed mode: 0644->0755]
drivers/input/gsensor/mma7660.c

old mode 100644 (file)
new mode 100755 (executable)
index 2b1a8e6..8f7ccf0
@@ -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,
 };
 
 /*****************************************************************************************
index 2cb2f0e5bfb05d0bcc10611f3cf48f4157a8789f..80b7e5bfb27783e836661cd87a58a907df5a9922 100755 (executable)
@@ -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,
 };
 
 /*****************************************************************************************
index c11ab16033c63cd3a2671b3f5307fb8bac13b009..f574e11f729dee136d44006c4707b98bffb84569 100755 (executable)
@@ -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,
 };
 
 /*****************************************************************************************
old mode 100644 (file)
new mode 100755 (executable)
index 98e24ac..c2ecd57
@@ -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*/
index a0c26b0f686db9f080164f902124978ebc68361f..4ca9a8c55117615457dee5153ccee63f4d0b4679 100755 (executable)
@@ -27,6 +27,7 @@
 #include <linux/freezer.h>
 #include <linux/mma7660.h>
 #include <mach/gpio.h>
+#include <mach/board.h> 
 #ifdef CONFIG_ANDROID_POWER
 #include <linux/android_power.h>
 #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;