summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorArve Hjønnevåg <arve@android.com>2009-07-08 21:32:06 -0700
committerArve Hjønnevåg <arve@android.com>2009-07-24 16:18:29 -0700
commit198ba7ab3227c06d9ac2b7b90d6b9119ebeac36d (patch)
tree409f754cea839e88d1ac0b64c8a3f1c7016894dc /drivers/input
parent75240fa23c3493988227b90edf622eddb2e125dd (diff)
Input: synaptics_i2c_rmi: Add support for panels with has-no-relative-data property.
Signed-off-by: Arve Hjønnevåg <arve@android.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/synaptics_i2c_rmi.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/input/touchscreen/synaptics_i2c_rmi.c b/drivers/input/touchscreen/synaptics_i2c_rmi.c
index b08c36cc3345..4ad4cc9cfec3 100644
--- a/drivers/input/touchscreen/synaptics_i2c_rmi.c
+++ b/drivers/input/touchscreen/synaptics_i2c_rmi.c
@@ -31,6 +31,7 @@ struct synaptics_ts_data {
struct i2c_client *client;
struct input_dev *input_dev;
int use_irq;
+ bool has_relative_report;
struct hrtimer timer;
struct work_struct work;
uint16_t max[2];
@@ -83,6 +84,7 @@ static void synaptics_ts_work_func(struct work_struct *work)
uint8_t start_reg;
uint8_t buf[15];
struct synaptics_ts_data *ts = container_of(work, struct synaptics_ts_data, work);
+ int buf_len = ts->has_relative_report ? 15 : 13;
msg[0].addr = ts->client->addr;
msg[0].flags = 0;
@@ -91,7 +93,7 @@ static void synaptics_ts_work_func(struct work_struct *work)
start_reg = 0x00;
msg[1].addr = ts->client->addr;
msg[1].flags = I2C_M_RD;
- msg[1].len = sizeof(buf);
+ msg[1].len = buf_len;
msg[1].buf = buf;
/* printk("synaptics_ts_work_func\n"); */
@@ -107,7 +109,7 @@ static void synaptics_ts_work_func(struct work_struct *work)
/* buf[4], buf[5], buf[6], buf[7], */
/* buf[8], buf[9], buf[10], buf[11], */
/* buf[12], buf[13], buf[14], ret); */
- if ((buf[14] & 0xc0) != 0x40) {
+ if ((buf[buf_len - 1] & 0xc0) != 0x40) {
printk(KERN_WARNING "synaptics_ts_work_func:"
" bad read %x %x %x %x %x %x %x %x %x"
" %x %x %x %x %x %x, ret %d\n",
@@ -121,7 +123,7 @@ static void synaptics_ts_work_func(struct work_struct *work)
continue;
}
bad_data = 0;
- if ((buf[14] & 1) == 0) {
+ if ((buf[buf_len - 1] & 1) == 0) {
/* printk("read %d coordinates\n", i); */
break;
} else {
@@ -392,6 +394,13 @@ static int synaptics_ts_probe(
printk(KERN_ERR "i2c_smbus_write_byte_data failed for page select\n");
goto err_detect_failed;
}
+ ret = i2c_smbus_read_word_data(ts->client, 0x02);
+ if (ret < 0) {
+ printk(KERN_ERR "i2c_smbus_read_word_data failed\n");
+ goto err_detect_failed;
+ }
+ ts->has_relative_report = !(ret & 0x100);
+ printk(KERN_INFO "synaptics_ts_probe: Sensor properties %x\n", ret);
ret = i2c_smbus_read_word_data(ts->client, 0x04);
if (ret < 0) {
printk(KERN_ERR "i2c_smbus_read_word_data failed\n");