From: Oliver Neukum <oliver@neukum.org>
To: linux-input@vger.kernel.org
Cc: Jiri Kosina <jikos@jikos.cz>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
David Brownell <david-b@pacbell.net>,
Alan Stern <stern@rowland.harvard.edu>,
"Rafael J. Wysocki" <rjw@sisk.pl>, Jiri Slaby <jslaby@suse.cz>,
linux-pm@vger.kernel.org
Subject: proposal on runtime power management in hid
Date: Thu, 30 Oct 2008 17:03:59 +0100 [thread overview]
Message-ID: <200810301704.01005.oliver@neukum.org> (raw)
Hi,
I am looking at runtime power management for usb hid devices.
There's a problem with hidraw. As we have no idea, what goes
on between a device and users of hidraw, it seems to me that
such a device should not be subject to runtime power management
without the user's explicit agreement.
But that would be only a kludge. Therefore this is my first draft of
an API to cleanly allow this.
It is based on telling drivers what capabilties a device must provide
to the system, allowing the driver to use the most aggressive runtime
power management compatible with the requirement.
Comments?
Regards
Oliver
diff --git a/include/linux/hid.h b/include/linux/hid.h
index ea80380..9b886c5 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -602,6 +602,12 @@ struct hid_driver {
* @parse: this method is called only once to parse the device data,
* shouldn't allocate anything to not leak memory
*/
+
+#define HID_POWER_LEVEL_NONE 0
+#define HID_POWER_LEVEL_WAKEUP 1
+#define HID_POWER_LEVEL_OPERATING 2
+#define HID_POWER_LEVEL_ON 3
+
struct hid_ll_driver {
int (*start)(struct hid_device *hdev);
void (*stop)(struct hid_device *hdev);
@@ -613,6 +619,7 @@ struct hid_ll_driver {
unsigned int code, int value);
int (*parse)(struct hid_device *hdev);
+ int (*pctrl)(struct hid_device *hdev, int level);
};
/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
next reply other threads:[~2008-10-30 16:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-30 16:03 Oliver Neukum [this message]
2008-10-30 17:01 ` proposal on runtime power management in hid Alan Stern
2008-10-30 23:17 ` Jiri Kosina
2008-10-31 9:26 ` Oliver Neukum
[not found] ` <d7e40be30810311553s579db3abiea69be2c2f30cf4e@mail.gmail.com>
2008-10-31 23:59 ` Oliver Neukum
2008-11-01 18:30 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200810301704.01005.oliver@neukum.org \
--to=oliver@neukum.org \
--cc=david-b@pacbell.net \
--cc=dmitry.torokhov@gmail.com \
--cc=jikos@jikos.cz \
--cc=jslaby@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=stern@rowland.harvard.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).