The patch number 13206 was added via David T.L. Wong <davidtlw...@gmail.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>

------

cx25840: add component support
Signed-Off-By: David T.L. Wong<davidtlw...@gmail.com>
Signed-Off-By: David T.L. Wong <davidtlw...@gmail.com>


---

 linux/drivers/media/video/cx25840/cx25840-core.c |   36 ++++++++++-----
 linux/include/media/cx25840.h                    |    1 
 2 files changed, 25 insertions(+), 12 deletions(-)

diff -r f6680fa8e7ec -r fa502ed00cf8 
linux/drivers/media/video/cx25840/cx25840-core.c
--- a/linux/drivers/media/video/cx25840/cx25840-core.c  Tue Oct 20 00:08:05 
2009 +0900
+++ b/linux/drivers/media/video/cx25840/cx25840-core.c  Tue Oct 20 23:13:39 
2009 +0800
@@ -735,6 +735,10 @@
        struct cx25840_state *state = to_state(i2c_get_clientdata(client));
        u8 is_composite = (vid_input >= CX25840_COMPOSITE1 &&
                           vid_input <= CX25840_COMPOSITE8);
+       u8 is_component = (vid_input & CX25840_COMPONENT_ON) ==
+                       CX25840_COMPONENT_ON;
+       int luma = vid_input & 0xf0;
+       int chroma = vid_input & 0xf00;
        u8 reg;
 
        v4l_dbg(1, cx25840_debug, client,
@@ -747,18 +751,14 @@
                reg = vid_input & 0xff;
                if ((vid_input & CX25840_SVIDEO_ON) == CX25840_SVIDEO_ON)
                        is_composite = 0;
-               else
+               else if ((vid_input & CX25840_COMPONENT_ON) == 0)
                        is_composite = 1;
 
                v4l_dbg(1, cx25840_debug, client, "mux cfg 0x%x comp=%d\n",
                        reg, is_composite);
-       } else
-       if (is_composite) {
+       } else if (is_composite) {
                reg = 0xf0 + (vid_input - CX25840_COMPOSITE1);
        } else {
-               int luma = vid_input & 0xf0;
-               int chroma = vid_input & 0xf00;
-
                if ((vid_input & ~0xff0) ||
                    luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA8 
||
                    chroma < CX25840_SVIDEO_CHROMA4 || chroma > 
CX25840_SVIDEO_CHROMA8) {
@@ -800,8 +800,11 @@
 
        cx25840_write(client, 0x103, reg);
 
-       /* Set INPUT_MODE to Composite (0) or S-Video (1) */
-       cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02);
+       /* Set INPUT_MODE to Composite, S-Video or Component */
+       if (is_component)
+               cx25840_and_or(client, 0x401, ~0x6, 0x6);
+       else
+               cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02);
 
        if (!is_cx2388x(state) && !is_cx231xx(state)) {
                /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */
@@ -812,12 +815,21 @@
                else
                        cx25840_and_or(client, 0x102, ~0x4, 0);
        } else {
-               if (is_composite)
+               /* Set DUAL_MODE_ADC2 to 1 if component*/
+               cx25840_and_or(client, 0x102, ~0x4, is_component ? 0x4 : 0x0);
+               if (is_composite) {
                        /* ADC2 input select channel 2 */
                        cx25840_and_or(client, 0x102, ~0x2, 0);
-               else
-                       /* ADC2 input select channel 3 */
-                       cx25840_and_or(client, 0x102, ~0x2, 2);
+               } else if (!is_component) {
+                       /* S-Video */
+                       if (chroma >= CX25840_SVIDEO_CHROMA7) {
+                               /* ADC2 input select channel 3 */
+                               cx25840_and_or(client, 0x102, ~0x2, 2);
+                       } else {
+                               /* ADC2 input select channel 2 */
+                               cx25840_and_or(client, 0x102, ~0x2, 0);
+                       }
+               }
        }
 
        state->vid_input = vid_input;
diff -r f6680fa8e7ec -r fa502ed00cf8 linux/include/media/cx25840.h
--- a/linux/include/media/cx25840.h     Tue Oct 20 00:08:05 2009 +0900
+++ b/linux/include/media/cx25840.h     Tue Oct 20 23:13:39 2009 +0800
@@ -84,6 +84,7 @@
        CX25840_NONE0_CH3 = 0x80000080,
        CX25840_NONE1_CH3 = 0x800000c0,
        CX25840_SVIDEO_ON = 0x80000100,
+       CX25840_COMPONENT_ON = 0x80000200,
 };
 
 enum cx25840_audio_input {


---

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

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

Reply via email to