linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFD] use-counting V4L2 clocks
@ 2013-09-12 19:13 Guennadi Liakhovetski
  2013-09-12 20:47 ` Sylwester Nawrocki
  2013-10-08 20:33 ` Mauro Carvalho Chehab
  0 siblings, 2 replies; 10+ messages in thread
From: Guennadi Liakhovetski @ 2013-09-12 19:13 UTC (permalink / raw)
  To: Linux Media Mailing List
  Cc: Mauro Carvalho Chehab, Laurent Pinchart, Hans Verkuil,
	Sylwester Nawrocki, Frank Schäfer

Hi all

We've got a broken driver in 3.11 and in 3.12-rc and we don't have a clear 
way to properly fix it. The problem has been originally reported and 
discussed in [1], a patch-set to fix the problem has been proposed in [2], 
which actually lead to the topic of this mail - whether or not calls to 
v4l2_clk_enable() and v4l2_clk_disable(), or respectively to s_power(1) 
and s_power(0) subdevice core operations should be balanced. Currently 
they aren't in em28xx driver, and the V4L2 clock API throws warnings on 
attempts to disable already disabled clock. Patch [3] attempted to fix 
that. So, the question is - whether to enforce balanced power on / off 
calls, or to remove the warning.

Let's try to have a look at other examples in the kernel:

1. runtime PM: pm_runtime_get*() / pm_runtime_put*() only work, if 
balanced, but no warning is issued, if the balance is broken, AFAICS.

2. clock API: clk_enable() / clk_disable() in drivers/clk/clk.c have to be 
balanced and a warning is issued, if clk_disable() is called for an 
already disabled clock.

3. regulator API: regulator_enable() / regulator_disable() have to be 
balanced. A warning is issued if regulator_disable() is called for a 
disabled regulator.

So, I think, our V4L2 clock enable / disable calls should be balanced, and 
to enforce that a warning is helpful. Other opinions?

Thanks
Guennadi

[1] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/68028
[2] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/68510
[3] http://thread.gmane.org/gmane.linux.drivers.video-input-infrastructure/68864

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

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

end of thread, other threads:[~2013-10-19 21:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-12 19:13 [RFD] use-counting V4L2 clocks Guennadi Liakhovetski
2013-09-12 20:47 ` Sylwester Nawrocki
2013-10-08 17:13   ` Guennadi Liakhovetski
2013-10-08 20:33 ` Mauro Carvalho Chehab
2013-10-08 21:57   ` Guennadi Liakhovetski
2013-10-10  0:06     ` Laurent Pinchart
2013-10-15  8:05       ` Guennadi Liakhovetski
2013-10-15 11:45         ` Laurent Pinchart
2013-10-15 21:37           ` Guennadi Liakhovetski
2013-10-19 21:44             ` Sylwester Nawrocki

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