diff options
author | Henrik Rydberg <rydberg@euromail.se> | 2013-02-25 05:31:43 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-02-25 07:26:39 -0500 |
commit | e90a6df80dc45ab53d2f4f4db297434e48c0208e (patch) | |
tree | c2758516b5a1d387ac81017de45adde6f19f622a /include/linux | |
parent | 48a732dfaa77a4dfec803aa8f248373998704f76 (diff) |
HID: Extend the interface with report requests
Some drivers send reports directly to underlying device, creating an
unwanted dependency on the underlying transport layer. This patch adds
hid_hw_request() to the interface, thereby removing usbhid from the
lion share of the drivers.
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/hid.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index e14b465b1146..261c713d4842 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -662,6 +662,7 @@ struct hid_driver { | |||
662 | * @hidinput_input_event: event input event (e.g. ff or leds) | 662 | * @hidinput_input_event: event input event (e.g. ff or leds) |
663 | * @parse: this method is called only once to parse the device data, | 663 | * @parse: this method is called only once to parse the device data, |
664 | * shouldn't allocate anything to not leak memory | 664 | * shouldn't allocate anything to not leak memory |
665 | * @request: send report request to device (e.g. feature report) | ||
665 | */ | 666 | */ |
666 | struct hid_ll_driver { | 667 | struct hid_ll_driver { |
667 | int (*start)(struct hid_device *hdev); | 668 | int (*start)(struct hid_device *hdev); |
@@ -676,6 +677,10 @@ struct hid_ll_driver { | |||
676 | unsigned int code, int value); | 677 | unsigned int code, int value); |
677 | 678 | ||
678 | int (*parse)(struct hid_device *hdev); | 679 | int (*parse)(struct hid_device *hdev); |
680 | |||
681 | void (*request)(struct hid_device *hdev, | ||
682 | struct hid_report *report, int reqtype); | ||
683 | |||
679 | }; | 684 | }; |
680 | 685 | ||
681 | #define PM_HINT_FULLON 1<<5 | 686 | #define PM_HINT_FULLON 1<<5 |
@@ -883,6 +888,21 @@ static inline int hid_hw_power(struct hid_device *hdev, int level) | |||
883 | return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; | 888 | return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; |
884 | } | 889 | } |
885 | 890 | ||
891 | |||
892 | /** | ||
893 | * hid_hw_request - send report request to device | ||
894 | * | ||
895 | * @hdev: hid device | ||
896 | * @report: report to send | ||
897 | * @reqtype: hid request type | ||
898 | */ | ||
899 | static inline void hid_hw_request(struct hid_device *hdev, | ||
900 | struct hid_report *report, int reqtype) | ||
901 | { | ||
902 | if (hdev->ll_driver->request) | ||
903 | hdev->ll_driver->request(hdev, report, reqtype); | ||
904 | } | ||
905 | |||
886 | int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | 906 | int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, |
887 | int interrupt); | 907 | int interrupt); |
888 | 908 | ||