diff options
Diffstat (limited to 'drivers/input/misc/kxtj9.c')
-rw-r--r-- | drivers/input/misc/kxtj9.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/drivers/input/misc/kxtj9.c b/drivers/input/misc/kxtj9.c index 783597a9a64a..f46139f19ff1 100644 --- a/drivers/input/misc/kxtj9.c +++ b/drivers/input/misc/kxtj9.c | |||
@@ -41,6 +41,14 @@ | |||
41 | #define PC1_ON (1 << 7) | 41 | #define PC1_ON (1 << 7) |
42 | /* Data ready funtion enable bit: set during probe if using irq mode */ | 42 | /* Data ready funtion enable bit: set during probe if using irq mode */ |
43 | #define DRDYE (1 << 5) | 43 | #define DRDYE (1 << 5) |
44 | /* DATA CONTROL REGISTER BITS */ | ||
45 | #define ODR12_5F 0 | ||
46 | #define ODR25F 1 | ||
47 | #define ODR50F 2 | ||
48 | #define ODR100F 3 | ||
49 | #define ODR200F 4 | ||
50 | #define ODR400F 5 | ||
51 | #define ODR800F 6 | ||
44 | /* INTERRUPT CONTROL REGISTER 1 BITS */ | 52 | /* INTERRUPT CONTROL REGISTER 1 BITS */ |
45 | /* Set these during probe if using irq mode */ | 53 | /* Set these during probe if using irq mode */ |
46 | #define KXTJ9_IEL (1 << 3) | 54 | #define KXTJ9_IEL (1 << 3) |
@@ -116,9 +124,13 @@ static void kxtj9_report_acceleration_data(struct kxtj9_data *tj9) | |||
116 | if (err < 0) | 124 | if (err < 0) |
117 | dev_err(&tj9->client->dev, "accelerometer data read failed\n"); | 125 | dev_err(&tj9->client->dev, "accelerometer data read failed\n"); |
118 | 126 | ||
119 | x = le16_to_cpu(acc_data[tj9->pdata.axis_map_x]) >> tj9->shift; | 127 | x = le16_to_cpu(acc_data[tj9->pdata.axis_map_x]); |
120 | y = le16_to_cpu(acc_data[tj9->pdata.axis_map_y]) >> tj9->shift; | 128 | y = le16_to_cpu(acc_data[tj9->pdata.axis_map_y]); |
121 | z = le16_to_cpu(acc_data[tj9->pdata.axis_map_z]) >> tj9->shift; | 129 | z = le16_to_cpu(acc_data[tj9->pdata.axis_map_z]); |
130 | |||
131 | x >>= tj9->shift; | ||
132 | y >>= tj9->shift; | ||
133 | z >>= tj9->shift; | ||
122 | 134 | ||
123 | input_report_abs(tj9->input_dev, ABS_X, tj9->pdata.negate_x ? -x : x); | 135 | input_report_abs(tj9->input_dev, ABS_X, tj9->pdata.negate_x ? -x : x); |
124 | input_report_abs(tj9->input_dev, ABS_Y, tj9->pdata.negate_y ? -y : y); | 136 | input_report_abs(tj9->input_dev, ABS_Y, tj9->pdata.negate_y ? -y : y); |
@@ -487,7 +499,7 @@ static int __devinit kxtj9_verify(struct kxtj9_data *tj9) | |||
487 | goto out; | 499 | goto out; |
488 | } | 500 | } |
489 | 501 | ||
490 | retval = retval != 0x06 ? -EIO : 0; | 502 | retval = (retval != 0x07 && retval != 0x08) ? -EIO : 0; |
491 | 503 | ||
492 | out: | 504 | out: |
493 | kxtj9_device_power_off(tj9); | 505 | kxtj9_device_power_off(tj9); |
@@ -537,7 +549,7 @@ static int __devinit kxtj9_probe(struct i2c_client *client, | |||
537 | i2c_set_clientdata(client, tj9); | 549 | i2c_set_clientdata(client, tj9); |
538 | 550 | ||
539 | tj9->ctrl_reg1 = tj9->pdata.res_12bit | tj9->pdata.g_range; | 551 | tj9->ctrl_reg1 = tj9->pdata.res_12bit | tj9->pdata.g_range; |
540 | tj9->data_ctrl = tj9->pdata.data_odr_init; | 552 | tj9->last_poll_interval = tj9->pdata.init_interval; |
541 | 553 | ||
542 | if (client->irq) { | 554 | if (client->irq) { |
543 | /* If in irq mode, populate INT_CTRL_REG1 and enable DRDY. */ | 555 | /* If in irq mode, populate INT_CTRL_REG1 and enable DRDY. */ |
@@ -655,17 +667,7 @@ static struct i2c_driver kxtj9_driver = { | |||
655 | .id_table = kxtj9_id, | 667 | .id_table = kxtj9_id, |
656 | }; | 668 | }; |
657 | 669 | ||
658 | static int __init kxtj9_init(void) | 670 | module_i2c_driver(kxtj9_driver); |
659 | { | ||
660 | return i2c_add_driver(&kxtj9_driver); | ||
661 | } | ||
662 | module_init(kxtj9_init); | ||
663 | |||
664 | static void __exit kxtj9_exit(void) | ||
665 | { | ||
666 | i2c_del_driver(&kxtj9_driver); | ||
667 | } | ||
668 | module_exit(kxtj9_exit); | ||
669 | 671 | ||
670 | MODULE_DESCRIPTION("KXTJ9 accelerometer driver"); | 672 | MODULE_DESCRIPTION("KXTJ9 accelerometer driver"); |
671 | MODULE_AUTHOR("Chris Hudson <chudson@kionix.com>"); | 673 | MODULE_AUTHOR("Chris Hudson <chudson@kionix.com>"); |