The patch number 8089 was added via Hans Verkuil <[EMAIL PROTECTED]>
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:
        [EMAIL PROTECTED]

------

From: Sri Deevi  <[EMAIL PROTECTED]>
cx18: add support for Conexant Raptor PAL/SECAM card


Patch provided courtesy of Conexant http://www.conexant.com.

Signed-off-by: Srinivasa Deevi <[EMAIL PROTECTED]>
Signed-off-by: Hans Verkuil <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/cx18/cx18-cards.c  |   55 +++++++++++++++++++
 linux/drivers/media/video/cx18/cx18-cards.h  |    8 ++
 linux/drivers/media/video/cx18/cx18-driver.c |    3 -
 linux/drivers/media/video/cx18/cx18-driver.h |    4 +
 linux/drivers/media/video/cx18/cx18-gpio.c   |   34 +++++++++++
 linux/drivers/media/video/cx18/cx18-gpio.h   |    1 
 linux/drivers/media/video/cx18/cx18-i2c.c    |   20 ++++++
 7 files changed, 122 insertions(+), 3 deletions(-)

diff -r 183149ba5d10 -r da2b6f1f22d9 linux/drivers/media/video/cx18/cx18-cards.c
--- a/linux/drivers/media/video/cx18/cx18-cards.c       Sat Jun 21 11:25:23 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-cards.c       Sat Jun 21 13:06:44 
2008 +0200
@@ -27,6 +27,8 @@
 #include "cx18-i2c.h"
 #include <media/cs5345.h>
 
+#define V4L2_STD_NOT_MN (V4L2_STD_PAL|V4L2_STD_SECAM)
+
 /********************** card configuration *******************************/
 
 /* usual i2c tuner addresses to probe */
@@ -219,11 +221,64 @@ static const struct cx18_card cx18_card_
        .i2c = &cx18_i2c_std,
 };
 
+/* ------------------------------------------------------------------------- */
+
+/* Conexant Raptor PAL/SECAM: note that this card is analog only! */
+
+static const struct cx18_card_pci_info cx18_pci_cnxt_raptor_pal[] = {
+       { PCI_DEVICE_ID_CX23418, CX18_PCI_ID_CONEXANT, 0x0009 },
+       { 0, 0, 0 }
+};
+
+static const struct cx18_card cx18_card_cnxt_raptor_pal = {
+       .type = CX18_CARD_CNXT_RAPTOR_PAL,
+       .name = "Conexant Raptor PAL/SECAM",
+       .comment = "VBI is not yet supported\n",
+       .v4l2_capabilities = CX18_CAP_ENCODER,
+       .hw_audio_ctrl = CX18_HW_CX23418,
+       .hw_muxer = CX18_HW_GPIO,
+       .hw_all = CX18_HW_TUNER | CX18_HW_GPIO,
+       .video_inputs = {
+               { CX18_CARD_INPUT_VID_TUNER,  0, CX18_AV_COMPOSITE2 },
+               { CX18_CARD_INPUT_SVIDEO1,    1,
+                       CX18_AV_SVIDEO_LUMA3 | CX18_AV_SVIDEO_CHROMA4 },
+               { CX18_CARD_INPUT_COMPOSITE1, 1, CX18_AV_COMPOSITE1 },
+               { CX18_CARD_INPUT_SVIDEO2,    2,
+                       CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 },
+               { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 },
+       },
+       .audio_inputs = {
+               { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL, 1 },
+               { CX18_CARD_INPUT_LINE_IN1,  CX18_AV_AUDIO_SERIAL, 0 },
+               { CX18_CARD_INPUT_LINE_IN2,  CX18_AV_AUDIO_SERIAL, 0 },
+       },
+       .tuners = {
+               { .std = V4L2_STD_NOT_MN, .tuner = TUNER_PHILIPS_FM1216ME_MK3 },
+       },
+       .ddr = {
+               /* MT 46V16M16 memory */
+               .chip_config = 0x50306,
+               .refresh = 0x753,
+               .timing1 = 0x33220953,
+               .timing2 = 0x09,
+               .tune_lane = 0,
+               .initial_emrs = 0,
+       },
+       .gpio_init.initial_value = 0x02,
+       .gpio_init.direction = 0x02,
+       .gpio_audio_input  = { .mask = 0x02, .tuner  = 0x02, .linein = 0x00 },
+       .pci_list = cx18_pci_cnxt_raptor_pal,
+       .i2c = &cx18_i2c_std,
+};
+
+/* ------------------------------------------------------------------------- */
+
 static const struct cx18_card *cx18_card_list[] = {
        &cx18_card_hvr1600_esmt,
        &cx18_card_hvr1600_samsung,
        &cx18_card_h900,
        &cx18_card_mpc718,
+       &cx18_card_cnxt_raptor_pal,
 };
 
 const struct cx18_card *cx18_get_card(u16 index)
