diff options
| -rw-r--r-- | drivers/media/dvb/dvb-usb/cxusb.c | 4 | ||||
| -rw-r--r-- | drivers/media/dvb/dvb-usb/digitv.c | 2 | ||||
| -rw-r--r-- | drivers/media/video/cafe_ccic.c | 4 | ||||
| -rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 6 | ||||
| -rw-r--r-- | drivers/media/video/cx25840/cx25840-firmware.c | 2 | ||||
| -rw-r--r-- | drivers/media/video/cx88/cx88-video.c | 4 | ||||
| -rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.c | 11 | ||||
| -rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-hdw.h | 7 | ||||
| -rw-r--r-- | drivers/media/video/pvrusb2/pvrusb2-v4l2.c | 4 | ||||
| -rw-r--r-- | drivers/media/video/saa7115.c | 2 | ||||
| -rw-r--r-- | drivers/media/video/saa7127.c | 2 | ||||
| -rw-r--r-- | drivers/media/video/tvp5150.c | 2 | ||||
| -rw-r--r-- | drivers/media/video/upd64031a.c | 2 | ||||
| -rw-r--r-- | drivers/media/video/upd64083.c | 2 | ||||
| -rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 4 | ||||
| -rw-r--r-- | drivers/media/video/v4l2-common.c | 43 | ||||
| -rw-r--r-- | drivers/media/video/videodev.c | 36 | ||||
| -rw-r--r-- | include/linux/videodev2.h | 71 | ||||
| -rw-r--r-- | include/media/v4l2-common.h | 8 | ||||
| -rw-r--r-- | include/media/v4l2-dev.h | 6 |
20 files changed, 184 insertions, 38 deletions
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 15d12fce34df..127a94b9a1b5 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
| @@ -469,9 +469,9 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, | |||
| 469 | fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { | 469 | fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { |
| 470 | 470 | ||
| 471 | fw->data[BLUEBIRD_01_ID_OFFSET + 2] = | 471 | fw->data[BLUEBIRD_01_ID_OFFSET + 2] = |
| 472 | udev->descriptor.idProduct + 1; | 472 | le16_to_cpu(udev->descriptor.idProduct) + 1; |
| 473 | fw->data[BLUEBIRD_01_ID_OFFSET + 3] = | 473 | fw->data[BLUEBIRD_01_ID_OFFSET + 3] = |
| 474 | udev->descriptor.idProduct >> 8; | 474 | le16_to_cpu(udev->descriptor.idProduct) >> 8; |
| 475 | 475 | ||
| 476 | return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); | 476 | return usb_cypress_load_firmware(udev, fw, CYPRESS_FX2); |
| 477 | } | 477 | } |
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index 4a198d4755b0..b5acb11c0bc9 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
| @@ -119,6 +119,8 @@ static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_f | |||
| 119 | struct dvb_usb_adapter *adap = fe->dvb->priv; | 119 | struct dvb_usb_adapter *adap = fe->dvb->priv; |
| 120 | u8 b[5]; | 120 | u8 b[5]; |
| 121 | dvb_usb_tuner_calc_regs(fe,fep,b, 5); | 121 | dvb_usb_tuner_calc_regs(fe,fep,b, 5); |
| 122 | if (fe->ops.i2c_gate_ctrl) | ||
| 123 | fe->ops.i2c_gate_ctrl(fe, 1); | ||
| 122 | return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0); | 124 | return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0); |
| 123 | } | 125 | } |
| 124 | 126 | ||
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 682dc7ce48d9..710c11a68296 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
| @@ -1022,7 +1022,7 @@ static ssize_t cafe_v4l_read(struct file *filp, | |||
| 1022 | char __user *buffer, size_t len, loff_t *pos) | 1022 | char __user *buffer, size_t len, loff_t *pos) |
| 1023 | { | 1023 | { |
| 1024 | struct cafe_camera *cam = filp->private_data; | 1024 | struct cafe_camera *cam = filp->private_data; |
| 1025 | int ret; | 1025 | int ret = 0; |
| 1026 | 1026 | ||
| 1027 | /* | 1027 | /* |
| 1028 | * Perhaps we're in speculative read mode and already | 1028 | * Perhaps we're in speculative read mode and already |
| @@ -1251,8 +1251,6 @@ static int cafe_vidioc_reqbufs(struct file *filp, void *priv, | |||
| 1251 | 1251 | ||
| 1252 | if (cam->n_sbufs == 0) /* no luck at all - ret already set */ | 1252 | if (cam->n_sbufs == 0) /* no luck at all - ret already set */ |
| 1253 | kfree(cam->sb_bufs); | 1253 | kfree(cam->sb_bufs); |
| 1254 | else | ||
| 1255 | ret = 0; | ||
| 1256 | req->count = cam->n_sbufs; /* In case of partial success */ | 1254 | req->count = cam->n_sbufs; /* In case of partial success */ |
| 1257 | 1255 | ||
| 1258 | out: | 1256 | out: |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index cc535ca713d2..774d2536555b 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
| @@ -633,7 +633,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
| 633 | { | 633 | { |
| 634 | struct v4l2_register *reg = arg; | 634 | struct v4l2_register *reg = arg; |
| 635 | 635 | ||
| 636 | if (reg->i2c_id != I2C_DRIVERID_CX25840) | 636 | if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) |
| 637 | return -EINVAL; | 637 | return -EINVAL; |
| 638 | if (!capable(CAP_SYS_ADMIN)) | 638 | if (!capable(CAP_SYS_ADMIN)) |
| 639 | return -EPERM; | 639 | return -EPERM; |
| @@ -903,13 +903,13 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address, | |||
| 903 | state->vbi_line_offset = 8; | 903 | state->vbi_line_offset = 8; |
| 904 | state->id = id; | 904 | state->id = id; |
| 905 | 905 | ||
| 906 | i2c_attach_client(client); | ||
| 907 | |||
| 906 | if (state->is_cx25836) | 908 | if (state->is_cx25836) |
| 907 | cx25836_initialize(client); | 909 | cx25836_initialize(client); |
| 908 | else | 910 | else |
| 909 | cx25840_initialize(client, 1); | 911 | cx25840_initialize(client, 1); |
| 910 | 912 | ||
| 911 | i2c_attach_client(client); | ||
| 912 | |||
| 913 | return 0; | 913 | return 0; |
| 914 | } | 914 | } |
| 915 | 915 | ||
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c index 1958d4016ea1..0e86b9d033ac 100644 --- a/drivers/media/video/cx25840/cx25840-firmware.c +++ b/drivers/media/video/cx25840/cx25840-firmware.c | |||
| @@ -37,7 +37,7 @@ | |||
| 37 | */ | 37 | */ |
| 38 | #define FWSEND 48 | 38 | #define FWSEND 48 |
| 39 | 39 | ||
| 40 | #define FWDEV(x) &((x)->adapter->dev) | 40 | #define FWDEV(x) &((x)->dev) |
| 41 | 41 | ||
| 42 | static char *firmware = FWFILE; | 42 | static char *firmware = FWFILE; |
| 43 | 43 | ||
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index a97be1bdc31d..bdfe2af70124 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
| @@ -1389,7 +1389,7 @@ static int vidioc_g_register (struct file *file, void *fh, | |||
| 1389 | { | 1389 | { |
| 1390 | struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; | 1390 | struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; |
| 1391 | 1391 | ||
| 1392 | if (reg->i2c_id != 0) | 1392 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) |
| 1393 | return -EINVAL; | 1393 | return -EINVAL; |
| 1394 | /* cx2388x has a 24-bit register space */ | 1394 | /* cx2388x has a 24-bit register space */ |
| 1395 | reg->val = cx_read(reg->reg&0xffffff); | 1395 | reg->val = cx_read(reg->reg&0xffffff); |
| @@ -1401,7 +1401,7 @@ static int vidioc_s_register (struct file *file, void *fh, | |||
| 1401 | { | 1401 | { |
| 1402 | struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; | 1402 | struct cx88_core *core = ((struct cx8800_fh*)fh)->dev->core; |
| 1403 | 1403 | ||
| 1404 | if (reg->i2c_id != 0) | 1404 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) |
| 1405 | return -EINVAL; | 1405 | return -EINVAL; |
| 1406 | cx_write(reg->reg&0xffffff, reg->val); | 1406 | cx_write(reg->reg&0xffffff, reg->val); |
| 1407 | return 0; | 1407 | return 0; |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index a1ca0f5007e0..1cd4bb3ae260 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
| @@ -3256,8 +3256,8 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw) | |||
| 3256 | 3256 | ||
| 3257 | 3257 | ||
| 3258 | int pvr2_hdw_register_access(struct pvr2_hdw *hdw, | 3258 | int pvr2_hdw_register_access(struct pvr2_hdw *hdw, |
| 3259 | u32 chip_id, u64 reg_id, | 3259 | u32 match_type, u32 match_chip, u64 reg_id, |
| 3260 | int setFl,u32 *val_ptr) | 3260 | int setFl,u64 *val_ptr) |
| 3261 | { | 3261 | { |
| 3262 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 3262 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
| 3263 | struct list_head *item; | 3263 | struct list_head *item; |
| @@ -3268,13 +3268,16 @@ int pvr2_hdw_register_access(struct pvr2_hdw *hdw, | |||
| 3268 | 3268 | ||
| 3269 | if (!capable(CAP_SYS_ADMIN)) return -EPERM; | 3269 | if (!capable(CAP_SYS_ADMIN)) return -EPERM; |
| 3270 | 3270 | ||
| 3271 | req.i2c_id = chip_id; | 3271 | req.match_type = match_type; |
| 3272 | req.match_chip = match_chip; | ||
| 3272 | req.reg = reg_id; | 3273 | req.reg = reg_id; |
| 3273 | if (setFl) req.val = *val_ptr; | 3274 | if (setFl) req.val = *val_ptr; |
| 3274 | mutex_lock(&hdw->i2c_list_lock); do { | 3275 | mutex_lock(&hdw->i2c_list_lock); do { |
| 3275 | list_for_each(item,&hdw->i2c_clients) { | 3276 | list_for_each(item,&hdw->i2c_clients) { |
| 3276 | cp = list_entry(item,struct pvr2_i2c_client,list); | 3277 | cp = list_entry(item,struct pvr2_i2c_client,list); |
| 3277 | if (cp->client->driver->id != chip_id) continue; | 3278 | if (!v4l2_chip_match_i2c_client(cp->client, req.match_type, req.match_chip)) { |
| 3279 | continue; | ||
| 3280 | } | ||
| 3278 | stat = pvr2_i2c_client_cmd( | 3281 | stat = pvr2_i2c_client_cmd( |
| 3279 | cp,(setFl ? VIDIOC_DBG_S_REGISTER : | 3282 | cp,(setFl ? VIDIOC_DBG_S_REGISTER : |
| 3280 | VIDIOC_DBG_G_REGISTER),&req); | 3283 | VIDIOC_DBG_G_REGISTER),&req); |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 566a8ef7e121..0c9cca43ff85 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h | |||
| @@ -217,13 +217,14 @@ void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *, | |||
| 217 | enum pvr2_v4l_type index,int); | 217 | enum pvr2_v4l_type index,int); |
| 218 | 218 | ||
| 219 | /* Direct read/write access to chip's registers: | 219 | /* Direct read/write access to chip's registers: |
| 220 | chip_id - unique id of chip (e.g. I2C_DRIVERD_xxxx) | 220 | match_type - how to interpret match_chip (e.g. driver ID, i2c address) |
| 221 | match_chip - chip match value (e.g. I2C_DRIVERD_xxxx) | ||
| 221 | reg_id - register number to access | 222 | reg_id - register number to access |
| 222 | setFl - true to set the register, false to read it | 223 | setFl - true to set the register, false to read it |
| 223 | val_ptr - storage location for source / result. */ | 224 | val_ptr - storage location for source / result. */ |
| 224 | int pvr2_hdw_register_access(struct pvr2_hdw *, | 225 | int pvr2_hdw_register_access(struct pvr2_hdw *, |
| 225 | u32 chip_id,u64 reg_id, | 226 | u32 match_type, u32 match_chip,u64 reg_id, |
| 226 | int setFl,u32 *val_ptr); | 227 | int setFl,u64 *val_ptr); |
| 227 | 228 | ||
| 228 | /* The following entry points are all lower level things you normally don't | 229 | /* The following entry points are all lower level things you normally don't |
| 229 | want to worry about. */ | 230 | want to worry about. */ |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index 4fe4136204c7..5313d342666e 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |||
| @@ -740,11 +740,11 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
| 740 | case VIDIOC_DBG_S_REGISTER: | 740 | case VIDIOC_DBG_S_REGISTER: |
| 741 | case VIDIOC_DBG_G_REGISTER: | 741 | case VIDIOC_DBG_G_REGISTER: |
| 742 | { | 742 | { |
| 743 | u32 val; | 743 | u64 val; |
| 744 | struct v4l2_register *req = (struct v4l2_register *)arg; | 744 | struct v4l2_register *req = (struct v4l2_register *)arg; |
| 745 | if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val; | 745 | if (cmd == VIDIOC_DBG_S_REGISTER) val = req->val; |
| 746 | ret = pvr2_hdw_register_access( | 746 | ret = pvr2_hdw_register_access( |
| 747 | hdw,req->i2c_id,req->reg, | 747 | hdw,req->match_type,req->match_chip,req->reg, |
| 748 | cmd == VIDIOC_DBG_S_REGISTER,&val); | 748 | cmd == VIDIOC_DBG_S_REGISTER,&val); |
| 749 | if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val; | 749 | if (cmd == VIDIOC_DBG_G_REGISTER) req->val = val; |
| 750 | break; | 750 | break; |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index c4f066d6668e..7735b6758921 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
| @@ -1425,7 +1425,7 @@ static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *ar | |||
| 1425 | { | 1425 | { |
| 1426 | struct v4l2_register *reg = arg; | 1426 | struct v4l2_register *reg = arg; |
| 1427 | 1427 | ||
| 1428 | if (reg->i2c_id != I2C_DRIVERID_SAA711X) | 1428 | if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) |
| 1429 | return -EINVAL; | 1429 | return -EINVAL; |
| 1430 | if (!capable(CAP_SYS_ADMIN)) | 1430 | if (!capable(CAP_SYS_ADMIN)) |
| 1431 | return -EPERM; | 1431 | return -EPERM; |
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c index bd9c4f3ad02e..654863db1591 100644 --- a/drivers/media/video/saa7127.c +++ b/drivers/media/video/saa7127.c | |||
| @@ -619,7 +619,7 @@ static int saa7127_command(struct i2c_client *client, | |||
| 619 | { | 619 | { |
| 620 | struct v4l2_register *reg = arg; | 620 | struct v4l2_register *reg = arg; |
| 621 | 621 | ||
| 622 | if (reg->i2c_id != I2C_DRIVERID_SAA7127) | 622 | if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) |
| 623 | return -EINVAL; | 623 | return -EINVAL; |
| 624 | if (!capable(CAP_SYS_ADMIN)) | 624 | if (!capable(CAP_SYS_ADMIN)) |
| 625 | return -EPERM; | 625 | return -EPERM; |
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 886b5df7c9d1..d5ec05f56adf 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
| @@ -955,7 +955,7 @@ static int tvp5150_command(struct i2c_client *c, | |||
| 955 | { | 955 | { |
| 956 | struct v4l2_register *reg = arg; | 956 | struct v4l2_register *reg = arg; |
| 957 | 957 | ||
| 958 | if (reg->i2c_id != I2C_DRIVERID_TVP5150) | 958 | if (!v4l2_chip_match_i2c_client(c, reg->match_type, reg->match_chip)) |
| 959 | return -EINVAL; | 959 | return -EINVAL; |
| 960 | if (!capable(CAP_SYS_ADMIN)) | 960 | if (!capable(CAP_SYS_ADMIN)) |
| 961 | return -EPERM; | 961 | return -EPERM; |
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index b3b5fd536dc3..28d1133a3b7a 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c | |||
| @@ -167,7 +167,7 @@ static int upd64031a_command(struct i2c_client *client, unsigned int cmd, void * | |||
| 167 | { | 167 | { |
| 168 | struct v4l2_register *reg = arg; | 168 | struct v4l2_register *reg = arg; |
| 169 | 169 | ||
| 170 | if (reg->i2c_id != I2C_DRIVERID_UPD64031A) | 170 | if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) |
| 171 | return -EINVAL; | 171 | return -EINVAL; |
| 172 | if (!capable(CAP_SYS_ADMIN)) | 172 | if (!capable(CAP_SYS_ADMIN)) |
| 173 | return -EPERM; | 173 | return -EPERM; |
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c index 8852903e7a92..fe38224150d8 100644 --- a/drivers/media/video/upd64083.c +++ b/drivers/media/video/upd64083.c | |||
| @@ -144,7 +144,7 @@ static int upd64083_command(struct i2c_client *client, unsigned int cmd, void *a | |||
| 144 | { | 144 | { |
| 145 | struct v4l2_register *reg = arg; | 145 | struct v4l2_register *reg = arg; |
| 146 | 146 | ||
| 147 | if (reg->i2c_id != I2C_DRIVERID_UPD64083) | 147 | if (!v4l2_chip_match_i2c_client(client, reg->match_type, reg->match_chip)) |
| 148 | return -EINVAL; | 148 | return -EINVAL; |
| 149 | if (!capable(CAP_SYS_ADMIN)) | 149 | if (!capable(CAP_SYS_ADMIN)) |
| 150 | return -EPERM; | 150 | return -EPERM; |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index ae5f42562c0c..6fc14557d623 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
| @@ -521,7 +521,7 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
| 521 | struct v4l2_register *reg = arg; | 521 | struct v4l2_register *reg = arg; |
| 522 | int errCode; | 522 | int errCode; |
| 523 | 523 | ||
| 524 | if (reg->i2c_id != 0) | 524 | if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) |
| 525 | return -EINVAL; | 525 | return -EINVAL; |
| 526 | if (!capable(CAP_SYS_ADMIN)) | 526 | if (!capable(CAP_SYS_ADMIN)) |
| 527 | return -EPERM; | 527 | return -EPERM; |
| @@ -540,7 +540,7 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
| 540 | 540 | ||
| 541 | PDEBUG(DBG_IOCTL, "VIDIOC_DBG_%c_REGISTER reg=0x%02X, value=0x%02X", | 541 | PDEBUG(DBG_IOCTL, "VIDIOC_DBG_%c_REGISTER reg=0x%02X, value=0x%02X", |
| 542 | cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S', | 542 | cmd == VIDIOC_DBG_G_REGISTER ? 'G' : 'S', |
| 543 | (unsigned int)reg->reg, reg->val); | 543 | (unsigned int)reg->reg, (unsigned int)reg->val); |
| 544 | return 0; | 544 | return 0; |
| 545 | } | 545 | } |
| 546 | #endif | 546 | #endif |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index ddfd80c5618b..54747606eae1 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | #include <linux/mm.h> | 51 | #include <linux/mm.h> |
| 52 | #include <linux/string.h> | 52 | #include <linux/string.h> |
| 53 | #include <linux/errno.h> | 53 | #include <linux/errno.h> |
| 54 | #include <linux/i2c.h> | ||
| 54 | #include <asm/uaccess.h> | 55 | #include <asm/uaccess.h> |
| 55 | #include <asm/system.h> | 56 | #include <asm/system.h> |
| 56 | #include <asm/pgtable.h> | 57 | #include <asm/pgtable.h> |
| @@ -365,13 +366,21 @@ static const char *v4l2_ioctls[] = { | |||
| 365 | [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT", | 366 | [_IOC_NR(VIDIOC_ENUMAUDOUT)] = "VIDIOC_ENUMAUDOUT", |
| 366 | [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY", | 367 | [_IOC_NR(VIDIOC_G_PRIORITY)] = "VIDIOC_G_PRIORITY", |
| 367 | [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY", | 368 | [_IOC_NR(VIDIOC_S_PRIORITY)] = "VIDIOC_S_PRIORITY", |
| 368 | #if 1 | ||
| 369 | [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP", | 369 | [_IOC_NR(VIDIOC_G_SLICED_VBI_CAP)] = "VIDIOC_G_SLICED_VBI_CAP", |
| 370 | #endif | ||
| 371 | [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS", | 370 | [_IOC_NR(VIDIOC_LOG_STATUS)] = "VIDIOC_LOG_STATUS", |
| 372 | [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS", | 371 | [_IOC_NR(VIDIOC_G_EXT_CTRLS)] = "VIDIOC_G_EXT_CTRLS", |
| 373 | [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS", | 372 | [_IOC_NR(VIDIOC_S_EXT_CTRLS)] = "VIDIOC_S_EXT_CTRLS", |
| 374 | [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS" | 373 | [_IOC_NR(VIDIOC_TRY_EXT_CTRLS)] = "VIDIOC_TRY_EXT_CTRLS", |
| 374 | #if 1 | ||
| 375 | [_IOC_NR(VIDIOC_ENUM_FRAMESIZES)] = "VIDIOC_ENUM_FRAMESIZES", | ||
| 376 | [_IOC_NR(VIDIOC_ENUM_FRAMEINTERVALS)] = "VIDIOC_ENUM_FRAMEINTERVALS", | ||
| 377 | [_IOC_NR(VIDIOC_G_ENC_INDEX)] = "VIDIOC_G_ENC_INDEX", | ||
| 378 | [_IOC_NR(VIDIOC_ENCODER_CMD)] = "VIDIOC_ENCODER_CMD", | ||
| 379 | [_IOC_NR(VIDIOC_TRY_ENCODER_CMD)] = "VIDIOC_TRY_ENCODER_CMD", | ||
| 380 | |||
| 381 | [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", | ||
| 382 | [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", | ||
| 383 | #endif | ||
| 375 | }; | 384 | }; |
| 376 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | 385 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) |
| 377 | 386 | ||
| @@ -395,9 +404,6 @@ static const char *v4l2_int_ioctls[] = { | |||
| 395 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", | 404 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", |
| 396 | [_IOC_NR(TDA9887_SET_CONFIG)] = "TDA9887_SET_CONFIG", | 405 | [_IOC_NR(TDA9887_SET_CONFIG)] = "TDA9887_SET_CONFIG", |
| 397 | 406 | ||
| 398 | [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", | ||
| 399 | [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", | ||
| 400 | |||
| 401 | [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE", | 407 | [_IOC_NR(VIDIOC_INT_S_TUNER_MODE)] = "VIDIOC_INT_S_TUNER_MODE", |
| 402 | [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET", | 408 | [_IOC_NR(VIDIOC_INT_RESET)] = "VIDIOC_INT_RESET", |
| 403 | [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ", | 409 | [_IOC_NR(VIDIOC_INT_AUDIO_CLOCK_FREQ)] = "VIDIOC_INT_AUDIO_CLOCK_FREQ", |
| @@ -947,6 +953,28 @@ u32 v4l2_ctrl_next(const u32 * const * ctrl_classes, u32 id) | |||
| 947 | return **ctrl_classes; | 953 | return **ctrl_classes; |
| 948 | } | 954 | } |
| 949 | 955 | ||
| 956 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_chip) | ||
| 957 | { | ||
| 958 | switch (match_type) { | ||
| 959 | case V4L2_CHIP_MATCH_I2C_DRIVER: | ||
| 960 | return (c != NULL && c->driver != NULL && c->driver->id == match_chip); | ||
| 961 | case V4L2_CHIP_MATCH_I2C_ADDR: | ||
| 962 | return (c != NULL && c->addr == match_chip); | ||
| 963 | default: | ||
| 964 | return 0; | ||
| 965 | } | ||
| 966 | } | ||
| 967 | |||
| 968 | int v4l2_chip_match_host(u32 match_type, u32 match_chip) | ||
| 969 | { | ||
| 970 | switch (match_type) { | ||
| 971 | case V4L2_CHIP_MATCH_HOST: | ||
| 972 | return match_chip == 0; | ||
| 973 | default: | ||
| 974 | return 0; | ||
| 975 | } | ||
| 976 | } | ||
| 977 | |||
| 950 | /* ----------------------------------------------------------------- */ | 978 | /* ----------------------------------------------------------------- */ |
| 951 | 979 | ||
| 952 | EXPORT_SYMBOL(v4l2_norm_to_name); | 980 | EXPORT_SYMBOL(v4l2_norm_to_name); |
| @@ -970,6 +998,9 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu); | |||
| 970 | EXPORT_SYMBOL(v4l2_ctrl_query_fill); | 998 | EXPORT_SYMBOL(v4l2_ctrl_query_fill); |
| 971 | EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); | 999 | EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); |
| 972 | 1000 | ||
| 1001 | EXPORT_SYMBOL(v4l2_chip_match_i2c_client); | ||
| 1002 | EXPORT_SYMBOL(v4l2_chip_match_host); | ||
| 1003 | |||
| 973 | /* | 1004 | /* |
| 974 | * Local variables: | 1005 | * Local variables: |
| 975 | * c-basic-offset: 8 | 1006 | * c-basic-offset: 8 |
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index dc9b1ef678aa..011938fb7e0e 100644 --- a/drivers/media/video/videodev.c +++ b/drivers/media/video/videodev.c | |||
| @@ -1342,6 +1342,42 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, | |||
| 1342 | ret=vfd->vidioc_s_jpegcomp(file, fh, p); | 1342 | ret=vfd->vidioc_s_jpegcomp(file, fh, p); |
| 1343 | break; | 1343 | break; |
| 1344 | } | 1344 | } |
| 1345 | case VIDIOC_G_ENC_INDEX: | ||
| 1346 | { | ||
| 1347 | struct v4l2_enc_idx *p=arg; | ||
| 1348 | |||
| 1349 | if (!vfd->vidioc_g_enc_index) | ||
| 1350 | break; | ||
| 1351 | ret=vfd->vidioc_g_enc_index(file, fh, p); | ||
| 1352 | if (!ret) | ||
| 1353 | dbgarg (cmd, "entries=%d, entries_cap=%d\n", | ||
| 1354 | p->entries,p->entries_cap); | ||
| 1355 | break; | ||
| 1356 | } | ||
| 1357 | case VIDIOC_ENCODER_CMD: | ||
| 1358 | { | ||
| 1359 | struct v4l2_encoder_cmd *p=arg; | ||
| 1360 | |||
| 1361 | if (!vfd->vidioc_encoder_cmd) | ||
| 1362 | break; | ||
| 1363 | ret=vfd->vidioc_encoder_cmd(file, fh, p); | ||
| 1364 | if (!ret) | ||
| 1365 | dbgarg (cmd, "cmd=%d, flags=%d\n", | ||
| 1366 | p->cmd,p->flags); | ||
| 1367 | break; | ||
| 1368 | } | ||
| 1369 | case VIDIOC_TRY_ENCODER_CMD: | ||
| 1370 | { | ||
| 1371 | struct v4l2_encoder_cmd *p=arg; | ||
| 1372 | |||
| 1373 | if (!vfd->vidioc_try_encoder_cmd) | ||
| 1374 | break; | ||
| 1375 | ret=vfd->vidioc_try_encoder_cmd(file, fh, p); | ||
| 1376 | if (!ret) | ||
| 1377 | dbgarg (cmd, "cmd=%d, flags=%d\n", | ||
| 1378 | p->cmd,p->flags); | ||
| 1379 | break; | ||
| 1380 | } | ||
| 1345 | case VIDIOC_G_PARM: | 1381 | case VIDIOC_G_PARM: |
| 1346 | { | 1382 | { |
| 1347 | struct v4l2_streamparm *p=arg; | 1383 | struct v4l2_streamparm *p=arg; |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 65a165f918c9..441b877bf150 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
| @@ -1193,6 +1193,55 @@ struct v4l2_audioout | |||
| 1193 | }; | 1193 | }; |
| 1194 | 1194 | ||
| 1195 | /* | 1195 | /* |
| 1196 | * M P E G S E R V I C E S | ||
| 1197 | * | ||
| 1198 | * NOTE: EXPERIMENTAL API | ||
| 1199 | */ | ||
| 1200 | #if 1 | ||
| 1201 | #define V4L2_ENC_IDX_FRAME_I (0) | ||
| 1202 | #define V4L2_ENC_IDX_FRAME_P (1) | ||
| 1203 | #define V4L2_ENC_IDX_FRAME_B (2) | ||
| 1204 | #define V4L2_ENC_IDX_FRAME_MASK (0xf) | ||
| 1205 | |||
| 1206 | struct v4l2_enc_idx_entry { | ||
| 1207 | __u64 offset; | ||
| 1208 | __u64 pts; | ||
| 1209 | __u32 length; | ||
| 1210 | __u32 flags; | ||
| 1211 | __u32 reserved[2]; | ||
| 1212 | }; | ||
| 1213 | |||
| 1214 | #define V4L2_ENC_IDX_ENTRIES (64) | ||
| 1215 | struct v4l2_enc_idx { | ||
| 1216 | __u32 entries; | ||
| 1217 | __u32 entries_cap; | ||
| 1218 | __u32 reserved[4]; | ||
| 1219 | struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; | ||
| 1220 | }; | ||
| 1221 | |||
| 1222 | |||
| 1223 | #define V4L2_ENC_CMD_START (0) | ||
| 1224 | #define V4L2_ENC_CMD_STOP (1) | ||
| 1225 | #define V4L2_ENC_CMD_PAUSE (2) | ||
| 1226 | #define V4L2_ENC_CMD_RESUME (3) | ||
| 1227 | |||
| 1228 | /* Flags for V4L2_ENC_CMD_STOP */ | ||
| 1229 | #define V4L2_ENC_CMD_STOP_AT_GOP_END (1 << 0) | ||
| 1230 | |||
| 1231 | struct v4l2_encoder_cmd { | ||
| 1232 | __u32 cmd; | ||
| 1233 | __u32 flags; | ||
| 1234 | union { | ||
| 1235 | struct { | ||
| 1236 | __u32 data[8]; | ||
| 1237 | } raw; | ||
| 1238 | }; | ||
| 1239 | }; | ||
| 1240 | |||
| 1241 | #endif | ||
| 1242 | |||
| 1243 | |||
| 1244 | /* | ||
| 1196 | * D A T A S E R V I C E S ( V B I ) | 1245 | * D A T A S E R V I C E S ( V B I ) |
| 1197 | * | 1246 | * |
| 1198 | * Data services API by Michael Schimek | 1247 | * Data services API by Michael Schimek |
| @@ -1303,13 +1352,21 @@ struct v4l2_streamparm | |||
| 1303 | 1352 | ||
| 1304 | /* | 1353 | /* |
| 1305 | * A D V A N C E D D E B U G G I N G | 1354 | * A D V A N C E D D E B U G G I N G |
| 1355 | * | ||
| 1356 | * NOTE: EXPERIMENTAL API | ||
| 1306 | */ | 1357 | */ |
| 1307 | 1358 | ||
| 1308 | /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ | 1359 | /* VIDIOC_DBG_G_REGISTER and VIDIOC_DBG_S_REGISTER */ |
| 1360 | |||
| 1361 | #define V4L2_CHIP_MATCH_HOST 0 /* Match against chip ID on host (0 for the host) */ | ||
| 1362 | #define V4L2_CHIP_MATCH_I2C_DRIVER 1 /* Match against I2C driver ID */ | ||
| 1363 | #define V4L2_CHIP_MATCH_I2C_ADDR 2 /* Match against I2C 7-bit address */ | ||
| 1364 | |||
| 1309 | struct v4l2_register { | 1365 | struct v4l2_register { |
| 1366 | __u32 match_type; /* Match type */ | ||
| 1367 | __u32 match_chip; /* Match this chip, meaning determined by match_type */ | ||
| 1310 | __u64 reg; | 1368 | __u64 reg; |
| 1311 | __u32 i2c_id; /* I2C driver ID of the I2C chip, or 0 for the host */ | 1369 | __u64 val; |
| 1312 | __u32 val; | ||
| 1313 | }; | 1370 | }; |
| 1314 | 1371 | ||
| 1315 | /* | 1372 | /* |
| @@ -1378,10 +1435,14 @@ struct v4l2_register { | |||
| 1378 | #if 1 | 1435 | #if 1 |
| 1379 | #define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) | 1436 | #define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum) |
| 1380 | #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) | 1437 | #define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum) |
| 1438 | #define VIDIOC_G_ENC_INDEX _IOR ('V', 76, struct v4l2_enc_idx) | ||
| 1439 | #define VIDIOC_ENCODER_CMD _IOWR ('V', 77, struct v4l2_encoder_cmd) | ||
| 1440 | #define VIDIOC_TRY_ENCODER_CMD _IOWR ('V', 78, struct v4l2_encoder_cmd) | ||
| 1441 | |||
| 1442 | /* Experimental, only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ | ||
| 1443 | #define VIDIOC_DBG_S_REGISTER _IOW ('V', 79, struct v4l2_register) | ||
| 1444 | #define VIDIOC_DBG_G_REGISTER _IOWR ('V', 80, struct v4l2_register) | ||
| 1381 | #endif | 1445 | #endif |
| 1382 | /* only implemented if CONFIG_VIDEO_ADV_DEBUG is defined */ | ||
| 1383 | #define VIDIOC_DBG_S_REGISTER _IOW ('d', 100, struct v4l2_register) | ||
| 1384 | #define VIDIOC_DBG_G_REGISTER _IOWR('d', 101, struct v4l2_register) | ||
| 1385 | 1446 | ||
| 1386 | #ifdef __OLD_VIDIOC_ | 1447 | #ifdef __OLD_VIDIOC_ |
| 1387 | /* for compatibility, will go away some day */ | 1448 | /* for compatibility, will go away some day */ |
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 244e440edb53..6eaeec98ed89 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
| @@ -94,6 +94,14 @@ u32 v4l2_ctrl_next(const u32 * const *ctrl_classes, u32 id); | |||
| 94 | 94 | ||
| 95 | /* ------------------------------------------------------------------------- */ | 95 | /* ------------------------------------------------------------------------- */ |
| 96 | 96 | ||
| 97 | /* Register/chip ident helper function */ | ||
| 98 | |||
| 99 | struct i2c_client; /* forward reference */ | ||
| 100 | int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 id_type, u32 chip_id); | ||
| 101 | int v4l2_chip_match_host(u32 id_type, u32 chip_id); | ||
| 102 | |||
| 103 | /* ------------------------------------------------------------------------- */ | ||
| 104 | |||
| 97 | /* Internal ioctls */ | 105 | /* Internal ioctls */ |
| 98 | 106 | ||
| 99 | /* VIDIOC_INT_DECODE_VBI_LINE */ | 107 | /* VIDIOC_INT_DECODE_VBI_LINE */ |
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index aeec56992ef5..1dd3d3239ecf 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
| @@ -271,6 +271,12 @@ struct video_device | |||
| 271 | struct v4l2_jpegcompression *a); | 271 | struct v4l2_jpegcompression *a); |
| 272 | int (*vidioc_s_jpegcomp) (struct file *file, void *fh, | 272 | int (*vidioc_s_jpegcomp) (struct file *file, void *fh, |
| 273 | struct v4l2_jpegcompression *a); | 273 | struct v4l2_jpegcompression *a); |
| 274 | int (*vidioc_g_enc_index) (struct file *file, void *fh, | ||
| 275 | struct v4l2_enc_idx *a); | ||
| 276 | int (*vidioc_encoder_cmd) (struct file *file, void *fh, | ||
| 277 | struct v4l2_encoder_cmd *a); | ||
| 278 | int (*vidioc_try_encoder_cmd) (struct file *file, void *fh, | ||
| 279 | struct v4l2_encoder_cmd *a); | ||
| 274 | 280 | ||
| 275 | /* Stream type-dependent parameter ioctls */ | 281 | /* Stream type-dependent parameter ioctls */ |
| 276 | int (*vidioc_g_parm) (struct file *file, void *fh, | 282 | int (*vidioc_g_parm) (struct file *file, void *fh, |
