Merge git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 2 Apr 2008 14:50:49 +0000 (07:50 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 2 Apr 2008 14:50:49 +0000 (07:50 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/v4l-dvb:
  V4L/DVB (7486): radio-cadet: wrap PNP probe code in #ifdef CONFIG_PNP
  V4L/DVB (7485): v4l2-int-device.c: add MODULE_LICENSE
  V4L/DVB (7466): Avoid minor model number warning when an OEM HVR1250 board is detected
  V4L/DVB (7465): Fix eeprom parsing and errors on the HVR1800 products
  V4L/DVB (7464): Convert driver to use a single SRAM memory map
  V4L/DVB (7461): bttv: fix missed index check
  V4L/DVB (7400): bttv: Add a radio compat_ioctl file operation
  V4L/DVB (7278): bttv: Re-enable radio tuner support for VIDIOCGFREQ/VIDIOCSFREQ ioctls
  V4L/DVB (7277): bttv: Re-enabling radio support requires the use of struct bttv_fh

drivers/media/radio/radio-cadet.c
drivers/media/video/bt8xx/bttv-driver.c
drivers/media/video/cx23885/cx23885-cards.c
drivers/media/video/cx23885/cx23885-core.c
drivers/media/video/v4l2-int-device.c

index 34e317c..57b9e3a 100644 (file)
@@ -587,6 +587,8 @@ static struct video_device cadet_radio=
        .vidioc_s_input     = vidioc_s_input,
 };
 
+#ifdef CONFIG_PNP
+
 static struct pnp_device_id cadet_pnp_devices[] = {
        /* ADS Cadet AM/FM Radio Card */
        {.id = "MSM0c24", .driver_data = 0},
@@ -621,6 +623,10 @@ static struct pnp_driver cadet_pnp_driver = {
        .remove         = NULL,
 };
 
+#else
+static struct pnp_driver cadet_pnp_driver;
+#endif
+
 static int cadet_probe(void)
 {
        static int iovals[8]={0x330,0x332,0x334,0x336,0x338,0x33a,0x33c,0x33e};
index a080c14..fcf8f2d 100644 (file)
@@ -1990,7 +1990,7 @@ static int bttv_g_frequency(struct file *file, void *priv,
        if (0 != err)
                return err;
 
-       f->type = V4L2_TUNER_ANALOG_TV;
+       f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
        f->frequency = btv->freq;
 
        return 0;
@@ -2009,7 +2009,8 @@ static int bttv_s_frequency(struct file *file, void *priv,
 
        if (unlikely(f->tuner != 0))
                return -EINVAL;
-       if (unlikely(f->type != V4L2_TUNER_ANALOG_TV))
+       if (unlikely(f->type != (btv->radio_user
+               ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV)))
                return -EINVAL;
        mutex_lock(&btv->lock);
        btv->freq = f->frequency;
@@ -3415,6 +3416,7 @@ static int radio_open(struct inode *inode, struct file *file)
 {
        int minor = iminor(inode);
        struct bttv *btv = NULL;
+       struct bttv_fh *fh;
        unsigned int i;
 
        dprintk("bttv: open minor=%d\n",minor);
@@ -3429,12 +3431,19 @@ static int radio_open(struct inode *inode, struct file *file)
                return -ENODEV;
 
        dprintk("bttv%d: open called (radio)\n",btv->c.nr);
+
+       /* allocate per filehandle data */
+       fh = kmalloc(sizeof(*fh), GFP_KERNEL);
+       if (NULL == fh)
+               return -ENOMEM;
+       file->private_data = fh;
+       *fh = btv->init;
+       v4l2_prio_open(&btv->prio, &fh->prio);
+
        mutex_lock(&btv->lock);
 
        btv->radio_user++;
 
-       file->private_data = btv;
-
        bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL);
        audio_input(btv,TVAUDIO_INPUT_RADIO);
 
@@ -3444,7 +3453,8 @@ static int radio_open(struct inode *inode, struct file *file)
 
 static int radio_release(struct inode *inode, struct file *file)
 {
-       struct bttv *btv = file->private_data;
+       struct bttv_fh *fh = file->private_data;
+       struct bttv *btv = fh->btv;
        struct rds_command cmd;
 
        btv->radio_user--;
@@ -3508,8 +3518,12 @@ static int radio_enum_input(struct file *file, void *priv,
 static int radio_g_audio(struct file *file, void *priv,
                                        struct v4l2_audio *a)
 {
+       if (a->index != 0)
+               return -EINVAL;
+
        memset(a, 0, sizeof(*a));
        strcpy(a->name, "Radio");
+
        return 0;
 }
 
@@ -3569,7 +3583,8 @@ static int radio_g_input(struct file *filp, void *priv, unsigned int *i)
 static ssize_t radio_read(struct file *file, char __user *data,
                         size_t count, loff_t *ppos)
 {
-       struct bttv    *btv = file->private_data;
+       struct bttv_fh *fh = file->private_data;
+       struct bttv *btv = fh->btv;
        struct rds_command cmd;
        cmd.block_count = count/3;
        cmd.buffer = data;
@@ -3583,7 +3598,8 @@ static ssize_t radio_read(struct file *file, char __user *data,
 
 static unsigned int radio_poll(struct file *file, poll_table *wait)
 {
-       struct bttv    *btv = file->private_data;
+       struct bttv_fh *fh = file->private_data;
+       struct bttv *btv = fh->btv;
        struct rds_command cmd;
        cmd.instance = file;
        cmd.event_list = wait;
@@ -3599,6 +3615,7 @@ static const struct file_operations radio_fops =
        .open     = radio_open,
        .read     = radio_read,
        .release  = radio_release,
+       .compat_ioctl   = v4l_compat_ioctl32,
        .ioctl    = video_ioctl2,
        .llseek   = no_llseek,
        .poll     = radio_poll,
index 2d414da..dfa2698 100644 (file)
@@ -232,6 +232,7 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data)
        case 78631: /* WinTV-HVR1800 (PCIe, OEM, No IR, No FM, Dual channel ATSC and MPEG2 HW Encoder */
        case 79001: /* WinTV-HVR1250 (PCIe, Retail, IR, full height, ATSC and Basic analog */
        case 79101: /* WinTV-HVR1250 (PCIe, Retail, IR, half height, ATSC and Basic analog */
+       case 79561: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */
        case 79571: /* WinTV-HVR1250 (PCIe, OEM, No IR, full height, ATSC and Basic analog */
        case 79671: /* WinTV-HVR1250 (PCIe, OEM, No IR, half height, ATSC and Basic analog */
                break;
@@ -347,10 +348,13 @@ void cx23885_card_setup(struct cx23885_dev *dev)
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
        case CX23885_BOARD_HAUPPAUGE_HVR1500:
        case CX23885_BOARD_HAUPPAUGE_HVR1500Q:
+               if (dev->i2c_bus[0].i2c_rc == 0)
+                       hauppauge_eeprom(dev, eeprom+0x80);
+               break;
        case CX23885_BOARD_HAUPPAUGE_HVR1800:
        case CX23885_BOARD_HAUPPAUGE_HVR1800lp:
                if (dev->i2c_bus[0].i2c_rc == 0)
-                       hauppauge_eeprom(dev, eeprom+0x80);
+                       hauppauge_eeprom(dev, eeprom+0xc0);
                break;
        }
 
index 8e40c7b..7f10b27 100644 (file)
@@ -56,137 +56,6 @@ LIST_HEAD(cx23885_devlist);
 
 #define NO_SYNC_LINE (-1U)
 
-/*
- * CX23885 Assumptions
- * 1 line = 16 bytes of CDT
- * cmds size = 80
- * cdt size = 16 * linesize
- * iqsize = 64
- * maxlines = 6
- *
- * Address Space:
- * 0x00000000 0x00008fff FIFO clusters
- * 0x00010000 0x000104af Channel Management Data Structures
- * 0x000104b0 0x000104ff Free
- * 0x00010500 0x000108bf 15 channels * iqsize
- * 0x000108c0 0x000108ff Free
- * 0x00010900 0x00010e9f IQ's + Cluster Descriptor Tables
- *                       15 channels * (iqsize + (maxlines * linesize))
- * 0x00010ea0 0x00010xxx Free
- */
-
-static struct sram_channel cx23885_sram_channels[] = {
-       [SRAM_CH01] = {
-               .name           = "VID A",
-               .cmds_start     = 0x10000,
-               .ctrl_start     = 0x105b0,
-               .cdt            = 0x107b0,
-               .fifo_start     = 0x40,
-               .fifo_size      = 0x2800,
-               .ptr1_reg       = DMA1_PTR1,
-               .ptr2_reg       = DMA1_PTR2,
-               .cnt1_reg       = DMA1_CNT1,
-               .cnt2_reg       = DMA1_CNT2,
-               .jumponly       = 1,
-       },
-       [SRAM_CH02] = {
-               .name           = "ch2",
-               .cmds_start     = 0x0,
-               .ctrl_start     = 0x0,
-               .cdt            = 0x0,
-               .fifo_start     = 0x0,
-               .fifo_size      = 0x0,
-               .ptr1_reg       = DMA2_PTR1,
-               .ptr2_reg       = DMA2_PTR2,
-               .cnt1_reg       = DMA2_CNT1,
-               .cnt2_reg       = DMA2_CNT2,
-       },
-       [SRAM_CH03] = {
-               .name           = "TS1 B",
-               .cmds_start     = 0x100A0,
-               .ctrl_start     = 0x10630,
-               .cdt            = 0x10870,
-               .fifo_start     = 0x5000,
-               .fifo_size      = 0x1000,
-               .ptr1_reg       = DMA3_PTR1,
-               .ptr2_reg       = DMA3_PTR2,
-               .cnt1_reg       = DMA3_CNT1,
-               .cnt2_reg       = DMA3_CNT2,
-       },
-       [SRAM_CH04] = {
-               .name           = "ch4",
-               .cmds_start     = 0x0,
-               .ctrl_start     = 0x0,
-               .cdt            = 0x0,
-               .fifo_start     = 0x0,
-               .fifo_size      = 0x0,
-               .ptr1_reg       = DMA4_PTR1,
-               .ptr2_reg       = DMA4_PTR2,
-               .cnt1_reg       = DMA4_CNT1,
-               .cnt2_reg       = DMA4_CNT2,
-       },
-       [SRAM_CH05] = {
-               .name           = "ch5",
-               .cmds_start     = 0x0,
-               .ctrl_start     = 0x0,
-               .cdt            = 0x0,
-               .fifo_start     = 0x0,
-               .fifo_size      = 0x0,
-               .ptr1_reg       = DMA5_PTR1,
-               .ptr2_reg       = DMA5_PTR2,
-               .cnt1_reg       = DMA5_CNT1,
-               .cnt2_reg       = DMA5_CNT2,
-       },
-       [SRAM_CH06] = {
-               .name           = "TS2 C",
-               .cmds_start     = 0x10140,
-               .ctrl_start     = 0x10680,
-               .cdt            = 0x108d0,
-               .fifo_start     = 0x6000,
-               .fifo_size      = 0x1000,
-               .ptr1_reg       = DMA5_PTR1,
-               .ptr2_reg       = DMA5_PTR2,
-               .cnt1_reg       = DMA5_CNT1,
-               .cnt2_reg       = DMA5_CNT2,
-       },
-       [SRAM_CH07] = {
-               .name           = "ch7",
-               .cmds_start     = 0x0,
-               .ctrl_start     = 0x0,
-               .cdt            = 0x0,
-               .fifo_start     = 0x0,
-               .fifo_size      = 0x0,
-               .ptr1_reg       = DMA6_PTR1,
-               .ptr2_reg       = DMA6_PTR2,
-               .cnt1_reg       = DMA6_CNT1,
-               .cnt2_reg       = DMA6_CNT2,
-       },
-       [SRAM_CH08] = {
-               .name           = "ch8",
-               .cmds_start     = 0x0,
-               .ctrl_start     = 0x0,
-               .cdt            = 0x0,
-               .fifo_start     = 0x0,
-               .fifo_size      = 0x0,
-               .ptr1_reg       = DMA7_PTR1,
-               .ptr2_reg       = DMA7_PTR2,
-               .cnt1_reg       = DMA7_CNT1,
-               .cnt2_reg       = DMA7_CNT2,
-       },
-       [SRAM_CH09] = {
-               .name           = "ch9",
-               .cmds_start     = 0x0,
-               .ctrl_start     = 0x0,
-               .cdt            = 0x0,
-               .fifo_start     = 0x0,
-               .fifo_size      = 0x0,
-               .ptr1_reg       = DMA8_PTR1,
-               .ptr2_reg       = DMA8_PTR2,
-               .cnt1_reg       = DMA8_CNT1,
-               .cnt2_reg       = DMA8_CNT2,
-       },
-};
-
 /* FIXME, these allocations will change when
  * analog arrives. The be reviewed.
  * CX23887 Assumptions
@@ -754,6 +623,7 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
        atomic_inc(&dev->refcount);
 
        dev->nr = cx23885_devcount++;
+       dev->sram_channels = cx23887_sram_channels;
        sprintf(dev->name, "cx23885[%d]", dev->nr);
 
        mutex_lock(&devlist);
@@ -763,13 +633,11 @@ static int cx23885_dev_setup(struct cx23885_dev *dev)
        /* Configure the internal memory */
        if(dev->pci->device == 0x8880) {
                dev->bridge = CX23885_BRIDGE_887;
-               dev->sram_channels = cx23887_sram_channels;
                /* Apply a sensible clock frequency for the PCIe bridge */
                dev->clk_freq = 25000000;
        } else
        if(dev->pci->device == 0x8852) {
                dev->bridge = CX23885_BRIDGE_885;
-               dev->sram_channels = cx23885_sram_channels;
                /* Apply a sensible clock frequency for the PCIe bridge */
                dev->clk_freq = 28000000;
        } else
index a545dca..0e45499 100644 (file)
@@ -156,3 +156,5 @@ int v4l2_int_ioctl_1(struct v4l2_int_device *d, int cmd, void *arg)
                find_ioctl(d->u.slave, cmd,
                           (v4l2_int_ioctl_func *)no_such_ioctl_1))(d, arg);
 }
+
+MODULE_LICENSE("GPL");