aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2014-04-01 13:05:09 -0400
committerJiri Kosina <jkosina@suse.cz>2014-04-01 13:05:09 -0400
commitad295b6d5739ab24880a31be403bbc8fab62e177 (patch)
treecd760a18bcfa6e59b8b63fc71e333ba394b1cd9c /include/linux
parentba04a57b4acd05a764471b2accd02000f6641881 (diff)
parentc3d77fab51f40821de91a744e4b514e9e4e76a7c (diff)
Merge branch 'for-3.15/hid-core-ll-transport-cleanup' into for-linus
Conflicts: drivers/hid/hid-ids.h drivers/hid/hid-sony.c drivers/hid/i2c-hid/i2c-hid.c
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hid.h65
1 files changed, 54 insertions, 11 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 003cc8e89831..01a90b8d53bb 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -287,6 +287,8 @@ struct hid_item {
287#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100 287#define HID_QUIRK_NO_EMPTY_INPUT 0x00000100
288#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200 288#define HID_QUIRK_NO_INIT_INPUT_REPORTS 0x00000200
289#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000 289#define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
290#define HID_QUIRK_SKIP_OUTPUT_REPORT_ID 0x00020000
291#define HID_QUIRK_NO_OUTPUT_REPORTS_ON_INTR_EP 0x00040000
290#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000 292#define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
291#define HID_QUIRK_NO_INIT_REPORTS 0x20000000 293#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
292#define HID_QUIRK_NO_IGNORE 0x40000000 294#define HID_QUIRK_NO_IGNORE 0x40000000
@@ -508,12 +510,6 @@ struct hid_device { /* device report descriptor */
508 struct hid_usage *, __s32); 510 struct hid_usage *, __s32);
509 void (*hiddev_report_event) (struct hid_device *, struct hid_report *); 511 void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
510 512
511 /* handler for raw input (Get_Report) data, used by hidraw */
512 int (*hid_get_raw_report) (struct hid_device *, unsigned char, __u8 *, size_t, unsigned char);
513
514 /* handler for raw output data, used by hidraw */
515 int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
516
517 /* debugging support via debugfs */ 513 /* debugging support via debugfs */
518 unsigned short debug; 514 unsigned short debug;
519 struct dentry *debug_dir; 515 struct dentry *debug_dir;
@@ -675,11 +671,12 @@ struct hid_driver {
675 * @stop: called on remove 671 * @stop: called on remove
676 * @open: called by input layer on open 672 * @open: called by input layer on open
677 * @close: called by input layer on close 673 * @close: called by input layer on close
678 * @hidinput_input_event: event input event (e.g. ff or leds)
679 * @parse: this method is called only once to parse the device data, 674 * @parse: this method is called only once to parse the device data,
680 * shouldn't allocate anything to not leak memory 675 * shouldn't allocate anything to not leak memory
681 * @request: send report request to device (e.g. feature report) 676 * @request: send report request to device (e.g. feature report)
682 * @wait: wait for buffered io to complete (send/recv reports) 677 * @wait: wait for buffered io to complete (send/recv reports)
678 * @raw_request: send raw report request to device (e.g. feature report)
679 * @output_report: send output report to device
683 * @idle: send idle request to device 680 * @idle: send idle request to device
684 */ 681 */
685struct hid_ll_driver { 682struct hid_ll_driver {
@@ -691,9 +688,6 @@ struct hid_ll_driver {
691 688
692 int (*power)(struct hid_device *hdev, int level); 689 int (*power)(struct hid_device *hdev, int level);
693 690
694 int (*hidinput_input_event) (struct input_dev *idev, unsigned int type,
695 unsigned int code, int value);
696
697 int (*parse)(struct hid_device *hdev); 691 int (*parse)(struct hid_device *hdev);
698 692
699 void (*request)(struct hid_device *hdev, 693 void (*request)(struct hid_device *hdev,
@@ -758,6 +752,7 @@ struct hid_field *hidinput_get_led_field(struct hid_device *hid);
758unsigned int hidinput_count_leds(struct hid_device *hid); 752unsigned int hidinput_count_leds(struct hid_device *hid);
759__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code); 753__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
760void hid_output_report(struct hid_report *report, __u8 *data); 754void hid_output_report(struct hid_report *report, __u8 *data);
755void __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype);
761u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags); 756u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
762struct hid_device *hid_allocate_device(void); 757struct hid_device *hid_allocate_device(void);
763struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id); 758struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@ -970,7 +965,55 @@ static inline void hid_hw_request(struct hid_device *hdev,
970 struct hid_report *report, int reqtype) 965 struct hid_report *report, int reqtype)
971{ 966{
972 if (hdev->ll_driver->request) 967 if (hdev->ll_driver->request)
973 hdev->ll_driver->request(hdev, report, reqtype); 968 return hdev->ll_driver->request(hdev, report, reqtype);
969
970 __hid_request(hdev, report, reqtype);
971}
972
973/**
974 * hid_hw_raw_request - send report request to device
975 *
976 * @hdev: hid device
977 * @reportnum: report ID
978 * @buf: in/out data to transfer
979 * @len: length of buf
980 * @rtype: HID report type
981 * @reqtype: HID_REQ_GET_REPORT or HID_REQ_SET_REPORT
982 *
983 * @return: count of data transfered, negative if error
984 *
985 * Same behavior as hid_hw_request, but with raw buffers instead.
986 */
987static inline int hid_hw_raw_request(struct hid_device *hdev,
988 unsigned char reportnum, __u8 *buf,
989 size_t len, unsigned char rtype, int reqtype)
990{
991 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
992 return -EINVAL;
993
994 return hdev->ll_driver->raw_request(hdev, reportnum, buf, len,
995 rtype, reqtype);
996}
997
998/**
999 * hid_hw_output_report - send output report to device
1000 *
1001 * @hdev: hid device
1002 * @buf: raw data to transfer
1003 * @len: length of buf
1004 *
1005 * @return: count of data transfered, negative if error
1006 */
1007static inline int hid_hw_output_report(struct hid_device *hdev, __u8 *buf,
1008 size_t len)
1009{
1010 if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
1011 return -EINVAL;
1012
1013 if (hdev->ll_driver->output_report)
1014 return hdev->ll_driver->output_report(hdev, buf, len);
1015
1016 return -ENOSYS;
974} 1017}
975 1018
976/** 1019/**