On Fri, Apr 19, 2013 at 5:58 AM, Hans Verkuil <hverkuil@xxxxxxxxx> wrote: > So perhaps this can be solved with two generic controls: > > bool CID_POWER_OFF_AT_LAST_CLOSE > int CID_POWER_OFF_DELAY (unit: seconds) > > If POWER_OFF_AT_LAST_CLOSE is false, then you never power off. If it is true, > then power off after a given delay. If the delay == 0 then power off immediately. > > Drivers can decide on proper default values. But radio devices must start > with CID_POWER_OFF_AT_LAST_CLOSE set to false for compatibility reasons. > > I don't have time for the next few weeks to investigate this further, so if > you are interested... Bear in mind that deferred shutdown opens a huge set of problems with hybrid tuners. We already have many, many race known conditions related to closing V4L and then immediately opening the corresponding DVB device (and closing DVB then immediately opening the V4L device). Without a proper framework, a change such as this will exacerbate the problem. These race conditions typically result in completely undefined behavior, as you either having both sides of the device powered up at the same time, or you have the second half powered up and then conflicting commands are received to power it down because of deferred commands for the first half to go to sleep. It's an absolute mess. And please don't forget that this isn't just about a shared tuner chip - it's about the state of video decoders and demodulators as well. You cannot just introduce simple locking in tuner-core and hope that resolves the problem. Devin -- Devin J. Heitmueller - Kernel Labs http://www.kernellabs.com -- 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