modified gsensor for it50

This commit is contained in:
swj
2010-09-14 03:23:01 -07:00
parent 90c9a9add9
commit ea3fa6bd5d
5 changed files with 15 additions and 3 deletions

1
arch/arm/mach-rk2818/board-infoit50.c Normal file → Executable file
View File

@@ -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,
};
/*****************************************************************************************

View File

@@ -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,
};
/*****************************************************************************************

View File

@@ -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,
};
/*****************************************************************************************

1
arch/arm/mach-rk2818/include/mach/board.h Normal file → Executable file
View File

@@ -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*/

View File

@@ -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;