]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/video/ivtv/ivtv-gpio.c
lockd: Specify address family for source address
[linux-2.6-omap-h63xx.git] / drivers / media / video / ivtv / ivtv-gpio.c
index 688cd3856685f09a0374fa91f42f20efbf1fdc92..bc22905ea20fa58c5f890a58a418361d495a46ef 100644 (file)
@@ -128,20 +128,17 @@ int ivtv_reset_tuner_gpio(void *dev, int cmd, int value)
 {
        struct i2c_algo_bit_data *algo = dev;
        struct ivtv *itv = algo->data;
-       int curdir, curout;
+       u32 curout;
 
        if (cmd != XC2028_TUNER_RESET)
                return 0;
        IVTV_DEBUG_INFO("Resetting tuner\n");
        curout = read_reg(IVTV_REG_GPIO_OUT);
-       curdir = read_reg(IVTV_REG_GPIO_DIR);
-       curdir |= (1 << 12);  /* GPIO bit 12 */
-
-       curout &= ~(1 << 12);
+       curout &= ~(1 << itv->card->xceive_pin);
        write_reg(curout, IVTV_REG_GPIO_OUT);
        schedule_timeout_interruptible(msecs_to_jiffies(1));
 
-       curout |= (1 << 12);
+       curout |= 1 << itv->card->xceive_pin;
        write_reg(curout, IVTV_REG_GPIO_OUT);
        schedule_timeout_interruptible(msecs_to_jiffies(1));
        return 0;
@@ -149,15 +146,20 @@ int ivtv_reset_tuner_gpio(void *dev, int cmd, int value)
 
 void ivtv_gpio_init(struct ivtv *itv)
 {
-       if (itv->card->gpio_init.direction == 0)
+       u16 pin = 0;
+
+       if (itv->card->xceive_pin)
+               pin = 1 << itv->card->xceive_pin;
+
+       if ((itv->card->gpio_init.direction | pin) == 0)
                return;
 
        IVTV_DEBUG_INFO("GPIO initial dir: %08x out: %08x\n",
                   read_reg(IVTV_REG_GPIO_DIR), read_reg(IVTV_REG_GPIO_OUT));
 
        /* init output data then direction */
-       write_reg(itv->card->gpio_init.initial_value, IVTV_REG_GPIO_OUT);
-       write_reg(itv->card->gpio_init.direction, IVTV_REG_GPIO_DIR);
+       write_reg(itv->card->gpio_init.initial_value | pin, IVTV_REG_GPIO_OUT);
+       write_reg(itv->card->gpio_init.direction | pin, IVTV_REG_GPIO_DIR);
 }
 
 static struct v4l2_queryctrl gpio_ctrl_mute = {