diff options
author | Andrew Duggan <aduggan@synaptics.com> | 2014-07-11 17:35:50 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-07-29 05:08:41 -0400 |
commit | 9e2c327ee85e37264a1e04109efc7b97844afd0b (patch) | |
tree | de71da9343b40314c4f47c6da009959e5ac8d4a5 /drivers/hid | |
parent | 4c2f503aade27ebf12f5733a583d711f99dc5ec1 (diff) |
HID: rmi: make compututation of the address of Query 12 more careful
There are additional queries which are optional and may not be present
depending on the configuration of the firmware. Knowing which queries are
present is needed to properly compute the address of Query 12 and all
subsequent queries. Additional bits in Query 1 are used to indicate the
presence of these optional queries.
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-rmi.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index 578bbe65902b..3221a95ed97c 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c | |||
@@ -549,10 +549,12 @@ static int rmi_populate_f11(struct hid_device *hdev) | |||
549 | u8 buf[20]; | 549 | u8 buf[20]; |
550 | int ret; | 550 | int ret; |
551 | bool has_query9; | 551 | bool has_query9; |
552 | bool has_query10; | 552 | bool has_query10 = false; |
553 | bool has_query11; | 553 | bool has_query11; |
554 | bool has_query12; | 554 | bool has_query12; |
555 | bool has_physical_props; | 555 | bool has_physical_props; |
556 | bool has_gestures; | ||
557 | bool has_rel; | ||
556 | unsigned x_size, y_size; | 558 | unsigned x_size, y_size; |
557 | u16 query12_offset; | 559 | u16 query12_offset; |
558 | 560 | ||
@@ -589,19 +591,32 @@ static int rmi_populate_f11(struct hid_device *hdev) | |||
589 | return -ENODEV; | 591 | return -ENODEV; |
590 | } | 592 | } |
591 | 593 | ||
592 | /* query 8 to find out if query 10 exists */ | 594 | has_rel = !!(buf[0] & BIT(3)); |
593 | ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf); | 595 | has_gestures = !!(buf[0] & BIT(5)); |
594 | if (ret) { | 596 | |
595 | hid_err(hdev, "can not read gesture information: %d.\n", ret); | 597 | if (has_gestures) { |
596 | return ret; | 598 | /* query 8 to find out if query 10 exists */ |
599 | ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf); | ||
600 | if (ret) { | ||
601 | hid_err(hdev, "can not read gesture information: %d.\n", | ||
602 | ret); | ||
603 | return ret; | ||
604 | } | ||
605 | has_query10 = !!(buf[0] & BIT(2)); | ||
597 | } | 606 | } |
598 | has_query10 = !!(buf[0] & BIT(2)); | ||
599 | 607 | ||
600 | /* | 608 | /* |
601 | * At least 8 queries are guaranteed to be present in F11 | 609 | * At least 4 queries are guaranteed to be present in F11 |
602 | * +1 for query12. | 610 | * +1 for query 5 which is present since absolute events are |
611 | * reported and +1 for query 12. | ||
603 | */ | 612 | */ |
604 | query12_offset = 9; | 613 | query12_offset = 6; |
614 | |||
615 | if (has_rel) | ||
616 | ++query12_offset; /* query 6 is present */ | ||
617 | |||
618 | if (has_gestures) | ||
619 | query12_offset += 2; /* query 7 and 8 are present */ | ||
605 | 620 | ||
606 | if (has_query9) | 621 | if (has_query9) |
607 | ++query12_offset; | 622 | ++query12_offset; |