The patch number 10253 was added via Mauro Carvalho Chehab <mche...@redhat.com>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        Linux Media Mailing List <linux-me...@vger.kernel.org>

------

From: Mauro Carvalho Chehab  <mche...@redhat.com>
merge: http://www.linuxtv.org/hg/~hverkuil/v4l-dvb-cx25840


Priority: normal

Signed-off-by: Mauro Carvalho Chehab <mche...@redhat.com>


---

 linux/Documentation/video4linux/v4l2-framework.txt |    6 ++++
 linux/drivers/media/video/cx25840/cx25840-core.c   |   18 +++++++++++++
 linux/include/media/cx25840.h                      |   12 ++++++++
 3 files changed, 36 insertions(+)

diff -r aedffebec498 -r 2913087bd96e 
linux/Documentation/video4linux/v4l2-framework.txt
--- a/linux/Documentation/video4linux/v4l2-framework.txt        Sun Jan 18 
23:37:59 2009 +0100
+++ b/linux/Documentation/video4linux/v4l2-framework.txt        Sun Jan 18 
22:28:51 2009 -0200
@@ -340,6 +340,12 @@ is called. This will unregister the sub-
 is called. This will unregister the sub-device from the bridge driver. It is
 safe to call this even if the sub-device was never registered.
 
+You need to do this because when the bridge driver destroys the i2c adapter
+the remove() callbacks are called of the i2c devices on that adapter.
+After that the corresponding v4l2_subdev structures are invalid, so they
+have to be unregistered first. Calling v4l2_device_unregister_subdev(sd)
+from the remove() callback ensures that this is always done correctly.
+
 
 The bridge driver also has some helper functions it can use:
 
diff -r aedffebec498 -r 2913087bd96e 
linux/drivers/media/video/cx25840/cx25840-core.c
--- a/linux/drivers/media/video/cx25840/cx25840-core.c  Sun Jan 18 23:37:59 
2009 +0100
+++ b/linux/drivers/media/video/cx25840/cx25840-core.c  Sun Jan 18 22:28:51 
2009 -0200
@@ -1120,6 +1120,16 @@ static void log_audio_status(struct i2c_
 
 /* ----------------------------------------------------------------------- */
 
+/* This init operation must be called to load the driver's firmware.
+   Without this the audio standard detection will fail and you will
+   only get mono.
+
+   Since loading the firmware is often problematic when the driver is
+   compiled into the kernel I recommend postponing calling this function
+   until the first open of the video device. Another reason for
+   postponing it is that loading this firmware takes a long time (seconds)
+   due to the slow i2c bus speed. So it will speed up the boot process if
+   you can avoid loading the fw as long as the video device isn't used.  */
 static int cx25840_init(struct v4l2_subdev *sd, u32 val)
 {
        struct cx25840_state *state = to_state(sd);
@@ -1401,6 +1411,14 @@ static int cx25840_log_status(struct v4l
 
 static int cx25840_command(struct i2c_client *client, unsigned cmd, void *arg)
 {
+       /* ignore this command */
+       if (cmd == TUNER_SET_TYPE_ADDR)
+               return 0;
+
+       /* Old-style drivers rely on initialization on first use, so
+          call the init whenever a command is issued to this driver.
+          New-style drivers using v4l2_subdev should call init explicitly. */
+       cx25840_init(i2c_get_clientdata(client), 0);
        return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg);
 }
 
diff -r aedffebec498 -r 2913087bd96e linux/include/media/cx25840.h
--- a/linux/include/media/cx25840.h     Sun Jan 18 23:37:59 2009 +0100
+++ b/linux/include/media/cx25840.h     Sun Jan 18 22:28:51 2009 -0200
@@ -20,6 +20,18 @@
 
 #ifndef _CX25840_H_
 #define _CX25840_H_
+
+/* Note that the cx25840 driver requires that the bridge driver calls the
+   v4l2_subdev's init operation in order to load the driver's firmware.
+   Without this the audio standard detection will fail and you will
+   only get mono.
+
+   Since loading the firmware is often problematic when the driver is
+   compiled into the kernel I recommend postponing calling this function
+   until the first open of the video device. Another reason for
+   postponing it is that loading this firmware takes a long time (seconds)
+   due to the slow i2c bus speed. So it will speed up the boot process if
+   you can avoid loading the fw as long as the video device isn't used. */
 
 enum cx25840_video_input {
        /* Composite video inputs In1-In8 */


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/2913087bd96e84042b0eb5aeaced8b1c182bb4d8

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to