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

[media] v4l2-subdev: add support for the new enum_frame_size 'which' field

Support the new 'which' field in the enum_frame_size ops. Most drivers do not
need to be changed since they always returns the same enumeration regardless
of the 'which' field.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Acked-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Tested-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
5778e749 3f1ccf16

+63 -46
+19 -4
drivers/media/i2c/s5c73m3/s5c73m3-core.c
··· 1251 1251 struct v4l2_subdev_pad_config *cfg, 1252 1252 struct v4l2_subdev_frame_size_enum *fse) 1253 1253 { 1254 + struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); 1254 1255 int idx; 1255 1256 1256 1257 if (fse->pad == OIF_SOURCE_PAD) { ··· 1261 1260 switch (fse->code) { 1262 1261 case S5C73M3_JPEG_FMT: 1263 1262 case S5C73M3_ISP_FMT: { 1264 - struct v4l2_mbus_framefmt *mf = 1265 - v4l2_subdev_get_try_format(sd, cfg, OIF_ISP_PAD); 1263 + unsigned w, h; 1266 1264 1267 - fse->max_width = fse->min_width = mf->width; 1268 - fse->max_height = fse->min_height = mf->height; 1265 + if (fse->which == V4L2_SUBDEV_FORMAT_TRY) { 1266 + struct v4l2_mbus_framefmt *mf; 1267 + 1268 + mf = v4l2_subdev_get_try_format(sd, cfg, 1269 + OIF_ISP_PAD); 1270 + 1271 + w = mf->width; 1272 + h = mf->height; 1273 + } else { 1274 + const struct s5c73m3_frame_size *fs; 1275 + 1276 + fs = state->oif_pix_size[RES_ISP]; 1277 + w = fs->width; 1278 + h = fs->height; 1279 + } 1280 + fse->max_width = fse->min_width = w; 1281 + fse->max_height = fse->min_height = h; 1269 1282 return 0; 1270 1283 } 1271 1284 default:
+1
drivers/media/platform/am437x/am437x-vpfe.c
··· 1645 1645 fse.index = fsize->index; 1646 1646 fse.pad = 0; 1647 1647 fse.code = mbus.code; 1648 + fse.which = V4L2_SUBDEV_FORMAT_ACTIVE; 1648 1649 ret = v4l2_subdev_call(sdinfo->sd, pad, enum_frame_size, NULL, &fse); 1649 1650 if (ret) 1650 1651 return -EINVAL;
+2 -2
drivers/media/platform/omap3isp/ispccdc.c
··· 2195 2195 format.code = fse->code; 2196 2196 format.width = 1; 2197 2197 format.height = 1; 2198 - ccdc_try_format(ccdc, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 2198 + ccdc_try_format(ccdc, cfg, fse->pad, &format, fse->which); 2199 2199 fse->min_width = format.width; 2200 2200 fse->min_height = format.height; 2201 2201 ··· 2205 2205 format.code = fse->code; 2206 2206 format.width = -1; 2207 2207 format.height = -1; 2208 - ccdc_try_format(ccdc, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 2208 + ccdc_try_format(ccdc, cfg, fse->pad, &format, fse->which); 2209 2209 fse->max_width = format.width; 2210 2210 fse->max_height = format.height; 2211 2211
+2 -2
drivers/media/platform/omap3isp/ispccp2.c
··· 723 723 format.code = fse->code; 724 724 format.width = 1; 725 725 format.height = 1; 726 - ccp2_try_format(ccp2, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 726 + ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); 727 727 fse->min_width = format.width; 728 728 fse->min_height = format.height; 729 729 ··· 733 733 format.code = fse->code; 734 734 format.width = -1; 735 735 format.height = -1; 736 - ccp2_try_format(ccp2, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 736 + ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); 737 737 fse->max_width = format.width; 738 738 fse->max_height = format.height; 739 739
+2 -2
drivers/media/platform/omap3isp/ispcsi2.c
··· 944 944 format.code = fse->code; 945 945 format.width = 1; 946 946 format.height = 1; 947 - csi2_try_format(csi2, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 947 + csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); 948 948 fse->min_width = format.width; 949 949 fse->min_height = format.height; 950 950 ··· 954 954 format.code = fse->code; 955 955 format.width = -1; 956 956 format.height = -1; 957 - csi2_try_format(csi2, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 957 + csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); 958 958 fse->max_width = format.width; 959 959 fse->max_height = format.height; 960 960
+2 -2
drivers/media/platform/omap3isp/isppreview.c
··· 1905 1905 format.code = fse->code; 1906 1906 format.width = 1; 1907 1907 format.height = 1; 1908 - preview_try_format(prev, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 1908 + preview_try_format(prev, cfg, fse->pad, &format, fse->which); 1909 1909 fse->min_width = format.width; 1910 1910 fse->min_height = format.height; 1911 1911 ··· 1915 1915 format.code = fse->code; 1916 1916 format.width = -1; 1917 1917 format.height = -1; 1918 - preview_try_format(prev, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 1918 + preview_try_format(prev, cfg, fse->pad, &format, fse->which); 1919 1919 fse->max_width = format.width; 1920 1920 fse->max_height = format.height; 1921 1921
+2 -2
drivers/media/platform/omap3isp/ispresizer.c
··· 1451 1451 format.code = fse->code; 1452 1452 format.width = 1; 1453 1453 format.height = 1; 1454 - resizer_try_format(res, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 1454 + resizer_try_format(res, cfg, fse->pad, &format, fse->which); 1455 1455 fse->min_width = format.width; 1456 1456 fse->min_height = format.height; 1457 1457 ··· 1461 1461 format.code = fse->code; 1462 1462 format.width = -1; 1463 1463 format.height = -1; 1464 - resizer_try_format(res, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 1464 + resizer_try_format(res, cfg, fse->pad, &format, fse->which); 1465 1465 fse->max_width = format.width; 1466 1466 fse->max_height = format.height; 1467 1467
+3 -1
drivers/media/platform/vsp1/vsp1_hsit.c
··· 76 76 struct v4l2_subdev_pad_config *cfg, 77 77 struct v4l2_subdev_frame_size_enum *fse) 78 78 { 79 + struct vsp1_hsit *hsit = to_hsit(subdev); 79 80 struct v4l2_mbus_framefmt *format; 80 81 81 - format = v4l2_subdev_get_try_format(subdev, cfg, fse->pad); 82 + format = vsp1_entity_get_pad_format(&hsit->entity, cfg, fse->pad, 83 + fse->which); 82 84 83 85 if (fse->index || fse->code != format->code) 84 86 return -EINVAL;
+3 -1
drivers/media/platform/vsp1/vsp1_lif.c
··· 109 109 struct v4l2_subdev_pad_config *cfg, 110 110 struct v4l2_subdev_frame_size_enum *fse) 111 111 { 112 + struct vsp1_lif *lif = to_lif(subdev); 112 113 struct v4l2_mbus_framefmt *format; 113 114 114 - format = v4l2_subdev_get_try_format(subdev, cfg, LIF_PAD_SINK); 115 + format = vsp1_entity_get_pad_format(&lif->entity, cfg, LIF_PAD_SINK, 116 + fse->which); 115 117 116 118 if (fse->index || fse->code != format->code) 117 119 return -EINVAL;
+3 -1
drivers/media/platform/vsp1/vsp1_lut.c
··· 117 117 struct v4l2_subdev_pad_config *cfg, 118 118 struct v4l2_subdev_frame_size_enum *fse) 119 119 { 120 + struct vsp1_lut *lut = to_lut(subdev); 120 121 struct v4l2_mbus_framefmt *format; 121 122 122 - format = v4l2_subdev_get_try_format(subdev, cfg, fse->pad); 123 + format = vsp1_entity_get_pad_format(&lut->entity, cfg, 124 + fse->pad, fse->which); 123 125 124 126 if (fse->index || fse->code != format->code) 125 127 return -EINVAL;
+2 -1
drivers/media/platform/vsp1/vsp1_rwpf.c
··· 48 48 struct vsp1_rwpf *rwpf = to_rwpf(subdev); 49 49 struct v4l2_mbus_framefmt *format; 50 50 51 - format = v4l2_subdev_get_try_format(subdev, cfg, fse->pad); 51 + format = vsp1_entity_get_pad_format(&rwpf->entity, cfg, fse->pad, 52 + fse->which); 52 53 53 54 if (fse->index || fse->code != format->code) 54 55 return -EINVAL;
+3 -1
drivers/media/platform/vsp1/vsp1_sru.c
··· 200 200 struct v4l2_subdev_pad_config *cfg, 201 201 struct v4l2_subdev_frame_size_enum *fse) 202 202 { 203 + struct vsp1_sru *sru = to_sru(subdev); 203 204 struct v4l2_mbus_framefmt *format; 204 205 205 - format = v4l2_subdev_get_try_format(subdev, cfg, SRU_PAD_SINK); 206 + format = vsp1_entity_get_pad_format(&sru->entity, cfg, 207 + SRU_PAD_SINK, fse->which); 206 208 207 209 if (fse->index || fse->code != format->code) 208 210 return -EINVAL;
+3 -1
drivers/media/platform/vsp1/vsp1_uds.c
··· 204 204 struct v4l2_subdev_pad_config *cfg, 205 205 struct v4l2_subdev_frame_size_enum *fse) 206 206 { 207 + struct vsp1_uds *uds = to_uds(subdev); 207 208 struct v4l2_mbus_framefmt *format; 208 209 209 - format = v4l2_subdev_get_try_format(subdev, cfg, UDS_PAD_SINK); 210 + format = vsp1_entity_get_pad_format(&uds->entity, cfg, 211 + UDS_PAD_SINK, fse->which); 210 212 211 213 if (fse->index || fse->code != format->code) 212 214 return -EINVAL;
+2 -4
drivers/staging/media/davinci_vpfe/dm365_ipipe.c
··· 1548 1548 format.code = fse->code; 1549 1549 format.width = 1; 1550 1550 format.height = 1; 1551 - ipipe_try_format(ipipe, cfg, fse->pad, &format, 1552 - V4L2_SUBDEV_FORMAT_TRY); 1551 + ipipe_try_format(ipipe, cfg, fse->pad, &format, fse->which); 1553 1552 fse->min_width = format.width; 1554 1553 fse->min_height = format.height; 1555 1554 ··· 1558 1559 format.code = fse->code; 1559 1560 format.width = -1; 1560 1561 format.height = -1; 1561 - ipipe_try_format(ipipe, cfg, fse->pad, &format, 1562 - V4L2_SUBDEV_FORMAT_TRY); 1562 + ipipe_try_format(ipipe, cfg, fse->pad, &format, fse->which); 1563 1563 fse->max_width = format.width; 1564 1564 fse->max_height = format.height; 1565 1565
+2 -4
drivers/staging/media/davinci_vpfe/dm365_ipipeif.c
··· 653 653 format.code = fse->code; 654 654 format.width = 1; 655 655 format.height = 1; 656 - ipipeif_try_format(ipipeif, cfg, fse->pad, &format, 657 - V4L2_SUBDEV_FORMAT_TRY); 656 + ipipeif_try_format(ipipeif, cfg, fse->pad, &format, fse->which); 658 657 fse->min_width = format.width; 659 658 fse->min_height = format.height; 660 659 ··· 663 664 format.code = fse->code; 664 665 format.width = -1; 665 666 format.height = -1; 666 - ipipeif_try_format(ipipeif, cfg, fse->pad, &format, 667 - V4L2_SUBDEV_FORMAT_TRY); 667 + ipipeif_try_format(ipipeif, cfg, fse->pad, &format, fse->which); 668 668 fse->max_width = format.width; 669 669 fse->max_height = format.height; 670 670
+2 -2
drivers/staging/media/davinci_vpfe/dm365_isif.c
··· 1489 1489 format.format.code = fse->code; 1490 1490 format.format.width = 1; 1491 1491 format.format.height = 1; 1492 - format.which = V4L2_SUBDEV_FORMAT_TRY; 1492 + format.which = fse->which; 1493 1493 isif_try_format(isif, cfg, &format); 1494 1494 fse->min_width = format.format.width; 1495 1495 fse->min_height = format.format.height; ··· 1501 1501 format.format.code = fse->code; 1502 1502 format.format.width = -1; 1503 1503 format.format.height = -1; 1504 - format.which = V4L2_SUBDEV_FORMAT_TRY; 1504 + format.which = fse->which; 1505 1505 isif_try_format(isif, cfg, &format); 1506 1506 fse->max_width = format.format.width; 1507 1507 fse->max_height = format.format.height;
+2 -4
drivers/staging/media/davinci_vpfe/dm365_resizer.c
··· 1484 1484 format.code = fse->code; 1485 1485 format.width = 1; 1486 1486 format.height = 1; 1487 - resizer_try_format(sd, cfg, fse->pad, &format, 1488 - V4L2_SUBDEV_FORMAT_TRY); 1487 + resizer_try_format(sd, cfg, fse->pad, &format, fse->which); 1489 1488 fse->min_width = format.width; 1490 1489 fse->min_height = format.height; 1491 1490 ··· 1494 1495 format.code = fse->code; 1495 1496 format.width = -1; 1496 1497 format.height = -1; 1497 - resizer_try_format(sd, cfg, fse->pad, &format, 1498 - V4L2_SUBDEV_FORMAT_TRY); 1498 + resizer_try_format(sd, cfg, fse->pad, &format, fse->which); 1499 1499 fse->max_width = format.width; 1500 1500 fse->max_height = format.height; 1501 1501
+2 -2
drivers/staging/media/omap4iss/iss_csi2.c
··· 943 943 format.code = fse->code; 944 944 format.width = 1; 945 945 format.height = 1; 946 - csi2_try_format(csi2, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 946 + csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); 947 947 fse->min_width = format.width; 948 948 fse->min_height = format.height; 949 949 ··· 953 953 format.code = fse->code; 954 954 format.width = -1; 955 955 format.height = -1; 956 - csi2_try_format(csi2, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 956 + csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); 957 957 fse->max_width = format.width; 958 958 fse->max_height = format.height; 959 959
+2 -2
drivers/staging/media/omap4iss/iss_ipipe.c
··· 280 280 format.code = fse->code; 281 281 format.width = 1; 282 282 format.height = 1; 283 - ipipe_try_format(ipipe, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 283 + ipipe_try_format(ipipe, cfg, fse->pad, &format, fse->which); 284 284 fse->min_width = format.width; 285 285 fse->min_height = format.height; 286 286 ··· 290 290 format.code = fse->code; 291 291 format.width = -1; 292 292 format.height = -1; 293 - ipipe_try_format(ipipe, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 293 + ipipe_try_format(ipipe, cfg, fse->pad, &format, fse->which); 294 294 fse->max_width = format.width; 295 295 fse->max_height = format.height; 296 296
+2 -4
drivers/staging/media/omap4iss/iss_ipipeif.c
··· 492 492 format.code = fse->code; 493 493 format.width = 1; 494 494 format.height = 1; 495 - ipipeif_try_format(ipipeif, cfg, fse->pad, &format, 496 - V4L2_SUBDEV_FORMAT_TRY); 495 + ipipeif_try_format(ipipeif, cfg, fse->pad, &format, fse->which); 497 496 fse->min_width = format.width; 498 497 fse->min_height = format.height; 499 498 ··· 502 503 format.code = fse->code; 503 504 format.width = -1; 504 505 format.height = -1; 505 - ipipeif_try_format(ipipeif, cfg, fse->pad, &format, 506 - V4L2_SUBDEV_FORMAT_TRY); 506 + ipipeif_try_format(ipipeif, cfg, fse->pad, &format, fse->which); 507 507 fse->max_width = format.width; 508 508 fse->max_height = format.height; 509 509
+2 -4
drivers/staging/media/omap4iss/iss_resizer.c
··· 554 554 format.code = fse->code; 555 555 format.width = 1; 556 556 format.height = 1; 557 - resizer_try_format(resizer, cfg, fse->pad, &format, 558 - V4L2_SUBDEV_FORMAT_TRY); 557 + resizer_try_format(resizer, cfg, fse->pad, &format, fse->which); 559 558 fse->min_width = format.width; 560 559 fse->min_height = format.height; 561 560 ··· 564 565 format.code = fse->code; 565 566 format.width = -1; 566 567 format.height = -1; 567 - resizer_try_format(resizer, cfg, fse->pad, &format, 568 - V4L2_SUBDEV_FORMAT_TRY); 568 + resizer_try_format(resizer, cfg, fse->pad, &format, fse->which); 569 569 fse->max_width = format.width; 570 570 fse->max_height = format.height; 571 571