mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
modified gsensor for it50
This commit is contained in:
1
arch/arm/mach-rk2818/board-infoit50.c
Normal file → Executable file
1
arch/arm/mach-rk2818/board-infoit50.c
Normal file → Executable 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,
|
||||
};
|
||||
|
||||
/*****************************************************************************************
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
/*****************************************************************************************
|
||||
|
||||
@@ -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
1
arch/arm/mach-rk2818/include/mach/board.h
Normal file → Executable 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*/
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user