diff options
author | Oliver Neukum <oliver@neukum.org> | 2008-12-17 09:38:03 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2009-03-25 12:57:57 -0400 |
commit | 0361a28d3f9a4315a100c7b37ba0b55cfe15fe07 (patch) | |
tree | 2aa33c5325118e68ce8691a009c5fb30ffdea68c /include/linux/hid.h | |
parent | 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff) |
HID: autosuspend support for USB HID
This uses the USB busy mechanism for aggessive autosuspend of USB
HID devices. It autosuspends all opened devices supporting remote wakeup
after a timeout unless
- output is being done to the device
- a key is being held down (remote wakeup isn't triggered upon key release)
- LED(s) are lit
- hiddev is opened
As in the current driver closed devices will be autosuspended even if they
don't support remote wakeup.
The patch is quite large because output to devices is done in hard interrupt
context meaning a lot a queuing and locking had to be touched. The LED stuff
has been solved by means of a simple counter. Additions to the generic HID code
could be avoided. In addition it now covers hidraw. It contains an embryonic
version of an API to let the generic HID code tell the lower levels which
capabilities with respect to power management are needed.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'include/linux/hid.h')
-rw-r--r-- | include/linux/hid.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/hid.h b/include/linux/hid.h index fa8ee9cef7be..6ac7795a8acc 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -603,12 +603,17 @@ struct hid_ll_driver { | |||
603 | int (*open)(struct hid_device *hdev); | 603 | int (*open)(struct hid_device *hdev); |
604 | void (*close)(struct hid_device *hdev); | 604 | void (*close)(struct hid_device *hdev); |
605 | 605 | ||
606 | int (*power)(struct hid_device *hdev, int level); | ||
607 | |||
606 | int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, | 608 | int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, |
607 | unsigned int code, int value); | 609 | unsigned int code, int value); |
608 | 610 | ||
609 | int (*parse)(struct hid_device *hdev); | 611 | int (*parse)(struct hid_device *hdev); |
610 | }; | 612 | }; |
611 | 613 | ||
614 | #define PM_HINT_FULLON 1<<5 | ||
615 | #define PM_HINT_NORMAL 1<<1 | ||
616 | |||
612 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ | 617 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ |
613 | /* We ignore a few input applications that are not widely used */ | 618 | /* We ignore a few input applications that are not widely used */ |
614 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) | 619 | #define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || (a == 0x000d0002)) |
@@ -641,6 +646,7 @@ int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int | |||
641 | void hid_output_report(struct hid_report *report, __u8 *data); | 646 | void hid_output_report(struct hid_report *report, __u8 *data); |
642 | struct hid_device *hid_allocate_device(void); | 647 | struct hid_device *hid_allocate_device(void); |
643 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); | 648 | int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); |
649 | int hid_check_keys_pressed(struct hid_device *hid); | ||
644 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); | 650 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); |
645 | 651 | ||
646 | /** | 652 | /** |