Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:
- Some regression fixes at the audio part for devices with
cx23885/cx25840
- A DMA corruption fix at cx231xx
- two fixes at the winbond IR driver
- Several fixes for the EXYNOS media driver (s5p)
- two fixes at the OMAP3 preview driver
- one fix at the dvb core failure path
- an include missing (slab.h) at smiapp-core causing compilation
breakage
- em28xx was not loading the IR driver driver anymore.

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (31 commits)
[media] Revert "[media] V4L: JPEG class documentation corrections"
[media] s5p-fimc: Add missing FIMC-LITE file operations locking
[media] omap3isp: preview: Fix contrast and brightness handling
[media] omap3isp: preview: Fix output size computation depending on input format
[media] winbond-cir: Initialise timeout, driver_type and allowed_protos
[media] winbond-cir: Fix txandrx module info
[media] cx23885: Silence unknown command warnings
[media] cx23885: add support for HVR-1255 analog (cx23888 variant)
[media] cx23885: make analog support work for HVR_1250 (cx23885 variant)
[media] cx25840: fix vsrc/hsrc usage on cx23888 designs
[media] cx25840: fix regression in HVR-1800 analog audio
[media] cx25840: fix regression in analog support hue/saturation controls
[media] cx25840: fix regression in HVR-1800 analog support
[media] s5p-mfc: Fixed setup of custom controls in decoder and encoder
[media] cx231xx: don't DMA to random addresses
[media] em28xx: fix em28xx-rc load
[media] dvb-core: Release semaphore on error path dvb_register_device()
[media] s5p-fimc: Stop media entity pipeline if fimc_pipeline_validate fails
[media] s5p-fimc: Fix compiler warning in fimc-lite.c
[media] s5p-fimc: media_entity_pipeline_start() may fail
...

+286 -138
+1 -1
Documentation/DocBook/media/v4l/controls.xml
··· 3988 3988 from RGB to Y'CbCr color space. 3989 3989 </entry> 3990 3990 </row> 3991 - <row id = "v4l2-jpeg-chroma-subsampling"> 3991 + <row> 3992 3992 <entrytbl spanname="descr" cols="2"> 3993 3993 <tbody valign="top"> 3994 3994 <row>
-7
Documentation/DocBook/media/v4l/vidioc-g-ext-ctrls.xml
··· 284 284 processing controls. These controls are described in <xref 285 285 linkend="image-process-controls" />.</entry> 286 286 </row> 287 - <row> 288 - <entry><constant>V4L2_CTRL_CLASS_JPEG</constant></entry> 289 - <entry>0x9d0000</entry> 290 - <entry>The class containing JPEG compression controls. 291 - These controls are described in <xref 292 - linkend="jpeg-controls" />.</entry> 293 - </row> 294 287 </tbody> 295 288 </tgroup> 296 289 </table>
+1
drivers/media/dvb/dvb-core/dvbdev.c
··· 243 243 if (minor == MAX_DVB_MINORS) { 244 244 kfree(dvbdevfops); 245 245 kfree(dvbdev); 246 + up_write(&minor_rwsem); 246 247 mutex_unlock(&dvbdev_register_lock); 247 248 return -EINVAL; 248 249 }
+3 -1
drivers/media/rc/winbond-cir.c
··· 232 232 233 233 static bool txandrx; /* default = 0 */ 234 234 module_param(txandrx, bool, 0444); 235 - MODULE_PARM_DESC(invert, "Allow simultaneous TX and RX"); 235 + MODULE_PARM_DESC(txandrx, "Allow simultaneous TX and RX"); 236 236 237 237 static unsigned int wake_sc = 0x800F040C; 238 238 module_param(wake_sc, uint, 0644); ··· 1032 1032 data->dev->tx_ir = wbcir_tx; 1033 1033 data->dev->priv = data; 1034 1034 data->dev->dev.parent = &device->dev; 1035 + data->dev->timeout = MS_TO_NS(100); 1036 + data->dev->allowed_protos = RC_TYPE_ALL; 1035 1037 1036 1038 if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { 1037 1039 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
+2 -2
drivers/media/video/cx231xx/cx231xx-audio.c
··· 307 307 urb->context = dev; 308 308 urb->pipe = usb_rcvisocpipe(dev->udev, 309 309 dev->adev.end_point_addr); 310 - urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; 310 + urb->transfer_flags = URB_ISO_ASAP; 311 311 urb->transfer_buffer = dev->adev.transfer_buffer[i]; 312 312 urb->interval = 1; 313 313 urb->complete = cx231xx_audio_isocirq; ··· 368 368 urb->context = dev; 369 369 urb->pipe = usb_rcvbulkpipe(dev->udev, 370 370 dev->adev.end_point_addr); 371 - urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; 371 + urb->transfer_flags = 0; 372 372 urb->transfer_buffer = dev->adev.transfer_buffer[i]; 373 373 urb->complete = cx231xx_audio_bulkirq; 374 374 urb->transfer_buffer_length = sb_size;
+1 -1
drivers/media/video/cx231xx/cx231xx-vbi.c
··· 448 448 return -ENOMEM; 449 449 } 450 450 dev->vbi_mode.bulk_ctl.urb[i] = urb; 451 - urb->transfer_flags = URB_NO_TRANSFER_DMA_MAP; 451 + urb->transfer_flags = 0; 452 452 453 453 dev->vbi_mode.bulk_ctl.transfer_buffer[i] = 454 454 kzalloc(sb_size, GFP_KERNEL);
+79 -10
drivers/media/video/cx23885/cx23885-cards.c
··· 127 127 }, 128 128 [CX23885_BOARD_HAUPPAUGE_HVR1250] = { 129 129 .name = "Hauppauge WinTV-HVR1250", 130 + .porta = CX23885_ANALOG_VIDEO, 130 131 .portc = CX23885_MPEG_DVB, 132 + #ifdef MT2131_NO_ANALOG_SUPPORT_YET 133 + .tuner_type = TUNER_PHILIPS_TDA8290, 134 + .tuner_addr = 0x42, /* 0x84 >> 1 */ 135 + .tuner_bus = 1, 136 + #endif 137 + .force_bff = 1, 131 138 .input = {{ 139 + #ifdef MT2131_NO_ANALOG_SUPPORT_YET 132 140 .type = CX23885_VMUX_TELEVISION, 133 - .vmux = 0, 141 + .vmux = CX25840_VIN7_CH3 | 142 + CX25840_VIN5_CH2 | 143 + CX25840_VIN2_CH1, 144 + .amux = CX25840_AUDIO8, 134 145 .gpio0 = 0xff00, 135 146 }, { 136 - .type = CX23885_VMUX_DEBUG, 137 - .vmux = 0, 138 - .gpio0 = 0xff01, 139 - }, { 147 + #endif 140 148 .type = CX23885_VMUX_COMPOSITE1, 141 - .vmux = 1, 149 + .vmux = CX25840_VIN7_CH3 | 150 + CX25840_VIN4_CH2 | 151 + CX25840_VIN6_CH1, 152 + .amux = CX25840_AUDIO7, 142 153 .gpio0 = 0xff02, 143 154 }, { 144 155 .type = CX23885_VMUX_SVIDEO, 145 - .vmux = 2, 156 + .vmux = CX25840_VIN7_CH3 | 157 + CX25840_VIN4_CH2 | 158 + CX25840_VIN8_CH1 | 159 + CX25840_SVIDEO_ON, 160 + .amux = CX25840_AUDIO7, 146 161 .gpio0 = 0xff02, 147 162 } }, 148 163 }, ··· 282 267 }, 283 268 [CX23885_BOARD_HAUPPAUGE_HVR1255] = { 284 269 .name = "Hauppauge WinTV-HVR1255", 270 + .porta = CX23885_ANALOG_VIDEO, 285 271 .portc = CX23885_MPEG_DVB, 272 + .tuner_type = TUNER_ABSENT, 273 + .tuner_addr = 0x42, /* 0x84 >> 1 */ 274 + .force_bff = 1, 275 + .input = {{ 276 + .type = CX23885_VMUX_TELEVISION, 277 + .vmux = CX25840_VIN7_CH3 | 278 + CX25840_VIN5_CH2 | 279 + CX25840_VIN2_CH1 | 280 + CX25840_DIF_ON, 281 + .amux = CX25840_AUDIO8, 282 + }, { 283 + .type = CX23885_VMUX_COMPOSITE1, 284 + .vmux = CX25840_VIN7_CH3 | 285 + CX25840_VIN4_CH2 | 286 + CX25840_VIN6_CH1, 287 + .amux = CX25840_AUDIO7, 288 + }, { 289 + .type = CX23885_VMUX_SVIDEO, 290 + .vmux = CX25840_VIN7_CH3 | 291 + CX25840_VIN4_CH2 | 292 + CX25840_VIN8_CH1 | 293 + CX25840_SVIDEO_ON, 294 + .amux = CX25840_AUDIO7, 295 + } }, 296 + }, 297 + [CX23885_BOARD_HAUPPAUGE_HVR1255_22111] = { 298 + .name = "Hauppauge WinTV-HVR1255", 299 + .porta = CX23885_ANALOG_VIDEO, 300 + .portc = CX23885_MPEG_DVB, 301 + .tuner_type = TUNER_ABSENT, 302 + .tuner_addr = 0x42, /* 0x84 >> 1 */ 303 + .force_bff = 1, 304 + .input = {{ 305 + .type = CX23885_VMUX_TELEVISION, 306 + .vmux = CX25840_VIN7_CH3 | 307 + CX25840_VIN5_CH2 | 308 + CX25840_VIN2_CH1 | 309 + CX25840_DIF_ON, 310 + .amux = CX25840_AUDIO8, 311 + }, { 312 + .type = CX23885_VMUX_SVIDEO, 313 + .vmux = CX25840_VIN7_CH3 | 314 + CX25840_VIN4_CH2 | 315 + CX25840_VIN8_CH1 | 316 + CX25840_SVIDEO_ON, 317 + .amux = CX25840_AUDIO7, 318 + } }, 286 319 }, 287 320 [CX23885_BOARD_HAUPPAUGE_HVR1210] = { 288 321 .name = "Hauppauge WinTV-HVR1210", ··· 687 624 }, { 688 625 .subvendor = 0x0070, 689 626 .subdevice = 0x2259, 690 - .card = CX23885_BOARD_HAUPPAUGE_HVR1255, 627 + .card = CX23885_BOARD_HAUPPAUGE_HVR1255_22111, 691 628 }, { 692 629 .subvendor = 0x0070, 693 630 .subdevice = 0x2291, ··· 963 900 struct cx23885_dev *dev = port->dev; 964 901 u32 bitmask = 0; 965 902 966 - if (command == XC2028_RESET_CLK) 903 + if ((command == XC2028_RESET_CLK) || (command == XC2028_I2C_FLUSH)) 967 904 return 0; 968 905 969 906 if (command != 0) { ··· 1193 1130 case CX23885_BOARD_HAUPPAUGE_HVR1270: 1194 1131 case CX23885_BOARD_HAUPPAUGE_HVR1275: 1195 1132 case CX23885_BOARD_HAUPPAUGE_HVR1255: 1133 + case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: 1196 1134 case CX23885_BOARD_HAUPPAUGE_HVR1210: 1197 1135 /* GPIO-5 RF Control: 0 = RF1 Terrestrial, 1 = RF2 Cable */ 1198 1136 /* GPIO-6 I2C Gate which can isolate the demod from the bus */ ··· 1331 1267 case CX23885_BOARD_HAUPPAUGE_HVR1400: 1332 1268 case CX23885_BOARD_HAUPPAUGE_HVR1275: 1333 1269 case CX23885_BOARD_HAUPPAUGE_HVR1255: 1270 + case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: 1334 1271 case CX23885_BOARD_HAUPPAUGE_HVR1210: 1335 1272 /* FIXME: Implement me */ 1336 1273 break; ··· 1489 1424 case CX23885_BOARD_HAUPPAUGE_HVR1270: 1490 1425 case CX23885_BOARD_HAUPPAUGE_HVR1275: 1491 1426 case CX23885_BOARD_HAUPPAUGE_HVR1255: 1427 + case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: 1492 1428 case CX23885_BOARD_HAUPPAUGE_HVR1210: 1493 1429 case CX23885_BOARD_HAUPPAUGE_HVR1850: 1494 1430 case CX23885_BOARD_HAUPPAUGE_HVR1290: ··· 1577 1511 case CX23885_BOARD_HAUPPAUGE_HVR1270: 1578 1512 case CX23885_BOARD_HAUPPAUGE_HVR1275: 1579 1513 case CX23885_BOARD_HAUPPAUGE_HVR1255: 1514 + case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: 1580 1515 case CX23885_BOARD_HAUPPAUGE_HVR1210: 1581 1516 case CX23885_BOARD_COMPRO_VIDEOMATE_E800: 1582 1517 case CX23885_BOARD_HAUPPAUGE_HVR1290: ··· 1593 1526 */ 1594 1527 switch (dev->board) { 1595 1528 case CX23885_BOARD_TEVII_S470: 1596 - case CX23885_BOARD_HAUPPAUGE_HVR1250: 1597 1529 /* Currently only enabled for the integrated IR controller */ 1598 1530 if (!enable_885_ir) 1599 1531 break; 1532 + case CX23885_BOARD_HAUPPAUGE_HVR1250: 1600 1533 case CX23885_BOARD_HAUPPAUGE_HVR1800: 1601 1534 case CX23885_BOARD_HAUPPAUGE_HVR1800lp: 1602 1535 case CX23885_BOARD_HAUPPAUGE_HVR1700: ··· 1606 1539 case CX23885_BOARD_NETUP_DUAL_DVBS2_CI: 1607 1540 case CX23885_BOARD_NETUP_DUAL_DVB_T_C_CI_RF: 1608 1541 case CX23885_BOARD_COMPRO_VIDEOMATE_E800: 1542 + case CX23885_BOARD_HAUPPAUGE_HVR1255: 1543 + case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: 1609 1544 case CX23885_BOARD_HAUPPAUGE_HVR1270: 1610 1545 case CX23885_BOARD_HAUPPAUGE_HVR1850: 1611 1546 case CX23885_BOARD_MYGICA_X8506:
+6
drivers/media/video/cx23885/cx23885-dvb.c
··· 712 712 } 713 713 break; 714 714 case CX23885_BOARD_HAUPPAUGE_HVR1255: 715 + case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: 715 716 i2c_bus = &dev->i2c_bus[0]; 716 717 fe0->dvb.frontend = dvb_attach(s5h1411_attach, 717 718 &hcw_s5h1411_config, ··· 722 721 0x60, &dev->i2c_bus[1].i2c_adap, 723 722 &hauppauge_tda18271_config); 724 723 } 724 + 725 + tda18271_attach(&dev->ts1.analog_fe, 726 + 0x60, &dev->i2c_bus[1].i2c_adap, 727 + &hauppauge_tda18271_config); 728 + 725 729 break; 726 730 case CX23885_BOARD_HAUPPAUGE_HVR1800: 727 731 i2c_bus = &dev->i2c_bus[0];
+8 -1
drivers/media/video/cx23885/cx23885-video.c
··· 505 505 506 506 if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1800) || 507 507 (dev->board == CX23885_BOARD_MPX885) || 508 + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1250) || 509 + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) || 510 + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111) || 508 511 (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850)) { 509 512 /* Configure audio routing */ 510 513 v4l2_subdev_call(dev->sd_cx25840, audio, s_routing, ··· 1581 1578 1582 1579 fe = vfe->dvb.frontend; 1583 1580 1584 - if (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) 1581 + if ((dev->board == CX23885_BOARD_HAUPPAUGE_HVR1850) || 1582 + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255) || 1583 + (dev->board == CX23885_BOARD_HAUPPAUGE_HVR1255_22111)) 1585 1584 fe = &dev->ts1.analog_fe; 1586 1585 1587 1586 if (fe && fe->ops.tuner_ops.set_analog_params) { ··· 1613 1608 int ret; 1614 1609 1615 1610 switch (dev->board) { 1611 + case CX23885_BOARD_HAUPPAUGE_HVR1255: 1612 + case CX23885_BOARD_HAUPPAUGE_HVR1255_22111: 1616 1613 case CX23885_BOARD_HAUPPAUGE_HVR1850: 1617 1614 ret = cx23885_set_freq_via_ops(dev, f); 1618 1615 break;
+1
drivers/media/video/cx23885/cx23885.h
··· 90 90 #define CX23885_BOARD_MYGICA_X8507 33 91 91 #define CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL 34 92 92 #define CX23885_BOARD_TEVII_S471 35 93 + #define CX23885_BOARD_HAUPPAUGE_HVR1255_22111 36 93 94 94 95 #define GPIO_0 0x00000001 95 96 #define GPIO_1 0x00000002
+56 -20
drivers/media/video/cx25840/cx25840-core.c
··· 84 84 85 85 86 86 /* ----------------------------------------------------------------------- */ 87 - static void cx23885_std_setup(struct i2c_client *client); 87 + static void cx23888_std_setup(struct i2c_client *client); 88 88 89 89 int cx25840_write(struct i2c_client *client, u16 addr, u8 value) 90 90 { ··· 638 638 finish_wait(&state->fw_wait, &wait); 639 639 destroy_workqueue(q); 640 640 641 - /* Call the cx23885 specific std setup func, we no longer rely on 641 + /* Call the cx23888 specific std setup func, we no longer rely on 642 642 * the generic cx24840 func. 643 643 */ 644 - cx23885_std_setup(client); 644 + if (is_cx23888(state)) 645 + cx23888_std_setup(client); 646 + else 647 + cx25840_std_setup(client); 645 648 646 649 /* (re)set input */ 647 650 set_input(client, state->vid_input, state->aud_input); ··· 1106 1103 1107 1104 cx25840_write4(client, 0x410, 0xffff0dbf); 1108 1105 cx25840_write4(client, 0x414, 0x00137d03); 1109 - cx25840_write4(client, 0x418, 0x01008080); 1106 + 1107 + /* on the 887, 0x418 is HSCALE_CTRL, on the 888 it is 1108 + CHROMA_CTRL */ 1109 + if (is_cx23888(state)) 1110 + cx25840_write4(client, 0x418, 0x01008080); 1111 + else 1112 + cx25840_write4(client, 0x418, 0x01000000); 1113 + 1110 1114 cx25840_write4(client, 0x41c, 0x00000000); 1111 - cx25840_write4(client, 0x420, 0x001c3e0f); 1115 + 1116 + /* on the 887, 0x420 is CHROMA_CTRL, on the 888 it is 1117 + CRUSH_CTRL */ 1118 + if (is_cx23888(state)) 1119 + cx25840_write4(client, 0x420, 0x001c3e0f); 1120 + else 1121 + cx25840_write4(client, 0x420, 0x001c8282); 1122 + 1112 1123 cx25840_write4(client, 0x42c, 0x42600000); 1113 1124 cx25840_write4(client, 0x430, 0x0000039b); 1114 1125 cx25840_write4(client, 0x438, 0x00000000); ··· 1250 1233 cx25840_write4(client, 0x8d0, 0x1f063870); 1251 1234 } 1252 1235 1253 - if (is_cx2388x(state)) { 1236 + if (is_cx23888(state)) { 1254 1237 /* HVR1850 */ 1255 1238 /* AUD_IO_CTRL - I2S Input, Parallel1*/ 1256 1239 /* - Channel 1 src - Parallel1 (Merlin out) */ ··· 1315 1298 } 1316 1299 cx25840_and_or(client, 0x400, ~0xf, fmt); 1317 1300 cx25840_and_or(client, 0x403, ~0x3, pal_m); 1318 - if (is_cx2388x(state)) 1319 - cx23885_std_setup(client); 1301 + if (is_cx23888(state)) 1302 + cx23888_std_setup(client); 1320 1303 else 1321 1304 cx25840_std_setup(client); 1322 1305 if (!is_cx2583x(state)) ··· 1329 1312 static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl) 1330 1313 { 1331 1314 struct v4l2_subdev *sd = to_sd(ctrl); 1315 + struct cx25840_state *state = to_state(sd); 1332 1316 struct i2c_client *client = v4l2_get_subdevdata(sd); 1333 1317 1334 1318 switch (ctrl->id) { ··· 1342 1324 break; 1343 1325 1344 1326 case V4L2_CID_SATURATION: 1345 - cx25840_write(client, 0x420, ctrl->val << 1); 1346 - cx25840_write(client, 0x421, ctrl->val << 1); 1327 + if (is_cx23888(state)) { 1328 + cx25840_write(client, 0x418, ctrl->val << 1); 1329 + cx25840_write(client, 0x419, ctrl->val << 1); 1330 + } else { 1331 + cx25840_write(client, 0x420, ctrl->val << 1); 1332 + cx25840_write(client, 0x421, ctrl->val << 1); 1333 + } 1347 1334 break; 1348 1335 1349 1336 case V4L2_CID_HUE: 1350 - cx25840_write(client, 0x422, ctrl->val); 1337 + if (is_cx23888(state)) 1338 + cx25840_write(client, 0x41a, ctrl->val); 1339 + else 1340 + cx25840_write(client, 0x422, ctrl->val); 1351 1341 break; 1352 1342 1353 1343 default: ··· 1380 1354 fmt->field = V4L2_FIELD_INTERLACED; 1381 1355 fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; 1382 1356 1383 - Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; 1384 - Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; 1357 + if (is_cx23888(state)) { 1358 + Vsrc = (cx25840_read(client, 0x42a) & 0x3f) << 4; 1359 + Vsrc |= (cx25840_read(client, 0x429) & 0xf0) >> 4; 1360 + } else { 1361 + Vsrc = (cx25840_read(client, 0x476) & 0x3f) << 4; 1362 + Vsrc |= (cx25840_read(client, 0x475) & 0xf0) >> 4; 1363 + } 1385 1364 1386 - Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; 1387 - Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; 1365 + if (is_cx23888(state)) { 1366 + Hsrc = (cx25840_read(client, 0x426) & 0x3f) << 4; 1367 + Hsrc |= (cx25840_read(client, 0x425) & 0xf0) >> 4; 1368 + } else { 1369 + Hsrc = (cx25840_read(client, 0x472) & 0x3f) << 4; 1370 + Hsrc |= (cx25840_read(client, 0x471) & 0xf0) >> 4; 1371 + } 1388 1372 1389 1373 Vlines = fmt->height + (is_50Hz ? 4 : 7); 1390 1374 ··· 1818 1782 struct cx25840_state *state = to_state(sd); 1819 1783 struct i2c_client *client = v4l2_get_subdevdata(sd); 1820 1784 1821 - if (is_cx2388x(state)) 1822 - cx23885_std_setup(client); 1785 + if (is_cx23888(state)) 1786 + cx23888_std_setup(client); 1823 1787 1824 1788 return set_input(client, input, state->aud_input); 1825 1789 } ··· 1830 1794 struct cx25840_state *state = to_state(sd); 1831 1795 struct i2c_client *client = v4l2_get_subdevdata(sd); 1832 1796 1833 - if (is_cx2388x(state)) 1834 - cx23885_std_setup(client); 1797 + if (is_cx23888(state)) 1798 + cx23888_std_setup(client); 1835 1799 return set_input(client, state->vid_input, input); 1836 1800 } 1837 1801 ··· 4975 4939 } 4976 4940 } 4977 4941 4978 - static void cx23885_std_setup(struct i2c_client *client) 4942 + static void cx23888_std_setup(struct i2c_client *client) 4979 4943 { 4980 4944 struct cx25840_state *state = to_state(i2c_get_clientdata(client)); 4981 4945 v4l2_std_id std = state->std;
+1 -1
drivers/media/video/em28xx/em28xx-cards.c
··· 2893 2893 2894 2894 if (dev->board.has_dvb) 2895 2895 request_module("em28xx-dvb"); 2896 - if (dev->board.has_ir_i2c && !disable_ir) 2896 + if (dev->board.ir_codes && !disable_ir) 2897 2897 request_module("em28xx-rc"); 2898 2898 } 2899 2899
+3 -3
drivers/media/video/omap3isp/isppreview.c
··· 888 888 preview_config_contrast, 889 889 NULL, 890 890 offsetof(struct prev_params, contrast), 891 - 0, true, 891 + 0, 0, true, 892 892 }, /* OMAP3ISP_PREV_BRIGHTNESS */ { 893 893 preview_config_brightness, 894 894 NULL, 895 895 offsetof(struct prev_params, brightness), 896 - 0, true, 896 + 0, 0, true, 897 897 }, 898 898 }; 899 899 ··· 1102 1102 unsigned int elv = prev->crop.top + prev->crop.height - 1; 1103 1103 u32 features; 1104 1104 1105 - if (format->code == V4L2_MBUS_FMT_Y10_1X10) { 1105 + if (format->code != V4L2_MBUS_FMT_Y10_1X10) { 1106 1106 sph -= 2; 1107 1107 eph += 2; 1108 1108 slv -= 2;
+1
drivers/media/video/pms.c
··· 26 26 #include <linux/fs.h> 27 27 #include <linux/kernel.h> 28 28 #include <linux/mm.h> 29 + #include <linux/slab.h> 29 30 #include <linux/ioport.h> 30 31 #include <linux/init.h> 31 32 #include <linux/mutex.h>
+34 -35
drivers/media/video/s5p-fimc/fimc-capture.c
··· 350 350 if (pixm) 351 351 sizes[i] = max(size, pixm->plane_fmt[i].sizeimage); 352 352 else 353 - sizes[i] = size; 353 + sizes[i] = max_t(u32, size, frame->payload[i]); 354 + 354 355 allocators[i] = ctx->fimc_dev->alloc_ctx; 355 356 } 356 357 ··· 480 479 static int fimc_capture_open(struct file *file) 481 480 { 482 481 struct fimc_dev *fimc = video_drvdata(file); 483 - int ret = v4l2_fh_open(file); 484 - 485 - if (ret) 486 - return ret; 482 + int ret; 487 483 488 484 dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); 489 485 490 - /* Return if the corresponding video mem2mem node is already opened. */ 491 486 if (fimc_m2m_active(fimc)) 492 487 return -EBUSY; 493 488 494 489 set_bit(ST_CAPT_BUSY, &fimc->state); 495 - pm_runtime_get_sync(&fimc->pdev->dev); 490 + ret = pm_runtime_get_sync(&fimc->pdev->dev); 491 + if (ret < 0) 492 + return ret; 496 493 497 - if (++fimc->vid_cap.refcnt == 1) { 498 - ret = fimc_pipeline_initialize(&fimc->pipeline, 499 - &fimc->vid_cap.vfd->entity, true); 500 - if (ret < 0) { 501 - dev_err(&fimc->pdev->dev, 502 - "Video pipeline initialization failed\n"); 503 - pm_runtime_put_sync(&fimc->pdev->dev); 504 - fimc->vid_cap.refcnt--; 505 - v4l2_fh_release(file); 506 - clear_bit(ST_CAPT_BUSY, &fimc->state); 507 - return ret; 508 - } 509 - ret = fimc_capture_ctrls_create(fimc); 494 + ret = v4l2_fh_open(file); 495 + if (ret) 496 + return ret; 510 497 511 - if (!ret && !fimc->vid_cap.user_subdev_api) 512 - ret = fimc_capture_set_default_format(fimc); 498 + if (++fimc->vid_cap.refcnt != 1) 499 + return 0; 500 + 501 + ret = fimc_pipeline_initialize(&fimc->pipeline, 502 + &fimc->vid_cap.vfd->entity, true); 503 + if (ret < 0) { 504 + clear_bit(ST_CAPT_BUSY, &fimc->state); 505 + pm_runtime_put_sync(&fimc->pdev->dev); 506 + fimc->vid_cap.refcnt--; 507 + v4l2_fh_release(file); 508 + return ret; 513 509 } 510 + ret = fimc_capture_ctrls_create(fimc); 511 + 512 + if (!ret && !fimc->vid_cap.user_subdev_api) 513 + ret = fimc_capture_set_default_format(fimc); 514 + 514 515 return ret; 515 516 } 516 517 ··· 821 818 struct fimc_dev *fimc = video_drvdata(file); 822 819 struct fimc_ctx *ctx = fimc->vid_cap.ctx; 823 820 824 - if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) 825 - return -EINVAL; 826 - 827 821 return fimc_fill_format(&ctx->d_frame, f); 828 822 } 829 823 ··· 832 832 struct fimc_ctx *ctx = fimc->vid_cap.ctx; 833 833 struct v4l2_mbus_framefmt mf; 834 834 struct fimc_fmt *ffmt = NULL; 835 - 836 - if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) 837 - return -EINVAL; 838 835 839 836 if (pix->pixelformat == V4L2_PIX_FMT_JPEG) { 840 837 fimc_capture_try_format(ctx, &pix->width, &pix->height, ··· 884 887 struct fimc_fmt *s_fmt = NULL; 885 888 int ret, i; 886 889 887 - if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) 888 - return -EINVAL; 889 890 if (vb2_is_busy(&fimc->vid_cap.vbq)) 890 891 return -EBUSY; 891 892 ··· 919 924 pix->width = mf->width; 920 925 pix->height = mf->height; 921 926 } 927 + 922 928 fimc_adjust_mplane_format(ff->fmt, pix->width, pix->height, pix); 923 929 for (i = 0; i < ff->fmt->colplanes; i++) 924 - ff->payload[i] = 925 - (pix->width * pix->height * ff->fmt->depth[i]) / 8; 930 + ff->payload[i] = pix->plane_fmt[i].sizeimage; 926 931 927 932 set_frame_bounds(ff, pix->width, pix->height); 928 933 /* Reset the composition rectangle if not yet configured */ ··· 1040 1045 { 1041 1046 struct fimc_dev *fimc = video_drvdata(file); 1042 1047 struct fimc_pipeline *p = &fimc->pipeline; 1048 + struct v4l2_subdev *sd = p->subdevs[IDX_SENSOR]; 1043 1049 int ret; 1044 1050 1045 1051 if (fimc_capture_active(fimc)) 1046 1052 return -EBUSY; 1047 1053 1048 - media_entity_pipeline_start(&p->subdevs[IDX_SENSOR]->entity, 1049 - p->m_pipeline); 1054 + ret = media_entity_pipeline_start(&sd->entity, p->m_pipeline); 1055 + if (ret < 0) 1056 + return ret; 1050 1057 1051 1058 if (fimc->vid_cap.user_subdev_api) { 1052 1059 ret = fimc_pipeline_validate(fimc); 1053 - if (ret) 1060 + if (ret < 0) { 1061 + media_entity_pipeline_stop(&sd->entity); 1054 1062 return ret; 1063 + } 1055 1064 } 1056 1065 return vb2_streamon(&fimc->vid_cap.vbq, type); 1057 1066 }
+10 -9
drivers/media/video/s5p-fimc/fimc-core.c
··· 153 153 .colplanes = 2, 154 154 .flags = FMT_FLAGS_M2M, 155 155 }, { 156 - .name = "YUV 4:2:0 non-contiguous 2-planar, Y/CbCr", 156 + .name = "YUV 4:2:0 non-contig. 2p, Y/CbCr", 157 157 .fourcc = V4L2_PIX_FMT_NV12M, 158 158 .color = FIMC_FMT_YCBCR420, 159 159 .depth = { 8, 4 }, ··· 161 161 .colplanes = 2, 162 162 .flags = FMT_FLAGS_M2M, 163 163 }, { 164 - .name = "YUV 4:2:0 non-contiguous 3-planar, Y/Cb/Cr", 164 + .name = "YUV 4:2:0 non-contig. 3p, Y/Cb/Cr", 165 165 .fourcc = V4L2_PIX_FMT_YUV420M, 166 166 .color = FIMC_FMT_YCBCR420, 167 167 .depth = { 8, 2, 2 }, ··· 169 169 .colplanes = 3, 170 170 .flags = FMT_FLAGS_M2M, 171 171 }, { 172 - .name = "YUV 4:2:0 non-contiguous 2-planar, Y/CbCr, tiled", 172 + .name = "YUV 4:2:0 non-contig. 2p, tiled", 173 173 .fourcc = V4L2_PIX_FMT_NV12MT, 174 174 .color = FIMC_FMT_YCBCR420, 175 175 .depth = { 8, 4 }, ··· 641 641 if (!ctrls->ready) 642 642 return; 643 643 644 - mutex_lock(&ctrls->handler.lock); 644 + mutex_lock(ctrls->handler.lock); 645 645 v4l2_ctrl_activate(ctrls->rotate, active); 646 646 v4l2_ctrl_activate(ctrls->hflip, active); 647 647 v4l2_ctrl_activate(ctrls->vflip, active); ··· 660 660 ctx->hflip = 0; 661 661 ctx->vflip = 0; 662 662 } 663 - mutex_unlock(&ctrls->handler.lock); 663 + mutex_unlock(ctrls->handler.lock); 664 664 } 665 665 666 666 /* Update maximum value of the alpha color control */ ··· 741 741 pix->width = width; 742 742 743 743 for (i = 0; i < pix->num_planes; ++i) { 744 - u32 bpl = pix->plane_fmt[i].bytesperline; 745 - u32 *sizeimage = &pix->plane_fmt[i].sizeimage; 744 + struct v4l2_plane_pix_format *plane_fmt = &pix->plane_fmt[i]; 745 + u32 bpl = plane_fmt->bytesperline; 746 746 747 747 if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) 748 748 bpl = pix->width; /* Planar */ ··· 754 754 if (i == 0) /* Same bytesperline for each plane. */ 755 755 bytesperline = bpl; 756 756 757 - pix->plane_fmt[i].bytesperline = bytesperline; 758 - *sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; 757 + plane_fmt->bytesperline = bytesperline; 758 + plane_fmt->sizeimage = max((pix->width * pix->height * 759 + fmt->depth[i]) / 8, plane_fmt->sizeimage); 759 760 } 760 761 } 761 762
+52 -21
drivers/media/video/s5p-fimc/fimc-lite.c
··· 451 451 static int fimc_lite_open(struct file *file) 452 452 { 453 453 struct fimc_lite *fimc = video_drvdata(file); 454 - int ret = v4l2_fh_open(file); 454 + int ret; 455 455 456 - if (ret) 457 - return ret; 456 + if (mutex_lock_interruptible(&fimc->lock)) 457 + return -ERESTARTSYS; 458 458 459 459 set_bit(ST_FLITE_IN_USE, &fimc->state); 460 - pm_runtime_get_sync(&fimc->pdev->dev); 460 + ret = pm_runtime_get_sync(&fimc->pdev->dev); 461 + if (ret < 0) 462 + goto done; 461 463 462 - if (++fimc->ref_count != 1 || fimc->out_path != FIMC_IO_DMA) 463 - return ret; 464 + ret = v4l2_fh_open(file); 465 + if (ret < 0) 466 + goto done; 464 467 465 - ret = fimc_pipeline_initialize(&fimc->pipeline, &fimc->vfd->entity, 466 - true); 467 - if (ret < 0) { 468 - v4l2_err(fimc->vfd, "Video pipeline initialization failed\n"); 469 - pm_runtime_put_sync(&fimc->pdev->dev); 470 - fimc->ref_count--; 471 - v4l2_fh_release(file); 472 - clear_bit(ST_FLITE_IN_USE, &fimc->state); 468 + if (++fimc->ref_count == 1 && fimc->out_path == FIMC_IO_DMA) { 469 + ret = fimc_pipeline_initialize(&fimc->pipeline, 470 + &fimc->vfd->entity, true); 471 + if (ret < 0) { 472 + pm_runtime_put_sync(&fimc->pdev->dev); 473 + fimc->ref_count--; 474 + v4l2_fh_release(file); 475 + clear_bit(ST_FLITE_IN_USE, &fimc->state); 476 + } 477 + 478 + fimc_lite_clear_event_counters(fimc); 473 479 } 474 - 475 - fimc_lite_clear_event_counters(fimc); 480 + done: 481 + mutex_unlock(&fimc->lock); 476 482 return ret; 477 483 } 478 484 479 485 static int fimc_lite_close(struct file *file) 480 486 { 481 487 struct fimc_lite *fimc = video_drvdata(file); 488 + int ret; 489 + 490 + if (mutex_lock_interruptible(&fimc->lock)) 491 + return -ERESTARTSYS; 482 492 483 493 if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { 484 494 clear_bit(ST_FLITE_IN_USE, &fimc->state); ··· 502 492 if (fimc->ref_count == 0) 503 493 vb2_queue_release(&fimc->vb_queue); 504 494 505 - return v4l2_fh_release(file); 495 + ret = v4l2_fh_release(file); 496 + 497 + mutex_unlock(&fimc->lock); 498 + return ret; 506 499 } 507 500 508 501 static unsigned int fimc_lite_poll(struct file *file, 509 502 struct poll_table_struct *wait) 510 503 { 511 504 struct fimc_lite *fimc = video_drvdata(file); 512 - return vb2_poll(&fimc->vb_queue, file, wait); 505 + int ret; 506 + 507 + if (mutex_lock_interruptible(&fimc->lock)) 508 + return POLL_ERR; 509 + 510 + ret = vb2_poll(&fimc->vb_queue, file, wait); 511 + mutex_unlock(&fimc->lock); 512 + 513 + return ret; 513 514 } 514 515 515 516 static int fimc_lite_mmap(struct file *file, struct vm_area_struct *vma) 516 517 { 517 518 struct fimc_lite *fimc = video_drvdata(file); 518 - return vb2_mmap(&fimc->vb_queue, vma); 519 + int ret; 520 + 521 + if (mutex_lock_interruptible(&fimc->lock)) 522 + return -ERESTARTSYS; 523 + 524 + ret = vb2_mmap(&fimc->vb_queue, vma); 525 + mutex_unlock(&fimc->lock); 526 + 527 + return ret; 519 528 } 520 529 521 530 static const struct v4l2_file_operations fimc_lite_fops = { ··· 791 762 if (fimc_lite_active(fimc)) 792 763 return -EBUSY; 793 764 794 - media_entity_pipeline_start(&sensor->entity, p->m_pipeline); 765 + ret = media_entity_pipeline_start(&sensor->entity, p->m_pipeline); 766 + if (ret < 0) 767 + return ret; 795 768 796 769 ret = fimc_pipeline_validate(fimc); 797 770 if (ret) { ··· 1539 1508 return 0; 1540 1509 1541 1510 ret = fimc_lite_stop_capture(fimc, suspend); 1542 - if (ret) 1511 + if (ret < 0 || !fimc_lite_active(fimc)) 1543 1512 return ret; 1544 1513 1545 1514 return fimc_pipeline_shutdown(&fimc->pipeline);
+24 -24
drivers/media/video/s5p-fimc/fimc-mdevice.c
··· 193 193 194 194 int fimc_pipeline_shutdown(struct fimc_pipeline *p) 195 195 { 196 - struct media_entity *me = &p->subdevs[IDX_SENSOR]->entity; 196 + struct media_entity *me; 197 197 int ret; 198 198 199 + if (!p || !p->subdevs[IDX_SENSOR]) 200 + return -EINVAL; 201 + 202 + me = &p->subdevs[IDX_SENSOR]->entity; 199 203 mutex_lock(&me->parent->graph_mutex); 200 204 ret = __fimc_pipeline_shutdown(p); 201 205 mutex_unlock(&me->parent->graph_mutex); ··· 502 498 * @source: the source entity to create links to all fimc entities from 503 499 * @sensor: sensor subdev linked to FIMC[fimc_id] entity, may be null 504 500 * @pad: the source entity pad index 505 - * @fimc_id: index of the fimc device for which link should be enabled 501 + * @link_mask: bitmask of the fimc devices for which link should be enabled 506 502 */ 507 503 static int __fimc_md_create_fimc_sink_links(struct fimc_md *fmd, 508 504 struct media_entity *source, 509 505 struct v4l2_subdev *sensor, 510 - int pad, int fimc_id) 506 + int pad, int link_mask) 511 507 { 512 508 struct fimc_sensor_info *s_info; 513 509 struct media_entity *sink; ··· 524 520 if (!fmd->fimc[i]->variant->has_cam_if) 525 521 continue; 526 522 527 - flags = (i == fimc_id) ? MEDIA_LNK_FL_ENABLED : 0; 523 + flags = ((1 << i) & link_mask) ? MEDIA_LNK_FL_ENABLED : 0; 528 524 529 525 sink = &fmd->fimc[i]->vid_cap.subdev.entity; 530 526 ret = media_entity_create_link(source, pad, sink, ··· 556 552 if (!fmd->fimc_lite[i]) 557 553 continue; 558 554 559 - flags = (i == fimc_id) ? MEDIA_LNK_FL_ENABLED : 0; 555 + if (link_mask & (1 << (i + FIMC_MAX_DEVS))) 556 + flags = MEDIA_LNK_FL_ENABLED; 557 + else 558 + flags = 0; 560 559 561 560 sink = &fmd->fimc_lite[i]->subdev.entity; 562 561 ret = media_entity_create_link(source, pad, sink, ··· 621 614 struct s5p_fimc_isp_info *pdata; 622 615 struct fimc_sensor_info *s_info; 623 616 struct media_entity *source, *sink; 624 - int i, pad, fimc_id = 0; 625 - int ret = 0; 626 - u32 flags; 617 + int i, pad, fimc_id = 0, ret = 0; 618 + u32 flags, link_mask = 0; 627 619 628 620 for (i = 0; i < fmd->num_sensors; i++) { 629 621 if (fmd->sensor[i].subdev == NULL) ··· 674 668 if (source == NULL) 675 669 continue; 676 670 671 + link_mask = 1 << fimc_id++; 677 672 ret = __fimc_md_create_fimc_sink_links(fmd, source, sensor, 678 - pad, fimc_id++); 673 + pad, link_mask); 679 674 } 680 675 681 - fimc_id = 0; 682 676 for (i = 0; i < ARRAY_SIZE(fmd->csis); i++) { 683 677 if (fmd->csis[i].sd == NULL) 684 678 continue; 685 679 source = &fmd->csis[i].sd->entity; 686 680 pad = CSIS_PAD_SOURCE; 687 681 682 + link_mask = 1 << fimc_id++; 688 683 ret = __fimc_md_create_fimc_sink_links(fmd, source, NULL, 689 - pad, fimc_id++); 684 + pad, link_mask); 690 685 } 691 686 692 687 /* Create immutable links between each FIMC's subdev and video node */ ··· 741 734 } 742 735 743 736 static int __fimc_md_set_camclk(struct fimc_md *fmd, 744 - struct fimc_sensor_info *s_info, 745 - bool on) 737 + struct fimc_sensor_info *s_info, 738 + bool on) 746 739 { 747 740 struct s5p_fimc_isp_info *pdata = s_info->pdata; 748 741 struct fimc_camclk_info *camclk; ··· 751 744 if (WARN_ON(pdata->clk_id >= FIMC_MAX_CAMCLKS) || fmd == NULL) 752 745 return -EINVAL; 753 746 754 - if (s_info->clk_on == on) 755 - return 0; 756 747 camclk = &fmd->camclk[pdata->clk_id]; 757 748 758 - dbg("camclk %d, f: %lu, clk: %p, on: %d", 759 - pdata->clk_id, pdata->clk_frequency, camclk, on); 749 + dbg("camclk %d, f: %lu, use_count: %d, on: %d", 750 + pdata->clk_id, pdata->clk_frequency, camclk->use_count, on); 760 751 761 752 if (on) { 762 753 if (camclk->use_count > 0 && ··· 765 760 clk_set_rate(camclk->clock, pdata->clk_frequency); 766 761 camclk->frequency = pdata->clk_frequency; 767 762 ret = clk_enable(camclk->clock); 763 + dbg("Enabled camclk %d: f: %lu", pdata->clk_id, 764 + clk_get_rate(camclk->clock)); 768 765 } 769 - s_info->clk_on = 1; 770 - dbg("Enabled camclk %d: f: %lu", pdata->clk_id, 771 - clk_get_rate(camclk->clock)); 772 - 773 766 return ret; 774 767 } 775 768 ··· 776 773 777 774 if (--camclk->use_count == 0) { 778 775 clk_disable(camclk->clock); 779 - s_info->clk_on = 0; 780 776 dbg("Disabled camclk %d", pdata->clk_id); 781 777 } 782 778 return ret; ··· 791 789 * devices to which sensors can be attached, either directly or through 792 790 * the MIPI CSI receiver. The clock is allowed here to be used by 793 791 * multiple sensors concurrently if they use same frequency. 794 - * The per sensor subdev clk_on attribute helps to synchronize accesses 795 - * to the sclk_cam clocks from the video and media device nodes. 796 792 * This function should only be called when the graph mutex is held. 797 793 */ 798 794 int fimc_md_set_camclk(struct v4l2_subdev *sd, bool on)
-2
drivers/media/video/s5p-fimc/fimc-mdevice.h
··· 47 47 * @pdata: sensor's atrributes passed as media device's platform data 48 48 * @subdev: image sensor v4l2 subdev 49 49 * @host: fimc device the sensor is currently linked to 50 - * @clk_on: sclk_cam clock's state associated with this subdev 51 50 * 52 51 * This data structure applies to image sensor and the writeback subdevs. 53 52 */ ··· 54 55 struct s5p_fimc_isp_info *pdata; 55 56 struct v4l2_subdev *subdev; 56 57 struct fimc_dev *host; 57 - bool clk_on; 58 58 }; 59 59 60 60 /**
+1
drivers/media/video/s5p-mfc/s5p_mfc_dec.c
··· 996 996 997 997 for (i = 0; i < NUM_CTRLS; i++) { 998 998 if (IS_MFC51_PRIV(controls[i].id)) { 999 + memset(&cfg, 0, sizeof(struct v4l2_ctrl_config)); 999 1000 cfg.ops = &s5p_mfc_dec_ctrl_ops; 1000 1001 cfg.id = controls[i].id; 1001 1002 cfg.min = controls[i].minimum;
+1
drivers/media/video/s5p-mfc/s5p_mfc_enc.c
··· 1773 1773 } 1774 1774 for (i = 0; i < NUM_CTRLS; i++) { 1775 1775 if (IS_MFC51_PRIV(controls[i].id)) { 1776 + memset(&cfg, 0, sizeof(struct v4l2_ctrl_config)); 1776 1777 cfg.ops = &s5p_mfc_enc_ctrl_ops; 1777 1778 cfg.id = controls[i].id; 1778 1779 cfg.min = controls[i].minimum;
+1
drivers/media/video/smiapp/smiapp-core.c
··· 31 31 #include <linux/device.h> 32 32 #include <linux/gpio.h> 33 33 #include <linux/module.h> 34 + #include <linux/slab.h> 34 35 #include <linux/regulator/consumer.h> 35 36 #include <linux/slab.h> 36 37 #include <linux/v4l2-mediabus.h>