public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/2] Allow UVC devices to remain runtime-suspended when sleeping
@ 2015-04-17 15:24 Tomeu Vizoso
  2015-04-17 15:24 ` [PATCH v3 2/2] [media] uvcvideo: Remain runtime-suspended at sleeps Tomeu Vizoso
  0 siblings, 1 reply; 5+ messages in thread
From: Tomeu Vizoso @ 2015-04-17 15:24 UTC (permalink / raw)
  To: linux-pm
  Cc: Laurent Pinchart, Dmitry Torokhov, Alan Stern, Tomeu Vizoso,
	Greg Kroah-Hartman, Len Brown, linux-kernel, linux-media,
	Mauro Carvalho Chehab, Pavel Machek, Rafael J. Wysocki

v3:	* Add a new power.force_direct_complete to let devices express that it's
	safe to let them be runtime-suspended at system sleep regardless of the state
	of their descendants

v2:	* Let creators of the input device to decide whether it should remain
	runtime suspended when the system goes into a sleep state
	* Don't enable PM runtime on all evdev handlers
	* Cope with another wrong wakeup setting in usb_dev_prepare

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").

Thanks,

Tomeu

Tomeu Vizoso (2):
  PM / sleep: Let devices force direct_complete
  [media] uvcvideo: Remain runtime-suspended at sleeps

 drivers/base/power/main.c          | 13 +++++++++----
 drivers/media/usb/uvc/uvc_driver.c |  2 ++
 include/linux/pm.h                 |  1 +
 3 files changed, 12 insertions(+), 4 deletions(-)

-- 
2.3.5


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] [media] uvcvideo: Remain runtime-suspended at sleeps
  2015-04-17 15:24 [PATCH v3 0/2] Allow UVC devices to remain runtime-suspended when sleeping Tomeu Vizoso
@ 2015-04-17 15:24 ` Tomeu Vizoso
  2015-04-17 17:32   ` Alan Stern
  0 siblings, 1 reply; 5+ messages in thread
From: Tomeu Vizoso @ 2015-04-17 15:24 UTC (permalink / raw)
  To: linux-pm
  Cc: Laurent Pinchart, Dmitry Torokhov, Alan Stern, Tomeu Vizoso,
	Mauro Carvalho Chehab, linux-media, linux-kernel

When the system goes to sleep and afterwards resumes, a significant
amount of time is spent suspending and resuming devices that were
already runtime-suspended.

By setting the power.force_direct_complete flag, the PM core will ignore
the state of descendant devices and the device will be let in
runtime-suspend.

Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
---
 drivers/media/usb/uvc/uvc_driver.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 5970dd6..ae75a70 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1945,6 +1945,8 @@ static int uvc_probe(struct usb_interface *intf,
 			"supported.\n", ret);
 	}
 
+	intf->dev.parent->power.force_direct_complete = true;
+
 	uvc_trace(UVC_TRACE_PROBE, "UVC device initialized.\n");
 	usb_enable_autosuspend(udev);
 	return 0;
-- 
2.3.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] [media] uvcvideo: Remain runtime-suspended at sleeps
  2015-04-17 15:24 ` [PATCH v3 2/2] [media] uvcvideo: Remain runtime-suspended at sleeps Tomeu Vizoso
@ 2015-04-17 17:32   ` Alan Stern
  2015-04-20  7:11     ` Tomeu Vizoso
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Stern @ 2015-04-17 17:32 UTC (permalink / raw)
  To: Tomeu Vizoso
  Cc: linux-pm, Laurent Pinchart, Dmitry Torokhov,
	Mauro Carvalho Chehab, linux-media, linux-kernel

On Fri, 17 Apr 2015, Tomeu Vizoso wrote:

> When the system goes to sleep and afterwards resumes, a significant
> amount of time is spent suspending and resuming devices that were
> already runtime-suspended.
> 
> By setting the power.force_direct_complete flag, the PM core will ignore
> the state of descendant devices and the device will be let in
> runtime-suspend.
> 
> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> ---
>  drivers/media/usb/uvc/uvc_driver.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
> index 5970dd6..ae75a70 100644
> --- a/drivers/media/usb/uvc/uvc_driver.c
> +++ b/drivers/media/usb/uvc/uvc_driver.c
> @@ -1945,6 +1945,8 @@ static int uvc_probe(struct usb_interface *intf,
>  			"supported.\n", ret);
>  	}
>  
> +	intf->dev.parent->power.force_direct_complete = true;

This seems wrong.  The uvc driver is bound to intf, not to intf's
parent.  So it would be okay for the driver to set
intf->dev.power.force_direct_complete, but it's wrong to set
intf->dev.parent->power.force_direct_complete.

