History log of /drivers/media/video/pvrusb2/pvrusb2-context.h
Revision Date Author Comments
d417f711b9180c4851cfdc19db030878918eac88 26-Jul-2008 Mike Isely <isely@pobox.com> V4L/DVB (8475): pvrusb2: Cosmetic macro fix (benign)

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
64723b301846636accbfb1539ebda0835f683a72 25-May-2008 Mike Isely <isely@pobox.com> V4L/DVB (7936): pvrusb2: Remove svn Id keyword from all sources

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
1cb03b76d09d20accfa5c1664c16ba6566f539a0 21-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7719): pvrusb2: Implement input selection enforcement

In the pvrusb2 driver, different interfaces (e.g. V4L, DVB) have

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
e5be15c63804e05b5a94197524023702a259e308 07-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7711): pvrusb2: Fix race on module unload

The pvrusb2 driver - for basically forever - was not enforcing a
proper module tear-down. Kernel threads are used inside the driver
and all must be gone before the module can be safely removed. This
changeset reimplements a chunk of pvrusb2-context.c to enforce this
correctly. Unfortunately this is not a simple fix. The new
implementation also cuts back on kernel thread usage; instead of there
being 1 control thread per instance now it's just 1 control thread
shared by all instances. (By dropping to a single thread then the
module exit function can block on its shutdown and the thread itself
can monitor and cleanly shut down all of the other instances first.)

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
794b16072e00d0a40a8c773dd4319fb1e460a632 22-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7321): pvrusb2: Rework context handling and initialization

This change significantly rearranges pvr2_context level initialization
and operation:

1. A new kernel thread is set up for management of the context.

2. Destruction of the pvr2_context instance is moved into the kernel
thread. No other context is able to remove the instance; doing
this simplifies lock handling.

3. The callback into pvrusb2-main, which is used to trigger
initialization of each interface, is now issued from this kernel
thread. Previously it had been indirectly issued out of the work
queue thread in pvr2_hdw, which led to deadlock issues if the
interface needed to change a control setting (which in turn
requires dispatch of another work queue entry).

4. Callbacks into the interfaces (via the pvr2_channel structure) are
now issued strictly from this thread. The net result of this is
that such callback functions can now also safely operate driver
controls without deadlocking the work queue. (At the moment this
is not actually a problem, but I'm anticipating issues with this in
the future).

5. There is no longer any need for anyone to enter / exit the
pvr2_context structure. Implementation of the kernel thread here
allows this all to be internal now, simplifying other logic.

6. A very very longstanding issue involving a mutex deadlock between
the pvrusb2 driver and v4l should now be solved. The deadlock
involved the pvr2_context mutex and a globals-protecting mutex in
v4l. During initialization the driver would take the pvr2_context
mutex first then the v4l2 interface would register with v4l and
implicitly take the v4l mutex. Later when v4l would call back into
the driver, the two mutexes could possibly be taken in the opposite
order, a situation that can lead to deadlock. In practice this
really wasn't an issue unless a v4l app tried to start VERY early
after the driver appeared. However it still needed to be solved,
and with the use of the kernel thread relieving need for
pvr2_context mutex, the problem should be finally solved.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
ee9ca4b24f03b4da04cae1a24ea445ceb8a1f3d2 22-Apr-2008 Mike Isely <isely@pobox.com> V4L/DVB (7318): pvrusb2: Remove dead code

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
681c739944018d80dbcf7f19997eba97676c7116 26-Nov-2007 Mike Isely <isely@pobox.com> V4L/DVB (6691): pvrusb2: Rework pipeline state control

This is a new implementation for video pipeline control within the
pvrusb2 driver. Actual start/stop of the pipeline is moved to the
driver's kernel thread. Pipeline stages are controlled autonomously
based on surrounding pipeline or application control state. Kernel
thread management is also cleaned up and moved into the internal
control structure of the driver, solving a set up / tear down race
along the way. Better failure recovery is implemented with this new
control strategy. Also with this change comes better control of the
cx23416 encoder, building on additional information learned about the
peculiarities of controlling this part (this information was the
original trigger for this rework). With this change, overall encoder
stability should be considerably improved. Yes, this is a large
change for this driver, but due to the nature of the feature being
worked on, the changes are fairly pervasive and would be difficult to
break into smaller pieces with any semblence of step-wise stability.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
62f5fdace7774a45e75e4d651237e7e1e8f05327 28-Dec-2006 Mike Isely <isely@pobox.com> V4L/DVB (5052): Pvrusb2: Remove stream claiming hack from /dev/radio

Trying to temporarily check that the stream is not claimed during open
of the radio device is at best a race condition. What's to stop
another app from claiming the stream anyway the instant after the
check is done? The implementation for this was dicey anyway. So it's
removed. The only "price" for this is that if /dev/radioX is opened
while streaming video, then the video stream is just going to switch
to radio mode anyway. If a user does this, he gets what he expects...

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
99cfdf5cc6dbe0bd748d810953874d4e08051a9f 28-Dec-2006 Pantelis Koukousoulas <pakt223@freemail.gr> V4L/DVB (5038): Pvrusb2: Implement stream claim checking function

Add (and expose) a new function, pvr2_channel_check_stream_no_lock(), in
pvrusb2-context.c. This is hopefully the last V4L2 interface related patch
to change anything outside pvrusb2-v4l2.c.

We need this to implement the open() for the radio device. The reason is
that within the *enter_context() section of open() we need to ensure nobody
is streaming and if we cannot, we should cleanup after ourselves and return
-EBUSY. We cannot just use claim_stream() because:

1) That would cause a deadlock trying to re-acquire the context lock
2) We only need to ensure that nobody is streaming. We don't need to
actually acquire the stream.

Again, this is a kinda ugly patch. Feel free to improve.

Signed-off-by: Pantelis Koukousoulas <pakt223@freemail.gr>
Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
d855497edbfbf9e19a17f4a1154bca69cb4bd9ba 27-Jun-2006 Mike Isely <isely@isely.net> V4L/DVB (4228a): pvrusb2 to kernel 2.6.18

Implement V4L2 driver for the Hauppauge PVR USB2 TV tuner.

The Hauppauge PVR USB2 is a USB connected TV tuner with an embedded
cx23416 hardware MPEG2 encoder. There are two major variants of this
device; this driver handles both. Any V4L2 application which
understands MPEG2 video stream data should be able to work with this
device.

Signed-off-by: Mike Isely <isely@pobox.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>