diff options
author | Oliver Neukum <oliver@neukum.org> | 2008-12-17 15:38:03 +0100 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2009-03-25 17:57:57 +0100 |
commit | 0361a28d3f9a4315a100c7b37ba0b55cfe15fe07 (patch) | |
tree | 2aa33c5325118e68ce8691a009c5fb30ffdea68c /include/linux/hid.h | |
parent | 8e0ee43bc2c3e19db56a4adaa9a9b04ce885cd84 (diff) | |
download | lwn-0361a28d3f9a4315a100c7b37ba0b55cfe15fe07.tar.gz lwn-0361a28d3f9a4315a100c7b37ba0b55cfe15fe07.zip |
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 { int (*open)(struct hid_device *hdev); void (*close)(struct hid_device *hdev); + int (*power)(struct hid_device *hdev, int level); + int (*hidinput_input_event) (struct input_dev *idev, unsigned int type, unsigned int code, int value); int (*parse)(struct hid_device *hdev); }; +#define PM_HINT_FULLON 1<<5 +#define PM_HINT_NORMAL 1<<1 + /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ /* We ignore a few input applications that are not widely used */ #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 void hid_output_report(struct hid_report *report, __u8 *data); struct hid_device *hid_allocate_device(void); int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size); +int hid_check_keys_pressed(struct hid_device *hid); int hid_connect(struct hid_device *hid, unsigned int connect_mask); /** |