On Tue, 9 Feb 2010, Hans Verkuil wrote: > > > On Mon, 8 Feb 2010, Mauro Carvalho Chehab wrote: > > > >> 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. > > > > Well, we can move it up to v4l core. Should it get any more complicated > > than adding > > > > ret = pm_runtime_resume(&vdev->dev); > > if (ret < 0 && ret != -ENOSYS) > > return ret; > > > > to v4l2_open() and > > > > pm_runtime_suspend(&vdev->dev); > > > > to v4l2_release()? > > My apologies if I say something stupid as I know little about pm: are you > assuming here that streaming only happens on one device node? That may be > true for soc-camera, but other devices can have multiple streaming nodes > (video, vbi, mpeg, etc). So the call to v4l2_release does not necessarily > mean that streaming has stopped. Of course you're right, and it concerns not only multiple streaming modes, but simple cases of multiple openings of one node. I was too fast to transfer the implementation from soc-camera to v4l2 - in soc-camera I'm counting opens and closes and only calling pm hooks on first open and last close. So, if we want to put it in v4l-core, we'd have to do something similar, I presume. Thanks Guennadi --- Guennadi Liakhovetski, Ph.D. Freelance Open-Source Software Developer http://www.open-technology.de/ -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html