]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
V4L/DVB (7887): cx18: fix Compro H900 analog support.
authorHans Verkuil <hverkuil@xs4all.nl>
Mon, 12 May 2008 16:57:18 +0000 (13:57 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Wed, 14 May 2008 05:56:44 +0000 (02:56 -0300)
Tuner, S-Video and Composite are all working for the Compro H900.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/cx18/cx18-cards.c
drivers/media/video/cx18/cx18-cards.h
drivers/media/video/cx18/cx18-gpio.c

index bf6f7edca88722c507c9d0045170f24bb97988dd..0f2bfb4ba8449253e019a66fe8fc70db21e993ea 100644 (file)
@@ -135,14 +135,15 @@ static const struct cx18_card_pci_info cx18_pci_h900[] = {
 static const struct cx18_card cx18_card_h900 = {
        .type = CX18_CARD_COMPRO_H900,
        .name = "Compro VideoMate H900",
-       .comment = "Not yet supported!\n",
-       .v4l2_capabilities = 0,
+       .comment = "DVB & VBI are not yet supported\n",
+       .v4l2_capabilities = CX18_CAP_ENCODER,
        .hw_audio_ctrl = CX18_HW_CX23418,
        .hw_all = CX18_HW_TUNER,
        .video_inputs = {
-               { CX18_CARD_INPUT_VID_TUNER,  0, CX23418_COMPOSITE7 },
-               { CX18_CARD_INPUT_SVIDEO1,    1, CX23418_SVIDEO1    },
-               { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE3 },
+               { CX18_CARD_INPUT_VID_TUNER,  0, CX23418_COMPOSITE2 },
+               { CX18_CARD_INPUT_SVIDEO1,    1,
+                       CX23418_SVIDEO_LUMA3 | CX23418_SVIDEO_CHROMA4 },
+               { CX18_CARD_INPUT_COMPOSITE1, 1, CX23418_COMPOSITE1 },
        },
        .audio_inputs = {
                { CX18_CARD_INPUT_AUD_TUNER,
@@ -164,6 +165,7 @@ static const struct cx18_card cx18_card_h900 = {
                .tune_lane = 0,
                .initial_emrs = 0,
        },
+       .xceive_pin = 15,
        .pci_list = cx18_pci_h900,
        .i2c = &cx18_i2c_std,
 };
index bca249bdd337020888c40541c72d92079c3728a9..bccb67f0db16415a1efd6ffef20909b9d42cd46d 100644 (file)
@@ -114,8 +114,8 @@ struct cx18_card_pci_info {
 /* The mask is the set of bits used by the operation */
 
 struct cx18_gpio_init { /* set initial GPIO DIR and OUT values */
-       u16 direction;  /* DIR setting. Leave to 0 if no init is needed */
-       u16 initial_value;
+       u32 direction;  /* DIR setting. Leave to 0 if no init is needed */
+       u32 initial_value;
 };
 
 struct cx18_card_tuner {
@@ -153,6 +153,7 @@ struct cx18_card {
        struct cx18_card_audio_input radio_input;
 
        /* GPIO card-specific settings */
+       u8 xceive_pin;          /* XCeive tuner GPIO reset pin */
        struct cx18_gpio_init           gpio_init;
 
        struct cx18_card_tuner tuners[CX18_CARD_MAX_TUNERS];
index 19253e6b86738f7d05c0bbac1b768dcd21cf57a4..bb8bc86086d0925c3a693bdce698524a48245265 100644 (file)
@@ -35,6 +35,9 @@
 #define CX18_REG_GPIO_OUT2   0xc78104
 #define CX18_REG_GPIO_DIR2   0xc7810c
 
+static u32 gpio_dir;
+static u32 gpio_val;
+
 /*
  * HVR-1600 GPIO pins, courtesy of Hauppauge:
  *
  * gpio13: cs5345 reset pin
 */
 
+static void gpio_write(struct cx18 *cx)
+{
+       write_reg((gpio_dir & 0xffff) << 16, CX18_REG_GPIO_DIR1);
+       write_reg(((gpio_dir & 0xffff) << 16) | (gpio_val & 0xffff),
+                       CX18_REG_GPIO_OUT1);
+       write_reg(gpio_dir & 0xffff0000, CX18_REG_GPIO_DIR2);
+       write_reg((gpio_dir & 0xffff0000) | ((gpio_val & 0xffff0000) >> 16),
+                       CX18_REG_GPIO_OUT2);
+}
+
 void cx18_gpio_init(struct cx18 *cx)
 {
-       if (cx->card->gpio_init.direction == 0)
+       gpio_dir = cx->card->gpio_init.direction;
+       gpio_val = cx->card->gpio_init.initial_value;
+
+       if (gpio_dir == 0)
                return;
 
-       CX18_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n",
-                  read_reg(CX18_REG_GPIO_DIR1), read_reg(CX18_REG_GPIO_OUT1));
+       gpio_dir |= 1 << cx->card->xceive_pin;
+       gpio_val |= 1 << cx->card->xceive_pin;
 
-       /* init output data then direction */
-       write_reg(cx->card->gpio_init.direction << 16, CX18_REG_GPIO_DIR1);
-       write_reg(0, CX18_REG_GPIO_DIR2);
-       write_reg((cx->card->gpio_init.direction << 16) |
-                       cx->card->gpio_init.initial_value, CX18_REG_GPIO_OUT1);
-       write_reg(0, CX18_REG_GPIO_OUT2);
+       CX18_DEBUG_INFO("GPIO initial dir: %08x/%08x out: %08x/%08x\n",
+                  read_reg(CX18_REG_GPIO_DIR1), read_reg(CX18_REG_GPIO_DIR2),
+                  read_reg(CX18_REG_GPIO_OUT1), read_reg(CX18_REG_GPIO_OUT2));
+
+       gpio_write(cx);
 }
 
 /* Xceive tuner reset function */
 int cx18_reset_tuner_gpio(void *dev, int cmd, int value)
 {
        struct i2c_algo_bit_data *algo = dev;
-       struct cx18 *cx = algo->data;
-/*     int curdir, curout;*/
+       struct cx18_i2c_algo_callback_data *cb_data = algo->data;
+       struct cx18 *cx = cb_data->cx;
 
        if (cmd != XC2028_TUNER_RESET)
                return 0;
        CX18_DEBUG_INFO("Resetting tuner\n");
+
+       gpio_dir |= 1 << cx->card->xceive_pin;
+       gpio_val &= ~(1 << cx->card->xceive_pin);
+
+       gpio_write(cx);
+       schedule_timeout_interruptible(msecs_to_jiffies(1));
+
+       gpio_val |= 1 << cx->card->xceive_pin;
+       gpio_write(cx);
+       schedule_timeout_interruptible(msecs_to_jiffies(1));
        return 0;
 }