Alan Stern


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 2/2] [media] uvcvideo: Remain runtime-suspended at sleeps
  2015-04-17 17:32   ` Alan Stern
@ 2015-04-20  7:11     ` Tomeu Vizoso
  2015-11-09 21:23       ` Laurent Pinchart
  0 siblings, 1 reply; 5+ messages in thread
From: Tomeu Vizoso @ 2015-04-20  7:11 UTC (permalink / raw)
  To: Alan Stern
  Cc: linux-pm@vger.kernel.org, Laurent Pinchart, Dmitry Torokhov,
	Mauro Carvalho Chehab, linux-media, linux-kernel@vger.kernel.org

On 17 April 2015 at 19:32, Alan Stern <stern@rowland.harvard.edu> wrote:
> On Fri, 17 Apr 2015, Tomeu Vizoso wrote:
>
>> When the system goes to sleep and afterwards resumes, a significant
>> amount of time is spent suspending and resuming devices that were
>> already runtime-suspended.
>>
>> By setting the power.force_direct_complete flag, the PM core will ignore
>> the state of descendant devices and the device will be let in
>> runtime-suspend.
>>
>> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
>> ---
>>  drivers/media/usb/uvc/uvc_driver.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
>> index 5970dd6..ae75a70 100644
>> --- a/drivers/media/usb/uvc/uvc_driver.c
>> +++ b/drivers/media/usb/uvc/uvc_driver.c
>> @@ -1945,6 +1945,8 @@ static int uvc_probe(struct usb_interface *intf,
>>                       "supported.\n", ret);
>>       }
>>
>> +     intf->dev.parent->power.force_direct_complete = true;
>
> This seems wrong.  The uvc driver is bound to intf, not to intf's
> parent.  So it would be okay for the driver to set
> intf->dev.power.force_direct_complete, but it's wrong to set
> intf->dev.parent->power.force_direct_complete.

Agreed.

Thanks,

Tomeu

> Alan Stern
>
> --
> 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

* Re: [PATCH v3 2/2] [media] uvcvideo: Remain runtime-suspended at sleeps
  2015-04-20  7:11     ` Tomeu Vizoso
@ 2015-11-09 21:23       ` Laurent Pinchart
  0 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2015-11-09 21:23 UTC (permalink / raw)
  To: Tomeu Vizoso
  Cc: Alan Stern, linux-pm@vger.kernel.org, Dmitry Torokhov,
	Mauro Carvalho Chehab, linux-media, linux-kernel@vger.kernel.org

Hi Tomeu,

On Monday 20 April 2015 09:11:36 Tomeu Vizoso wrote:
> On 17 April 2015 at 19:32, Alan Stern <stern@rowland.harvard.edu> wrote:
> > On Fri, 17 Apr 2015, Tomeu Vizoso wrote:
> >> When the system goes to sleep and afterwards resumes, a significant
> >> amount of time is spent suspending and resuming devices that were
> >> already runtime-suspended.
> >> 
> >> By setting the power.force_direct_complete flag, the PM core will ignore
> >> the state of descendant devices and the device will be let in
> >> runtime-suspend.
> >> 
> >> Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
> >> ---
> >> 
> >>  drivers/media/usb/uvc/uvc_driver.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >> 
> >> diff --git a/drivers/media/usb/uvc/uvc_driver.c
> >> b/drivers/media/usb/uvc/uvc_driver.c index 5970dd6..ae75a70 100644
> >> --- a/drivers/media/usb/uvc/uvc_driver.c
> >> +++ b/drivers/media/usb/uvc/uvc_driver.c
> >> @@ -1945,6 +1945,8 @@ static int uvc_probe(struct usb_interface *intf,
> >> 
> >>                       "supported.\n", ret);
> >>       
> >>       }
> >> 
> >> +     intf->dev.parent->power.force_direct_complete = true;
> > 
> > This seems wrong.  The uvc driver is bound to intf, not to intf's
> > parent.  So it would be okay for the driver to set
> > intf->dev.power.force_direct_complete, but it's wrong to set
> > intf->dev.parent->power.force_direct_complete.
> 
> Agreed.

Do you plan to resubmit this patch series with the above fix ? I know you've 
had a hard time trying to find an approach that could get accepted, but please 
rest assured that your work on the uvcvideo driver is appreciated.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-11-09 21:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-17 15:24 [PATCH v3 0/2] Allow UVC devices to remain runtime-suspended when sleeping Tomeu Vizoso
2015-04-17 15:24 ` [PATCH v3 2/2] [media] uvcvideo: Remain runtime-suspended at sleeps Tomeu Vizoso
2015-04-17 17:32   ` Alan Stern
2015-04-20  7:11     ` Tomeu Vizoso
2015-11-09 21:23       ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox