* [PATCH 0/6] Allow UVC devices to remain runtime-suspended when sleeping
@ 2015-03-31 16:14 Tomeu Vizoso
2015-03-31 16:14 ` [PATCH 3/6] Input: Implement dev_pm_ops.prepare() Tomeu Vizoso
2015-03-31 16:14 ` [PATCH 5/6] Input: evdev - Enable runtime PM of the evdev input handler Tomeu Vizoso
0 siblings, 2 replies; 5+ messages in thread
From: Tomeu Vizoso @ 2015-03-31 16:14 UTC (permalink / raw)
To: linux-pm
Cc: Tomeu Vizoso, Alan Stern, Dan Williams, Dmitry Torokhov,
Greg Kroah-Hartman, Hans Verkuil, Julius Werner, Laurent Pinchart,
linux-input, linux-kernel, linux-media, linux-usb,
Mauro Carvalho Chehab, Pratyush Anand, Rafael J. Wysocki,
Ramakrishnan Muthukrishnan, Sakari Ailus, Scot Doyle,
Sebastian Andrzej Siewior
Hi,
this series contain what I needed to do in order to have my USB webcam to not be resumed when the system resumes, reducing considerably the total time that resuming takes.
It makes use of the facility that Rafael Wysocki added in aae4518b3 ("PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily"), which requires that a devices and all its descendants opt-in by having their dev_pm_ops.prepare callback return 1, to have runtime PM enabled, and to be runtime suspended when the system goes to a sleep state.
Thanks,
Tomeu
Tomeu Vizoso (6):
[media] uvcvideo: Enable runtime PM of descendant devices
[media] v4l2-core: Implement dev_pm_ops.prepare()
Input: Implement dev_pm_ops.prepare()
[media] media-devnode: Implement dev_pm_ops.prepare callback
Input: evdev - Enable runtime PM of the evdev input handler
USB / PM: Allow USB devices to remain runtime-suspended when sleeping
drivers/input/evdev.c | 3 +++
drivers/input/input.c | 13 +++++++++++++
drivers/media/media-devnode.c | 10 ++++++++++
drivers/media/usb/uvc/uvc_driver.c | 4 ++++
drivers/media/usb/uvc/uvc_status.c | 3 +++
drivers/media/v4l2-core/v4l2-dev.c | 10 ++++++++++
drivers/usb/core/endpoint.c | 17 +++++++++++++++++
drivers/usb/core/message.c | 16 ++++++++++++++++
drivers/usb/core/port.c | 6 ++++++
drivers/usb/core/usb.c | 2 +-
10 files changed, 83 insertions(+), 1 deletion(-)
--
2.3.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/6] Input: Implement dev_pm_ops.prepare()
2015-03-31 16:14 [PATCH 0/6] Allow UVC devices to remain runtime-suspended when sleeping Tomeu Vizoso
@ 2015-03-31 16:14 ` Tomeu Vizoso
2015-03-31 16:14 ` [PATCH 5/6] Input: evdev - Enable runtime PM of the evdev input handler Tomeu Vizoso
1 sibling, 0 replies; 5+ messages in thread
From: Tomeu Vizoso @ 2015-03-31 16:14 UTC (permalink / raw)
To: linux-pm; +Cc: Tomeu Vizoso, Dmitry Torokhov, linux-input, linux-kernel
Have it return 1 in both input_dev_type and input_class (for evdev
handlers) so that input devices that are runtime-suspended won't be
suspended when the system goes to a sleep state. This can make resume
times considerably shorter because these devices don't need to be
resumed when the system is awaken.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
drivers/input/input.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/input/input.c b/drivers/input/input.c
index cc357f1..cbbd391 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -1741,12 +1741,22 @@ static int input_dev_poweroff(struct device *dev)
return 0;
}
+static int input_dev_prepare(struct device *dev)
+{
+ return 1;
+}
+
static const struct dev_pm_ops input_dev_pm_ops = {
.suspend = input_dev_suspend,
.resume = input_dev_resume,
.freeze = input_dev_freeze,
.poweroff = input_dev_poweroff,
.restore = input_dev_resume,
+ .prepare = input_dev_prepare,
+};
+
+static const struct dev_pm_ops input_class_pm_ops = {
+ .prepare = input_dev_prepare,
};
#endif /* CONFIG_PM */
@@ -1767,6 +1777,9 @@ static char *input_devnode(struct device *dev, umode_t *mode)
struct class input_class = {
.name = "input",
.devnode = input_devnode,
+#ifdef CONFIG_PM_SLEEP
+ .pm = &input_class_pm_ops,
+#endif
};
EXPORT_SYMBOL_GPL(input_class);
--
2.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 5/6] Input: evdev - Enable runtime PM of the evdev input handler
2015-03-31 16:14 [PATCH 0/6] Allow UVC devices to remain runtime-suspended when sleeping Tomeu Vizoso
2015-03-31 16:14 ` [PATCH 3/6] Input: Implement dev_pm_ops.prepare() Tomeu Vizoso
@ 2015-03-31 16:14 ` Tomeu Vizoso
2015-03-31 20:31 ` Dmitry Torokhov
1 sibling, 1 reply; 5+ messages in thread
From: Tomeu Vizoso @ 2015-03-31 16:14 UTC (permalink / raw)
To: linux-pm; +Cc: Tomeu Vizoso, Dmitry Torokhov, linux-input, linux-kernel
So ancestor devices can remain runtime-suspended when the system goes
into a sleep state, they and all of their descendant devices need to
have runtime PM enabled.
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
drivers/input/evdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index a18f41b..3d60c20 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -26,6 +26,7 @@
#include <linux/major.h>
#include <linux/device.h>
#include <linux/cdev.h>
+#include <linux/pm_runtime.h>
#include "input-compat.h"
enum evdev_clock_type {
@@ -1201,6 +1202,8 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
if (error)
goto err_cleanup_evdev;
+ pm_runtime_enable(&evdev->dev);
+
return 0;
err_cleanup_evdev:
--
2.3.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6] Input: evdev - Enable runtime PM of the evdev input handler
2015-03-31 16:14 ` [PATCH 5/6] Input: evdev - Enable runtime PM of the evdev input handler Tomeu Vizoso
@ 2015-03-31 20:31 ` Dmitry Torokhov
2015-04-03 13:03 ` Tomeu Vizoso
0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Torokhov @ 2015-03-31 20:31 UTC (permalink / raw)
To: Tomeu Vizoso; +Cc: linux-pm, linux-input, linux-kernel
On Tue, Mar 31, 2015 at 06:14:49PM +0200, Tomeu Vizoso wrote:
> So ancestor devices can remain runtime-suspended when the system goes
> into a sleep state, they and all of their descendant devices need to
> have runtime PM enabled.
I am confused. Input devices are not runtime-PM-enabled, so what
enabling this on evdev handler buys us? And what about joydev and
mousedev? Other handlers that might be attached?
The stubbing of prepare also feels wrong: we do want to suspend/resume
input devices since we want to shut off and restore their leds even if
device (keyboard) happens to be sleeping.
Thanks.
>
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
> drivers/input/evdev.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
> index a18f41b..3d60c20 100644
> --- a/drivers/input/evdev.c
> +++ b/drivers/input/evdev.c
> @@ -26,6 +26,7 @@
> #include <linux/major.h>
> #include <linux/device.h>
> #include <linux/cdev.h>
> +#include <linux/pm_runtime.h>
> #include "input-compat.h"
>
> enum evdev_clock_type {
> @@ -1201,6 +1202,8 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
> if (error)
> goto err_cleanup_evdev;
>
> + pm_runtime_enable(&evdev->dev);
> +
> return 0;
>
> err_cleanup_evdev:
> --
> 2.3.4
>
--
Dmitry
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/6] Input: evdev - Enable runtime PM of the evdev input handler
2015-03-31 20:31 ` Dmitry Torokhov
@ 2015-04-03 13:03 ` Tomeu Vizoso
0 siblings, 0 replies; 5+ messages in thread
From: Tomeu Vizoso @ 2015-04-03 13:03 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: linux-pm@vger.kernel.org, linux-input,
linux-kernel@vger.kernel.org
On 31 March 2015 at 22:31, Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> On Tue, Mar 31, 2015 at 06:14:49PM +0200, Tomeu Vizoso wrote:
>> So ancestor devices can remain runtime-suspended when the system goes
>> into a sleep state, they and all of their descendant devices need to
>> have runtime PM enabled.
>
> I am confused. Input devices are not runtime-PM-enabled, so what
> enabling this on evdev handler buys us?
The UVC driver would be enabling runtime PM for the input device that
it registers.
> And what about joydev and
> mousedev? Other handlers that might be attached?
Not sure, tbh. What I have ended up doing in v2 is descending the tree
from the UVC device and enabling runtime PM for all descendants. The
idea is that the UVC driver knows whether it should remain runtime
suspended and that its descendants should copy it.
> The stubbing of prepare also feels wrong: we do want to suspend/resume
> input devices since we want to shut off and restore their leds even if
> device (keyboard) happens to be sleeping.
Fair enough, I have introduced a flag that allows the creator of the
input device to decide that.
Thanks,
Tomeu
> Thanks.
>
>>
>> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
>> ---
>> drivers/input/evdev.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
>> index a18f41b..3d60c20 100644
>> --- a/drivers/input/evdev.c
>> +++ b/drivers/input/evdev.c
>> @@ -26,6 +26,7 @@
>> #include <linux/major.h>
>> #include <linux/device.h>
>> #include <linux/cdev.h>
>> +#include <linux/pm_runtime.h>
>> #include "input-compat.h"
>>
>> enum evdev_clock_type {
>> @@ -1201,6 +1202,8 @@ static int evdev_connect(struct input_handler *handler, struct input_dev *dev,
>> if (error)
>> goto err_cleanup_evdev;
>>
>> + pm_runtime_enable(&evdev->dev);
>> +
>> return 0;
>>
>> err_cleanup_evdev:
>> --
>> 2.3.4
>>
>
> --
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-04-03 13:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 16:14 [PATCH 0/6] Allow UVC devices to remain runtime-suspended when sleeping Tomeu Vizoso
2015-03-31 16:14 ` [PATCH 3/6] Input: Implement dev_pm_ops.prepare() Tomeu Vizoso
2015-03-31 16:14 ` [PATCH 5/6] Input: evdev - Enable runtime PM of the evdev input handler Tomeu Vizoso
2015-03-31 20:31 ` Dmitry Torokhov
2015-04-03 13:03 ` Tomeu Vizoso
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).