Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (34 commits)
V4L/DVB (10173): Missing v4l2_prio_close in radio_release
V4L/DVB (10172): add DVB_DEVICE_TYPE= to uevent
V4L/DVB (10171): Use usb_set_intfdata
V4L/DVB (10170): tuner-simple: prevent possible OOPS caused by divide by zero error
V4L/DVB (10168): sms1xxx: fix inverted gpio for lna control on tiger r2
V4L/DVB (10167): sms1xxx: add support for inverted gpio
V4L/DVB (10166): dvb frontend: stop using non-C99 compliant comments
V4L/DVB (10165): Add FE_CAN_2G_MODULATION flag to frontends that support DVB-S2
V4L/DVB (10164): Add missing S2 caps flag to S2API
V4L/DVB (10163): em28xx: allocate adev together with struct em28xx dev
V4L/DVB (10162): tuner-simple: Fix tuner type set message
V4L/DVB (10161): saa7134: fix autodetection for AVer TV GO 007 FM Plus
V4L/DVB (10160): em28xx: update chip id for em2710
V4L/DVB (10157): Add USB ID for the Sil4701 radio from DealExtreme
V4L/DVB (10156): saa7134: Add support for Avermedia AVer TV GO 007 FM Plus
V4L/DVB (10155): Add TEA5764 radio driver
V4L/DVB (10154): saa7134: fix a merge conflict on Behold H6 board
V4L/DVB (10153): Add the Beholder H6 card to DVB-T part of sources.
V4L/DVB (10152): Change configuration of the Beholder H6 card
V4L/DVB (10151): Fix I2C bridge error in zl10353
...

+1629 -1106
+1
Documentation/video4linux/CARDLIST.saa7134
··· 152 151 -> ADS Tech Instant HDTV [1421:0380] 153 152 -> Asus Tiger Rev:1.00 [1043:4857] 154 153 -> Kworld Plus TV Analog Lite PCI [17de:7128]
··· 152 151 -> ADS Tech Instant HDTV [1421:0380] 153 152 -> Asus Tiger Rev:1.00 [1043:4857] 154 153 -> Kworld Plus TV Analog Lite PCI [17de:7128] 155 + 154 -> Avermedia AVerTV GO 007 FM Plus [1461:f31d]
+1
Documentation/video4linux/si470x.txt
··· 41 - 10c4:818a: Silicon Labs USB FM Radio Reference Design 42 - 06e1:a155: ADS/Tech FM Radio Receiver (formerly Instant FM Music) (RDX-155-EF) 43 - 1b80:d700: KWorld USB FM Radio SnapMusic Mobile 700 (FM700) 44 45 46 Software
··· 41 - 10c4:818a: Silicon Labs USB FM Radio Reference Design 42 - 06e1:a155: ADS/Tech FM Radio Receiver (formerly Instant FM Music) (RDX-155-EF) 43 - 1b80:d700: KWorld USB FM Radio SnapMusic Mobile 700 (FM700) 44 + - 10c5:819a: DealExtreme USB Radio 45 46 47 Software
+10 -9
Documentation/video4linux/v4l2-framework.txt
··· 184 It looks like this: 185 186 struct v4l2_subdev_core_ops { 187 - int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip); 188 int (*log_status)(struct v4l2_subdev *sd); 189 int (*init)(struct v4l2_subdev *sd, u32 val); 190 ... ··· 390 391 You should also set these fields: 392 393 - - parent: set to the parent device (same device as was used to register 394 - v4l2_device). 395 - name: set to something descriptive and unique. 396 - - fops: set to the file_operations struct. 397 - ioctl_ops: if you use the v4l2_ioctl_ops to simplify ioctl maintenance 398 (highly recommended to use this and it might become compulsory in the 399 future!), then set this to your v4l2_ioctl_ops struct. 400 401 - If you use v4l2_ioctl_ops, then you should set .unlocked_ioctl to 402 - __video_ioctl2 or .ioctl to video_ioctl2 in your file_operations struct. 403 404 405 video_device registration ··· 412 413 err = video_register_device(vdev, VFL_TYPE_GRABBER, -1); 414 if (err) { 415 - video_device_release(vdev); // or kfree(my_vdev); 416 return err; 417 } 418 ··· 518 519 You can go from a video_device struct to the v4l2_device struct using: 520 521 - struct v4l2_device *v4l2_dev = dev_get_drvdata(vdev->parent); 522 -
··· 184 It looks like this: 185 186 struct v4l2_subdev_core_ops { 187 + int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 188 int (*log_status)(struct v4l2_subdev *sd); 189 int (*init)(struct v4l2_subdev *sd, u32 val); 190 ... ··· 390 391 You should also set these fields: 392 393 + - v4l2_dev: set to the v4l2_device parent device. 394 - name: set to something descriptive and unique. 395 + - fops: set to the v4l2_file_operations struct. 396 - ioctl_ops: if you use the v4l2_ioctl_ops to simplify ioctl maintenance 397 (highly recommended to use this and it might become compulsory in the 398 future!), then set this to your v4l2_ioctl_ops struct. 399 400 + If you use v4l2_ioctl_ops, then you should set either .unlocked_ioctl or 401 + .ioctl to video_ioctl2 in your v4l2_file_operations struct. 402 + 403 + The v4l2_file_operations struct is a subset of file_operations. The main 404 + difference is that the inode argument is omitted since it is never used. 405 406 407 video_device registration ··· 410 411 err = video_register_device(vdev, VFL_TYPE_GRABBER, -1); 412 if (err) { 413 + video_device_release(vdev); /* or kfree(my_vdev); */ 414 return err; 415 } 416 ··· 516 517 You can go from a video_device struct to the v4l2_device struct using: 518 519 + struct v4l2_device *v4l2_dev = vdev->v4l2_dev;
+10 -11
drivers/media/common/saa7146_fops.c
··· 192 /********************************************************************************/ 193 /* file operations */ 194 195 - static int fops_open(struct inode *inode, struct file *file) 196 { 197 - unsigned int minor = iminor(inode); 198 struct saa7146_dev *h = NULL, *dev = NULL; 199 struct list_head *list; 200 struct saa7146_fh *fh = NULL; ··· 202 203 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 204 205 - DEB_EE(("inode:%p, file:%p, minor:%d\n",inode,file,minor)); 206 207 if (mutex_lock_interruptible(&saa7146_devices_lock)) 208 return -ERESTARTSYS; ··· 255 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) 256 result = saa7146_vbi_uops.open(dev,file); 257 if (dev->ext_vv_data->vbi_fops.open) 258 - dev->ext_vv_data->vbi_fops.open(inode, file); 259 } else { 260 DEB_S(("initializing video...\n")); 261 result = saa7146_video_uops.open(dev,file); ··· 280 return result; 281 } 282 283 - static int fops_release(struct inode *inode, struct file *file) 284 { 285 struct saa7146_fh *fh = file->private_data; 286 struct saa7146_dev *dev = fh->dev; 287 288 - DEB_EE(("inode:%p, file:%p\n",inode,file)); 289 290 if (mutex_lock_interruptible(&saa7146_devices_lock)) 291 return -ERESTARTSYS; ··· 294 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) 295 saa7146_vbi_uops.release(dev,file); 296 if (dev->ext_vv_data->vbi_fops.release) 297 - dev->ext_vv_data->vbi_fops.release(inode, file); 298 } else { 299 saa7146_video_uops.release(dev,file); 300 } ··· 308 return 0; 309 } 310 311 - static int fops_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 312 { 313 /* 314 - DEB_EE(("inode:%p, file:%p, cmd:%d, arg:%li\n",inode, file, cmd, arg)); 315 */ 316 return video_usercopy(file, cmd, arg, saa7146_video_do_ioctl); 317 } ··· 416 } 417 } 418 419 - static const struct file_operations video_fops = 420 { 421 .owner = THIS_MODULE, 422 .open = fops_open, ··· 426 .poll = fops_poll, 427 .mmap = fops_mmap, 428 .ioctl = fops_ioctl, 429 - .llseek = no_llseek, 430 }; 431 432 static void vv_callback(struct saa7146_dev *dev, unsigned long status)
··· 192 /********************************************************************************/ 193 /* file operations */ 194 195 + static int fops_open(struct file *file) 196 { 197 + unsigned int minor = video_devdata(file)->minor; 198 struct saa7146_dev *h = NULL, *dev = NULL; 199 struct list_head *list; 200 struct saa7146_fh *fh = NULL; ··· 202 203 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 204 205 + DEB_EE(("file:%p, minor:%d\n", file, minor)); 206 207 if (mutex_lock_interruptible(&saa7146_devices_lock)) 208 return -ERESTARTSYS; ··· 255 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) 256 result = saa7146_vbi_uops.open(dev,file); 257 if (dev->ext_vv_data->vbi_fops.open) 258 + dev->ext_vv_data->vbi_fops.open(file); 259 } else { 260 DEB_S(("initializing video...\n")); 261 result = saa7146_video_uops.open(dev,file); ··· 280 return result; 281 } 282 283 + static int fops_release(struct file *file) 284 { 285 struct saa7146_fh *fh = file->private_data; 286 struct saa7146_dev *dev = fh->dev; 287 288 + DEB_EE(("file:%p\n", file)); 289 290 if (mutex_lock_interruptible(&saa7146_devices_lock)) 291 return -ERESTARTSYS; ··· 294 if (dev->ext_vv_data->capabilities & V4L2_CAP_VBI_CAPTURE) 295 saa7146_vbi_uops.release(dev,file); 296 if (dev->ext_vv_data->vbi_fops.release) 297 + dev->ext_vv_data->vbi_fops.release(file); 298 } else { 299 saa7146_video_uops.release(dev,file); 300 } ··· 308 return 0; 309 } 310 311 + static long fops_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 312 { 313 /* 314 + DEB_EE(("file:%p, cmd:%d, arg:%li\n", file, cmd, arg)); 315 */ 316 return video_usercopy(file, cmd, arg, saa7146_video_do_ioctl); 317 } ··· 416 } 417 } 418 419 + static const struct v4l2_file_operations video_fops = 420 { 421 .owner = THIS_MODULE, 422 .open = fops_open, ··· 426 .poll = fops_poll, 427 .mmap = fops_mmap, 428 .ioctl = fops_ioctl, 429 }; 430 431 static void vv_callback(struct saa7146_dev *dev, unsigned long status)
+3 -2
drivers/media/common/saa7146_video.c
··· 834 * copying is done already, arg is a kernel pointer. 835 */ 836 837 - int saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) 838 { 839 struct saa7146_fh *fh = file->private_data; 840 struct saa7146_dev *dev = fh->dev; 841 struct saa7146_vv *vv = dev->vv_data; 842 843 - int err = 0, result = 0, ee = 0; 844 845 struct saa7146_use_ops *ops; 846 struct videobuf_queue *q;
··· 834 * copying is done already, arg is a kernel pointer. 835 */ 836 837 + long saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) 838 { 839 struct saa7146_fh *fh = file->private_data; 840 struct saa7146_dev *dev = fh->dev; 841 struct saa7146_vv *vv = dev->vv_data; 842 843 + long err = 0; 844 + int result = 0, ee = 0; 845 846 struct saa7146_use_ops *ops; 847 struct videobuf_queue *q;
+15 -1
drivers/media/common/tuners/tuner-simple.c
··· 820 int ret; 821 unsigned frequency = params->frequency / 62500; 822 823 t_params = simple_tuner_params(fe, TUNER_PARAM_TYPE_DIGITAL); 824 ret = simple_config_lookup(fe, t_params, &frequency, &config, &cb); 825 if (ret < 0) ··· 1068 memcpy(&fe->ops.tuner_ops, &simple_tuner_ops, 1069 sizeof(struct dvb_tuner_ops)); 1070 1071 - tuner_info("type set to %d (%s)\n", type, priv->tun->name); 1072 1073 if ((debug) || ((atv_input[priv->nr] > 0) || 1074 (dtv_input[priv->nr] > 0))) {
··· 820 int ret; 821 unsigned frequency = params->frequency / 62500; 822 823 + if (!tun->stepsize) { 824 + /* tuner-core was loaded before the digital tuner was 825 + * configured and somehow picked the wrong tuner type */ 826 + tuner_err("attempt to treat tuner %d (%s) as digital tuner " 827 + "without stepsize defined.\n", 828 + priv->type, priv->tun->name); 829 + return 0; /* failure */ 830 + } 831 + 832 t_params = simple_tuner_params(fe, TUNER_PARAM_TYPE_DIGITAL); 833 ret = simple_config_lookup(fe, t_params, &frequency, &config, &cb); 834 if (ret < 0) ··· 1059 memcpy(&fe->ops.tuner_ops, &simple_tuner_ops, 1060 sizeof(struct dvb_tuner_ops)); 1061 1062 + if (type != priv->type) 1063 + tuner_warn("couldn't set type to %d. Using %d (%s) instead\n", 1064 + type, priv->type, priv->tun->name); 1065 + else 1066 + tuner_info("type set to %d (%s)\n", 1067 + priv->type, priv->tun->name); 1068 1069 if ((debug) || ((atv_input[priv->nr] > 0) || 1070 (dtv_input[priv->nr] > 0))) {
+2 -1
drivers/media/dvb/dvb-core/dvbdev.c
··· 436 { 437 struct dvb_device *dvbdev = dev_get_drvdata(dev); 438 439 - add_uevent_var(env, "DVB_DEVICE_NUM=%d", dvbdev->id); 440 add_uevent_var(env, "DVB_ADAPTER_NUM=%d", dvbdev->adapter->num); 441 return 0; 442 } 443
··· 436 { 437 struct dvb_device *dvbdev = dev_get_drvdata(dev); 438 439 add_uevent_var(env, "DVB_ADAPTER_NUM=%d", dvbdev->adapter->num); 440 + add_uevent_var(env, "DVB_DEVICE_TYPE=%s", dnames[dvbdev->type]); 441 + add_uevent_var(env, "DVB_DEVICE_NUM=%d", dvbdev->id); 442 return 0; 443 } 444
+1 -1
drivers/media/dvb/dvb-usb/gp8psk.c
··· 187 /* load BCM4500 firmware */ 188 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) 189 if (gp8psk_load_bcm4500fw(d)) 190 - return EINVAL; 191 return 0; 192 } 193
··· 187 /* load BCM4500 firmware */ 188 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM) 189 if (gp8psk_load_bcm4500fw(d)) 190 + return -EINVAL; 191 return 0; 192 } 193
+1
drivers/media/dvb/frontends/cx24116.c
··· 1463 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | 1464 FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | 1465 FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | 1466 FE_CAN_QPSK | FE_CAN_RECOVER 1467 }, 1468
··· 1463 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | 1464 FE_CAN_FEC_4_5 | FE_CAN_FEC_5_6 | FE_CAN_FEC_6_7 | 1465 FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | 1466 + FE_CAN_2G_MODULATION | 1467 FE_CAN_QPSK | FE_CAN_RECOVER 1468 }, 1469
+2 -1
drivers/media/dvb/frontends/cx24116.h
··· 37 u8 mpg_clk_pos_pol:0x02; 38 }; 39 40 - #if defined(CONFIG_DVB_CX24116) || defined(CONFIG_DVB_CX24116_MODULE) 41 extern struct dvb_frontend *cx24116_attach( 42 const struct cx24116_config *config, 43 struct i2c_adapter *i2c);
··· 37 u8 mpg_clk_pos_pol:0x02; 38 }; 39 40 + #if defined(CONFIG_DVB_CX24116) || \ 41 + (defined(CONFIG_DVB_CX24116_MODULE) && defined(MODULE)) 42 extern struct dvb_frontend *cx24116_attach( 43 const struct cx24116_config *config, 44 struct i2c_adapter *i2c);
+1
drivers/media/dvb/frontends/stb0899_drv.c
··· 1618 1619 .caps = FE_CAN_INVERSION_AUTO | 1620 FE_CAN_FEC_AUTO | 1621 FE_CAN_QPSK 1622 }, 1623
··· 1618 1619 .caps = FE_CAN_INVERSION_AUTO | 1620 FE_CAN_FEC_AUTO | 1621 + FE_CAN_2G_MODULATION | 1622 FE_CAN_QPSK 1623 }, 1624
+7
drivers/media/dvb/frontends/zl10353.c
··· 587 588 static int zl10353_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) 589 { 590 u8 val = 0x0a; 591 592 if (enable) 593 val |= 0x10;
··· 587 588 static int zl10353_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) 589 { 590 + struct zl10353_state *state = fe->demodulator_priv; 591 u8 val = 0x0a; 592 + 593 + if (state->config.no_tuner) { 594 + /* No tuner attached to the internal I2C bus */ 595 + /* If set enable I2C bridge, the main I2C bus stopped hardly */ 596 + return 0; 597 + } 598 599 if (enable) 600 val |= 0x10;
+14 -5
drivers/media/dvb/siano/sms-cards.c
··· 120 .name = "Hauppauge WinTV MiniCard", 121 .type = SMS_NOVA_B0, 122 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", 123 - .lna_ctrl = 1, 124 }, 125 }; 126 ··· 131 return &sms_boards[id]; 132 } 133 134 - static int sms_set_gpio(struct smscore_device_t *coredev, u32 pin, int enable) 135 { 136 - int ret; 137 struct smscore_gpio_config gpioconfig = { 138 .direction = SMS_GPIO_DIRECTION_OUTPUT, 139 .pullupdown = SMS_GPIO_PULLUPDOWN_NONE, ··· 146 if (pin == 0) 147 return -EINVAL; 148 149 - ret = smscore_configure_gpio(coredev, pin, &gpioconfig); 150 151 if (ret < 0) 152 return ret; 153 154 - return smscore_set_gpio(coredev, pin, enable); 155 } 156 157 int sms_board_setup(struct smscore_device_t *coredev)
··· 120 .name = "Hauppauge WinTV MiniCard", 121 .type = SMS_NOVA_B0, 122 .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", 123 + .lna_ctrl = -1, 124 }, 125 }; 126 ··· 131 return &sms_boards[id]; 132 } 133 134 + static int sms_set_gpio(struct smscore_device_t *coredev, int pin, int enable) 135 { 136 + int lvl, ret; 137 + u32 gpio; 138 struct smscore_gpio_config gpioconfig = { 139 .direction = SMS_GPIO_DIRECTION_OUTPUT, 140 .pullupdown = SMS_GPIO_PULLUPDOWN_NONE, ··· 145 if (pin == 0) 146 return -EINVAL; 147 148 + if (pin < 0) { 149 + /* inverted gpio */ 150 + gpio = pin * -1; 151 + lvl = enable ? 0 : 1; 152 + } else { 153 + gpio = pin; 154 + lvl = enable ? 1 : 0; 155 + } 156 157 + ret = smscore_configure_gpio(coredev, gpio, &gpioconfig); 158 if (ret < 0) 159 return ret; 160 161 + return smscore_set_gpio(coredev, gpio, lvl); 162 } 163 164 int sms_board_setup(struct smscore_device_t *coredev)
+2 -2
drivers/media/dvb/ttpci/av7110_v4l.c
··· 316 return 0; 317 } 318 319 - static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 320 { 321 struct saa7146_dev *dev = fh->dev; 322 struct av7110 *av7110 = (struct av7110*) dev->ext_priv; ··· 567 return 0; 568 } 569 570 - static int av7110_vbi_reset(struct inode *inode, struct file *file) 571 { 572 struct saa7146_fh *fh = file->private_data; 573 struct saa7146_dev *dev = fh->dev;
··· 316 return 0; 317 } 318 319 + static long av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 320 { 321 struct saa7146_dev *dev = fh->dev; 322 struct av7110 *av7110 = (struct av7110*) dev->ext_priv; ··· 567 return 0; 568 } 569 570 + static int av7110_vbi_reset(struct file *file) 571 { 572 struct saa7146_fh *fh = file->private_data; 573 struct saa7146_dev *dev = fh->dev;
+1 -1
drivers/media/dvb/ttpci/budget-av.c
··· 1493 {0, 0} 1494 }; 1495 1496 - static int av_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 1497 { 1498 struct saa7146_dev *dev = fh->dev; 1499 struct budget_av *budget_av = (struct budget_av *) dev->ext_priv;
··· 1493 {0, 0} 1494 }; 1495 1496 + static long av_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 1497 { 1498 struct saa7146_dev *dev = fh->dev; 1499 struct budget_av *budget_av = (struct budget_av *) dev->ext_priv;
+1 -1
drivers/media/dvb/ttusb-budget/Kconfig
··· 1 config DVB_TTUSB_BUDGET 2 tristate "Technotrend/Hauppauge Nova-USB devices" 3 - depends on DVB_CORE && USB && I2C 4 select DVB_CX22700 if !DVB_FE_CUSTOMISE 5 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 6 select DVB_VES1820 if !DVB_FE_CUSTOMISE
··· 1 config DVB_TTUSB_BUDGET 2 tristate "Technotrend/Hauppauge Nova-USB devices" 3 + depends on DVB_CORE && USB && I2C && PCI 4 select DVB_CX22700 if !DVB_FE_CUSTOMISE 5 select DVB_TDA1004X if !DVB_FE_CUSTOMISE 6 select DVB_VES1820 if !DVB_FE_CUSTOMISE
+1 -1
drivers/media/dvb/ttusb-dec/Kconfig
··· 1 config DVB_TTUSB_DEC 2 tristate "Technotrend/Hauppauge USB DEC devices" 3 - depends on DVB_CORE && USB && INPUT 4 select CRC32 5 help 6 Support for external USB adapters designed by Technotrend and
··· 1 config DVB_TTUSB_DEC 2 tristate "Technotrend/Hauppauge USB DEC devices" 3 + depends on DVB_CORE && USB && INPUT && PCI 4 select CRC32 5 help 6 Support for external USB adapters designed by Technotrend and
+19
drivers/media/radio/Kconfig
··· 387 To compile this driver as a module, choose M here: the 388 module will be called radio-mr800. 389 390 endif # RADIO_ADAPTERS
··· 387 To compile this driver as a module, choose M here: the 388 module will be called radio-mr800. 389 390 + config RADIO_TEA5764 391 + tristate "TEA5764 I2C FM radio support" 392 + depends on I2C && VIDEO_V4L2 393 + ---help--- 394 + Say Y here if you want to use the TEA5764 FM chip found in 395 + EZX phones. This FM chip is present in EZX phones from Motorola, 396 + connected to internal pxa I2C bus. 397 + 398 + To compile this driver as a module, choose M here: the 399 + module will be called radio-tea5764. 400 + 401 + config RADIO_TEA5764_XTAL 402 + bool "TEA5764 crystal reference" 403 + depends on RADIO_TEA5764=y 404 + default y 405 + help 406 + Say Y here if TEA5764 have a 32768 Hz crystal in circuit, say N 407 + here if TEA5764 reference frequency is connected in FREQIN. 408 + 409 endif # RADIO_ADAPTERS
+1
drivers/media/radio/Makefile
··· 19 obj-$(CONFIG_USB_DSBR) += dsbr100.o 20 obj-$(CONFIG_USB_SI470X) += radio-si470x.o 21 obj-$(CONFIG_USB_MR800) += radio-mr800.o 22 23 EXTRA_CFLAGS += -Isound
··· 19 obj-$(CONFIG_USB_DSBR) += dsbr100.o 20 obj-$(CONFIG_USB_SI470X) += radio-si470x.o 21 obj-$(CONFIG_USB_MR800) += radio-mr800.o 22 + obj-$(CONFIG_RADIO_TEA5764) += radio-tea5764.o 23 24 EXTRA_CFLAGS += -Isound
+5 -9
drivers/media/radio/dsbr100.c
··· 154 static int usb_dsbr100_probe(struct usb_interface *intf, 155 const struct usb_device_id *id); 156 static void usb_dsbr100_disconnect(struct usb_interface *intf); 157 - static int usb_dsbr100_open(struct inode *inode, struct file *file); 158 - static int usb_dsbr100_close(struct inode *inode, struct file *file); 159 static int usb_dsbr100_suspend(struct usb_interface *intf, 160 pm_message_t message); 161 static int usb_dsbr100_resume(struct usb_interface *intf); ··· 566 return 0; 567 } 568 569 - static int usb_dsbr100_open(struct inode *inode, struct file *file) 570 { 571 struct dsbr100_device *radio = video_drvdata(file); 572 int retval; ··· 593 return 0; 594 } 595 596 - static int usb_dsbr100_close(struct inode *inode, struct file *file) 597 { 598 struct dsbr100_device *radio = video_drvdata(file); 599 int retval; ··· 653 } 654 655 /* File system interface */ 656 - static const struct file_operations usb_dsbr100_fops = { 657 .owner = THIS_MODULE, 658 .open = usb_dsbr100_open, 659 .release = usb_dsbr100_close, 660 .ioctl = video_ioctl2, 661 - #ifdef CONFIG_COMPAT 662 - .compat_ioctl = v4l_compat_ioctl32, 663 - #endif 664 - .llseek = no_llseek, 665 }; 666 667 static const struct v4l2_ioctl_ops usb_dsbr100_ioctl_ops = {
··· 154 static int usb_dsbr100_probe(struct usb_interface *intf, 155 const struct usb_device_id *id); 156 static void usb_dsbr100_disconnect(struct usb_interface *intf); 157 + static int usb_dsbr100_open(struct file *file); 158 + static int usb_dsbr100_close(struct file *file); 159 static int usb_dsbr100_suspend(struct usb_interface *intf, 160 pm_message_t message); 161 static int usb_dsbr100_resume(struct usb_interface *intf); ··· 566 return 0; 567 } 568 569 + static int usb_dsbr100_open(struct file *file) 570 { 571 struct dsbr100_device *radio = video_drvdata(file); 572 int retval; ··· 593 return 0; 594 } 595 596 + static int usb_dsbr100_close(struct file *file) 597 { 598 struct dsbr100_device *radio = video_drvdata(file); 599 int retval; ··· 653 } 654 655 /* File system interface */ 656 + static const struct v4l2_file_operations usb_dsbr100_fops = { 657 .owner = THIS_MODULE, 658 .open = usb_dsbr100_open, 659 .release = usb_dsbr100_close, 660 .ioctl = video_ioctl2, 661 }; 662 663 static const struct v4l2_ioctl_ops usb_dsbr100_ioctl_ops = {
+3 -7
drivers/media/radio/radio-aimslab.c
··· 374 375 static struct rt_device rtrack_unit; 376 377 - static int rtrack_exclusive_open(struct inode *inode, struct file *file) 378 { 379 return test_and_set_bit(0, &rtrack_unit.in_use) ? -EBUSY : 0; 380 } 381 382 - static int rtrack_exclusive_release(struct inode *inode, struct file *file) 383 { 384 clear_bit(0, &rtrack_unit.in_use); 385 return 0; 386 } 387 388 - static const struct file_operations rtrack_fops = { 389 .owner = THIS_MODULE, 390 .open = rtrack_exclusive_open, 391 .release = rtrack_exclusive_release, 392 .ioctl = video_ioctl2, 393 - #ifdef CONFIG_COMPAT 394 - .compat_ioctl = v4l_compat_ioctl32, 395 - #endif 396 - .llseek = no_llseek, 397 }; 398 399 static const struct v4l2_ioctl_ops rtrack_ioctl_ops = {
··· 374 375 static struct rt_device rtrack_unit; 376 377 + static int rtrack_exclusive_open(struct file *file) 378 { 379 return test_and_set_bit(0, &rtrack_unit.in_use) ? -EBUSY : 0; 380 } 381 382 + static int rtrack_exclusive_release(struct file *file) 383 { 384 clear_bit(0, &rtrack_unit.in_use); 385 return 0; 386 } 387 388 + static const struct v4l2_file_operations rtrack_fops = { 389 .owner = THIS_MODULE, 390 .open = rtrack_exclusive_open, 391 .release = rtrack_exclusive_release, 392 .ioctl = video_ioctl2, 393 }; 394 395 static const struct v4l2_ioctl_ops rtrack_ioctl_ops = {
+3 -7
drivers/media/radio/radio-aztech.c
··· 338 339 static struct az_device aztech_unit; 340 341 - static int aztech_exclusive_open(struct inode *inode, struct file *file) 342 { 343 return test_and_set_bit(0, &aztech_unit.in_use) ? -EBUSY : 0; 344 } 345 346 - static int aztech_exclusive_release(struct inode *inode, struct file *file) 347 { 348 clear_bit(0, &aztech_unit.in_use); 349 return 0; 350 } 351 352 - static const struct file_operations aztech_fops = { 353 .owner = THIS_MODULE, 354 .open = aztech_exclusive_open, 355 .release = aztech_exclusive_release, 356 .ioctl = video_ioctl2, 357 - #ifdef CONFIG_COMPAT 358 - .compat_ioctl = v4l_compat_ioctl32, 359 - #endif 360 - .llseek = no_llseek, 361 }; 362 363 static const struct v4l2_ioctl_ops aztech_ioctl_ops = {
··· 338 339 static struct az_device aztech_unit; 340 341 + static int aztech_exclusive_open(struct file *file) 342 { 343 return test_and_set_bit(0, &aztech_unit.in_use) ? -EBUSY : 0; 344 } 345 346 + static int aztech_exclusive_release(struct file *file) 347 { 348 clear_bit(0, &aztech_unit.in_use); 349 return 0; 350 } 351 352 + static const struct v4l2_file_operations aztech_fops = { 353 .owner = THIS_MODULE, 354 .open = aztech_exclusive_open, 355 .release = aztech_exclusive_release, 356 .ioctl = video_ioctl2, 357 }; 358 359 static const struct v4l2_ioctl_ops aztech_ioctl_ops = {
+3 -7
drivers/media/radio/radio-cadet.c
··· 529 } 530 531 static int 532 - cadet_open(struct inode *inode, struct file *file) 533 { 534 users++; 535 if (1 == users) init_waitqueue_head(&read_queue); ··· 537 } 538 539 static int 540 - cadet_release(struct inode *inode, struct file *file) 541 { 542 users--; 543 if (0 == users){ ··· 557 } 558 559 560 - static const struct file_operations cadet_fops = { 561 .owner = THIS_MODULE, 562 .open = cadet_open, 563 .release = cadet_release, 564 .read = cadet_read, 565 .ioctl = video_ioctl2, 566 .poll = cadet_poll, 567 - #ifdef CONFIG_COMPAT 568 - .compat_ioctl = v4l_compat_ioctl32, 569 - #endif 570 - .llseek = no_llseek, 571 }; 572 573 static const struct v4l2_ioctl_ops cadet_ioctl_ops = {
··· 529 } 530 531 static int 532 + cadet_open(struct file *file) 533 { 534 users++; 535 if (1 == users) init_waitqueue_head(&read_queue); ··· 537 } 538 539 static int 540 + cadet_release(struct file *file) 541 { 542 users--; 543 if (0 == users){ ··· 557 } 558 559 560 + static const struct v4l2_file_operations cadet_fops = { 561 .owner = THIS_MODULE, 562 .open = cadet_open, 563 .release = cadet_release, 564 .read = cadet_read, 565 .ioctl = video_ioctl2, 566 .poll = cadet_poll, 567 }; 568 569 static const struct v4l2_ioctl_ops cadet_ioctl_ops = {
+3 -7
drivers/media/radio/radio-gemtek-pci.c
··· 358 359 static int mx = 1; 360 361 - static int gemtek_pci_exclusive_open(struct inode *inode, struct file *file) 362 { 363 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 364 } 365 366 - static int gemtek_pci_exclusive_release(struct inode *inode, struct file *file) 367 { 368 clear_bit(0, &in_use); 369 return 0; 370 } 371 372 - static const struct file_operations gemtek_pci_fops = { 373 .owner = THIS_MODULE, 374 .open = gemtek_pci_exclusive_open, 375 .release = gemtek_pci_exclusive_release, 376 .ioctl = video_ioctl2, 377 - #ifdef CONFIG_COMPAT 378 - .compat_ioctl = v4l_compat_ioctl32, 379 - #endif 380 - .llseek = no_llseek, 381 }; 382 383 static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = {
··· 358 359 static int mx = 1; 360 361 + static int gemtek_pci_exclusive_open(struct file *file) 362 { 363 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 364 } 365 366 + static int gemtek_pci_exclusive_release(struct file *file) 367 { 368 clear_bit(0, &in_use); 369 return 0; 370 } 371 372 + static const struct v4l2_file_operations gemtek_pci_fops = { 373 .owner = THIS_MODULE, 374 .open = gemtek_pci_exclusive_open, 375 .release = gemtek_pci_exclusive_release, 376 .ioctl = video_ioctl2, 377 }; 378 379 static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = {
+3 -7
drivers/media/radio/radio-gemtek.c
··· 394 } 395 }; 396 397 - static int gemtek_exclusive_open(struct inode *inode, struct file *file) 398 { 399 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 400 } 401 402 - static int gemtek_exclusive_release(struct inode *inode, struct file *file) 403 { 404 clear_bit(0, &in_use); 405 return 0; 406 } 407 408 - static const struct file_operations gemtek_fops = { 409 .owner = THIS_MODULE, 410 .open = gemtek_exclusive_open, 411 .release = gemtek_exclusive_release, 412 .ioctl = video_ioctl2, 413 - #ifdef CONFIG_COMPAT 414 - .compat_ioctl = v4l_compat_ioctl32, 415 - #endif 416 - .llseek = no_llseek 417 }; 418 419 static int vidioc_querycap(struct file *file, void *priv,
··· 394 } 395 }; 396 397 + static int gemtek_exclusive_open(struct file *file) 398 { 399 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 400 } 401 402 + static int gemtek_exclusive_release(struct file *file) 403 { 404 clear_bit(0, &in_use); 405 return 0; 406 } 407 408 + static const struct v4l2_file_operations gemtek_fops = { 409 .owner = THIS_MODULE, 410 .open = gemtek_exclusive_open, 411 .release = gemtek_exclusive_release, 412 .ioctl = video_ioctl2, 413 }; 414 415 static int vidioc_querycap(struct file *file, void *priv,
+3 -7
drivers/media/radio/radio-maestro.c
··· 79 80 static int maestro_probe(struct pci_dev *pdev, const struct pci_device_id *ent); 81 82 - static int maestro_exclusive_open(struct inode *inode, struct file *file) 83 { 84 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 85 } 86 87 - static int maestro_exclusive_release(struct inode *inode, struct file *file) 88 { 89 clear_bit(0, &in_use); 90 return 0; ··· 110 .remove = __devexit_p(maestro_remove), 111 }; 112 113 - static const struct file_operations maestro_fops = { 114 .owner = THIS_MODULE, 115 .open = maestro_exclusive_open, 116 .release = maestro_exclusive_release, 117 .ioctl = video_ioctl2, 118 - #ifdef CONFIG_COMPAT 119 - .compat_ioctl = v4l_compat_ioctl32, 120 - #endif 121 - .llseek = no_llseek, 122 }; 123 124 struct radio_device {
··· 79 80 static int maestro_probe(struct pci_dev *pdev, const struct pci_device_id *ent); 81 82 + static int maestro_exclusive_open(struct file *file) 83 { 84 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 85 } 86 87 + static int maestro_exclusive_release(struct file *file) 88 { 89 clear_bit(0, &in_use); 90 return 0; ··· 110 .remove = __devexit_p(maestro_remove), 111 }; 112 113 + static const struct v4l2_file_operations maestro_fops = { 114 .owner = THIS_MODULE, 115 .open = maestro_exclusive_open, 116 .release = maestro_exclusive_release, 117 .ioctl = video_ioctl2, 118 }; 119 120 struct radio_device {
+3 -7
drivers/media/radio/radio-maxiradio.c
··· 100 #define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF) 101 102 103 - static int maxiradio_exclusive_open(struct inode *inode, struct file *file) 104 { 105 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 106 } 107 108 - static int maxiradio_exclusive_release(struct inode *inode, struct file *file) 109 { 110 clear_bit(0, &in_use); 111 return 0; 112 } 113 114 - static const struct file_operations maxiradio_fops = { 115 .owner = THIS_MODULE, 116 .open = maxiradio_exclusive_open, 117 .release = maxiradio_exclusive_release, 118 .ioctl = video_ioctl2, 119 - #ifdef CONFIG_COMPAT 120 - .compat_ioctl = v4l_compat_ioctl32, 121 - #endif 122 - .llseek = no_llseek, 123 }; 124 125 static struct radio_device
··· 100 #define BITS2FREQ(x) ((x) * FREQ_STEP - FREQ_IF) 101 102 103 + static int maxiradio_exclusive_open(struct file *file) 104 { 105 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 106 } 107 108 + static int maxiradio_exclusive_release(struct file *file) 109 { 110 clear_bit(0, &in_use); 111 return 0; 112 } 113 114 + static const struct v4l2_file_operations maxiradio_fops = { 115 .owner = THIS_MODULE, 116 .open = maxiradio_exclusive_open, 117 .release = maxiradio_exclusive_release, 118 .ioctl = video_ioctl2, 119 }; 120 121 static struct radio_device
+5 -9
drivers/media/radio/radio-mr800.c
··· 127 static int usb_amradio_probe(struct usb_interface *intf, 128 const struct usb_device_id *id); 129 static void usb_amradio_disconnect(struct usb_interface *intf); 130 - static int usb_amradio_open(struct inode *inode, struct file *file); 131 - static int usb_amradio_close(struct inode *inode, struct file *file); 132 static int usb_amradio_suspend(struct usb_interface *intf, 133 pm_message_t message); 134 static int usb_amradio_resume(struct usb_interface *intf); ··· 500 } 501 502 /* open device - amradio_start() and amradio_setfreq() */ 503 - static int usb_amradio_open(struct inode *inode, struct file *file) 504 { 505 struct amradio_device *radio = video_get_drvdata(video_devdata(file)); 506 ··· 525 } 526 527 /*close device */ 528 - static int usb_amradio_close(struct inode *inode, struct file *file) 529 { 530 struct amradio_device *radio = video_get_drvdata(video_devdata(file)); 531 int retval; ··· 572 } 573 574 /* File system interface */ 575 - static const struct file_operations usb_amradio_fops = { 576 .owner = THIS_MODULE, 577 .open = usb_amradio_open, 578 .release = usb_amradio_close, 579 .ioctl = video_ioctl2, 580 - #ifdef CONFIG_COMPAT 581 - .compat_ioctl = v4l_compat_ioctl32, 582 - #endif 583 - .llseek = no_llseek, 584 }; 585 586 static const struct v4l2_ioctl_ops usb_amradio_ioctl_ops = {
··· 127 static int usb_amradio_probe(struct usb_interface *intf, 128 const struct usb_device_id *id); 129 static void usb_amradio_disconnect(struct usb_interface *intf); 130 + static int usb_amradio_open(struct file *file); 131 + static int usb_amradio_close(struct file *file); 132 static int usb_amradio_suspend(struct usb_interface *intf, 133 pm_message_t message); 134 static int usb_amradio_resume(struct usb_interface *intf); ··· 500 } 501 502 /* open device - amradio_start() and amradio_setfreq() */ 503 + static int usb_amradio_open(struct file *file) 504 { 505 struct amradio_device *radio = video_get_drvdata(video_devdata(file)); 506 ··· 525 } 526 527 /*close device */ 528 + static int usb_amradio_close(struct file *file) 529 { 530 struct amradio_device *radio = video_get_drvdata(video_devdata(file)); 531 int retval; ··· 572 } 573 574 /* File system interface */ 575 + static const struct v4l2_file_operations usb_amradio_fops = { 576 .owner = THIS_MODULE, 577 .open = usb_amradio_open, 578 .release = usb_amradio_close, 579 .ioctl = video_ioctl2, 580 }; 581 582 static const struct v4l2_ioctl_ops usb_amradio_ioctl_ops = {
+3 -7
drivers/media/radio/radio-rtrack2.c
··· 280 281 static struct rt_device rtrack2_unit; 282 283 - static int rtrack2_exclusive_open(struct inode *inode, struct file *file) 284 { 285 return test_and_set_bit(0, &rtrack2_unit.in_use) ? -EBUSY : 0; 286 } 287 288 - static int rtrack2_exclusive_release(struct inode *inode, struct file *file) 289 { 290 clear_bit(0, &rtrack2_unit.in_use); 291 return 0; 292 } 293 294 - static const struct file_operations rtrack2_fops = { 295 .owner = THIS_MODULE, 296 .open = rtrack2_exclusive_open, 297 .release = rtrack2_exclusive_release, 298 .ioctl = video_ioctl2, 299 - #ifdef CONFIG_COMPAT 300 - .compat_ioctl = v4l_compat_ioctl32, 301 - #endif 302 - .llseek = no_llseek, 303 }; 304 305 static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = {
··· 280 281 static struct rt_device rtrack2_unit; 282 283 + static int rtrack2_exclusive_open(struct file *file) 284 { 285 return test_and_set_bit(0, &rtrack2_unit.in_use) ? -EBUSY : 0; 286 } 287 288 + static int rtrack2_exclusive_release(struct file *file) 289 { 290 clear_bit(0, &rtrack2_unit.in_use); 291 return 0; 292 } 293 294 + static const struct v4l2_file_operations rtrack2_fops = { 295 .owner = THIS_MODULE, 296 .open = rtrack2_exclusive_open, 297 .release = rtrack2_exclusive_release, 298 .ioctl = video_ioctl2, 299 }; 300 301 static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = {
+3 -7
drivers/media/radio/radio-sf16fmi.c
··· 280 281 static struct fmi_device fmi_unit; 282 283 - static int fmi_exclusive_open(struct inode *inode, struct file *file) 284 { 285 return test_and_set_bit(0, &fmi_unit.in_use) ? -EBUSY : 0; 286 } 287 288 - static int fmi_exclusive_release(struct inode *inode, struct file *file) 289 { 290 clear_bit(0, &fmi_unit.in_use); 291 return 0; 292 } 293 294 - static const struct file_operations fmi_fops = { 295 .owner = THIS_MODULE, 296 .open = fmi_exclusive_open, 297 .release = fmi_exclusive_release, 298 .ioctl = video_ioctl2, 299 - #ifdef CONFIG_COMPAT 300 - .compat_ioctl = v4l_compat_ioctl32, 301 - #endif 302 - .llseek = no_llseek, 303 }; 304 305 static const struct v4l2_ioctl_ops fmi_ioctl_ops = {
··· 280 281 static struct fmi_device fmi_unit; 282 283 + static int fmi_exclusive_open(struct file *file) 284 { 285 return test_and_set_bit(0, &fmi_unit.in_use) ? -EBUSY : 0; 286 } 287 288 + static int fmi_exclusive_release(struct file *file) 289 { 290 clear_bit(0, &fmi_unit.in_use); 291 return 0; 292 } 293 294 + static const struct v4l2_file_operations fmi_fops = { 295 .owner = THIS_MODULE, 296 .open = fmi_exclusive_open, 297 .release = fmi_exclusive_release, 298 .ioctl = video_ioctl2, 299 }; 300 301 static const struct v4l2_ioctl_ops fmi_ioctl_ops = {
+3 -7
drivers/media/radio/radio-sf16fmr2.c
··· 396 397 static struct fmr2_device fmr2_unit; 398 399 - static int fmr2_exclusive_open(struct inode *inode, struct file *file) 400 { 401 return test_and_set_bit(0, &fmr2_unit.in_use) ? -EBUSY : 0; 402 } 403 404 - static int fmr2_exclusive_release(struct inode *inode, struct file *file) 405 { 406 clear_bit(0, &fmr2_unit.in_use); 407 return 0; 408 } 409 410 - static const struct file_operations fmr2_fops = { 411 .owner = THIS_MODULE, 412 .open = fmr2_exclusive_open, 413 .release = fmr2_exclusive_release, 414 .ioctl = video_ioctl2, 415 - #ifdef CONFIG_COMPAT 416 - .compat_ioctl = v4l_compat_ioctl32, 417 - #endif 418 - .llseek = no_llseek, 419 }; 420 421 static const struct v4l2_ioctl_ops fmr2_ioctl_ops = {
··· 396 397 static struct fmr2_device fmr2_unit; 398 399 + static int fmr2_exclusive_open(struct file *file) 400 { 401 return test_and_set_bit(0, &fmr2_unit.in_use) ? -EBUSY : 0; 402 } 403 404 + static int fmr2_exclusive_release(struct file *file) 405 { 406 clear_bit(0, &fmr2_unit.in_use); 407 return 0; 408 } 409 410 + static const struct v4l2_file_operations fmr2_fops = { 411 .owner = THIS_MODULE, 412 .open = fmr2_exclusive_open, 413 .release = fmr2_exclusive_release, 414 .ioctl = video_ioctl2, 415 }; 416 417 static const struct v4l2_ioctl_ops fmr2_ioctl_ops = {
+7 -7
drivers/media/radio/radio-si470x.c
··· 96 * 2008-10-20 Alexey Klimov <klimov.linux@gmail.com> 97 * - add support for KWorld USB FM Radio FM700 98 * - blacklisted KWorld radio in hid-core.c and hid-ids.h 99 * 100 * ToDo: 101 * - add firmware download/update support ··· 140 { USB_DEVICE_AND_INTERFACE_INFO(0x06e1, 0xa155, USB_CLASS_HID, 0, 0) }, 141 /* KWorld USB FM Radio SnapMusic Mobile 700 (FM700) */ 142 { USB_DEVICE_AND_INTERFACE_INFO(0x1b80, 0xd700, USB_CLASS_HID, 0, 0) }, 143 /* Terminating entry */ 144 { } 145 }; ··· 1079 /* 1080 * si470x_fops_open - file open 1081 */ 1082 - static int si470x_fops_open(struct inode *inode, struct file *file) 1083 { 1084 struct si470x_device *radio = video_drvdata(file); 1085 int retval; ··· 1109 /* 1110 * si470x_fops_release - file release 1111 */ 1112 - static int si470x_fops_release(struct inode *inode, struct file *file) 1113 { 1114 struct si470x_device *radio = video_drvdata(file); 1115 int retval = 0; ··· 1151 /* 1152 * si470x_fops - file operations interface 1153 */ 1154 - static const struct file_operations si470x_fops = { 1155 .owner = THIS_MODULE, 1156 - .llseek = no_llseek, 1157 .read = si470x_fops_read, 1158 .poll = si470x_fops_poll, 1159 .ioctl = video_ioctl2, 1160 - #ifdef CONFIG_COMPAT 1161 - .compat_ioctl = v4l_compat_ioctl32, 1162 - #endif 1163 .open = si470x_fops_open, 1164 .release = si470x_fops_release, 1165 };
··· 96 * 2008-10-20 Alexey Klimov <klimov.linux@gmail.com> 97 * - add support for KWorld USB FM Radio FM700 98 * - blacklisted KWorld radio in hid-core.c and hid-ids.h 99 + * 2008-12-03 Mark Lord <mlord@pobox.com> 100 + * - add support for DealExtreme USB Radio 101 * 102 * ToDo: 103 * - add firmware download/update support ··· 138 { USB_DEVICE_AND_INTERFACE_INFO(0x06e1, 0xa155, USB_CLASS_HID, 0, 0) }, 139 /* KWorld USB FM Radio SnapMusic Mobile 700 (FM700) */ 140 { USB_DEVICE_AND_INTERFACE_INFO(0x1b80, 0xd700, USB_CLASS_HID, 0, 0) }, 141 + /* DealExtreme USB Radio */ 142 + { USB_DEVICE_AND_INTERFACE_INFO(0x10c5, 0x819a, USB_CLASS_HID, 0, 0) }, 143 /* Terminating entry */ 144 { } 145 }; ··· 1075 /* 1076 * si470x_fops_open - file open 1077 */ 1078 + static int si470x_fops_open(struct file *file) 1079 { 1080 struct si470x_device *radio = video_drvdata(file); 1081 int retval; ··· 1105 /* 1106 * si470x_fops_release - file release 1107 */ 1108 + static int si470x_fops_release(struct file *file) 1109 { 1110 struct si470x_device *radio = video_drvdata(file); 1111 int retval = 0; ··· 1147 /* 1148 * si470x_fops - file operations interface 1149 */ 1150 + static const struct v4l2_file_operations si470x_fops = { 1151 .owner = THIS_MODULE, 1152 .read = si470x_fops_read, 1153 .poll = si470x_fops_poll, 1154 .ioctl = video_ioctl2, 1155 .open = si470x_fops_open, 1156 .release = si470x_fops_release, 1157 };
+634
drivers/media/radio/radio-tea5764.c
···
··· 1 + /* 2 + * driver/media/radio/radio-tea5764.c 3 + * 4 + * Driver for TEA5764 radio chip for linux 2.6. 5 + * This driver is for TEA5764 chip from NXP, used in EZX phones from Motorola. 6 + * The I2C protocol is used for communicate with chip. 7 + * 8 + * Based in radio-tea5761.c Copyright (C) 2005 Nokia Corporation 9 + * 10 + * Copyright (c) 2008 Fabio Belavenuto <belavenuto@gmail.com> 11 + * 12 + * This program is free software; you can redistribute it and/or modify 13 + * it under the terms of the GNU General Public License as published by 14 + * the Free Software Foundation; either version 2 of the License, or 15 + * (at your option) any later version. 16 + * 17 + * This program is distributed in the hope that it will be useful, 18 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 + * GNU General Public License for more details. 21 + * 22 + * You should have received a copy of the GNU General Public License 23 + * along with this program; if not, write to the Free Software 24 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 + * 26 + * History: 27 + * 2008-12-06 Fabio Belavenuto <belavenuto@gmail.com> 28 + * initial code 29 + * 30 + * TODO: 31 + * add platform_data support for IRQs platform dependencies 32 + * add RDS support 33 + */ 34 + #include <linux/kernel.h> 35 + #include <linux/module.h> 36 + #include <linux/init.h> /* Initdata */ 37 + #include <linux/videodev2.h> /* kernel radio structs */ 38 + #include <linux/i2c.h> /* I2C */ 39 + #include <media/v4l2-common.h> 40 + #include <media/v4l2-ioctl.h> 41 + #include <linux/version.h> /* for KERNEL_VERSION MACRO */ 42 + 43 + #define DRIVER_VERSION "v0.01" 44 + #define RADIO_VERSION KERNEL_VERSION(0, 0, 1) 45 + 46 + #define DRIVER_AUTHOR "Fabio Belavenuto <belavenuto@gmail.com>" 47 + #define DRIVER_DESC "A driver for the TEA5764 radio chip for EZX Phones." 48 + 49 + #define PINFO(format, ...)\ 50 + printk(KERN_INFO KBUILD_MODNAME ": "\ 51 + DRIVER_VERSION ": " format "\n", ## __VA_ARGS__) 52 + #define PWARN(format, ...)\ 53 + printk(KERN_WARNING KBUILD_MODNAME ": "\ 54 + DRIVER_VERSION ": " format "\n", ## __VA_ARGS__) 55 + # define PDEBUG(format, ...)\ 56 + printk(KERN_DEBUG KBUILD_MODNAME ": "\ 57 + DRIVER_VERSION ": " format "\n", ## __VA_ARGS__) 58 + 59 + /* Frequency limits in MHz -- these are European values. For Japanese 60 + devices, that would be 76000 and 91000. */ 61 + #define FREQ_MIN 87500 62 + #define FREQ_MAX 108000 63 + #define FREQ_MUL 16 64 + 65 + /* TEA5764 registers */ 66 + #define TEA5764_MANID 0x002b 67 + #define TEA5764_CHIPID 0x5764 68 + 69 + #define TEA5764_INTREG_BLMSK 0x0001 70 + #define TEA5764_INTREG_FRRMSK 0x0002 71 + #define TEA5764_INTREG_LEVMSK 0x0008 72 + #define TEA5764_INTREG_IFMSK 0x0010 73 + #define TEA5764_INTREG_BLMFLAG 0x0100 74 + #define TEA5764_INTREG_FRRFLAG 0x0200 75 + #define TEA5764_INTREG_LEVFLAG 0x0800 76 + #define TEA5764_INTREG_IFFLAG 0x1000 77 + 78 + #define TEA5764_FRQSET_SUD 0x8000 79 + #define TEA5764_FRQSET_SM 0x4000 80 + 81 + #define TEA5764_TNCTRL_PUPD1 0x8000 82 + #define TEA5764_TNCTRL_PUPD0 0x4000 83 + #define TEA5764_TNCTRL_BLIM 0x2000 84 + #define TEA5764_TNCTRL_SWPM 0x1000 85 + #define TEA5764_TNCTRL_IFCTC 0x0800 86 + #define TEA5764_TNCTRL_AFM 0x0400 87 + #define TEA5764_TNCTRL_SMUTE 0x0200 88 + #define TEA5764_TNCTRL_SNC 0x0100 89 + #define TEA5764_TNCTRL_MU 0x0080 90 + #define TEA5764_TNCTRL_SSL1 0x0040 91 + #define TEA5764_TNCTRL_SSL0 0x0020 92 + #define TEA5764_TNCTRL_HLSI 0x0010 93 + #define TEA5764_TNCTRL_MST 0x0008 94 + #define TEA5764_TNCTRL_SWP 0x0004 95 + #define TEA5764_TNCTRL_DTC 0x0002 96 + #define TEA5764_TNCTRL_AHLSI 0x0001 97 + 98 + #define TEA5764_TUNCHK_LEVEL(x) (((x) & 0x00F0) >> 4) 99 + #define TEA5764_TUNCHK_IFCNT(x) (((x) & 0xFE00) >> 9) 100 + #define TEA5764_TUNCHK_TUNTO 0x0100 101 + #define TEA5764_TUNCHK_LD 0x0008 102 + #define TEA5764_TUNCHK_STEREO 0x0004 103 + 104 + #define TEA5764_TESTREG_TRIGFR 0x0800 105 + 106 + struct tea5764_regs { 107 + u16 intreg; /* INTFLAG & INTMSK */ 108 + u16 frqset; /* FRQSETMSB & FRQSETLSB */ 109 + u16 tnctrl; /* TNCTRL1 & TNCTRL2 */ 110 + u16 frqchk; /* FRQCHKMSB & FRQCHKLSB */ 111 + u16 tunchk; /* IFCHK & LEVCHK */ 112 + u16 testreg; /* TESTBITS & TESTMODE */ 113 + u16 rdsstat; /* RDSSTAT1 & RDSSTAT2 */ 114 + u16 rdslb; /* RDSLBMSB & RDSLBLSB */ 115 + u16 rdspb; /* RDSPBMSB & RDSPBLSB */ 116 + u16 rdsbc; /* RDSBBC & RDSGBC */ 117 + u16 rdsctrl; /* RDSCTRL1 & RDSCTRL2 */ 118 + u16 rdsbbl; /* PAUSEDET & RDSBBL */ 119 + u16 manid; /* MANID1 & MANID2 */ 120 + u16 chipid; /* CHIPID1 & CHIPID2 */ 121 + } __attribute__ ((packed)); 122 + 123 + struct tea5764_write_regs { 124 + u8 intreg; /* INTMSK */ 125 + u16 frqset; /* FRQSETMSB & FRQSETLSB */ 126 + u16 tnctrl; /* TNCTRL1 & TNCTRL2 */ 127 + u16 testreg; /* TESTBITS & TESTMODE */ 128 + u16 rdsctrl; /* RDSCTRL1 & RDSCTRL2 */ 129 + u16 rdsbbl; /* PAUSEDET & RDSBBL */ 130 + } __attribute__ ((packed)); 131 + 132 + #ifndef RADIO_TEA5764_XTAL 133 + #define RADIO_TEA5764_XTAL 1 134 + #endif 135 + 136 + static int radio_nr = -1; 137 + static int use_xtal = RADIO_TEA5764_XTAL; 138 + 139 + struct tea5764_device { 140 + struct i2c_client *i2c_client; 141 + struct video_device *videodev; 142 + struct tea5764_regs regs; 143 + struct mutex mutex; 144 + int users; 145 + }; 146 + 147 + /* I2C code related */ 148 + int tea5764_i2c_read(struct tea5764_device *radio) 149 + { 150 + int i; 151 + u16 *p = (u16 *) &radio->regs; 152 + 153 + struct i2c_msg msgs[1] = { 154 + { radio->i2c_client->addr, I2C_M_RD, sizeof(radio->regs), 155 + (void *)&radio->regs }, 156 + }; 157 + if (i2c_transfer(radio->i2c_client->adapter, msgs, 1) != 1) 158 + return -EIO; 159 + for (i = 0; i < sizeof(struct tea5764_regs) / sizeof(u16); i++) 160 + p[i] = __be16_to_cpu(p[i]); 161 + 162 + return 0; 163 + } 164 + 165 + int tea5764_i2c_write(struct tea5764_device *radio) 166 + { 167 + struct tea5764_write_regs wr; 168 + struct tea5764_regs *r = &radio->regs; 169 + struct i2c_msg msgs[1] = { 170 + { radio->i2c_client->addr, 0, sizeof(wr), (void *) &wr }, 171 + }; 172 + wr.intreg = r->intreg & 0xff; 173 + wr.frqset = __cpu_to_be16(r->frqset); 174 + wr.tnctrl = __cpu_to_be16(r->tnctrl); 175 + wr.testreg = __cpu_to_be16(r->testreg); 176 + wr.rdsctrl = __cpu_to_be16(r->rdsctrl); 177 + wr.rdsbbl = __cpu_to_be16(r->rdsbbl); 178 + if (i2c_transfer(radio->i2c_client->adapter, msgs, 1) != 1) 179 + return -EIO; 180 + return 0; 181 + } 182 + 183 + /* V4L2 code related */ 184 + static struct v4l2_queryctrl radio_qctrl[] = { 185 + { 186 + .id = V4L2_CID_AUDIO_MUTE, 187 + .name = "Mute", 188 + .minimum = 0, 189 + .maximum = 1, 190 + .default_value = 1, 191 + .type = V4L2_CTRL_TYPE_BOOLEAN, 192 + } 193 + }; 194 + 195 + static void tea5764_power_up(struct tea5764_device *radio) 196 + { 197 + struct tea5764_regs *r = &radio->regs; 198 + 199 + if (!(r->tnctrl & TEA5764_TNCTRL_PUPD0)) { 200 + r->tnctrl &= ~(TEA5764_TNCTRL_AFM | TEA5764_TNCTRL_MU | 201 + TEA5764_TNCTRL_HLSI); 202 + if (!use_xtal) 203 + r->testreg |= TEA5764_TESTREG_TRIGFR; 204 + else 205 + r->testreg &= ~TEA5764_TESTREG_TRIGFR; 206 + 207 + r->tnctrl |= TEA5764_TNCTRL_PUPD0; 208 + tea5764_i2c_write(radio); 209 + } 210 + } 211 + 212 + static void tea5764_power_down(struct tea5764_device *radio) 213 + { 214 + struct tea5764_regs *r = &radio->regs; 215 + 216 + if (r->tnctrl & TEA5764_TNCTRL_PUPD0) { 217 + r->tnctrl &= ~TEA5764_TNCTRL_PUPD0; 218 + tea5764_i2c_write(radio); 219 + } 220 + } 221 + 222 + static void tea5764_set_freq(struct tea5764_device *radio, int freq) 223 + { 224 + struct tea5764_regs *r = &radio->regs; 225 + 226 + /* formula: (freq [+ or -] 225000) / 8192 */ 227 + if (r->tnctrl & TEA5764_TNCTRL_HLSI) 228 + r->frqset = (freq + 225000) / 8192; 229 + else 230 + r->frqset = (freq - 225000) / 8192; 231 + } 232 + 233 + static int tea5764_get_freq(struct tea5764_device *radio) 234 + { 235 + struct tea5764_regs *r = &radio->regs; 236 + 237 + if (r->tnctrl & TEA5764_TNCTRL_HLSI) 238 + return (r->frqchk * 8192) - 225000; 239 + else 240 + return (r->frqchk * 8192) + 225000; 241 + } 242 + 243 + /* tune an frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */ 244 + static void tea5764_tune(struct tea5764_device *radio, int freq) 245 + { 246 + tea5764_set_freq(radio, freq); 247 + if (tea5764_i2c_write(radio)) 248 + PWARN("Could not set frequency!"); 249 + } 250 + 251 + static void tea5764_set_audout_mode(struct tea5764_device *radio, int audmode) 252 + { 253 + struct tea5764_regs *r = &radio->regs; 254 + int tnctrl = r->tnctrl; 255 + 256 + if (audmode == V4L2_TUNER_MODE_MONO) 257 + r->tnctrl |= TEA5764_TNCTRL_MST; 258 + else 259 + r->tnctrl &= ~TEA5764_TNCTRL_MST; 260 + if (tnctrl != r->tnctrl) 261 + tea5764_i2c_write(radio); 262 + } 263 + 264 + static int tea5764_get_audout_mode(struct tea5764_device *radio) 265 + { 266 + struct tea5764_regs *r = &radio->regs; 267 + 268 + if (r->tnctrl & TEA5764_TNCTRL_MST) 269 + return V4L2_TUNER_MODE_MONO; 270 + else 271 + return V4L2_TUNER_MODE_STEREO; 272 + } 273 + 274 + static void tea5764_mute(struct tea5764_device *radio, int on) 275 + { 276 + struct tea5764_regs *r = &radio->regs; 277 + int tnctrl = r->tnctrl; 278 + 279 + if (on) 280 + r->tnctrl |= TEA5764_TNCTRL_MU; 281 + else 282 + r->tnctrl &= ~TEA5764_TNCTRL_MU; 283 + if (tnctrl != r->tnctrl) 284 + tea5764_i2c_write(radio); 285 + } 286 + 287 + static int tea5764_is_muted(struct tea5764_device *radio) 288 + { 289 + return radio->regs.tnctrl & TEA5764_TNCTRL_MU; 290 + } 291 + 292 + /* V4L2 vidioc */ 293 + static int vidioc_querycap(struct file *file, void *priv, 294 + struct v4l2_capability *v) 295 + { 296 + struct tea5764_device *radio = video_drvdata(file); 297 + struct video_device *dev = radio->videodev; 298 + 299 + strlcpy(v->driver, dev->dev.driver->name, sizeof(v->driver)); 300 + strlcpy(v->card, dev->name, sizeof(v->card)); 301 + snprintf(v->bus_info, sizeof(v->bus_info), "I2C:%s", dev->dev.bus_id); 302 + v->version = RADIO_VERSION; 303 + v->capabilities = V4L2_CAP_TUNER | V4L2_CAP_RADIO; 304 + return 0; 305 + } 306 + 307 + static int vidioc_g_tuner(struct file *file, void *priv, 308 + struct v4l2_tuner *v) 309 + { 310 + struct tea5764_device *radio = video_drvdata(file); 311 + struct tea5764_regs *r = &radio->regs; 312 + 313 + if (v->index > 0) 314 + return -EINVAL; 315 + 316 + memset(v, 0, sizeof(v)); 317 + strcpy(v->name, "FM"); 318 + v->type = V4L2_TUNER_RADIO; 319 + tea5764_i2c_read(radio); 320 + v->rangelow = FREQ_MIN * FREQ_MUL; 321 + v->rangehigh = FREQ_MAX * FREQ_MUL; 322 + v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; 323 + if (r->tunchk & TEA5764_TUNCHK_STEREO) 324 + v->rxsubchans = V4L2_TUNER_SUB_STEREO; 325 + v->audmode = tea5764_get_audout_mode(radio); 326 + v->signal = TEA5764_TUNCHK_LEVEL(r->tunchk) * 0xffff / 0xf; 327 + v->afc = TEA5764_TUNCHK_IFCNT(r->tunchk); 328 + 329 + return 0; 330 + } 331 + 332 + static int vidioc_s_tuner(struct file *file, void *priv, 333 + struct v4l2_tuner *v) 334 + { 335 + struct tea5764_device *radio = video_drvdata(file); 336 + 337 + if (v->index > 0) 338 + return -EINVAL; 339 + 340 + tea5764_set_audout_mode(radio, v->audmode); 341 + return 0; 342 + } 343 + 344 + static int vidioc_s_frequency(struct file *file, void *priv, 345 + struct v4l2_frequency *f) 346 + { 347 + struct tea5764_device *radio = video_drvdata(file); 348 + 349 + if (f->tuner != 0) 350 + return -EINVAL; 351 + if (f->frequency == 0) { 352 + /* We special case this as a power down control. */ 353 + tea5764_power_down(radio); 354 + } 355 + if (f->frequency < (FREQ_MIN * FREQ_MUL)) 356 + return -EINVAL; 357 + if (f->frequency > (FREQ_MAX * FREQ_MUL)) 358 + return -EINVAL; 359 + tea5764_power_up(radio); 360 + tea5764_tune(radio, (f->frequency * 125) / 2); 361 + return 0; 362 + } 363 + 364 + static int vidioc_g_frequency(struct file *file, void *priv, 365 + struct v4l2_frequency *f) 366 + { 367 + struct tea5764_device *radio = video_drvdata(file); 368 + struct tea5764_regs *r = &radio->regs; 369 + 370 + tea5764_i2c_read(radio); 371 + memset(f, 0, sizeof(f)); 372 + f->type = V4L2_TUNER_RADIO; 373 + if (r->tnctrl & TEA5764_TNCTRL_PUPD0) 374 + f->frequency = (tea5764_get_freq(radio) * 2) / 125; 375 + else 376 + f->frequency = 0; 377 + 378 + return 0; 379 + } 380 + 381 + static int vidioc_queryctrl(struct file *file, void *priv, 382 + struct v4l2_queryctrl *qc) 383 + { 384 + int i; 385 + 386 + for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { 387 + if (qc->id && qc->id == radio_qctrl[i].id) { 388 + memcpy(qc, &(radio_qctrl[i]), sizeof(*qc)); 389 + return 0; 390 + } 391 + } 392 + return -EINVAL; 393 + } 394 + 395 + static int vidioc_g_ctrl(struct file *file, void *priv, 396 + struct v4l2_control *ctrl) 397 + { 398 + struct tea5764_device *radio = video_drvdata(file); 399 + 400 + switch (ctrl->id) { 401 + case V4L2_CID_AUDIO_MUTE: 402 + tea5764_i2c_read(radio); 403 + ctrl->value = tea5764_is_muted(radio) ? 1 : 0; 404 + return 0; 405 + } 406 + return -EINVAL; 407 + } 408 + 409 + static int vidioc_s_ctrl(struct file *file, void *priv, 410 + struct v4l2_control *ctrl) 411 + { 412 + struct tea5764_device *radio = video_drvdata(file); 413 + 414 + switch (ctrl->id) { 415 + case V4L2_CID_AUDIO_MUTE: 416 + tea5764_mute(radio, ctrl->value); 417 + return 0; 418 + } 419 + return -EINVAL; 420 + } 421 + 422 + static int vidioc_g_input(struct file *filp, void *priv, unsigned int *i) 423 + { 424 + *i = 0; 425 + return 0; 426 + } 427 + 428 + static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) 429 + { 430 + if (i != 0) 431 + return -EINVAL; 432 + return 0; 433 + } 434 + 435 + static int vidioc_g_audio(struct file *file, void *priv, 436 + struct v4l2_audio *a) 437 + { 438 + if (a->index > 1) 439 + return -EINVAL; 440 + 441 + strcpy(a->name, "Radio"); 442 + a->capability = V4L2_AUDCAP_STEREO; 443 + return 0; 444 + } 445 + 446 + static int vidioc_s_audio(struct file *file, void *priv, 447 + struct v4l2_audio *a) 448 + { 449 + if (a->index != 0) 450 + return -EINVAL; 451 + 452 + return 0; 453 + } 454 + 455 + static int tea5764_open(struct file *file) 456 + { 457 + /* Currently we support only one device */ 458 + int minor = video_devdata(file)->minor; 459 + struct tea5764_device *radio = video_drvdata(file); 460 + 461 + if (radio->videodev->minor != minor) 462 + return -ENODEV; 463 + 464 + mutex_lock(&radio->mutex); 465 + /* Only exclusive access */ 466 + if (radio->users) { 467 + mutex_unlock(&radio->mutex); 468 + return -EBUSY; 469 + } 470 + radio->users++; 471 + mutex_unlock(&radio->mutex); 472 + file->private_data = radio; 473 + return 0; 474 + } 475 + 476 + static int tea5764_close(struct file *file) 477 + { 478 + struct tea5764_device *radio = video_drvdata(file); 479 + 480 + if (!radio) 481 + return -ENODEV; 482 + mutex_lock(&radio->mutex); 483 + radio->users--; 484 + mutex_unlock(&radio->mutex); 485 + return 0; 486 + } 487 + 488 + /* File system interface */ 489 + static const struct v4l2_file_operations tea5764_fops = { 490 + .owner = THIS_MODULE, 491 + .open = tea5764_open, 492 + .release = tea5764_close, 493 + .ioctl = video_ioctl2, 494 + }; 495 + 496 + static const struct v4l2_ioctl_ops tea5764_ioctl_ops = { 497 + .vidioc_querycap = vidioc_querycap, 498 + .vidioc_g_tuner = vidioc_g_tuner, 499 + .vidioc_s_tuner = vidioc_s_tuner, 500 + .vidioc_g_audio = vidioc_g_audio, 501 + .vidioc_s_audio = vidioc_s_audio, 502 + .vidioc_g_input = vidioc_g_input, 503 + .vidioc_s_input = vidioc_s_input, 504 + .vidioc_g_frequency = vidioc_g_frequency, 505 + .vidioc_s_frequency = vidioc_s_frequency, 506 + .vidioc_queryctrl = vidioc_queryctrl, 507 + .vidioc_g_ctrl = vidioc_g_ctrl, 508 + .vidioc_s_ctrl = vidioc_s_ctrl, 509 + }; 510 + 511 + /* V4L2 interface */ 512 + static struct video_device tea5764_radio_template = { 513 + .name = "TEA5764 FM-Radio", 514 + .fops = &tea5764_fops, 515 + .ioctl_ops = &tea5764_ioctl_ops, 516 + .release = video_device_release, 517 + }; 518 + 519 + /* I2C probe: check if the device exists and register with v4l if it is */ 520 + static int __devinit tea5764_i2c_probe(struct i2c_client *client, 521 + const struct i2c_device_id *id) 522 + { 523 + struct tea5764_device *radio; 524 + struct tea5764_regs *r; 525 + int ret; 526 + 527 + PDEBUG("probe"); 528 + radio = kmalloc(sizeof(struct tea5764_device), GFP_KERNEL); 529 + if (!radio) 530 + return -ENOMEM; 531 + 532 + mutex_init(&radio->mutex); 533 + radio->i2c_client = client; 534 + ret = tea5764_i2c_read(radio); 535 + if (ret) 536 + goto errfr; 537 + r = &radio->regs; 538 + PDEBUG("chipid = %04X, manid = %04X", r->chipid, r->manid); 539 + if (r->chipid != TEA5764_CHIPID || 540 + (r->manid & 0x0fff) != TEA5764_MANID) { 541 + PWARN("This chip is not a TEA5764!"); 542 + ret = -EINVAL; 543 + goto errfr; 544 + } 545 + 546 + radio->videodev = video_device_alloc(); 547 + if (!(radio->videodev)) { 548 + ret = -ENOMEM; 549 + goto errfr; 550 + } 551 + memcpy(radio->videodev, &tea5764_radio_template, 552 + sizeof(tea5764_radio_template)); 553 + 554 + i2c_set_clientdata(client, radio); 555 + video_set_drvdata(radio->videodev, radio); 556 + 557 + ret = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); 558 + if (ret < 0) { 559 + PWARN("Could not register video device!"); 560 + goto errrel; 561 + } 562 + 563 + /* initialize and power off the chip */ 564 + tea5764_i2c_read(radio); 565 + tea5764_set_audout_mode(radio, V4L2_TUNER_MODE_STEREO); 566 + tea5764_mute(radio, 1); 567 + tea5764_power_down(radio); 568 + 569 + PINFO("registered."); 570 + return 0; 571 + errrel: 572 + video_device_release(radio->videodev); 573 + errfr: 574 + kfree(radio); 575 + return ret; 576 + } 577 + 578 + static int __devexit tea5764_i2c_remove(struct i2c_client *client) 579 + { 580 + struct tea5764_device *radio = i2c_get_clientdata(client); 581 + 582 + PDEBUG("remove"); 583 + if (radio) { 584 + tea5764_power_down(radio); 585 + video_unregister_device(radio->videodev); 586 + kfree(radio); 587 + } 588 + return 0; 589 + } 590 + 591 + /* I2C subsystem interface */ 592 + static const struct i2c_device_id tea5764_id[] = { 593 + { "radio-tea5764", 0 }, 594 + { } /* Terminating entry */ 595 + }; 596 + MODULE_DEVICE_TABLE(i2c, tea5764_id); 597 + 598 + static struct i2c_driver tea5764_i2c_driver = { 599 + .driver = { 600 + .name = "radio-tea5764", 601 + .owner = THIS_MODULE, 602 + }, 603 + .probe = tea5764_i2c_probe, 604 + .remove = __devexit_p(tea5764_i2c_remove), 605 + .id_table = tea5764_id, 606 + }; 607 + 608 + /* init the driver */ 609 + static int __init tea5764_init(void) 610 + { 611 + int ret = i2c_add_driver(&tea5764_i2c_driver); 612 + 613 + printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_VERSION ": " 614 + DRIVER_DESC "\n"); 615 + return ret; 616 + } 617 + 618 + /* cleanup the driver */ 619 + static void __exit tea5764_exit(void) 620 + { 621 + i2c_del_driver(&tea5764_i2c_driver); 622 + } 623 + 624 + MODULE_AUTHOR(DRIVER_AUTHOR); 625 + MODULE_DESCRIPTION(DRIVER_DESC); 626 + MODULE_LICENSE("GPL"); 627 + 628 + module_param(use_xtal, int, 1); 629 + MODULE_PARM_DESC(use_xtal, "Chip have a xtal connected in board"); 630 + module_param(radio_nr, int, 0); 631 + MODULE_PARM_DESC(radio_nr, "video4linux device number to use"); 632 + 633 + module_init(tea5764_init); 634 + module_exit(tea5764_exit);
+3 -7
drivers/media/radio/radio-terratec.c
··· 352 353 static struct tt_device terratec_unit; 354 355 - static int terratec_exclusive_open(struct inode *inode, struct file *file) 356 { 357 return test_and_set_bit(0, &terratec_unit.in_use) ? -EBUSY : 0; 358 } 359 360 - static int terratec_exclusive_release(struct inode *inode, struct file *file) 361 { 362 clear_bit(0, &terratec_unit.in_use); 363 return 0; 364 } 365 366 - static const struct file_operations terratec_fops = { 367 .owner = THIS_MODULE, 368 .open = terratec_exclusive_open, 369 .release = terratec_exclusive_release, 370 .ioctl = video_ioctl2, 371 - #ifdef CONFIG_COMPAT 372 - .compat_ioctl = v4l_compat_ioctl32, 373 - #endif 374 - .llseek = no_llseek, 375 }; 376 377 static const struct v4l2_ioctl_ops terratec_ioctl_ops = {
··· 352 353 static struct tt_device terratec_unit; 354 355 + static int terratec_exclusive_open(struct file *file) 356 { 357 return test_and_set_bit(0, &terratec_unit.in_use) ? -EBUSY : 0; 358 } 359 360 + static int terratec_exclusive_release(struct file *file) 361 { 362 clear_bit(0, &terratec_unit.in_use); 363 return 0; 364 } 365 366 + static const struct v4l2_file_operations terratec_fops = { 367 .owner = THIS_MODULE, 368 .open = terratec_exclusive_open, 369 .release = terratec_exclusive_release, 370 .ioctl = video_ioctl2, 371 }; 372 373 static const struct v4l2_ioctl_ops terratec_ioctl_ops = {
+3 -7
drivers/media/radio/radio-trust.c
··· 337 return 0; 338 } 339 340 - static int trust_exclusive_open(struct inode *inode, struct file *file) 341 { 342 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 343 } 344 345 - static int trust_exclusive_release(struct inode *inode, struct file *file) 346 { 347 clear_bit(0, &in_use); 348 return 0; 349 } 350 351 - static const struct file_operations trust_fops = { 352 .owner = THIS_MODULE, 353 .open = trust_exclusive_open, 354 .release = trust_exclusive_release, 355 .ioctl = video_ioctl2, 356 - #ifdef CONFIG_COMPAT 357 - .compat_ioctl = v4l_compat_ioctl32, 358 - #endif 359 - .llseek = no_llseek, 360 }; 361 362 static const struct v4l2_ioctl_ops trust_ioctl_ops = {
··· 337 return 0; 338 } 339 340 + static int trust_exclusive_open(struct file *file) 341 { 342 return test_and_set_bit(0, &in_use) ? -EBUSY : 0; 343 } 344 345 + static int trust_exclusive_release(struct file *file) 346 { 347 clear_bit(0, &in_use); 348 return 0; 349 } 350 351 + static const struct v4l2_file_operations trust_fops = { 352 .owner = THIS_MODULE, 353 .open = trust_exclusive_open, 354 .release = trust_exclusive_release, 355 .ioctl = video_ioctl2, 356 }; 357 358 static const struct v4l2_ioctl_ops trust_ioctl_ops = {
+3 -7
drivers/media/radio/radio-typhoon.c
··· 330 .mutefreq = CONFIG_RADIO_TYPHOON_MUTEFREQ, 331 }; 332 333 - static int typhoon_exclusive_open(struct inode *inode, struct file *file) 334 { 335 return test_and_set_bit(0, &typhoon_unit.in_use) ? -EBUSY : 0; 336 } 337 338 - static int typhoon_exclusive_release(struct inode *inode, struct file *file) 339 { 340 clear_bit(0, &typhoon_unit.in_use); 341 return 0; 342 } 343 344 - static const struct file_operations typhoon_fops = { 345 .owner = THIS_MODULE, 346 .open = typhoon_exclusive_open, 347 .release = typhoon_exclusive_release, 348 .ioctl = video_ioctl2, 349 - #ifdef CONFIG_COMPAT 350 - .compat_ioctl = v4l_compat_ioctl32, 351 - #endif 352 - .llseek = no_llseek, 353 }; 354 355 static const struct v4l2_ioctl_ops typhoon_ioctl_ops = {
··· 330 .mutefreq = CONFIG_RADIO_TYPHOON_MUTEFREQ, 331 }; 332 333 + static int typhoon_exclusive_open(struct file *file) 334 { 335 return test_and_set_bit(0, &typhoon_unit.in_use) ? -EBUSY : 0; 336 } 337 338 + static int typhoon_exclusive_release(struct file *file) 339 { 340 clear_bit(0, &typhoon_unit.in_use); 341 return 0; 342 } 343 344 + static const struct v4l2_file_operations typhoon_fops = { 345 .owner = THIS_MODULE, 346 .open = typhoon_exclusive_open, 347 .release = typhoon_exclusive_release, 348 .ioctl = video_ioctl2, 349 }; 350 351 static const struct v4l2_ioctl_ops typhoon_ioctl_ops = {
+3 -7
drivers/media/radio/radio-zoltrix.c
··· 401 402 static struct zol_device zoltrix_unit; 403 404 - static int zoltrix_exclusive_open(struct inode *inode, struct file *file) 405 { 406 return test_and_set_bit(0, &zoltrix_unit.in_use) ? -EBUSY : 0; 407 } 408 409 - static int zoltrix_exclusive_release(struct inode *inode, struct file *file) 410 { 411 clear_bit(0, &zoltrix_unit.in_use); 412 return 0; 413 } 414 415 - static const struct file_operations zoltrix_fops = 416 { 417 .owner = THIS_MODULE, 418 .open = zoltrix_exclusive_open, 419 .release = zoltrix_exclusive_release, 420 .ioctl = video_ioctl2, 421 - #ifdef CONFIG_COMPAT 422 - .compat_ioctl = v4l_compat_ioctl32, 423 - #endif 424 - .llseek = no_llseek, 425 }; 426 427 static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = {
··· 401 402 static struct zol_device zoltrix_unit; 403 404 + static int zoltrix_exclusive_open(struct file *file) 405 { 406 return test_and_set_bit(0, &zoltrix_unit.in_use) ? -EBUSY : 0; 407 } 408 409 + static int zoltrix_exclusive_release(struct file *file) 410 { 411 clear_bit(0, &zoltrix_unit.in_use); 412 return 0; 413 } 414 415 + static const struct v4l2_file_operations zoltrix_fops = 416 { 417 .owner = THIS_MODULE, 418 .open = zoltrix_exclusive_open, 419 .release = zoltrix_exclusive_release, 420 .ioctl = video_ioctl2, 421 }; 422 423 static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = {
+4 -1
drivers/media/video/Makefile
··· 12 13 videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-subdev.o 14 15 - obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-compat-ioctl32.o v4l2-int-device.o 16 17 obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o 18
··· 12 13 videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-subdev.o 14 15 + obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-int-device.o 16 + ifeq ($(CONFIG_COMPAT),y) 17 + obj-$(CONFIG_VIDEO_DEV) += v4l2-compat-ioctl32.o 18 + endif 19 20 obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o 21
+5 -9
drivers/media/video/arv.c
··· 396 return ret; 397 } 398 399 - static int ar_do_ioctl(struct file *file, unsigned int cmd, void *arg) 400 { 401 struct video_device *dev = video_devdata(file); 402 struct ar_device *ar = video_get_drvdata(dev); ··· 539 return 0; 540 } 541 542 - static int ar_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 543 unsigned long arg) 544 { 545 return video_usercopy(file, cmd, arg, ar_do_ioctl); ··· 744 ****************************************************************************/ 745 static struct ar_device ardev; 746 747 - static int ar_exclusive_open(struct inode *inode, struct file *file) 748 { 749 return test_and_set_bit(0, &ardev.in_use) ? -EBUSY : 0; 750 } 751 752 - static int ar_exclusive_release(struct inode *inode, struct file *file) 753 { 754 clear_bit(0, &ardev.in_use); 755 return 0; 756 } 757 758 - static const struct file_operations ar_fops = { 759 .owner = THIS_MODULE, 760 .open = ar_exclusive_open, 761 .release = ar_exclusive_release, 762 .read = ar_read, 763 .ioctl = ar_ioctl, 764 - #ifdef CONFIG_COMPAT 765 - .compat_ioctl = v4l_compat_ioctl32, 766 - #endif 767 - .llseek = no_llseek, 768 }; 769 770 static struct video_device ar_template = {
··· 396 return ret; 397 } 398 399 + static long ar_do_ioctl(struct file *file, unsigned int cmd, void *arg) 400 { 401 struct video_device *dev = video_devdata(file); 402 struct ar_device *ar = video_get_drvdata(dev); ··· 539 return 0; 540 } 541 542 + static long ar_ioctl(struct file *file, unsigned int cmd, 543 unsigned long arg) 544 { 545 return video_usercopy(file, cmd, arg, ar_do_ioctl); ··· 744 ****************************************************************************/ 745 static struct ar_device ardev; 746 747 + static int ar_exclusive_open(struct file *file) 748 { 749 return test_and_set_bit(0, &ardev.in_use) ? -EBUSY : 0; 750 } 751 752 + static int ar_exclusive_release(struct file *file) 753 { 754 clear_bit(0, &ardev.in_use); 755 return 0; 756 } 757 758 + static const struct v4l2_file_operations ar_fops = { 759 .owner = THIS_MODULE, 760 .open = ar_exclusive_open, 761 .release = ar_exclusive_release, 762 .read = ar_read, 763 .ioctl = ar_ioctl, 764 }; 765 766 static struct video_device ar_template = {
+14 -16
drivers/media/video/bt8xx/bttv-driver.c
··· 2039 2040 #ifdef CONFIG_VIDEO_ADV_DEBUG 2041 static int bttv_g_register(struct file *file, void *f, 2042 - struct v4l2_register *reg) 2043 { 2044 struct bttv_fh *fh = f; 2045 struct bttv *btv = fh->btv; ··· 2047 if (!capable(CAP_SYS_ADMIN)) 2048 return -EPERM; 2049 2050 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2051 return -EINVAL; 2052 2053 /* bt848 has a 12-bit register space */ 2054 reg->reg &= 0xfff; 2055 reg->val = btread(reg->reg); 2056 2057 return 0; 2058 } 2059 2060 static int bttv_s_register(struct file *file, void *f, 2061 - struct v4l2_register *reg) 2062 { 2063 struct bttv_fh *fh = f; 2064 struct bttv *btv = fh->btv; ··· 2067 if (!capable(CAP_SYS_ADMIN)) 2068 return -EPERM; 2069 2070 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2071 return -EINVAL; 2072 2073 /* bt848 has a 12-bit register space */ ··· 3209 return POLLERR; 3210 } 3211 3212 - static int bttv_open(struct inode *inode, struct file *file) 3213 { 3214 - int minor = iminor(inode); 3215 struct bttv *btv = NULL; 3216 struct bttv_fh *fh; 3217 enum v4l2_buf_type type = 0; ··· 3292 return 0; 3293 } 3294 3295 - static int bttv_release(struct inode *inode, struct file *file) 3296 { 3297 struct bttv_fh *fh = file->private_data; 3298 struct bttv *btv = fh->btv; ··· 3347 return videobuf_mmap_mapper(bttv_queue(fh),vma); 3348 } 3349 3350 - static const struct file_operations bttv_fops = 3351 { 3352 .owner = THIS_MODULE, 3353 .open = bttv_open, 3354 .release = bttv_release, 3355 .ioctl = video_ioctl2, 3356 - .compat_ioctl = v4l_compat_ioctl32, 3357 - .llseek = no_llseek, 3358 .read = bttv_read, 3359 .mmap = bttv_mmap, 3360 .poll = bttv_poll, ··· 3421 /* ----------------------------------------------------------------------- */ 3422 /* radio interface */ 3423 3424 - static int radio_open(struct inode *inode, struct file *file) 3425 { 3426 - int minor = iminor(inode); 3427 struct bttv *btv = NULL; 3428 struct bttv_fh *fh; 3429 unsigned int i; ··· 3466 return 0; 3467 } 3468 3469 - static int radio_release(struct inode *inode, struct file *file) 3470 { 3471 struct bttv_fh *fh = file->private_data; 3472 struct bttv *btv = fh->btv; 3473 struct rds_command cmd; 3474 3475 file->private_data = NULL; 3476 kfree(fh); 3477 ··· 3633 return cmd.result; 3634 } 3635 3636 - static const struct file_operations radio_fops = 3637 { 3638 .owner = THIS_MODULE, 3639 .open = radio_open, 3640 .read = radio_read, 3641 .release = radio_release, 3642 - .compat_ioctl = v4l_compat_ioctl32, 3643 .ioctl = video_ioctl2, 3644 - .llseek = no_llseek, 3645 .poll = radio_poll, 3646 }; 3647
··· 2039 2040 #ifdef CONFIG_VIDEO_ADV_DEBUG 2041 static int bttv_g_register(struct file *file, void *f, 2042 + struct v4l2_dbg_register *reg) 2043 { 2044 struct bttv_fh *fh = f; 2045 struct bttv *btv = fh->btv; ··· 2047 if (!capable(CAP_SYS_ADMIN)) 2048 return -EPERM; 2049 2050 + if (!v4l2_chip_match_host(&reg->match)) 2051 return -EINVAL; 2052 2053 /* bt848 has a 12-bit register space */ 2054 reg->reg &= 0xfff; 2055 reg->val = btread(reg->reg); 2056 + reg->size = 1; 2057 2058 return 0; 2059 } 2060 2061 static int bttv_s_register(struct file *file, void *f, 2062 + struct v4l2_dbg_register *reg) 2063 { 2064 struct bttv_fh *fh = f; 2065 struct bttv *btv = fh->btv; ··· 2066 if (!capable(CAP_SYS_ADMIN)) 2067 return -EPERM; 2068 2069 + if (!v4l2_chip_match_host(&reg->match)) 2070 return -EINVAL; 2071 2072 /* bt848 has a 12-bit register space */ ··· 3208 return POLLERR; 3209 } 3210 3211 + static int bttv_open(struct file *file) 3212 { 3213 + int minor = video_devdata(file)->minor; 3214 struct bttv *btv = NULL; 3215 struct bttv_fh *fh; 3216 enum v4l2_buf_type type = 0; ··· 3291 return 0; 3292 } 3293 3294 + static int bttv_release(struct file *file) 3295 { 3296 struct bttv_fh *fh = file->private_data; 3297 struct bttv *btv = fh->btv; ··· 3346 return videobuf_mmap_mapper(bttv_queue(fh),vma); 3347 } 3348 3349 + static const struct v4l2_file_operations bttv_fops = 3350 { 3351 .owner = THIS_MODULE, 3352 .open = bttv_open, 3353 .release = bttv_release, 3354 .ioctl = video_ioctl2, 3355 .read = bttv_read, 3356 .mmap = bttv_mmap, 3357 .poll = bttv_poll, ··· 3422 /* ----------------------------------------------------------------------- */ 3423 /* radio interface */ 3424 3425 + static int radio_open(struct file *file) 3426 { 3427 + int minor = video_devdata(file)->minor; 3428 struct bttv *btv = NULL; 3429 struct bttv_fh *fh; 3430 unsigned int i; ··· 3467 return 0; 3468 } 3469 3470 + static int radio_release(struct file *file) 3471 { 3472 struct bttv_fh *fh = file->private_data; 3473 struct bttv *btv = fh->btv; 3474 struct rds_command cmd; 3475 3476 + v4l2_prio_close(&btv->prio,&fh->prio); 3477 file->private_data = NULL; 3478 kfree(fh); 3479 ··· 3633 return cmd.result; 3634 } 3635 3636 + static const struct v4l2_file_operations radio_fops = 3637 { 3638 .owner = THIS_MODULE, 3639 .open = radio_open, 3640 .read = radio_read, 3641 .release = radio_release, 3642 .ioctl = video_ioctl2, 3643 .poll = radio_poll, 3644 }; 3645
+5 -9
drivers/media/video/bw-qcam.c
··· 706 * Video4linux interfacing 707 */ 708 709 - static int qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) 710 { 711 struct video_device *dev = video_devdata(file); 712 struct qcam_device *qcam=(struct qcam_device *)dev; ··· 863 return 0; 864 } 865 866 - static int qcam_ioctl(struct inode *inode, struct file *file, 867 unsigned int cmd, unsigned long arg) 868 { 869 return video_usercopy(file, cmd, arg, qcam_do_ioctl); ··· 893 return len; 894 } 895 896 - static int qcam_exclusive_open(struct inode *inode, struct file *file) 897 { 898 struct video_device *dev = video_devdata(file); 899 struct qcam_device *qcam = (struct qcam_device *)dev; ··· 901 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0; 902 } 903 904 - static int qcam_exclusive_release(struct inode *inode, struct file *file) 905 { 906 struct video_device *dev = video_devdata(file); 907 struct qcam_device *qcam = (struct qcam_device *)dev; ··· 910 return 0; 911 } 912 913 - static const struct file_operations qcam_fops = { 914 .owner = THIS_MODULE, 915 .open = qcam_exclusive_open, 916 .release = qcam_exclusive_release, 917 .ioctl = qcam_ioctl, 918 - #ifdef CONFIG_COMPAT 919 - .compat_ioctl = v4l_compat_ioctl32, 920 - #endif 921 .read = qcam_read, 922 - .llseek = no_llseek, 923 }; 924 static struct video_device qcam_template= 925 {
··· 706 * Video4linux interfacing 707 */ 708 709 + static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) 710 { 711 struct video_device *dev = video_devdata(file); 712 struct qcam_device *qcam=(struct qcam_device *)dev; ··· 863 return 0; 864 } 865 866 + static long qcam_ioctl(struct file *file, 867 unsigned int cmd, unsigned long arg) 868 { 869 return video_usercopy(file, cmd, arg, qcam_do_ioctl); ··· 893 return len; 894 } 895 896 + static int qcam_exclusive_open(struct file *file) 897 { 898 struct video_device *dev = video_devdata(file); 899 struct qcam_device *qcam = (struct qcam_device *)dev; ··· 901 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0; 902 } 903 904 + static int qcam_exclusive_release(struct file *file) 905 { 906 struct video_device *dev = video_devdata(file); 907 struct qcam_device *qcam = (struct qcam_device *)dev; ··· 910 return 0; 911 } 912 913 + static const struct v4l2_file_operations qcam_fops = { 914 .owner = THIS_MODULE, 915 .open = qcam_exclusive_open, 916 .release = qcam_exclusive_release, 917 .ioctl = qcam_ioctl, 918 .read = qcam_read, 919 }; 920 static struct video_device qcam_template= 921 {
+5 -9
drivers/media/video/c-qcam.c
··· 500 * Video4linux interfacing 501 */ 502 503 - static int qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) 504 { 505 struct video_device *dev = video_devdata(file); 506 struct qcam_device *qcam=(struct qcam_device *)dev; ··· 665 return 0; 666 } 667 668 - static int qcam_ioctl(struct inode *inode, struct file *file, 669 unsigned int cmd, unsigned long arg) 670 { 671 return video_usercopy(file, cmd, arg, qcam_do_ioctl); ··· 687 return len; 688 } 689 690 - static int qcam_exclusive_open(struct inode *inode, struct file *file) 691 { 692 struct video_device *dev = video_devdata(file); 693 struct qcam_device *qcam = (struct qcam_device *)dev; ··· 695 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0; 696 } 697 698 - static int qcam_exclusive_release(struct inode *inode, struct file *file) 699 { 700 struct video_device *dev = video_devdata(file); 701 struct qcam_device *qcam = (struct qcam_device *)dev; ··· 705 } 706 707 /* video device template */ 708 - static const struct file_operations qcam_fops = { 709 .owner = THIS_MODULE, 710 .open = qcam_exclusive_open, 711 .release = qcam_exclusive_release, 712 .ioctl = qcam_ioctl, 713 - #ifdef CONFIG_COMPAT 714 - .compat_ioctl = v4l_compat_ioctl32, 715 - #endif 716 .read = qcam_read, 717 - .llseek = no_llseek, 718 }; 719 720 static struct video_device qcam_template=
··· 500 * Video4linux interfacing 501 */ 502 503 + static long qcam_do_ioctl(struct file *file, unsigned int cmd, void *arg) 504 { 505 struct video_device *dev = video_devdata(file); 506 struct qcam_device *qcam=(struct qcam_device *)dev; ··· 665 return 0; 666 } 667 668 + static long qcam_ioctl(struct file *file, 669 unsigned int cmd, unsigned long arg) 670 { 671 return video_usercopy(file, cmd, arg, qcam_do_ioctl); ··· 687 return len; 688 } 689 690 + static int qcam_exclusive_open(struct file *file) 691 { 692 struct video_device *dev = video_devdata(file); 693 struct qcam_device *qcam = (struct qcam_device *)dev; ··· 695 return test_and_set_bit(0, &qcam->in_use) ? -EBUSY : 0; 696 } 697 698 + static int qcam_exclusive_release(struct file *file) 699 { 700 struct video_device *dev = video_devdata(file); 701 struct qcam_device *qcam = (struct qcam_device *)dev; ··· 705 } 706 707 /* video device template */ 708 + static const struct v4l2_file_operations qcam_fops = { 709 .owner = THIS_MODULE, 710 .open = qcam_exclusive_open, 711 .release = qcam_exclusive_release, 712 .ioctl = qcam_ioctl, 713 .read = qcam_read, 714 }; 715 716 static struct video_device qcam_template=
+8 -8
drivers/media/video/cafe_ccic.c
··· 859 */ 860 static int cafe_cam_init(struct cafe_camera *cam) 861 { 862 - struct v4l2_chip_ident chip = { V4L2_CHIP_MATCH_I2C_ADDR, 0, 0, 0 }; 863 int ret; 864 865 mutex_lock(&cam->s_mutex); ··· 869 ret = __cafe_cam_reset(cam); 870 if (ret) 871 goto out; 872 - chip.match_chip = cam->sensor->addr; 873 - ret = __cafe_cam_cmd(cam, VIDIOC_G_CHIP_IDENT, &chip); 874 if (ret) 875 goto out; 876 cam->sensor_type = chip.ident; ··· 1473 1474 1475 1476 - static int cafe_v4l_open(struct inode *inode, struct file *filp) 1477 { 1478 struct cafe_camera *cam; 1479 1480 - cam = cafe_find_dev(iminor(inode)); 1481 if (cam == NULL) 1482 return -ENODEV; 1483 filp->private_data = cam; ··· 1495 } 1496 1497 1498 - static int cafe_v4l_release(struct inode *inode, struct file *filp) 1499 { 1500 struct cafe_camera *cam = filp->private_data; 1501 ··· 1760 * clone it for specific real devices. 1761 */ 1762 1763 - static const struct file_operations cafe_v4l_fops = { 1764 .owner = THIS_MODULE, 1765 .open = cafe_v4l_open, 1766 .release = cafe_v4l_release, ··· 1768 .poll = cafe_v4l_poll, 1769 .mmap = cafe_v4l_mmap, 1770 .ioctl = video_ioctl2, 1771 - .llseek = no_llseek, 1772 }; 1773 1774 static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = {
··· 859 */ 860 static int cafe_cam_init(struct cafe_camera *cam) 861 { 862 + struct v4l2_dbg_chip_ident chip; 863 int ret; 864 865 mutex_lock(&cam->s_mutex); ··· 869 ret = __cafe_cam_reset(cam); 870 if (ret) 871 goto out; 872 + chip.match.type = V4L2_CHIP_MATCH_I2C_ADDR; 873 + chip.match.addr = cam->sensor->addr; 874 + ret = __cafe_cam_cmd(cam, VIDIOC_DBG_G_CHIP_IDENT, &chip); 875 if (ret) 876 goto out; 877 cam->sensor_type = chip.ident; ··· 1472 1473 1474 1475 + static int cafe_v4l_open(struct file *filp) 1476 { 1477 struct cafe_camera *cam; 1478 1479 + cam = cafe_find_dev(video_devdata(filp)->minor); 1480 if (cam == NULL) 1481 return -ENODEV; 1482 filp->private_data = cam; ··· 1494 } 1495 1496 1497 + static int cafe_v4l_release(struct file *filp) 1498 { 1499 struct cafe_camera *cam = filp->private_data; 1500 ··· 1759 * clone it for specific real devices. 1760 */ 1761 1762 + static const struct v4l2_file_operations cafe_v4l_fops = { 1763 .owner = THIS_MODULE, 1764 .open = cafe_v4l_open, 1765 .release = cafe_v4l_release, ··· 1767 .poll = cafe_v4l_poll, 1768 .mmap = cafe_v4l_mmap, 1769 .ioctl = video_ioctl2, 1770 }; 1771 1772 static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = {
+5 -9
drivers/media/video/cpia.c
··· 3148 } 3149 3150 /* ------------------------- V4L interface --------------------- */ 3151 - static int cpia_open(struct inode *inode, struct file *file) 3152 { 3153 struct video_device *dev = video_devdata(file); 3154 struct cam_data *cam = video_get_drvdata(dev); ··· 3225 return err; 3226 } 3227 3228 - static int cpia_close(struct inode *inode, struct file *file) 3229 { 3230 struct video_device *dev = file->private_data; 3231 struct cam_data *cam = video_get_drvdata(dev); ··· 3333 return cam->decompressed_frame.count; 3334 } 3335 3336 - static int cpia_do_ioctl(struct file *file, unsigned int cmd, void *arg) 3337 { 3338 struct video_device *dev = file->private_data; 3339 struct cam_data *cam = video_get_drvdata(dev); ··· 3720 return retval; 3721 } 3722 3723 - static int cpia_ioctl(struct inode *inode, struct file *file, 3724 unsigned int cmd, unsigned long arg) 3725 { 3726 return video_usercopy(file, cmd, arg, cpia_do_ioctl); ··· 3780 return 0; 3781 } 3782 3783 - static const struct file_operations cpia_fops = { 3784 .owner = THIS_MODULE, 3785 .open = cpia_open, 3786 .release = cpia_close, 3787 .read = cpia_read, 3788 .mmap = cpia_mmap, 3789 .ioctl = cpia_ioctl, 3790 - #ifdef CONFIG_COMPAT 3791 - .compat_ioctl = v4l_compat_ioctl32, 3792 - #endif 3793 - .llseek = no_llseek, 3794 }; 3795 3796 static struct video_device cpia_template = {
··· 3148 } 3149 3150 /* ------------------------- V4L interface --------------------- */ 3151 + static int cpia_open(struct file *file) 3152 { 3153 struct video_device *dev = video_devdata(file); 3154 struct cam_data *cam = video_get_drvdata(dev); ··· 3225 return err; 3226 } 3227 3228 + static int cpia_close(struct file *file) 3229 { 3230 struct video_device *dev = file->private_data; 3231 struct cam_data *cam = video_get_drvdata(dev); ··· 3333 return cam->decompressed_frame.count; 3334 } 3335 3336 + static long cpia_do_ioctl(struct file *file, unsigned int cmd, void *arg) 3337 { 3338 struct video_device *dev = file->private_data; 3339 struct cam_data *cam = video_get_drvdata(dev); ··· 3720 return retval; 3721 } 3722 3723 + static long cpia_ioctl(struct file *file, 3724 unsigned int cmd, unsigned long arg) 3725 { 3726 return video_usercopy(file, cmd, arg, cpia_do_ioctl); ··· 3780 return 0; 3781 } 3782 3783 + static const struct v4l2_file_operations cpia_fops = { 3784 .owner = THIS_MODULE, 3785 .open = cpia_open, 3786 .release = cpia_close, 3787 .read = cpia_read, 3788 .mmap = cpia_mmap, 3789 .ioctl = cpia_ioctl, 3790 }; 3791 3792 static struct video_device cpia_template = {
+6 -10
drivers/media/video/cpia2/cpia2_v4l.c
··· 239 * cpia2_open 240 * 241 *****************************************************************************/ 242 - static int cpia2_open(struct inode *inode, struct file *file) 243 { 244 struct camera_data *cam = video_drvdata(file); 245 int retval = 0; ··· 302 * cpia2_close 303 * 304 *****************************************************************************/ 305 - static int cpia2_close(struct inode *inode, struct file *file) 306 { 307 struct video_device *dev = video_devdata(file); 308 struct camera_data *cam = video_get_drvdata(dev); ··· 1572 * cpia2_ioctl 1573 * 1574 *****************************************************************************/ 1575 - static int cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1576 { 1577 struct camera_data *cam = video_drvdata(file); 1578 - int retval = 0; 1579 1580 if (!cam) 1581 return -ENOTTY; ··· 1841 return retval; 1842 } 1843 1844 - static int cpia2_ioctl(struct inode *inode, struct file *file, 1845 unsigned int cmd, unsigned long arg) 1846 { 1847 return video_usercopy(file, cmd, arg, cpia2_do_ioctl); ··· 1912 /*** 1913 * The v4l video device structure initialized for this device 1914 ***/ 1915 - static const struct file_operations fops_template = { 1916 .owner = THIS_MODULE, 1917 .open = cpia2_open, 1918 .release = cpia2_close, 1919 .read = cpia2_v4l_read, 1920 .poll = cpia2_v4l_poll, 1921 .ioctl = cpia2_ioctl, 1922 - .llseek = no_llseek, 1923 - #ifdef CONFIG_COMPAT 1924 - .compat_ioctl = v4l_compat_ioctl32, 1925 - #endif 1926 .mmap = cpia2_mmap, 1927 }; 1928
··· 239 * cpia2_open 240 * 241 *****************************************************************************/ 242 + static int cpia2_open(struct file *file) 243 { 244 struct camera_data *cam = video_drvdata(file); 245 int retval = 0; ··· 302 * cpia2_close 303 * 304 *****************************************************************************/ 305 + static int cpia2_close(struct file *file) 306 { 307 struct video_device *dev = video_devdata(file); 308 struct camera_data *cam = video_get_drvdata(dev); ··· 1572 * cpia2_ioctl 1573 * 1574 *****************************************************************************/ 1575 + static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1576 { 1577 struct camera_data *cam = video_drvdata(file); 1578 + long retval = 0; 1579 1580 if (!cam) 1581 return -ENOTTY; ··· 1841 return retval; 1842 } 1843 1844 + static long cpia2_ioctl(struct file *file, 1845 unsigned int cmd, unsigned long arg) 1846 { 1847 return video_usercopy(file, cmd, arg, cpia2_do_ioctl); ··· 1912 /*** 1913 * The v4l video device structure initialized for this device 1914 ***/ 1915 + static const struct v4l2_file_operations fops_template = { 1916 .owner = THIS_MODULE, 1917 .open = cpia2_open, 1918 .release = cpia2_close, 1919 .read = cpia2_v4l_read, 1920 .poll = cpia2_v4l_poll, 1921 .ioctl = cpia2_ioctl, 1922 .mmap = cpia2_mmap, 1923 }; 1924
+6 -7
drivers/media/video/cs5345.c
··· 95 } 96 97 #ifdef CONFIG_VIDEO_ADV_DEBUG 98 - static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 99 { 100 struct i2c_client *client = v4l2_get_subdevdata(sd); 101 102 - if (!v4l2_chip_match_i2c_client(client, 103 - reg->match_type, reg->match_chip)) 104 return -EINVAL; 105 if (!capable(CAP_SYS_ADMIN)) 106 return -EPERM; 107 reg->val = cs5345_read(sd, reg->reg & 0x1f); 108 return 0; 109 } 110 111 - static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 112 { 113 struct i2c_client *client = v4l2_get_subdevdata(sd); 114 115 - if (!v4l2_chip_match_i2c_client(client, 116 - reg->match_type, reg->match_chip)) 117 return -EINVAL; 118 if (!capable(CAP_SYS_ADMIN)) 119 return -EPERM; ··· 121 } 122 #endif 123 124 - static int cs5345_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 125 { 126 struct i2c_client *client = v4l2_get_subdevdata(sd); 127
··· 95 } 96 97 #ifdef CONFIG_VIDEO_ADV_DEBUG 98 + static int cs5345_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 99 { 100 struct i2c_client *client = v4l2_get_subdevdata(sd); 101 102 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 103 return -EINVAL; 104 if (!capable(CAP_SYS_ADMIN)) 105 return -EPERM; 106 + reg->size = 1; 107 reg->val = cs5345_read(sd, reg->reg & 0x1f); 108 return 0; 109 } 110 111 + static int cs5345_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 112 { 113 struct i2c_client *client = v4l2_get_subdevdata(sd); 114 115 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 116 return -EINVAL; 117 if (!capable(CAP_SYS_ADMIN)) 118 return -EPERM; ··· 122 } 123 #endif 124 125 + static int cs5345_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 126 { 127 struct i2c_client *client = v4l2_get_subdevdata(sd); 128
+1 -1
drivers/media/video/cs53l32a.c
··· 102 return 0; 103 } 104 105 - static int cs53l32a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 106 { 107 struct i2c_client *client = v4l2_get_subdevdata(sd); 108
··· 102 return 0; 103 } 104 105 + static int cs53l32a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 106 { 107 struct i2c_client *client = v4l2_get_subdevdata(sd); 108
+3 -3
drivers/media/video/cx18/cx18-fileops.c
··· 552 } 553 } 554 555 - int cx18_v4l2_close(struct inode *inode, struct file *filp) 556 { 557 struct cx18_open_id *id = filp->private_data; 558 struct cx18 *cx = id->cx; ··· 650 return 0; 651 } 652 653 - int cx18_v4l2_open(struct inode *inode, struct file *filp) 654 { 655 int res, x, y = 0; 656 struct cx18 *cx = NULL; 657 struct cx18_stream *s = NULL; 658 - int minor = iminor(inode); 659 660 /* Find which card this open was on */ 661 spin_lock(&cx18_cards_lock);
··· 552 } 553 } 554 555 + int cx18_v4l2_close(struct file *filp) 556 { 557 struct cx18_open_id *id = filp->private_data; 558 struct cx18 *cx = id->cx; ··· 650 return 0; 651 } 652 653 + int cx18_v4l2_open(struct file *filp) 654 { 655 int res, x, y = 0; 656 struct cx18 *cx = NULL; 657 struct cx18_stream *s = NULL; 658 + int minor = video_devdata(filp)->minor; 659 660 /* Find which card this open was on */ 661 spin_lock(&cx18_cards_lock);
+2 -2
drivers/media/video/cx18/cx18-fileops.h
··· 22 */ 23 24 /* Testing/Debugging */ 25 - int cx18_v4l2_open(struct inode *inode, struct file *filp); 26 ssize_t cx18_v4l2_read(struct file *filp, char __user *buf, size_t count, 27 loff_t *pos); 28 ssize_t cx18_v4l2_write(struct file *filp, const char __user *buf, size_t count, 29 loff_t *pos); 30 - int cx18_v4l2_close(struct inode *inode, struct file *filp); 31 unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait); 32 int cx18_start_capture(struct cx18_open_id *id); 33 void cx18_stop_capture(struct cx18_open_id *id, int gop_end);
··· 22 */ 23 24 /* Testing/Debugging */ 25 + int cx18_v4l2_open(struct file *filp); 26 ssize_t cx18_v4l2_read(struct file *filp, char __user *buf, size_t count, 27 loff_t *pos); 28 ssize_t cx18_v4l2_write(struct file *filp, const char __user *buf, size_t count, 29 loff_t *pos); 30 + int cx18_v4l2_close(struct file *filp); 31 unsigned int cx18_v4l2_enc_poll(struct file *filp, poll_table *wait); 32 int cx18_start_capture(struct cx18_open_id *id); 33 void cx18_stop_capture(struct cx18_open_id *id, int gop_end);
+1 -27
drivers/media/video/cx18/cx18-i2c.c
··· 242 return retval; 243 } 244 } 245 - if (cmd != VIDIOC_G_CHIP_IDENT) 246 CX18_ERR("i2c addr 0x%02x not found for cmd 0x%x!\n", 247 addr, cmd); 248 return -ENODEV; ··· 266 } 267 } 268 return retval; 269 - } 270 - 271 - /* Find the i2c device name matching the DRIVERID */ 272 - static const char *cx18_i2c_id_name(u32 id) 273 - { 274 - int i; 275 - 276 - for (i = 0; i < ARRAY_SIZE(hw_driverids); i++) 277 - if (hw_driverids[i] == id) 278 - return hw_devicenames[i]; 279 - return "unknown device"; 280 } 281 282 /* Find the i2c device name matching the CX18_HW_ flag */ ··· 310 if (addr < 0) { 311 CX18_ERR("i2c hardware 0x%08x (%s) not found for cmd 0x%x!\n", 312 hw, cx18_i2c_hw_name(hw), cmd); 313 - return addr; 314 - } 315 - return cx18_call_i2c_client(cx, addr, cmd, arg); 316 - } 317 - 318 - /* Calls i2c device based on I2C driver ID. */ 319 - int cx18_i2c_id(struct cx18 *cx, u32 id, unsigned int cmd, void *arg) 320 - { 321 - int addr; 322 - 323 - addr = cx18_i2c_id_addr(cx, id); 324 - if (addr < 0) { 325 - if (cmd != VIDIOC_G_CHIP_IDENT) 326 - CX18_ERR("i2c ID 0x%08x (%s) not found for cmd 0x%x!\n", 327 - id, cx18_i2c_id_name(id), cmd); 328 return addr; 329 } 330 return cx18_call_i2c_client(cx, addr, cmd, arg);
··· 242 return retval; 243 } 244 } 245 + if (cmd != VIDIOC_DBG_G_CHIP_IDENT) 246 CX18_ERR("i2c addr 0x%02x not found for cmd 0x%x!\n", 247 addr, cmd); 248 return -ENODEV; ··· 266 } 267 } 268 return retval; 269 } 270 271 /* Find the i2c device name matching the CX18_HW_ flag */ ··· 321 if (addr < 0) { 322 CX18_ERR("i2c hardware 0x%08x (%s) not found for cmd 0x%x!\n", 323 hw, cx18_i2c_hw_name(hw), cmd); 324 return addr; 325 } 326 return cx18_call_i2c_client(cx, addr, cmd, arg);
-1
drivers/media/video/cx18/cx18-i2c.h
··· 23 24 int cx18_i2c_hw_addr(struct cx18 *cx, u32 hw); 25 int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg); 26 - int cx18_i2c_id(struct cx18 *cx, u32 id, unsigned int cmd, void *arg); 27 int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg); 28 void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg); 29 int cx18_i2c_register(struct cx18 *cx, unsigned idx);
··· 23 24 int cx18_i2c_hw_addr(struct cx18 *cx, u32 hw); 25 int cx18_i2c_hw(struct cx18 *cx, u32 hw, unsigned int cmd, void *arg); 26 int cx18_call_i2c_client(struct cx18 *cx, int addr, unsigned cmd, void *arg); 27 void cx18_call_i2c_clients(struct cx18 *cx, unsigned int cmd, void *arg); 28 int cx18_i2c_register(struct cx18 *cx, unsigned idx);
+19 -30
drivers/media/video/cx18/cx18-ioctl.c
··· 254 } 255 256 static int cx18_g_chip_ident(struct file *file, void *fh, 257 - struct v4l2_chip_ident *chip) 258 { 259 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 260 261 chip->ident = V4L2_IDENT_NONE; 262 chip->revision = 0; 263 - if (chip->match_type == V4L2_CHIP_MATCH_HOST) { 264 - if (v4l2_chip_match_host(chip->match_type, chip->match_chip)) 265 - chip->ident = V4L2_IDENT_CX23418; 266 return 0; 267 } 268 - if (chip->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 269 - return cx18_i2c_id(cx, chip->match_chip, VIDIOC_G_CHIP_IDENT, 270 - chip); 271 - if (chip->match_type == V4L2_CHIP_MATCH_I2C_ADDR) 272 - return cx18_call_i2c_client(cx, chip->match_chip, 273 - VIDIOC_G_CHIP_IDENT, chip); 274 - return -EINVAL; 275 } 276 277 #ifdef CONFIG_VIDEO_ADV_DEBUG 278 static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg) 279 { 280 - struct v4l2_register *regs = arg; 281 unsigned long flags; 282 283 if (!capable(CAP_SYS_ADMIN)) ··· 280 return -EINVAL; 281 282 spin_lock_irqsave(&cx18_cards_lock, flags); 283 if (cmd == VIDIOC_DBG_G_REGISTER) 284 regs->val = cx18_read_enc(cx, regs->reg); 285 else ··· 290 } 291 292 static int cx18_g_register(struct file *file, void *fh, 293 - struct v4l2_register *reg) 294 { 295 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 296 297 - if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 298 return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg); 299 - if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 300 - return cx18_i2c_id(cx, reg->match_chip, VIDIOC_DBG_G_REGISTER, 301 - reg); 302 - return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_G_REGISTER, 303 - reg); 304 } 305 306 static int cx18_s_register(struct file *file, void *fh, 307 - struct v4l2_register *reg) 308 { 309 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 310 311 - if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 312 return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg); 313 - if (reg->match_type == V4L2_CHIP_MATCH_I2C_DRIVER) 314 - return cx18_i2c_id(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER, 315 - reg); 316 - return cx18_call_i2c_client(cx, reg->match_chip, VIDIOC_DBG_S_REGISTER, 317 - reg); 318 } 319 #endif 320 ··· 744 return 0; 745 } 746 747 - static int cx18_default(struct file *file, void *fh, int cmd, void *arg) 748 { 749 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 750 ··· 772 return 0; 773 } 774 775 - int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 776 unsigned long arg) 777 { 778 struct video_device *vfd = video_devdata(filp); 779 struct cx18_open_id *id = (struct cx18_open_id *)filp->private_data; 780 struct cx18 *cx = id->cx; 781 - int res; 782 783 mutex_lock(&cx->serialize_lock); 784 785 if (cx18_debug & CX18_DBGFLG_IOCTL) 786 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; 787 - res = video_ioctl2(inode, filp, cmd, arg); 788 vfd->debug = 0; 789 mutex_unlock(&cx->serialize_lock); 790 return res;
··· 254 } 255 256 static int cx18_g_chip_ident(struct file *file, void *fh, 257 + struct v4l2_dbg_chip_ident *chip) 258 { 259 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 260 261 chip->ident = V4L2_IDENT_NONE; 262 chip->revision = 0; 263 + if (v4l2_chip_match_host(&chip->match)) { 264 + chip->ident = V4L2_IDENT_CX23418; 265 return 0; 266 } 267 + cx18_call_i2c_clients(cx, VIDIOC_DBG_G_CHIP_IDENT, chip); 268 + return 0; 269 } 270 271 #ifdef CONFIG_VIDEO_ADV_DEBUG 272 static int cx18_cxc(struct cx18 *cx, unsigned int cmd, void *arg) 273 { 274 + struct v4l2_dbg_register *regs = arg; 275 unsigned long flags; 276 277 if (!capable(CAP_SYS_ADMIN)) ··· 286 return -EINVAL; 287 288 spin_lock_irqsave(&cx18_cards_lock, flags); 289 + regs->size = 4; 290 if (cmd == VIDIOC_DBG_G_REGISTER) 291 regs->val = cx18_read_enc(cx, regs->reg); 292 else ··· 295 } 296 297 static int cx18_g_register(struct file *file, void *fh, 298 + struct v4l2_dbg_register *reg) 299 { 300 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 301 302 + if (v4l2_chip_match_host(&reg->match)) 303 return cx18_cxc(cx, VIDIOC_DBG_G_REGISTER, reg); 304 + cx18_call_i2c_clients(cx, VIDIOC_DBG_G_REGISTER, reg); 305 + return 0; 306 } 307 308 static int cx18_s_register(struct file *file, void *fh, 309 + struct v4l2_dbg_register *reg) 310 { 311 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 312 313 + if (v4l2_chip_match_host(&reg->match)) 314 return cx18_cxc(cx, VIDIOC_DBG_S_REGISTER, reg); 315 + cx18_call_i2c_clients(cx, VIDIOC_DBG_S_REGISTER, reg); 316 + return 0; 317 } 318 #endif 319 ··· 755 return 0; 756 } 757 758 + static long cx18_default(struct file *file, void *fh, int cmd, void *arg) 759 { 760 struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 761 ··· 783 return 0; 784 } 785 786 + long cx18_v4l2_ioctl(struct file *filp, unsigned int cmd, 787 unsigned long arg) 788 { 789 struct video_device *vfd = video_devdata(filp); 790 struct cx18_open_id *id = (struct cx18_open_id *)filp->private_data; 791 struct cx18 *cx = id->cx; 792 + long res; 793 794 mutex_lock(&cx->serialize_lock); 795 796 if (cx18_debug & CX18_DBGFLG_IOCTL) 797 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; 798 + res = video_ioctl2(filp, cmd, arg); 799 vfd->debug = 0; 800 mutex_unlock(&cx->serialize_lock); 801 return res;
+1 -1
drivers/media/video/cx18/cx18-ioctl.h
··· 29 int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std); 30 int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); 31 int cx18_s_input(struct file *file, void *fh, unsigned int inp); 32 - int cx18_v4l2_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, 33 unsigned long arg);
··· 29 int cx18_s_std(struct file *file, void *fh, v4l2_std_id *std); 30 int cx18_s_frequency(struct file *file, void *fh, struct v4l2_frequency *vf); 31 int cx18_s_input(struct file *file, void *fh, unsigned int inp); 32 + long cx18_v4l2_ioctl(struct file *filp, unsigned int cmd, 33 unsigned long arg);
+2 -11
drivers/media/video/cx18/cx18-streams.c
··· 37 38 #define CX18_DSP0_INTERRUPT_MASK 0xd0004C 39 40 - static struct file_operations cx18_v4l2_enc_fops = { 41 .owner = THIS_MODULE, 42 .read = cx18_v4l2_read, 43 .open = cx18_v4l2_open, 44 /* FIXME change to video_ioctl2 if serialization lock can be removed */ 45 .ioctl = cx18_v4l2_ioctl, 46 - .compat_ioctl = v4l_compat_ioctl32, 47 .release = cx18_v4l2_close, 48 .poll = cx18_v4l2_enc_poll, 49 }; ··· 60 int num_offset; 61 int dma; 62 enum v4l2_buf_type buf_type; 63 - struct file_operations *fops; 64 } cx18_stream_info[] = { 65 { /* CX18_ENC_STREAM_TYPE_MPG */ 66 "encoder MPEG", 67 VFL_TYPE_GRABBER, 0, 68 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 69 - &cx18_v4l2_enc_fops 70 }, 71 { /* CX18_ENC_STREAM_TYPE_TS */ 72 "TS", 73 VFL_TYPE_GRABBER, -1, 74 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 75 - &cx18_v4l2_enc_fops 76 }, 77 { /* CX18_ENC_STREAM_TYPE_YUV */ 78 "encoder YUV", 79 VFL_TYPE_GRABBER, CX18_V4L2_ENC_YUV_OFFSET, 80 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 81 - &cx18_v4l2_enc_fops 82 }, 83 { /* CX18_ENC_STREAM_TYPE_VBI */ 84 "encoder VBI", 85 VFL_TYPE_VBI, 0, 86 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VBI_CAPTURE, 87 - &cx18_v4l2_enc_fops 88 }, 89 { /* CX18_ENC_STREAM_TYPE_PCM */ 90 "encoder PCM audio", 91 VFL_TYPE_GRABBER, CX18_V4L2_ENC_PCM_OFFSET, 92 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_PRIVATE, 93 - &cx18_v4l2_enc_fops 94 }, 95 { /* CX18_ENC_STREAM_TYPE_IDX */ 96 "encoder IDX", 97 VFL_TYPE_GRABBER, -1, 98 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 99 - &cx18_v4l2_enc_fops 100 }, 101 { /* CX18_ENC_STREAM_TYPE_RAD */ 102 "encoder radio", 103 VFL_TYPE_RADIO, 0, 104 PCI_DMA_NONE, V4L2_BUF_TYPE_PRIVATE, 105 - &cx18_v4l2_enc_fops 106 }, 107 }; 108 ··· 175 176 s->v4l2dev->num = num; 177 s->v4l2dev->parent = &cx->dev->dev; 178 - s->v4l2dev->fops = cx18_stream_info[type].fops; 179 s->v4l2dev->release = video_device_release; 180 s->v4l2dev->tvnorms = V4L2_STD_ALL; 181 cx18_set_funcs(s->v4l2dev);
··· 37 38 #define CX18_DSP0_INTERRUPT_MASK 0xd0004C 39 40 + static struct v4l2_file_operations cx18_v4l2_enc_fops = { 41 .owner = THIS_MODULE, 42 .read = cx18_v4l2_read, 43 .open = cx18_v4l2_open, 44 /* FIXME change to video_ioctl2 if serialization lock can be removed */ 45 .ioctl = cx18_v4l2_ioctl, 46 .release = cx18_v4l2_close, 47 .poll = cx18_v4l2_enc_poll, 48 }; ··· 61 int num_offset; 62 int dma; 63 enum v4l2_buf_type buf_type; 64 } cx18_stream_info[] = { 65 { /* CX18_ENC_STREAM_TYPE_MPG */ 66 "encoder MPEG", 67 VFL_TYPE_GRABBER, 0, 68 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 69 }, 70 { /* CX18_ENC_STREAM_TYPE_TS */ 71 "TS", 72 VFL_TYPE_GRABBER, -1, 73 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 74 }, 75 { /* CX18_ENC_STREAM_TYPE_YUV */ 76 "encoder YUV", 77 VFL_TYPE_GRABBER, CX18_V4L2_ENC_YUV_OFFSET, 78 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 79 }, 80 { /* CX18_ENC_STREAM_TYPE_VBI */ 81 "encoder VBI", 82 VFL_TYPE_VBI, 0, 83 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VBI_CAPTURE, 84 }, 85 { /* CX18_ENC_STREAM_TYPE_PCM */ 86 "encoder PCM audio", 87 VFL_TYPE_GRABBER, CX18_V4L2_ENC_PCM_OFFSET, 88 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_PRIVATE, 89 }, 90 { /* CX18_ENC_STREAM_TYPE_IDX */ 91 "encoder IDX", 92 VFL_TYPE_GRABBER, -1, 93 PCI_DMA_FROMDEVICE, V4L2_BUF_TYPE_VIDEO_CAPTURE, 94 }, 95 { /* CX18_ENC_STREAM_TYPE_RAD */ 96 "encoder radio", 97 VFL_TYPE_RADIO, 0, 98 PCI_DMA_NONE, V4L2_BUF_TYPE_PRIVATE, 99 }, 100 }; 101 ··· 184 185 s->v4l2dev->num = num; 186 s->v4l2dev->parent = &cx->dev->dev; 187 + s->v4l2dev->fops = &cx18_v4l2_enc_fops; 188 s->v4l2dev->release = video_device_release; 189 s->v4l2dev->tvnorms = V4L2_STD_ALL; 190 cx18_set_funcs(s->v4l2dev);
+7 -8
drivers/media/video/cx23885/cx23885-417.c
··· 1027 printk(KERN_ERR "%s() f/w load failed\n", __func__); 1028 return retval; 1029 } 1030 - dev->cx23417_mailbox = cx23885_find_mailbox(dev); 1031 - if (dev->cx23417_mailbox < 0) { 1032 printk(KERN_ERR "%s() mailbox < 0, error\n", 1033 __func__); 1034 return -1; 1035 } 1036 retval = cx23885_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); 1037 if (retval < 0) { 1038 printk(KERN_ERR ··· 1574 return cx23885_queryctrl(dev, c); 1575 } 1576 1577 - static int mpeg_open(struct inode *inode, struct file *file) 1578 { 1579 - int minor = iminor(inode); 1580 struct cx23885_dev *h, *dev = NULL; 1581 struct list_head *list; 1582 struct cx23885_fh *fh; ··· 1618 return 0; 1619 } 1620 1621 - static int mpeg_release(struct inode *inode, struct file *file) 1622 { 1623 struct cx23885_fh *fh = file->private_data; 1624 struct cx23885_dev *dev = fh->dev; ··· 1695 return videobuf_mmap_mapper(&fh->mpegq, vma); 1696 } 1697 1698 - static struct file_operations mpeg_fops = { 1699 .owner = THIS_MODULE, 1700 .open = mpeg_open, 1701 .release = mpeg_release, 1702 .read = mpeg_read, 1703 .poll = mpeg_poll, 1704 .mmap = mpeg_mmap, 1705 - .ioctl = video_ioctl2, 1706 - .llseek = no_llseek, 1707 }; 1708 1709 static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
··· 1027 printk(KERN_ERR "%s() f/w load failed\n", __func__); 1028 return retval; 1029 } 1030 + retval = cx23885_find_mailbox(dev); 1031 + if (retval < 0) { 1032 printk(KERN_ERR "%s() mailbox < 0, error\n", 1033 __func__); 1034 return -1; 1035 } 1036 + dev->cx23417_mailbox = retval; 1037 retval = cx23885_api_cmd(dev, CX2341X_ENC_PING_FW, 0, 0); 1038 if (retval < 0) { 1039 printk(KERN_ERR ··· 1573 return cx23885_queryctrl(dev, c); 1574 } 1575 1576 + static int mpeg_open(struct file *file) 1577 { 1578 + int minor = video_devdata(file)->minor; 1579 struct cx23885_dev *h, *dev = NULL; 1580 struct list_head *list; 1581 struct cx23885_fh *fh; ··· 1617 return 0; 1618 } 1619 1620 + static int mpeg_release(struct file *file) 1621 { 1622 struct cx23885_fh *fh = file->private_data; 1623 struct cx23885_dev *dev = fh->dev; ··· 1694 return videobuf_mmap_mapper(&fh->mpegq, vma); 1695 } 1696 1697 + static struct v4l2_file_operations mpeg_fops = { 1698 .owner = THIS_MODULE, 1699 .open = mpeg_open, 1700 .release = mpeg_release, 1701 .read = mpeg_read, 1702 .poll = mpeg_poll, 1703 .mmap = mpeg_mmap, 1704 }; 1705 1706 static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
+9 -13
drivers/media/video/cx23885/cx23885-video.c
··· 718 } 719 } 720 721 - static int video_open(struct inode *inode, struct file *file) 722 { 723 - int minor = iminor(inode); 724 struct cx23885_dev *h, *dev = NULL; 725 struct cx23885_fh *fh; 726 struct list_head *list; ··· 834 return 0; 835 } 836 837 - static int video_release(struct inode *inode, struct file *file) 838 { 839 struct cx23885_fh *fh = file->private_data; 840 struct cx23885_dev *dev = fh->dev; ··· 1326 1327 #ifdef CONFIG_VIDEO_ADV_DEBUG 1328 static int vidioc_g_register(struct file *file, void *fh, 1329 - struct v4l2_register *reg) 1330 { 1331 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 1332 1333 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1334 return -EINVAL; 1335 1336 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg); ··· 1339 } 1340 1341 static int vidioc_s_register(struct file *file, void *fh, 1342 - struct v4l2_register *reg) 1343 { 1344 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 1345 1346 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1347 return -EINVAL; 1348 1349 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg); ··· 1422 /* ----------------------------------------------------------- */ 1423 /* exported stuff */ 1424 1425 - static const struct file_operations video_fops = { 1426 .owner = THIS_MODULE, 1427 .open = video_open, 1428 .release = video_release, ··· 1430 .poll = video_poll, 1431 .mmap = video_mmap, 1432 .ioctl = video_ioctl2, 1433 - .compat_ioctl = v4l_compat_ioctl32, 1434 - .llseek = no_llseek, 1435 }; 1436 1437 static const struct v4l2_ioctl_ops video_ioctl_ops = { ··· 1477 .current_norm = V4L2_STD_NTSC_M, 1478 }; 1479 1480 - static const struct file_operations radio_fops = { 1481 .owner = THIS_MODULE, 1482 .open = video_open, 1483 .release = video_release, 1484 .ioctl = video_ioctl2, 1485 - .compat_ioctl = v4l_compat_ioctl32, 1486 - .llseek = no_llseek, 1487 }; 1488 1489
··· 718 } 719 } 720 721 + static int video_open(struct file *file) 722 { 723 + int minor = video_devdata(file)->minor; 724 struct cx23885_dev *h, *dev = NULL; 725 struct cx23885_fh *fh; 726 struct list_head *list; ··· 834 return 0; 835 } 836 837 + static int video_release(struct file *file) 838 { 839 struct cx23885_fh *fh = file->private_data; 840 struct cx23885_dev *dev = fh->dev; ··· 1326 1327 #ifdef CONFIG_VIDEO_ADV_DEBUG 1328 static int vidioc_g_register(struct file *file, void *fh, 1329 + struct v4l2_dbg_register *reg) 1330 { 1331 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 1332 1333 + if (!v4l2_chip_match_host(&reg->match)) 1334 return -EINVAL; 1335 1336 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_G_REGISTER, reg); ··· 1339 } 1340 1341 static int vidioc_s_register(struct file *file, void *fh, 1342 + struct v4l2_dbg_register *reg) 1343 { 1344 struct cx23885_dev *dev = ((struct cx23885_fh *)fh)->dev; 1345 1346 + if (!v4l2_chip_match_host(&reg->match)) 1347 return -EINVAL; 1348 1349 cx23885_call_i2c_clients(&dev->i2c_bus[2], VIDIOC_DBG_S_REGISTER, reg); ··· 1422 /* ----------------------------------------------------------- */ 1423 /* exported stuff */ 1424 1425 + static const struct v4l2_file_operations video_fops = { 1426 .owner = THIS_MODULE, 1427 .open = video_open, 1428 .release = video_release, ··· 1430 .poll = video_poll, 1431 .mmap = video_mmap, 1432 .ioctl = video_ioctl2, 1433 }; 1434 1435 static const struct v4l2_ioctl_ops video_ioctl_ops = { ··· 1479 .current_norm = V4L2_STD_NTSC_M, 1480 }; 1481 1482 + static const struct v4l2_file_operations radio_fops = { 1483 .owner = THIS_MODULE, 1484 .open = video_open, 1485 .release = video_release, 1486 .ioctl = video_ioctl2, 1487 }; 1488 1489
+6 -7
drivers/media/video/cx25840/cx25840-core.c
··· 1120 } 1121 1122 #ifdef CONFIG_VIDEO_ADV_DEBUG 1123 - static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1124 { 1125 struct i2c_client *client = v4l2_get_subdevdata(sd); 1126 1127 - if (!v4l2_chip_match_i2c_client(client, 1128 - reg->match_type, reg->match_chip)) 1129 return -EINVAL; 1130 if (!capable(CAP_SYS_ADMIN)) 1131 return -EPERM; 1132 reg->val = cx25840_read(client, reg->reg & 0x0fff); 1133 return 0; 1134 } 1135 1136 - static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1137 { 1138 struct i2c_client *client = v4l2_get_subdevdata(sd); 1139 1140 - if (!v4l2_chip_match_i2c_client(client, 1141 - reg->match_type, reg->match_chip)) 1142 return -EINVAL; 1143 if (!capable(CAP_SYS_ADMIN)) 1144 return -EPERM; ··· 1361 return 0; 1362 } 1363 1364 - static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1365 { 1366 struct cx25840_state *state = to_state(sd); 1367 struct i2c_client *client = v4l2_get_subdevdata(sd);
··· 1120 } 1121 1122 #ifdef CONFIG_VIDEO_ADV_DEBUG 1123 + static int cx25840_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 1124 { 1125 struct i2c_client *client = v4l2_get_subdevdata(sd); 1126 1127 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 1128 return -EINVAL; 1129 if (!capable(CAP_SYS_ADMIN)) 1130 return -EPERM; 1131 + reg->size = 1; 1132 reg->val = cx25840_read(client, reg->reg & 0x0fff); 1133 return 0; 1134 } 1135 1136 + static int cx25840_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 1137 { 1138 struct i2c_client *client = v4l2_get_subdevdata(sd); 1139 1140 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 1141 return -EINVAL; 1142 if (!capable(CAP_SYS_ADMIN)) 1143 return -EPERM; ··· 1362 return 0; 1363 } 1364 1365 + static int cx25840_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 1366 { 1367 struct cx25840_state *state = to_state(sd); 1368 struct i2c_client *client = v4l2_get_subdevdata(sd);
+6 -7
drivers/media/video/cx88/cx88-blackbird.c
··· 1049 1050 /* FIXME: cx88_ioctl_hook not implemented */ 1051 1052 - static int mpeg_open(struct inode *inode, struct file *file) 1053 { 1054 - int minor = iminor(inode); 1055 struct cx8802_dev *dev = NULL; 1056 struct cx8802_fh *fh; 1057 struct cx8802_driver *drv = NULL; 1058 int err; 1059 1060 lock_kernel(); 1061 - dev = cx8802_get_device(inode); 1062 1063 dprintk( 1, "%s\n", __func__); 1064 ··· 1114 return 0; 1115 } 1116 1117 - static int mpeg_release(struct inode *inode, struct file *file) 1118 { 1119 struct cx8802_fh *fh = file->private_data; 1120 struct cx8802_dev *dev = fh->dev; ··· 1132 kfree(fh); 1133 1134 /* Make sure we release the hardware */ 1135 - dev = cx8802_get_device(inode); 1136 if (dev == NULL) 1137 return -ENODEV; 1138 ··· 1178 return videobuf_mmap_mapper(&fh->mpegq, vma); 1179 } 1180 1181 - static const struct file_operations mpeg_fops = 1182 { 1183 .owner = THIS_MODULE, 1184 .open = mpeg_open, ··· 1187 .poll = mpeg_poll, 1188 .mmap = mpeg_mmap, 1189 .ioctl = video_ioctl2, 1190 - .llseek = no_llseek, 1191 }; 1192 1193 static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
··· 1049 1050 /* FIXME: cx88_ioctl_hook not implemented */ 1051 1052 + static int mpeg_open(struct file *file) 1053 { 1054 + int minor = video_devdata(file)->minor; 1055 struct cx8802_dev *dev = NULL; 1056 struct cx8802_fh *fh; 1057 struct cx8802_driver *drv = NULL; 1058 int err; 1059 1060 lock_kernel(); 1061 + dev = cx8802_get_device(minor); 1062 1063 dprintk( 1, "%s\n", __func__); 1064 ··· 1114 return 0; 1115 } 1116 1117 + static int mpeg_release(struct file *file) 1118 { 1119 struct cx8802_fh *fh = file->private_data; 1120 struct cx8802_dev *dev = fh->dev; ··· 1132 kfree(fh); 1133 1134 /* Make sure we release the hardware */ 1135 + dev = cx8802_get_device(video_devdata(file)->minor); 1136 if (dev == NULL) 1137 return -ENODEV; 1138 ··· 1178 return videobuf_mmap_mapper(&fh->mpegq, vma); 1179 } 1180 1181 + static const struct v4l2_file_operations mpeg_fops = 1182 { 1183 .owner = THIS_MODULE, 1184 .open = mpeg_open, ··· 1187 .poll = mpeg_poll, 1188 .mmap = mpeg_mmap, 1189 .ioctl = video_ioctl2, 1190 }; 1191 1192 static const struct v4l2_ioctl_ops mpeg_ioctl_ops = {
+1 -2
drivers/media/video/cx88/cx88-mpeg.c
··· 578 579 #if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \ 580 defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE) 581 - struct cx8802_dev * cx8802_get_device(struct inode *inode) 582 { 583 - int minor = iminor(inode); 584 struct cx8802_dev *dev; 585 586 list_for_each_entry(dev, &cx8802_devlist, devlist)
··· 578 579 #if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \ 580 defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE) 581 + struct cx8802_dev *cx8802_get_device(int minor) 582 { 583 struct cx8802_dev *dev; 584 585 list_for_each_entry(dev, &cx8802_devlist, devlist)
+12 -15
drivers/media/video/cx88/cx88-video.c
··· 757 } 758 } 759 760 - static int video_open(struct inode *inode, struct file *file) 761 { 762 - int minor = iminor(inode); 763 struct cx8800_dev *h,*dev = NULL; 764 struct cx88_core *core; 765 struct cx8800_fh *fh; ··· 904 return 0; 905 } 906 907 - static int video_release(struct inode *inode, struct file *file) 908 { 909 struct cx8800_fh *fh = file->private_data; 910 struct cx8800_dev *dev = fh->dev; ··· 1447 1448 #ifdef CONFIG_VIDEO_ADV_DEBUG 1449 static int vidioc_g_register (struct file *file, void *fh, 1450 - struct v4l2_register *reg) 1451 { 1452 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1453 1454 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1455 return -EINVAL; 1456 /* cx2388x has a 24-bit register space */ 1457 - reg->val = cx_read(reg->reg&0xffffff); 1458 return 0; 1459 } 1460 1461 static int vidioc_s_register (struct file *file, void *fh, 1462 - struct v4l2_register *reg) 1463 { 1464 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1465 1466 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1467 return -EINVAL; 1468 - cx_write(reg->reg&0xffffff, reg->val); 1469 return 0; 1470 } 1471 #endif ··· 1694 /* ----------------------------------------------------------- */ 1695 /* exported stuff */ 1696 1697 - static const struct file_operations video_fops = 1698 { 1699 .owner = THIS_MODULE, 1700 .open = video_open, ··· 1703 .poll = video_poll, 1704 .mmap = video_mmap, 1705 .ioctl = video_ioctl2, 1706 - .compat_ioctl = v4l_compat_ioctl32, 1707 - .llseek = no_llseek, 1708 }; 1709 1710 static const struct v4l2_ioctl_ops video_ioctl_ops = { ··· 1751 .current_norm = V4L2_STD_NTSC_M, 1752 }; 1753 1754 - static const struct file_operations radio_fops = 1755 { 1756 .owner = THIS_MODULE, 1757 .open = video_open, 1758 .release = video_release, 1759 .ioctl = video_ioctl2, 1760 - .compat_ioctl = v4l_compat_ioctl32, 1761 - .llseek = no_llseek, 1762 }; 1763 1764 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
··· 757 } 758 } 759 760 + static int video_open(struct file *file) 761 { 762 + int minor = video_devdata(file)->minor; 763 struct cx8800_dev *h,*dev = NULL; 764 struct cx88_core *core; 765 struct cx8800_fh *fh; ··· 904 return 0; 905 } 906 907 + static int video_release(struct file *file) 908 { 909 struct cx8800_fh *fh = file->private_data; 910 struct cx8800_dev *dev = fh->dev; ··· 1447 1448 #ifdef CONFIG_VIDEO_ADV_DEBUG 1449 static int vidioc_g_register (struct file *file, void *fh, 1450 + struct v4l2_dbg_register *reg) 1451 { 1452 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1453 1454 + if (!v4l2_chip_match_host(&reg->match)) 1455 return -EINVAL; 1456 /* cx2388x has a 24-bit register space */ 1457 + reg->val = cx_read(reg->reg & 0xffffff); 1458 + reg->size = 4; 1459 return 0; 1460 } 1461 1462 static int vidioc_s_register (struct file *file, void *fh, 1463 + struct v4l2_dbg_register *reg) 1464 { 1465 struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; 1466 1467 + if (!v4l2_chip_match_host(&reg->match)) 1468 return -EINVAL; 1469 + cx_write(reg->reg & 0xffffff, reg->val); 1470 return 0; 1471 } 1472 #endif ··· 1693 /* ----------------------------------------------------------- */ 1694 /* exported stuff */ 1695 1696 + static const struct v4l2_file_operations video_fops = 1697 { 1698 .owner = THIS_MODULE, 1699 .open = video_open, ··· 1702 .poll = video_poll, 1703 .mmap = video_mmap, 1704 .ioctl = video_ioctl2, 1705 }; 1706 1707 static const struct v4l2_ioctl_ops video_ioctl_ops = { ··· 1752 .current_norm = V4L2_STD_NTSC_M, 1753 }; 1754 1755 + static const struct v4l2_file_operations radio_fops = 1756 { 1757 .owner = THIS_MODULE, 1758 .open = video_open, 1759 .release = video_release, 1760 .ioctl = video_ioctl2, 1761 }; 1762 1763 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
+1 -1
drivers/media/video/cx88/cx88.h
··· 643 644 int cx8802_register_driver(struct cx8802_driver *drv); 645 int cx8802_unregister_driver(struct cx8802_driver *drv); 646 - struct cx8802_dev * cx8802_get_device(struct inode *inode); 647 struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype); 648 649 /* ----------------------------------------------------------- */
··· 643 644 int cx8802_register_driver(struct cx8802_driver *drv); 645 int cx8802_unregister_driver(struct cx8802_driver *drv); 646 + struct cx8802_dev *cx8802_get_device(int minor); 647 struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype); 648 649 /* ----------------------------------------------------------- */
+41 -50
drivers/media/video/em28xx/em28xx-audio.c
··· 62 63 dprintk("Stopping isoc\n"); 64 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { 65 - usb_unlink_urb(dev->adev->urb[i]); 66 - usb_free_urb(dev->adev->urb[i]); 67 - dev->adev->urb[i] = NULL; 68 } 69 70 return 0; ··· 81 unsigned int stride; 82 struct snd_pcm_substream *substream; 83 struct snd_pcm_runtime *runtime; 84 - if (dev->adev->capture_pcm_substream) { 85 - substream = dev->adev->capture_pcm_substream; 86 runtime = substream->runtime; 87 stride = runtime->frame_bits >> 3; 88 ··· 95 if (!length) 96 continue; 97 98 - oldptr = dev->adev->hwptr_done_capture; 99 if (oldptr + length >= runtime->buffer_size) { 100 unsigned int cnt = 101 runtime->buffer_size - oldptr; ··· 110 111 snd_pcm_stream_lock(substream); 112 113 - dev->adev->hwptr_done_capture += length; 114 - if (dev->adev->hwptr_done_capture >= 115 runtime->buffer_size) 116 - dev->adev->hwptr_done_capture -= 117 runtime->buffer_size; 118 119 - dev->adev->capture_transfer_done += length; 120 - if (dev->adev->capture_transfer_done >= 121 runtime->period_size) { 122 - dev->adev->capture_transfer_done -= 123 runtime->period_size; 124 period_elapsed = 1; 125 } ··· 131 } 132 urb->status = 0; 133 134 - if (dev->adev->shutdown) 135 return; 136 137 status = usb_submit_urb(urb, GFP_ATOMIC); ··· 154 struct urb *urb; 155 int j, k; 156 157 - dev->adev->transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC); 158 - if (!dev->adev->transfer_buffer[i]) 159 return -ENOMEM; 160 161 - memset(dev->adev->transfer_buffer[i], 0x80, sb_size); 162 urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); 163 if (!urb) { 164 em28xx_errdev("usb_alloc_urb failed!\n"); 165 for (j = 0; j < i; j++) { 166 - usb_free_urb(dev->adev->urb[j]); 167 - kfree(dev->adev->transfer_buffer[j]); 168 } 169 return -ENOMEM; 170 } ··· 173 urb->context = dev; 174 urb->pipe = usb_rcvisocpipe(dev->udev, 0x83); 175 urb->transfer_flags = URB_ISO_ASAP; 176 - urb->transfer_buffer = dev->adev->transfer_buffer[i]; 177 urb->interval = 1; 178 urb->complete = em28xx_audio_isocirq; 179 urb->number_of_packets = EM28XX_NUM_AUDIO_PACKETS; ··· 185 urb->iso_frame_desc[j].length = 186 EM28XX_AUDIO_MAX_PACKET_SIZE; 187 } 188 - dev->adev->urb[i] = urb; 189 } 190 191 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { 192 - errCode = usb_submit_urb(dev->adev->urb[i], GFP_ATOMIC); 193 if (errCode) { 194 em28xx_isoc_audio_deinit(dev); 195 ··· 202 203 static int em28xx_cmd(struct em28xx *dev, int cmd, int arg) 204 { 205 - dprintk("%s transfer\n", (dev->adev->capture_stream == STREAM_ON)? 206 "stop" : "start"); 207 208 switch (cmd) { 209 case EM28XX_CAPTURE_STREAM_EN: 210 - if (dev->adev->capture_stream == STREAM_OFF && arg == 1) { 211 - dev->adev->capture_stream = STREAM_ON; 212 em28xx_init_audio_isoc(dev); 213 - } else if (dev->adev->capture_stream == STREAM_ON && arg == 0) { 214 - dev->adev->capture_stream = STREAM_OFF; 215 em28xx_isoc_audio_deinit(dev); 216 } else { 217 printk(KERN_ERR "An underrun very likely occurred. " ··· 289 goto err; 290 291 runtime->hw = snd_em28xx_hw_capture; 292 - if (dev->alt == 0 && dev->adev->users == 0) { 293 int errCode; 294 dev->alt = 7; 295 errCode = usb_set_interface(dev->udev, 0, 7); 296 dprintk("changing alternate number to 7\n"); 297 } 298 299 - dev->adev->users++; 300 301 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 302 - dev->adev->capture_pcm_substream = substream; 303 runtime->private_data = dev; 304 305 return 0; ··· 311 static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) 312 { 313 struct em28xx *dev = snd_pcm_substream_chip(substream); 314 - dev->adev->users--; 315 316 dprintk("closing device\n"); 317 ··· 320 em28xx_audio_analog_set(dev); 321 mutex_unlock(&dev->lock); 322 323 - if (dev->adev->users == 0 && dev->adev->shutdown == 1) { 324 - dprintk("audio users: %d\n", dev->adev->users); 325 dprintk("disabling audio stream!\n"); 326 - dev->adev->shutdown = 0; 327 dprintk("released lock\n"); 328 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); 329 } ··· 356 357 dprintk("Stop capture, if needed\n"); 358 359 - if (dev->adev->capture_stream == STREAM_ON) 360 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); 361 362 return 0; ··· 379 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1); 380 return 0; 381 case SNDRV_PCM_TRIGGER_STOP: 382 - dev->adev->shutdown = 1; 383 return 0; 384 default: 385 return -EINVAL; ··· 393 394 snd_pcm_uframes_t hwptr_done; 395 dev = snd_pcm_substream_chip(substream); 396 - hwptr_done = dev->adev->hwptr_done_capture; 397 398 return hwptr_done; 399 } ··· 420 421 static int em28xx_audio_init(struct em28xx *dev) 422 { 423 - struct em28xx_audio *adev; 424 struct snd_pcm *pcm; 425 struct snd_card *card; 426 static int devnr; ··· 438 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " 439 "Rechberger\n"); 440 441 - adev = kzalloc(sizeof(*adev), GFP_KERNEL); 442 - if (!adev) { 443 - printk(KERN_ERR "em28xx-audio.c: out of memory\n"); 444 - return -1; 445 - } 446 card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); 447 - if (card == NULL) { 448 - kfree(adev); 449 return -ENOMEM; 450 - } 451 452 spin_lock_init(&adev->slock); 453 err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); ··· 464 } 465 adev->sndcard = card; 466 adev->udev = dev->udev; 467 - dev->adev = adev; 468 469 return 0; 470 } ··· 480 return 0; 481 } 482 483 - if (dev->adev) { 484 - snd_card_free(dev->adev->sndcard); 485 - kfree(dev->adev); 486 - dev->adev = NULL; 487 } 488 489 return 0;
··· 62 63 dprintk("Stopping isoc\n"); 64 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { 65 + usb_unlink_urb(dev->adev.urb[i]); 66 + usb_free_urb(dev->adev.urb[i]); 67 + dev->adev.urb[i] = NULL; 68 } 69 70 return 0; ··· 81 unsigned int stride; 82 struct snd_pcm_substream *substream; 83 struct snd_pcm_runtime *runtime; 84 + if (dev->adev.capture_pcm_substream) { 85 + substream = dev->adev.capture_pcm_substream; 86 runtime = substream->runtime; 87 stride = runtime->frame_bits >> 3; 88 ··· 95 if (!length) 96 continue; 97 98 + oldptr = dev->adev.hwptr_done_capture; 99 if (oldptr + length >= runtime->buffer_size) { 100 unsigned int cnt = 101 runtime->buffer_size - oldptr; ··· 110 111 snd_pcm_stream_lock(substream); 112 113 + dev->adev.hwptr_done_capture += length; 114 + if (dev->adev.hwptr_done_capture >= 115 runtime->buffer_size) 116 + dev->adev.hwptr_done_capture -= 117 runtime->buffer_size; 118 119 + dev->adev.capture_transfer_done += length; 120 + if (dev->adev.capture_transfer_done >= 121 runtime->period_size) { 122 + dev->adev.capture_transfer_done -= 123 runtime->period_size; 124 period_elapsed = 1; 125 } ··· 131 } 132 urb->status = 0; 133 134 + if (dev->adev.shutdown) 135 return; 136 137 status = usb_submit_urb(urb, GFP_ATOMIC); ··· 154 struct urb *urb; 155 int j, k; 156 157 + dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC); 158 + if (!dev->adev.transfer_buffer[i]) 159 return -ENOMEM; 160 161 + memset(dev->adev.transfer_buffer[i], 0x80, sb_size); 162 urb = usb_alloc_urb(EM28XX_NUM_AUDIO_PACKETS, GFP_ATOMIC); 163 if (!urb) { 164 em28xx_errdev("usb_alloc_urb failed!\n"); 165 for (j = 0; j < i; j++) { 166 + usb_free_urb(dev->adev.urb[j]); 167 + kfree(dev->adev.transfer_buffer[j]); 168 } 169 return -ENOMEM; 170 } ··· 173 urb->context = dev; 174 urb->pipe = usb_rcvisocpipe(dev->udev, 0x83); 175 urb->transfer_flags = URB_ISO_ASAP; 176 + urb->transfer_buffer = dev->adev.transfer_buffer[i]; 177 urb->interval = 1; 178 urb->complete = em28xx_audio_isocirq; 179 urb->number_of_packets = EM28XX_NUM_AUDIO_PACKETS; ··· 185 urb->iso_frame_desc[j].length = 186 EM28XX_AUDIO_MAX_PACKET_SIZE; 187 } 188 + dev->adev.urb[i] = urb; 189 } 190 191 for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { 192 + errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); 193 if (errCode) { 194 em28xx_isoc_audio_deinit(dev); 195 ··· 202 203 static int em28xx_cmd(struct em28xx *dev, int cmd, int arg) 204 { 205 + dprintk("%s transfer\n", (dev->adev.capture_stream == STREAM_ON) ? 206 "stop" : "start"); 207 208 switch (cmd) { 209 case EM28XX_CAPTURE_STREAM_EN: 210 + if (dev->adev.capture_stream == STREAM_OFF && arg == 1) { 211 + dev->adev.capture_stream = STREAM_ON; 212 em28xx_init_audio_isoc(dev); 213 + } else if (dev->adev.capture_stream == STREAM_ON && arg == 0) { 214 + dev->adev.capture_stream = STREAM_OFF; 215 em28xx_isoc_audio_deinit(dev); 216 } else { 217 printk(KERN_ERR "An underrun very likely occurred. " ··· 289 goto err; 290 291 runtime->hw = snd_em28xx_hw_capture; 292 + if (dev->alt == 0 && dev->adev.users == 0) { 293 int errCode; 294 dev->alt = 7; 295 errCode = usb_set_interface(dev->udev, 0, 7); 296 dprintk("changing alternate number to 7\n"); 297 } 298 299 + dev->adev.users++; 300 301 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 302 + dev->adev.capture_pcm_substream = substream; 303 runtime->private_data = dev; 304 305 return 0; ··· 311 static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) 312 { 313 struct em28xx *dev = snd_pcm_substream_chip(substream); 314 + dev->adev.users--; 315 316 dprintk("closing device\n"); 317 ··· 320 em28xx_audio_analog_set(dev); 321 mutex_unlock(&dev->lock); 322 323 + if (dev->adev.users == 0 && dev->adev.shutdown == 1) { 324 + dprintk("audio users: %d\n", dev->adev.users); 325 dprintk("disabling audio stream!\n"); 326 + dev->adev.shutdown = 0; 327 dprintk("released lock\n"); 328 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); 329 } ··· 356 357 dprintk("Stop capture, if needed\n"); 358 359 + if (dev->adev.capture_stream == STREAM_ON) 360 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 0); 361 362 return 0; ··· 379 em28xx_cmd(dev, EM28XX_CAPTURE_STREAM_EN, 1); 380 return 0; 381 case SNDRV_PCM_TRIGGER_STOP: 382 + dev->adev.shutdown = 1; 383 return 0; 384 default: 385 return -EINVAL; ··· 393 394 snd_pcm_uframes_t hwptr_done; 395 dev = snd_pcm_substream_chip(substream); 396 + hwptr_done = dev->adev.hwptr_done_capture; 397 398 return hwptr_done; 399 } ··· 420 421 static int em28xx_audio_init(struct em28xx *dev) 422 { 423 + struct em28xx_audio *adev = &dev->adev; 424 struct snd_pcm *pcm; 425 struct snd_card *card; 426 static int devnr; ··· 438 printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " 439 "Rechberger\n"); 440 441 card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); 442 + if (card == NULL) 443 return -ENOMEM; 444 445 spin_lock_init(&adev->slock); 446 err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); ··· 471 } 472 adev->sndcard = card; 473 adev->udev = dev->udev; 474 475 return 0; 476 } ··· 488 return 0; 489 } 490 491 + if (dev->adev.sndcard) { 492 + snd_card_free(dev->adev.sndcard); 493 + dev->adev.sndcard = NULL; 494 } 495 496 return 0;
+1 -2
drivers/media/video/em28xx/em28xx-core.c
··· 1000 static LIST_HEAD(em28xx_devlist); 1001 static DEFINE_MUTEX(em28xx_devlist_mutex); 1002 1003 - struct em28xx *em28xx_get_device(struct inode *inode, 1004 enum v4l2_buf_type *fh_type, 1005 int *has_radio) 1006 { 1007 struct em28xx *h, *dev = NULL; 1008 - int minor = iminor(inode); 1009 1010 *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1011 *has_radio = 0;
··· 1000 static LIST_HEAD(em28xx_devlist); 1001 static DEFINE_MUTEX(em28xx_devlist_mutex); 1002 1003 + struct em28xx *em28xx_get_device(int minor, 1004 enum v4l2_buf_type *fh_type, 1005 int *has_radio) 1006 { 1007 struct em28xx *h, *dev = NULL; 1008 1009 *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1010 *has_radio = 0;
+1 -1
drivers/media/video/em28xx/em28xx-reg.h
··· 160 161 /* FIXME: Need to be populated with the other chip ID's */ 162 enum em28xx_chip_id { 163 - CHIP_ID_EM2820 = 18, 164 CHIP_ID_EM2840 = 20, 165 CHIP_ID_EM2750 = 33, 166 CHIP_ID_EM2860 = 34,
··· 160 161 /* FIXME: Need to be populated with the other chip ID's */ 162 enum em28xx_chip_id { 163 + CHIP_ID_EM2820 = 18, /* Also used by em2710 */ 164 CHIP_ID_EM2840 = 20, 165 CHIP_ID_EM2750 = 33, 166 CHIP_ID_EM2860 = 34,
+21 -23
drivers/media/video/em28xx/em28xx-video.c
··· 1154 } 1155 1156 static int vidioc_g_chip_ident(struct file *file, void *priv, 1157 - struct v4l2_chip_ident *chip) 1158 { 1159 struct em28xx_fh *fh = priv; 1160 struct em28xx *dev = fh->dev; ··· 1162 chip->ident = V4L2_IDENT_NONE; 1163 chip->revision = 0; 1164 1165 - em28xx_i2c_call_clients(dev, VIDIOC_G_CHIP_IDENT, chip); 1166 1167 return 0; 1168 } 1169 1170 1171 static int vidioc_g_register(struct file *file, void *priv, 1172 - struct v4l2_register *reg) 1173 { 1174 struct em28xx_fh *fh = priv; 1175 struct em28xx *dev = fh->dev; 1176 int ret; 1177 1178 - switch (reg->match_type) { 1179 case V4L2_CHIP_MATCH_AC97: 1180 mutex_lock(&dev->lock); 1181 ret = em28xx_read_ac97(dev, reg->reg); ··· 1184 return ret; 1185 1186 reg->val = ret; 1187 return 0; 1188 case V4L2_CHIP_MATCH_I2C_DRIVER: 1189 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg); ··· 1193 /* Not supported yet */ 1194 return -EINVAL; 1195 default: 1196 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1197 return -EINVAL; 1198 } 1199 1200 /* Match host */ 1201 - if (em28xx_reg_len(reg->reg) == 1) { 1202 mutex_lock(&dev->lock); 1203 ret = em28xx_read_reg(dev, reg->reg); 1204 mutex_unlock(&dev->lock); ··· 1209 1210 reg->val = ret; 1211 } else { 1212 - __le64 val = 0; 1213 mutex_lock(&dev->lock); 1214 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, 1215 reg->reg, (char *)&val, 2); ··· 1217 if (ret < 0) 1218 return ret; 1219 1220 - reg->val = le64_to_cpu(val); 1221 } 1222 1223 return 0; 1224 } 1225 1226 static int vidioc_s_register(struct file *file, void *priv, 1227 - struct v4l2_register *reg) 1228 { 1229 struct em28xx_fh *fh = priv; 1230 struct em28xx *dev = fh->dev; 1231 - __le64 buf; 1232 int rc; 1233 1234 - switch (reg->match_type) { 1235 case V4L2_CHIP_MATCH_AC97: 1236 mutex_lock(&dev->lock); 1237 rc = em28xx_write_ac97(dev, reg->reg, reg->val); ··· 1245 /* Not supported yet */ 1246 return -EINVAL; 1247 default: 1248 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 1249 return -EINVAL; 1250 } 1251 1252 /* Match host */ 1253 - buf = cpu_to_le64(reg->val); 1254 1255 mutex_lock(&dev->lock); 1256 rc = em28xx_write_regs(dev, reg->reg, (char *)&buf, ··· 1584 * em28xx_v4l2_open() 1585 * inits the device and starts isoc transfer 1586 */ 1587 - static int em28xx_v4l2_open(struct inode *inode, struct file *filp) 1588 { 1589 - int minor = iminor(inode); 1590 int errCode = 0, radio; 1591 struct em28xx *dev; 1592 enum v4l2_buf_type fh_type; 1593 struct em28xx_fh *fh; 1594 1595 - dev = em28xx_get_device(inode, &fh_type, &radio); 1596 1597 if (NULL == dev) 1598 return -ENODEV; ··· 1688 * stops streaming and deallocates all resources allocated by the v4l2 1689 * calls and ioctls 1690 */ 1691 - static int em28xx_v4l2_close(struct inode *inode, struct file *filp) 1692 { 1693 struct em28xx_fh *fh = filp->private_data; 1694 struct em28xx *dev = fh->dev; ··· 1828 return rc; 1829 } 1830 1831 - static const struct file_operations em28xx_v4l_fops = { 1832 .owner = THIS_MODULE, 1833 .open = em28xx_v4l2_open, 1834 .release = em28xx_v4l2_close, ··· 1836 .poll = em28xx_v4l2_poll, 1837 .mmap = em28xx_v4l2_mmap, 1838 .ioctl = video_ioctl2, 1839 - .llseek = no_llseek, 1840 - .compat_ioctl = v4l_compat_ioctl32, 1841 }; 1842 1843 static const struct v4l2_ioctl_ops video_ioctl_ops = { ··· 1890 .current_norm = V4L2_STD_PAL, 1891 }; 1892 1893 - static const struct file_operations radio_fops = { 1894 .owner = THIS_MODULE, 1895 .open = em28xx_v4l2_open, 1896 .release = em28xx_v4l2_close, 1897 .ioctl = video_ioctl2, 1898 - .compat_ioctl = v4l_compat_ioctl32, 1899 - .llseek = no_llseek, 1900 }; 1901 1902 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
··· 1154 } 1155 1156 static int vidioc_g_chip_ident(struct file *file, void *priv, 1157 + struct v4l2_dbg_chip_ident *chip) 1158 { 1159 struct em28xx_fh *fh = priv; 1160 struct em28xx *dev = fh->dev; ··· 1162 chip->ident = V4L2_IDENT_NONE; 1163 chip->revision = 0; 1164 1165 + em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_CHIP_IDENT, chip); 1166 1167 return 0; 1168 } 1169 1170 1171 static int vidioc_g_register(struct file *file, void *priv, 1172 + struct v4l2_dbg_register *reg) 1173 { 1174 struct em28xx_fh *fh = priv; 1175 struct em28xx *dev = fh->dev; 1176 int ret; 1177 1178 + switch (reg->match.type) { 1179 case V4L2_CHIP_MATCH_AC97: 1180 mutex_lock(&dev->lock); 1181 ret = em28xx_read_ac97(dev, reg->reg); ··· 1184 return ret; 1185 1186 reg->val = ret; 1187 + reg->size = 1; 1188 return 0; 1189 case V4L2_CHIP_MATCH_I2C_DRIVER: 1190 em28xx_i2c_call_clients(dev, VIDIOC_DBG_G_REGISTER, reg); ··· 1192 /* Not supported yet */ 1193 return -EINVAL; 1194 default: 1195 + if (!v4l2_chip_match_host(&reg->match)) 1196 return -EINVAL; 1197 } 1198 1199 /* Match host */ 1200 + reg->size = em28xx_reg_len(reg->reg); 1201 + if (reg->size == 1) { 1202 mutex_lock(&dev->lock); 1203 ret = em28xx_read_reg(dev, reg->reg); 1204 mutex_unlock(&dev->lock); ··· 1207 1208 reg->val = ret; 1209 } else { 1210 + __le16 val = 0; 1211 mutex_lock(&dev->lock); 1212 ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, 1213 reg->reg, (char *)&val, 2); ··· 1215 if (ret < 0) 1216 return ret; 1217 1218 + reg->val = le16_to_cpu(val); 1219 } 1220 1221 return 0; 1222 } 1223 1224 static int vidioc_s_register(struct file *file, void *priv, 1225 + struct v4l2_dbg_register *reg) 1226 { 1227 struct em28xx_fh *fh = priv; 1228 struct em28xx *dev = fh->dev; 1229 + __le16 buf; 1230 int rc; 1231 1232 + switch (reg->match.type) { 1233 case V4L2_CHIP_MATCH_AC97: 1234 mutex_lock(&dev->lock); 1235 rc = em28xx_write_ac97(dev, reg->reg, reg->val); ··· 1243 /* Not supported yet */ 1244 return -EINVAL; 1245 default: 1246 + if (!v4l2_chip_match_host(&reg->match)) 1247 return -EINVAL; 1248 } 1249 1250 /* Match host */ 1251 + buf = cpu_to_le16(reg->val); 1252 1253 mutex_lock(&dev->lock); 1254 rc = em28xx_write_regs(dev, reg->reg, (char *)&buf, ··· 1582 * em28xx_v4l2_open() 1583 * inits the device and starts isoc transfer 1584 */ 1585 + static int em28xx_v4l2_open(struct file *filp) 1586 { 1587 + int minor = video_devdata(filp)->minor; 1588 int errCode = 0, radio; 1589 struct em28xx *dev; 1590 enum v4l2_buf_type fh_type; 1591 struct em28xx_fh *fh; 1592 1593 + dev = em28xx_get_device(minor, &fh_type, &radio); 1594 1595 if (NULL == dev) 1596 return -ENODEV; ··· 1686 * stops streaming and deallocates all resources allocated by the v4l2 1687 * calls and ioctls 1688 */ 1689 + static int em28xx_v4l2_close(struct file *filp) 1690 { 1691 struct em28xx_fh *fh = filp->private_data; 1692 struct em28xx *dev = fh->dev; ··· 1826 return rc; 1827 } 1828 1829 + static const struct v4l2_file_operations em28xx_v4l_fops = { 1830 .owner = THIS_MODULE, 1831 .open = em28xx_v4l2_open, 1832 .release = em28xx_v4l2_close, ··· 1834 .poll = em28xx_v4l2_poll, 1835 .mmap = em28xx_v4l2_mmap, 1836 .ioctl = video_ioctl2, 1837 }; 1838 1839 static const struct v4l2_ioctl_ops video_ioctl_ops = { ··· 1890 .current_norm = V4L2_STD_PAL, 1891 }; 1892 1893 + static const struct v4l2_file_operations radio_fops = { 1894 .owner = THIS_MODULE, 1895 .open = em28xx_v4l2_open, 1896 .release = em28xx_v4l2_close, 1897 .ioctl = video_ioctl2, 1898 }; 1899 1900 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
+2 -2
drivers/media/video/em28xx/em28xx.h
··· 473 unsigned long i2c_hash; /* i2c devicelist hash - 474 for boards with generic ID */ 475 476 - struct em28xx_audio *adev; 477 478 /* states */ 479 enum em28xx_dev_state state; ··· 583 void em28xx_wake_i2c(struct em28xx *dev); 584 void em28xx_remove_from_devlist(struct em28xx *dev); 585 void em28xx_add_into_devlist(struct em28xx *dev); 586 - struct em28xx *em28xx_get_device(struct inode *inode, 587 enum v4l2_buf_type *fh_type, 588 int *has_radio); 589 int em28xx_register_extension(struct em28xx_ops *dev);
··· 473 unsigned long i2c_hash; /* i2c devicelist hash - 474 for boards with generic ID */ 475 476 + struct em28xx_audio adev; 477 478 /* states */ 479 enum em28xx_dev_state state; ··· 583 void em28xx_wake_i2c(struct em28xx *dev); 584 void em28xx_remove_from_devlist(struct em28xx *dev); 585 void em28xx_add_into_devlist(struct em28xx *dev); 586 + struct em28xx *em28xx_get_device(int minor, 587 enum v4l2_buf_type *fh_type, 588 int *has_radio); 589 int em28xx_register_extension(struct em28xx_ops *dev);
+8 -12
drivers/media/video/et61x251/et61x251_core.c
··· 1206 } 1207 1208 1209 - static int et61x251_open(struct inode* inode, struct file* filp) 1210 { 1211 struct et61x251_device* cam; 1212 int err = 0; ··· 1291 } 1292 1293 1294 - static int et61x251_release(struct inode* inode, struct file* filp) 1295 { 1296 struct et61x251_device* cam; 1297 ··· 2392 } 2393 2394 2395 - static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, 2396 - unsigned int cmd, void __user * arg) 2397 { 2398 struct et61x251_device *cam = video_drvdata(filp); 2399 ··· 2487 } 2488 2489 2490 - static int et61x251_ioctl(struct inode* inode, struct file* filp, 2491 unsigned int cmd, unsigned long arg) 2492 { 2493 struct et61x251_device *cam = video_drvdata(filp); 2494 - int err = 0; 2495 2496 if (mutex_lock_interruptible(&cam->fileop_mutex)) 2497 return -ERESTARTSYS; ··· 2511 2512 V4LDBG(3, "et61x251", cmd); 2513 2514 - err = et61x251_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); 2515 2516 mutex_unlock(&cam->fileop_mutex); 2517 ··· 2519 } 2520 2521 2522 - static const struct file_operations et61x251_fops = { 2523 .owner = THIS_MODULE, 2524 .open = et61x251_open, 2525 .release = et61x251_release, 2526 .ioctl = et61x251_ioctl, 2527 - #ifdef CONFIG_COMPAT 2528 - .compat_ioctl = v4l_compat_ioctl32, 2529 - #endif 2530 .read = et61x251_read, 2531 .poll = et61x251_poll, 2532 .mmap = et61x251_mmap, 2533 - .llseek = no_llseek, 2534 }; 2535 2536 /*****************************************************************************/
··· 1206 } 1207 1208 1209 + static int et61x251_open(struct file *filp) 1210 { 1211 struct et61x251_device* cam; 1212 int err = 0; ··· 1291 } 1292 1293 1294 + static int et61x251_release(struct file *filp) 1295 { 1296 struct et61x251_device* cam; 1297 ··· 2392 } 2393 2394 2395 + static long et61x251_ioctl_v4l2(struct file *filp, 2396 + unsigned int cmd, void __user *arg) 2397 { 2398 struct et61x251_device *cam = video_drvdata(filp); 2399 ··· 2487 } 2488 2489 2490 + static long et61x251_ioctl(struct file *filp, 2491 unsigned int cmd, unsigned long arg) 2492 { 2493 struct et61x251_device *cam = video_drvdata(filp); 2494 + long err = 0; 2495 2496 if (mutex_lock_interruptible(&cam->fileop_mutex)) 2497 return -ERESTARTSYS; ··· 2511 2512 V4LDBG(3, "et61x251", cmd); 2513 2514 + err = et61x251_ioctl_v4l2(filp, cmd, (void __user *)arg); 2515 2516 mutex_unlock(&cam->fileop_mutex); 2517 ··· 2519 } 2520 2521 2522 + static const struct v4l2_file_operations et61x251_fops = { 2523 .owner = THIS_MODULE, 2524 .open = et61x251_open, 2525 .release = et61x251_release, 2526 .ioctl = et61x251_ioctl, 2527 .read = et61x251_read, 2528 .poll = et61x251_poll, 2529 .mmap = et61x251_mmap, 2530 }; 2531 2532 /*****************************************************************************/
+4 -8
drivers/media/video/gspca/gspca.c
··· 875 kfree(gspca_dev); 876 } 877 878 - static int dev_open(struct inode *inode, struct file *file) 879 { 880 struct gspca_dev *gspca_dev; 881 int ret; ··· 922 return ret; 923 } 924 925 - static int dev_close(struct inode *inode, struct file *file) 926 { 927 struct gspca_dev *gspca_dev = file->private_data; 928 ··· 1802 return ret; 1803 } 1804 1805 - static struct file_operations dev_fops = { 1806 .owner = THIS_MODULE, 1807 .open = dev_open, 1808 .release = dev_close, 1809 .read = dev_read, 1810 .mmap = dev_mmap, 1811 - .unlocked_ioctl = __video_ioctl2, 1812 - #ifdef CONFIG_COMPAT 1813 - .compat_ioctl = v4l_compat_ioctl32, 1814 - #endif 1815 - .llseek = no_llseek, 1816 .poll = dev_poll, 1817 }; 1818
··· 875 kfree(gspca_dev); 876 } 877 878 + static int dev_open(struct file *file) 879 { 880 struct gspca_dev *gspca_dev; 881 int ret; ··· 922 return ret; 923 } 924 925 + static int dev_close(struct file *file) 926 { 927 struct gspca_dev *gspca_dev = file->private_data; 928 ··· 1802 return ret; 1803 } 1804 1805 + static struct v4l2_file_operations dev_fops = { 1806 .owner = THIS_MODULE, 1807 .open = dev_open, 1808 .release = dev_close, 1809 .read = dev_read, 1810 .mmap = dev_mmap, 1811 + .unlocked_ioctl = video_ioctl2, 1812 .poll = dev_poll, 1813 }; 1814
+1 -1
drivers/media/video/hexium_gemini.c
··· 306 return 0; 307 } 308 309 - static int hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 310 { 311 struct saa7146_dev *dev = fh->dev; 312 struct hexium *hexium = (struct hexium *) dev->ext_priv;
··· 306 return 0; 307 } 308 309 + static long hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 310 { 311 struct saa7146_dev *dev = fh->dev; 312 struct hexium *hexium = (struct hexium *) dev->ext_priv;
+1 -1
drivers/media/video/hexium_orion.c
··· 370 return 0; 371 } 372 373 - static int hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 374 { 375 struct saa7146_dev *dev = fh->dev; 376 struct hexium *hexium = (struct hexium *) dev->ext_priv;
··· 370 return 0; 371 } 372 373 + static long hexium_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 374 { 375 struct saa7146_dev *dev = fh->dev; 376 struct hexium *hexium = (struct hexium *) dev->ext_priv;
+4 -3
drivers/media/video/ivtv/ivtv-driver.c
··· 902 } 903 904 if (hw & IVTV_HW_SAA711X) { 905 - struct v4l2_chip_ident v = { V4L2_CHIP_MATCH_I2C_DRIVER, I2C_DRIVERID_SAA711X }; 906 907 /* determine the exact saa711x model */ 908 itv->hw_flags &= ~IVTV_HW_SAA711X; 909 910 ivtv_call_hw(itv, IVTV_HW_SAA711X, core, g_chip_ident, &v); 911 if (v.ident == V4L2_IDENT_SAA7114) { 912 itv->hw_flags |= IVTV_HW_SAA7114; 913 /* VBI is not yet supported by the saa7114 driver. */ 914 itv->v4l2_cap &= ~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE); 915 - } 916 - else { 917 itv->hw_flags |= IVTV_HW_SAA7115; 918 } 919 itv->vbi.raw_decoder_line_size = 1443;
··· 902 } 903 904 if (hw & IVTV_HW_SAA711X) { 905 + struct v4l2_dbg_chip_ident v; 906 907 /* determine the exact saa711x model */ 908 itv->hw_flags &= ~IVTV_HW_SAA711X; 909 910 + v.match.type = V4L2_CHIP_MATCH_I2C_DRIVER; 911 + strlcpy(v.match.name, "saa7115", sizeof(v.match.name)); 912 ivtv_call_hw(itv, IVTV_HW_SAA711X, core, g_chip_ident, &v); 913 if (v.ident == V4L2_IDENT_SAA7114) { 914 itv->hw_flags |= IVTV_HW_SAA7114; 915 /* VBI is not yet supported by the saa7114 driver. */ 916 itv->v4l2_cap &= ~(V4L2_CAP_SLICED_VBI_CAPTURE|V4L2_CAP_VBI_CAPTURE); 917 + } else { 918 itv->hw_flags |= IVTV_HW_SAA7115; 919 } 920 itv->vbi.raw_decoder_line_size = 1443;
+2 -2
drivers/media/video/ivtv/ivtv-fileops.c
··· 831 ivtv_release_stream(s); 832 } 833 834 - int ivtv_v4l2_close(struct inode *inode, struct file *filp) 835 { 836 struct ivtv_open_id *id = filp->private_data; 837 struct ivtv *itv = id->itv; ··· 978 return 0; 979 } 980 981 - int ivtv_v4l2_open(struct inode *inode, struct file *filp) 982 { 983 int res; 984 struct ivtv *itv = NULL;
··· 831 ivtv_release_stream(s); 832 } 833 834 + int ivtv_v4l2_close(struct file *filp) 835 { 836 struct ivtv_open_id *id = filp->private_data; 837 struct ivtv *itv = id->itv; ··· 978 return 0; 979 } 980 981 + int ivtv_v4l2_open(struct file *filp) 982 { 983 int res; 984 struct ivtv *itv = NULL;
+2 -2
drivers/media/video/ivtv/ivtv-fileops.h
··· 22 #define IVTV_FILEOPS_H 23 24 /* Testing/Debugging */ 25 - int ivtv_v4l2_open(struct inode *inode, struct file *filp); 26 ssize_t ivtv_v4l2_read(struct file *filp, char __user *buf, size_t count, 27 loff_t * pos); 28 ssize_t ivtv_v4l2_write(struct file *filp, const char __user *buf, size_t count, 29 loff_t * pos); 30 - int ivtv_v4l2_close(struct inode *inode, struct file *filp); 31 unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait); 32 unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table * wait); 33 int ivtv_start_capture(struct ivtv_open_id *id);
··· 22 #define IVTV_FILEOPS_H 23 24 /* Testing/Debugging */ 25 + int ivtv_v4l2_open(struct file *filp); 26 ssize_t ivtv_v4l2_read(struct file *filp, char __user *buf, size_t count, 27 loff_t * pos); 28 ssize_t ivtv_v4l2_write(struct file *filp, const char __user *buf, size_t count, 29 loff_t * pos); 30 + int ivtv_v4l2_close(struct file *filp); 31 unsigned int ivtv_v4l2_enc_poll(struct file *filp, poll_table * wait); 32 unsigned int ivtv_v4l2_dec_poll(struct file *filp, poll_table * wait); 33 int ivtv_start_capture(struct ivtv_open_id *id);
+13 -12
drivers/media/video/ivtv/ivtv-ioctl.c
··· 674 return ret; 675 } 676 677 - static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident *chip) 678 { 679 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 680 681 chip->ident = V4L2_IDENT_NONE; 682 chip->revision = 0; 683 - if (chip->match_type == V4L2_CHIP_MATCH_HOST) { 684 - if (v4l2_chip_match_host(chip->match_type, chip->match_chip)) 685 chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416; 686 return 0; 687 } 688 - if (chip->match_type != V4L2_CHIP_MATCH_I2C_DRIVER && 689 - chip->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 690 return -EINVAL; 691 /* TODO: is this correct? */ 692 return ivtv_call_all_err(itv, core, g_chip_ident, chip); ··· 695 #ifdef CONFIG_VIDEO_ADV_DEBUG 696 static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg) 697 { 698 - struct v4l2_register *regs = arg; 699 volatile u8 __iomem *reg_start; 700 701 if (!capable(CAP_SYS_ADMIN)) ··· 710 else 711 return -EINVAL; 712 713 if (cmd == VIDIOC_DBG_G_REGISTER) 714 regs->val = readl(regs->reg + reg_start); 715 else ··· 718 return 0; 719 } 720 721 - static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *reg) 722 { 723 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 724 725 - if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 726 return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg); 727 /* TODO: subdev errors should not be ignored, this should become a 728 subdev helper function. */ ··· 730 return 0; 731 } 732 733 - static int ivtv_s_register(struct file *file, void *fh, struct v4l2_register *reg) 734 { 735 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 736 737 - if (v4l2_chip_match_host(reg->match_type, reg->match_chip)) 738 return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg); 739 /* TODO: subdev errors should not be ignored, this should become a 740 subdev helper function. */ ··· 1726 return 0; 1727 } 1728 1729 - static int ivtv_default(struct file *file, void *fh, int cmd, void *arg) 1730 { 1731 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 1732 ··· 1828 1829 if (ivtv_debug & IVTV_DBGFLG_IOCTL) 1830 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; 1831 - ret = __video_ioctl2(filp, cmd, arg); 1832 vfd->debug = 0; 1833 return ret; 1834 }
··· 674 return ret; 675 } 676 677 + static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_dbg_chip_ident *chip) 678 { 679 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 680 681 chip->ident = V4L2_IDENT_NONE; 682 chip->revision = 0; 683 + if (chip->match.type == V4L2_CHIP_MATCH_HOST) { 684 + if (v4l2_chip_match_host(&chip->match)) 685 chip->ident = itv->has_cx23415 ? V4L2_IDENT_CX23415 : V4L2_IDENT_CX23416; 686 return 0; 687 } 688 + if (chip->match.type != V4L2_CHIP_MATCH_I2C_DRIVER && 689 + chip->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 690 return -EINVAL; 691 /* TODO: is this correct? */ 692 return ivtv_call_all_err(itv, core, g_chip_ident, chip); ··· 695 #ifdef CONFIG_VIDEO_ADV_DEBUG 696 static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg) 697 { 698 + struct v4l2_dbg_register *regs = arg; 699 volatile u8 __iomem *reg_start; 700 701 if (!capable(CAP_SYS_ADMIN)) ··· 710 else 711 return -EINVAL; 712 713 + regs->size = 4; 714 if (cmd == VIDIOC_DBG_G_REGISTER) 715 regs->val = readl(regs->reg + reg_start); 716 else ··· 717 return 0; 718 } 719 720 + static int ivtv_g_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) 721 { 722 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 723 724 + if (v4l2_chip_match_host(&reg->match)) 725 return ivtv_itvc(itv, VIDIOC_DBG_G_REGISTER, reg); 726 /* TODO: subdev errors should not be ignored, this should become a 727 subdev helper function. */ ··· 729 return 0; 730 } 731 732 + static int ivtv_s_register(struct file *file, void *fh, struct v4l2_dbg_register *reg) 733 { 734 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 735 736 + if (v4l2_chip_match_host(&reg->match)) 737 return ivtv_itvc(itv, VIDIOC_DBG_S_REGISTER, reg); 738 /* TODO: subdev errors should not be ignored, this should become a 739 subdev helper function. */ ··· 1725 return 0; 1726 } 1727 1728 + static long ivtv_default(struct file *file, void *fh, int cmd, void *arg) 1729 { 1730 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 1731 ··· 1827 1828 if (ivtv_debug & IVTV_DBGFLG_IOCTL) 1829 vfd->debug = V4L2_DEBUG_IOCTL | V4L2_DEBUG_IOCTL_ARG; 1830 + ret = video_ioctl2(filp, cmd, arg); 1831 vfd->debug = 0; 1832 return ret; 1833 }
+3 -5
drivers/media/video/ivtv/ivtv-streams.c
··· 43 #include "ivtv-cards.h" 44 #include "ivtv-streams.h" 45 46 - static const struct file_operations ivtv_v4l2_enc_fops = { 47 .owner = THIS_MODULE, 48 .read = ivtv_v4l2_read, 49 .write = ivtv_v4l2_write, 50 .open = ivtv_v4l2_open, 51 .unlocked_ioctl = ivtv_v4l2_ioctl, 52 - .compat_ioctl = v4l_compat_ioctl32, 53 .release = ivtv_v4l2_close, 54 .poll = ivtv_v4l2_enc_poll, 55 }; 56 57 - static const struct file_operations ivtv_v4l2_dec_fops = { 58 .owner = THIS_MODULE, 59 .read = ivtv_v4l2_read, 60 .write = ivtv_v4l2_write, 61 .open = ivtv_v4l2_open, 62 .unlocked_ioctl = ivtv_v4l2_ioctl, 63 - .compat_ioctl = v4l_compat_ioctl32, 64 .release = ivtv_v4l2_close, 65 .poll = ivtv_v4l2_dec_poll, 66 }; ··· 76 int num_offset; 77 int dma, pio; 78 enum v4l2_buf_type buf_type; 79 - const struct file_operations *fops; 80 } ivtv_stream_info[] = { 81 { /* IVTV_ENC_STREAM_TYPE_MPG */ 82 "encoder MPG",
··· 43 #include "ivtv-cards.h" 44 #include "ivtv-streams.h" 45 46 + static const struct v4l2_file_operations ivtv_v4l2_enc_fops = { 47 .owner = THIS_MODULE, 48 .read = ivtv_v4l2_read, 49 .write = ivtv_v4l2_write, 50 .open = ivtv_v4l2_open, 51 .unlocked_ioctl = ivtv_v4l2_ioctl, 52 .release = ivtv_v4l2_close, 53 .poll = ivtv_v4l2_enc_poll, 54 }; 55 56 + static const struct v4l2_file_operations ivtv_v4l2_dec_fops = { 57 .owner = THIS_MODULE, 58 .read = ivtv_v4l2_read, 59 .write = ivtv_v4l2_write, 60 .open = ivtv_v4l2_open, 61 .unlocked_ioctl = ivtv_v4l2_ioctl, 62 .release = ivtv_v4l2_close, 63 .poll = ivtv_v4l2_dec_poll, 64 }; ··· 78 int num_offset; 79 int dma, pio; 80 enum v4l2_buf_type buf_type; 81 + const struct v4l2_file_operations *fops; 82 } ivtv_stream_info[] = { 83 { /* IVTV_ENC_STREAM_TYPE_MPG */ 84 "encoder MPG",
+6 -7
drivers/media/video/m52790.c
··· 80 } 81 82 #ifdef CONFIG_VIDEO_ADV_DEBUG 83 - static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 84 { 85 struct m52790_state *state = to_state(sd); 86 struct i2c_client *client = v4l2_get_subdevdata(sd); 87 88 - if (!v4l2_chip_match_i2c_client(client, 89 - reg->match_type, reg->match_chip)) 90 return -EINVAL; 91 if (!capable(CAP_SYS_ADMIN)) 92 return -EPERM; 93 if (reg->reg != 0) 94 return -EINVAL; 95 reg->val = state->input | state->output; 96 return 0; 97 } 98 99 - static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 100 { 101 struct m52790_state *state = to_state(sd); 102 struct i2c_client *client = v4l2_get_subdevdata(sd); 103 104 - if (!v4l2_chip_match_i2c_client(client, 105 - reg->match_type, reg->match_chip)) 106 return -EINVAL; 107 if (!capable(CAP_SYS_ADMIN)) 108 return -EPERM; ··· 114 } 115 #endif 116 117 - static int m52790_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 118 { 119 struct i2c_client *client = v4l2_get_subdevdata(sd); 120
··· 80 } 81 82 #ifdef CONFIG_VIDEO_ADV_DEBUG 83 + static int m52790_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 84 { 85 struct m52790_state *state = to_state(sd); 86 struct i2c_client *client = v4l2_get_subdevdata(sd); 87 88 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 89 return -EINVAL; 90 if (!capable(CAP_SYS_ADMIN)) 91 return -EPERM; 92 if (reg->reg != 0) 93 return -EINVAL; 94 + reg->size = 1; 95 reg->val = state->input | state->output; 96 return 0; 97 } 98 99 + static int m52790_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 100 { 101 struct m52790_state *state = to_state(sd); 102 struct i2c_client *client = v4l2_get_subdevdata(sd); 103 104 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 105 return -EINVAL; 106 if (!capable(CAP_SYS_ADMIN)) 107 return -EPERM; ··· 115 } 116 #endif 117 118 + static int m52790_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 119 { 120 struct i2c_client *client = v4l2_get_subdevdata(sd); 121
+4 -8
drivers/media/video/meye.c
··· 841 /* video4linux integration */ 842 /****************************************************************************/ 843 844 - static int meye_open(struct inode *inode, struct file *file) 845 { 846 int i; 847 ··· 863 return 0; 864 } 865 866 - static int meye_release(struct inode *inode, struct file *file) 867 { 868 mchip_hic_stop(); 869 mchip_dma_free(); ··· 1577 return 0; 1578 } 1579 1580 - static int vidioc_default(struct file *file, void *fh, int cmd, void *arg) 1581 { 1582 switch (cmd) { 1583 case MEYEIOC_G_PARAMS: ··· 1684 return 0; 1685 } 1686 1687 - static const struct file_operations meye_fops = { 1688 .owner = THIS_MODULE, 1689 .open = meye_open, 1690 .release = meye_release, 1691 .mmap = meye_mmap, 1692 .ioctl = video_ioctl2, 1693 - #ifdef CONFIG_COMPAT 1694 - .compat_ioctl = v4l_compat_ioctl32, 1695 - #endif 1696 .poll = meye_poll, 1697 - .llseek = no_llseek, 1698 }; 1699 1700 static const struct v4l2_ioctl_ops meye_ioctl_ops = {
··· 841 /* video4linux integration */ 842 /****************************************************************************/ 843 844 + static int meye_open(struct file *file) 845 { 846 int i; 847 ··· 863 return 0; 864 } 865 866 + static int meye_release(struct file *file) 867 { 868 mchip_hic_stop(); 869 mchip_dma_free(); ··· 1577 return 0; 1578 } 1579 1580 + static long vidioc_default(struct file *file, void *fh, int cmd, void *arg) 1581 { 1582 switch (cmd) { 1583 case MEYEIOC_G_PARAMS: ··· 1684 return 0; 1685 } 1686 1687 + static const struct v4l2_file_operations meye_fops = { 1688 .owner = THIS_MODULE, 1689 .open = meye_open, 1690 .release = meye_release, 1691 .mmap = meye_mmap, 1692 .ioctl = video_ioctl2, 1693 .poll = meye_poll, 1694 }; 1695 1696 static const struct v4l2_ioctl_ops meye_ioctl_ops = {
+2 -2
drivers/media/video/msp3400-driver.c
··· 483 } 484 485 #ifdef CONFIG_VIDEO_ALLOW_V4L1 486 - static int msp_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) 487 { 488 struct msp_state *state = to_state(sd); 489 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 733 return 0; 734 } 735 736 - static int msp_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 737 { 738 struct msp_state *state = to_state(sd); 739 struct i2c_client *client = v4l2_get_subdevdata(sd);
··· 483 } 484 485 #ifdef CONFIG_VIDEO_ALLOW_V4L1 486 + static long msp_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) 487 { 488 struct msp_state *state = to_state(sd); 489 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 733 return 0; 734 } 735 736 + static int msp_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 737 { 738 struct msp_state *state = to_state(sd); 739 struct i2c_client *client = v4l2_get_subdevdata(sd);
+10 -9
drivers/media/video/mt9m001.c
··· 343 } 344 345 static int mt9m001_get_chip_id(struct soc_camera_device *icd, 346 - struct v4l2_chip_ident *id) 347 { 348 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 349 350 - if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 351 return -EINVAL; 352 353 - if (id->match_chip != mt9m001->client->addr) 354 return -ENODEV; 355 356 id->ident = mt9m001->model; ··· 361 362 #ifdef CONFIG_VIDEO_ADV_DEBUG 363 static int mt9m001_get_register(struct soc_camera_device *icd, 364 - struct v4l2_register *reg) 365 { 366 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 367 368 - if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 369 return -EINVAL; 370 371 - if (reg->match_chip != mt9m001->client->addr) 372 return -ENODEV; 373 374 reg->val = reg_read(icd, reg->reg); 375 376 if (reg->val > 0xffff) ··· 381 } 382 383 static int mt9m001_set_register(struct soc_camera_device *icd, 384 - struct v4l2_register *reg) 385 { 386 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 387 388 - if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 389 return -EINVAL; 390 391 - if (reg->match_chip != mt9m001->client->addr) 392 return -ENODEV; 393 394 if (reg_write(icd, reg->reg, reg->val) < 0)
··· 343 } 344 345 static int mt9m001_get_chip_id(struct soc_camera_device *icd, 346 + struct v4l2_dbg_chip_ident *id) 347 { 348 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 349 350 + if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 351 return -EINVAL; 352 353 + if (id->match.addr != mt9m001->client->addr) 354 return -ENODEV; 355 356 id->ident = mt9m001->model; ··· 361 362 #ifdef CONFIG_VIDEO_ADV_DEBUG 363 static int mt9m001_get_register(struct soc_camera_device *icd, 364 + struct v4l2_dbg_register *reg) 365 { 366 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 367 368 + if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 369 return -EINVAL; 370 371 + if (reg->match.addr != mt9m001->client->addr) 372 return -ENODEV; 373 374 + reg->size = 2; 375 reg->val = reg_read(icd, reg->reg); 376 377 if (reg->val > 0xffff) ··· 380 } 381 382 static int mt9m001_set_register(struct soc_camera_device *icd, 383 + struct v4l2_dbg_register *reg) 384 { 385 struct mt9m001 *mt9m001 = container_of(icd, struct mt9m001, icd); 386 387 + if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 388 return -EINVAL; 389 390 + if (reg->match.addr != mt9m001->client->addr) 391 return -ENODEV; 392 393 if (reg_write(icd, reg->reg, reg->val) < 0)
+10 -9
drivers/media/video/mt9m111.c
··· 514 } 515 516 static int mt9m111_get_chip_id(struct soc_camera_device *icd, 517 - struct v4l2_chip_ident *id) 518 { 519 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 520 521 - if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 522 return -EINVAL; 523 524 - if (id->match_chip != mt9m111->client->addr) 525 return -ENODEV; 526 527 id->ident = mt9m111->model; ··· 532 533 #ifdef CONFIG_VIDEO_ADV_DEBUG 534 static int mt9m111_get_register(struct soc_camera_device *icd, 535 - struct v4l2_register *reg) 536 { 537 int val; 538 539 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 540 541 - if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 542 return -EINVAL; 543 - if (reg->match_chip != mt9m111->client->addr) 544 return -ENODEV; 545 546 val = mt9m111_reg_read(icd, reg->reg); 547 reg->val = (u64)val; 548 549 if (reg->val > 0xffff) ··· 554 } 555 556 static int mt9m111_set_register(struct soc_camera_device *icd, 557 - struct v4l2_register *reg) 558 { 559 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 560 561 - if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 562 return -EINVAL; 563 564 - if (reg->match_chip != mt9m111->client->addr) 565 return -ENODEV; 566 567 if (mt9m111_reg_write(icd, reg->reg, reg->val) < 0)
··· 514 } 515 516 static int mt9m111_get_chip_id(struct soc_camera_device *icd, 517 + struct v4l2_dbg_chip_ident *id) 518 { 519 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 520 521 + if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 522 return -EINVAL; 523 524 + if (id->match.addr != mt9m111->client->addr) 525 return -ENODEV; 526 527 id->ident = mt9m111->model; ··· 532 533 #ifdef CONFIG_VIDEO_ADV_DEBUG 534 static int mt9m111_get_register(struct soc_camera_device *icd, 535 + struct v4l2_dbg_register *reg) 536 { 537 int val; 538 539 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 540 541 + if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 542 return -EINVAL; 543 + if (reg->match.addr != mt9m111->client->addr) 544 return -ENODEV; 545 546 val = mt9m111_reg_read(icd, reg->reg); 547 + reg->size = 2; 548 reg->val = (u64)val; 549 550 if (reg->val > 0xffff) ··· 553 } 554 555 static int mt9m111_set_register(struct soc_camera_device *icd, 556 + struct v4l2_dbg_register *reg) 557 { 558 struct mt9m111 *mt9m111 = container_of(icd, struct mt9m111, icd); 559 560 + if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0x2ff) 561 return -EINVAL; 562 563 + if (reg->match.addr != mt9m111->client->addr) 564 return -ENODEV; 565 566 if (mt9m111_reg_write(icd, reg->reg, reg->val) < 0)
+9 -9
drivers/media/video/mt9t031.c
··· 326 } 327 328 static int mt9t031_get_chip_id(struct soc_camera_device *icd, 329 - struct v4l2_chip_ident *id) 330 { 331 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 332 333 - if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 334 return -EINVAL; 335 336 - if (id->match_chip != mt9t031->client->addr) 337 return -ENODEV; 338 339 id->ident = mt9t031->model; ··· 344 345 #ifdef CONFIG_VIDEO_ADV_DEBUG 346 static int mt9t031_get_register(struct soc_camera_device *icd, 347 - struct v4l2_register *reg) 348 { 349 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 350 351 - if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 352 return -EINVAL; 353 354 - if (reg->match_chip != mt9t031->client->addr) 355 return -ENODEV; 356 357 reg->val = reg_read(icd, reg->reg); ··· 363 } 364 365 static int mt9t031_set_register(struct soc_camera_device *icd, 366 - struct v4l2_register *reg) 367 { 368 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 369 370 - if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 371 return -EINVAL; 372 373 - if (reg->match_chip != mt9t031->client->addr) 374 return -ENODEV; 375 376 if (reg_write(icd, reg->reg, reg->val) < 0)
··· 326 } 327 328 static int mt9t031_get_chip_id(struct soc_camera_device *icd, 329 + struct v4l2_dbg_chip_ident *id) 330 { 331 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 332 333 + if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 334 return -EINVAL; 335 336 + if (id->match.addr != mt9t031->client->addr) 337 return -ENODEV; 338 339 id->ident = mt9t031->model; ··· 344 345 #ifdef CONFIG_VIDEO_ADV_DEBUG 346 static int mt9t031_get_register(struct soc_camera_device *icd, 347 + struct v4l2_dbg_register *reg) 348 { 349 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 350 351 + if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 352 return -EINVAL; 353 354 + if (reg->match.addr != mt9t031->client->addr) 355 return -ENODEV; 356 357 reg->val = reg_read(icd, reg->reg); ··· 363 } 364 365 static int mt9t031_set_register(struct soc_camera_device *icd, 366 + struct v4l2_dbg_register *reg) 367 { 368 struct mt9t031 *mt9t031 = container_of(icd, struct mt9t031, icd); 369 370 + if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 371 return -EINVAL; 372 373 + if (reg->match.addr != mt9t031->client->addr) 374 return -ENODEV; 375 376 if (reg_write(icd, reg->reg, reg->val) < 0)
+10 -9
drivers/media/video/mt9v022.c
··· 422 } 423 424 static int mt9v022_get_chip_id(struct soc_camera_device *icd, 425 - struct v4l2_chip_ident *id) 426 { 427 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 428 429 - if (id->match_type != V4L2_CHIP_MATCH_I2C_ADDR) 430 return -EINVAL; 431 432 - if (id->match_chip != mt9v022->client->addr) 433 return -ENODEV; 434 435 id->ident = mt9v022->model; ··· 440 441 #ifdef CONFIG_VIDEO_ADV_DEBUG 442 static int mt9v022_get_register(struct soc_camera_device *icd, 443 - struct v4l2_register *reg) 444 { 445 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 446 447 - if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 448 return -EINVAL; 449 450 - if (reg->match_chip != mt9v022->client->addr) 451 return -ENODEV; 452 453 reg->val = reg_read(icd, reg->reg); 454 455 if (reg->val > 0xffff) ··· 460 } 461 462 static int mt9v022_set_register(struct soc_camera_device *icd, 463 - struct v4l2_register *reg) 464 { 465 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 466 467 - if (reg->match_type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 468 return -EINVAL; 469 470 - if (reg->match_chip != mt9v022->client->addr) 471 return -ENODEV; 472 473 if (reg_write(icd, reg->reg, reg->val) < 0)
··· 422 } 423 424 static int mt9v022_get_chip_id(struct soc_camera_device *icd, 425 + struct v4l2_dbg_chip_ident *id) 426 { 427 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 428 429 + if (id->match.type != V4L2_CHIP_MATCH_I2C_ADDR) 430 return -EINVAL; 431 432 + if (id->match.addr != mt9v022->client->addr) 433 return -ENODEV; 434 435 id->ident = mt9v022->model; ··· 440 441 #ifdef CONFIG_VIDEO_ADV_DEBUG 442 static int mt9v022_get_register(struct soc_camera_device *icd, 443 + struct v4l2_dbg_register *reg) 444 { 445 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 446 447 + if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 448 return -EINVAL; 449 450 + if (reg->match.addr != mt9v022->client->addr) 451 return -ENODEV; 452 453 + reg->size = 2; 454 reg->val = reg_read(icd, reg->reg); 455 456 if (reg->val > 0xffff) ··· 459 } 460 461 static int mt9v022_set_register(struct soc_camera_device *icd, 462 + struct v4l2_dbg_register *reg) 463 { 464 struct mt9v022 *mt9v022 = container_of(icd, struct mt9v022, icd); 465 466 + if (reg->match.type != V4L2_CHIP_MATCH_I2C_ADDR || reg->reg > 0xff) 467 return -EINVAL; 468 469 + if (reg->match.addr != mt9v022->client->addr) 470 return -ENODEV; 471 472 if (reg_write(icd, reg->reg, reg->val) < 0)
+1 -1
drivers/media/video/mxb.c
··· 489 return 0; 490 } 491 492 - static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 493 { 494 struct saa7146_dev *dev = fh->dev; 495 struct mxb *mxb = (struct mxb *)dev->ext_priv;
··· 489 return 0; 490 } 491 492 + static long mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) 493 { 494 struct saa7146_dev *dev = fh->dev; 495 struct mxb *mxb = (struct mxb *)dev->ext_priv;
+4 -5
drivers/media/video/omap24xxcam.c
··· 1454 return rval; 1455 } 1456 1457 - static int omap24xxcam_open(struct inode *inode, struct file *file) 1458 { 1459 - int minor = iminor(inode); 1460 struct omap24xxcam_device *cam = omap24xxcam.priv; 1461 struct omap24xxcam_fh *fh; 1462 struct v4l2_format format; ··· 1511 return -ENODEV; 1512 } 1513 1514 - static int omap24xxcam_release(struct inode *inode, struct file *file) 1515 { 1516 struct omap24xxcam_fh *fh = file->private_data; 1517 struct omap24xxcam_device *cam = fh->cam; ··· 1559 return 0; 1560 } 1561 1562 - static struct file_operations omap24xxcam_fops = { 1563 - .llseek = no_llseek, 1564 .ioctl = video_ioctl2, 1565 .poll = omap24xxcam_poll, 1566 .mmap = omap24xxcam_mmap,
··· 1454 return rval; 1455 } 1456 1457 + static int omap24xxcam_open(struct file *file) 1458 { 1459 + int minor = video_devdata(file)->minor; 1460 struct omap24xxcam_device *cam = omap24xxcam.priv; 1461 struct omap24xxcam_fh *fh; 1462 struct v4l2_format format; ··· 1511 return -ENODEV; 1512 } 1513 1514 + static int omap24xxcam_release(struct file *file) 1515 { 1516 struct omap24xxcam_fh *fh = file->private_data; 1517 struct omap24xxcam_device *cam = fh->cam; ··· 1559 return 0; 1560 } 1561 1562 + static struct v4l2_file_operations omap24xxcam_fops = { 1563 .ioctl = video_ioctl2, 1564 .poll = omap24xxcam_poll, 1565 .mmap = omap24xxcam_mmap,
+6 -10
drivers/media/video/ov511.c
··· 3915 ***************************************************************************/ 3916 3917 static int 3918 - ov51x_v4l1_open(struct inode *inode, struct file *file) 3919 { 3920 struct video_device *vdev = video_devdata(file); 3921 struct usb_ov511 *ov = video_get_drvdata(vdev); ··· 3972 } 3973 3974 static int 3975 - ov51x_v4l1_close(struct inode *inode, struct file *file) 3976 { 3977 struct video_device *vdev = file->private_data; 3978 struct usb_ov511 *ov = video_get_drvdata(vdev); ··· 4010 } 4011 4012 /* Do not call this function directly! */ 4013 - static int 4014 ov51x_v4l1_ioctl_internal(struct file *file, unsigned int cmd, void *arg) 4015 { 4016 struct video_device *vdev = file->private_data; ··· 4449 return 0; 4450 } 4451 4452 - static int 4453 - ov51x_v4l1_ioctl(struct inode *inode, struct file *file, 4454 unsigned int cmd, unsigned long arg) 4455 { 4456 struct video_device *vdev = file->private_data; ··· 4661 return 0; 4662 } 4663 4664 - static const struct file_operations ov511_fops = { 4665 .owner = THIS_MODULE, 4666 .open = ov51x_v4l1_open, 4667 .release = ov51x_v4l1_close, 4668 .read = ov51x_v4l1_read, 4669 .mmap = ov51x_v4l1_mmap, 4670 .ioctl = ov51x_v4l1_ioctl, 4671 - #ifdef CONFIG_COMPAT 4672 - .compat_ioctl = v4l_compat_ioctl32, 4673 - #endif 4674 - .llseek = no_llseek, 4675 }; 4676 4677 static struct video_device vdev_template = {
··· 3915 ***************************************************************************/ 3916 3917 static int 3918 + ov51x_v4l1_open(struct file *file) 3919 { 3920 struct video_device *vdev = video_devdata(file); 3921 struct usb_ov511 *ov = video_get_drvdata(vdev); ··· 3972 } 3973 3974 static int 3975 + ov51x_v4l1_close(struct file *file) 3976 { 3977 struct video_device *vdev = file->private_data; 3978 struct usb_ov511 *ov = video_get_drvdata(vdev); ··· 4010 } 4011 4012 /* Do not call this function directly! */ 4013 + static long 4014 ov51x_v4l1_ioctl_internal(struct file *file, unsigned int cmd, void *arg) 4015 { 4016 struct video_device *vdev = file->private_data; ··· 4449 return 0; 4450 } 4451 4452 + static long 4453 + ov51x_v4l1_ioctl(struct file *file, 4454 unsigned int cmd, unsigned long arg) 4455 { 4456 struct video_device *vdev = file->private_data; ··· 4661 return 0; 4662 } 4663 4664 + static const struct v4l2_file_operations ov511_fops = { 4665 .owner = THIS_MODULE, 4666 .open = ov51x_v4l1_open, 4667 .release = ov51x_v4l1_close, 4668 .read = ov51x_v4l1_read, 4669 .mmap = ov51x_v4l1_mmap, 4670 .ioctl = ov51x_v4l1_ioctl, 4671 }; 4672 4673 static struct video_device vdev_template = {
+1 -1
drivers/media/video/ov7670.c
··· 1310 void *arg) 1311 { 1312 switch (cmd) { 1313 - case VIDIOC_G_CHIP_IDENT: 1314 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_OV7670, 0); 1315 1316 case VIDIOC_INT_RESET:
··· 1310 void *arg) 1311 { 1312 switch (cmd) { 1313 + case VIDIOC_DBG_G_CHIP_IDENT: 1314 return v4l2_chip_ident_i2c_client(client, arg, V4L2_IDENT_OV7670, 0); 1315 1316 case VIDIOC_INT_RESET:
+4 -3
drivers/media/video/ov772x.c
··· 724 } 725 726 static int ov772x_get_chip_id(struct soc_camera_device *icd, 727 - struct v4l2_chip_ident *id) 728 { 729 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 730 ··· 736 737 #ifdef CONFIG_VIDEO_ADV_DEBUG 738 static int ov772x_get_register(struct soc_camera_device *icd, 739 - struct v4l2_register *reg) 740 { 741 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 742 int ret; 743 744 if (reg->reg > 0xff) 745 return -EINVAL; 746 ··· 755 } 756 757 static int ov772x_set_register(struct soc_camera_device *icd, 758 - struct v4l2_register *reg) 759 { 760 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 761
··· 724 } 725 726 static int ov772x_get_chip_id(struct soc_camera_device *icd, 727 + struct v4l2_dbg_chip_ident *id) 728 { 729 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 730 ··· 736 737 #ifdef CONFIG_VIDEO_ADV_DEBUG 738 static int ov772x_get_register(struct soc_camera_device *icd, 739 + struct v4l2_dbg_register *reg) 740 { 741 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 742 int ret; 743 744 + reg->size = 1; 745 if (reg->reg > 0xff) 746 return -EINVAL; 747 ··· 754 } 755 756 static int ov772x_set_register(struct soc_camera_device *icd, 757 + struct v4l2_dbg_register *reg) 758 { 759 struct ov772x_priv *priv = container_of(icd, struct ov772x_priv, icd); 760
+5 -9
drivers/media/video/pms.c
··· 680 * Video4linux interfacing 681 */ 682 683 - static int pms_do_ioctl(struct file *file, unsigned int cmd, void *arg) 684 { 685 struct video_device *dev = video_devdata(file); 686 struct pms_device *pd=(struct pms_device *)dev; ··· 862 return 0; 863 } 864 865 - static int pms_ioctl(struct inode *inode, struct file *file, 866 unsigned int cmd, unsigned long arg) 867 { 868 return video_usercopy(file, cmd, arg, pms_do_ioctl); ··· 881 return len; 882 } 883 884 - static int pms_exclusive_open(struct inode *inode, struct file *file) 885 { 886 struct video_device *v = video_devdata(file); 887 struct pms_device *pd = (struct pms_device *)v; ··· 889 return test_and_set_bit(0, &pd->in_use) ? -EBUSY : 0; 890 } 891 892 - static int pms_exclusive_release(struct inode *inode, struct file *file) 893 { 894 struct video_device *v = video_devdata(file); 895 struct pms_device *pd = (struct pms_device *)v; ··· 898 return 0; 899 } 900 901 - static const struct file_operations pms_fops = { 902 .owner = THIS_MODULE, 903 .open = pms_exclusive_open, 904 .release = pms_exclusive_release, 905 .ioctl = pms_ioctl, 906 - #ifdef CONFIG_COMPAT 907 - .compat_ioctl = v4l_compat_ioctl32, 908 - #endif 909 .read = pms_read, 910 - .llseek = no_llseek, 911 }; 912 913 static struct video_device pms_template=
··· 680 * Video4linux interfacing 681 */ 682 683 + static long pms_do_ioctl(struct file *file, unsigned int cmd, void *arg) 684 { 685 struct video_device *dev = video_devdata(file); 686 struct pms_device *pd=(struct pms_device *)dev; ··· 862 return 0; 863 } 864 865 + static long pms_ioctl(struct file *file, 866 unsigned int cmd, unsigned long arg) 867 { 868 return video_usercopy(file, cmd, arg, pms_do_ioctl); ··· 881 return len; 882 } 883 884 + static int pms_exclusive_open(struct file *file) 885 { 886 struct video_device *v = video_devdata(file); 887 struct pms_device *pd = (struct pms_device *)v; ··· 889 return test_and_set_bit(0, &pd->in_use) ? -EBUSY : 0; 890 } 891 892 + static int pms_exclusive_release(struct file *file) 893 { 894 struct video_device *v = video_devdata(file); 895 struct pms_device *pd = (struct pms_device *)v; ··· 898 return 0; 899 } 900 901 + static const struct v4l2_file_operations pms_fops = { 902 .owner = THIS_MODULE, 903 .open = pms_exclusive_open, 904 .release = pms_exclusive_release, 905 .ioctl = pms_ioctl, 906 .read = pms_read, 907 }; 908 909 static struct video_device pms_template=
+5 -6
drivers/media/video/pvrusb2/pvrusb2-hdw.c
··· 4732 4733 4734 int pvr2_hdw_register_access(struct pvr2_hdw *hdw, 4735 - u32 match_type, u32 match_chip, u64 reg_id, 4736 - int setFl,u64 *val_ptr) 4737 { 4738 #ifdef CONFIG_VIDEO_ADV_DEBUG 4739 struct pvr2_i2c_client *cp; 4740 - struct v4l2_register req; 4741 int stat = 0; 4742 int okFl = 0; 4743 4744 if (!capable(CAP_SYS_ADMIN)) return -EPERM; 4745 4746 - req.match_type = match_type; 4747 - req.match_chip = match_chip; 4748 req.reg = reg_id; 4749 if (setFl) req.val = *val_ptr; 4750 mutex_lock(&hdw->i2c_list_lock); do { 4751 list_for_each_entry(cp, &hdw->i2c_clients, list) { 4752 if (!v4l2_chip_match_i2c_client( 4753 cp->client, 4754 - req.match_type, req.match_chip)) { 4755 continue; 4756 } 4757 stat = pvr2_i2c_client_cmd(
··· 4732 4733 4734 int pvr2_hdw_register_access(struct pvr2_hdw *hdw, 4735 + struct v4l2_dbg_match *match, u64 reg_id, 4736 + int setFl, u64 *val_ptr) 4737 { 4738 #ifdef CONFIG_VIDEO_ADV_DEBUG 4739 struct pvr2_i2c_client *cp; 4740 + struct v4l2_dbg_register req; 4741 int stat = 0; 4742 int okFl = 0; 4743 4744 if (!capable(CAP_SYS_ADMIN)) return -EPERM; 4745 4746 + req.match = *match; 4747 req.reg = reg_id; 4748 if (setFl) req.val = *val_ptr; 4749 mutex_lock(&hdw->i2c_list_lock); do { 4750 list_for_each_entry(cp, &hdw->i2c_clients, list) { 4751 if (!v4l2_chip_match_i2c_client( 4752 cp->client, 4753 + &req.match)) { 4754 continue; 4755 } 4756 stat = pvr2_i2c_client_cmd(
+2 -2
drivers/media/video/pvrusb2/pvrusb2-hdw.h
··· 242 setFl - true to set the register, false to read it 243 val_ptr - storage location for source / result. */ 244 int pvr2_hdw_register_access(struct pvr2_hdw *, 245 - u32 match_type, u32 match_chip,u64 reg_id, 246 - int setFl,u64 *val_ptr); 247 248 /* The following entry points are all lower level things you normally don't 249 want to worry about. */
··· 242 setFl - true to set the register, false to read it 243 val_ptr - storage location for source / result. */ 244 int pvr2_hdw_register_access(struct pvr2_hdw *, 245 + struct v4l2_dbg_match *match, u64 reg_id, 246 + int setFl, u64 *val_ptr); 247 248 /* The following entry points are all lower level things you normally don't 249 want to worry about. */
+14 -15
drivers/media/video/pvrusb2/pvrusb2-v4l2.c
··· 168 * This is part of Video 4 Linux API. The procedure handles ioctl() calls. 169 * 170 */ 171 - static int pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 172 { 173 struct pvr2_v4l2_fh *fh = file->private_data; 174 struct pvr2_v4l2 *vp = fh->vhead; 175 struct pvr2_v4l2_dev *dev_info = fh->dev_info; 176 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; 177 - int ret = -EINVAL; 178 179 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 180 v4l_print_ioctl(pvr2_hdw_get_driver_name(hdw),cmd); ··· 851 case VIDIOC_DBG_G_REGISTER: 852 { 853 u64 val; 854 - struct v4l2_register *req = (struct v4l2_register *)arg; 855 if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val; 856 ret = pvr2_hdw_register_access( 857 - hdw,req->match_type,req->match_chip,req->reg, 858 - cmd == VIDIOC_DBG_S_REGISTER,&val); 859 if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val; 860 break; 861 } ··· 871 if (ret < 0) { 872 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 873 pvr2_trace(PVR2_TRACE_V4LIOCTL, 874 - "pvr2_v4l2_do_ioctl failure, ret=%d",ret); 875 } else { 876 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 877 pvr2_trace(PVR2_TRACE_V4LIOCTL, 878 - "pvr2_v4l2_do_ioctl failure, ret=%d" 879 - " command was:",ret); 880 v4l_print_ioctl(pvr2_hdw_get_driver_name(hdw), 881 cmd); 882 } 883 } 884 } else { 885 pvr2_trace(PVR2_TRACE_V4LIOCTL, 886 - "pvr2_v4l2_do_ioctl complete, ret=%d (0x%x)", 887 - ret,ret); 888 } 889 return ret; 890 } ··· 948 } 949 950 951 - static int pvr2_v4l2_ioctl(struct inode *inode, struct file *file, 952 unsigned int cmd, unsigned long arg) 953 { 954 ··· 960 } 961 962 963 - static int pvr2_v4l2_release(struct inode *inode, struct file *file) 964 { 965 struct pvr2_v4l2_fh *fhp = file->private_data; 966 struct pvr2_v4l2 *vp = fhp->vhead; ··· 1008 } 1009 1010 1011 - static int pvr2_v4l2_open(struct inode *inode, struct file *file) 1012 { 1013 struct pvr2_v4l2_dev *dip; /* Our own context pointer */ 1014 struct pvr2_v4l2_fh *fhp; ··· 1235 } 1236 1237 1238 - static const struct file_operations vdev_fops = { 1239 .owner = THIS_MODULE, 1240 .open = pvr2_v4l2_open, 1241 .release = pvr2_v4l2_release, 1242 .read = pvr2_v4l2_read, 1243 .ioctl = pvr2_v4l2_ioctl, 1244 - .llseek = no_llseek, 1245 .poll = pvr2_v4l2_poll, 1246 }; 1247
··· 168 * This is part of Video 4 Linux API. The procedure handles ioctl() calls. 169 * 170 */ 171 + static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 172 { 173 struct pvr2_v4l2_fh *fh = file->private_data; 174 struct pvr2_v4l2 *vp = fh->vhead; 175 struct pvr2_v4l2_dev *dev_info = fh->dev_info; 176 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; 177 + long ret = -EINVAL; 178 179 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 180 v4l_print_ioctl(pvr2_hdw_get_driver_name(hdw),cmd); ··· 851 case VIDIOC_DBG_G_REGISTER: 852 { 853 u64 val; 854 + struct v4l2_dbg_register *req = (struct v4l2_dbg_register *)arg; 855 if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val; 856 ret = pvr2_hdw_register_access( 857 + hdw, &req->match, req->reg, 858 + cmd == VIDIOC_DBG_S_REGISTER, &val); 859 if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val; 860 break; 861 } ··· 871 if (ret < 0) { 872 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 873 pvr2_trace(PVR2_TRACE_V4LIOCTL, 874 + "pvr2_v4l2_do_ioctl failure, ret=%ld", ret); 875 } else { 876 if (pvrusb2_debug & PVR2_TRACE_V4LIOCTL) { 877 pvr2_trace(PVR2_TRACE_V4LIOCTL, 878 + "pvr2_v4l2_do_ioctl failure, ret=%ld" 879 + " command was:", ret); 880 v4l_print_ioctl(pvr2_hdw_get_driver_name(hdw), 881 cmd); 882 } 883 } 884 } else { 885 pvr2_trace(PVR2_TRACE_V4LIOCTL, 886 + "pvr2_v4l2_do_ioctl complete, ret=%ld (0x%lx)", 887 + ret, ret); 888 } 889 return ret; 890 } ··· 948 } 949 950 951 + static long pvr2_v4l2_ioctl(struct file *file, 952 unsigned int cmd, unsigned long arg) 953 { 954 ··· 960 } 961 962 963 + static int pvr2_v4l2_release(struct file *file) 964 { 965 struct pvr2_v4l2_fh *fhp = file->private_data; 966 struct pvr2_v4l2 *vp = fhp->vhead; ··· 1008 } 1009 1010 1011 + static int pvr2_v4l2_open(struct file *file) 1012 { 1013 struct pvr2_v4l2_dev *dip; /* Our own context pointer */ 1014 struct pvr2_v4l2_fh *fhp; ··· 1235 } 1236 1237 1238 + static const struct v4l2_file_operations vdev_fops = { 1239 .owner = THIS_MODULE, 1240 .open = pvr2_v4l2_open, 1241 .release = pvr2_v4l2_release, 1242 .read = pvr2_v4l2_read, 1243 .ioctl = pvr2_v4l2_ioctl, 1244 .poll = pvr2_v4l2_poll, 1245 }; 1246
+2 -2
drivers/media/video/pwc/pwc-ctrl.c
··· 1266 /* copy local variable to arg */ 1267 #define ARG_OUT(ARG_name) /* nothing */ 1268 1269 - int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) 1270 { 1271 - int ret = 0; 1272 1273 switch(cmd) { 1274 case VIDIOCPWCRUSER:
··· 1266 /* copy local variable to arg */ 1267 #define ARG_OUT(ARG_name) /* nothing */ 1268 1269 + long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) 1270 { 1271 + long ret = 0; 1272 1273 switch(cmd) { 1274 case VIDIOCPWCRUSER:
+8 -12
drivers/media/video/pwc/pwc-if.c
··· 142 143 /***/ 144 145 - static int pwc_video_open(struct inode *inode, struct file *file); 146 - static int pwc_video_close(struct inode *inode, struct file *file); 147 static ssize_t pwc_video_read(struct file *file, char __user *buf, 148 size_t count, loff_t *ppos); 149 static unsigned int pwc_video_poll(struct file *file, poll_table *wait); 150 - static int pwc_video_ioctl(struct inode *inode, struct file *file, 151 unsigned int ioctlnr, unsigned long arg); 152 static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma); 153 154 - static const struct file_operations pwc_fops = { 155 .owner = THIS_MODULE, 156 .open = pwc_video_open, 157 .release = pwc_video_close, ··· 159 .poll = pwc_video_poll, 160 .mmap = pwc_video_mmap, 161 .ioctl = pwc_video_ioctl, 162 - #ifdef CONFIG_COMPAT 163 - .compat_ioctl = v4l_compat_ioctl32, 164 - #endif 165 - .llseek = no_llseek, 166 }; 167 static struct video_device pwc_template = { 168 .name = "Philips Webcam", /* Filled in later */ ··· 1100 /***************************************************************************/ 1101 /* Video4Linux functions */ 1102 1103 - static int pwc_video_open(struct inode *inode, struct file *file) 1104 { 1105 int i, ret; 1106 struct video_device *vdev = video_devdata(file); ··· 1220 } 1221 1222 /* Note that all cleanup is done in the reverse order as in _open */ 1223 - static int pwc_video_close(struct inode *inode, struct file *file) 1224 { 1225 struct video_device *vdev = file->private_data; 1226 struct pwc_device *pdev; ··· 1395 return 0; 1396 } 1397 1398 - static int pwc_video_ioctl(struct inode *inode, struct file *file, 1399 unsigned int cmd, unsigned long arg) 1400 { 1401 struct video_device *vdev = file->private_data; 1402 struct pwc_device *pdev; 1403 - int r = -ENODEV; 1404 1405 if (!vdev) 1406 goto out;
··· 142 143 /***/ 144 145 + static int pwc_video_open(struct file *file); 146 + static int pwc_video_close(struct file *file); 147 static ssize_t pwc_video_read(struct file *file, char __user *buf, 148 size_t count, loff_t *ppos); 149 static unsigned int pwc_video_poll(struct file *file, poll_table *wait); 150 + static long pwc_video_ioctl(struct file *file, 151 unsigned int ioctlnr, unsigned long arg); 152 static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma); 153 154 + static const struct v4l2_file_operations pwc_fops = { 155 .owner = THIS_MODULE, 156 .open = pwc_video_open, 157 .release = pwc_video_close, ··· 159 .poll = pwc_video_poll, 160 .mmap = pwc_video_mmap, 161 .ioctl = pwc_video_ioctl, 162 }; 163 static struct video_device pwc_template = { 164 .name = "Philips Webcam", /* Filled in later */ ··· 1104 /***************************************************************************/ 1105 /* Video4Linux functions */ 1106 1107 + static int pwc_video_open(struct file *file) 1108 { 1109 int i, ret; 1110 struct video_device *vdev = video_devdata(file); ··· 1224 } 1225 1226 /* Note that all cleanup is done in the reverse order as in _open */ 1227 + static int pwc_video_close(struct file *file) 1228 { 1229 struct video_device *vdev = file->private_data; 1230 struct pwc_device *pdev; ··· 1399 return 0; 1400 } 1401 1402 + static long pwc_video_ioctl(struct file *file, 1403 unsigned int cmd, unsigned long arg) 1404 { 1405 struct video_device *vdev = file->private_data; 1406 struct pwc_device *pdev; 1407 + long r = -ENODEV; 1408 1409 if (!vdev) 1410 goto out;
+1 -1
drivers/media/video/pwc/pwc-v4l.c
··· 337 338 } 339 340 - int pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) 341 { 342 struct video_device *vdev = video_devdata(file); 343 struct pwc_device *pdev;
··· 337 338 } 339 340 + long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) 341 { 342 struct video_device *vdev = video_devdata(file); 343 struct pwc_device *pdev;
+2 -2
drivers/media/video/pwc/pwc.h
··· 337 extern int pwc_camera_power(struct pwc_device *pdev, int power); 338 339 /* Private ioctl()s; see pwc-ioctl.h */ 340 - extern int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg); 341 342 /** Functions in pwc-v4l.c */ 343 - extern int pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg); 344 345 /** pwc-uncompress.c */ 346 /* Expand frame to image, possibly including decompression. Uses read_frame and fill_image */
··· 337 extern int pwc_camera_power(struct pwc_device *pdev, int power); 338 339 /* Private ioctl()s; see pwc-ioctl.h */ 340 + extern long pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg); 341 342 /** Functions in pwc-v4l.c */ 343 + extern long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg); 344 345 /** pwc-uncompress.c */ 346 /* Expand frame to image, possibly including decompression. Uses read_frame and fill_image */
+5 -7
drivers/media/video/s2255drv.c
··· 1502 dprintk(2, "setting jpeg quality %d\n", jc->quality); 1503 return 0; 1504 } 1505 - static int s2255_open(struct inode *inode, struct file *file) 1506 { 1507 - int minor = iminor(inode); 1508 struct s2255_dev *h, *dev = NULL; 1509 struct s2255_fh *fh; 1510 struct list_head *list; ··· 1711 mutex_unlock(&dev->open_lock); 1712 } 1713 1714 - static int s2255_close(struct inode *inode, struct file *file) 1715 { 1716 struct s2255_fh *fh = file->private_data; 1717 struct s2255_dev *dev = fh->dev; 1718 - int minor = iminor(inode); 1719 if (!dev) 1720 return -ENODEV; 1721 ··· 1759 return ret; 1760 } 1761 1762 - static const struct file_operations s2255_fops_v4l = { 1763 .owner = THIS_MODULE, 1764 .open = s2255_open, 1765 .release = s2255_close, 1766 .poll = s2255_poll, 1767 .ioctl = video_ioctl2, /* V4L2 ioctl handler */ 1768 - .compat_ioctl = v4l_compat_ioctl32, 1769 .mmap = s2255_mmap_v4l, 1770 - .llseek = no_llseek, 1771 }; 1772 1773 static const struct v4l2_ioctl_ops s2255_ioctl_ops = {
··· 1502 dprintk(2, "setting jpeg quality %d\n", jc->quality); 1503 return 0; 1504 } 1505 + static int s2255_open(struct file *file) 1506 { 1507 + int minor = video_devdata(file)->minor; 1508 struct s2255_dev *h, *dev = NULL; 1509 struct s2255_fh *fh; 1510 struct list_head *list; ··· 1711 mutex_unlock(&dev->open_lock); 1712 } 1713 1714 + static int s2255_close(struct file *file) 1715 { 1716 struct s2255_fh *fh = file->private_data; 1717 struct s2255_dev *dev = fh->dev; 1718 + int minor = video_devdata(file)->minor; 1719 if (!dev) 1720 return -ENODEV; 1721 ··· 1759 return ret; 1760 } 1761 1762 + static const struct v4l2_file_operations s2255_fops_v4l = { 1763 .owner = THIS_MODULE, 1764 .open = s2255_open, 1765 .release = s2255_close, 1766 .poll = s2255_poll, 1767 .ioctl = video_ioctl2, /* V4L2 ioctl handler */ 1768 .mmap = s2255_mmap_v4l, 1769 }; 1770 1771 static const struct v4l2_ioctl_ops s2255_ioctl_ops = {
+6 -7
drivers/media/video/saa5246a.c
··· 804 * 805 * Returns 0 if successful 806 */ 807 - static int do_saa5246a_ioctl(struct file *file, unsigned int cmd, void *arg) 808 { 809 struct saa5246a_device *t = video_drvdata(file); 810 ··· 944 /* 945 * Handle the locking 946 */ 947 - static int saa5246a_ioctl(struct inode *inode, struct file *file, 948 unsigned int cmd, unsigned long arg) 949 { 950 struct saa5246a_device *t = video_drvdata(file); 951 - int err; 952 953 cmd = vtx_fix_command(cmd); 954 mutex_lock(&t->lock); ··· 957 return err; 958 } 959 960 - static int saa5246a_open(struct inode *inode, struct file *file) 961 { 962 struct saa5246a_device *t = video_drvdata(file); 963 ··· 999 return 0; 1000 } 1001 1002 - static int saa5246a_release(struct inode *inode, struct file *file) 1003 { 1004 struct saa5246a_device *t = video_drvdata(file); 1005 ··· 1018 return 0; 1019 } 1020 1021 - static const struct file_operations saa_fops = { 1022 .owner = THIS_MODULE, 1023 .open = saa5246a_open, 1024 .release = saa5246a_release, 1025 .ioctl = saa5246a_ioctl, 1026 - .llseek = no_llseek, 1027 }; 1028 1029 static struct video_device saa_template =
··· 804 * 805 * Returns 0 if successful 806 */ 807 + static long do_saa5246a_ioctl(struct file *file, unsigned int cmd, void *arg) 808 { 809 struct saa5246a_device *t = video_drvdata(file); 810 ··· 944 /* 945 * Handle the locking 946 */ 947 + static long saa5246a_ioctl(struct file *file, 948 unsigned int cmd, unsigned long arg) 949 { 950 struct saa5246a_device *t = video_drvdata(file); 951 + long err; 952 953 cmd = vtx_fix_command(cmd); 954 mutex_lock(&t->lock); ··· 957 return err; 958 } 959 960 + static int saa5246a_open(struct file *file) 961 { 962 struct saa5246a_device *t = video_drvdata(file); 963 ··· 999 return 0; 1000 } 1001 1002 + static int saa5246a_release(struct file *file) 1003 { 1004 struct saa5246a_device *t = video_drvdata(file); 1005 ··· 1018 return 0; 1019 } 1020 1021 + static const struct v4l2_file_operations saa_fops = { 1022 .owner = THIS_MODULE, 1023 .open = saa5246a_open, 1024 .release = saa5246a_release, 1025 .ioctl = saa5246a_ioctl, 1026 }; 1027 1028 static struct video_device saa_template =
+6 -10
drivers/media/video/saa5249.c
··· 190 * Standard character-device-driver functions 191 */ 192 193 - static int do_saa5249_ioctl(struct file *file, unsigned int cmd, void *arg) 194 { 195 static int virtual_mode = false; 196 struct saa5249_device *t = video_drvdata(file); ··· 479 * Handle the locking 480 */ 481 482 - static int saa5249_ioctl(struct inode *inode, struct file *file, 483 unsigned int cmd, unsigned long arg) 484 { 485 struct saa5249_device *t = video_drvdata(file); 486 - int err; 487 488 cmd = vtx_fix_command(cmd); 489 mutex_lock(&t->lock); ··· 492 return err; 493 } 494 495 - static int saa5249_open(struct inode *inode, struct file *file) 496 { 497 struct saa5249_device *t = video_drvdata(file); 498 int pgbuf; ··· 529 530 531 532 - static int saa5249_release(struct inode *inode, struct file *file) 533 { 534 struct saa5249_device *t = video_drvdata(file); 535 ··· 539 return 0; 540 } 541 542 - static const struct file_operations saa_fops = { 543 .owner = THIS_MODULE, 544 .open = saa5249_open, 545 .release = saa5249_release, 546 .ioctl = saa5249_ioctl, 547 - #ifdef CONFIG_COMPAT 548 - .compat_ioctl = v4l_compat_ioctl32, 549 - #endif 550 - .llseek = no_llseek, 551 }; 552 553 static struct video_device saa_template =
··· 190 * Standard character-device-driver functions 191 */ 192 193 + static long do_saa5249_ioctl(struct file *file, unsigned int cmd, void *arg) 194 { 195 static int virtual_mode = false; 196 struct saa5249_device *t = video_drvdata(file); ··· 479 * Handle the locking 480 */ 481 482 + static long saa5249_ioctl(struct file *file, 483 unsigned int cmd, unsigned long arg) 484 { 485 struct saa5249_device *t = video_drvdata(file); 486 + long err; 487 488 cmd = vtx_fix_command(cmd); 489 mutex_lock(&t->lock); ··· 492 return err; 493 } 494 495 + static int saa5249_open(struct file *file) 496 { 497 struct saa5249_device *t = video_drvdata(file); 498 int pgbuf; ··· 529 530 531 532 + static int saa5249_release(struct file *file) 533 { 534 struct saa5249_device *t = video_drvdata(file); 535 ··· 539 return 0; 540 } 541 542 + static const struct v4l2_file_operations saa_fops = { 543 .owner = THIS_MODULE, 544 .open = saa5249_open, 545 .release = saa5249_release, 546 .ioctl = saa5249_ioctl, 547 }; 548 549 static struct video_device saa_template =
+6 -7
drivers/media/video/saa7115.c
··· 1371 } 1372 1373 #ifdef CONFIG_VIDEO_ADV_DEBUG 1374 - static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1375 { 1376 struct i2c_client *client = v4l2_get_subdevdata(sd); 1377 1378 - if (!v4l2_chip_match_i2c_client(client, 1379 - reg->match_type, reg->match_chip)) 1380 return -EINVAL; 1381 if (!capable(CAP_SYS_ADMIN)) 1382 return -EPERM; 1383 reg->val = saa711x_read(sd, reg->reg & 0xff); 1384 return 0; 1385 } 1386 1387 - static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1388 { 1389 struct i2c_client *client = v4l2_get_subdevdata(sd); 1390 1391 - if (!v4l2_chip_match_i2c_client(client, 1392 - reg->match_type, reg->match_chip)) 1393 return -EINVAL; 1394 if (!capable(CAP_SYS_ADMIN)) 1395 return -EPERM; ··· 1397 } 1398 #endif 1399 1400 - static int saa711x_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1401 { 1402 struct saa711x_state *state = to_state(sd); 1403 struct i2c_client *client = v4l2_get_subdevdata(sd);
··· 1371 } 1372 1373 #ifdef CONFIG_VIDEO_ADV_DEBUG 1374 + static int saa711x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 1375 { 1376 struct i2c_client *client = v4l2_get_subdevdata(sd); 1377 1378 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 1379 return -EINVAL; 1380 if (!capable(CAP_SYS_ADMIN)) 1381 return -EPERM; 1382 reg->val = saa711x_read(sd, reg->reg & 0xff); 1383 + reg->size = 1; 1384 return 0; 1385 } 1386 1387 + static int saa711x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 1388 { 1389 struct i2c_client *client = v4l2_get_subdevdata(sd); 1390 1391 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 1392 return -EINVAL; 1393 if (!capable(CAP_SYS_ADMIN)) 1394 return -EPERM; ··· 1398 } 1399 #endif 1400 1401 + static int saa711x_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 1402 { 1403 struct saa711x_state *state = to_state(sd); 1404 struct i2c_client *client = v4l2_get_subdevdata(sd);
+6 -7
drivers/media/video/saa7127.c
··· 623 } 624 625 #ifdef CONFIG_VIDEO_ADV_DEBUG 626 - static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 627 { 628 struct i2c_client *client = v4l2_get_subdevdata(sd); 629 630 - if (!v4l2_chip_match_i2c_client(client, 631 - reg->match_type, reg->match_chip)) 632 return -EINVAL; 633 if (!capable(CAP_SYS_ADMIN)) 634 return -EPERM; 635 reg->val = saa7127_read(sd, reg->reg & 0xff); 636 return 0; 637 } 638 639 - static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 640 { 641 struct i2c_client *client = v4l2_get_subdevdata(sd); 642 643 - if (!v4l2_chip_match_i2c_client(client, 644 - reg->match_type, reg->match_chip)) 645 return -EINVAL; 646 if (!capable(CAP_SYS_ADMIN)) 647 return -EPERM; ··· 649 } 650 #endif 651 652 - static int saa7127_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 653 { 654 struct saa7127_state *state = to_state(sd); 655 struct i2c_client *client = v4l2_get_subdevdata(sd);
··· 623 } 624 625 #ifdef CONFIG_VIDEO_ADV_DEBUG 626 + static int saa7127_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 627 { 628 struct i2c_client *client = v4l2_get_subdevdata(sd); 629 630 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 631 return -EINVAL; 632 if (!capable(CAP_SYS_ADMIN)) 633 return -EPERM; 634 reg->val = saa7127_read(sd, reg->reg & 0xff); 635 + reg->size = 1; 636 return 0; 637 } 638 639 + static int saa7127_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 640 { 641 struct i2c_client *client = v4l2_get_subdevdata(sd); 642 643 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 644 return -EINVAL; 645 if (!capable(CAP_SYS_ADMIN)) 646 return -EPERM; ··· 650 } 651 #endif 652 653 + static int saa7127_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 654 { 655 struct saa7127_state *state = to_state(sd); 656 struct i2c_client *client = v4l2_get_subdevdata(sd);
+1 -1
drivers/media/video/saa7134/saa6752hs.c
··· 838 h->standard = *((v4l2_std_id *) arg); 839 break; 840 841 - case VIDIOC_G_CHIP_IDENT: 842 return v4l2_chip_ident_i2c_client(client, 843 arg, h->chip, h->revision); 844
··· 838 h->standard = *((v4l2_std_id *) arg); 839 break; 840 841 + case VIDIOC_DBG_G_CHIP_IDENT: 842 return v4l2_chip_ident_i2c_client(client, 843 arg, h->chip, h->revision); 844
+42 -2
drivers/media/video/saa7134/saa7134-cards.c
··· 4462 .tuner_addr = ADDR_UNSET, 4463 .radio_addr = ADDR_UNSET, 4464 .tda9887_conf = TDA9887_PRESENT, 4465 .inputs = {{ 4466 .name = name_tv, 4467 .vmux = 3, ··· 4481 .name = name_radio, 4482 .amux = LINE2, 4483 }, 4484 - /* no DVB support for now */ 4485 - /* .mpeg = SAA7134_MPEG_DVB, */ 4486 }, 4487 [SAA7134_BOARD_ASUSTeK_TIGER_3IN1] = { 4488 .name = "Asus Tiger 3in1", ··· 4640 .name = name_mute, 4641 .vmux = 8, 4642 .amux = 2, 4643 }, 4644 }, 4645 }; ··· 5733 .subdevice = 0x7128, 5734 .driver_data = SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG, 5735 }, { 5736 /* --- boards without eeprom + subsystem ID --- */ 5737 .vendor = PCI_VENDOR_ID_PHILIPS, 5738 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, ··· 5968 case SAA7134_BOARD_GENIUS_TVGO_A11MCE: 5969 case SAA7134_BOARD_REAL_ANGEL_220: 5970 case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: 5971 dev->has_remote = SAA7134_REMOTE_GPIO; 5972 break; 5973 case SAA7134_BOARD_FLYDVBS_LR300: ··· 6064 case SAA7134_BOARD_BEHOLD_M6: 6065 case SAA7134_BOARD_BEHOLD_M63: 6066 case SAA7134_BOARD_BEHOLD_M6_EXTRA: 6067 dev->has_remote = SAA7134_REMOTE_I2C; 6068 break; 6069 case SAA7134_BOARD_AVERMEDIA_A169_B:
··· 4462 .tuner_addr = ADDR_UNSET, 4463 .radio_addr = ADDR_UNSET, 4464 .tda9887_conf = TDA9887_PRESENT, 4465 + .mpeg = SAA7134_MPEG_DVB, 4466 .inputs = {{ 4467 .name = name_tv, 4468 .vmux = 3, ··· 4480 .name = name_radio, 4481 .amux = LINE2, 4482 }, 4483 }, 4484 [SAA7134_BOARD_ASUSTeK_TIGER_3IN1] = { 4485 .name = "Asus Tiger 3in1", ··· 4641 .name = name_mute, 4642 .vmux = 8, 4643 .amux = 2, 4644 + }, 4645 + }, 4646 + [SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS] = { 4647 + .name = "Avermedia AVerTV GO 007 FM Plus", 4648 + .audio_clock = 0x00187de7, 4649 + .tuner_type = TUNER_PHILIPS_TDA8290, 4650 + .radio_type = UNSET, 4651 + .tuner_addr = ADDR_UNSET, 4652 + .radio_addr = ADDR_UNSET, 4653 + .gpiomask = 0x00300003, 4654 + /* .gpiomask = 0x8c240003, */ 4655 + .inputs = { { 4656 + .name = name_tv, 4657 + .vmux = 1, 4658 + .amux = TV, 4659 + .tv = 1, 4660 + .gpio = 0x01, 4661 + }, { 4662 + .name = name_svideo, 4663 + .vmux = 6, 4664 + .amux = LINE1, 4665 + .gpio = 0x02, 4666 + } }, 4667 + .radio = { 4668 + .name = name_radio, 4669 + .amux = TV, 4670 + .gpio = 0x00300001, 4671 + }, 4672 + .mute = { 4673 + .name = name_mute, 4674 + .amux = TV, 4675 + .gpio = 0x01, 4676 }, 4677 }, 4678 }; ··· 5702 .subdevice = 0x7128, 5703 .driver_data = SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG, 5704 }, { 5705 + .vendor = PCI_VENDOR_ID_PHILIPS, 5706 + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, 5707 + .subvendor = 0x1461, /* Avermedia Technologies Inc */ 5708 + .subdevice = 0xf31d, 5709 + .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS, 5710 + 5711 + }, { 5712 /* --- boards without eeprom + subsystem ID --- */ 5713 .vendor = PCI_VENDOR_ID_PHILIPS, 5714 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, ··· 5930 case SAA7134_BOARD_GENIUS_TVGO_A11MCE: 5931 case SAA7134_BOARD_REAL_ANGEL_220: 5932 case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG: 5933 + case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: 5934 dev->has_remote = SAA7134_REMOTE_GPIO; 5935 break; 5936 case SAA7134_BOARD_FLYDVBS_LR300: ··· 6025 case SAA7134_BOARD_BEHOLD_M6: 6026 case SAA7134_BOARD_BEHOLD_M63: 6027 case SAA7134_BOARD_BEHOLD_M6_EXTRA: 6028 + case SAA7134_BOARD_BEHOLD_H6: 6029 dev->has_remote = SAA7134_REMOTE_I2C; 6030 break; 6031 case SAA7134_BOARD_AVERMEDIA_A169_B:
+18
drivers/media/video/saa7134/saa7134-dvb.c
··· 49 #include "lnbp21.h" 50 #include "tuner-simple.h" 51 52 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 53 MODULE_LICENSE("GPL"); 54 ··· 856 .request_firmware = philips_tda1004x_request_firmware 857 }; 858 859 /* ================================================================== 860 * tda10086 based DVB-S cards, helper functions 861 */ ··· 1364 if (configure_tda827x_fe(dev, &philips_tiger_config, 1365 &tda827x_cfg_0) < 0) 1366 goto dettach_frontend; 1367 break; 1368 default: 1369 wprintk("Huh? unknown DVB card?\n");
··· 49 #include "lnbp21.h" 50 #include "tuner-simple.h" 51 52 + #include "zl10353.h" 53 + 54 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 55 MODULE_LICENSE("GPL"); 56 ··· 854 .request_firmware = philips_tda1004x_request_firmware 855 }; 856 857 + static struct zl10353_config behold_h6_config = { 858 + .demod_address = 0x1e>>1, 859 + .no_tuner = 1, 860 + .parallel_ts = 1, 861 + }; 862 + 863 /* ================================================================== 864 * tda10086 based DVB-S cards, helper functions 865 */ ··· 1356 if (configure_tda827x_fe(dev, &philips_tiger_config, 1357 &tda827x_cfg_0) < 0) 1358 goto dettach_frontend; 1359 + break; 1360 + case SAA7134_BOARD_BEHOLD_H6: 1361 + fe0->dvb.frontend = dvb_attach(zl10353_attach, 1362 + &behold_h6_config, 1363 + &dev->i2c_adap); 1364 + if (fe0->dvb.frontend) { 1365 + dvb_attach(simple_tuner_attach, fe0->dvb.frontend, 1366 + &dev->i2c_adap, 0x61, 1367 + TUNER_PHILIPS_FMD1216ME_MK3); 1368 + } 1369 break; 1370 default: 1371 wprintk("Huh? unknown DVB card?\n");
+11 -12
drivers/media/video/saa7134/saa7134-empress.c
··· 83 84 /* ------------------------------------------------------------------ */ 85 86 - static int ts_open(struct inode *inode, struct file *file) 87 { 88 - int minor = iminor(inode); 89 struct saa7134_dev *dev; 90 int err; 91 ··· 119 return err; 120 } 121 122 - static int ts_release(struct inode *inode, struct file *file) 123 { 124 struct saa7134_dev *dev = file->private_data; 125 ··· 405 } 406 407 static int empress_g_chip_ident(struct file *file, void *fh, 408 - struct v4l2_chip_ident *chip) 409 { 410 struct saa7134_dev *dev = file->private_data; 411 ··· 413 chip->revision = 0; 414 if (dev->mpeg_i2c_client == NULL) 415 return -EINVAL; 416 - if (chip->match_type == V4L2_CHIP_MATCH_I2C_DRIVER && 417 - chip->match_chip == I2C_DRIVERID_SAA6752HS) 418 - return saa7134_i2c_call_saa6752(dev, VIDIOC_G_CHIP_IDENT, chip); 419 - if (chip->match_type == V4L2_CHIP_MATCH_I2C_ADDR && 420 - chip->match_chip == dev->mpeg_i2c_client->addr) 421 - return saa7134_i2c_call_saa6752(dev, VIDIOC_G_CHIP_IDENT, chip); 422 return -EINVAL; 423 } 424 ··· 437 return 0; 438 } 439 440 - static const struct file_operations ts_fops = 441 { 442 .owner = THIS_MODULE, 443 .open = ts_open, ··· 446 .poll = ts_poll, 447 .mmap = ts_mmap, 448 .ioctl = video_ioctl2, 449 - .llseek = no_llseek, 450 }; 451 452 static const struct v4l2_ioctl_ops ts_ioctl_ops = {
··· 83 84 /* ------------------------------------------------------------------ */ 85 86 + static int ts_open(struct file *file) 87 { 88 + int minor = video_devdata(file)->minor; 89 struct saa7134_dev *dev; 90 int err; 91 ··· 119 return err; 120 } 121 122 + static int ts_release(struct file *file) 123 { 124 struct saa7134_dev *dev = file->private_data; 125 ··· 405 } 406 407 static int empress_g_chip_ident(struct file *file, void *fh, 408 + struct v4l2_dbg_chip_ident *chip) 409 { 410 struct saa7134_dev *dev = file->private_data; 411 ··· 413 chip->revision = 0; 414 if (dev->mpeg_i2c_client == NULL) 415 return -EINVAL; 416 + if (chip->match.type == V4L2_CHIP_MATCH_I2C_DRIVER && 417 + !strcmp(chip->match.name, "saa6752hs")) 418 + return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip); 419 + if (chip->match.type == V4L2_CHIP_MATCH_I2C_ADDR && 420 + chip->match.addr == dev->mpeg_i2c_client->addr) 421 + return saa7134_i2c_call_saa6752(dev, VIDIOC_DBG_G_CHIP_IDENT, chip); 422 return -EINVAL; 423 } 424 ··· 437 return 0; 438 } 439 440 + static const struct v4l2_file_operations ts_fops = 441 { 442 .owner = THIS_MODULE, 443 .open = ts_open, ··· 446 .poll = ts_poll, 447 .mmap = ts_mmap, 448 .ioctl = video_ioctl2, 449 }; 450 451 static const struct v4l2_ioctl_ops ts_ioctl_ops = {
+1
drivers/media/video/saa7134/saa7134-input.c
··· 449 case SAA7134_BOARD_AVERMEDIA_STUDIO_507: 450 case SAA7134_BOARD_AVERMEDIA_GO_007_FM: 451 case SAA7134_BOARD_AVERMEDIA_M102: 452 ir_codes = ir_codes_avermedia; 453 mask_keycode = 0x0007C8; 454 mask_keydown = 0x000010;
··· 449 case SAA7134_BOARD_AVERMEDIA_STUDIO_507: 450 case SAA7134_BOARD_AVERMEDIA_GO_007_FM: 451 case SAA7134_BOARD_AVERMEDIA_M102: 452 + case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS: 453 ir_codes = ir_codes_avermedia; 454 mask_keycode = 0x0007C8; 455 mask_keydown = 0x000010;
+10 -13
drivers/media/video/saa7134/saa7134-video.c
··· 1326 return 0; 1327 } 1328 1329 - static int video_open(struct inode *inode, struct file *file) 1330 { 1331 - int minor = iminor(inode); 1332 struct saa7134_dev *dev; 1333 struct saa7134_fh *fh; 1334 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ··· 1462 return POLLERR; 1463 } 1464 1465 - static int video_release(struct inode *inode, struct file *file) 1466 { 1467 struct saa7134_fh *fh = file->private_data; 1468 struct saa7134_dev *dev = fh->dev; ··· 2247 2248 #ifdef CONFIG_VIDEO_ADV_DEBUG 2249 static int vidioc_g_register (struct file *file, void *priv, 2250 - struct v4l2_register *reg) 2251 { 2252 struct saa7134_fh *fh = priv; 2253 struct saa7134_dev *dev = fh->dev; 2254 2255 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2256 return -EINVAL; 2257 reg->val = saa_readb(reg->reg); 2258 return 0; 2259 } 2260 2261 static int vidioc_s_register (struct file *file, void *priv, 2262 - struct v4l2_register *reg) 2263 { 2264 struct saa7134_fh *fh = priv; 2265 struct saa7134_dev *dev = fh->dev; 2266 2267 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 2268 return -EINVAL; 2269 saa_writeb(reg->reg&0xffffff, reg->val); 2270 return 0; ··· 2378 return 0; 2379 } 2380 2381 - static const struct file_operations video_fops = 2382 { 2383 .owner = THIS_MODULE, 2384 .open = video_open, ··· 2387 .poll = video_poll, 2388 .mmap = video_mmap, 2389 .ioctl = video_ioctl2, 2390 - .compat_ioctl = v4l_compat_ioctl32, 2391 - .llseek = no_llseek, 2392 }; 2393 2394 static const struct v4l2_ioctl_ops video_ioctl_ops = { ··· 2440 #endif 2441 }; 2442 2443 - static const struct file_operations radio_fops = { 2444 .owner = THIS_MODULE, 2445 .open = video_open, 2446 .release = video_release, 2447 .ioctl = video_ioctl2, 2448 - .compat_ioctl = v4l_compat_ioctl32, 2449 - .llseek = no_llseek, 2450 }; 2451 2452 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
··· 1326 return 0; 1327 } 1328 1329 + static int video_open(struct file *file) 1330 { 1331 + int minor = video_devdata(file)->minor; 1332 struct saa7134_dev *dev; 1333 struct saa7134_fh *fh; 1334 enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ··· 1462 return POLLERR; 1463 } 1464 1465 + static int video_release(struct file *file) 1466 { 1467 struct saa7134_fh *fh = file->private_data; 1468 struct saa7134_dev *dev = fh->dev; ··· 2247 2248 #ifdef CONFIG_VIDEO_ADV_DEBUG 2249 static int vidioc_g_register (struct file *file, void *priv, 2250 + struct v4l2_dbg_register *reg) 2251 { 2252 struct saa7134_fh *fh = priv; 2253 struct saa7134_dev *dev = fh->dev; 2254 2255 + if (!v4l2_chip_match_host(&reg->match)) 2256 return -EINVAL; 2257 reg->val = saa_readb(reg->reg); 2258 + reg->size = 1; 2259 return 0; 2260 } 2261 2262 static int vidioc_s_register (struct file *file, void *priv, 2263 + struct v4l2_dbg_register *reg) 2264 { 2265 struct saa7134_fh *fh = priv; 2266 struct saa7134_dev *dev = fh->dev; 2267 2268 + if (!v4l2_chip_match_host(&reg->match)) 2269 return -EINVAL; 2270 saa_writeb(reg->reg&0xffffff, reg->val); 2271 return 0; ··· 2377 return 0; 2378 } 2379 2380 + static const struct v4l2_file_operations video_fops = 2381 { 2382 .owner = THIS_MODULE, 2383 .open = video_open, ··· 2386 .poll = video_poll, 2387 .mmap = video_mmap, 2388 .ioctl = video_ioctl2, 2389 }; 2390 2391 static const struct v4l2_ioctl_ops video_ioctl_ops = { ··· 2441 #endif 2442 }; 2443 2444 + static const struct v4l2_file_operations radio_fops = { 2445 .owner = THIS_MODULE, 2446 .open = video_open, 2447 .release = video_release, 2448 .ioctl = video_ioctl2, 2449 }; 2450 2451 static const struct v4l2_ioctl_ops radio_ioctl_ops = {
+1
drivers/media/video/saa7134/saa7134.h
··· 276 #define SAA7134_BOARD_ADS_INSTANT_HDTV_PCI 151 277 #define SAA7134_BOARD_ASUSTeK_TIGER 152 278 #define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153 279 280 #define SAA7134_MAXBOARDS 32 281 #define SAA7134_INPUT_MAX 8
··· 276 #define SAA7134_BOARD_ADS_INSTANT_HDTV_PCI 151 277 #define SAA7134_BOARD_ASUSTeK_TIGER 152 278 #define SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG 153 279 + #define SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS 154 280 281 #define SAA7134_MAXBOARDS 32 282 #define SAA7134_INPUT_MAX 8
+5 -4
drivers/media/video/saa717x.c
··· 1171 } 1172 1173 #ifdef CONFIG_VIDEO_ADV_DEBUG 1174 - static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1175 { 1176 struct i2c_client *client = v4l2_get_subdevdata(sd); 1177 1178 - if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) 1179 return -EINVAL; 1180 if (!capable(CAP_SYS_ADMIN)) 1181 return -EPERM; 1182 reg->val = saa717x_read(sd, reg->reg); 1183 return 0; 1184 } 1185 1186 - static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 1187 { 1188 struct i2c_client *client = v4l2_get_subdevdata(sd); 1189 u16 addr = reg->reg & 0xffff; 1190 u8 val = reg->val & 0xff; 1191 1192 - if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) 1193 return -EINVAL; 1194 if (!capable(CAP_SYS_ADMIN)) 1195 return -EPERM;
··· 1171 } 1172 1173 #ifdef CONFIG_VIDEO_ADV_DEBUG 1174 + static int saa717x_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 1175 { 1176 struct i2c_client *client = v4l2_get_subdevdata(sd); 1177 1178 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 1179 return -EINVAL; 1180 if (!capable(CAP_SYS_ADMIN)) 1181 return -EPERM; 1182 reg->val = saa717x_read(sd, reg->reg); 1183 + reg->size = 1; 1184 return 0; 1185 } 1186 1187 + static int saa717x_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 1188 { 1189 struct i2c_client *client = v4l2_get_subdevdata(sd); 1190 u16 addr = reg->reg & 0xffff; 1191 u8 val = reg->val & 0xff; 1192 1193 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 1194 return -EINVAL; 1195 if (!capable(CAP_SYS_ADMIN)) 1196 return -EPERM;
+5 -9
drivers/media/video/se401.c
··· 932 ***************************************************************************/ 933 934 935 - static int se401_open(struct inode *inode, struct file *file) 936 { 937 struct video_device *dev = video_devdata(file); 938 struct usb_se401 *se401 = (struct usb_se401 *)dev; ··· 954 return err; 955 } 956 957 - static int se401_close(struct inode *inode, struct file *file) 958 { 959 struct video_device *dev = file->private_data; 960 struct usb_se401 *se401 = (struct usb_se401 *)dev; ··· 975 return 0; 976 } 977 978 - static int se401_do_ioctl(struct file *file, unsigned int cmd, void *arg) 979 { 980 struct video_device *vdev = file->private_data; 981 struct usb_se401 *se401 = (struct usb_se401 *)vdev; ··· 1138 return 0; 1139 } 1140 1141 - static int se401_ioctl(struct inode *inode, struct file *file, 1142 unsigned int cmd, unsigned long arg) 1143 { 1144 return video_usercopy(file, cmd, arg, se401_do_ioctl); ··· 1222 return 0; 1223 } 1224 1225 - static const struct file_operations se401_fops = { 1226 .owner = THIS_MODULE, 1227 .open = se401_open, 1228 .release = se401_close, 1229 .read = se401_read, 1230 .mmap = se401_mmap, 1231 .ioctl = se401_ioctl, 1232 - #ifdef CONFIG_COMPAT 1233 - .compat_ioctl = v4l_compat_ioctl32, 1234 - #endif 1235 - .llseek = no_llseek, 1236 }; 1237 static struct video_device se401_template = { 1238 .name = "se401 USB camera",
··· 932 ***************************************************************************/ 933 934 935 + static int se401_open(struct file *file) 936 { 937 struct video_device *dev = video_devdata(file); 938 struct usb_se401 *se401 = (struct usb_se401 *)dev; ··· 954 return err; 955 } 956 957 + static int se401_close(struct file *file) 958 { 959 struct video_device *dev = file->private_data; 960 struct usb_se401 *se401 = (struct usb_se401 *)dev; ··· 975 return 0; 976 } 977 978 + static long se401_do_ioctl(struct file *file, unsigned int cmd, void *arg) 979 { 980 struct video_device *vdev = file->private_data; 981 struct usb_se401 *se401 = (struct usb_se401 *)vdev; ··· 1138 return 0; 1139 } 1140 1141 + static long se401_ioctl(struct file *file, 1142 unsigned int cmd, unsigned long arg) 1143 { 1144 return video_usercopy(file, cmd, arg, se401_do_ioctl); ··· 1222 return 0; 1223 } 1224 1225 + static const struct v4l2_file_operations se401_fops = { 1226 .owner = THIS_MODULE, 1227 .open = se401_open, 1228 .release = se401_close, 1229 .read = se401_read, 1230 .mmap = se401_mmap, 1231 .ioctl = se401_ioctl, 1232 }; 1233 static struct video_device se401_template = { 1234 .name = "se401 USB camera",
+7 -11
drivers/media/video/sn9c102/sn9c102_core.c
··· 1746 } 1747 1748 1749 - static int sn9c102_open(struct inode* inode, struct file* filp) 1750 { 1751 struct sn9c102_device* cam; 1752 int err = 0; ··· 1857 } 1858 1859 1860 - static int sn9c102_release(struct inode* inode, struct file* filp) 1861 { 1862 struct sn9c102_device* cam; 1863 ··· 3092 } 3093 3094 3095 - static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, 3096 - unsigned int cmd, void __user * arg) 3097 { 3098 struct sn9c102_device *cam = video_drvdata(filp); 3099 ··· 3196 } 3197 3198 3199 - static int sn9c102_ioctl(struct inode* inode, struct file* filp, 3200 unsigned int cmd, unsigned long arg) 3201 { 3202 struct sn9c102_device *cam = video_drvdata(filp); ··· 3220 3221 V4LDBG(3, "sn9c102", cmd); 3222 3223 - err = sn9c102_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); 3224 3225 mutex_unlock(&cam->fileop_mutex); 3226 ··· 3229 3230 /*****************************************************************************/ 3231 3232 - static const struct file_operations sn9c102_fops = { 3233 .owner = THIS_MODULE, 3234 .open = sn9c102_open, 3235 .release = sn9c102_release, 3236 .ioctl = sn9c102_ioctl, 3237 - #ifdef CONFIG_COMPAT 3238 - .compat_ioctl = v4l_compat_ioctl32, 3239 - #endif 3240 .read = sn9c102_read, 3241 .poll = sn9c102_poll, 3242 .mmap = sn9c102_mmap, 3243 - .llseek = no_llseek, 3244 }; 3245 3246 /*****************************************************************************/
··· 1746 } 1747 1748 1749 + static int sn9c102_open(struct file *filp) 1750 { 1751 struct sn9c102_device* cam; 1752 int err = 0; ··· 1857 } 1858 1859 1860 + static int sn9c102_release(struct file *filp) 1861 { 1862 struct sn9c102_device* cam; 1863 ··· 3092 } 3093 3094 3095 + static long sn9c102_ioctl_v4l2(struct file *filp, 3096 + unsigned int cmd, void __user *arg) 3097 { 3098 struct sn9c102_device *cam = video_drvdata(filp); 3099 ··· 3196 } 3197 3198 3199 + static long sn9c102_ioctl(struct file *filp, 3200 unsigned int cmd, unsigned long arg) 3201 { 3202 struct sn9c102_device *cam = video_drvdata(filp); ··· 3220 3221 V4LDBG(3, "sn9c102", cmd); 3222 3223 + err = sn9c102_ioctl_v4l2(filp, cmd, (void __user *)arg); 3224 3225 mutex_unlock(&cam->fileop_mutex); 3226 ··· 3229 3230 /*****************************************************************************/ 3231 3232 + static const struct v4l2_file_operations sn9c102_fops = { 3233 .owner = THIS_MODULE, 3234 .open = sn9c102_open, 3235 .release = sn9c102_release, 3236 .ioctl = sn9c102_ioctl, 3237 .read = sn9c102_read, 3238 .poll = sn9c102_poll, 3239 .mmap = sn9c102_mmap, 3240 }; 3241 3242 /*****************************************************************************/
+6 -7
drivers/media/video/soc_camera.c
··· 256 vfree(icd->user_formats); 257 } 258 259 - static int soc_camera_open(struct inode *inode, struct file *file) 260 { 261 struct video_device *vdev; 262 struct soc_camera_device *icd; ··· 330 return ret; 331 } 332 333 - static int soc_camera_close(struct inode *inode, struct file *file) 334 { 335 struct soc_camera_file *icf = file->private_data; 336 struct soc_camera_device *icd = icf->icd; ··· 400 return ici->ops->poll(file, pt); 401 } 402 403 - static struct file_operations soc_camera_fops = { 404 .owner = THIS_MODULE, 405 .open = soc_camera_open, 406 .release = soc_camera_close, ··· 408 .read = soc_camera_read, 409 .mmap = soc_camera_mmap, 410 .poll = soc_camera_poll, 411 - .llseek = no_llseek, 412 }; 413 414 static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv, ··· 699 } 700 701 static int soc_camera_g_chip_ident(struct file *file, void *fh, 702 - struct v4l2_chip_ident *id) 703 { 704 struct soc_camera_file *icf = file->private_data; 705 struct soc_camera_device *icd = icf->icd; ··· 712 713 #ifdef CONFIG_VIDEO_ADV_DEBUG 714 static int soc_camera_g_register(struct file *file, void *fh, 715 - struct v4l2_register *reg) 716 { 717 struct soc_camera_file *icf = file->private_data; 718 struct soc_camera_device *icd = icf->icd; ··· 724 } 725 726 static int soc_camera_s_register(struct file *file, void *fh, 727 - struct v4l2_register *reg) 728 { 729 struct soc_camera_file *icf = file->private_data; 730 struct soc_camera_device *icd = icf->icd;
··· 256 vfree(icd->user_formats); 257 } 258 259 + static int soc_camera_open(struct file *file) 260 { 261 struct video_device *vdev; 262 struct soc_camera_device *icd; ··· 330 return ret; 331 } 332 333 + static int soc_camera_close(struct file *file) 334 { 335 struct soc_camera_file *icf = file->private_data; 336 struct soc_camera_device *icd = icf->icd; ··· 400 return ici->ops->poll(file, pt); 401 } 402 403 + static struct v4l2_file_operations soc_camera_fops = { 404 .owner = THIS_MODULE, 405 .open = soc_camera_open, 406 .release = soc_camera_close, ··· 408 .read = soc_camera_read, 409 .mmap = soc_camera_mmap, 410 .poll = soc_camera_poll, 411 }; 412 413 static int soc_camera_s_fmt_vid_cap(struct file *file, void *priv, ··· 700 } 701 702 static int soc_camera_g_chip_ident(struct file *file, void *fh, 703 + struct v4l2_dbg_chip_ident *id) 704 { 705 struct soc_camera_file *icf = file->private_data; 706 struct soc_camera_device *icd = icf->icd; ··· 713 714 #ifdef CONFIG_VIDEO_ADV_DEBUG 715 static int soc_camera_g_register(struct file *file, void *fh, 716 + struct v4l2_dbg_register *reg) 717 { 718 struct soc_camera_file *icf = file->private_data; 719 struct soc_camera_device *icd = icf->icd; ··· 725 } 726 727 static int soc_camera_s_register(struct file *file, void *fh, 728 + struct v4l2_dbg_register *reg) 729 { 730 struct soc_camera_file *icf = file->private_data; 731 struct soc_camera_device *icd = icf->icd;
+3 -7
drivers/media/video/stk-webcam.c
··· 664 665 /* v4l file operations */ 666 667 - static int v4l_stk_open(struct inode *inode, struct file *fp) 668 { 669 struct stk_camera *dev; 670 struct video_device *vdev; ··· 684 return 0; 685 } 686 687 - static int v4l_stk_release(struct inode *inode, struct file *fp) 688 { 689 struct stk_camera *dev = fp->private_data; 690 ··· 1281 } 1282 } 1283 1284 - static struct file_operations v4l_stk_fops = { 1285 .owner = THIS_MODULE, 1286 .open = v4l_stk_open, 1287 .release = v4l_stk_release, ··· 1289 .poll = v4l_stk_poll, 1290 .mmap = v4l_stk_mmap, 1291 .ioctl = video_ioctl2, 1292 - #ifdef CONFIG_COMPAT 1293 - .compat_ioctl = v4l_compat_ioctl32, 1294 - #endif 1295 - .llseek = no_llseek 1296 }; 1297 1298 static const struct v4l2_ioctl_ops v4l_stk_ioctl_ops = {
··· 664 665 /* v4l file operations */ 666 667 + static int v4l_stk_open(struct file *fp) 668 { 669 struct stk_camera *dev; 670 struct video_device *vdev; ··· 684 return 0; 685 } 686 687 + static int v4l_stk_release(struct file *fp) 688 { 689 struct stk_camera *dev = fp->private_data; 690 ··· 1281 } 1282 } 1283 1284 + static struct v4l2_file_operations v4l_stk_fops = { 1285 .owner = THIS_MODULE, 1286 .open = v4l_stk_open, 1287 .release = v4l_stk_release, ··· 1289 .poll = v4l_stk_poll, 1290 .mmap = v4l_stk_mmap, 1291 .ioctl = video_ioctl2, 1292 }; 1293 1294 static const struct v4l2_ioctl_ops v4l_stk_ioctl_ops = {
+4 -8
drivers/media/video/stradis.c
··· 1275 clip_draw_rectangle(clipmap, 0, 0, 1024, -saa->win.y); 1276 } 1277 1278 - static int saa_ioctl(struct inode *inode, struct file *file, 1279 unsigned int cmd, unsigned long argl) 1280 { 1281 struct saa7146 *saa = file->private_data; ··· 1877 return count; 1878 } 1879 1880 - static int saa_open(struct inode *inode, struct file *file) 1881 { 1882 struct video_device *vdev = video_devdata(file); 1883 struct saa7146 *saa = container_of(vdev, struct saa7146, video_dev); ··· 1895 return 0; 1896 } 1897 1898 - static int saa_release(struct inode *inode, struct file *file) 1899 { 1900 struct saa7146 *saa = file->private_data; 1901 saa->user--; ··· 1906 return 0; 1907 } 1908 1909 - static const struct file_operations saa_fops = { 1910 .owner = THIS_MODULE, 1911 .open = saa_open, 1912 .release = saa_release, 1913 .ioctl = saa_ioctl, 1914 - #ifdef CONFIG_COMPAT 1915 - .compat_ioctl = v4l_compat_ioctl32, 1916 - #endif 1917 .read = saa_read, 1918 - .llseek = no_llseek, 1919 .write = saa_write, 1920 .mmap = saa_mmap, 1921 };
··· 1275 clip_draw_rectangle(clipmap, 0, 0, 1024, -saa->win.y); 1276 } 1277 1278 + static long saa_ioctl(struct file *file, 1279 unsigned int cmd, unsigned long argl) 1280 { 1281 struct saa7146 *saa = file->private_data; ··· 1877 return count; 1878 } 1879 1880 + static int saa_open(struct file *file) 1881 { 1882 struct video_device *vdev = video_devdata(file); 1883 struct saa7146 *saa = container_of(vdev, struct saa7146, video_dev); ··· 1895 return 0; 1896 } 1897 1898 + static int saa_release(struct file *file) 1899 { 1900 struct saa7146 *saa = file->private_data; 1901 saa->user--; ··· 1906 return 0; 1907 } 1908 1909 + static const struct v4l2_file_operations saa_fops = { 1910 .owner = THIS_MODULE, 1911 .open = saa_open, 1912 .release = saa_release, 1913 .ioctl = saa_ioctl, 1914 .read = saa_read, 1915 .write = saa_write, 1916 .mmap = saa_mmap, 1917 };
+5 -9
drivers/media/video/stv680.c
··· 1080 * Video4Linux 1081 *********************************************************************/ 1082 1083 - static int stv_open (struct inode *inode, struct file *file) 1084 { 1085 struct video_device *dev = video_devdata(file); 1086 struct usb_stv *stv680 = video_get_drvdata(dev); ··· 1106 return err; 1107 } 1108 1109 - static int stv_close (struct inode *inode, struct file *file) 1110 { 1111 struct video_device *dev = file->private_data; 1112 struct usb_stv *stv680 = video_get_drvdata(dev); ··· 1132 return 0; 1133 } 1134 1135 - static int stv680_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1136 { 1137 struct video_device *vdev = file->private_data; 1138 struct usb_stv *stv680 = video_get_drvdata(vdev); ··· 1299 return 0; 1300 } 1301 1302 - static int stv680_ioctl(struct inode *inode, struct file *file, 1303 unsigned int cmd, unsigned long arg) 1304 { 1305 return video_usercopy(file, cmd, arg, stv680_do_ioctl); ··· 1391 return realcount; 1392 } /* stv680_read */ 1393 1394 - static const struct file_operations stv680_fops = { 1395 .owner = THIS_MODULE, 1396 .open = stv_open, 1397 .release = stv_close, 1398 .read = stv680_read, 1399 .mmap = stv680_mmap, 1400 .ioctl = stv680_ioctl, 1401 - #ifdef CONFIG_COMPAT 1402 - .compat_ioctl = v4l_compat_ioctl32, 1403 - #endif 1404 - .llseek = no_llseek, 1405 }; 1406 static struct video_device stv680_template = { 1407 .name = "STV0680 USB camera",
··· 1080 * Video4Linux 1081 *********************************************************************/ 1082 1083 + static int stv_open(struct file *file) 1084 { 1085 struct video_device *dev = video_devdata(file); 1086 struct usb_stv *stv680 = video_get_drvdata(dev); ··· 1106 return err; 1107 } 1108 1109 + static int stv_close(struct file *file) 1110 { 1111 struct video_device *dev = file->private_data; 1112 struct usb_stv *stv680 = video_get_drvdata(dev); ··· 1132 return 0; 1133 } 1134 1135 + static long stv680_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1136 { 1137 struct video_device *vdev = file->private_data; 1138 struct usb_stv *stv680 = video_get_drvdata(vdev); ··· 1299 return 0; 1300 } 1301 1302 + static long stv680_ioctl(struct file *file, 1303 unsigned int cmd, unsigned long arg) 1304 { 1305 return video_usercopy(file, cmd, arg, stv680_do_ioctl); ··· 1391 return realcount; 1392 } /* stv680_read */ 1393 1394 + static const struct v4l2_file_operations stv680_fops = { 1395 .owner = THIS_MODULE, 1396 .open = stv_open, 1397 .release = stv_close, 1398 .read = stv680_read, 1399 .mmap = stv680_mmap, 1400 .ioctl = stv680_ioctl, 1401 }; 1402 static struct video_device stv680_template = { 1403 .name = "STV0680 USB camera",
+1 -1
drivers/media/video/tda9840.c
··· 137 return 0; 138 } 139 140 - static int tda9840_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 141 { 142 int byte; 143
··· 137 return 0; 138 } 139 140 + static long tda9840_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 141 { 142 int byte; 143
+1 -1
drivers/media/video/tea6415c.c
··· 122 return ret; 123 } 124 125 - static int tea6415c_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 126 { 127 if (cmd == TEA6415C_SWITCH) { 128 struct i2c_client *client = v4l2_get_subdevdata(sd);
··· 122 return ret; 123 } 124 125 + static long tea6415c_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 126 { 127 if (cmd == TEA6415C_SWITCH) { 128 struct i2c_client *client = v4l2_get_subdevdata(sd);
+1 -1
drivers/media/video/tea6420.c
··· 90 return 0; 91 } 92 93 - static int tea6420_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 94 { 95 if (cmd == TEA6420_SWITCH) { 96 struct i2c_client *client = v4l2_get_subdevdata(sd);
··· 90 return 0; 91 } 92 93 + static long tea6420_ioctl(struct v4l2_subdev *sd, unsigned cmd, void *arg) 94 { 95 if (cmd == TEA6420_SWITCH) { 96 struct i2c_client *client = v4l2_get_subdevdata(sd);
+1 -1
drivers/media/video/tuner-core.c
··· 800 } 801 802 #ifdef CONFIG_VIDEO_ALLOW_V4L1 803 - static int tuner_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) 804 { 805 struct tuner *t = to_tuner(sd); 806 struct i2c_client *client = v4l2_get_subdevdata(sd);
··· 800 } 801 802 #ifdef CONFIG_VIDEO_ALLOW_V4L1 803 + static long tuner_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) 804 { 805 struct tuner *t = to_tuner(sd); 806 struct i2c_client *client = v4l2_get_subdevdata(sd);
+1 -1
drivers/media/video/tvaudio.c
··· 1762 return 0; 1763 } 1764 1765 - static int tvaudio_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 1766 { 1767 struct i2c_client *client = v4l2_get_subdevdata(sd); 1768
··· 1762 return 0; 1763 } 1764 1765 + static int tvaudio_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 1766 { 1767 struct i2c_client *client = v4l2_get_subdevdata(sd); 1768
+6 -7
drivers/media/video/tvp5150.c
··· 963 964 965 static int tvp5150_g_chip_ident(struct v4l2_subdev *sd, 966 - struct v4l2_chip_ident *chip) 967 { 968 int rev; 969 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 977 978 979 #ifdef CONFIG_VIDEO_ADV_DEBUG 980 - static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 981 { 982 struct i2c_client *client = v4l2_get_subdevdata(sd); 983 984 - if (!v4l2_chip_match_i2c_client(client, 985 - reg->match_type, reg->match_chip)) 986 return -EINVAL; 987 if (!capable(CAP_SYS_ADMIN)) 988 return -EPERM; 989 reg->val = tvp5150_read(sd, reg->reg & 0xff); 990 return 0; 991 } 992 993 - static int tvp5150_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 994 { 995 struct i2c_client *client = v4l2_get_subdevdata(sd); 996 997 - if (!v4l2_chip_match_i2c_client(client, 998 - reg->match_type, reg->match_chip)) 999 return -EINVAL; 1000 if (!capable(CAP_SYS_ADMIN)) 1001 return -EPERM;
··· 963 964 965 static int tvp5150_g_chip_ident(struct v4l2_subdev *sd, 966 + struct v4l2_dbg_chip_ident *chip) 967 { 968 int rev; 969 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 977 978 979 #ifdef CONFIG_VIDEO_ADV_DEBUG 980 + static int tvp5150_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 981 { 982 struct i2c_client *client = v4l2_get_subdevdata(sd); 983 984 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 985 return -EINVAL; 986 if (!capable(CAP_SYS_ADMIN)) 987 return -EPERM; 988 reg->val = tvp5150_read(sd, reg->reg & 0xff); 989 + reg->size = 1; 990 return 0; 991 } 992 993 + static int tvp5150_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 994 { 995 struct i2c_client *client = v4l2_get_subdevdata(sd); 996 997 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 998 return -EINVAL; 999 if (!capable(CAP_SYS_ADMIN)) 1000 return -EPERM;
+3 -3
drivers/media/video/tw9910.c
··· 575 } 576 577 static int tw9910_get_chip_id(struct soc_camera_device *icd, 578 - struct v4l2_chip_ident *id) 579 { 580 id->ident = V4L2_IDENT_TW9910; 581 id->revision = 0; ··· 606 607 #ifdef CONFIG_VIDEO_ADV_DEBUG 608 static int tw9910_get_register(struct soc_camera_device *icd, 609 - struct v4l2_register *reg) 610 { 611 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); 612 int ret; ··· 627 } 628 629 static int tw9910_set_register(struct soc_camera_device *icd, 630 - struct v4l2_register *reg) 631 { 632 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); 633
··· 575 } 576 577 static int tw9910_get_chip_id(struct soc_camera_device *icd, 578 + struct v4l2_dbg_chip_ident *id) 579 { 580 id->ident = V4L2_IDENT_TW9910; 581 id->revision = 0; ··· 606 607 #ifdef CONFIG_VIDEO_ADV_DEBUG 608 static int tw9910_get_register(struct soc_camera_device *icd, 609 + struct v4l2_dbg_register *reg) 610 { 611 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); 612 int ret; ··· 627 } 628 629 static int tw9910_set_register(struct soc_camera_device *icd, 630 + struct v4l2_dbg_register *reg) 631 { 632 struct tw9910_priv *priv = container_of(icd, struct tw9910_priv, icd); 633
+6 -7
drivers/media/video/upd64031a.c
··· 147 return upd64031a_s_frequency(sd, NULL); 148 } 149 150 - static int upd64031a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 151 { 152 struct i2c_client *client = v4l2_get_subdevdata(sd); 153 ··· 162 } 163 164 #ifdef CONFIG_VIDEO_ADV_DEBUG 165 - static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 166 { 167 struct i2c_client *client = v4l2_get_subdevdata(sd); 168 169 - if (!v4l2_chip_match_i2c_client(client, 170 - reg->match_type, reg->match_chip)) 171 return -EINVAL; 172 if (!capable(CAP_SYS_ADMIN)) 173 return -EPERM; 174 reg->val = upd64031a_read(sd, reg->reg & 0xff); 175 return 0; 176 } 177 178 - static int upd64031a_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 179 { 180 struct i2c_client *client = v4l2_get_subdevdata(sd); 181 182 - if (!v4l2_chip_match_i2c_client(client, 183 - reg->match_type, reg->match_chip)) 184 return -EINVAL; 185 if (!capable(CAP_SYS_ADMIN)) 186 return -EPERM;
··· 147 return upd64031a_s_frequency(sd, NULL); 148 } 149 150 + static int upd64031a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 151 { 152 struct i2c_client *client = v4l2_get_subdevdata(sd); 153 ··· 162 } 163 164 #ifdef CONFIG_VIDEO_ADV_DEBUG 165 + static int upd64031a_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 166 { 167 struct i2c_client *client = v4l2_get_subdevdata(sd); 168 169 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 170 return -EINVAL; 171 if (!capable(CAP_SYS_ADMIN)) 172 return -EPERM; 173 reg->val = upd64031a_read(sd, reg->reg & 0xff); 174 + reg->size = 1; 175 return 0; 176 } 177 178 + static int upd64031a_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 179 { 180 struct i2c_client *client = v4l2_get_subdevdata(sd); 181 182 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 183 return -EINVAL; 184 if (!capable(CAP_SYS_ADMIN)) 185 return -EPERM;
+6 -7
drivers/media/video/upd64083.c
··· 120 } 121 122 #ifdef CONFIG_VIDEO_ADV_DEBUG 123 - static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 124 { 125 struct i2c_client *client = v4l2_get_subdevdata(sd); 126 127 - if (!v4l2_chip_match_i2c_client(client, 128 - reg->match_type, reg->match_chip)) 129 return -EINVAL; 130 if (!capable(CAP_SYS_ADMIN)) 131 return -EPERM; 132 reg->val = upd64083_read(sd, reg->reg & 0xff); 133 return 0; 134 } 135 136 - static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_register *reg) 137 { 138 struct i2c_client *client = v4l2_get_subdevdata(sd); 139 140 - if (!v4l2_chip_match_i2c_client(client, 141 - reg->match_type, reg->match_chip)) 142 return -EINVAL; 143 if (!capable(CAP_SYS_ADMIN)) 144 return -EPERM; ··· 146 } 147 #endif 148 149 - static int upd64083_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 150 { 151 struct i2c_client *client = v4l2_get_subdevdata(sd); 152
··· 120 } 121 122 #ifdef CONFIG_VIDEO_ADV_DEBUG 123 + static int upd64083_g_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 124 { 125 struct i2c_client *client = v4l2_get_subdevdata(sd); 126 127 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 128 return -EINVAL; 129 if (!capable(CAP_SYS_ADMIN)) 130 return -EPERM; 131 reg->val = upd64083_read(sd, reg->reg & 0xff); 132 + reg->size = 1; 133 return 0; 134 } 135 136 + static int upd64083_s_register(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg) 137 { 138 struct i2c_client *client = v4l2_get_subdevdata(sd); 139 140 + if (!v4l2_chip_match_i2c_client(client, &reg->match)) 141 return -EINVAL; 142 if (!capable(CAP_SYS_ADMIN)) 143 return -EPERM; ··· 147 } 148 #endif 149 150 + static int upd64083_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 151 { 152 struct i2c_client *client = v4l2_get_subdevdata(sd); 153
+8 -12
drivers/media/video/usbvideo/usbvideo.c
··· 41 static void usbvideo_Disconnect(struct usb_interface *intf); 42 static void usbvideo_CameraRelease(struct uvd *uvd); 43 44 - static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, 45 unsigned int cmd, unsigned long arg); 46 static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma); 47 - static int usbvideo_v4l_open(struct inode *inode, struct file *file); 48 static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, 49 size_t count, loff_t *ppos); 50 - static int usbvideo_v4l_close(struct inode *inode, struct file *file); 51 52 static int usbvideo_StartDataPump(struct uvd *uvd); 53 static void usbvideo_StopDataPump(struct uvd *uvd); ··· 942 return rv; 943 } 944 945 - static const struct file_operations usbvideo_fops = { 946 .owner = THIS_MODULE, 947 .open = usbvideo_v4l_open, 948 .release =usbvideo_v4l_close, 949 .read = usbvideo_v4l_read, 950 .mmap = usbvideo_v4l_mmap, 951 .ioctl = usbvideo_v4l_ioctl, 952 - #ifdef CONFIG_COMPAT 953 - .compat_ioctl = v4l_compat_ioctl32, 954 - #endif 955 - .llseek = no_llseek, 956 }; 957 static const struct video_device usbvideo_template = { 958 .fops = &usbvideo_fops, ··· 1109 * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers. 1110 * 24-May-2000 Corrected to prevent race condition (MOD_xxx_USE_COUNT). 1111 */ 1112 - static int usbvideo_v4l_open(struct inode *inode, struct file *file) 1113 { 1114 struct video_device *dev = video_devdata(file); 1115 struct uvd *uvd = (struct uvd *) dev; ··· 1229 * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers. 1230 * 24-May-2000 Moved MOD_DEC_USE_COUNT outside of code that can sleep. 1231 */ 1232 - static int usbvideo_v4l_close(struct inode *inode, struct file *file) 1233 { 1234 struct video_device *dev = file->private_data; 1235 struct uvd *uvd = (struct uvd *) dev; ··· 1277 * History: 1278 * 22-Jan-2000 Corrected VIDIOCSPICT to reject unsupported settings. 1279 */ 1280 - static int usbvideo_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1281 { 1282 struct uvd *uvd = file->private_data; 1283 ··· 1497 return 0; 1498 } 1499 1500 - static int usbvideo_v4l_ioctl(struct inode *inode, struct file *file, 1501 unsigned int cmd, unsigned long arg) 1502 { 1503 return video_usercopy(file, cmd, arg, usbvideo_v4l_do_ioctl);
··· 41 static void usbvideo_Disconnect(struct usb_interface *intf); 42 static void usbvideo_CameraRelease(struct uvd *uvd); 43 44 + static long usbvideo_v4l_ioctl(struct file *file, 45 unsigned int cmd, unsigned long arg); 46 static int usbvideo_v4l_mmap(struct file *file, struct vm_area_struct *vma); 47 + static int usbvideo_v4l_open(struct file *file); 48 static ssize_t usbvideo_v4l_read(struct file *file, char __user *buf, 49 size_t count, loff_t *ppos); 50 + static int usbvideo_v4l_close(struct file *file); 51 52 static int usbvideo_StartDataPump(struct uvd *uvd); 53 static void usbvideo_StopDataPump(struct uvd *uvd); ··· 942 return rv; 943 } 944 945 + static const struct v4l2_file_operations usbvideo_fops = { 946 .owner = THIS_MODULE, 947 .open = usbvideo_v4l_open, 948 .release =usbvideo_v4l_close, 949 .read = usbvideo_v4l_read, 950 .mmap = usbvideo_v4l_mmap, 951 .ioctl = usbvideo_v4l_ioctl, 952 }; 953 static const struct video_device usbvideo_template = { 954 .fops = &usbvideo_fops, ··· 1113 * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers. 1114 * 24-May-2000 Corrected to prevent race condition (MOD_xxx_USE_COUNT). 1115 */ 1116 + static int usbvideo_v4l_open(struct file *file) 1117 { 1118 struct video_device *dev = video_devdata(file); 1119 struct uvd *uvd = (struct uvd *) dev; ··· 1233 * 27-Jan-2000 Used USBVIDEO_NUMSBUF as number of URB buffers. 1234 * 24-May-2000 Moved MOD_DEC_USE_COUNT outside of code that can sleep. 1235 */ 1236 + static int usbvideo_v4l_close(struct file *file) 1237 { 1238 struct video_device *dev = file->private_data; 1239 struct uvd *uvd = (struct uvd *) dev; ··· 1281 * History: 1282 * 22-Jan-2000 Corrected VIDIOCSPICT to reject unsupported settings. 1283 */ 1284 + static long usbvideo_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1285 { 1286 struct uvd *uvd = file->private_data; 1287 ··· 1501 return 0; 1502 } 1503 1504 + static long usbvideo_v4l_ioctl(struct file *file, 1505 unsigned int cmd, unsigned long arg) 1506 { 1507 return video_usercopy(file, cmd, arg, usbvideo_v4l_do_ioctl);
+6 -10
drivers/media/video/usbvideo/vicam.c
··· 229 return 0; 230 } 231 232 - static int 233 - vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsigned long arg) 234 { 235 void __user *user_arg = (void __user *)arg; 236 struct vicam_camera *cam = file->private_data; 237 - int retval = 0; 238 239 if (!cam) 240 return -ENODEV; ··· 470 } 471 472 static int 473 - vicam_open(struct inode *inode, struct file *file) 474 { 475 struct vicam_camera *cam = video_drvdata(file); 476 ··· 536 } 537 538 static int 539 - vicam_close(struct inode *inode, struct file *file) 540 { 541 struct vicam_camera *cam = file->private_data; 542 int open_count; ··· 783 return 0; 784 } 785 786 - static const struct file_operations vicam_fops = { 787 .owner = THIS_MODULE, 788 .open = vicam_open, 789 .release = vicam_close, 790 .read = vicam_read, 791 .mmap = vicam_mmap, 792 .ioctl = vicam_ioctl, 793 - #ifdef CONFIG_COMPAT 794 - .compat_ioctl = v4l_compat_ioctl32, 795 - #endif 796 - .llseek = no_llseek, 797 }; 798 799 static struct video_device vicam_template = {
··· 229 return 0; 230 } 231 232 + static long 233 + vicam_ioctl(struct file *file, unsigned int ioctlnr, unsigned long arg) 234 { 235 void __user *user_arg = (void __user *)arg; 236 struct vicam_camera *cam = file->private_data; 237 + long retval = 0; 238 239 if (!cam) 240 return -ENODEV; ··· 470 } 471 472 static int 473 + vicam_open(struct file *file) 474 { 475 struct vicam_camera *cam = video_drvdata(file); 476 ··· 536 } 537 538 static int 539 + vicam_close(struct file *file) 540 { 541 struct vicam_camera *cam = file->private_data; 542 int open_count; ··· 783 return 0; 784 } 785 786 + static const struct v4l2_file_operations vicam_fops = { 787 .owner = THIS_MODULE, 788 .open = vicam_open, 789 .release = vicam_close, 790 .read = vicam_read, 791 .mmap = vicam_mmap, 792 .ioctl = vicam_ioctl, 793 }; 794 795 static struct video_device vicam_template = {
+16 -21
drivers/media/video/usbvision/usbvision-video.c
··· 355 * then allocates buffers needed for video processing. 356 * 357 */ 358 - static int usbvision_v4l2_open(struct inode *inode, struct file *file) 359 { 360 struct usb_usbvision *usbvision = video_drvdata(file); 361 int errCode = 0; ··· 432 * allocated in usbvision_v4l2_open(). 433 * 434 */ 435 - static int usbvision_v4l2_close(struct inode *inode, struct file *file) 436 { 437 struct usb_usbvision *usbvision = video_drvdata(file); 438 ··· 477 */ 478 #ifdef CONFIG_VIDEO_ADV_DEBUG 479 static int vidioc_g_register (struct file *file, void *priv, 480 - struct v4l2_register *reg) 481 { 482 struct usb_usbvision *usbvision = video_drvdata(file); 483 int errCode; 484 485 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 486 return -EINVAL; 487 /* NT100x has a 8-bit register space */ 488 errCode = usbvision_read_reg(usbvision, reg->reg&0xff); ··· 492 return errCode; 493 } 494 reg->val = errCode; 495 return 0; 496 } 497 498 static int vidioc_s_register (struct file *file, void *priv, 499 - struct v4l2_register *reg) 500 { 501 struct usb_usbvision *usbvision = video_drvdata(file); 502 int errCode; 503 504 - if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) 505 return -EINVAL; 506 /* NT100x has a 8-bit register space */ 507 errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); ··· 1179 * Here comes the stuff for radio on usbvision based devices 1180 * 1181 */ 1182 - static int usbvision_radio_open(struct inode *inode, struct file *file) 1183 { 1184 struct usb_usbvision *usbvision = video_drvdata(file); 1185 int errCode = 0; ··· 1229 } 1230 1231 1232 - static int usbvision_radio_close(struct inode *inode, struct file *file) 1233 { 1234 struct usb_usbvision *usbvision = video_drvdata(file); 1235 int errCode = 0; ··· 1267 * Here comes the stuff for vbi on usbvision based devices 1268 * 1269 */ 1270 - static int usbvision_vbi_open(struct inode *inode, struct file *file) 1271 { 1272 /* TODO */ 1273 return -ENODEV; 1274 } 1275 1276 - static int usbvision_vbi_close(struct inode *inode, struct file *file) 1277 { 1278 /* TODO */ 1279 return -ENODEV; 1280 } 1281 1282 - static int usbvision_do_vbi_ioctl(struct file *file, 1283 unsigned int cmd, void *arg) 1284 { 1285 /* TODO */ 1286 return -ENOIOCTLCMD; 1287 } 1288 1289 - static int usbvision_vbi_ioctl(struct inode *inode, struct file *file, 1290 unsigned int cmd, unsigned long arg) 1291 { 1292 return video_usercopy(file, cmd, arg, usbvision_do_vbi_ioctl); ··· 1298 // 1299 1300 // Video template 1301 - static const struct file_operations usbvision_fops = { 1302 .owner = THIS_MODULE, 1303 .open = usbvision_v4l2_open, 1304 .release = usbvision_v4l2_close, 1305 .read = usbvision_v4l2_read, 1306 .mmap = usbvision_v4l2_mmap, 1307 .ioctl = video_ioctl2, 1308 - .llseek = no_llseek, 1309 /* .poll = video_poll, */ 1310 - .compat_ioctl = v4l_compat_ioctl32, 1311 }; 1312 1313 static const struct v4l2_ioctl_ops usbvision_ioctl_ops = { ··· 1354 1355 1356 // Radio template 1357 - static const struct file_operations usbvision_radio_fops = { 1358 .owner = THIS_MODULE, 1359 .open = usbvision_radio_open, 1360 .release = usbvision_radio_close, 1361 .ioctl = video_ioctl2, 1362 - .llseek = no_llseek, 1363 - .compat_ioctl = v4l_compat_ioctl32, 1364 }; 1365 1366 static const struct v4l2_ioctl_ops usbvision_radio_ioctl_ops = { ··· 1389 }; 1390 1391 // vbi template 1392 - static const struct file_operations usbvision_vbi_fops = { 1393 .owner = THIS_MODULE, 1394 .open = usbvision_vbi_open, 1395 .release = usbvision_vbi_close, 1396 .ioctl = usbvision_vbi_ioctl, 1397 - .llseek = no_llseek, 1398 - .compat_ioctl = v4l_compat_ioctl32, 1399 }; 1400 1401 static struct video_device usbvision_vbi_template=
··· 355 * then allocates buffers needed for video processing. 356 * 357 */ 358 + static int usbvision_v4l2_open(struct file *file) 359 { 360 struct usb_usbvision *usbvision = video_drvdata(file); 361 int errCode = 0; ··· 432 * allocated in usbvision_v4l2_open(). 433 * 434 */ 435 + static int usbvision_v4l2_close(struct file *file) 436 { 437 struct usb_usbvision *usbvision = video_drvdata(file); 438 ··· 477 */ 478 #ifdef CONFIG_VIDEO_ADV_DEBUG 479 static int vidioc_g_register (struct file *file, void *priv, 480 + struct v4l2_dbg_register *reg) 481 { 482 struct usb_usbvision *usbvision = video_drvdata(file); 483 int errCode; 484 485 + if (!v4l2_chip_match_host(&reg->match)) 486 return -EINVAL; 487 /* NT100x has a 8-bit register space */ 488 errCode = usbvision_read_reg(usbvision, reg->reg&0xff); ··· 492 return errCode; 493 } 494 reg->val = errCode; 495 + reg->size = 1; 496 return 0; 497 } 498 499 static int vidioc_s_register (struct file *file, void *priv, 500 + struct v4l2_dbg_register *reg) 501 { 502 struct usb_usbvision *usbvision = video_drvdata(file); 503 int errCode; 504 505 + if (!v4l2_chip_match_host(&reg->match)) 506 return -EINVAL; 507 /* NT100x has a 8-bit register space */ 508 errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val); ··· 1178 * Here comes the stuff for radio on usbvision based devices 1179 * 1180 */ 1181 + static int usbvision_radio_open(struct file *file) 1182 { 1183 struct usb_usbvision *usbvision = video_drvdata(file); 1184 int errCode = 0; ··· 1228 } 1229 1230 1231 + static int usbvision_radio_close(struct file *file) 1232 { 1233 struct usb_usbvision *usbvision = video_drvdata(file); 1234 int errCode = 0; ··· 1266 * Here comes the stuff for vbi on usbvision based devices 1267 * 1268 */ 1269 + static int usbvision_vbi_open(struct file *file) 1270 { 1271 /* TODO */ 1272 return -ENODEV; 1273 } 1274 1275 + static int usbvision_vbi_close(struct file *file) 1276 { 1277 /* TODO */ 1278 return -ENODEV; 1279 } 1280 1281 + static long usbvision_do_vbi_ioctl(struct file *file, 1282 unsigned int cmd, void *arg) 1283 { 1284 /* TODO */ 1285 return -ENOIOCTLCMD; 1286 } 1287 1288 + static long usbvision_vbi_ioctl(struct file *file, 1289 unsigned int cmd, unsigned long arg) 1290 { 1291 return video_usercopy(file, cmd, arg, usbvision_do_vbi_ioctl); ··· 1297 // 1298 1299 // Video template 1300 + static const struct v4l2_file_operations usbvision_fops = { 1301 .owner = THIS_MODULE, 1302 .open = usbvision_v4l2_open, 1303 .release = usbvision_v4l2_close, 1304 .read = usbvision_v4l2_read, 1305 .mmap = usbvision_v4l2_mmap, 1306 .ioctl = video_ioctl2, 1307 /* .poll = video_poll, */ 1308 }; 1309 1310 static const struct v4l2_ioctl_ops usbvision_ioctl_ops = { ··· 1355 1356 1357 // Radio template 1358 + static const struct v4l2_file_operations usbvision_radio_fops = { 1359 .owner = THIS_MODULE, 1360 .open = usbvision_radio_open, 1361 .release = usbvision_radio_close, 1362 .ioctl = video_ioctl2, 1363 }; 1364 1365 static const struct v4l2_ioctl_ops usbvision_radio_ioctl_ops = { ··· 1392 }; 1393 1394 // vbi template 1395 + static const struct v4l2_file_operations usbvision_vbi_fops = { 1396 .owner = THIS_MODULE, 1397 .open = usbvision_vbi_open, 1398 .release = usbvision_vbi_close, 1399 .ioctl = usbvision_vbi_ioctl, 1400 }; 1401 1402 static struct video_device usbvision_vbi_template=
+6 -8
drivers/media/video/uvc/uvc_v4l2.c
··· 406 * V4L2 file operations 407 */ 408 409 - static int uvc_v4l2_open(struct inode *inode, struct file *file) 410 { 411 struct uvc_video_device *video; 412 struct uvc_fh *handle; ··· 444 return ret; 445 } 446 447 - static int uvc_v4l2_release(struct inode *inode, struct file *file) 448 { 449 struct uvc_video_device *video = video_drvdata(file); 450 struct uvc_fh *handle = (struct uvc_fh *)file->private_data; ··· 472 return 0; 473 } 474 475 - static int uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 476 { 477 struct video_device *vdev = video_devdata(file); 478 struct uvc_video_device *video = video_get_drvdata(vdev); 479 struct uvc_fh *handle = (struct uvc_fh *)file->private_data; 480 - int ret = 0; 481 482 switch (cmd) { 483 /* Query capabilities */ ··· 996 return ret; 997 } 998 999 - static int uvc_v4l2_ioctl(struct inode *inode, struct file *file, 1000 unsigned int cmd, unsigned long arg) 1001 { 1002 if (uvc_trace_param & UVC_TRACE_IOCTL) { ··· 1097 return uvc_queue_poll(&video->queue, file, wait); 1098 } 1099 1100 - struct file_operations uvc_fops = { 1101 .owner = THIS_MODULE, 1102 .open = uvc_v4l2_open, 1103 .release = uvc_v4l2_release, 1104 .ioctl = uvc_v4l2_ioctl, 1105 - .compat_ioctl = v4l_compat_ioctl32, 1106 - .llseek = no_llseek, 1107 .read = uvc_v4l2_read, 1108 .mmap = uvc_v4l2_mmap, 1109 .poll = uvc_v4l2_poll,
··· 406 * V4L2 file operations 407 */ 408 409 + static int uvc_v4l2_open(struct file *file) 410 { 411 struct uvc_video_device *video; 412 struct uvc_fh *handle; ··· 444 return ret; 445 } 446 447 + static int uvc_v4l2_release(struct file *file) 448 { 449 struct uvc_video_device *video = video_drvdata(file); 450 struct uvc_fh *handle = (struct uvc_fh *)file->private_data; ··· 472 return 0; 473 } 474 475 + static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 476 { 477 struct video_device *vdev = video_devdata(file); 478 struct uvc_video_device *video = video_get_drvdata(vdev); 479 struct uvc_fh *handle = (struct uvc_fh *)file->private_data; 480 + long ret = 0; 481 482 switch (cmd) { 483 /* Query capabilities */ ··· 996 return ret; 997 } 998 999 + static long uvc_v4l2_ioctl(struct file *file, 1000 unsigned int cmd, unsigned long arg) 1001 { 1002 if (uvc_trace_param & UVC_TRACE_IOCTL) { ··· 1097 return uvc_queue_poll(&video->queue, file, wait); 1098 } 1099 1100 + const struct v4l2_file_operations uvc_fops = { 1101 .owner = THIS_MODULE, 1102 .open = uvc_v4l2_open, 1103 .release = uvc_v4l2_release, 1104 .ioctl = uvc_v4l2_ioctl, 1105 .read = uvc_v4l2_read, 1106 .mmap = uvc_v4l2_mmap, 1107 .poll = uvc_v4l2_poll,
+1 -1
drivers/media/video/uvc/uvcvideo.h
··· 753 } 754 755 /* V4L2 interface */ 756 - extern struct file_operations uvc_fops; 757 758 /* Video */ 759 extern int uvc_video_init(struct uvc_video_device *video);
··· 753 } 754 755 /* V4L2 interface */ 756 + extern const struct v4l2_file_operations uvc_fops; 757 758 /* Video */ 759 extern int uvc_video_init(struct uvc_video_device *video);
+83 -81
drivers/media/video/v4l1-compat.c
··· 267 268 /* ----------------------------------------------------------------- */ 269 270 - static noinline int v4l1_compat_get_capabilities( 271 struct video_capability *cap, 272 struct file *file, 273 v4l2_kioctl drv) 274 { 275 - int err; 276 struct v4l2_framebuffer fbuf; 277 struct v4l2_capability *cap2; 278 ··· 286 287 err = drv(file, VIDIOC_QUERYCAP, cap2); 288 if (err < 0) { 289 - dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %d\n", err); 290 goto done; 291 } 292 if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { 293 err = drv(file, VIDIOC_G_FBUF, &fbuf); 294 if (err < 0) { 295 - dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %d\n", err); 296 memset(&fbuf, 0, sizeof(fbuf)); 297 } 298 err = 0; ··· 324 return err; 325 } 326 327 - static noinline int v4l1_compat_get_frame_buffer( 328 struct video_buffer *buffer, 329 struct file *file, 330 v4l2_kioctl drv) 331 { 332 - int err; 333 struct v4l2_framebuffer fbuf; 334 335 memset(buffer, 0, sizeof(*buffer)); ··· 337 338 err = drv(file, VIDIOC_G_FBUF, &fbuf); 339 if (err < 0) { 340 - dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n", err); 341 goto done; 342 } 343 buffer->base = fbuf.base; ··· 378 return err; 379 } 380 381 - static noinline int v4l1_compat_set_frame_buffer( 382 struct video_buffer *buffer, 383 struct file *file, 384 v4l2_kioctl drv) 385 { 386 - int err; 387 struct v4l2_framebuffer fbuf; 388 389 memset(&fbuf, 0, sizeof(fbuf)); ··· 410 fbuf.fmt.bytesperline = buffer->bytesperline; 411 err = drv(file, VIDIOC_S_FBUF, &fbuf); 412 if (err < 0) 413 - dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %d\n", err); 414 return err; 415 } 416 417 - static noinline int v4l1_compat_get_win_cap_dimensions( 418 struct video_window *win, 419 struct file *file, 420 v4l2_kioctl drv) 421 { 422 - int err; 423 struct v4l2_format *fmt; 424 425 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); ··· 432 fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; 433 err = drv(file, VIDIOC_G_FMT, fmt); 434 if (err < 0) 435 - dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %d\n", err); 436 if (err == 0) { 437 win->x = fmt->fmt.win.w.left; 438 win->y = fmt->fmt.win.w.top; ··· 447 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 448 err = drv(file, VIDIOC_G_FMT, fmt); 449 if (err < 0) { 450 - dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %d\n", err); 451 goto done; 452 } 453 win->x = 0; ··· 462 return err; 463 } 464 465 - static noinline int v4l1_compat_set_win_cap_dimensions( 466 struct video_window *win, 467 struct file *file, 468 v4l2_kioctl drv) 469 { 470 - int err, err1, err2; 471 struct v4l2_format *fmt; 472 473 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); ··· 479 drv(file, VIDIOC_STREAMOFF, &fmt->type); 480 err1 = drv(file, VIDIOC_G_FMT, fmt); 481 if (err1 < 0) 482 - dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %d\n", err1); 483 if (err1 == 0) { 484 fmt->fmt.pix.width = win->width; 485 fmt->fmt.pix.height = win->height; ··· 487 fmt->fmt.pix.bytesperline = 0; 488 err = drv(file, VIDIOC_S_FMT, fmt); 489 if (err < 0) 490 - dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %d\n", 491 err); 492 win->width = fmt->fmt.pix.width; 493 win->height = fmt->fmt.pix.height; ··· 504 fmt->fmt.win.clipcount = win->clipcount; 505 err2 = drv(file, VIDIOC_S_FMT, fmt); 506 if (err2 < 0) 507 - dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %d\n", err2); 508 509 if (err1 != 0 && err2 != 0) 510 err = err1; ··· 514 return err; 515 } 516 517 - static noinline int v4l1_compat_turn_preview_on_off( 518 int *on, 519 struct file *file, 520 v4l2_kioctl drv) 521 { 522 - int err; 523 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 524 525 if (0 == *on) { ··· 530 } 531 err = drv(file, VIDIOC_OVERLAY, on); 532 if (err < 0) 533 - dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %d\n", err); 534 return err; 535 } 536 537 - static noinline int v4l1_compat_get_input_info( 538 struct video_channel *chan, 539 struct file *file, 540 v4l2_kioctl drv) 541 { 542 - int err; 543 struct v4l2_input input2; 544 v4l2_std_id sid; 545 ··· 548 err = drv(file, VIDIOC_ENUMINPUT, &input2); 549 if (err < 0) { 550 dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " 551 - "channel=%d err=%d\n", chan->channel, err); 552 goto done; 553 } 554 chan->channel = input2.index; ··· 569 chan->norm = 0; 570 err = drv(file, VIDIOC_G_STD, &sid); 571 if (err < 0) 572 - dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %d\n", err); 573 if (err == 0) { 574 if (sid & V4L2_STD_PAL) 575 chan->norm = VIDEO_MODE_PAL; ··· 582 return err; 583 } 584 585 - static noinline int v4l1_compat_set_input( 586 struct video_channel *chan, 587 struct file *file, 588 v4l2_kioctl drv) 589 { 590 - int err; 591 v4l2_std_id sid = 0; 592 593 err = drv(file, VIDIOC_S_INPUT, &chan->channel); 594 if (err < 0) 595 - dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %d\n", err); 596 switch (chan->norm) { 597 case VIDEO_MODE_PAL: 598 sid = V4L2_STD_PAL; ··· 607 if (0 != sid) { 608 err = drv(file, VIDIOC_S_STD, &sid); 609 if (err < 0) 610 - dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %d\n", err); 611 } 612 return err; 613 } 614 615 - static noinline int v4l1_compat_get_picture( 616 struct video_picture *pict, 617 struct file *file, 618 v4l2_kioctl drv) 619 { 620 - int err; 621 struct v4l2_format *fmt; 622 623 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); ··· 640 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 641 err = drv(file, VIDIOC_G_FMT, fmt); 642 if (err < 0) { 643 - dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %d\n", err); 644 goto done; 645 } 646 ··· 654 return err; 655 } 656 657 - static noinline int v4l1_compat_set_picture( 658 struct video_picture *pict, 659 struct file *file, 660 v4l2_kioctl drv) 661 { 662 - int err; 663 struct v4l2_framebuffer fbuf; 664 int mem_err = 0, ovl_err = 0; 665 struct v4l2_format *fmt; ··· 694 support memory capture. Trying to set the memory capture 695 parameters would be pointless. */ 696 if (err < 0) { 697 - dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %d\n", err); 698 mem_err = -1000; /* didn't even try */ 699 } else if (fmt->fmt.pix.pixelformat != 700 palette_to_pixelformat(pict->palette)) { ··· 711 support overlay. Trying to set the overlay parameters 712 would be quite pointless. */ 713 if (err < 0) { 714 - dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %d\n", err); 715 ovl_err = -1000; /* didn't even try */ 716 } else if (fbuf.fmt.pixelformat != 717 palette_to_pixelformat(pict->palette)) { ··· 736 return err; 737 } 738 739 - static noinline int v4l1_compat_get_tuner( 740 struct video_tuner *tun, 741 struct file *file, 742 v4l2_kioctl drv) 743 { 744 - int err, i; 745 struct v4l2_tuner tun2; 746 struct v4l2_standard std2; 747 v4l2_std_id sid; ··· 750 memset(&tun2, 0, sizeof(tun2)); 751 err = drv(file, VIDIOC_G_TUNER, &tun2); 752 if (err < 0) { 753 - dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %d\n", err); 754 goto done; 755 } 756 memcpy(tun->name, tun2.name, ··· 776 777 err = drv(file, VIDIOC_G_STD, &sid); 778 if (err < 0) 779 - dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %d\n", err); 780 if (err == 0) { 781 if (sid & V4L2_STD_PAL) 782 tun->mode = VIDEO_MODE_PAL; ··· 795 return err; 796 } 797 798 - static noinline int v4l1_compat_select_tuner( 799 struct video_tuner *tun, 800 struct file *file, 801 v4l2_kioctl drv) 802 { 803 - int err; 804 struct v4l2_tuner t;/*84 bytes on x86_64*/ 805 memset(&t, 0, sizeof(t)); 806 ··· 808 809 err = drv(file, VIDIOC_S_INPUT, &t); 810 if (err < 0) 811 - dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %d\n", err); 812 return err; 813 } 814 815 - static noinline int v4l1_compat_get_frequency( 816 unsigned long *freq, 817 struct file *file, 818 v4l2_kioctl drv) 819 { 820 - int err; 821 struct v4l2_frequency freq2; 822 memset(&freq2, 0, sizeof(freq2)); 823 824 freq2.tuner = 0; 825 err = drv(file, VIDIOC_G_FREQUENCY, &freq2); 826 if (err < 0) 827 - dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %d\n", err); 828 if (0 == err) 829 *freq = freq2.frequency; 830 return err; 831 } 832 833 - static noinline int v4l1_compat_set_frequency( 834 unsigned long *freq, 835 struct file *file, 836 v4l2_kioctl drv) 837 { 838 - int err; 839 struct v4l2_frequency freq2; 840 memset(&freq2, 0, sizeof(freq2)); 841 ··· 843 freq2.frequency = *freq; 844 err = drv(file, VIDIOC_S_FREQUENCY, &freq2); 845 if (err < 0) 846 - dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %d\n", err); 847 return err; 848 } 849 850 - static noinline int v4l1_compat_get_audio( 851 struct video_audio *aud, 852 struct file *file, 853 v4l2_kioctl drv) 854 { 855 - int err, i; 856 struct v4l2_queryctrl qctrl2; 857 struct v4l2_audio aud2; 858 struct v4l2_tuner tun2; ··· 861 862 err = drv(file, VIDIOC_G_AUDIO, &aud2); 863 if (err < 0) { 864 - dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %d\n", err); 865 goto done; 866 } 867 memcpy(aud->name, aud2.name, ··· 905 memset(&tun2, 0, sizeof(tun2)); 906 err = drv(file, VIDIOC_G_TUNER, &tun2); 907 if (err < 0) { 908 - dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n", err); 909 err = 0; 910 goto done; 911 } ··· 920 return err; 921 } 922 923 - static noinline int v4l1_compat_set_audio( 924 struct video_audio *aud, 925 struct file *file, 926 v4l2_kioctl drv) 927 { 928 - int err; 929 struct v4l2_audio aud2; 930 struct v4l2_tuner tun2; 931 ··· 935 aud2.index = aud->audio; 936 err = drv(file, VIDIOC_S_AUDIO, &aud2); 937 if (err < 0) { 938 - dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %d\n", err); 939 goto done; 940 } 941 ··· 952 953 err = drv(file, VIDIOC_G_TUNER, &tun2); 954 if (err < 0) 955 - dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %d\n", err); 956 if (err == 0) { 957 switch (aud->mode) { 958 default: ··· 969 } 970 err = drv(file, VIDIOC_S_TUNER, &tun2); 971 if (err < 0) 972 - dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %d\n", err); 973 } 974 err = 0; 975 done: 976 return err; 977 } 978 979 - static noinline int v4l1_compat_capture_frame( 980 struct video_mmap *mm, 981 struct file *file, 982 v4l2_kioctl drv) 983 { 984 - int err; 985 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 986 struct v4l2_buffer buf; 987 struct v4l2_format *fmt; ··· 996 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 997 err = drv(file, VIDIOC_G_FMT, fmt); 998 if (err < 0) { 999 - dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %d\n", err); 1000 goto done; 1001 } 1002 if (mm->width != fmt->fmt.pix.width || ··· 1012 fmt->fmt.pix.bytesperline = 0; 1013 err = drv(file, VIDIOC_S_FMT, fmt); 1014 if (err < 0) { 1015 - dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %d\n", err); 1016 goto done; 1017 } 1018 } ··· 1020 buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1021 err = drv(file, VIDIOC_QUERYBUF, &buf); 1022 if (err < 0) { 1023 - dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %d\n", err); 1024 goto done; 1025 } 1026 err = drv(file, VIDIOC_QBUF, &buf); 1027 if (err < 0) { 1028 - dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %d\n", err); 1029 goto done; 1030 } 1031 err = drv(file, VIDIOC_STREAMON, &captype); 1032 if (err < 0) 1033 - dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %d\n", err); 1034 done: 1035 kfree(fmt); 1036 return err; 1037 } 1038 1039 - static noinline int v4l1_compat_sync( 1040 int *i, 1041 struct file *file, 1042 v4l2_kioctl drv) 1043 { 1044 - int err; 1045 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1046 struct v4l2_buffer buf; 1047 struct poll_wqueues *pwq; ··· 1052 err = drv(file, VIDIOC_QUERYBUF, &buf); 1053 if (err < 0) { 1054 /* No such buffer */ 1055 - dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); 1056 goto done; 1057 } 1058 if (!(buf.flags & V4L2_BUF_FLAG_MAPPED)) { ··· 1064 /* make sure capture actually runs so we don't block forever */ 1065 err = drv(file, VIDIOC_STREAMON, &captype); 1066 if (err < 0) { 1067 - dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %d\n", err); 1068 goto done; 1069 } 1070 ··· 1078 break; 1079 err = drv(file, VIDIOC_QUERYBUF, &buf); 1080 if (err < 0) 1081 - dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %d\n", err); 1082 } 1083 kfree(pwq); 1084 if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */ ··· 1086 do { 1087 err = drv(file, VIDIOC_DQBUF, &buf); 1088 if (err < 0) 1089 - dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %d\n", err); 1090 } while (err == 0 && buf.index != *i); 1091 done: 1092 return err; 1093 } 1094 1095 - static noinline int v4l1_compat_get_vbi_format( 1096 struct vbi_format *fmt, 1097 struct file *file, 1098 v4l2_kioctl drv) 1099 { 1100 - int err; 1101 struct v4l2_format *fmt2; 1102 1103 fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); ··· 1109 1110 err = drv(file, VIDIOC_G_FMT, fmt2); 1111 if (err < 0) { 1112 - dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %d\n", err); 1113 goto done; 1114 } 1115 if (fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY) { ··· 1130 return err; 1131 } 1132 1133 - static noinline int v4l1_compat_set_vbi_format( 1134 struct vbi_format *fmt, 1135 struct file *file, 1136 v4l2_kioctl drv) 1137 { 1138 - int err; 1139 struct v4l2_format *fmt2 = NULL; 1140 1141 if (VIDEO_PALETTE_RAW != fmt->sample_format) { ··· 1159 fmt2->fmt.vbi.flags = fmt->flags; 1160 err = drv(file, VIDIOC_TRY_FMT, fmt2); 1161 if (err < 0) { 1162 - dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %d\n", err); 1163 goto done; 1164 } 1165 ··· 1176 } 1177 err = drv(file, VIDIOC_S_FMT, fmt2); 1178 if (err < 0) 1179 - dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %d\n", err); 1180 done: 1181 kfree(fmt2); 1182 return err; ··· 1185 /* 1186 * This function is exported. 1187 */ 1188 - int 1189 v4l_compat_translate_ioctl(struct file *file, 1190 int cmd, 1191 void *arg, 1192 v4l2_kioctl drv) 1193 { 1194 - int err; 1195 1196 switch (cmd) { 1197 case VIDIOCGCAP: /* capability */
··· 267 268 /* ----------------------------------------------------------------- */ 269 270 + static noinline long v4l1_compat_get_capabilities( 271 struct video_capability *cap, 272 struct file *file, 273 v4l2_kioctl drv) 274 { 275 + long err; 276 struct v4l2_framebuffer fbuf; 277 struct v4l2_capability *cap2; 278 ··· 286 287 err = drv(file, VIDIOC_QUERYCAP, cap2); 288 if (err < 0) { 289 + dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %ld\n", err); 290 goto done; 291 } 292 if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { 293 err = drv(file, VIDIOC_G_FBUF, &fbuf); 294 if (err < 0) { 295 + dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %ld\n", err); 296 memset(&fbuf, 0, sizeof(fbuf)); 297 } 298 err = 0; ··· 324 return err; 325 } 326 327 + static noinline long v4l1_compat_get_frame_buffer( 328 struct video_buffer *buffer, 329 struct file *file, 330 v4l2_kioctl drv) 331 { 332 + long err; 333 struct v4l2_framebuffer fbuf; 334 335 memset(buffer, 0, sizeof(*buffer)); ··· 337 338 err = drv(file, VIDIOC_G_FBUF, &fbuf); 339 if (err < 0) { 340 + dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %ld\n", err); 341 goto done; 342 } 343 buffer->base = fbuf.base; ··· 378 return err; 379 } 380 381 + static noinline long v4l1_compat_set_frame_buffer( 382 struct video_buffer *buffer, 383 struct file *file, 384 v4l2_kioctl drv) 385 { 386 + long err; 387 struct v4l2_framebuffer fbuf; 388 389 memset(&fbuf, 0, sizeof(fbuf)); ··· 410 fbuf.fmt.bytesperline = buffer->bytesperline; 411 err = drv(file, VIDIOC_S_FBUF, &fbuf); 412 if (err < 0) 413 + dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %ld\n", err); 414 return err; 415 } 416 417 + static noinline long v4l1_compat_get_win_cap_dimensions( 418 struct video_window *win, 419 struct file *file, 420 v4l2_kioctl drv) 421 { 422 + long err; 423 struct v4l2_format *fmt; 424 425 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); ··· 432 fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; 433 err = drv(file, VIDIOC_G_FMT, fmt); 434 if (err < 0) 435 + dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %ld\n", err); 436 if (err == 0) { 437 win->x = fmt->fmt.win.w.left; 438 win->y = fmt->fmt.win.w.top; ··· 447 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 448 err = drv(file, VIDIOC_G_FMT, fmt); 449 if (err < 0) { 450 + dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %ld\n", err); 451 goto done; 452 } 453 win->x = 0; ··· 462 return err; 463 } 464 465 + static noinline long v4l1_compat_set_win_cap_dimensions( 466 struct video_window *win, 467 struct file *file, 468 v4l2_kioctl drv) 469 { 470 + long err, err1, err2; 471 struct v4l2_format *fmt; 472 473 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); ··· 479 drv(file, VIDIOC_STREAMOFF, &fmt->type); 480 err1 = drv(file, VIDIOC_G_FMT, fmt); 481 if (err1 < 0) 482 + dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %ld\n", err1); 483 if (err1 == 0) { 484 fmt->fmt.pix.width = win->width; 485 fmt->fmt.pix.height = win->height; ··· 487 fmt->fmt.pix.bytesperline = 0; 488 err = drv(file, VIDIOC_S_FMT, fmt); 489 if (err < 0) 490 + dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %ld\n", 491 err); 492 win->width = fmt->fmt.pix.width; 493 win->height = fmt->fmt.pix.height; ··· 504 fmt->fmt.win.clipcount = win->clipcount; 505 err2 = drv(file, VIDIOC_S_FMT, fmt); 506 if (err2 < 0) 507 + dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %ld\n", err2); 508 509 if (err1 != 0 && err2 != 0) 510 err = err1; ··· 514 return err; 515 } 516 517 + static noinline long v4l1_compat_turn_preview_on_off( 518 int *on, 519 struct file *file, 520 v4l2_kioctl drv) 521 { 522 + long err; 523 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 524 525 if (0 == *on) { ··· 530 } 531 err = drv(file, VIDIOC_OVERLAY, on); 532 if (err < 0) 533 + dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %ld\n", err); 534 return err; 535 } 536 537 + static noinline long v4l1_compat_get_input_info( 538 struct video_channel *chan, 539 struct file *file, 540 v4l2_kioctl drv) 541 { 542 + long err; 543 struct v4l2_input input2; 544 v4l2_std_id sid; 545 ··· 548 err = drv(file, VIDIOC_ENUMINPUT, &input2); 549 if (err < 0) { 550 dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " 551 + "channel=%d err=%ld\n", chan->channel, err); 552 goto done; 553 } 554 chan->channel = input2.index; ··· 569 chan->norm = 0; 570 err = drv(file, VIDIOC_G_STD, &sid); 571 if (err < 0) 572 + dprintk("VIDIOCGCHAN / VIDIOC_G_STD: %ld\n", err); 573 if (err == 0) { 574 if (sid & V4L2_STD_PAL) 575 chan->norm = VIDEO_MODE_PAL; ··· 582 return err; 583 } 584 585 + static noinline long v4l1_compat_set_input( 586 struct video_channel *chan, 587 struct file *file, 588 v4l2_kioctl drv) 589 { 590 + long err; 591 v4l2_std_id sid = 0; 592 593 err = drv(file, VIDIOC_S_INPUT, &chan->channel); 594 if (err < 0) 595 + dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %ld\n", err); 596 switch (chan->norm) { 597 case VIDEO_MODE_PAL: 598 sid = V4L2_STD_PAL; ··· 607 if (0 != sid) { 608 err = drv(file, VIDIOC_S_STD, &sid); 609 if (err < 0) 610 + dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %ld\n", err); 611 } 612 return err; 613 } 614 615 + static noinline long v4l1_compat_get_picture( 616 struct video_picture *pict, 617 struct file *file, 618 v4l2_kioctl drv) 619 { 620 + long err; 621 struct v4l2_format *fmt; 622 623 fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); ··· 640 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 641 err = drv(file, VIDIOC_G_FMT, fmt); 642 if (err < 0) { 643 + dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %ld\n", err); 644 goto done; 645 } 646 ··· 654 return err; 655 } 656 657 + static noinline long v4l1_compat_set_picture( 658 struct video_picture *pict, 659 struct file *file, 660 v4l2_kioctl drv) 661 { 662 + long err; 663 struct v4l2_framebuffer fbuf; 664 int mem_err = 0, ovl_err = 0; 665 struct v4l2_format *fmt; ··· 694 support memory capture. Trying to set the memory capture 695 parameters would be pointless. */ 696 if (err < 0) { 697 + dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %ld\n", err); 698 mem_err = -1000; /* didn't even try */ 699 } else if (fmt->fmt.pix.pixelformat != 700 palette_to_pixelformat(pict->palette)) { ··· 711 support overlay. Trying to set the overlay parameters 712 would be quite pointless. */ 713 if (err < 0) { 714 + dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %ld\n", err); 715 ovl_err = -1000; /* didn't even try */ 716 } else if (fbuf.fmt.pixelformat != 717 palette_to_pixelformat(pict->palette)) { ··· 736 return err; 737 } 738 739 + static noinline long v4l1_compat_get_tuner( 740 struct video_tuner *tun, 741 struct file *file, 742 v4l2_kioctl drv) 743 { 744 + long err; 745 + int i; 746 struct v4l2_tuner tun2; 747 struct v4l2_standard std2; 748 v4l2_std_id sid; ··· 749 memset(&tun2, 0, sizeof(tun2)); 750 err = drv(file, VIDIOC_G_TUNER, &tun2); 751 if (err < 0) { 752 + dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %ld\n", err); 753 goto done; 754 } 755 memcpy(tun->name, tun2.name, ··· 775 776 err = drv(file, VIDIOC_G_STD, &sid); 777 if (err < 0) 778 + dprintk("VIDIOCGTUNER / VIDIOC_G_STD: %ld\n", err); 779 if (err == 0) { 780 if (sid & V4L2_STD_PAL) 781 tun->mode = VIDEO_MODE_PAL; ··· 794 return err; 795 } 796 797 + static noinline long v4l1_compat_select_tuner( 798 struct video_tuner *tun, 799 struct file *file, 800 v4l2_kioctl drv) 801 { 802 + long err; 803 struct v4l2_tuner t;/*84 bytes on x86_64*/ 804 memset(&t, 0, sizeof(t)); 805 ··· 807 808 err = drv(file, VIDIOC_S_INPUT, &t); 809 if (err < 0) 810 + dprintk("VIDIOCSTUNER / VIDIOC_S_INPUT: %ld\n", err); 811 return err; 812 } 813 814 + static noinline long v4l1_compat_get_frequency( 815 unsigned long *freq, 816 struct file *file, 817 v4l2_kioctl drv) 818 { 819 + long err; 820 struct v4l2_frequency freq2; 821 memset(&freq2, 0, sizeof(freq2)); 822 823 freq2.tuner = 0; 824 err = drv(file, VIDIOC_G_FREQUENCY, &freq2); 825 if (err < 0) 826 + dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %ld\n", err); 827 if (0 == err) 828 *freq = freq2.frequency; 829 return err; 830 } 831 832 + static noinline long v4l1_compat_set_frequency( 833 unsigned long *freq, 834 struct file *file, 835 v4l2_kioctl drv) 836 { 837 + long err; 838 struct v4l2_frequency freq2; 839 memset(&freq2, 0, sizeof(freq2)); 840 ··· 842 freq2.frequency = *freq; 843 err = drv(file, VIDIOC_S_FREQUENCY, &freq2); 844 if (err < 0) 845 + dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %ld\n", err); 846 return err; 847 } 848 849 + static noinline long v4l1_compat_get_audio( 850 struct video_audio *aud, 851 struct file *file, 852 v4l2_kioctl drv) 853 { 854 + long err; 855 + int i; 856 struct v4l2_queryctrl qctrl2; 857 struct v4l2_audio aud2; 858 struct v4l2_tuner tun2; ··· 859 860 err = drv(file, VIDIOC_G_AUDIO, &aud2); 861 if (err < 0) { 862 + dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %ld\n", err); 863 goto done; 864 } 865 memcpy(aud->name, aud2.name, ··· 903 memset(&tun2, 0, sizeof(tun2)); 904 err = drv(file, VIDIOC_G_TUNER, &tun2); 905 if (err < 0) { 906 + dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %ld\n", err); 907 err = 0; 908 goto done; 909 } ··· 918 return err; 919 } 920 921 + static noinline long v4l1_compat_set_audio( 922 struct video_audio *aud, 923 struct file *file, 924 v4l2_kioctl drv) 925 { 926 + long err; 927 struct v4l2_audio aud2; 928 struct v4l2_tuner tun2; 929 ··· 933 aud2.index = aud->audio; 934 err = drv(file, VIDIOC_S_AUDIO, &aud2); 935 if (err < 0) { 936 + dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %ld\n", err); 937 goto done; 938 } 939 ··· 950 951 err = drv(file, VIDIOC_G_TUNER, &tun2); 952 if (err < 0) 953 + dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %ld\n", err); 954 if (err == 0) { 955 switch (aud->mode) { 956 default: ··· 967 } 968 err = drv(file, VIDIOC_S_TUNER, &tun2); 969 if (err < 0) 970 + dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %ld\n", err); 971 } 972 err = 0; 973 done: 974 return err; 975 } 976 977 + static noinline long v4l1_compat_capture_frame( 978 struct video_mmap *mm, 979 struct file *file, 980 v4l2_kioctl drv) 981 { 982 + long err; 983 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 984 struct v4l2_buffer buf; 985 struct v4l2_format *fmt; ··· 994 fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 995 err = drv(file, VIDIOC_G_FMT, fmt); 996 if (err < 0) { 997 + dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %ld\n", err); 998 goto done; 999 } 1000 if (mm->width != fmt->fmt.pix.width || ··· 1010 fmt->fmt.pix.bytesperline = 0; 1011 err = drv(file, VIDIOC_S_FMT, fmt); 1012 if (err < 0) { 1013 + dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %ld\n", err); 1014 goto done; 1015 } 1016 } ··· 1018 buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1019 err = drv(file, VIDIOC_QUERYBUF, &buf); 1020 if (err < 0) { 1021 + dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %ld\n", err); 1022 goto done; 1023 } 1024 err = drv(file, VIDIOC_QBUF, &buf); 1025 if (err < 0) { 1026 + dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %ld\n", err); 1027 goto done; 1028 } 1029 err = drv(file, VIDIOC_STREAMON, &captype); 1030 if (err < 0) 1031 + dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %ld\n", err); 1032 done: 1033 kfree(fmt); 1034 return err; 1035 } 1036 1037 + static noinline long v4l1_compat_sync( 1038 int *i, 1039 struct file *file, 1040 v4l2_kioctl drv) 1041 { 1042 + long err; 1043 enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; 1044 struct v4l2_buffer buf; 1045 struct poll_wqueues *pwq; ··· 1050 err = drv(file, VIDIOC_QUERYBUF, &buf); 1051 if (err < 0) { 1052 /* No such buffer */ 1053 + dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err); 1054 goto done; 1055 } 1056 if (!(buf.flags & V4L2_BUF_FLAG_MAPPED)) { ··· 1062 /* make sure capture actually runs so we don't block forever */ 1063 err = drv(file, VIDIOC_STREAMON, &captype); 1064 if (err < 0) { 1065 + dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %ld\n", err); 1066 goto done; 1067 } 1068 ··· 1076 break; 1077 err = drv(file, VIDIOC_QUERYBUF, &buf); 1078 if (err < 0) 1079 + dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err); 1080 } 1081 kfree(pwq); 1082 if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */ ··· 1084 do { 1085 err = drv(file, VIDIOC_DQBUF, &buf); 1086 if (err < 0) 1087 + dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %ld\n", err); 1088 } while (err == 0 && buf.index != *i); 1089 done: 1090 return err; 1091 } 1092 1093 + static noinline long v4l1_compat_get_vbi_format( 1094 struct vbi_format *fmt, 1095 struct file *file, 1096 v4l2_kioctl drv) 1097 { 1098 + long err; 1099 struct v4l2_format *fmt2; 1100 1101 fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); ··· 1107 1108 err = drv(file, VIDIOC_G_FMT, fmt2); 1109 if (err < 0) { 1110 + dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %ld\n", err); 1111 goto done; 1112 } 1113 if (fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY) { ··· 1128 return err; 1129 } 1130 1131 + static noinline long v4l1_compat_set_vbi_format( 1132 struct vbi_format *fmt, 1133 struct file *file, 1134 v4l2_kioctl drv) 1135 { 1136 + long err; 1137 struct v4l2_format *fmt2 = NULL; 1138 1139 if (VIDEO_PALETTE_RAW != fmt->sample_format) { ··· 1157 fmt2->fmt.vbi.flags = fmt->flags; 1158 err = drv(file, VIDIOC_TRY_FMT, fmt2); 1159 if (err < 0) { 1160 + dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %ld\n", err); 1161 goto done; 1162 } 1163 ··· 1174 } 1175 err = drv(file, VIDIOC_S_FMT, fmt2); 1176 if (err < 0) 1177 + dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %ld\n", err); 1178 done: 1179 kfree(fmt2); 1180 return err; ··· 1183 /* 1184 * This function is exported. 1185 */ 1186 + long 1187 v4l_compat_translate_ioctl(struct file *file, 1188 int cmd, 1189 void *arg, 1190 v4l2_kioctl drv) 1191 { 1192 + long err; 1193 1194 switch (cmd) { 1195 case VIDIOCGCAP: /* capability */
+20 -9
drivers/media/video/v4l2-common.c
··· 797 } 798 EXPORT_SYMBOL(v4l2_ctrl_next); 799 800 - int v4l2_chip_match_host(u32 match_type, u32 match_chip) 801 { 802 - switch (match_type) { 803 case V4L2_CHIP_MATCH_HOST: 804 - return match_chip == 0; 805 default: 806 return 0; 807 } ··· 809 EXPORT_SYMBOL(v4l2_chip_match_host); 810 811 #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) 812 - int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) 813 { 814 - switch (match_type) { 815 case V4L2_CHIP_MATCH_I2C_DRIVER: 816 - return (c != NULL && c->driver != NULL && c->driver->id == match_chip); 817 case V4L2_CHIP_MATCH_I2C_ADDR: 818 - return (c != NULL && c->addr == match_chip); 819 default: 820 return 0; 821 } 822 } 823 EXPORT_SYMBOL(v4l2_chip_match_i2c_client); 824 825 - int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, 826 u32 ident, u32 revision) 827 { 828 - if (!v4l2_chip_match_i2c_client(c, chip->match_type, chip->match_chip)) 829 return 0; 830 if (chip->ident == V4L2_IDENT_NONE) { 831 chip->ident = ident;
··· 797 } 798 EXPORT_SYMBOL(v4l2_ctrl_next); 799 800 + int v4l2_chip_match_host(const struct v4l2_dbg_match *match) 801 { 802 + switch (match->type) { 803 case V4L2_CHIP_MATCH_HOST: 804 + return match->addr == 0; 805 default: 806 return 0; 807 } ··· 809 EXPORT_SYMBOL(v4l2_chip_match_host); 810 811 #if defined(CONFIG_I2C) || (defined(CONFIG_I2C_MODULE) && defined(MODULE)) 812 + int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match) 813 { 814 + int len; 815 + 816 + if (c == NULL || match == NULL) 817 + return 0; 818 + 819 + switch (match->type) { 820 case V4L2_CHIP_MATCH_I2C_DRIVER: 821 + if (c->driver == NULL || c->driver->driver.name == NULL) 822 + return 0; 823 + len = strlen(c->driver->driver.name); 824 + /* legacy drivers have a ' suffix, don't try to match that */ 825 + if (len && c->driver->driver.name[len - 1] == '\'') 826 + len--; 827 + return len && !strncmp(c->driver->driver.name, match->name, len); 828 case V4L2_CHIP_MATCH_I2C_ADDR: 829 + return c->addr == match->addr; 830 default: 831 return 0; 832 } 833 } 834 EXPORT_SYMBOL(v4l2_chip_match_i2c_client); 835 836 + int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip, 837 u32 ident, u32 revision) 838 { 839 + if (!v4l2_chip_match_i2c_client(c, &chip->match)) 840 return 0; 841 if (chip->ident == V4L2_IDENT_NONE) { 842 chip->ident = ident;
+12 -15
drivers/media/video/v4l2-compat-ioctl32.c
··· 222 223 #endif 224 225 - static int native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 226 { 227 - int ret = -ENOIOCTLCMD; 228 229 if (file->f_op->unlocked_ioctl) 230 ret = file->f_op->unlocked_ioctl(file, cmd, arg); ··· 705 #define VIDIOC_G_OUTPUT32 _IOR ('V', 46, s32) 706 #define VIDIOC_S_OUTPUT32 _IOWR('V', 47, s32) 707 708 - static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 709 { 710 union { 711 #ifdef CONFIG_VIDEO_V4L1_COMPAT ··· 726 } karg; 727 void __user *up = compat_ptr(arg); 728 int compatible_arg = 1; 729 - int err = 0; 730 731 /* First, convert the command. */ 732 switch (cmd) { ··· 937 return err; 938 } 939 940 - long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) 941 { 942 - int ret = -ENOIOCTLCMD; 943 944 if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl) 945 return ret; ··· 1046 case VIDIOC_TRY_ENCODER_CMD: 1047 case VIDIOC_DBG_S_REGISTER: 1048 case VIDIOC_DBG_G_REGISTER: 1049 - case VIDIOC_G_CHIP_IDENT: 1050 case VIDIOC_S_HW_FREQ_SEEK: 1051 ret = do_video_ioctl(file, cmd, arg); 1052 break; ··· 1066 break; 1067 #endif 1068 default: 1069 - v4l_print_ioctl("compat_ioctl32", cmd); 1070 - printk(KERN_CONT "\n"); 1071 break; 1072 } 1073 return ret; 1074 } 1075 - #else 1076 - long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) 1077 - { 1078 - return -ENOIOCTLCMD; 1079 - } 1080 #endif 1081 - EXPORT_SYMBOL_GPL(v4l_compat_ioctl32); 1082 1083 MODULE_LICENSE("GPL");
··· 222 223 #endif 224 225 + static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 226 { 227 + long ret = -ENOIOCTLCMD; 228 229 if (file->f_op->unlocked_ioctl) 230 ret = file->f_op->unlocked_ioctl(file, cmd, arg); ··· 705 #define VIDIOC_G_OUTPUT32 _IOR ('V', 46, s32) 706 #define VIDIOC_S_OUTPUT32 _IOWR('V', 47, s32) 707 708 + static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 709 { 710 union { 711 #ifdef CONFIG_VIDEO_V4L1_COMPAT ··· 726 } karg; 727 void __user *up = compat_ptr(arg); 728 int compatible_arg = 1; 729 + long err = 0; 730 731 /* First, convert the command. */ 732 switch (cmd) { ··· 937 return err; 938 } 939 940 + long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) 941 { 942 + long ret = -ENOIOCTLCMD; 943 944 if (!file->f_op->ioctl && !file->f_op->unlocked_ioctl) 945 return ret; ··· 1046 case VIDIOC_TRY_ENCODER_CMD: 1047 case VIDIOC_DBG_S_REGISTER: 1048 case VIDIOC_DBG_G_REGISTER: 1049 + case VIDIOC_DBG_G_CHIP_IDENT: 1050 + case VIDIOC_G_CHIP_IDENT_OLD: 1051 case VIDIOC_S_HW_FREQ_SEEK: 1052 ret = do_video_ioctl(file, cmd, arg); 1053 break; ··· 1065 break; 1066 #endif 1067 default: 1068 + printk(KERN_WARNING "compat_ioctl32: " 1069 + "unknown ioctl '%c', dir=%d, #%d (0x%08x)\n", 1070 + _IOC_TYPE(cmd), _IOC_DIR(cmd), _IOC_NR(cmd), cmd); 1071 break; 1072 } 1073 return ret; 1074 } 1075 + EXPORT_SYMBOL_GPL(v4l2_compat_ioctl32); 1076 #endif 1077 1078 MODULE_LICENSE("GPL");
+6 -19
drivers/media/video/v4l2-dev.c
··· 31 32 #include <media/v4l2-common.h> 33 #include <media/v4l2-device.h> 34 35 #define VIDEO_NUM_DEVICES 256 36 #define VIDEO_NAME "video4linux" ··· 183 return -ENOTTY; 184 /* Allow ioctl to continue even if the device was unregistered. 185 Things like dequeueing buffers might still be useful. */ 186 - return vdev->fops->ioctl(inode, filp, cmd, arg); 187 } 188 189 static long v4l2_unlocked_ioctl(struct file *filp, ··· 197 Things like dequeueing buffers might still be useful. */ 198 return vdev->fops->unlocked_ioctl(filp, cmd, arg); 199 } 200 - 201 - #ifdef CONFIG_COMPAT 202 - static long v4l2_compat_ioctl(struct file *filp, 203 - unsigned int cmd, unsigned long arg) 204 - { 205 - struct video_device *vdev = video_devdata(filp); 206 - 207 - if (!vdev->fops->compat_ioctl) 208 - return -ENOIOCTLCMD; 209 - /* Allow ioctl to continue even if the device was unregistered. 210 - Things like dequeueing buffers might still be useful. */ 211 - return vdev->fops->compat_ioctl(filp, cmd, arg); 212 - } 213 - #endif 214 215 static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) 216 { ··· 226 /* and increase the device refcount */ 227 video_get(vdev); 228 mutex_unlock(&videodev_lock); 229 - ret = vdev->fops->open(inode, filp); 230 /* decrease the refcount in case of an error */ 231 if (ret) 232 video_put(vdev); ··· 237 static int v4l2_release(struct inode *inode, struct file *filp) 238 { 239 struct video_device *vdev = video_devdata(filp); 240 - int ret = vdev->fops->release(inode, filp); 241 242 /* decrease the refcount unconditionally since the release() 243 return value is ignored. */ ··· 253 .mmap = v4l2_mmap, 254 .unlocked_ioctl = v4l2_unlocked_ioctl, 255 #ifdef CONFIG_COMPAT 256 - .compat_ioctl = v4l2_compat_ioctl, 257 #endif 258 .release = v4l2_release, 259 .poll = v4l2_poll, ··· 268 .mmap = v4l2_mmap, 269 .ioctl = v4l2_ioctl, 270 #ifdef CONFIG_COMPAT 271 - .compat_ioctl = v4l2_compat_ioctl, 272 #endif 273 .release = v4l2_release, 274 .poll = v4l2_poll,
··· 31 32 #include <media/v4l2-common.h> 33 #include <media/v4l2-device.h> 34 + #include <media/v4l2-ioctl.h> 35 36 #define VIDEO_NUM_DEVICES 256 37 #define VIDEO_NAME "video4linux" ··· 182 return -ENOTTY; 183 /* Allow ioctl to continue even if the device was unregistered. 184 Things like dequeueing buffers might still be useful. */ 185 + return vdev->fops->ioctl(filp, cmd, arg); 186 } 187 188 static long v4l2_unlocked_ioctl(struct file *filp, ··· 196 Things like dequeueing buffers might still be useful. */ 197 return vdev->fops->unlocked_ioctl(filp, cmd, arg); 198 } 199 200 static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) 201 { ··· 239 /* and increase the device refcount */ 240 video_get(vdev); 241 mutex_unlock(&videodev_lock); 242 + ret = vdev->fops->open(filp); 243 /* decrease the refcount in case of an error */ 244 if (ret) 245 video_put(vdev); ··· 250 static int v4l2_release(struct inode *inode, struct file *filp) 251 { 252 struct video_device *vdev = video_devdata(filp); 253 + int ret = vdev->fops->release(filp); 254 255 /* decrease the refcount unconditionally since the release() 256 return value is ignored. */ ··· 266 .mmap = v4l2_mmap, 267 .unlocked_ioctl = v4l2_unlocked_ioctl, 268 #ifdef CONFIG_COMPAT 269 + .compat_ioctl = v4l2_compat_ioctl32, 270 #endif 271 .release = v4l2_release, 272 .poll = v4l2_poll, ··· 281 .mmap = v4l2_mmap, 282 .ioctl = v4l2_ioctl, 283 #ifdef CONFIG_COMPAT 284 + .compat_ioctl = v4l2_compat_ioctl32, 285 #endif 286 .release = v4l2_release, 287 .poll = v4l2_poll,
+17 -19
drivers/media/video/v4l2-ioctl.c
··· 266 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", 267 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", 268 269 - [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT", 270 [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK", 271 #endif 272 }; ··· 392 /* 393 * Obsolete usercopy function - Should be removed soon 394 */ 395 - int 396 video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, 397 v4l2_kioctl func) 398 { 399 char sbuf[128]; 400 void *mbuf = NULL; 401 void *parg = NULL; 402 - int err = -EINVAL; 403 int is_ext_ctrl; 404 size_t ctrls_size = 0; 405 void __user *user_ptr = NULL; ··· 623 return -EINVAL; 624 } 625 626 - static int __video_do_ioctl(struct file *file, 627 unsigned int cmd, void *arg) 628 { 629 struct video_device *vfd = video_devdata(file); 630 const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops; 631 void *fh = file->private_data; 632 - int ret = -EINVAL; 633 634 if ((vfd->debug & V4L2_DEBUG_IOCTL) && 635 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { ··· 1720 #ifdef CONFIG_VIDEO_ADV_DEBUG 1721 case VIDIOC_DBG_G_REGISTER: 1722 { 1723 - struct v4l2_register *p = arg; 1724 1725 if (!capable(CAP_SYS_ADMIN)) 1726 ret = -EPERM; ··· 1730 } 1731 case VIDIOC_DBG_S_REGISTER: 1732 { 1733 - struct v4l2_register *p = arg; 1734 1735 if (!capable(CAP_SYS_ADMIN)) 1736 ret = -EPERM; ··· 1739 break; 1740 } 1741 #endif 1742 - case VIDIOC_G_CHIP_IDENT: 1743 { 1744 - struct v4l2_chip_ident *p = arg; 1745 1746 if (!ops->vidioc_g_chip_ident) 1747 break; ··· 1750 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); 1751 break; 1752 } 1753 case VIDIOC_S_HW_FREQ_SEEK: 1754 { 1755 struct v4l2_hw_freq_seek *p = arg; ··· 1850 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { 1851 if (ret < 0) { 1852 v4l_print_ioctl(vfd->name, cmd); 1853 - printk(KERN_CONT " error %d\n", ret); 1854 } 1855 } 1856 1857 return ret; 1858 } 1859 1860 - long __video_ioctl2(struct file *file, 1861 unsigned int cmd, unsigned long arg) 1862 { 1863 char sbuf[128]; 1864 void *mbuf = NULL; 1865 void *parg = NULL; 1866 - int err = -EINVAL; 1867 int is_ext_ctrl; 1868 size_t ctrls_size = 0; 1869 void __user *user_ptr = NULL; ··· 1948 out: 1949 kfree(mbuf); 1950 return err; 1951 - } 1952 - EXPORT_SYMBOL(__video_ioctl2); 1953 - 1954 - int video_ioctl2(struct inode *inode, struct file *file, 1955 - unsigned int cmd, unsigned long arg) 1956 - { 1957 - return __video_ioctl2(file, cmd, arg); 1958 } 1959 EXPORT_SYMBOL(video_ioctl2);
··· 266 [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", 267 [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", 268 269 + [_IOC_NR(VIDIOC_DBG_G_CHIP_IDENT)] = "VIDIOC_DBG_G_CHIP_IDENT", 270 [_IOC_NR(VIDIOC_S_HW_FREQ_SEEK)] = "VIDIOC_S_HW_FREQ_SEEK", 271 #endif 272 }; ··· 392 /* 393 * Obsolete usercopy function - Should be removed soon 394 */ 395 + long 396 video_usercopy(struct file *file, unsigned int cmd, unsigned long arg, 397 v4l2_kioctl func) 398 { 399 char sbuf[128]; 400 void *mbuf = NULL; 401 void *parg = NULL; 402 + long err = -EINVAL; 403 int is_ext_ctrl; 404 size_t ctrls_size = 0; 405 void __user *user_ptr = NULL; ··· 623 return -EINVAL; 624 } 625 626 + static long __video_do_ioctl(struct file *file, 627 unsigned int cmd, void *arg) 628 { 629 struct video_device *vfd = video_devdata(file); 630 const struct v4l2_ioctl_ops *ops = vfd->ioctl_ops; 631 void *fh = file->private_data; 632 + long ret = -EINVAL; 633 634 if ((vfd->debug & V4L2_DEBUG_IOCTL) && 635 !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { ··· 1720 #ifdef CONFIG_VIDEO_ADV_DEBUG 1721 case VIDIOC_DBG_G_REGISTER: 1722 { 1723 + struct v4l2_dbg_register *p = arg; 1724 1725 if (!capable(CAP_SYS_ADMIN)) 1726 ret = -EPERM; ··· 1730 } 1731 case VIDIOC_DBG_S_REGISTER: 1732 { 1733 + struct v4l2_dbg_register *p = arg; 1734 1735 if (!capable(CAP_SYS_ADMIN)) 1736 ret = -EPERM; ··· 1739 break; 1740 } 1741 #endif 1742 + case VIDIOC_DBG_G_CHIP_IDENT: 1743 { 1744 + struct v4l2_dbg_chip_ident *p = arg; 1745 1746 if (!ops->vidioc_g_chip_ident) 1747 break; ··· 1750 dbgarg(cmd, "chip_ident=%u, revision=0x%x\n", p->ident, p->revision); 1751 break; 1752 } 1753 + case VIDIOC_G_CHIP_IDENT_OLD: 1754 + printk(KERN_ERR "VIDIOC_G_CHIP_IDENT has been deprecated and will disappear in 2.6.30.\n"); 1755 + printk(KERN_ERR "It is a debugging ioctl and must not be used in applications!\n"); 1756 + return -EINVAL; 1757 + 1758 case VIDIOC_S_HW_FREQ_SEEK: 1759 { 1760 struct v4l2_hw_freq_seek *p = arg; ··· 1845 if (vfd->debug & V4L2_DEBUG_IOCTL_ARG) { 1846 if (ret < 0) { 1847 v4l_print_ioctl(vfd->name, cmd); 1848 + printk(KERN_CONT " error %ld\n", ret); 1849 } 1850 } 1851 1852 return ret; 1853 } 1854 1855 + long video_ioctl2(struct file *file, 1856 unsigned int cmd, unsigned long arg) 1857 { 1858 char sbuf[128]; 1859 void *mbuf = NULL; 1860 void *parg = NULL; 1861 + long err = -EINVAL; 1862 int is_ext_ctrl; 1863 size_t ctrls_size = 0; 1864 void __user *user_ptr = NULL; ··· 1943 out: 1944 kfree(mbuf); 1945 return err; 1946 } 1947 EXPORT_SYMBOL(video_ioctl2);
+1 -1
drivers/media/video/v4l2-subdev.c
··· 37 return v4l2_subdev_call(sd, core, queryctrl, arg); 38 case VIDIOC_LOG_STATUS: 39 return v4l2_subdev_call(sd, core, log_status); 40 - case VIDIOC_G_CHIP_IDENT: 41 return v4l2_subdev_call(sd, core, g_chip_ident, arg); 42 case VIDIOC_INT_S_STANDBY: 43 return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0);
··· 37 return v4l2_subdev_call(sd, core, queryctrl, arg); 38 case VIDIOC_LOG_STATUS: 39 return v4l2_subdev_call(sd, core, log_status); 40 + case VIDIOC_DBG_G_CHIP_IDENT: 41 return v4l2_subdev_call(sd, core, g_chip_ident, arg); 42 case VIDIOC_INT_S_STANDBY: 43 return v4l2_subdev_call(sd, core, s_standby, arg ? (*(u32 *)arg) : 0);
+6 -7
drivers/media/video/vino.c
··· 4019 4020 /* File operations */ 4021 4022 - static int vino_open(struct inode *inode, struct file *file) 4023 { 4024 struct vino_channel_settings *vcs = video_drvdata(file); 4025 int ret = 0; ··· 4050 return ret; 4051 } 4052 4053 - static int vino_close(struct inode *inode, struct file *file) 4054 { 4055 struct vino_channel_settings *vcs = video_drvdata(file); 4056 dprintk("close():\n"); ··· 4237 return ret; 4238 } 4239 4240 - static int vino_do_ioctl(struct file *file, unsigned int cmd, void *arg) 4241 { 4242 struct vino_channel_settings *vcs = video_drvdata(file); 4243 ··· 4343 return 0; 4344 } 4345 4346 - static int vino_ioctl(struct inode *inode, struct file *file, 4347 unsigned int cmd, unsigned long arg) 4348 { 4349 struct vino_channel_settings *vcs = video_drvdata(file); 4350 - int ret; 4351 4352 if (mutex_lock_interruptible(&vcs->mutex)) 4353 return -EINTR; ··· 4364 /* __initdata */ 4365 static int vino_init_stage; 4366 4367 - static const struct file_operations vino_fops = { 4368 .owner = THIS_MODULE, 4369 .open = vino_open, 4370 .release = vino_close, 4371 .ioctl = vino_ioctl, 4372 .mmap = vino_mmap, 4373 .poll = vino_poll, 4374 - .llseek = no_llseek, 4375 }; 4376 4377 static struct video_device v4l_device_template = {
··· 4019 4020 /* File operations */ 4021 4022 + static int vino_open(struct file *file) 4023 { 4024 struct vino_channel_settings *vcs = video_drvdata(file); 4025 int ret = 0; ··· 4050 return ret; 4051 } 4052 4053 + static int vino_close(struct file *file) 4054 { 4055 struct vino_channel_settings *vcs = video_drvdata(file); 4056 dprintk("close():\n"); ··· 4237 return ret; 4238 } 4239 4240 + static long vino_do_ioctl(struct file *file, unsigned int cmd, void *arg) 4241 { 4242 struct vino_channel_settings *vcs = video_drvdata(file); 4243 ··· 4343 return 0; 4344 } 4345 4346 + static long vino_ioctl(struct file *file, 4347 unsigned int cmd, unsigned long arg) 4348 { 4349 struct vino_channel_settings *vcs = video_drvdata(file); 4350 + long ret; 4351 4352 if (mutex_lock_interruptible(&vcs->mutex)) 4353 return -EINTR; ··· 4364 /* __initdata */ 4365 static int vino_init_stage; 4366 4367 + static const struct v4l2_file_operations vino_fops = { 4368 .owner = THIS_MODULE, 4369 .open = vino_open, 4370 .release = vino_close, 4371 .ioctl = vino_ioctl, 4372 .mmap = vino_mmap, 4373 .poll = vino_poll, 4374 }; 4375 4376 static struct video_device v4l_device_template = {
+5 -7
drivers/media/video/vivi.c
··· 1024 File operations for the device 1025 ------------------------------------------------------------------*/ 1026 1027 - static int vivi_open(struct inode *inode, struct file *file) 1028 { 1029 - int minor = iminor(inode); 1030 struct vivi_dev *dev; 1031 struct vivi_fh *fh = NULL; 1032 int i; ··· 1127 return videobuf_poll_stream(file, q, wait); 1128 } 1129 1130 - static int vivi_close(struct inode *inode, struct file *file) 1131 { 1132 struct vivi_fh *fh = file->private_data; 1133 struct vivi_dev *dev = fh->dev; 1134 struct vivi_dmaqueue *vidq = &dev->vidq; 1135 1136 - int minor = iminor(inode); 1137 1138 vivi_stop_thread(vidq); 1139 videobuf_stop(&fh->vb_vidq); ··· 1195 return ret; 1196 } 1197 1198 - static const struct file_operations vivi_fops = { 1199 .owner = THIS_MODULE, 1200 .open = vivi_open, 1201 .release = vivi_close, 1202 .read = vivi_read, 1203 .poll = vivi_poll, 1204 .ioctl = video_ioctl2, /* V4L2 ioctl handler */ 1205 - .compat_ioctl = v4l_compat_ioctl32, 1206 .mmap = vivi_mmap, 1207 - .llseek = no_llseek, 1208 }; 1209 1210 static const struct v4l2_ioctl_ops vivi_ioctl_ops = {
··· 1024 File operations for the device 1025 ------------------------------------------------------------------*/ 1026 1027 + static int vivi_open(struct file *file) 1028 { 1029 + int minor = video_devdata(file)->minor; 1030 struct vivi_dev *dev; 1031 struct vivi_fh *fh = NULL; 1032 int i; ··· 1127 return videobuf_poll_stream(file, q, wait); 1128 } 1129 1130 + static int vivi_close(struct file *file) 1131 { 1132 struct vivi_fh *fh = file->private_data; 1133 struct vivi_dev *dev = fh->dev; 1134 struct vivi_dmaqueue *vidq = &dev->vidq; 1135 1136 + int minor = video_devdata(file)->minor; 1137 1138 vivi_stop_thread(vidq); 1139 videobuf_stop(&fh->vb_vidq); ··· 1195 return ret; 1196 } 1197 1198 + static const struct v4l2_file_operations vivi_fops = { 1199 .owner = THIS_MODULE, 1200 .open = vivi_open, 1201 .release = vivi_close, 1202 .read = vivi_read, 1203 .poll = vivi_poll, 1204 .ioctl = video_ioctl2, /* V4L2 ioctl handler */ 1205 .mmap = vivi_mmap, 1206 }; 1207 1208 static const struct v4l2_ioctl_ops vivi_ioctl_ops = {
+1 -1
drivers/media/video/vp27smpx.c
··· 113 return 0; 114 } 115 116 - static int vp27smpx_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 117 { 118 struct i2c_client *client = v4l2_get_subdevdata(sd); 119
··· 113 return 0; 114 } 115 116 + static int vp27smpx_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 117 { 118 struct i2c_client *client = v4l2_get_subdevdata(sd); 119
+6 -10
drivers/media/video/w9966.c
··· 180 static int w9966_i2c_rbyte(struct w9966_dev* cam); 181 #endif 182 183 - static int w9966_v4l_ioctl(struct inode *inode, struct file *file, 184 unsigned int cmd, unsigned long arg); 185 static ssize_t w9966_v4l_read(struct file *file, char __user *buf, 186 size_t count, loff_t *ppos); 187 188 - static int w9966_exclusive_open(struct inode *inode, struct file *file) 189 { 190 struct w9966_dev *cam = video_drvdata(file); 191 192 return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0; 193 } 194 195 - static int w9966_exclusive_release(struct inode *inode, struct file *file) 196 { 197 struct w9966_dev *cam = video_drvdata(file); 198 ··· 200 return 0; 201 } 202 203 - static const struct file_operations w9966_fops = { 204 .owner = THIS_MODULE, 205 .open = w9966_exclusive_open, 206 .release = w9966_exclusive_release, 207 .ioctl = w9966_v4l_ioctl, 208 - #ifdef CONFIG_COMPAT 209 - .compat_ioctl = v4l_compat_ioctl32, 210 - #endif 211 .read = w9966_v4l_read, 212 - .llseek = no_llseek, 213 }; 214 static struct video_device w9966_template = { 215 .name = W9966_DRIVERNAME, ··· 723 * Video4linux interfacing 724 */ 725 726 - static int w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) 727 { 728 struct w9966_dev *cam = video_drvdata(file); 729 ··· 873 return 0; 874 } 875 876 - static int w9966_v4l_ioctl(struct inode *inode, struct file *file, 877 unsigned int cmd, unsigned long arg) 878 { 879 return video_usercopy(file, cmd, arg, w9966_v4l_do_ioctl);
··· 180 static int w9966_i2c_rbyte(struct w9966_dev* cam); 181 #endif 182 183 + static long w9966_v4l_ioctl(struct file *file, 184 unsigned int cmd, unsigned long arg); 185 static ssize_t w9966_v4l_read(struct file *file, char __user *buf, 186 size_t count, loff_t *ppos); 187 188 + static int w9966_exclusive_open(struct file *file) 189 { 190 struct w9966_dev *cam = video_drvdata(file); 191 192 return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0; 193 } 194 195 + static int w9966_exclusive_release(struct file *file) 196 { 197 struct w9966_dev *cam = video_drvdata(file); 198 ··· 200 return 0; 201 } 202 203 + static const struct v4l2_file_operations w9966_fops = { 204 .owner = THIS_MODULE, 205 .open = w9966_exclusive_open, 206 .release = w9966_exclusive_release, 207 .ioctl = w9966_v4l_ioctl, 208 .read = w9966_v4l_read, 209 }; 210 static struct video_device w9966_template = { 211 .name = W9966_DRIVERNAME, ··· 727 * Video4linux interfacing 728 */ 729 730 + static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg) 731 { 732 struct w9966_dev *cam = video_drvdata(file); 733 ··· 877 return 0; 878 } 879 880 + static long w9966_v4l_ioctl(struct file *file, 881 unsigned int cmd, unsigned long arg) 882 { 883 return video_usercopy(file, cmd, arg, w9966_v4l_do_ioctl);
+16 -20
drivers/media/video/w9968cf.c
··· 399 ****************************************************************************/ 400 401 /* Video4linux interface */ 402 - static const struct file_operations w9968cf_fops; 403 - static int w9968cf_open(struct inode*, struct file*); 404 - static int w9968cf_release(struct inode*, struct file*); 405 - static int w9968cf_mmap(struct file*, struct vm_area_struct*); 406 - static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long); 407 - static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*); 408 - static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int, 409 void __user *); 410 411 /* USB-specific */ ··· 2662 * Video4Linux interface * 2663 ****************************************************************************/ 2664 2665 - static int w9968cf_open(struct inode* inode, struct file* filp) 2666 { 2667 struct w9968cf_device* cam; 2668 int err; ··· 2748 } 2749 2750 2751 - static int w9968cf_release(struct inode* inode, struct file* filp) 2752 { 2753 struct w9968cf_device* cam; 2754 ··· 2885 } 2886 2887 2888 - static int 2889 - w9968cf_ioctl(struct inode* inode, struct file* filp, 2890 unsigned int cmd, unsigned long arg) 2891 { 2892 struct w9968cf_device* cam; 2893 - int err; 2894 2895 cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); 2896 ··· 2909 return -EIO; 2910 } 2911 2912 - err = w9968cf_v4l_ioctl(inode, filp, cmd, (void __user *)arg); 2913 2914 mutex_unlock(&cam->fileop_mutex); 2915 return err; 2916 } 2917 2918 2919 - static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, 2920 - unsigned int cmd, void __user * arg) 2921 { 2922 struct w9968cf_device* cam; 2923 const char* v4l1_ioctls[] = { ··· 3456 } 3457 3458 3459 - static const struct file_operations w9968cf_fops = { 3460 .owner = THIS_MODULE, 3461 .open = w9968cf_open, 3462 .release = w9968cf_release, 3463 .read = w9968cf_read, 3464 .ioctl = w9968cf_ioctl, 3465 - #ifdef CONFIG_COMPAT 3466 - .compat_ioctl = v4l_compat_ioctl32, 3467 - #endif 3468 .mmap = w9968cf_mmap, 3469 - .llseek = no_llseek, 3470 }; 3471 3472
··· 399 ****************************************************************************/ 400 401 /* Video4linux interface */ 402 + static const struct v4l2_file_operations w9968cf_fops; 403 + static int w9968cf_open(struct file *); 404 + static int w9968cf_release(struct file *); 405 + static int w9968cf_mmap(struct file *, struct vm_area_struct *); 406 + static long w9968cf_ioctl(struct file *, unsigned, unsigned long); 407 + static ssize_t w9968cf_read(struct file *, char __user *, size_t, loff_t *); 408 + static long w9968cf_v4l_ioctl(struct file *, unsigned int, 409 void __user *); 410 411 /* USB-specific */ ··· 2662 * Video4Linux interface * 2663 ****************************************************************************/ 2664 2665 + static int w9968cf_open(struct file *filp) 2666 { 2667 struct w9968cf_device* cam; 2668 int err; ··· 2748 } 2749 2750 2751 + static int w9968cf_release(struct file *filp) 2752 { 2753 struct w9968cf_device* cam; 2754 ··· 2885 } 2886 2887 2888 + static long 2889 + w9968cf_ioctl(struct file *filp, 2890 unsigned int cmd, unsigned long arg) 2891 { 2892 struct w9968cf_device* cam; 2893 + long err; 2894 2895 cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); 2896 ··· 2909 return -EIO; 2910 } 2911 2912 + err = w9968cf_v4l_ioctl(filp, cmd, (void __user *)arg); 2913 2914 mutex_unlock(&cam->fileop_mutex); 2915 return err; 2916 } 2917 2918 2919 + static long w9968cf_v4l_ioctl(struct file *filp, 2920 + unsigned int cmd, void __user *arg) 2921 { 2922 struct w9968cf_device* cam; 2923 const char* v4l1_ioctls[] = { ··· 3456 } 3457 3458 3459 + static const struct v4l2_file_operations w9968cf_fops = { 3460 .owner = THIS_MODULE, 3461 .open = w9968cf_open, 3462 .release = w9968cf_release, 3463 .read = w9968cf_read, 3464 .ioctl = w9968cf_ioctl, 3465 .mmap = w9968cf_mmap, 3466 }; 3467 3468
+1 -1
drivers/media/video/wm8739.c
··· 233 return -EINVAL; 234 } 235 236 - static int wm8739_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 237 { 238 struct i2c_client *client = v4l2_get_subdevdata(sd); 239
··· 233 return -EINVAL; 234 } 235 236 + static int wm8739_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 237 { 238 struct i2c_client *client = v4l2_get_subdevdata(sd); 239
+1 -1
drivers/media/video/wm8775.c
··· 130 return 0; 131 } 132 133 - static int wm8775_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip) 134 { 135 struct i2c_client *client = v4l2_get_subdevdata(sd); 136
··· 130 return 0; 131 } 132 133 + static int wm8775_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip) 134 { 135 struct i2c_client *client = v4l2_get_subdevdata(sd); 136
+7 -11
drivers/media/video/zc0301/zc0301_core.c
··· 649 } 650 651 652 - static int zc0301_open(struct inode* inode, struct file* filp) 653 { 654 struct zc0301_device* cam; 655 int err = 0; ··· 733 } 734 735 736 - static int zc0301_release(struct inode* inode, struct file* filp) 737 { 738 struct zc0301_device* cam; 739 ··· 1793 } 1794 1795 1796 - static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, 1797 - unsigned int cmd, void __user * arg) 1798 { 1799 struct zc0301_device *cam = video_drvdata(filp); 1800 ··· 1888 } 1889 1890 1891 - static int zc0301_ioctl(struct inode* inode, struct file* filp, 1892 unsigned int cmd, unsigned long arg) 1893 { 1894 struct zc0301_device *cam = video_drvdata(filp); ··· 1912 1913 V4LDBG(3, "zc0301", cmd); 1914 1915 - err = zc0301_ioctl_v4l2(inode, filp, cmd, (void __user *)arg); 1916 1917 mutex_unlock(&cam->fileop_mutex); 1918 ··· 1920 } 1921 1922 1923 - static const struct file_operations zc0301_fops = { 1924 .owner = THIS_MODULE, 1925 .open = zc0301_open, 1926 .release = zc0301_release, 1927 .ioctl = zc0301_ioctl, 1928 - #ifdef CONFIG_COMPAT 1929 - .compat_ioctl = v4l_compat_ioctl32, 1930 - #endif 1931 .read = zc0301_read, 1932 .poll = zc0301_poll, 1933 .mmap = zc0301_mmap, 1934 - .llseek = no_llseek, 1935 }; 1936 1937 /*****************************************************************************/
··· 649 } 650 651 652 + static int zc0301_open(struct file *filp) 653 { 654 struct zc0301_device* cam; 655 int err = 0; ··· 733 } 734 735 736 + static int zc0301_release(struct file *filp) 737 { 738 struct zc0301_device* cam; 739 ··· 1793 } 1794 1795 1796 + static long zc0301_ioctl_v4l2(struct file *filp, 1797 + unsigned int cmd, void __user *arg) 1798 { 1799 struct zc0301_device *cam = video_drvdata(filp); 1800 ··· 1888 } 1889 1890 1891 + static long zc0301_ioctl(struct file *filp, 1892 unsigned int cmd, unsigned long arg) 1893 { 1894 struct zc0301_device *cam = video_drvdata(filp); ··· 1912 1913 V4LDBG(3, "zc0301", cmd); 1914 1915 + err = zc0301_ioctl_v4l2(filp, cmd, (void __user *)arg); 1916 1917 mutex_unlock(&cam->fileop_mutex); 1918 ··· 1920 } 1921 1922 1923 + static const struct v4l2_file_operations zc0301_fops = { 1924 .owner = THIS_MODULE, 1925 .open = zc0301_open, 1926 .release = zc0301_release, 1927 .ioctl = zc0301_ioctl, 1928 .read = zc0301_read, 1929 .poll = zc0301_poll, 1930 .mmap = zc0301_mmap, 1931 }; 1932 1933 /*****************************************************************************/
+9 -16
drivers/media/video/zoran/zoran_driver.c
··· 1197 */ 1198 1199 static int 1200 - zoran_open (struct inode *inode, 1201 - struct file *file) 1202 { 1203 - unsigned int minor = iminor(inode); 1204 struct zoran *zr = NULL; 1205 struct zoran_fh *fh; 1206 int i, res, first_open = 0, have_module_locks = 0; ··· 1339 } 1340 1341 static int 1342 - zoran_close (struct inode *inode, 1343 - struct file *file) 1344 { 1345 struct zoran_fh *fh = file->private_data; 1346 struct zoran *zr = fh->zr; ··· 1938 * ioctl routine 1939 */ 1940 1941 - static int zoran_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1942 { 1943 struct zoran_fh *fh = file->private_data; 1944 struct zoran *zr = fh->zr; ··· 4189 } 4190 4191 4192 - static int 4193 - zoran_ioctl (struct inode *inode, 4194 - struct file *file, 4195 - unsigned int cmd, 4196 - unsigned long arg) 4197 { 4198 return video_usercopy(file, cmd, arg, zoran_do_ioctl); 4199 } ··· 4617 return 0; 4618 } 4619 4620 - static const struct file_operations zoran_fops = { 4621 .owner = THIS_MODULE, 4622 .open = zoran_open, 4623 .release = zoran_close, 4624 .ioctl = zoran_ioctl, 4625 - #ifdef CONFIG_COMPAT 4626 - .compat_ioctl = v4l_compat_ioctl32, 4627 - #endif 4628 - .llseek = no_llseek, 4629 .read = zoran_read, 4630 .write = zoran_write, 4631 .mmap = zoran_mmap,
··· 1197 */ 1198 1199 static int 1200 + zoran_open(struct file *file) 1201 { 1202 + unsigned int minor = video_devdata(file)->minor; 1203 struct zoran *zr = NULL; 1204 struct zoran_fh *fh; 1205 int i, res, first_open = 0, have_module_locks = 0; ··· 1340 } 1341 1342 static int 1343 + zoran_close(struct file *file) 1344 { 1345 struct zoran_fh *fh = file->private_data; 1346 struct zoran *zr = fh->zr; ··· 1940 * ioctl routine 1941 */ 1942 1943 + static long zoran_do_ioctl(struct file *file, unsigned int cmd, void *arg) 1944 { 1945 struct zoran_fh *fh = file->private_data; 1946 struct zoran *zr = fh->zr; ··· 4191 } 4192 4193 4194 + static long 4195 + zoran_ioctl(struct file *file, 4196 + unsigned int cmd, 4197 + unsigned long arg) 4198 { 4199 return video_usercopy(file, cmd, arg, zoran_do_ioctl); 4200 } ··· 4620 return 0; 4621 } 4622 4623 + static const struct v4l2_file_operations zoran_fops = { 4624 .owner = THIS_MODULE, 4625 .open = zoran_open, 4626 .release = zoran_close, 4627 .ioctl = zoran_ioctl, 4628 .read = zoran_read, 4629 .write = zoran_write, 4630 .mmap = zoran_mmap,
+3 -5
drivers/media/video/zr364xx.c
··· 634 635 636 /* open the camera */ 637 - static int zr364xx_open(struct inode *inode, struct file *file) 638 { 639 struct video_device *vdev = video_devdata(file); 640 struct zr364xx_camera *cam = video_get_drvdata(vdev); ··· 688 689 690 /* release the camera */ 691 - static int zr364xx_release(struct inode *inode, struct file *file) 692 { 693 struct video_device *vdev = video_devdata(file); 694 struct zr364xx_camera *cam; ··· 761 } 762 763 764 - static const struct file_operations zr364xx_fops = { 765 .owner = THIS_MODULE, 766 .open = zr364xx_open, 767 .release = zr364xx_release, 768 .read = zr364xx_read, 769 .mmap = zr364xx_mmap, 770 .ioctl = video_ioctl2, 771 - .llseek = no_llseek, 772 }; 773 774 static const struct v4l2_ioctl_ops zr364xx_ioctl_ops = { ··· 893 { 894 struct zr364xx_camera *cam = usb_get_intfdata(intf); 895 usb_set_intfdata(intf, NULL); 896 - dev_set_drvdata(&intf->dev, NULL); 897 dev_info(&intf->dev, DRIVER_DESC " webcam unplugged\n"); 898 if (cam->vdev) 899 video_unregister_device(cam->vdev);
··· 634 635 636 /* open the camera */ 637 + static int zr364xx_open(struct file *file) 638 { 639 struct video_device *vdev = video_devdata(file); 640 struct zr364xx_camera *cam = video_get_drvdata(vdev); ··· 688 689 690 /* release the camera */ 691 + static int zr364xx_release(struct file *file) 692 { 693 struct video_device *vdev = video_devdata(file); 694 struct zr364xx_camera *cam; ··· 761 } 762 763 764 + static const struct v4l2_file_operations zr364xx_fops = { 765 .owner = THIS_MODULE, 766 .open = zr364xx_open, 767 .release = zr364xx_release, 768 .read = zr364xx_read, 769 .mmap = zr364xx_mmap, 770 .ioctl = video_ioctl2, 771 }; 772 773 static const struct v4l2_ioctl_ops zr364xx_ioctl_ops = { ··· 894 { 895 struct zr364xx_camera *cam = usb_get_intfdata(intf); 896 usb_set_intfdata(intf, NULL); 897 dev_info(&intf->dev, DRIVER_DESC " webcam unplugged\n"); 898 if (cam->vdev) 899 video_unregister_device(cam->vdev);
+14 -13
include/linux/dvb/frontend.h
··· 62 FE_CAN_HIERARCHY_AUTO = 0x100000, 63 FE_CAN_8VSB = 0x200000, 64 FE_CAN_16VSB = 0x400000, 65 - FE_HAS_EXTENDED_CAPS = 0x800000, // We need more bitspace for newer APIs, indicate this. 66 - FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) 67 - FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically 68 - FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output 69 } fe_caps_t; 70 71 ··· 122 123 124 typedef enum fe_status { 125 - FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ 126 - FE_HAS_CARRIER = 0x02, /* found a DVB signal */ 127 - FE_HAS_VITERBI = 0x04, /* FEC is stable */ 128 - FE_HAS_SYNC = 0x08, /* found sync bytes */ 129 - FE_HAS_LOCK = 0x10, /* everything's working... */ 130 - FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ 131 - FE_REINIT = 0x40 /* frontend was reinitialized, */ 132 - } fe_status_t; /* application is recommended to reset */ 133 - /* DiSEqC, tone and parameters */ 134 135 typedef enum fe_spectral_inversion { 136 INVERSION_OFF,
··· 62 FE_CAN_HIERARCHY_AUTO = 0x100000, 63 FE_CAN_8VSB = 0x200000, 64 FE_CAN_16VSB = 0x400000, 65 + FE_HAS_EXTENDED_CAPS = 0x800000, /* We need more bitspace for newer APIs, indicate this. */ 66 + FE_CAN_2G_MODULATION = 0x10000000, /* frontend supports "2nd generation modulation" (DVB-S2) */ 67 + FE_NEEDS_BENDING = 0x20000000, /* not supported anymore, don't use (frontend requires frequency bending) */ 68 + FE_CAN_RECOVER = 0x40000000, /* frontend can recover from a cable unplug automatically */ 69 + FE_CAN_MUTE_TS = 0x80000000 /* frontend can stop spurious TS data output */ 70 } fe_caps_t; 71 72 ··· 121 122 123 typedef enum fe_status { 124 + FE_HAS_SIGNAL = 0x01, /* found something above the noise level */ 125 + FE_HAS_CARRIER = 0x02, /* found a DVB signal */ 126 + FE_HAS_VITERBI = 0x04, /* FEC is stable */ 127 + FE_HAS_SYNC = 0x08, /* found sync bytes */ 128 + FE_HAS_LOCK = 0x10, /* everything's working... */ 129 + FE_TIMEDOUT = 0x20, /* no lock within the last ~2 seconds */ 130 + FE_REINIT = 0x40 /* frontend was reinitialized, */ 131 + } fe_status_t; /* application is recommended to reset */ 132 + /* DiSEqC, tone and parameters */ 133 134 typedef enum fe_spectral_inversion { 135 INVERSION_OFF,
+39 -14
include/linux/videodev2.h
··· 1370 /* 1371 * A D V A N C E D D E B U G G I N G 1372 * 1373 - * NOTE: EXPERIMENTAL API 1374 */ 1375 1376 /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 1377 1378 #define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ 1379 - #define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */ 1380 #define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ 1381 #define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ 1382 1383 - struct v4l2_register { 1384 - __u32 match_type; /* Match type */ 1385 - __u32 match_chip; /* Match this chip, meaning determined by match_type */ 1386 __u64 reg; 1387 __u64 val; 1388 - }; 1389 1390 - /* VIDIOC_G_CHIP_IDENT */ 1391 - struct v4l2_chip_ident { 1392 __u32 match_type; /* Match type */ 1393 __u32 match_chip; /* Match this chip, meaning determined by match_type */ 1394 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */ ··· 1476 #define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) 1477 #define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) 1478 #define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) 1479 - 1480 - /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ 1481 - #define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_register) 1482 - #define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_register) 1483 - 1484 - #define VIDIOC_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_chip_ident) 1485 #endif 1486 #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1487 /* Reminder: when adding new ioctls please add support for them to 1488 drivers/media/video/v4l2-compat-ioctl32.c as well! */
··· 1370 /* 1371 * A D V A N C E D D E B U G G I N G 1372 * 1373 + * NOTE: EXPERIMENTAL API, NEVER RELY ON THIS IN APPLICATIONS! 1374 + * FOR DEBUGGING, TESTING AND INTERNAL USE ONLY! 1375 */ 1376 1377 /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ 1378 1379 #define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ 1380 + #define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver name */ 1381 #define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ 1382 #define V4L2_CHIP_MATCH_AC97 3 /* Match against anciliary AC97 chip */ 1383 1384 + struct v4l2_dbg_match { 1385 + __u32 type; /* Match type */ 1386 + union { /* Match this chip, meaning determined by type */ 1387 + __u32 addr; 1388 + char name[32]; 1389 + }; 1390 + } __attribute__ ((packed)); 1391 + 1392 + struct v4l2_dbg_register { 1393 + struct v4l2_dbg_match match; 1394 + __u32 size; /* register size in bytes */ 1395 __u64 reg; 1396 __u64 val; 1397 + } __attribute__ ((packed)); 1398 1399 + /* VIDIOC_DBG_G_CHIP_IDENT */ 1400 + struct v4l2_dbg_chip_ident { 1401 + struct v4l2_dbg_match match; 1402 + __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */ 1403 + __u32 revision; /* chip revision, chip specific */ 1404 + } __attribute__ ((packed)); 1405 + 1406 + /* VIDIOC_G_CHIP_IDENT_OLD: Deprecated, do not use */ 1407 + struct v4l2_chip_ident_old { 1408 __u32 match_type; /* Match type */ 1409 __u32 match_chip; /* Match this chip, meaning determined by match_type */ 1410 __u32 ident; /* chip identifier as specified in <media/v4l2-chip-ident.h> */ ··· 1460 #define VIDIOC_G_ENC_INDEX _IOR('V', 76, struct v4l2_enc_idx) 1461 #define VIDIOC_ENCODER_CMD _IOWR('V', 77, struct v4l2_encoder_cmd) 1462 #define VIDIOC_TRY_ENCODER_CMD _IOWR('V', 78, struct v4l2_encoder_cmd) 1463 #endif 1464 + 1465 + #if 1 1466 + /* Experimental, meant for debugging, testing and internal use. 1467 + Only implemented if CONFIG_VIDEO_ADV_DEBUG is defined. 1468 + You must be root to use these ioctls. Never use these in applications! */ 1469 + #define VIDIOC_DBG_S_REGISTER _IOW('V', 79, struct v4l2_dbg_register) 1470 + #define VIDIOC_DBG_G_REGISTER _IOWR('V', 80, struct v4l2_dbg_register) 1471 + 1472 + /* Experimental, meant for debugging, testing and internal use. 1473 + Never use this ioctl in applications! */ 1474 + #define VIDIOC_DBG_G_CHIP_IDENT _IOWR('V', 81, struct v4l2_dbg_chip_ident) 1475 + /* This is deprecated and will go away in 2.6.30 */ 1476 + #define VIDIOC_G_CHIP_IDENT_OLD _IOWR('V', 81, struct v4l2_chip_ident_old) 1477 + #endif 1478 + 1479 #define VIDIOC_S_HW_FREQ_SEEK _IOW('V', 82, struct v4l2_hw_freq_seek) 1480 /* Reminder: when adding new ioctls please add support for them to 1481 drivers/media/video/v4l2-compat-ioctl32.c as well! */
+3 -3
include/media/saa7146_vv.h
··· 177 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); 178 179 struct saa7146_extension_ioctls *ioctls; 180 - int (*ioctl)(struct saa7146_fh*, unsigned int cmd, void *arg); 181 182 - struct file_operations vbi_fops; 183 }; 184 185 struct saa7146_use_ops { ··· 216 extern struct saa7146_use_ops saa7146_video_uops; 217 int saa7146_start_preview(struct saa7146_fh *fh); 218 int saa7146_stop_preview(struct saa7146_fh *fh); 219 - int saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg); 220 221 /* from saa7146_vbi.c */ 222 extern struct saa7146_use_ops saa7146_vbi_uops;
··· 177 int (*std_callback)(struct saa7146_dev*, struct saa7146_standard *); 178 179 struct saa7146_extension_ioctls *ioctls; 180 + long (*ioctl)(struct saa7146_fh *, unsigned int cmd, void *arg); 181 182 + struct v4l2_file_operations vbi_fops; 183 }; 184 185 struct saa7146_use_ops { ··· 216 extern struct saa7146_use_ops saa7146_video_uops; 217 int saa7146_start_preview(struct saa7146_fh *fh); 218 int saa7146_stop_preview(struct saa7146_fh *fh); 219 + long saa7146_video_do_ioctl(struct file *file, unsigned int cmd, void *arg); 220 221 /* from saa7146_vbi.c */ 222 extern struct saa7146_use_ops saa7146_vbi_uops;
+3 -3
include/media/soc_camera.h
··· 164 unsigned long (*query_bus_param)(struct soc_camera_device *); 165 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 166 int (*get_chip_id)(struct soc_camera_device *, 167 - struct v4l2_chip_ident *); 168 int (*set_std)(struct soc_camera_device *, v4l2_std_id *); 169 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *); 170 #ifdef CONFIG_VIDEO_ADV_DEBUG 171 - int (*get_register)(struct soc_camera_device *, struct v4l2_register *); 172 - int (*set_register)(struct soc_camera_device *, struct v4l2_register *); 173 #endif 174 int (*get_control)(struct soc_camera_device *, struct v4l2_control *); 175 int (*set_control)(struct soc_camera_device *, struct v4l2_control *);
··· 164 unsigned long (*query_bus_param)(struct soc_camera_device *); 165 int (*set_bus_param)(struct soc_camera_device *, unsigned long); 166 int (*get_chip_id)(struct soc_camera_device *, 167 + struct v4l2_dbg_chip_ident *); 168 int (*set_std)(struct soc_camera_device *, v4l2_std_id *); 169 int (*enum_input)(struct soc_camera_device *, struct v4l2_input *); 170 #ifdef CONFIG_VIDEO_ADV_DEBUG 171 + int (*get_register)(struct soc_camera_device *, struct v4l2_dbg_register *); 172 + int (*set_register)(struct soc_camera_device *, struct v4l2_dbg_register *); 173 #endif 174 int (*get_control)(struct soc_camera_device *, struct v4l2_control *); 175 int (*set_control)(struct soc_camera_device *, struct v4l2_control *);
+2 -2
include/media/v4l2-chip-ident.h
··· 2 v4l2 chip identifiers header 3 4 This header provides a list of chip identifiers that can be returned 5 - through the VIDIOC_G_CHIP_IDENT ioctl. 6 7 Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 8 ··· 24 #ifndef V4L2_CHIP_IDENT_H_ 25 #define V4L2_CHIP_IDENT_H_ 26 27 - /* VIDIOC_G_CHIP_IDENT: identifies the actual chip installed on the board */ 28 enum { 29 /* general idents: reserved range 0-49 */ 30 V4L2_IDENT_NONE = 0, /* No chip matched */
··· 2 v4l2 chip identifiers header 3 4 This header provides a list of chip identifiers that can be returned 5 + through the VIDIOC_DBG_G_CHIP_IDENT ioctl. 6 7 Copyright (C) 2007 Hans Verkuil <hverkuil@xs4all.nl> 8 ··· 24 #ifndef V4L2_CHIP_IDENT_H_ 25 #define V4L2_CHIP_IDENT_H_ 26 27 + /* VIDIOC_DBG_G_CHIP_IDENT: identifies the actual chip installed on the board */ 28 enum { 29 /* general idents: reserved range 0-49 */ 30 V4L2_IDENT_NONE = 0, /* No chip matched */
+3 -3
include/media/v4l2-common.h
··· 114 /* Register/chip ident helper function */ 115 116 struct i2c_client; /* forward reference */ 117 - int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id); 118 - int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, 119 u32 ident, u32 revision); 120 - int v4l2_chip_match_host(u32 id_type, u32 chip_id); 121 122 /* ------------------------------------------------------------------------- */ 123
··· 114 /* Register/chip ident helper function */ 115 116 struct i2c_client; /* forward reference */ 117 + int v4l2_chip_match_i2c_client(struct i2c_client *c, const struct v4l2_dbg_match *match); 118 + int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_dbg_chip_ident *chip, 119 u32 ident, u32 revision); 120 + int v4l2_chip_match_host(const struct v4l2_dbg_match *match); 121 122 /* ------------------------------------------------------------------------- */ 123
+14 -1
include/media/v4l2-dev.h
··· 25 #define VFL_TYPE_MAX 4 26 27 struct v4l2_ioctl_callbacks; 28 struct v4l2_device; 29 30 /* Flag to mark the video_device struct as unregistered. 31 Drivers can set this flag if they want to block all future 32 device access. It is set by video_unregister_device. */ 33 #define V4L2_FL_UNREGISTERED (0) 34 35 /* 36 * Newer version of video_device, handled by videodev2.c ··· 54 struct video_device 55 { 56 /* device ops */ 57 - const struct file_operations *fops; 58 59 /* sysfs */ 60 struct device dev; /* v4l device */
··· 25 #define VFL_TYPE_MAX 4 26 27 struct v4l2_ioctl_callbacks; 28 + struct video_device; 29 struct v4l2_device; 30 31 /* Flag to mark the video_device struct as unregistered. 32 Drivers can set this flag if they want to block all future 33 device access. It is set by video_unregister_device. */ 34 #define V4L2_FL_UNREGISTERED (0) 35 + 36 + struct v4l2_file_operations { 37 + struct module *owner; 38 + ssize_t (*read) (struct file *, char __user *, size_t, loff_t *); 39 + ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *); 40 + unsigned int (*poll) (struct file *, struct poll_table_struct *); 41 + long (*ioctl) (struct file *, unsigned int, unsigned long); 42 + long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 43 + int (*mmap) (struct file *, struct vm_area_struct *); 44 + int (*open) (struct file *); 45 + int (*release) (struct file *); 46 + }; 47 48 /* 49 * Newer version of video_device, handled by videodev2.c ··· 41 struct video_device 42 { 43 /* device ops */ 44 + const struct v4l2_file_operations *fops; 45 46 /* sysfs */ 47 struct device dev; /* v4l device */
+1 -1
include/media/v4l2-device.h
··· 80 #define __v4l2_device_call_subdevs_until_err(dev, cond, o, f, args...) \ 81 ({ \ 82 struct v4l2_subdev *sd; \ 83 - int err = 0; \ 84 \ 85 list_for_each_entry(sd, &(dev)->subdevs, list) { \ 86 if ((cond) && sd->ops->o && sd->ops->o->f) \
··· 80 #define __v4l2_device_call_subdevs_until_err(dev, cond, o, f, args...) \ 81 ({ \ 82 struct v4l2_subdev *sd; \ 83 + long err = 0; \ 84 \ 85 list_for_each_entry(sd, &(dev)->subdevs, list) { \ 86 if ((cond) && sd->ops->o && sd->ops->o->f) \
+1 -1
include/media/v4l2-int-device.h
··· 219 vidioc_int_reset_num, 220 /* VIDIOC_INT_INIT */ 221 vidioc_int_init_num, 222 - /* VIDIOC_INT_G_CHIP_IDENT */ 223 vidioc_int_g_chip_ident_num, 224 225 /*
··· 219 vidioc_int_reset_num, 220 /* VIDIOC_INT_INIT */ 221 vidioc_int_init_num, 222 + /* VIDIOC_DBG_G_CHIP_IDENT */ 223 vidioc_int_g_chip_ident_num, 224 225 /*
+11 -20
include/media/v4l2-ioctl.h
··· 225 /* Debugging ioctls */ 226 #ifdef CONFIG_VIDEO_ADV_DEBUG 227 int (*vidioc_g_register) (struct file *file, void *fh, 228 - struct v4l2_register *reg); 229 int (*vidioc_s_register) (struct file *file, void *fh, 230 - struct v4l2_register *reg); 231 #endif 232 int (*vidioc_g_chip_ident) (struct file *file, void *fh, 233 - struct v4l2_chip_ident *chip); 234 235 int (*vidioc_enum_framesizes) (struct file *file, void *fh, 236 struct v4l2_frmsizeenum *fsize); ··· 239 struct v4l2_frmivalenum *fival); 240 241 /* For other private ioctls */ 242 - int (*vidioc_default) (struct file *file, void *fh, 243 int cmd, void *arg); 244 }; 245 ··· 277 extern const char *v4l2_type_names[]; 278 279 /* Compatibility layer interface -- v4l1-compat module */ 280 - typedef int (*v4l2_kioctl)(struct file *file, 281 unsigned int cmd, void *arg); 282 #ifdef CONFIG_VIDEO_V4L1_COMPAT 283 - int v4l_compat_translate_ioctl(struct file *file, 284 int cmd, void *arg, v4l2_kioctl driver_ioctl); 285 #else 286 #define v4l_compat_translate_ioctl(file, cmd, arg, ioctl) (-EINVAL) 287 #endif 288 289 /* 32 Bits compatibility layer for 64 bits processors */ 290 - extern long v4l_compat_ioctl32(struct file *file, unsigned int cmd, 291 unsigned long arg); 292 293 /* Include support for obsoleted stuff */ 294 - extern int video_usercopy(struct file *file, unsigned int cmd, 295 unsigned long arg, v4l2_kioctl func); 296 297 /* Standard handlers for V4L ioctl's */ 298 - 299 - /* This prototype is used on fops.unlocked_ioctl */ 300 - extern long __video_ioctl2(struct file *file, 301 - unsigned int cmd, unsigned long arg); 302 - 303 - /* This prototype is used on fops.ioctl 304 - * Since fops.ioctl enables Kernel Big Lock, it is preferred 305 - * to use __video_ioctl2 instead. 306 - * It should be noticed that there's no lock code inside 307 - * video_ioctl2(). 308 - */ 309 - extern int video_ioctl2(struct inode *inode, struct file *file, 310 unsigned int cmd, unsigned long arg); 311 312 #endif /* _V4L2_IOCTL_H */
··· 225 /* Debugging ioctls */ 226 #ifdef CONFIG_VIDEO_ADV_DEBUG 227 int (*vidioc_g_register) (struct file *file, void *fh, 228 + struct v4l2_dbg_register *reg); 229 int (*vidioc_s_register) (struct file *file, void *fh, 230 + struct v4l2_dbg_register *reg); 231 #endif 232 int (*vidioc_g_chip_ident) (struct file *file, void *fh, 233 + struct v4l2_dbg_chip_ident *chip); 234 235 int (*vidioc_enum_framesizes) (struct file *file, void *fh, 236 struct v4l2_frmsizeenum *fsize); ··· 239 struct v4l2_frmivalenum *fival); 240 241 /* For other private ioctls */ 242 + long (*vidioc_default) (struct file *file, void *fh, 243 int cmd, void *arg); 244 }; 245 ··· 277 extern const char *v4l2_type_names[]; 278 279 /* Compatibility layer interface -- v4l1-compat module */ 280 + typedef long (*v4l2_kioctl)(struct file *file, 281 unsigned int cmd, void *arg); 282 #ifdef CONFIG_VIDEO_V4L1_COMPAT 283 + long v4l_compat_translate_ioctl(struct file *file, 284 int cmd, void *arg, v4l2_kioctl driver_ioctl); 285 #else 286 #define v4l_compat_translate_ioctl(file, cmd, arg, ioctl) (-EINVAL) 287 #endif 288 289 + #ifdef CONFIG_COMPAT 290 /* 32 Bits compatibility layer for 64 bits processors */ 291 + extern long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, 292 unsigned long arg); 293 + #endif 294 295 /* Include support for obsoleted stuff */ 296 + extern long video_usercopy(struct file *file, unsigned int cmd, 297 unsigned long arg, v4l2_kioctl func); 298 299 /* Standard handlers for V4L ioctl's */ 300 + extern long video_ioctl2(struct file *file, 301 unsigned int cmd, unsigned long arg); 302 303 #endif /* _V4L2_IOCTL_H */
+4 -4
include/media/v4l2-subdev.h
··· 69 not yet implemented) since ops provide proper type-checking. 70 */ 71 struct v4l2_subdev_core_ops { 72 - int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_chip_ident *chip); 73 int (*log_status)(struct v4l2_subdev *sd); 74 int (*init)(struct v4l2_subdev *sd, u32 val); 75 int (*s_standby)(struct v4l2_subdev *sd, u32 standby); ··· 79 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 80 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 81 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); 82 - int (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 83 #ifdef CONFIG_VIDEO_ADV_DEBUG 84 - int (*g_register)(struct v4l2_subdev *sd, struct v4l2_register *reg); 85 - int (*s_register)(struct v4l2_subdev *sd, struct v4l2_register *reg); 86 #endif 87 }; 88
··· 69 not yet implemented) since ops provide proper type-checking. 70 */ 71 struct v4l2_subdev_core_ops { 72 + int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); 73 int (*log_status)(struct v4l2_subdev *sd); 74 int (*init)(struct v4l2_subdev *sd, u32 val); 75 int (*s_standby)(struct v4l2_subdev *sd, u32 standby); ··· 79 int (*g_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 80 int (*s_ctrl)(struct v4l2_subdev *sd, struct v4l2_control *ctrl); 81 int (*querymenu)(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); 82 + long (*ioctl)(struct v4l2_subdev *sd, unsigned int cmd, void *arg); 83 #ifdef CONFIG_VIDEO_ADV_DEBUG 84 + int (*g_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 85 + int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); 86 #endif 87 }; 88
+1 -1
include/sound/tea575x-tuner.h
··· 36 struct snd_tea575x { 37 struct snd_card *card; 38 struct video_device vd; /* video device */ 39 - struct file_operations fops; 40 int dev_nr; /* requested device number + 1 */ 41 int vd_registered; /* video device is registered */ 42 int tea5759; /* 5759 chip is present */
··· 36 struct snd_tea575x { 37 struct snd_card *card; 38 struct video_device vd; /* video device */ 39 + struct v4l2_file_operations fops; 40 int dev_nr; /* requested device number + 1 */ 41 int vd_registered; /* video device is registered */ 42 int tea5759; /* 5759 chip is present */
+3 -3
sound/i2c/other/tea575x-tuner.c
··· 84 * Linux Video interface 85 */ 86 87 - static int snd_tea575x_ioctl(struct inode *inode, struct file *file, 88 unsigned int cmd, unsigned long data) 89 { 90 struct snd_tea575x *tea = video_drvdata(file); ··· 174 { 175 } 176 177 - static int snd_tea575x_exclusive_open(struct inode *inode, struct file *file) 178 { 179 struct snd_tea575x *tea = video_drvdata(file); 180 181 return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; 182 } 183 184 - static int snd_tea575x_exclusive_release(struct inode *inode, struct file *file) 185 { 186 struct snd_tea575x *tea = video_drvdata(file); 187
··· 84 * Linux Video interface 85 */ 86 87 + static long snd_tea575x_ioctl(struct file *file, 88 unsigned int cmd, unsigned long data) 89 { 90 struct snd_tea575x *tea = video_drvdata(file); ··· 174 { 175 } 176 177 + static int snd_tea575x_exclusive_open(struct file *file) 178 { 179 struct snd_tea575x *tea = video_drvdata(file); 180 181 return test_and_set_bit(0, &tea->in_use) ? -EBUSY : 0; 182 } 183 184 + static int snd_tea575x_exclusive_release(struct file *file) 185 { 186 struct snd_tea575x *tea = video_drvdata(file); 187