diff options
Diffstat (limited to 'include/linux/hid.h')
| -rw-r--r-- | include/linux/hid.h | 86 |
1 files changed, 78 insertions, 8 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index bb0f56f5c01e..42f7e2fb501f 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
| @@ -402,7 +402,7 @@ struct hid_field { | |||
| 402 | __u16 dpad; /* dpad input code */ | 402 | __u16 dpad; /* dpad input code */ |
| 403 | }; | 403 | }; |
| 404 | 404 | ||
| 405 | #define HID_MAX_FIELDS 64 | 405 | #define HID_MAX_FIELDS 128 |
| 406 | 406 | ||
| 407 | struct hid_report { | 407 | struct hid_report { |
| 408 | struct list_head list; | 408 | struct list_head list; |
| @@ -504,6 +504,9 @@ struct hid_device { /* device report descriptor */ | |||
| 504 | struct hid_usage *, __s32); | 504 | struct hid_usage *, __s32); |
| 505 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); | 505 | void (*hiddev_report_event) (struct hid_device *, struct hid_report *); |
| 506 | 506 | ||
| 507 | /* handler for raw input (Get_Report) data, used by hidraw */ | ||
| 508 | int (*hid_get_raw_report) (struct hid_device *, unsigned char, __u8 *, size_t, unsigned char); | ||
| 509 | |||
| 507 | /* handler for raw output data, used by hidraw */ | 510 | /* handler for raw output data, used by hidraw */ |
| 508 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); | 511 | int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char); |
| 509 | 512 | ||
| @@ -593,6 +596,7 @@ struct hid_usage_id { | |||
| 593 | * @report_fixup: called before report descriptor parsing (NULL means nop) | 596 | * @report_fixup: called before report descriptor parsing (NULL means nop) |
| 594 | * @input_mapping: invoked on input registering before mapping an usage | 597 | * @input_mapping: invoked on input registering before mapping an usage |
| 595 | * @input_mapped: invoked on input registering after mapping an usage | 598 | * @input_mapped: invoked on input registering after mapping an usage |
| 599 | * @feature_mapping: invoked on feature registering | ||
| 596 | * @suspend: invoked on suspend (NULL means nop) | 600 | * @suspend: invoked on suspend (NULL means nop) |
| 597 | * @resume: invoked on resume if device was not reset (NULL means nop) | 601 | * @resume: invoked on resume if device was not reset (NULL means nop) |
| 598 | * @reset_resume: invoked on resume if device was reset (NULL means nop) | 602 | * @reset_resume: invoked on resume if device was reset (NULL means nop) |
| @@ -636,6 +640,9 @@ struct hid_driver { | |||
| 636 | int (*input_mapped)(struct hid_device *hdev, | 640 | int (*input_mapped)(struct hid_device *hdev, |
| 637 | struct hid_input *hidinput, struct hid_field *field, | 641 | struct hid_input *hidinput, struct hid_field *field, |
| 638 | struct hid_usage *usage, unsigned long **bit, int *max); | 642 | struct hid_usage *usage, unsigned long **bit, int *max); |
| 643 | void (*feature_mapping)(struct hid_device *hdev, | ||
| 644 | struct hid_field *field, | ||
| 645 | struct hid_usage *usage); | ||
| 639 | #ifdef CONFIG_PM | 646 | #ifdef CONFIG_PM |
| 640 | int (*suspend)(struct hid_device *hdev, pm_message_t message); | 647 | int (*suspend)(struct hid_device *hdev, pm_message_t message); |
| 641 | int (*resume)(struct hid_device *hdev); | 648 | int (*resume)(struct hid_device *hdev); |
| @@ -792,7 +799,7 @@ static inline int __must_check hid_parse(struct hid_device *hdev) | |||
| 792 | * | 799 | * |
| 793 | * Call this in probe function *after* hid_parse. This will setup HW buffers | 800 | * Call this in probe function *after* hid_parse. This will setup HW buffers |
| 794 | * and start the device (if not deffered to device open). hid_hw_stop must be | 801 | * and start the device (if not deffered to device open). hid_hw_stop must be |
| 795 | * called if this was successfull. | 802 | * called if this was successful. |
| 796 | */ | 803 | */ |
| 797 | static inline int __must_check hid_hw_start(struct hid_device *hdev, | 804 | static inline int __must_check hid_hw_start(struct hid_device *hdev, |
| 798 | unsigned int connect_mask) | 805 | unsigned int connect_mask) |
| @@ -820,6 +827,49 @@ static inline void hid_hw_stop(struct hid_device *hdev) | |||
| 820 | hdev->ll_driver->stop(hdev); | 827 | hdev->ll_driver->stop(hdev); |
| 821 | } | 828 | } |
| 822 | 829 | ||
| 830 | /** | ||
| 831 | * hid_hw_open - signal underlaying HW to start delivering events | ||
| 832 | * | ||
| 833 | * @hdev: hid device | ||
| 834 | * | ||
| 835 | * Tell underlying HW to start delivering events from the device. | ||
| 836 | * This function should be called sometime after successful call | ||
| 837 | * to hid_hiw_start(). | ||
| 838 | */ | ||
| 839 | static inline int __must_check hid_hw_open(struct hid_device *hdev) | ||
| 840 | { | ||
| 841 | return hdev->ll_driver->open(hdev); | ||
| 842 | } | ||
| 843 | |||
| 844 | /** | ||
| 845 | * hid_hw_close - signal underlaying HW to stop delivering events | ||
| 846 | * | ||
| 847 | * @hdev: hid device | ||
| 848 | * | ||
| 849 | * This function indicates that we are not interested in the events | ||
| 850 | * from this device anymore. Delivery of events may or may not stop, | ||
| 851 | * depending on the number of users still outstanding. | ||
| 852 | */ | ||
| 853 | static inline void hid_hw_close(struct hid_device *hdev) | ||
| 854 | { | ||
| 855 | hdev->ll_driver->close(hdev); | ||
| 856 | } | ||
| 857 | |||
| 858 | /** | ||
| 859 | * hid_hw_power - requests underlying HW to go into given power mode | ||
| 860 | * | ||
| 861 | * @hdev: hid device | ||
| 862 | * @level: requested power level (one of %PM_HINT_* defines) | ||
| 863 | * | ||
| 864 | * This function requests underlying hardware to enter requested power | ||
| 865 | * mode. | ||
| 866 | */ | ||
| 867 | |||
| 868 | static inline int hid_hw_power(struct hid_device *hdev, int level) | ||
| 869 | { | ||
| 870 | return hdev->ll_driver->power ? hdev->ll_driver->power(hdev, level) : 0; | ||
| 871 | } | ||
| 872 | |||
| 823 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, | 873 | void hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, |
| 824 | int interrupt); | 874 | int interrupt); |
| 825 | 875 | ||
| @@ -838,12 +888,32 @@ int hid_pidff_init(struct hid_device *hid); | |||
| 838 | #define hid_pidff_init NULL | 888 | #define hid_pidff_init NULL |
| 839 | #endif | 889 | #endif |
| 840 | 890 | ||
| 841 | #define dbg_hid(format, arg...) if (hid_debug) \ | 891 | #define dbg_hid(format, arg...) \ |
| 842 | printk(KERN_DEBUG "%s: " format ,\ | 892 | do { \ |
| 843 | __FILE__ , ## arg) | 893 | if (hid_debug) \ |
| 844 | #define err_hid(format, arg...) printk(KERN_ERR "%s: " format "\n" , \ | 894 | printk(KERN_DEBUG "%s: " format, __FILE__, ##arg); \ |
| 845 | __FILE__ , ## arg) | 895 | } while (0) |
| 846 | #endif /* HID_FF */ | 896 | |
| 897 | #define hid_printk(level, hid, fmt, arg...) \ | ||
| 898 | dev_printk(level, &(hid)->dev, fmt, ##arg) | ||
| 899 | #define hid_emerg(hid, fmt, arg...) \ | ||
| 900 | dev_emerg(&(hid)->dev, fmt, ##arg) | ||
| 901 | #define hid_crit(hid, fmt, arg...) \ | ||
| 902 | dev_crit(&(hid)->dev, fmt, ##arg) | ||
| 903 | #define hid_alert(hid, fmt, arg...) \ | ||
| 904 | dev_alert(&(hid)->dev, fmt, ##arg) | ||
| 905 | #define hid_err(hid, fmt, arg...) \ | ||
| 906 | dev_err(&(hid)->dev, fmt, ##arg) | ||
| 907 | #define hid_notice(hid, fmt, arg...) \ | ||
| 908 | dev_notice(&(hid)->dev, fmt, ##arg) | ||
| 909 | #define hid_warn(hid, fmt, arg...) \ | ||
| 910 | dev_warn(&(hid)->dev, fmt, ##arg) | ||
| 911 | #define hid_info(hid, fmt, arg...) \ | ||
| 912 | dev_info(&(hid)->dev, fmt, ##arg) | ||
| 913 | #define hid_dbg(hid, fmt, arg...) \ | ||
| 914 | dev_dbg(&(hid)->dev, fmt, ##arg) | ||
| 915 | |||
| 916 | #endif /* __KERNEL__ */ | ||
| 847 | 917 | ||
| 848 | #endif | 918 | #endif |
| 849 | 919 | ||
