All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: linux-pm@lists.linux-foundation.org,
	Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: Re: [PATCH/RESEND] soc-camera: add runtime pm support for subdevices
Date: Mon, 08 Feb 2010 16:04:06 -0200	[thread overview]
Message-ID: <4B705216.7040907@redhat.com> (raw)
In-Reply-To: <Pine.LNX.4.64.1002081447020.4936@axis700.grange>

Guennadi Liakhovetski wrote:
> Hi Mauro
> 
> Thanks for your comments.
> 
> On Mon, 8 Feb 2010, Mauro Carvalho Chehab wrote:
> 
>> Guennadi Liakhovetski wrote:
>>> To save power soc-camera powers subdevices down, when they are not in use, 
>>> if this is supported by the platform. However, the V4L standard dictates, 
>>> that video nodes shall preserve configuration between uses. This requires 
>>> runtime power management, which is implemented by this patch. It allows 
>>> subdevice drivers to specify their runtime power-management methods, by 
>>> assigning a type to the video device.
>> It seems a great idea to me. For sure we need some sort of power management
>> control.
> 
> Agree;)
> 
>>> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
>>> ---
>>>
>>> I've posted this patch to linux-media earlier, but I'd also like to get 
>>> comments on linux-pm, sorry to linux-media falks for a duplicate. To 
>>> explain a bit - soc_camera.c is a management module, that binds video 
>>> interfaces on SoCs and sensor drivers. The calls, that I am adding to 
>>> soc_camera.c shall save and restore sensor registers before they are 
>>> powered down and after they are powered up.
>>>
>>> diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c
>>> index 6b3fbcc..53201f3 100644
>>> --- a/drivers/media/video/soc_camera.c
>>> +++ b/drivers/media/video/soc_camera.c
>>> @@ -24,6 +24,7 @@
>>>  #include <linux/mutex.h>
>>>  #include <linux/module.h>
>>>  #include <linux/platform_device.h>
>>> +#include <linux/pm_runtime.h>
>>>  #include <linux/vmalloc.h>
>>
>> Hmm... wouldn't it be better to enable it at the subsystem level? We may for 
>> example call ?
>> The subsystem can call vidioc_streamoff() at suspend and vidioc_streamon() at
>> resume, if the device were streaming during suspend. We may add another ops to
>> the struct for the drivers/subdrivers that needs additional care.
>>
>> That's said, it shouldn't be hard to implement some routine that will save/restore
>> all registers if the device goes to power down mode. Unfortunately, very few
>> devices successfully recovers from hibernation if streaming. One good example
>> is saa7134, that even disables/re-enables IR IRQ's during suspend/resume.
> 
> To clarify a bit - this patch implements not static PM, but dynamic 
> (runtime) power-management. 

Ok.

> In this case it means, we are trying to save 
> power while the system is running, but we know, that the sensor is not 
> needed. Specifically, as long as no application is holding the video 
> device open. And this information is only available at the bridge driver 
> (soc-camera core) level - there is no subdev operation for open and close 
> calls, so, subdevices do not "know" whether they are in use or not. So, 
> only saving / restoring registers when streaming is not enough. Static PM 
> will also be interesting - as it has been mentioned before, we will have 
> to be careful, because sensors "sit" on two busses - i2c and video. So, 
> you have to resume after both are up and suspend before the first of them 
> goes down... So, that will be a different exciting topic;)

In fact, on all drivers, there are devices that needs to be turn on only when
streaming is happening: sensors, analog TV/audio demods, digital demods. Also,
a few devices (for example: TV tuners) could eventually be on power off when
no device is opened.

As the V4L core knows when this is happening (due to
open/close/poll/streamon/reqbuf/qbuf/dqbuf hooks, I think the runtime management 
can happen at V4L core level.

> 
> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/


-- 

Cheers,
Mauro

  parent reply	other threads:[~2010-02-08 18:04 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-08  9:50 [PATCH/RESEND] soc-camera: add runtime pm support for subdevices Guennadi Liakhovetski
2010-02-08 13:34 ` Mauro Carvalho Chehab
2010-02-08 13:34 ` Mauro Carvalho Chehab
2010-02-08 14:06   ` Guennadi Liakhovetski
2010-02-08 14:06   ` Guennadi Liakhovetski
2010-02-08 18:04     ` Mauro Carvalho Chehab
2010-02-08 18:04     ` Mauro Carvalho Chehab [this message]
2010-02-09 10:27       ` Guennadi Liakhovetski
2010-02-09 10:27       ` Guennadi Liakhovetski
2010-02-09 11:22         ` Hans Verkuil
2010-02-09 11:22         ` Hans Verkuil
2010-02-09 12:02           ` Guennadi Liakhovetski
2010-02-09 12:02           ` Guennadi Liakhovetski
2010-02-09 12:13             ` Hans Verkuil
2010-02-09 12:44               ` Guennadi Liakhovetski
2010-02-09 12:44               ` Guennadi Liakhovetski
2010-02-09 13:02               ` Mauro Carvalho Chehab
2010-02-09 13:02               ` Mauro Carvalho Chehab
2010-02-09 14:37                 ` Hans Verkuil
2010-02-09 14:37                 ` Hans Verkuil
2010-02-09 15:10                   ` Mauro Carvalho Chehab
2010-02-09 15:10                   ` Mauro Carvalho Chehab
2010-02-09 15:50                   ` Guennadi Liakhovetski
2010-02-09 15:50                   ` Guennadi Liakhovetski
2010-02-09 12:13             ` Hans Verkuil
2010-02-08 22:10 ` [linux-pm] " Rafael J. Wysocki
2010-02-09  8:12   ` Guennadi Liakhovetski
2010-02-09  8:12   ` Guennadi Liakhovetski
2010-02-08 22:10 ` Rafael J. Wysocki
2010-02-09 15:18 ` Alan Stern
2010-02-09 15:18 ` [linux-pm] " Alan Stern
2010-02-09 15:42   ` Guennadi Liakhovetski
2010-02-09 15:42   ` [linux-pm] " Guennadi Liakhovetski
2010-02-09 16:24     ` Alan Stern
2010-02-09 16:24     ` [linux-pm] " Alan Stern
  -- strict thread matches above, loose matches on Subject: below --
2010-02-08  9:50 Guennadi Liakhovetski

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=4B705216.7040907@redhat.com \
    --to=mchehab@redhat.com \
    --cc=g.liakhovetski@gmx.de \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.