diff -r 183149ba5d10 -r da2b6f1f22d9 linux/drivers/media/video/cx18/cx18-cards.h
--- a/linux/drivers/media/video/cx18/cx18-cards.h       Sat Jun 21 11:25:23 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-cards.h       Sat Jun 21 13:06:44 
2008 +0200
@@ -78,6 +78,13 @@ struct cx18_gpio_init { /* set initial G
        u32 initial_value;
 };
 
+struct ivtv_gpio_audio_input {         /* select tuner/line in input */
+       u32 mask;               /* leave to 0 if not supported */
+       u32 tuner;
+       u32 linein;
+       u32 radio;
+};
+
 struct cx18_card_tuner {
        v4l2_std_id std;        /* standard for which the tuner is suitable */
        int         tuner;      /* tuner ID (from tuner.h) */
@@ -115,6 +122,7 @@ struct cx18_card {
        /* GPIO card-specific settings */
        u8 xceive_pin;          /* XCeive tuner GPIO reset pin */
        struct cx18_gpio_init           gpio_init;
+       struct ivtv_gpio_audio_input    gpio_audio_input;
 
        struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
        struct cx18_card_tuner_i2c *i2c;
diff -r 183149ba5d10 -r da2b6f1f22d9 
linux/drivers/media/video/cx18/cx18-driver.c
--- a/linux/drivers/media/video/cx18/cx18-driver.c      Sat Jun 21 11:25:23 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-driver.c      Sat Jun 21 13:06:44 
2008 +0200
@@ -120,6 +120,7 @@ MODULE_PARM_DESC(cardtype,
                 "\t\t\t 2 = Hauppauge HVR 1600 (Samsung memory)\n"
                 "\t\t\t 3 = Compro VideoMate H900\n"
                 "\t\t\t 4 = Yuan MPC718\n"
+                "\t\t\t 5 = Conexant Raptor PAL/SECAM\n"
                 "\t\t\t 0 = Autodetect (default)\n"
                 "\t\t\t-1 = Ignore this card\n\t\t");
 MODULE_PARM_DESC(pal, "Set PAL standard: B, G, H, D, K, I, M, N, Nc, 60");
@@ -435,7 +436,7 @@ static int __devinit cx18_init_struct1(s
                (cx->params.video_temporal_filter_mode << 1) |
                (cx->params.video_median_filter_type << 2);
        cx->params.port = CX2341X_PORT_MEMORY;
-       cx->params.capabilities = CX2341X_CAP_HAS_SLICED_VBI;
+       cx->params.capabilities = 0;
        init_waitqueue_head(&cx->cap_w);
        init_waitqueue_head(&cx->mb_apu_waitq);
        init_waitqueue_head(&cx->mb_cpu_waitq);
diff -r 183149ba5d10 -r da2b6f1f22d9 
linux/drivers/media/video/cx18/cx18-driver.h
--- a/linux/drivers/media/video/cx18/cx18-driver.h      Sat Jun 21 11:25:23 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-driver.h      Sat Jun 21 13:06:44 
2008 +0200
@@ -77,7 +77,8 @@
 #define CX18_CARD_HVR_1600_SAMSUNG    1        /* Hauppauge HVR 1600 (Samsung 
memory) */
 #define CX18_CARD_COMPRO_H900        2 /* Compro VideoMate H900 */
 #define CX18_CARD_YUAN_MPC718        3 /* Yuan MPC718 */
-#define CX18_CARD_LAST                       3
+#define CX18_CARD_CNXT_RAPTOR_PAL     4        /* Conexant Raptor PAL */
+#define CX18_CARD_LAST                       4
 
 #define CX18_ENC_STREAM_TYPE_MPG  0
 #define CX18_ENC_STREAM_TYPE_TS   1
@@ -96,6 +97,7 @@
 #define CX18_PCI_ID_HAUPPAUGE          0x0070
 #define CX18_PCI_ID_COMPRO             0x185b
 #define CX18_PCI_ID_YUAN               0x12ab
+#define CX18_PCI_ID_CONEXANT           0x14f1
 
 /* ======================================================================== */
 /* ========================== START USER SETTABLE DMA VARIABLES =========== */
diff -r 183149ba5d10 -r da2b6f1f22d9 linux/drivers/media/video/cx18/cx18-gpio.c
--- a/linux/drivers/media/video/cx18/cx18-gpio.c        Sat Jun 21 11:25:23 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-gpio.c        Sat Jun 21 13:06:44 
2008 +0200
@@ -98,3 +98,37 @@ int cx18_reset_tuner_gpio(void *dev, int
        schedule_timeout_interruptible(msecs_to_jiffies(1));
        return 0;
 }
+
+int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg)
+{
+       struct v4l2_routing *route = arg;
+       u32 mask, data;
+
+       switch (command) {
+       case VIDIOC_INT_S_AUDIO_ROUTING:
+               if (route->input > 2)
+                       return -EINVAL;
+               mask = cx->card->gpio_audio_input.mask;
+               switch (route->input) {
+               case 0:
+                       data = cx->card->gpio_audio_input.tuner;
+                       break;
+               case 1:
+                       data = cx->card->gpio_audio_input.linein;
+                       break;
+               case 2:
+               default:
+                       data = cx->card->gpio_audio_input.radio;
+                       break;
+               }
+               break;
+
+       default:
+               return -EINVAL;
+       }
+       if (mask) {
+               cx->gpio_val = (cx->gpio_val & ~mask) | (data & mask);
+               gpio_write(cx);
+       }
+       return 0;
+}
diff -r 183149ba5d10 -r da2b6f1f22d9 linux/drivers/media/video/cx18/cx18-gpio.h
--- a/linux/drivers/media/video/cx18/cx18-gpio.h        Sat Jun 21 11:25:23 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-gpio.h        Sat Jun 21 13:06:44 
2008 +0200
@@ -22,3 +22,4 @@
 
 void cx18_gpio_init(struct cx18 *cx);
 int cx18_reset_tuner_gpio(void *dev, int cmd, int value);
+int cx18_gpio(struct cx18 *cx, unsigned int command, void *arg);
diff -r 183149ba5d10 -r da2b6f1f22d9 linux/drivers/media/video/cx18/cx18-i2c.c
--- a/linux/drivers/media/video/cx18/cx18-i2c.c Sat Jun 21 11:25:23 2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-i2c.c Sat Jun 21 13:06:44 2008 +0200
@@ -339,8 +339,12 @@ int cx18_i2c_hw(struct cx18 *cx, u32 hw,
 {
        int addr;
 
-       if (hw == CX18_HW_GPIO || hw == 0)
+       if (hw == 0)
                return 0;
+
+       if (hw == CX18_HW_GPIO)
+               return cx18_gpio(cx, cmd, arg);
+
        if (hw == CX18_HW_CX23418)
                return cx18_av_cmd(cx, cmd, arg);
 
@@ -378,6 +382,8 @@ void cx18_call_i2c_clients(struct cx18 *
        cx18_av_cmd(cx, cmd, arg);
        i2c_clients_command(&cx->i2c_adap[0], cmd, arg);
        i2c_clients_command(&cx->i2c_adap[1], cmd, arg);
+       if (cx->hw_flags & CX18_HW_GPIO)
+               cx18_gpio(cx, cmd, arg);
 }
 
 /* init + register i2c algo-bit adapter */
@@ -385,6 +391,18 @@ int init_cx18_i2c(struct cx18 *cx)
 {
        int i;
        CX18_DEBUG_I2C("i2c init\n");
+
+       /* Sanity checks for the I2C hardware arrays. They must be the
+        * same size and GPIO/CX23418 must be the last entries.
+        */
+       if (ARRAY_SIZE(hw_driverids) != ARRAY_SIZE(hw_addrs) ||
+           ARRAY_SIZE(hw_devicenames) != ARRAY_SIZE(hw_addrs) ||
+           CX18_HW_GPIO != (1 << (ARRAY_SIZE(hw_addrs) - 2)) ||
+           CX18_HW_CX23418 != (1 << (ARRAY_SIZE(hw_addrs) - 1)) ||
+           hw_driverids[ARRAY_SIZE(hw_addrs) - 1]) {
+               CX18_ERR("Mismatched I2C hardware arrays\n");
+               return -ENODEV;
+       }
 
        for (i = 0; i < 2; i++) {
                memcpy(&cx->i2c_adap[i], &cx18_i2c_adap_template,


---

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

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

Reply via email to