diff options
author | Andrew Duggan <aduggan@synaptics.com> | 2014-12-08 18:02:00 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-12-12 05:14:55 -0500 |
commit | cabd9b5f1fc3fc2261bce2e0399767b59c84bb7b (patch) | |
tree | 9ea1f07d7f20f6be1d22d7a3f930b5bc2ba59c2e /drivers/hid | |
parent | 8414947a2018a98cf3adc975dc279f41ba30ab11 (diff) |
HID: rmi: The address of query8 must be calculated based on which query registers are present
If a touchpad does not report relative data then query 6 will not be present and the address
of query 8 will be one less. This patches calculates the location of query 8 instead of
hardcoding the offset.
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-rmi.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/hid/hid-rmi.c b/drivers/hid/hid-rmi.c index a994477bd25a..b51200fe2f33 100644 --- a/drivers/hid/hid-rmi.c +++ b/drivers/hid/hid-rmi.c | |||
@@ -632,17 +632,6 @@ static int rmi_populate_f11(struct hid_device *hdev) | |||
632 | has_rel = !!(buf[0] & BIT(3)); | 632 | has_rel = !!(buf[0] & BIT(3)); |
633 | has_gestures = !!(buf[0] & BIT(5)); | 633 | has_gestures = !!(buf[0] & BIT(5)); |
634 | 634 | ||
635 | if (has_gestures) { | ||
636 | /* query 8 to find out if query 10 exists */ | ||
637 | ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf); | ||
638 | if (ret) { | ||
639 | hid_err(hdev, "can not read gesture information: %d.\n", | ||
640 | ret); | ||
641 | return ret; | ||
642 | } | ||
643 | has_query10 = !!(buf[0] & BIT(2)); | ||
644 | } | ||
645 | |||
646 | /* | 635 | /* |
647 | * At least 4 queries are guaranteed to be present in F11 | 636 | * At least 4 queries are guaranteed to be present in F11 |
648 | * +1 for query 5 which is present since absolute events are | 637 | * +1 for query 5 which is present since absolute events are |
@@ -653,8 +642,19 @@ static int rmi_populate_f11(struct hid_device *hdev) | |||
653 | if (has_rel) | 642 | if (has_rel) |
654 | ++query_offset; /* query 6 is present */ | 643 | ++query_offset; /* query 6 is present */ |
655 | 644 | ||
656 | if (has_gestures) | 645 | if (has_gestures) { |
646 | /* query 8 to find out if query 10 exists */ | ||
647 | ret = rmi_read(hdev, | ||
648 | data->f11.query_base_addr + query_offset + 1, buf); | ||
649 | if (ret) { | ||
650 | hid_err(hdev, "can not read gesture information: %d.\n", | ||
651 | ret); | ||
652 | return ret; | ||
653 | } | ||
654 | has_query10 = !!(buf[0] & BIT(2)); | ||
655 | |||
657 | query_offset += 2; /* query 7 and 8 are present */ | 656 | query_offset += 2; /* query 7 and 8 are present */ |
657 | } | ||
658 | 658 | ||
659 | if (has_query9) | 659 | if (has_query9) |
660 | ++query_offset; | 660 | ++query_offset; |