Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 294035
b: refs/heads/master
c: 0439166
h: refs/heads/master
i:
  294033: 9451646
  294031: 9308c42
v: v3
  • Loading branch information
Christopher Hudson authored and Dmitry Torokhov committed Mar 17, 2012
1 parent fd2cc70 commit fb89db7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 104594b01ce750c91a19e9f1d8fe6b24ea8f9a59
refs/heads/master: 043916608c4b309e98a1650520ed4e88ec5e9123
22 changes: 17 additions & 5 deletions trunk/drivers/input/misc/kxtj9.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@
#define PC1_ON (1 << 7)
/* Data ready funtion enable bit: set during probe if using irq mode */
#define DRDYE (1 << 5)
/* DATA CONTROL REGISTER BITS */
#define ODR12_5F 0
#define ODR25F 1
#define ODR50F 2
#define ODR100F 3
#define ODR200F 4
#define ODR400F 5
#define ODR800F 6
/* INTERRUPT CONTROL REGISTER 1 BITS */
/* Set these during probe if using irq mode */
#define KXTJ9_IEL (1 << 3)
Expand Down Expand Up @@ -116,9 +124,13 @@ static void kxtj9_report_acceleration_data(struct kxtj9_data *tj9)
if (err < 0)
dev_err(&tj9->client->dev, "accelerometer data read failed\n");

x = le16_to_cpu(acc_data[tj9->pdata.axis_map_x]) >> tj9->shift;
y = le16_to_cpu(acc_data[tj9->pdata.axis_map_y]) >> tj9->shift;
z = le16_to_cpu(acc_data[tj9->pdata.axis_map_z]) >> tj9->shift;
x = le16_to_cpu(acc_data[tj9->pdata.axis_map_x]);
y = le16_to_cpu(acc_data[tj9->pdata.axis_map_y]);
z = le16_to_cpu(acc_data[tj9->pdata.axis_map_z]);

x >>= tj9->shift;
y >>= tj9->shift;
z >>= tj9->shift;

input_report_abs(tj9->input_dev, ABS_X, tj9->pdata.negate_x ? -x : x);
input_report_abs(tj9->input_dev, ABS_Y, tj9->pdata.negate_y ? -y : y);
Expand Down Expand Up @@ -487,7 +499,7 @@ static int __devinit kxtj9_verify(struct kxtj9_data *tj9)
goto out;
}

retval = retval != 0x06 ? -EIO : 0;
retval = (retval != 0x07 && retval != 0x08) ? -EIO : 0;

out:
kxtj9_device_power_off(tj9);
Expand Down Expand Up @@ -537,7 +549,7 @@ static int __devinit kxtj9_probe(struct i2c_client *client,
i2c_set_clientdata(client, tj9);

tj9->ctrl_reg1 = tj9->pdata.res_12bit | tj9->pdata.g_range;
tj9->data_ctrl = tj9->pdata.data_odr_init;
tj9->last_poll_interval = tj9->pdata.init_interval;

if (client->irq) {
/* If in irq mode, populate INT_CTRL_REG1 and enable DRDY. */
Expand Down
11 changes: 1 addition & 10 deletions trunk/include/linux/input/kxtj9.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

struct kxtj9_platform_data {
unsigned int min_interval; /* minimum poll interval (in milli-seconds) */
unsigned int init_interval; /* initial poll interval (in milli-seconds) */

/*
* By default, x is axis 0, y is axis 1, z is axis 2; these can be
Expand Down Expand Up @@ -52,16 +53,6 @@ struct kxtj9_platform_data {
#define KXTJ9_G_8G (1 << 4)
u8 g_range;

/* DATA_CTRL_REG: controls the output data rate of the part */
#define ODR12_5F 0
#define ODR25F 1
#define ODR50F 2
#define ODR100F 3
#define ODR200F 4
#define ODR400F 5
#define ODR800F 6
u8 data_odr_init;

int (*init)(void);
void (*exit)(void);
int (*power_on)(void);
Expand Down

0 comments on commit fb89db7

Please sign in to comment.