aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2015-03-04 04:47:54 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-03-23 14:41:36 -0400
commitf7234138f14c2296c5eb6b8224abe00b507faf3f (patch)
tree947508529c06cf0c3ff36a71071725ffdb83e3b1 /drivers/media/i2c
parent3d945be05ac1e806af075e9315bc1b3409adae2b (diff)
[media] v4l2-subdev: replace v4l2_subdev_fh by v4l2_subdev_pad_config
If a subdevice pad op is called from a bridge driver, then there is no v4l2_subdev_fh struct that can be passed to the subdevice. This made it hard to use such subdevs from a bridge driver. This patch replaces the v4l2_subdev_fh pointer by a v4l2_subdev_pad_config pointer in the pad ops. This allows bridge drivers to use the various try_ pad ops by creating a v4l2_subdev_pad_config struct and passing it along to the pad op. The v4l2_subdev_get_try_* macros had to be changed because of this, so I also took the opportunity to use the full name of the v4l2_subdev_get_try_* functions in the __V4L2_SUBDEV_MK_GET_TRY macro arguments: if you now do 'git grep v4l2_subdev_get_try_format' you will actually find the header where it is defined. One remark regarding the drivers/staging/media/davinci_vpfe patches: the *_init_formats() functions assumed that fh could be NULL. However, that's not true for this driver, it's always set. This is almost certainly a copy and paste from the omap3isp driver. I've updated the code to reflect the fact that fh is never NULL. 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: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/adv7180.c10
-rw-r--r--drivers/media/i2c/adv7511.c16
-rw-r--r--drivers/media/i2c/adv7604.c12
-rw-r--r--drivers/media/i2c/m5mols/m5mols_core.c16
-rw-r--r--drivers/media/i2c/mt9m032.c34
-rw-r--r--drivers/media/i2c/mt9p031.c36
-rw-r--r--drivers/media/i2c/mt9t001.c36
-rw-r--r--drivers/media/i2c/mt9v032.c36
-rw-r--r--drivers/media/i2c/noon010pc30.c17
-rw-r--r--drivers/media/i2c/ov9650.c16
-rw-r--r--drivers/media/i2c/s5c73m3/s5c73m3-core.c51
-rw-r--r--drivers/media/i2c/s5k4ecgx.c16
-rw-r--r--drivers/media/i2c/s5k5baf.c38
-rw-r--r--drivers/media/i2c/s5k6a3.c18
-rw-r--r--drivers/media/i2c/s5k6aa.c34
-rw-r--r--drivers/media/i2c/smiapp/smiapp-core.c80
-rw-r--r--drivers/media/i2c/tvp514x.c12
-rw-r--r--drivers/media/i2c/tvp7002.c14
18 files changed, 249 insertions, 243 deletions
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index b75878c27c2a..a493c0b0b5fe 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -582,7 +582,7 @@ static void adv7180_exit_controls(struct adv7180_state *state)
582} 582}
583 583
584static int adv7180_enum_mbus_code(struct v4l2_subdev *sd, 584static int adv7180_enum_mbus_code(struct v4l2_subdev *sd,
585 struct v4l2_subdev_fh *fh, 585 struct v4l2_subdev_pad_config *cfg,
586 struct v4l2_subdev_mbus_code_enum *code) 586 struct v4l2_subdev_mbus_code_enum *code)
587{ 587{
588 if (code->index != 0) 588 if (code->index != 0)
@@ -645,13 +645,13 @@ static int adv7180_set_field_mode(struct adv7180_state *state)
645} 645}
646 646
647static int adv7180_get_pad_format(struct v4l2_subdev *sd, 647static int adv7180_get_pad_format(struct v4l2_subdev *sd,
648 struct v4l2_subdev_fh *fh, 648 struct v4l2_subdev_pad_config *cfg,
649 struct v4l2_subdev_format *format) 649 struct v4l2_subdev_format *format)
650{ 650{
651 struct adv7180_state *state = to_state(sd); 651 struct adv7180_state *state = to_state(sd);
652 652
653 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 653 if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
654 format->format = *v4l2_subdev_get_try_format(fh, 0); 654 format->format = *v4l2_subdev_get_try_format(sd, cfg, 0);
655 } else { 655 } else {
656 adv7180_mbus_fmt(sd, &format->format); 656 adv7180_mbus_fmt(sd, &format->format);
657 format->format.field = state->field; 657 format->format.field = state->field;
@@ -661,7 +661,7 @@ static int adv7180_get_pad_format(struct v4l2_subdev *sd,
661} 661}
662 662
663static int adv7180_set_pad_format(struct v4l2_subdev *sd, 663static int adv7180_set_pad_format(struct v4l2_subdev *sd,
664 struct v4l2_subdev_fh *fh, 664 struct v4l2_subdev_pad_config *cfg,
665 struct v4l2_subdev_format *format) 665 struct v4l2_subdev_format *format)
666{ 666{
667 struct adv7180_state *state = to_state(sd); 667 struct adv7180_state *state = to_state(sd);
@@ -686,7 +686,7 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd,
686 adv7180_set_power(state, true); 686 adv7180_set_power(state, true);
687 } 687 }
688 } else { 688 } else {
689 framefmt = v4l2_subdev_get_try_format(fh, 0); 689 framefmt = v4l2_subdev_get_try_format(sd, cfg, 0);
690 *framefmt = format->format; 690 *framefmt = format->format;
691 } 691 }
692 692
diff --git a/drivers/media/i2c/adv7511.c b/drivers/media/i2c/adv7511.c
index 81736aaf0f31..03ea62f9c074 100644
--- a/drivers/media/i2c/adv7511.c
+++ b/drivers/media/i2c/adv7511.c
@@ -810,7 +810,7 @@ static int adv7511_get_edid(struct v4l2_subdev *sd, struct v4l2_edid *edid)
810} 810}
811 811
812static int adv7511_enum_mbus_code(struct v4l2_subdev *sd, 812static int adv7511_enum_mbus_code(struct v4l2_subdev *sd,
813 struct v4l2_subdev_fh *fh, 813 struct v4l2_subdev_pad_config *cfg,
814 struct v4l2_subdev_mbus_code_enum *code) 814 struct v4l2_subdev_mbus_code_enum *code)
815{ 815{
816 if (code->pad != 0) 816 if (code->pad != 0)
@@ -842,8 +842,9 @@ static void adv7511_fill_format(struct adv7511_state *state,
842 format->field = V4L2_FIELD_NONE; 842 format->field = V4L2_FIELD_NONE;
843} 843}
844 844
845static int adv7511_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 845static int adv7511_get_fmt(struct v4l2_subdev *sd,
846 struct v4l2_subdev_format *format) 846 struct v4l2_subdev_pad_config *cfg,
847 struct v4l2_subdev_format *format)
847{ 848{
848 struct adv7511_state *state = get_adv7511_state(sd); 849 struct adv7511_state *state = get_adv7511_state(sd);
849 850
@@ -855,7 +856,7 @@ static int adv7511_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
855 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 856 if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
856 struct v4l2_mbus_framefmt *fmt; 857 struct v4l2_mbus_framefmt *fmt;
857 858
858 fmt = v4l2_subdev_get_try_format(fh, format->pad); 859 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
859 format->format.code = fmt->code; 860 format->format.code = fmt->code;
860 format->format.colorspace = fmt->colorspace; 861 format->format.colorspace = fmt->colorspace;
861 format->format.ycbcr_enc = fmt->ycbcr_enc; 862 format->format.ycbcr_enc = fmt->ycbcr_enc;
@@ -870,8 +871,9 @@ static int adv7511_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
870 return 0; 871 return 0;
871} 872}
872 873
873static int adv7511_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 874static int adv7511_set_fmt(struct v4l2_subdev *sd,
874 struct v4l2_subdev_format *format) 875 struct v4l2_subdev_pad_config *cfg,
876 struct v4l2_subdev_format *format)
875{ 877{
876 struct adv7511_state *state = get_adv7511_state(sd); 878 struct adv7511_state *state = get_adv7511_state(sd);
877 /* 879 /*
@@ -905,7 +907,7 @@ static int adv7511_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
905 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 907 if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
906 struct v4l2_mbus_framefmt *fmt; 908 struct v4l2_mbus_framefmt *fmt;
907 909
908 fmt = v4l2_subdev_get_try_format(fh, format->pad); 910 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
909 fmt->code = format->format.code; 911 fmt->code = format->format.code;
910 fmt->colorspace = format->format.colorspace; 912 fmt->colorspace = format->format.colorspace;
911 fmt->ycbcr_enc = format->format.ycbcr_enc; 913 fmt->ycbcr_enc = format->format.ycbcr_enc;
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index aaab9c9cebee..1e58537c3ea3 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -1734,7 +1734,7 @@ static int adv76xx_s_routing(struct v4l2_subdev *sd,
1734} 1734}
1735 1735
1736static int adv76xx_enum_mbus_code(struct v4l2_subdev *sd, 1736static int adv76xx_enum_mbus_code(struct v4l2_subdev *sd,
1737 struct v4l2_subdev_fh *fh, 1737 struct v4l2_subdev_pad_config *cfg,
1738 struct v4l2_subdev_mbus_code_enum *code) 1738 struct v4l2_subdev_mbus_code_enum *code)
1739{ 1739{
1740 struct adv76xx_state *state = to_state(sd); 1740 struct adv76xx_state *state = to_state(sd);
@@ -1811,7 +1811,8 @@ static void adv76xx_setup_format(struct adv76xx_state *state)
1811 state->format->swap_cb_cr ? ADV76XX_OP_SWAP_CB_CR : 0); 1811 state->format->swap_cb_cr ? ADV76XX_OP_SWAP_CB_CR : 0);
1812} 1812}
1813 1813
1814static int adv76xx_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 1814static int adv76xx_get_format(struct v4l2_subdev *sd,
1815 struct v4l2_subdev_pad_config *cfg,
1815 struct v4l2_subdev_format *format) 1816 struct v4l2_subdev_format *format)
1816{ 1817{
1817 struct adv76xx_state *state = to_state(sd); 1818 struct adv76xx_state *state = to_state(sd);
@@ -1824,7 +1825,7 @@ static int adv76xx_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1824 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1825 if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
1825 struct v4l2_mbus_framefmt *fmt; 1826 struct v4l2_mbus_framefmt *fmt;
1826 1827
1827 fmt = v4l2_subdev_get_try_format(fh, format->pad); 1828 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
1828 format->format.code = fmt->code; 1829 format->format.code = fmt->code;
1829 } else { 1830 } else {
1830 format->format.code = state->format->code; 1831 format->format.code = state->format->code;
@@ -1833,7 +1834,8 @@ static int adv76xx_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1833 return 0; 1834 return 0;
1834} 1835}
1835 1836
1836static int adv76xx_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 1837static int adv76xx_set_format(struct v4l2_subdev *sd,
1838 struct v4l2_subdev_pad_config *cfg,
1837 struct v4l2_subdev_format *format) 1839 struct v4l2_subdev_format *format)
1838{ 1840{
1839 struct adv76xx_state *state = to_state(sd); 1841 struct adv76xx_state *state = to_state(sd);
@@ -1852,7 +1854,7 @@ static int adv76xx_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1852 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1854 if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
1853 struct v4l2_mbus_framefmt *fmt; 1855 struct v4l2_mbus_framefmt *fmt;
1854 1856
1855 fmt = v4l2_subdev_get_try_format(fh, format->pad); 1857 fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad);
1856 fmt->code = format->format.code; 1858 fmt->code = format->format.code;
1857 } else { 1859 } else {
1858 state->format = info; 1860 state->format = info;
diff --git a/drivers/media/i2c/m5mols/m5mols_core.c b/drivers/media/i2c/m5mols/m5mols_core.c
index 6ed16e569bbf..6404c0d93e7a 100644
--- a/drivers/media/i2c/m5mols/m5mols_core.c
+++ b/drivers/media/i2c/m5mols/m5mols_core.c
@@ -531,17 +531,17 @@ static int __find_resolution(struct v4l2_subdev *sd,
531} 531}
532 532
533static struct v4l2_mbus_framefmt *__find_format(struct m5mols_info *info, 533static struct v4l2_mbus_framefmt *__find_format(struct m5mols_info *info,
534 struct v4l2_subdev_fh *fh, 534 struct v4l2_subdev_pad_config *cfg,
535 enum v4l2_subdev_format_whence which, 535 enum v4l2_subdev_format_whence which,
536 enum m5mols_restype type) 536 enum m5mols_restype type)
537{ 537{
538 if (which == V4L2_SUBDEV_FORMAT_TRY) 538 if (which == V4L2_SUBDEV_FORMAT_TRY)
539 return fh ? v4l2_subdev_get_try_format(fh, 0) : NULL; 539 return cfg ? v4l2_subdev_get_try_format(&info->sd, cfg, 0) : NULL;
540 540
541 return &info->ffmt[type]; 541 return &info->ffmt[type];
542} 542}
543 543
544static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 544static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
545 struct v4l2_subdev_format *fmt) 545 struct v4l2_subdev_format *fmt)
546{ 546{
547 struct m5mols_info *info = to_m5mols(sd); 547 struct m5mols_info *info = to_m5mols(sd);
@@ -550,7 +550,7 @@ static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
550 550
551 mutex_lock(&info->lock); 551 mutex_lock(&info->lock);
552 552
553 format = __find_format(info, fh, fmt->which, info->res_type); 553 format = __find_format(info, cfg, fmt->which, info->res_type);
554 if (format) 554 if (format)
555 fmt->format = *format; 555 fmt->format = *format;
556 else 556 else
@@ -560,7 +560,7 @@ static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
560 return ret; 560 return ret;
561} 561}
562 562
563static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 563static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
564 struct v4l2_subdev_format *fmt) 564 struct v4l2_subdev_format *fmt)
565{ 565{
566 struct m5mols_info *info = to_m5mols(sd); 566 struct m5mols_info *info = to_m5mols(sd);
@@ -574,7 +574,7 @@ static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
574 if (ret < 0) 574 if (ret < 0)
575 return ret; 575 return ret;
576 576
577 sfmt = __find_format(info, fh, fmt->which, type); 577 sfmt = __find_format(info, cfg, fmt->which, type);
578 if (!sfmt) 578 if (!sfmt)
579 return 0; 579 return 0;
580 580
@@ -640,7 +640,7 @@ static int m5mols_set_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
640 640
641 641
642static int m5mols_enum_mbus_code(struct v4l2_subdev *sd, 642static int m5mols_enum_mbus_code(struct v4l2_subdev *sd,
643 struct v4l2_subdev_fh *fh, 643 struct v4l2_subdev_pad_config *cfg,
644 struct v4l2_subdev_mbus_code_enum *code) 644 struct v4l2_subdev_mbus_code_enum *code)
645{ 645{
646 if (!code || code->index >= SIZE_DEFAULT_FFMT) 646 if (!code || code->index >= SIZE_DEFAULT_FFMT)
@@ -895,7 +895,7 @@ static const struct v4l2_subdev_core_ops m5mols_core_ops = {
895 */ 895 */
896static int m5mols_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 896static int m5mols_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
897{ 897{
898 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(fh, 0); 898 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0);
899 899
900 *format = m5mols_default_ffmt[0]; 900 *format = m5mols_default_ffmt[0];
901 return 0; 901 return 0;
diff --git a/drivers/media/i2c/mt9m032.c b/drivers/media/i2c/mt9m032.c
index 76431223f0ff..c7747bd0cabb 100644
--- a/drivers/media/i2c/mt9m032.c
+++ b/drivers/media/i2c/mt9m032.c
@@ -317,7 +317,7 @@ static int mt9m032_setup_pll(struct mt9m032 *sensor)
317 */ 317 */
318 318
319static int mt9m032_enum_mbus_code(struct v4l2_subdev *subdev, 319static int mt9m032_enum_mbus_code(struct v4l2_subdev *subdev,
320 struct v4l2_subdev_fh *fh, 320 struct v4l2_subdev_pad_config *cfg,
321 struct v4l2_subdev_mbus_code_enum *code) 321 struct v4l2_subdev_mbus_code_enum *code)
322{ 322{
323 if (code->index != 0) 323 if (code->index != 0)
@@ -328,7 +328,7 @@ static int mt9m032_enum_mbus_code(struct v4l2_subdev *subdev,
328} 328}
329 329
330static int mt9m032_enum_frame_size(struct v4l2_subdev *subdev, 330static int mt9m032_enum_frame_size(struct v4l2_subdev *subdev,
331 struct v4l2_subdev_fh *fh, 331 struct v4l2_subdev_pad_config *cfg,
332 struct v4l2_subdev_frame_size_enum *fse) 332 struct v4l2_subdev_frame_size_enum *fse)
333{ 333{
334 if (fse->index != 0 || fse->code != MEDIA_BUS_FMT_Y8_1X8) 334 if (fse->index != 0 || fse->code != MEDIA_BUS_FMT_Y8_1X8)
@@ -345,18 +345,18 @@ static int mt9m032_enum_frame_size(struct v4l2_subdev *subdev,
345/** 345/**
346 * __mt9m032_get_pad_crop() - get crop rect 346 * __mt9m032_get_pad_crop() - get crop rect
347 * @sensor: pointer to the sensor struct 347 * @sensor: pointer to the sensor struct
348 * @fh: file handle for getting the try crop rect from 348 * @cfg: v4l2_subdev_pad_config for getting the try crop rect from
349 * @which: select try or active crop rect 349 * @which: select try or active crop rect
350 * 350 *
351 * Returns a pointer the current active or fh relative try crop rect 351 * Returns a pointer the current active or fh relative try crop rect
352 */ 352 */
353static struct v4l2_rect * 353static struct v4l2_rect *
354__mt9m032_get_pad_crop(struct mt9m032 *sensor, struct v4l2_subdev_fh *fh, 354__mt9m032_get_pad_crop(struct mt9m032 *sensor, struct v4l2_subdev_pad_config *cfg,
355 enum v4l2_subdev_format_whence which) 355 enum v4l2_subdev_format_whence which)
356{ 356{
357 switch (which) { 357 switch (which) {
358 case V4L2_SUBDEV_FORMAT_TRY: 358 case V4L2_SUBDEV_FORMAT_TRY:
359 return v4l2_subdev_get_try_crop(fh, 0); 359 return v4l2_subdev_get_try_crop(&sensor->subdev, cfg, 0);
360 case V4L2_SUBDEV_FORMAT_ACTIVE: 360 case V4L2_SUBDEV_FORMAT_ACTIVE:
361 return &sensor->crop; 361 return &sensor->crop;
362 default: 362 default:
@@ -367,18 +367,18 @@ __mt9m032_get_pad_crop(struct mt9m032 *sensor, struct v4l2_subdev_fh *fh,
367/** 367/**
368 * __mt9m032_get_pad_format() - get format 368 * __mt9m032_get_pad_format() - get format
369 * @sensor: pointer to the sensor struct 369 * @sensor: pointer to the sensor struct
370 * @fh: file handle for getting the try format from 370 * @cfg: v4l2_subdev_pad_config for getting the try format from
371 * @which: select try or active format 371 * @which: select try or active format
372 * 372 *
373 * Returns a pointer the current active or fh relative try format 373 * Returns a pointer the current active or fh relative try format
374 */ 374 */
375static struct v4l2_mbus_framefmt * 375static struct v4l2_mbus_framefmt *
376__mt9m032_get_pad_format(struct mt9m032 *sensor, struct v4l2_subdev_fh *fh, 376__mt9m032_get_pad_format(struct mt9m032 *sensor, struct v4l2_subdev_pad_config *cfg,
377 enum v4l2_subdev_format_whence which) 377 enum v4l2_subdev_format_whence which)
378{ 378{
379 switch (which) { 379 switch (which) {
380 case V4L2_SUBDEV_FORMAT_TRY: 380 case V4L2_SUBDEV_FORMAT_TRY:
381 return v4l2_subdev_get_try_format(fh, 0); 381 return v4l2_subdev_get_try_format(&sensor->subdev, cfg, 0);
382 case V4L2_SUBDEV_FORMAT_ACTIVE: 382 case V4L2_SUBDEV_FORMAT_ACTIVE:
383 return &sensor->format; 383 return &sensor->format;
384 default: 384 default:
@@ -387,20 +387,20 @@ __mt9m032_get_pad_format(struct mt9m032 *sensor, struct v4l2_subdev_fh *fh,
387} 387}
388 388
389static int mt9m032_get_pad_format(struct v4l2_subdev *subdev, 389static int mt9m032_get_pad_format(struct v4l2_subdev *subdev,
390 struct v4l2_subdev_fh *fh, 390 struct v4l2_subdev_pad_config *cfg,
391 struct v4l2_subdev_format *fmt) 391 struct v4l2_subdev_format *fmt)
392{ 392{
393 struct mt9m032 *sensor = to_mt9m032(subdev); 393 struct mt9m032 *sensor = to_mt9m032(subdev);
394 394
395 mutex_lock(&sensor->lock); 395 mutex_lock(&sensor->lock);
396 fmt->format = *__mt9m032_get_pad_format(sensor, fh, fmt->which); 396 fmt->format = *__mt9m032_get_pad_format(sensor, cfg, fmt->which);
397 mutex_unlock(&sensor->lock); 397 mutex_unlock(&sensor->lock);
398 398
399 return 0; 399 return 0;
400} 400}
401 401
402static int mt9m032_set_pad_format(struct v4l2_subdev *subdev, 402static int mt9m032_set_pad_format(struct v4l2_subdev *subdev,
403 struct v4l2_subdev_fh *fh, 403 struct v4l2_subdev_pad_config *cfg,
404 struct v4l2_subdev_format *fmt) 404 struct v4l2_subdev_format *fmt)
405{ 405{
406 struct mt9m032 *sensor = to_mt9m032(subdev); 406 struct mt9m032 *sensor = to_mt9m032(subdev);
@@ -414,7 +414,7 @@ static int mt9m032_set_pad_format(struct v4l2_subdev *subdev,
414 } 414 }
415 415
416 /* Scaling is not supported, the format is thus fixed. */ 416 /* Scaling is not supported, the format is thus fixed. */
417 fmt->format = *__mt9m032_get_pad_format(sensor, fh, fmt->which); 417 fmt->format = *__mt9m032_get_pad_format(sensor, cfg, fmt->which);
418 ret = 0; 418 ret = 0;
419 419
420done: 420done:
@@ -423,7 +423,7 @@ done:
423} 423}
424 424
425static int mt9m032_get_pad_selection(struct v4l2_subdev *subdev, 425static int mt9m032_get_pad_selection(struct v4l2_subdev *subdev,
426 struct v4l2_subdev_fh *fh, 426 struct v4l2_subdev_pad_config *cfg,
427 struct v4l2_subdev_selection *sel) 427 struct v4l2_subdev_selection *sel)
428{ 428{
429 struct mt9m032 *sensor = to_mt9m032(subdev); 429 struct mt9m032 *sensor = to_mt9m032(subdev);
@@ -432,14 +432,14 @@ static int mt9m032_get_pad_selection(struct v4l2_subdev *subdev,
432 return -EINVAL; 432 return -EINVAL;
433 433
434 mutex_lock(&sensor->lock); 434 mutex_lock(&sensor->lock);
435 sel->r = *__mt9m032_get_pad_crop(sensor, fh, sel->which); 435 sel->r = *__mt9m032_get_pad_crop(sensor, cfg, sel->which);
436 mutex_unlock(&sensor->lock); 436 mutex_unlock(&sensor->lock);
437 437
438 return 0; 438 return 0;
439} 439}
440 440
441static int mt9m032_set_pad_selection(struct v4l2_subdev *subdev, 441static int mt9m032_set_pad_selection(struct v4l2_subdev *subdev,
442 struct v4l2_subdev_fh *fh, 442 struct v4l2_subdev_pad_config *cfg,
443 struct v4l2_subdev_selection *sel) 443 struct v4l2_subdev_selection *sel)
444{ 444{
445 struct mt9m032 *sensor = to_mt9m032(subdev); 445 struct mt9m032 *sensor = to_mt9m032(subdev);
@@ -475,13 +475,13 @@ static int mt9m032_set_pad_selection(struct v4l2_subdev *subdev,
475 rect.height = min_t(unsigned int, rect.height, 475 rect.height = min_t(unsigned int, rect.height,
476 MT9M032_PIXEL_ARRAY_HEIGHT - rect.top); 476 MT9M032_PIXEL_ARRAY_HEIGHT - rect.top);
477 477
478 __crop = __mt9m032_get_pad_crop(sensor, fh, sel->which); 478 __crop = __mt9m032_get_pad_crop(sensor, cfg, sel->which);
479 479
480 if (rect.width != __crop->width || rect.height != __crop->height) { 480 if (rect.width != __crop->width || rect.height != __crop->height) {
481 /* Reset the output image size if the crop rectangle size has 481 /* Reset the output image size if the crop rectangle size has
482 * been modified. 482 * been modified.
483 */ 483 */
484 format = __mt9m032_get_pad_format(sensor, fh, sel->which); 484 format = __mt9m032_get_pad_format(sensor, cfg, sel->which);
485 format->width = rect.width; 485 format->width = rect.width;
486 format->height = rect.height; 486 format->height = rect.height;
487 } 487 }
diff --git a/drivers/media/i2c/mt9p031.c b/drivers/media/i2c/mt9p031.c
index e3acae9a2ec3..c56a58b47c78 100644
--- a/drivers/media/i2c/mt9p031.c
+++ b/drivers/media/i2c/mt9p031.c
@@ -474,7 +474,7 @@ static int mt9p031_s_stream(struct v4l2_subdev *subdev, int enable)
474} 474}
475 475
476static int mt9p031_enum_mbus_code(struct v4l2_subdev *subdev, 476static int mt9p031_enum_mbus_code(struct v4l2_subdev *subdev,
477 struct v4l2_subdev_fh *fh, 477 struct v4l2_subdev_pad_config *cfg,
478 struct v4l2_subdev_mbus_code_enum *code) 478 struct v4l2_subdev_mbus_code_enum *code)
479{ 479{
480 struct mt9p031 *mt9p031 = to_mt9p031(subdev); 480 struct mt9p031 *mt9p031 = to_mt9p031(subdev);
@@ -487,7 +487,7 @@ static int mt9p031_enum_mbus_code(struct v4l2_subdev *subdev,
487} 487}
488 488
489static int mt9p031_enum_frame_size(struct v4l2_subdev *subdev, 489static int mt9p031_enum_frame_size(struct v4l2_subdev *subdev,
490 struct v4l2_subdev_fh *fh, 490 struct v4l2_subdev_pad_config *cfg,
491 struct v4l2_subdev_frame_size_enum *fse) 491 struct v4l2_subdev_frame_size_enum *fse)
492{ 492{
493 struct mt9p031 *mt9p031 = to_mt9p031(subdev); 493 struct mt9p031 *mt9p031 = to_mt9p031(subdev);
@@ -505,12 +505,12 @@ static int mt9p031_enum_frame_size(struct v4l2_subdev *subdev,
505} 505}
506 506
507static struct v4l2_mbus_framefmt * 507static struct v4l2_mbus_framefmt *
508__mt9p031_get_pad_format(struct mt9p031 *mt9p031, struct v4l2_subdev_fh *fh, 508__mt9p031_get_pad_format(struct mt9p031 *mt9p031, struct v4l2_subdev_pad_config *cfg,
509 unsigned int pad, u32 which) 509 unsigned int pad, u32 which)
510{ 510{
511 switch (which) { 511 switch (which) {
512 case V4L2_SUBDEV_FORMAT_TRY: 512 case V4L2_SUBDEV_FORMAT_TRY:
513 return v4l2_subdev_get_try_format(fh, pad); 513 return v4l2_subdev_get_try_format(&mt9p031->subdev, cfg, pad);
514 case V4L2_SUBDEV_FORMAT_ACTIVE: 514 case V4L2_SUBDEV_FORMAT_ACTIVE:
515 return &mt9p031->format; 515 return &mt9p031->format;
516 default: 516 default:
@@ -519,12 +519,12 @@ __mt9p031_get_pad_format(struct mt9p031 *mt9p031, struct v4l2_subdev_fh *fh,
519} 519}
520 520
521static struct v4l2_rect * 521static struct v4l2_rect *
522__mt9p031_get_pad_crop(struct mt9p031 *mt9p031, struct v4l2_subdev_fh *fh, 522__mt9p031_get_pad_crop(struct mt9p031 *mt9p031, struct v4l2_subdev_pad_config *cfg,
523 unsigned int pad, u32 which) 523 unsigned int pad, u32 which)
524{ 524{
525 switch (which) { 525 switch (which) {
526 case V4L2_SUBDEV_FORMAT_TRY: 526 case V4L2_SUBDEV_FORMAT_TRY:
527 return v4l2_subdev_get_try_crop(fh, pad); 527 return v4l2_subdev_get_try_crop(&mt9p031->subdev, cfg, pad);
528 case V4L2_SUBDEV_FORMAT_ACTIVE: 528 case V4L2_SUBDEV_FORMAT_ACTIVE:
529 return &mt9p031->crop; 529 return &mt9p031->crop;
530 default: 530 default:
@@ -533,18 +533,18 @@ __mt9p031_get_pad_crop(struct mt9p031 *mt9p031, struct v4l2_subdev_fh *fh,
533} 533}
534 534
535static int mt9p031_get_format(struct v4l2_subdev *subdev, 535static int mt9p031_get_format(struct v4l2_subdev *subdev,
536 struct v4l2_subdev_fh *fh, 536 struct v4l2_subdev_pad_config *cfg,
537 struct v4l2_subdev_format *fmt) 537 struct v4l2_subdev_format *fmt)
538{ 538{
539 struct mt9p031 *mt9p031 = to_mt9p031(subdev); 539 struct mt9p031 *mt9p031 = to_mt9p031(subdev);
540 540
541 fmt->format = *__mt9p031_get_pad_format(mt9p031, fh, fmt->pad, 541 fmt->format = *__mt9p031_get_pad_format(mt9p031, cfg, fmt->pad,
542 fmt->which); 542 fmt->which);
543 return 0; 543 return 0;
544} 544}
545 545
546static int mt9p031_set_format(struct v4l2_subdev *subdev, 546static int mt9p031_set_format(struct v4l2_subdev *subdev,
547 struct v4l2_subdev_fh *fh, 547 struct v4l2_subdev_pad_config *cfg,
548 struct v4l2_subdev_format *format) 548 struct v4l2_subdev_format *format)
549{ 549{
550 struct mt9p031 *mt9p031 = to_mt9p031(subdev); 550 struct mt9p031 *mt9p031 = to_mt9p031(subdev);
@@ -555,7 +555,7 @@ static int mt9p031_set_format(struct v4l2_subdev *subdev,
555 unsigned int hratio; 555 unsigned int hratio;
556 unsigned int vratio; 556 unsigned int vratio;
557 557
558 __crop = __mt9p031_get_pad_crop(mt9p031, fh, format->pad, 558 __crop = __mt9p031_get_pad_crop(mt9p031, cfg, format->pad,
559 format->which); 559 format->which);
560 560
561 /* Clamp the width and height to avoid dividing by zero. */ 561 /* Clamp the width and height to avoid dividing by zero. */
@@ -571,7 +571,7 @@ static int mt9p031_set_format(struct v4l2_subdev *subdev,
571 hratio = DIV_ROUND_CLOSEST(__crop->width, width); 571 hratio = DIV_ROUND_CLOSEST(__crop->width, width);
572 vratio = DIV_ROUND_CLOSEST(__crop->height, height); 572 vratio = DIV_ROUND_CLOSEST(__crop->height, height);
573 573
574 __format = __mt9p031_get_pad_format(mt9p031, fh, format->pad, 574 __format = __mt9p031_get_pad_format(mt9p031, cfg, format->pad,
575 format->which); 575 format->which);
576 __format->width = __crop->width / hratio; 576 __format->width = __crop->width / hratio;
577 __format->height = __crop->height / vratio; 577 __format->height = __crop->height / vratio;
@@ -582,7 +582,7 @@ static int mt9p031_set_format(struct v4l2_subdev *subdev,
582} 582}
583 583
584static int mt9p031_get_selection(struct v4l2_subdev *subdev, 584static int mt9p031_get_selection(struct v4l2_subdev *subdev,
585 struct v4l2_subdev_fh *fh, 585 struct v4l2_subdev_pad_config *cfg,
586 struct v4l2_subdev_selection *sel) 586 struct v4l2_subdev_selection *sel)
587{ 587{
588 struct mt9p031 *mt9p031 = to_mt9p031(subdev); 588 struct mt9p031 *mt9p031 = to_mt9p031(subdev);
@@ -590,12 +590,12 @@ static int mt9p031_get_selection(struct v4l2_subdev *subdev,
590 if (sel->target != V4L2_SEL_TGT_CROP) 590 if (sel->target != V4L2_SEL_TGT_CROP)
591 return -EINVAL; 591 return -EINVAL;
592 592
593 sel->r = *__mt9p031_get_pad_crop(mt9p031, fh, sel->pad, sel->which); 593 sel->r = *__mt9p031_get_pad_crop(mt9p031, cfg, sel->pad, sel->which);
594 return 0; 594 return 0;
595} 595}
596 596
597static int mt9p031_set_selection(struct v4l2_subdev *subdev, 597static int mt9p031_set_selection(struct v4l2_subdev *subdev,
598 struct v4l2_subdev_fh *fh, 598 struct v4l2_subdev_pad_config *cfg,
599 struct v4l2_subdev_selection *sel) 599 struct v4l2_subdev_selection *sel)
600{ 600{
601 struct mt9p031 *mt9p031 = to_mt9p031(subdev); 601 struct mt9p031 *mt9p031 = to_mt9p031(subdev);
@@ -625,13 +625,13 @@ static int mt9p031_set_selection(struct v4l2_subdev *subdev,
625 rect.height = min_t(unsigned int, rect.height, 625 rect.height = min_t(unsigned int, rect.height,
626 MT9P031_PIXEL_ARRAY_HEIGHT - rect.top); 626 MT9P031_PIXEL_ARRAY_HEIGHT - rect.top);
627 627
628 __crop = __mt9p031_get_pad_crop(mt9p031, fh, sel->pad, sel->which); 628 __crop = __mt9p031_get_pad_crop(mt9p031, cfg, sel->pad, sel->which);
629 629
630 if (rect.width != __crop->width || rect.height != __crop->height) { 630 if (rect.width != __crop->width || rect.height != __crop->height) {
631 /* Reset the output image size if the crop rectangle size has 631 /* Reset the output image size if the crop rectangle size has
632 * been modified. 632 * been modified.
633 */ 633 */
634 __format = __mt9p031_get_pad_format(mt9p031, fh, sel->pad, 634 __format = __mt9p031_get_pad_format(mt9p031, cfg, sel->pad,
635 sel->which); 635 sel->which);
636 __format->width = rect.width; 636 __format->width = rect.width;
637 __format->height = rect.height; 637 __format->height = rect.height;
@@ -946,13 +946,13 @@ static int mt9p031_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
946 struct v4l2_mbus_framefmt *format; 946 struct v4l2_mbus_framefmt *format;
947 struct v4l2_rect *crop; 947 struct v4l2_rect *crop;
948 948
949 crop = v4l2_subdev_get_try_crop(fh, 0); 949 crop = v4l2_subdev_get_try_crop(subdev, fh->pad, 0);
950 crop->left = MT9P031_COLUMN_START_DEF; 950 crop->left = MT9P031_COLUMN_START_DEF;
951 crop->top = MT9P031_ROW_START_DEF; 951 crop->top = MT9P031_ROW_START_DEF;
952 crop->width = MT9P031_WINDOW_WIDTH_DEF; 952 crop->width = MT9P031_WINDOW_WIDTH_DEF;
953 crop->height = MT9P031_WINDOW_HEIGHT_DEF; 953 crop->height = MT9P031_WINDOW_HEIGHT_DEF;
954 954
955 format = v4l2_subdev_get_try_format(fh, 0); 955 format = v4l2_subdev_get_try_format(subdev, fh->pad, 0);
956 956
957 if (mt9p031->model == MT9P031_MODEL_MONOCHROME) 957 if (mt9p031->model == MT9P031_MODEL_MONOCHROME)
958 format->code = MEDIA_BUS_FMT_Y12_1X12; 958 format->code = MEDIA_BUS_FMT_Y12_1X12;
diff --git a/drivers/media/i2c/mt9t001.c b/drivers/media/i2c/mt9t001.c
index f6ca636b538d..8ae99f7f254c 100644
--- a/drivers/media/i2c/mt9t001.c
+++ b/drivers/media/i2c/mt9t001.c
@@ -244,12 +244,12 @@ static int __mt9t001_set_power(struct mt9t001 *mt9t001, bool on)
244 */ 244 */
245 245
246static struct v4l2_mbus_framefmt * 246static struct v4l2_mbus_framefmt *
247__mt9t001_get_pad_format(struct mt9t001 *mt9t001, struct v4l2_subdev_fh *fh, 247__mt9t001_get_pad_format(struct mt9t001 *mt9t001, struct v4l2_subdev_pad_config *cfg,
248 unsigned int pad, enum v4l2_subdev_format_whence which) 248 unsigned int pad, enum v4l2_subdev_format_whence which)
249{ 249{
250 switch (which) { 250 switch (which) {
251 case V4L2_SUBDEV_FORMAT_TRY: 251 case V4L2_SUBDEV_FORMAT_TRY:
252 return v4l2_subdev_get_try_format(fh, pad); 252 return v4l2_subdev_get_try_format(&mt9t001->subdev, cfg, pad);
253 case V4L2_SUBDEV_FORMAT_ACTIVE: 253 case V4L2_SUBDEV_FORMAT_ACTIVE:
254 return &mt9t001->format; 254 return &mt9t001->format;
255 default: 255 default:
@@ -258,12 +258,12 @@ __mt9t001_get_pad_format(struct mt9t001 *mt9t001, struct v4l2_subdev_fh *fh,
258} 258}
259 259
260static struct v4l2_rect * 260static struct v4l2_rect *
261__mt9t001_get_pad_crop(struct mt9t001 *mt9t001, struct v4l2_subdev_fh *fh, 261__mt9t001_get_pad_crop(struct mt9t001 *mt9t001, struct v4l2_subdev_pad_config *cfg,
262 unsigned int pad, enum v4l2_subdev_format_whence which) 262 unsigned int pad, enum v4l2_subdev_format_whence which)
263{ 263{
264 switch (which) { 264 switch (which) {
265 case V4L2_SUBDEV_FORMAT_TRY: 265 case V4L2_SUBDEV_FORMAT_TRY:
266 return v4l2_subdev_get_try_crop(fh, pad); 266 return v4l2_subdev_get_try_crop(&mt9t001->subdev, cfg, pad);
267 case V4L2_SUBDEV_FORMAT_ACTIVE: 267 case V4L2_SUBDEV_FORMAT_ACTIVE:
268 return &mt9t001->crop; 268 return &mt9t001->crop;
269 default: 269 default:
@@ -327,7 +327,7 @@ static int mt9t001_s_stream(struct v4l2_subdev *subdev, int enable)
327} 327}
328 328
329static int mt9t001_enum_mbus_code(struct v4l2_subdev *subdev, 329static int mt9t001_enum_mbus_code(struct v4l2_subdev *subdev,
330 struct v4l2_subdev_fh *fh, 330 struct v4l2_subdev_pad_config *cfg,
331 struct v4l2_subdev_mbus_code_enum *code) 331 struct v4l2_subdev_mbus_code_enum *code)
332{ 332{
333 if (code->index > 0) 333 if (code->index > 0)
@@ -338,7 +338,7 @@ static int mt9t001_enum_mbus_code(struct v4l2_subdev *subdev,
338} 338}
339 339
340static int mt9t001_enum_frame_size(struct v4l2_subdev *subdev, 340static int mt9t001_enum_frame_size(struct v4l2_subdev *subdev,
341 struct v4l2_subdev_fh *fh, 341 struct v4l2_subdev_pad_config *cfg,
342 struct v4l2_subdev_frame_size_enum *fse) 342 struct v4l2_subdev_frame_size_enum *fse)
343{ 343{
344 if (fse->index >= 8 || fse->code != MEDIA_BUS_FMT_SGRBG10_1X10) 344 if (fse->index >= 8 || fse->code != MEDIA_BUS_FMT_SGRBG10_1X10)
@@ -353,18 +353,18 @@ static int mt9t001_enum_frame_size(struct v4l2_subdev *subdev,
353} 353}
354 354
355static int mt9t001_get_format(struct v4l2_subdev *subdev, 355static int mt9t001_get_format(struct v4l2_subdev *subdev,
356 struct v4l2_subdev_fh *fh, 356 struct v4l2_subdev_pad_config *cfg,
357 struct v4l2_subdev_format *format) 357 struct v4l2_subdev_format *format)
358{ 358{
359 struct mt9t001 *mt9t001 = to_mt9t001(subdev); 359 struct mt9t001 *mt9t001 = to_mt9t001(subdev);
360 360
361 format->format = *__mt9t001_get_pad_format(mt9t001, fh, format->pad, 361 format->format = *__mt9t001_get_pad_format(mt9t001, cfg, format->pad,
362 format->which); 362 format->which);
363 return 0; 363 return 0;
364} 364}
365 365
366static int mt9t001_set_format(struct v4l2_subdev *subdev, 366static int mt9t001_set_format(struct v4l2_subdev *subdev,
367 struct v4l2_subdev_fh *fh, 367 struct v4l2_subdev_pad_config *cfg,
368 struct v4l2_subdev_format *format) 368 struct v4l2_subdev_format *format)
369{ 369{
370 struct mt9t001 *mt9t001 = to_mt9t001(subdev); 370 struct mt9t001 *mt9t001 = to_mt9t001(subdev);
@@ -375,7 +375,7 @@ static int mt9t001_set_format(struct v4l2_subdev *subdev,
375 unsigned int hratio; 375 unsigned int hratio;
376 unsigned int vratio; 376 unsigned int vratio;
377 377
378 __crop = __mt9t001_get_pad_crop(mt9t001, fh, format->pad, 378 __crop = __mt9t001_get_pad_crop(mt9t001, cfg, format->pad,
379 format->which); 379 format->which);
380 380
381 /* Clamp the width and height to avoid dividing by zero. */ 381 /* Clamp the width and height to avoid dividing by zero. */
@@ -391,7 +391,7 @@ static int mt9t001_set_format(struct v4l2_subdev *subdev,
391 hratio = DIV_ROUND_CLOSEST(__crop->width, width); 391 hratio = DIV_ROUND_CLOSEST(__crop->width, width);
392 vratio = DIV_ROUND_CLOSEST(__crop->height, height); 392 vratio = DIV_ROUND_CLOSEST(__crop->height, height);
393 393
394 __format = __mt9t001_get_pad_format(mt9t001, fh, format->pad, 394 __format = __mt9t001_get_pad_format(mt9t001, cfg, format->pad,
395 format->which); 395 format->which);
396 __format->width = __crop->width / hratio; 396 __format->width = __crop->width / hratio;
397 __format->height = __crop->height / vratio; 397 __format->height = __crop->height / vratio;
@@ -402,7 +402,7 @@ static int mt9t001_set_format(struct v4l2_subdev *subdev,
402} 402}
403 403
404static int mt9t001_get_selection(struct v4l2_subdev *subdev, 404static int mt9t001_get_selection(struct v4l2_subdev *subdev,
405 struct v4l2_subdev_fh *fh, 405 struct v4l2_subdev_pad_config *cfg,
406 struct v4l2_subdev_selection *sel) 406 struct v4l2_subdev_selection *sel)
407{ 407{
408 struct mt9t001 *mt9t001 = to_mt9t001(subdev); 408 struct mt9t001 *mt9t001 = to_mt9t001(subdev);
@@ -410,12 +410,12 @@ static int mt9t001_get_selection(struct v4l2_subdev *subdev,
410 if (sel->target != V4L2_SEL_TGT_CROP) 410 if (sel->target != V4L2_SEL_TGT_CROP)
411 return -EINVAL; 411 return -EINVAL;
412 412
413 sel->r = *__mt9t001_get_pad_crop(mt9t001, fh, sel->pad, sel->which); 413 sel->r = *__mt9t001_get_pad_crop(mt9t001, cfg, sel->pad, sel->which);
414 return 0; 414 return 0;
415} 415}
416 416
417static int mt9t001_set_selection(struct v4l2_subdev *subdev, 417static int mt9t001_set_selection(struct v4l2_subdev *subdev,
418 struct v4l2_subdev_fh *fh, 418 struct v4l2_subdev_pad_config *cfg,
419 struct v4l2_subdev_selection *sel) 419 struct v4l2_subdev_selection *sel)
420{ 420{
421 struct mt9t001 *mt9t001 = to_mt9t001(subdev); 421 struct mt9t001 *mt9t001 = to_mt9t001(subdev);
@@ -447,13 +447,13 @@ static int mt9t001_set_selection(struct v4l2_subdev *subdev,
447 rect.height = min_t(unsigned int, rect.height, 447 rect.height = min_t(unsigned int, rect.height,
448 MT9T001_PIXEL_ARRAY_HEIGHT - rect.top); 448 MT9T001_PIXEL_ARRAY_HEIGHT - rect.top);
449 449
450 __crop = __mt9t001_get_pad_crop(mt9t001, fh, sel->pad, sel->which); 450 __crop = __mt9t001_get_pad_crop(mt9t001, cfg, sel->pad, sel->which);
451 451
452 if (rect.width != __crop->width || rect.height != __crop->height) { 452 if (rect.width != __crop->width || rect.height != __crop->height) {
453 /* Reset the output image size if the crop rectangle size has 453 /* Reset the output image size if the crop rectangle size has
454 * been modified. 454 * been modified.
455 */ 455 */
456 __format = __mt9t001_get_pad_format(mt9t001, fh, sel->pad, 456 __format = __mt9t001_get_pad_format(mt9t001, cfg, sel->pad,
457 sel->which); 457 sel->which);
458 __format->width = rect.width; 458 __format->width = rect.width;
459 __format->height = rect.height; 459 __format->height = rect.height;
@@ -790,13 +790,13 @@ static int mt9t001_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
790 struct v4l2_mbus_framefmt *format; 790 struct v4l2_mbus_framefmt *format;
791 struct v4l2_rect *crop; 791 struct v4l2_rect *crop;
792 792
793 crop = v4l2_subdev_get_try_crop(fh, 0); 793 crop = v4l2_subdev_get_try_crop(subdev, fh->pad, 0);
794 crop->left = MT9T001_COLUMN_START_DEF; 794 crop->left = MT9T001_COLUMN_START_DEF;
795 crop->top = MT9T001_ROW_START_DEF; 795 crop->top = MT9T001_ROW_START_DEF;
796 crop->width = MT9T001_WINDOW_WIDTH_DEF + 1; 796 crop->width = MT9T001_WINDOW_WIDTH_DEF + 1;
797 crop->height = MT9T001_WINDOW_HEIGHT_DEF + 1; 797 crop->height = MT9T001_WINDOW_HEIGHT_DEF + 1;
798 798
799 format = v4l2_subdev_get_try_format(fh, 0); 799 format = v4l2_subdev_get_try_format(subdev, fh->pad, 0);
800 format->code = MEDIA_BUS_FMT_SGRBG10_1X10; 800 format->code = MEDIA_BUS_FMT_SGRBG10_1X10;
801 format->width = MT9T001_WINDOW_WIDTH_DEF + 1; 801 format->width = MT9T001_WINDOW_WIDTH_DEF + 1;
802 format->height = MT9T001_WINDOW_HEIGHT_DEF + 1; 802 format->height = MT9T001_WINDOW_HEIGHT_DEF + 1;
diff --git a/drivers/media/i2c/mt9v032.c b/drivers/media/i2c/mt9v032.c
index 3267c183104b..3793d317772b 100644
--- a/drivers/media/i2c/mt9v032.c
+++ b/drivers/media/i2c/mt9v032.c
@@ -371,12 +371,12 @@ static int __mt9v032_set_power(struct mt9v032 *mt9v032, bool on)
371 */ 371 */
372 372
373static struct v4l2_mbus_framefmt * 373static struct v4l2_mbus_framefmt *
374__mt9v032_get_pad_format(struct mt9v032 *mt9v032, struct v4l2_subdev_fh *fh, 374__mt9v032_get_pad_format(struct mt9v032 *mt9v032, struct v4l2_subdev_pad_config *cfg,
375 unsigned int pad, enum v4l2_subdev_format_whence which) 375 unsigned int pad, enum v4l2_subdev_format_whence which)
376{ 376{
377 switch (which) { 377 switch (which) {
378 case V4L2_SUBDEV_FORMAT_TRY: 378 case V4L2_SUBDEV_FORMAT_TRY:
379 return v4l2_subdev_get_try_format(fh, pad); 379 return v4l2_subdev_get_try_format(&mt9v032->subdev, cfg, pad);
380 case V4L2_SUBDEV_FORMAT_ACTIVE: 380 case V4L2_SUBDEV_FORMAT_ACTIVE:
381 return &mt9v032->format; 381 return &mt9v032->format;
382 default: 382 default:
@@ -385,12 +385,12 @@ __mt9v032_get_pad_format(struct mt9v032 *mt9v032, struct v4l2_subdev_fh *fh,
385} 385}
386 386
387static struct v4l2_rect * 387static struct v4l2_rect *
388__mt9v032_get_pad_crop(struct mt9v032 *mt9v032, struct v4l2_subdev_fh *fh, 388__mt9v032_get_pad_crop(struct mt9v032 *mt9v032, struct v4l2_subdev_pad_config *cfg,
389 unsigned int pad, enum v4l2_subdev_format_whence which) 389 unsigned int pad, enum v4l2_subdev_format_whence which)
390{ 390{
391 switch (which) { 391 switch (which) {
392 case V4L2_SUBDEV_FORMAT_TRY: 392 case V4L2_SUBDEV_FORMAT_TRY:
393 return v4l2_subdev_get_try_crop(fh, pad); 393 return v4l2_subdev_get_try_crop(&mt9v032->subdev, cfg, pad);
394 case V4L2_SUBDEV_FORMAT_ACTIVE: 394 case V4L2_SUBDEV_FORMAT_ACTIVE:
395 return &mt9v032->crop; 395 return &mt9v032->crop;
396 default: 396 default:
@@ -448,7 +448,7 @@ static int mt9v032_s_stream(struct v4l2_subdev *subdev, int enable)
448} 448}
449 449
450static int mt9v032_enum_mbus_code(struct v4l2_subdev *subdev, 450static int mt9v032_enum_mbus_code(struct v4l2_subdev *subdev,
451 struct v4l2_subdev_fh *fh, 451 struct v4l2_subdev_pad_config *cfg,
452 struct v4l2_subdev_mbus_code_enum *code) 452 struct v4l2_subdev_mbus_code_enum *code)
453{ 453{
454 if (code->index > 0) 454 if (code->index > 0)
@@ -459,7 +459,7 @@ static int mt9v032_enum_mbus_code(struct v4l2_subdev *subdev,
459} 459}
460 460
461static int mt9v032_enum_frame_size(struct v4l2_subdev *subdev, 461static int mt9v032_enum_frame_size(struct v4l2_subdev *subdev,
462 struct v4l2_subdev_fh *fh, 462 struct v4l2_subdev_pad_config *cfg,
463 struct v4l2_subdev_frame_size_enum *fse) 463 struct v4l2_subdev_frame_size_enum *fse)
464{ 464{
465 if (fse->index >= 3 || fse->code != MEDIA_BUS_FMT_SGRBG10_1X10) 465 if (fse->index >= 3 || fse->code != MEDIA_BUS_FMT_SGRBG10_1X10)
@@ -474,12 +474,12 @@ static int mt9v032_enum_frame_size(struct v4l2_subdev *subdev,
474} 474}
475 475
476static int mt9v032_get_format(struct v4l2_subdev *subdev, 476static int mt9v032_get_format(struct v4l2_subdev *subdev,
477 struct v4l2_subdev_fh *fh, 477 struct v4l2_subdev_pad_config *cfg,
478 struct v4l2_subdev_format *format) 478 struct v4l2_subdev_format *format)
479{ 479{
480 struct mt9v032 *mt9v032 = to_mt9v032(subdev); 480 struct mt9v032 *mt9v032 = to_mt9v032(subdev);
481 481
482 format->format = *__mt9v032_get_pad_format(mt9v032, fh, format->pad, 482 format->format = *__mt9v032_get_pad_format(mt9v032, cfg, format->pad,
483 format->which); 483 format->which);
484 return 0; 484 return 0;
485} 485}
@@ -509,7 +509,7 @@ static unsigned int mt9v032_calc_ratio(unsigned int input, unsigned int output)
509} 509}
510 510
511static int mt9v032_set_format(struct v4l2_subdev *subdev, 511static int mt9v032_set_format(struct v4l2_subdev *subdev,
512 struct v4l2_subdev_fh *fh, 512 struct v4l2_subdev_pad_config *cfg,
513 struct v4l2_subdev_format *format) 513 struct v4l2_subdev_format *format)
514{ 514{
515 struct mt9v032 *mt9v032 = to_mt9v032(subdev); 515 struct mt9v032 *mt9v032 = to_mt9v032(subdev);
@@ -520,7 +520,7 @@ static int mt9v032_set_format(struct v4l2_subdev *subdev,
520 unsigned int hratio; 520 unsigned int hratio;
521 unsigned int vratio; 521 unsigned int vratio;
522 522
523 __crop = __mt9v032_get_pad_crop(mt9v032, fh, format->pad, 523 __crop = __mt9v032_get_pad_crop(mt9v032, cfg, format->pad,
524 format->which); 524 format->which);
525 525
526 /* Clamp the width and height to avoid dividing by zero. */ 526 /* Clamp the width and height to avoid dividing by zero. */
@@ -536,7 +536,7 @@ static int mt9v032_set_format(struct v4l2_subdev *subdev,
536 hratio = mt9v032_calc_ratio(__crop->width, width); 536 hratio = mt9v032_calc_ratio(__crop->width, width);
537 vratio = mt9v032_calc_ratio(__crop->height, height); 537 vratio = mt9v032_calc_ratio(__crop->height, height);
538 538
539 __format = __mt9v032_get_pad_format(mt9v032, fh, format->pad, 539 __format = __mt9v032_get_pad_format(mt9v032, cfg, format->pad,
540 format->which); 540 format->which);
541 __format->width = __crop->width / hratio; 541 __format->width = __crop->width / hratio;
542 __format->height = __crop->height / vratio; 542 __format->height = __crop->height / vratio;
@@ -553,7 +553,7 @@ static int mt9v032_set_format(struct v4l2_subdev *subdev,
553} 553}
554 554
555static int mt9v032_get_selection(struct v4l2_subdev *subdev, 555static int mt9v032_get_selection(struct v4l2_subdev *subdev,
556 struct v4l2_subdev_fh *fh, 556 struct v4l2_subdev_pad_config *cfg,
557 struct v4l2_subdev_selection *sel) 557 struct v4l2_subdev_selection *sel)
558{ 558{
559 struct mt9v032 *mt9v032 = to_mt9v032(subdev); 559 struct mt9v032 *mt9v032 = to_mt9v032(subdev);
@@ -561,12 +561,12 @@ static int mt9v032_get_selection(struct v4l2_subdev *subdev,
561 if (sel->target != V4L2_SEL_TGT_CROP) 561 if (sel->target != V4L2_SEL_TGT_CROP)
562 return -EINVAL; 562 return -EINVAL;
563 563
564 sel->r = *__mt9v032_get_pad_crop(mt9v032, fh, sel->pad, sel->which); 564 sel->r = *__mt9v032_get_pad_crop(mt9v032, cfg, sel->pad, sel->which);
565 return 0; 565 return 0;
566} 566}
567 567
568static int mt9v032_set_selection(struct v4l2_subdev *subdev, 568static int mt9v032_set_selection(struct v4l2_subdev *subdev,
569 struct v4l2_subdev_fh *fh, 569 struct v4l2_subdev_pad_config *cfg,
570 struct v4l2_subdev_selection *sel) 570 struct v4l2_subdev_selection *sel)
571{ 571{
572 struct mt9v032 *mt9v032 = to_mt9v032(subdev); 572 struct mt9v032 *mt9v032 = to_mt9v032(subdev);
@@ -598,13 +598,13 @@ static int mt9v032_set_selection(struct v4l2_subdev *subdev,
598 rect.height = min_t(unsigned int, 598 rect.height = min_t(unsigned int,
599 rect.height, MT9V032_PIXEL_ARRAY_HEIGHT - rect.top); 599 rect.height, MT9V032_PIXEL_ARRAY_HEIGHT - rect.top);
600 600
601 __crop = __mt9v032_get_pad_crop(mt9v032, fh, sel->pad, sel->which); 601 __crop = __mt9v032_get_pad_crop(mt9v032, cfg, sel->pad, sel->which);
602 602
603 if (rect.width != __crop->width || rect.height != __crop->height) { 603 if (rect.width != __crop->width || rect.height != __crop->height) {
604 /* Reset the output image size if the crop rectangle size has 604 /* Reset the output image size if the crop rectangle size has
605 * been modified. 605 * been modified.
606 */ 606 */
607 __format = __mt9v032_get_pad_format(mt9v032, fh, sel->pad, 607 __format = __mt9v032_get_pad_format(mt9v032, cfg, sel->pad,
608 sel->which); 608 sel->which);
609 __format->width = rect.width; 609 __format->width = rect.width;
610 __format->height = rect.height; 610 __format->height = rect.height;
@@ -810,13 +810,13 @@ static int mt9v032_open(struct v4l2_subdev *subdev, struct v4l2_subdev_fh *fh)
810 struct v4l2_mbus_framefmt *format; 810 struct v4l2_mbus_framefmt *format;
811 struct v4l2_rect *crop; 811 struct v4l2_rect *crop;
812 812
813 crop = v4l2_subdev_get_try_crop(fh, 0); 813 crop = v4l2_subdev_get_try_crop(subdev, fh->pad, 0);
814 crop->left = MT9V032_COLUMN_START_DEF; 814 crop->left = MT9V032_COLUMN_START_DEF;
815 crop->top = MT9V032_ROW_START_DEF; 815 crop->top = MT9V032_ROW_START_DEF;
816 crop->width = MT9V032_WINDOW_WIDTH_DEF; 816 crop->width = MT9V032_WINDOW_WIDTH_DEF;
817 crop->height = MT9V032_WINDOW_HEIGHT_DEF; 817 crop->height = MT9V032_WINDOW_HEIGHT_DEF;
818 818
819 format = v4l2_subdev_get_try_format(fh, 0); 819 format = v4l2_subdev_get_try_format(subdev, fh->pad, 0);
820 820
821 if (mt9v032->model->color) 821 if (mt9v032->model->color)
822 format->code = MEDIA_BUS_FMT_SGRBG10_1X10; 822 format->code = MEDIA_BUS_FMT_SGRBG10_1X10;
diff --git a/drivers/media/i2c/noon010pc30.c b/drivers/media/i2c/noon010pc30.c
index 00c7b26f4823..f197b6cbd407 100644
--- a/drivers/media/i2c/noon010pc30.c
+++ b/drivers/media/i2c/noon010pc30.c
@@ -492,7 +492,7 @@ unlock:
492} 492}
493 493
494static int noon010_enum_mbus_code(struct v4l2_subdev *sd, 494static int noon010_enum_mbus_code(struct v4l2_subdev *sd,
495 struct v4l2_subdev_fh *fh, 495 struct v4l2_subdev_pad_config *cfg,
496 struct v4l2_subdev_mbus_code_enum *code) 496 struct v4l2_subdev_mbus_code_enum *code)
497{ 497{
498 if (code->index >= ARRAY_SIZE(noon010_formats)) 498 if (code->index >= ARRAY_SIZE(noon010_formats))
@@ -502,15 +502,16 @@ static int noon010_enum_mbus_code(struct v4l2_subdev *sd,
502 return 0; 502 return 0;
503} 503}
504 504
505static int noon010_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 505static int noon010_get_fmt(struct v4l2_subdev *sd,
506 struct v4l2_subdev_pad_config *cfg,
506 struct v4l2_subdev_format *fmt) 507 struct v4l2_subdev_format *fmt)
507{ 508{
508 struct noon010_info *info = to_noon010(sd); 509 struct noon010_info *info = to_noon010(sd);
509 struct v4l2_mbus_framefmt *mf; 510 struct v4l2_mbus_framefmt *mf;
510 511
511 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 512 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
512 if (fh) { 513 if (cfg) {
513 mf = v4l2_subdev_get_try_format(fh, 0); 514 mf = v4l2_subdev_get_try_format(sd, cfg, 0);
514 fmt->format = *mf; 515 fmt->format = *mf;
515 } 516 }
516 return 0; 517 return 0;
@@ -542,7 +543,7 @@ static const struct noon010_format *noon010_try_fmt(struct v4l2_subdev *sd,
542 return &noon010_formats[i]; 543 return &noon010_formats[i];
543} 544}
544 545
545static int noon010_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 546static int noon010_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
546 struct v4l2_subdev_format *fmt) 547 struct v4l2_subdev_format *fmt)
547{ 548{
548 struct noon010_info *info = to_noon010(sd); 549 struct noon010_info *info = to_noon010(sd);
@@ -557,8 +558,8 @@ static int noon010_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
557 fmt->format.field = V4L2_FIELD_NONE; 558 fmt->format.field = V4L2_FIELD_NONE;
558 559
559 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 560 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
560 if (fh) { 561 if (cfg) {
561 mf = v4l2_subdev_get_try_format(fh, 0); 562 mf = v4l2_subdev_get_try_format(sd, cfg, 0);
562 *mf = fmt->format; 563 *mf = fmt->format;
563 } 564 }
564 return 0; 565 return 0;
@@ -640,7 +641,7 @@ static int noon010_log_status(struct v4l2_subdev *sd)
640 641
641static int noon010_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 642static int noon010_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
642{ 643{
643 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(fh, 0); 644 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0);
644 645
645 mf->width = noon010_sizes[0].width; 646 mf->width = noon010_sizes[0].width;
646 mf->height = noon010_sizes[0].height; 647 mf->height = noon010_sizes[0].height;
diff --git a/drivers/media/i2c/ov9650.c b/drivers/media/i2c/ov9650.c
index 2246bd5436ad..2bc473385c91 100644
--- a/drivers/media/i2c/ov9650.c
+++ b/drivers/media/i2c/ov9650.c
@@ -1067,7 +1067,7 @@ static void ov965x_get_default_format(struct v4l2_mbus_framefmt *mf)
1067} 1067}
1068 1068
1069static int ov965x_enum_mbus_code(struct v4l2_subdev *sd, 1069static int ov965x_enum_mbus_code(struct v4l2_subdev *sd,
1070 struct v4l2_subdev_fh *fh, 1070 struct v4l2_subdev_pad_config *cfg,
1071 struct v4l2_subdev_mbus_code_enum *code) 1071 struct v4l2_subdev_mbus_code_enum *code)
1072{ 1072{
1073 if (code->index >= ARRAY_SIZE(ov965x_formats)) 1073 if (code->index >= ARRAY_SIZE(ov965x_formats))
@@ -1078,7 +1078,7 @@ static int ov965x_enum_mbus_code(struct v4l2_subdev *sd,
1078} 1078}
1079 1079
1080static int ov965x_enum_frame_sizes(struct v4l2_subdev *sd, 1080static int ov965x_enum_frame_sizes(struct v4l2_subdev *sd,
1081 struct v4l2_subdev_fh *fh, 1081 struct v4l2_subdev_pad_config *cfg,
1082 struct v4l2_subdev_frame_size_enum *fse) 1082 struct v4l2_subdev_frame_size_enum *fse)
1083{ 1083{
1084 int i = ARRAY_SIZE(ov965x_formats); 1084 int i = ARRAY_SIZE(ov965x_formats);
@@ -1164,14 +1164,14 @@ static int ov965x_s_frame_interval(struct v4l2_subdev *sd,
1164 return ret; 1164 return ret;
1165} 1165}
1166 1166
1167static int ov965x_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 1167static int ov965x_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
1168 struct v4l2_subdev_format *fmt) 1168 struct v4l2_subdev_format *fmt)
1169{ 1169{
1170 struct ov965x *ov965x = to_ov965x(sd); 1170 struct ov965x *ov965x = to_ov965x(sd);
1171 struct v4l2_mbus_framefmt *mf; 1171 struct v4l2_mbus_framefmt *mf;
1172 1172
1173 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1173 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1174 mf = v4l2_subdev_get_try_format(fh, 0); 1174 mf = v4l2_subdev_get_try_format(sd, cfg, 0);
1175 fmt->format = *mf; 1175 fmt->format = *mf;
1176 return 0; 1176 return 0;
1177 } 1177 }
@@ -1208,7 +1208,7 @@ static void __ov965x_try_frame_size(struct v4l2_mbus_framefmt *mf,
1208 *size = match; 1208 *size = match;
1209} 1209}
1210 1210
1211static int ov965x_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 1211static int ov965x_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
1212 struct v4l2_subdev_format *fmt) 1212 struct v4l2_subdev_format *fmt)
1213{ 1213{
1214 unsigned int index = ARRAY_SIZE(ov965x_formats); 1214 unsigned int index = ARRAY_SIZE(ov965x_formats);
@@ -1230,8 +1230,8 @@ static int ov965x_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1230 mutex_lock(&ov965x->lock); 1230 mutex_lock(&ov965x->lock);
1231 1231
1232 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1232 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1233 if (fh != NULL) { 1233 if (cfg != NULL) {
1234 mf = v4l2_subdev_get_try_format(fh, fmt->pad); 1234 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
1235 *mf = fmt->format; 1235 *mf = fmt->format;
1236 } 1236 }
1237 } else { 1237 } else {
@@ -1361,7 +1361,7 @@ static int ov965x_s_stream(struct v4l2_subdev *sd, int on)
1361 */ 1361 */
1362static int ov965x_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1362static int ov965x_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
1363{ 1363{
1364 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(fh, 0); 1364 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0);
1365 1365
1366 ov965x_get_default_format(mf); 1366 ov965x_get_default_format(mf);
1367 return 0; 1367 return 0;
diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
index ee0f57e01b56..257a335c0ece 100644
--- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c
+++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c
@@ -824,10 +824,11 @@ static const struct s5c73m3_frame_size *s5c73m3_find_frame_size(
824} 824}
825 825
826static void s5c73m3_oif_try_format(struct s5c73m3 *state, 826static void s5c73m3_oif_try_format(struct s5c73m3 *state,
827 struct v4l2_subdev_fh *fh, 827 struct v4l2_subdev_pad_config *cfg,
828 struct v4l2_subdev_format *fmt, 828 struct v4l2_subdev_format *fmt,
829 const struct s5c73m3_frame_size **fs) 829 const struct s5c73m3_frame_size **fs)
830{ 830{
831 struct v4l2_subdev *sd = &state->sensor_sd;
831 u32 code; 832 u32 code;
832 833
833 switch (fmt->pad) { 834 switch (fmt->pad) {
@@ -850,7 +851,7 @@ static void s5c73m3_oif_try_format(struct s5c73m3 *state,
850 *fs = state->oif_pix_size[RES_ISP]; 851 *fs = state->oif_pix_size[RES_ISP];
851 else 852 else
852 *fs = s5c73m3_find_frame_size( 853 *fs = s5c73m3_find_frame_size(
853 v4l2_subdev_get_try_format(fh, 854 v4l2_subdev_get_try_format(sd, cfg,
854 OIF_ISP_PAD), 855 OIF_ISP_PAD),
855 RES_ISP); 856 RES_ISP);
856 break; 857 break;
@@ -860,7 +861,7 @@ static void s5c73m3_oif_try_format(struct s5c73m3 *state,
860} 861}
861 862
862static void s5c73m3_try_format(struct s5c73m3 *state, 863static void s5c73m3_try_format(struct s5c73m3 *state,
863 struct v4l2_subdev_fh *fh, 864 struct v4l2_subdev_pad_config *cfg,
864 struct v4l2_subdev_format *fmt, 865 struct v4l2_subdev_format *fmt,
865 const struct s5c73m3_frame_size **fs) 866 const struct s5c73m3_frame_size **fs)
866{ 867{
@@ -952,7 +953,7 @@ static int s5c73m3_oif_s_frame_interval(struct v4l2_subdev *sd,
952} 953}
953 954
954static int s5c73m3_oif_enum_frame_interval(struct v4l2_subdev *sd, 955static int s5c73m3_oif_enum_frame_interval(struct v4l2_subdev *sd,
955 struct v4l2_subdev_fh *fh, 956 struct v4l2_subdev_pad_config *cfg,
956 struct v4l2_subdev_frame_interval_enum *fie) 957 struct v4l2_subdev_frame_interval_enum *fie)
957{ 958{
958 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); 959 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd);
@@ -990,7 +991,7 @@ static int s5c73m3_oif_get_pad_code(int pad, int index)
990} 991}
991 992
992static int s5c73m3_get_fmt(struct v4l2_subdev *sd, 993static int s5c73m3_get_fmt(struct v4l2_subdev *sd,
993 struct v4l2_subdev_fh *fh, 994 struct v4l2_subdev_pad_config *cfg,
994 struct v4l2_subdev_format *fmt) 995 struct v4l2_subdev_format *fmt)
995{ 996{
996 struct s5c73m3 *state = sensor_sd_to_s5c73m3(sd); 997 struct s5c73m3 *state = sensor_sd_to_s5c73m3(sd);
@@ -998,7 +999,7 @@ static int s5c73m3_get_fmt(struct v4l2_subdev *sd,
998 u32 code; 999 u32 code;
999 1000
1000 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1001 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1001 fmt->format = *v4l2_subdev_get_try_format(fh, fmt->pad); 1002 fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
1002 return 0; 1003 return 0;
1003 } 1004 }
1004 1005
@@ -1024,7 +1025,7 @@ static int s5c73m3_get_fmt(struct v4l2_subdev *sd,
1024} 1025}
1025 1026
1026static int s5c73m3_oif_get_fmt(struct v4l2_subdev *sd, 1027static int s5c73m3_oif_get_fmt(struct v4l2_subdev *sd,
1027 struct v4l2_subdev_fh *fh, 1028 struct v4l2_subdev_pad_config *cfg,
1028 struct v4l2_subdev_format *fmt) 1029 struct v4l2_subdev_format *fmt)
1029{ 1030{
1030 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); 1031 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd);
@@ -1032,7 +1033,7 @@ static int s5c73m3_oif_get_fmt(struct v4l2_subdev *sd,
1032 u32 code; 1033 u32 code;
1033 1034
1034 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1035 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1035 fmt->format = *v4l2_subdev_get_try_format(fh, fmt->pad); 1036 fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
1036 return 0; 1037 return 0;
1037 } 1038 }
1038 1039
@@ -1062,7 +1063,7 @@ static int s5c73m3_oif_get_fmt(struct v4l2_subdev *sd,
1062} 1063}
1063 1064
1064static int s5c73m3_set_fmt(struct v4l2_subdev *sd, 1065static int s5c73m3_set_fmt(struct v4l2_subdev *sd,
1065 struct v4l2_subdev_fh *fh, 1066 struct v4l2_subdev_pad_config *cfg,
1066 struct v4l2_subdev_format *fmt) 1067 struct v4l2_subdev_format *fmt)
1067{ 1068{
1068 const struct s5c73m3_frame_size *frame_size = NULL; 1069 const struct s5c73m3_frame_size *frame_size = NULL;
@@ -1072,10 +1073,10 @@ static int s5c73m3_set_fmt(struct v4l2_subdev *sd,
1072 1073
1073 mutex_lock(&state->lock); 1074 mutex_lock(&state->lock);
1074 1075
1075 s5c73m3_try_format(state, fh, fmt, &frame_size); 1076 s5c73m3_try_format(state, cfg, fmt, &frame_size);
1076 1077
1077 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1078 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1078 mf = v4l2_subdev_get_try_format(fh, fmt->pad); 1079 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
1079 *mf = fmt->format; 1080 *mf = fmt->format;
1080 } else { 1081 } else {
1081 switch (fmt->pad) { 1082 switch (fmt->pad) {
@@ -1101,7 +1102,7 @@ static int s5c73m3_set_fmt(struct v4l2_subdev *sd,
1101} 1102}
1102 1103
1103static int s5c73m3_oif_set_fmt(struct v4l2_subdev *sd, 1104static int s5c73m3_oif_set_fmt(struct v4l2_subdev *sd,
1104 struct v4l2_subdev_fh *fh, 1105 struct v4l2_subdev_pad_config *cfg,
1105 struct v4l2_subdev_format *fmt) 1106 struct v4l2_subdev_format *fmt)
1106{ 1107{
1107 const struct s5c73m3_frame_size *frame_size = NULL; 1108 const struct s5c73m3_frame_size *frame_size = NULL;
@@ -1111,13 +1112,13 @@ static int s5c73m3_oif_set_fmt(struct v4l2_subdev *sd,
1111 1112
1112 mutex_lock(&state->lock); 1113 mutex_lock(&state->lock);
1113 1114
1114 s5c73m3_oif_try_format(state, fh, fmt, &frame_size); 1115 s5c73m3_oif_try_format(state, cfg, fmt, &frame_size);
1115 1116
1116 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1117 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1117 mf = v4l2_subdev_get_try_format(fh, fmt->pad); 1118 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
1118 *mf = fmt->format; 1119 *mf = fmt->format;
1119 if (fmt->pad == OIF_ISP_PAD) { 1120 if (fmt->pad == OIF_ISP_PAD) {
1120 mf = v4l2_subdev_get_try_format(fh, OIF_SOURCE_PAD); 1121 mf = v4l2_subdev_get_try_format(sd, cfg, OIF_SOURCE_PAD);
1121 mf->width = fmt->format.width; 1122 mf->width = fmt->format.width;
1122 mf->height = fmt->format.height; 1123 mf->height = fmt->format.height;
1123 } 1124 }
@@ -1189,7 +1190,7 @@ static int s5c73m3_oif_set_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
1189} 1190}
1190 1191
1191static int s5c73m3_enum_mbus_code(struct v4l2_subdev *sd, 1192static int s5c73m3_enum_mbus_code(struct v4l2_subdev *sd,
1192 struct v4l2_subdev_fh *fh, 1193 struct v4l2_subdev_pad_config *cfg,
1193 struct v4l2_subdev_mbus_code_enum *code) 1194 struct v4l2_subdev_mbus_code_enum *code)
1194{ 1195{
1195 static const int codes[] = { 1196 static const int codes[] = {
@@ -1205,7 +1206,7 @@ static int s5c73m3_enum_mbus_code(struct v4l2_subdev *sd,
1205} 1206}
1206 1207
1207static int s5c73m3_oif_enum_mbus_code(struct v4l2_subdev *sd, 1208static int s5c73m3_oif_enum_mbus_code(struct v4l2_subdev *sd,
1208 struct v4l2_subdev_fh *fh, 1209 struct v4l2_subdev_pad_config *cfg,
1209 struct v4l2_subdev_mbus_code_enum *code) 1210 struct v4l2_subdev_mbus_code_enum *code)
1210{ 1211{
1211 int ret; 1212 int ret;
@@ -1220,7 +1221,7 @@ static int s5c73m3_oif_enum_mbus_code(struct v4l2_subdev *sd,
1220} 1221}
1221 1222
1222static int s5c73m3_enum_frame_size(struct v4l2_subdev *sd, 1223static int s5c73m3_enum_frame_size(struct v4l2_subdev *sd,
1223 struct v4l2_subdev_fh *fh, 1224 struct v4l2_subdev_pad_config *cfg,
1224 struct v4l2_subdev_frame_size_enum *fse) 1225 struct v4l2_subdev_frame_size_enum *fse)
1225{ 1226{
1226 int idx; 1227 int idx;
@@ -1247,7 +1248,7 @@ static int s5c73m3_enum_frame_size(struct v4l2_subdev *sd,
1247} 1248}
1248 1249
1249static int s5c73m3_oif_enum_frame_size(struct v4l2_subdev *sd, 1250static int s5c73m3_oif_enum_frame_size(struct v4l2_subdev *sd,
1250 struct v4l2_subdev_fh *fh, 1251 struct v4l2_subdev_pad_config *cfg,
1251 struct v4l2_subdev_frame_size_enum *fse) 1252 struct v4l2_subdev_frame_size_enum *fse)
1252{ 1253{
1253 int idx; 1254 int idx;
@@ -1260,7 +1261,7 @@ static int s5c73m3_oif_enum_frame_size(struct v4l2_subdev *sd,
1260 case S5C73M3_JPEG_FMT: 1261 case S5C73M3_JPEG_FMT:
1261 case S5C73M3_ISP_FMT: { 1262 case S5C73M3_ISP_FMT: {
1262 struct v4l2_mbus_framefmt *mf = 1263 struct v4l2_mbus_framefmt *mf =
1263 v4l2_subdev_get_try_format(fh, OIF_ISP_PAD); 1264 v4l2_subdev_get_try_format(sd, cfg, OIF_ISP_PAD);
1264 1265
1265 fse->max_width = fse->min_width = mf->width; 1266 fse->max_width = fse->min_width = mf->width;
1266 fse->max_height = fse->min_height = mf->height; 1267 fse->max_height = fse->min_height = mf->height;
@@ -1306,11 +1307,11 @@ static int s5c73m3_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
1306{ 1307{
1307 struct v4l2_mbus_framefmt *mf; 1308 struct v4l2_mbus_framefmt *mf;
1308 1309
1309 mf = v4l2_subdev_get_try_format(fh, S5C73M3_ISP_PAD); 1310 mf = v4l2_subdev_get_try_format(sd, fh->pad, S5C73M3_ISP_PAD);
1310 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1], 1311 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1],
1311 S5C73M3_ISP_FMT); 1312 S5C73M3_ISP_FMT);
1312 1313
1313 mf = v4l2_subdev_get_try_format(fh, S5C73M3_JPEG_PAD); 1314 mf = v4l2_subdev_get_try_format(sd, fh->pad, S5C73M3_JPEG_PAD);
1314 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_jpeg_resolutions[1], 1315 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_jpeg_resolutions[1],
1315 S5C73M3_JPEG_FMT); 1316 S5C73M3_JPEG_FMT);
1316 1317
@@ -1321,15 +1322,15 @@ static int s5c73m3_oif_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
1321{ 1322{
1322 struct v4l2_mbus_framefmt *mf; 1323 struct v4l2_mbus_framefmt *mf;
1323 1324
1324 mf = v4l2_subdev_get_try_format(fh, OIF_ISP_PAD); 1325 mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_ISP_PAD);
1325 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1], 1326 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1],
1326 S5C73M3_ISP_FMT); 1327 S5C73M3_ISP_FMT);
1327 1328
1328 mf = v4l2_subdev_get_try_format(fh, OIF_JPEG_PAD); 1329 mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_JPEG_PAD);
1329 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_jpeg_resolutions[1], 1330 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_jpeg_resolutions[1],
1330 S5C73M3_JPEG_FMT); 1331 S5C73M3_JPEG_FMT);
1331 1332
1332 mf = v4l2_subdev_get_try_format(fh, OIF_SOURCE_PAD); 1333 mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_SOURCE_PAD);
1333 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1], 1334 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1],
1334 S5C73M3_ISP_FMT); 1335 S5C73M3_ISP_FMT);
1335 return 0; 1336 return 0;
diff --git a/drivers/media/i2c/s5k4ecgx.c b/drivers/media/i2c/s5k4ecgx.c
index 70071314789e..97084237275d 100644
--- a/drivers/media/i2c/s5k4ecgx.c
+++ b/drivers/media/i2c/s5k4ecgx.c
@@ -531,7 +531,7 @@ static int s5k4ecgx_try_frame_size(struct v4l2_mbus_framefmt *mf,
531} 531}
532 532
533static int s5k4ecgx_enum_mbus_code(struct v4l2_subdev *sd, 533static int s5k4ecgx_enum_mbus_code(struct v4l2_subdev *sd,
534 struct v4l2_subdev_fh *fh, 534 struct v4l2_subdev_pad_config *cfg,
535 struct v4l2_subdev_mbus_code_enum *code) 535 struct v4l2_subdev_mbus_code_enum *code)
536{ 536{
537 if (code->index >= ARRAY_SIZE(s5k4ecgx_formats)) 537 if (code->index >= ARRAY_SIZE(s5k4ecgx_formats))
@@ -541,15 +541,15 @@ static int s5k4ecgx_enum_mbus_code(struct v4l2_subdev *sd,
541 return 0; 541 return 0;
542} 542}
543 543
544static int s5k4ecgx_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 544static int s5k4ecgx_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
545 struct v4l2_subdev_format *fmt) 545 struct v4l2_subdev_format *fmt)
546{ 546{
547 struct s5k4ecgx *priv = to_s5k4ecgx(sd); 547 struct s5k4ecgx *priv = to_s5k4ecgx(sd);
548 struct v4l2_mbus_framefmt *mf; 548 struct v4l2_mbus_framefmt *mf;
549 549
550 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 550 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
551 if (fh) { 551 if (cfg) {
552 mf = v4l2_subdev_get_try_format(fh, 0); 552 mf = v4l2_subdev_get_try_format(sd, cfg, 0);
553 fmt->format = *mf; 553 fmt->format = *mf;
554 } 554 }
555 return 0; 555 return 0;
@@ -581,7 +581,7 @@ static const struct s5k4ecgx_pixfmt *s5k4ecgx_try_fmt(struct v4l2_subdev *sd,
581 return &s5k4ecgx_formats[i]; 581 return &s5k4ecgx_formats[i];
582} 582}
583 583
584static int s5k4ecgx_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 584static int s5k4ecgx_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
585 struct v4l2_subdev_format *fmt) 585 struct v4l2_subdev_format *fmt)
586{ 586{
587 struct s5k4ecgx *priv = to_s5k4ecgx(sd); 587 struct s5k4ecgx *priv = to_s5k4ecgx(sd);
@@ -596,8 +596,8 @@ static int s5k4ecgx_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
596 fmt->format.field = V4L2_FIELD_NONE; 596 fmt->format.field = V4L2_FIELD_NONE;
597 597
598 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 598 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
599 if (fh) { 599 if (cfg) {
600 mf = v4l2_subdev_get_try_format(fh, 0); 600 mf = v4l2_subdev_get_try_format(sd, cfg, 0);
601 *mf = fmt->format; 601 *mf = fmt->format;
602 } 602 }
603 return 0; 603 return 0;
@@ -692,7 +692,7 @@ static int s5k4ecgx_registered(struct v4l2_subdev *sd)
692 */ 692 */
693static int s5k4ecgx_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 693static int s5k4ecgx_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
694{ 694{
695 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(fh, 0); 695 struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0);
696 696
697 mf->width = s5k4ecgx_prev_sizes[0].size.width; 697 mf->width = s5k4ecgx_prev_sizes[0].size.width;
698 mf->height = s5k4ecgx_prev_sizes[0].size.height; 698 mf->height = s5k4ecgx_prev_sizes[0].size.height;
diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c
index a3d7d0391302..96e7a4834130 100644
--- a/drivers/media/i2c/s5k5baf.c
+++ b/drivers/media/i2c/s5k5baf.c
@@ -1182,7 +1182,7 @@ static int s5k5baf_s_frame_interval(struct v4l2_subdev *sd,
1182 * V4L2 subdev pad level and video operations 1182 * V4L2 subdev pad level and video operations
1183 */ 1183 */
1184static int s5k5baf_enum_frame_interval(struct v4l2_subdev *sd, 1184static int s5k5baf_enum_frame_interval(struct v4l2_subdev *sd,
1185 struct v4l2_subdev_fh *fh, 1185 struct v4l2_subdev_pad_config *cfg,
1186 struct v4l2_subdev_frame_interval_enum *fie) 1186 struct v4l2_subdev_frame_interval_enum *fie)
1187{ 1187{
1188 if (fie->index > S5K5BAF_MAX_FR_TIME - S5K5BAF_MIN_FR_TIME || 1188 if (fie->index > S5K5BAF_MAX_FR_TIME - S5K5BAF_MIN_FR_TIME ||
@@ -1201,7 +1201,7 @@ static int s5k5baf_enum_frame_interval(struct v4l2_subdev *sd,
1201} 1201}
1202 1202
1203static int s5k5baf_enum_mbus_code(struct v4l2_subdev *sd, 1203static int s5k5baf_enum_mbus_code(struct v4l2_subdev *sd,
1204 struct v4l2_subdev_fh *fh, 1204 struct v4l2_subdev_pad_config *cfg,
1205 struct v4l2_subdev_mbus_code_enum *code) 1205 struct v4l2_subdev_mbus_code_enum *code)
1206{ 1206{
1207 if (code->pad == PAD_CIS) { 1207 if (code->pad == PAD_CIS) {
@@ -1219,7 +1219,7 @@ static int s5k5baf_enum_mbus_code(struct v4l2_subdev *sd,
1219} 1219}
1220 1220
1221static int s5k5baf_enum_frame_size(struct v4l2_subdev *sd, 1221static int s5k5baf_enum_frame_size(struct v4l2_subdev *sd,
1222 struct v4l2_subdev_fh *fh, 1222 struct v4l2_subdev_pad_config *cfg,
1223 struct v4l2_subdev_frame_size_enum *fse) 1223 struct v4l2_subdev_frame_size_enum *fse)
1224{ 1224{
1225 int i; 1225 int i;
@@ -1276,7 +1276,7 @@ static int s5k5baf_try_isp_format(struct v4l2_mbus_framefmt *mf)
1276 return pixfmt; 1276 return pixfmt;
1277} 1277}
1278 1278
1279static int s5k5baf_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 1279static int s5k5baf_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
1280 struct v4l2_subdev_format *fmt) 1280 struct v4l2_subdev_format *fmt)
1281{ 1281{
1282 struct s5k5baf *state = to_s5k5baf(sd); 1282 struct s5k5baf *state = to_s5k5baf(sd);
@@ -1284,7 +1284,7 @@ static int s5k5baf_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1284 struct v4l2_mbus_framefmt *mf; 1284 struct v4l2_mbus_framefmt *mf;
1285 1285
1286 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1286 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1287 mf = v4l2_subdev_get_try_format(fh, fmt->pad); 1287 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
1288 fmt->format = *mf; 1288 fmt->format = *mf;
1289 return 0; 1289 return 0;
1290 } 1290 }
@@ -1306,7 +1306,7 @@ static int s5k5baf_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1306 return 0; 1306 return 0;
1307} 1307}
1308 1308
1309static int s5k5baf_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 1309static int s5k5baf_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
1310 struct v4l2_subdev_format *fmt) 1310 struct v4l2_subdev_format *fmt)
1311{ 1311{
1312 struct v4l2_mbus_framefmt *mf = &fmt->format; 1312 struct v4l2_mbus_framefmt *mf = &fmt->format;
@@ -1317,7 +1317,7 @@ static int s5k5baf_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1317 mf->field = V4L2_FIELD_NONE; 1317 mf->field = V4L2_FIELD_NONE;
1318 1318
1319 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1319 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1320 *v4l2_subdev_get_try_format(fh, fmt->pad) = *mf; 1320 *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = *mf;
1321 return 0; 1321 return 0;
1322 } 1322 }
1323 1323
@@ -1369,7 +1369,7 @@ static int s5k5baf_is_bound_target(u32 target)
1369} 1369}
1370 1370
1371static int s5k5baf_get_selection(struct v4l2_subdev *sd, 1371static int s5k5baf_get_selection(struct v4l2_subdev *sd,
1372 struct v4l2_subdev_fh *fh, 1372 struct v4l2_subdev_pad_config *cfg,
1373 struct v4l2_subdev_selection *sel) 1373 struct v4l2_subdev_selection *sel)
1374{ 1374{
1375 static enum selection_rect rtype; 1375 static enum selection_rect rtype;
@@ -1389,9 +1389,9 @@ static int s5k5baf_get_selection(struct v4l2_subdev *sd,
1389 1389
1390 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1390 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) {
1391 if (rtype == R_COMPOSE) 1391 if (rtype == R_COMPOSE)
1392 sel->r = *v4l2_subdev_get_try_compose(fh, sel->pad); 1392 sel->r = *v4l2_subdev_get_try_compose(sd, cfg, sel->pad);
1393 else 1393 else
1394 sel->r = *v4l2_subdev_get_try_crop(fh, sel->pad); 1394 sel->r = *v4l2_subdev_get_try_crop(sd, cfg, sel->pad);
1395 return 0; 1395 return 0;
1396 } 1396 }
1397 1397
@@ -1460,7 +1460,7 @@ static bool s5k5baf_cmp_rect(const struct v4l2_rect *r1,
1460} 1460}
1461 1461
1462static int s5k5baf_set_selection(struct v4l2_subdev *sd, 1462static int s5k5baf_set_selection(struct v4l2_subdev *sd,
1463 struct v4l2_subdev_fh *fh, 1463 struct v4l2_subdev_pad_config *cfg,
1464 struct v4l2_subdev_selection *sel) 1464 struct v4l2_subdev_selection *sel)
1465{ 1465{
1466 static enum selection_rect rtype; 1466 static enum selection_rect rtype;
@@ -1481,9 +1481,9 @@ static int s5k5baf_set_selection(struct v4l2_subdev *sd,
1481 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1481 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) {
1482 rects = (struct v4l2_rect * []) { 1482 rects = (struct v4l2_rect * []) {
1483 &s5k5baf_cis_rect, 1483 &s5k5baf_cis_rect,
1484 v4l2_subdev_get_try_crop(fh, PAD_CIS), 1484 v4l2_subdev_get_try_crop(sd, cfg, PAD_CIS),
1485 v4l2_subdev_get_try_compose(fh, PAD_CIS), 1485 v4l2_subdev_get_try_compose(sd, cfg, PAD_CIS),
1486 v4l2_subdev_get_try_crop(fh, PAD_OUT) 1486 v4l2_subdev_get_try_crop(sd, cfg, PAD_OUT)
1487 }; 1487 };
1488 s5k5baf_set_rect_and_adjust(rects, rtype, &sel->r); 1488 s5k5baf_set_rect_and_adjust(rects, rtype, &sel->r);
1489 return 0; 1489 return 0;
@@ -1701,22 +1701,22 @@ static int s5k5baf_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
1701{ 1701{
1702 struct v4l2_mbus_framefmt *mf; 1702 struct v4l2_mbus_framefmt *mf;
1703 1703
1704 mf = v4l2_subdev_get_try_format(fh, PAD_CIS); 1704 mf = v4l2_subdev_get_try_format(sd, fh->pad, PAD_CIS);
1705 s5k5baf_try_cis_format(mf); 1705 s5k5baf_try_cis_format(mf);
1706 1706
1707 if (s5k5baf_is_cis_subdev(sd)) 1707 if (s5k5baf_is_cis_subdev(sd))
1708 return 0; 1708 return 0;
1709 1709
1710 mf = v4l2_subdev_get_try_format(fh, PAD_OUT); 1710 mf = v4l2_subdev_get_try_format(sd, fh->pad, PAD_OUT);
1711 mf->colorspace = s5k5baf_formats[0].colorspace; 1711 mf->colorspace = s5k5baf_formats[0].colorspace;
1712 mf->code = s5k5baf_formats[0].code; 1712 mf->code = s5k5baf_formats[0].code;
1713 mf->width = s5k5baf_cis_rect.width; 1713 mf->width = s5k5baf_cis_rect.width;
1714 mf->height = s5k5baf_cis_rect.height; 1714 mf->height = s5k5baf_cis_rect.height;
1715 mf->field = V4L2_FIELD_NONE; 1715 mf->field = V4L2_FIELD_NONE;
1716 1716
1717 *v4l2_subdev_get_try_crop(fh, PAD_CIS) = s5k5baf_cis_rect; 1717 *v4l2_subdev_get_try_crop(sd, fh->pad, PAD_CIS) = s5k5baf_cis_rect;
1718 *v4l2_subdev_get_try_compose(fh, PAD_CIS) = s5k5baf_cis_rect; 1718 *v4l2_subdev_get_try_compose(sd, fh->pad, PAD_CIS) = s5k5baf_cis_rect;
1719 *v4l2_subdev_get_try_crop(fh, PAD_OUT) = s5k5baf_cis_rect; 1719 *v4l2_subdev_get_try_crop(sd, fh->pad, PAD_OUT) = s5k5baf_cis_rect;
1720 1720
1721 return 0; 1721 return 0;
1722} 1722}
diff --git a/drivers/media/i2c/s5k6a3.c b/drivers/media/i2c/s5k6a3.c
index 91b841a1b850..bc389d5e42ae 100644
--- a/drivers/media/i2c/s5k6a3.c
+++ b/drivers/media/i2c/s5k6a3.c
@@ -99,7 +99,7 @@ static const struct v4l2_mbus_framefmt *find_sensor_format(
99} 99}
100 100
101static int s5k6a3_enum_mbus_code(struct v4l2_subdev *sd, 101static int s5k6a3_enum_mbus_code(struct v4l2_subdev *sd,
102 struct v4l2_subdev_fh *fh, 102 struct v4l2_subdev_pad_config *cfg,
103 struct v4l2_subdev_mbus_code_enum *code) 103 struct v4l2_subdev_mbus_code_enum *code)
104{ 104{
105 if (code->index >= ARRAY_SIZE(s5k6a3_formats)) 105 if (code->index >= ARRAY_SIZE(s5k6a3_formats))
@@ -123,17 +123,17 @@ static void s5k6a3_try_format(struct v4l2_mbus_framefmt *mf)
123} 123}
124 124
125static struct v4l2_mbus_framefmt *__s5k6a3_get_format( 125static struct v4l2_mbus_framefmt *__s5k6a3_get_format(
126 struct s5k6a3 *sensor, struct v4l2_subdev_fh *fh, 126 struct s5k6a3 *sensor, struct v4l2_subdev_pad_config *cfg,
127 u32 pad, enum v4l2_subdev_format_whence which) 127 u32 pad, enum v4l2_subdev_format_whence which)
128{ 128{
129 if (which == V4L2_SUBDEV_FORMAT_TRY) 129 if (which == V4L2_SUBDEV_FORMAT_TRY)
130 return fh ? v4l2_subdev_get_try_format(fh, pad) : NULL; 130 return cfg ? v4l2_subdev_get_try_format(&sensor->subdev, cfg, pad) : NULL;
131 131
132 return &sensor->format; 132 return &sensor->format;
133} 133}
134 134
135static int s5k6a3_set_fmt(struct v4l2_subdev *sd, 135static int s5k6a3_set_fmt(struct v4l2_subdev *sd,
136 struct v4l2_subdev_fh *fh, 136 struct v4l2_subdev_pad_config *cfg,
137 struct v4l2_subdev_format *fmt) 137 struct v4l2_subdev_format *fmt)
138{ 138{
139 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); 139 struct s5k6a3 *sensor = sd_to_s5k6a3(sd);
@@ -141,7 +141,7 @@ static int s5k6a3_set_fmt(struct v4l2_subdev *sd,
141 141
142 s5k6a3_try_format(&fmt->format); 142 s5k6a3_try_format(&fmt->format);
143 143
144 mf = __s5k6a3_get_format(sensor, fh, fmt->pad, fmt->which); 144 mf = __s5k6a3_get_format(sensor, cfg, fmt->pad, fmt->which);
145 if (mf) { 145 if (mf) {
146 mutex_lock(&sensor->lock); 146 mutex_lock(&sensor->lock);
147 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) 147 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE)
@@ -152,13 +152,13 @@ static int s5k6a3_set_fmt(struct v4l2_subdev *sd,
152} 152}
153 153
154static int s5k6a3_get_fmt(struct v4l2_subdev *sd, 154static int s5k6a3_get_fmt(struct v4l2_subdev *sd,
155 struct v4l2_subdev_fh *fh, 155 struct v4l2_subdev_pad_config *cfg,
156 struct v4l2_subdev_format *fmt) 156 struct v4l2_subdev_format *fmt)
157{ 157{
158 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); 158 struct s5k6a3 *sensor = sd_to_s5k6a3(sd);
159 struct v4l2_mbus_framefmt *mf; 159 struct v4l2_mbus_framefmt *mf;
160 160
161 mf = __s5k6a3_get_format(sensor, fh, fmt->pad, fmt->which); 161 mf = __s5k6a3_get_format(sensor, cfg, fmt->pad, fmt->which);
162 162
163 mutex_lock(&sensor->lock); 163 mutex_lock(&sensor->lock);
164 fmt->format = *mf; 164 fmt->format = *mf;
@@ -174,7 +174,7 @@ static struct v4l2_subdev_pad_ops s5k6a3_pad_ops = {
174 174
175static int s5k6a3_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 175static int s5k6a3_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
176{ 176{
177 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(fh, 0); 177 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0);
178 178
179 *format = s5k6a3_formats[0]; 179 *format = s5k6a3_formats[0];
180 format->width = S5K6A3_DEFAULT_WIDTH; 180 format->width = S5K6A3_DEFAULT_WIDTH;
diff --git a/drivers/media/i2c/s5k6aa.c b/drivers/media/i2c/s5k6aa.c
index b1c583239dab..de803a11efb4 100644
--- a/drivers/media/i2c/s5k6aa.c
+++ b/drivers/media/i2c/s5k6aa.c
@@ -996,7 +996,7 @@ static int s5k6aa_s_frame_interval(struct v4l2_subdev *sd,
996 * V4L2 subdev pad level and video operations 996 * V4L2 subdev pad level and video operations
997 */ 997 */
998static int s5k6aa_enum_frame_interval(struct v4l2_subdev *sd, 998static int s5k6aa_enum_frame_interval(struct v4l2_subdev *sd,
999 struct v4l2_subdev_fh *fh, 999 struct v4l2_subdev_pad_config *cfg,
1000 struct v4l2_subdev_frame_interval_enum *fie) 1000 struct v4l2_subdev_frame_interval_enum *fie)
1001{ 1001{
1002 struct s5k6aa *s5k6aa = to_s5k6aa(sd); 1002 struct s5k6aa *s5k6aa = to_s5k6aa(sd);
@@ -1023,7 +1023,7 @@ static int s5k6aa_enum_frame_interval(struct v4l2_subdev *sd,
1023} 1023}
1024 1024
1025static int s5k6aa_enum_mbus_code(struct v4l2_subdev *sd, 1025static int s5k6aa_enum_mbus_code(struct v4l2_subdev *sd,
1026 struct v4l2_subdev_fh *fh, 1026 struct v4l2_subdev_pad_config *cfg,
1027 struct v4l2_subdev_mbus_code_enum *code) 1027 struct v4l2_subdev_mbus_code_enum *code)
1028{ 1028{
1029 if (code->index >= ARRAY_SIZE(s5k6aa_formats)) 1029 if (code->index >= ARRAY_SIZE(s5k6aa_formats))
@@ -1034,7 +1034,7 @@ static int s5k6aa_enum_mbus_code(struct v4l2_subdev *sd,
1034} 1034}
1035 1035
1036static int s5k6aa_enum_frame_size(struct v4l2_subdev *sd, 1036static int s5k6aa_enum_frame_size(struct v4l2_subdev *sd,
1037 struct v4l2_subdev_fh *fh, 1037 struct v4l2_subdev_pad_config *cfg,
1038 struct v4l2_subdev_frame_size_enum *fse) 1038 struct v4l2_subdev_frame_size_enum *fse)
1039{ 1039{
1040 int i = ARRAY_SIZE(s5k6aa_formats); 1040 int i = ARRAY_SIZE(s5k6aa_formats);
@@ -1056,14 +1056,14 @@ static int s5k6aa_enum_frame_size(struct v4l2_subdev *sd,
1056} 1056}
1057 1057
1058static struct v4l2_rect * 1058static struct v4l2_rect *
1059__s5k6aa_get_crop_rect(struct s5k6aa *s5k6aa, struct v4l2_subdev_fh *fh, 1059__s5k6aa_get_crop_rect(struct s5k6aa *s5k6aa, struct v4l2_subdev_pad_config *cfg,
1060 enum v4l2_subdev_format_whence which) 1060 enum v4l2_subdev_format_whence which)
1061{ 1061{
1062 if (which == V4L2_SUBDEV_FORMAT_ACTIVE) 1062 if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
1063 return &s5k6aa->ccd_rect; 1063 return &s5k6aa->ccd_rect;
1064 1064
1065 WARN_ON(which != V4L2_SUBDEV_FORMAT_TRY); 1065 WARN_ON(which != V4L2_SUBDEV_FORMAT_TRY);
1066 return v4l2_subdev_get_try_crop(fh, 0); 1066 return v4l2_subdev_get_try_crop(&s5k6aa->sd, cfg, 0);
1067} 1067}
1068 1068
1069static void s5k6aa_try_format(struct s5k6aa *s5k6aa, 1069static void s5k6aa_try_format(struct s5k6aa *s5k6aa,
@@ -1087,7 +1087,7 @@ static void s5k6aa_try_format(struct s5k6aa *s5k6aa,
1087 mf->field = V4L2_FIELD_NONE; 1087 mf->field = V4L2_FIELD_NONE;
1088} 1088}
1089 1089
1090static int s5k6aa_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 1090static int s5k6aa_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
1091 struct v4l2_subdev_format *fmt) 1091 struct v4l2_subdev_format *fmt)
1092{ 1092{
1093 struct s5k6aa *s5k6aa = to_s5k6aa(sd); 1093 struct s5k6aa *s5k6aa = to_s5k6aa(sd);
@@ -1096,7 +1096,7 @@ static int s5k6aa_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1096 memset(fmt->reserved, 0, sizeof(fmt->reserved)); 1096 memset(fmt->reserved, 0, sizeof(fmt->reserved));
1097 1097
1098 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1098 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1099 mf = v4l2_subdev_get_try_format(fh, 0); 1099 mf = v4l2_subdev_get_try_format(sd, cfg, 0);
1100 fmt->format = *mf; 1100 fmt->format = *mf;
1101 return 0; 1101 return 0;
1102 } 1102 }
@@ -1108,7 +1108,7 @@ static int s5k6aa_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1108 return 0; 1108 return 0;
1109} 1109}
1110 1110
1111static int s5k6aa_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 1111static int s5k6aa_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
1112 struct v4l2_subdev_format *fmt) 1112 struct v4l2_subdev_format *fmt)
1113{ 1113{
1114 struct s5k6aa *s5k6aa = to_s5k6aa(sd); 1114 struct s5k6aa *s5k6aa = to_s5k6aa(sd);
@@ -1121,8 +1121,8 @@ static int s5k6aa_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1121 s5k6aa_try_format(s5k6aa, &fmt->format); 1121 s5k6aa_try_format(s5k6aa, &fmt->format);
1122 1122
1123 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1123 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1124 mf = v4l2_subdev_get_try_format(fh, fmt->pad); 1124 mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad);
1125 crop = v4l2_subdev_get_try_crop(fh, 0); 1125 crop = v4l2_subdev_get_try_crop(sd, cfg, 0);
1126 } else { 1126 } else {
1127 if (s5k6aa->streaming) { 1127 if (s5k6aa->streaming) {
1128 ret = -EBUSY; 1128 ret = -EBUSY;
@@ -1162,7 +1162,7 @@ static int s5k6aa_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
1162} 1162}
1163 1163
1164static int s5k6aa_get_selection(struct v4l2_subdev *sd, 1164static int s5k6aa_get_selection(struct v4l2_subdev *sd,
1165 struct v4l2_subdev_fh *fh, 1165 struct v4l2_subdev_pad_config *cfg,
1166 struct v4l2_subdev_selection *sel) 1166 struct v4l2_subdev_selection *sel)
1167{ 1167{
1168 struct s5k6aa *s5k6aa = to_s5k6aa(sd); 1168 struct s5k6aa *s5k6aa = to_s5k6aa(sd);
@@ -1174,7 +1174,7 @@ static int s5k6aa_get_selection(struct v4l2_subdev *sd,
1174 memset(sel->reserved, 0, sizeof(sel->reserved)); 1174 memset(sel->reserved, 0, sizeof(sel->reserved));
1175 1175
1176 mutex_lock(&s5k6aa->lock); 1176 mutex_lock(&s5k6aa->lock);
1177 rect = __s5k6aa_get_crop_rect(s5k6aa, fh, sel->which); 1177 rect = __s5k6aa_get_crop_rect(s5k6aa, cfg, sel->which);
1178 sel->r = *rect; 1178 sel->r = *rect;
1179 mutex_unlock(&s5k6aa->lock); 1179 mutex_unlock(&s5k6aa->lock);
1180 1180
@@ -1185,7 +1185,7 @@ static int s5k6aa_get_selection(struct v4l2_subdev *sd,
1185} 1185}
1186 1186
1187static int s5k6aa_set_selection(struct v4l2_subdev *sd, 1187static int s5k6aa_set_selection(struct v4l2_subdev *sd,
1188 struct v4l2_subdev_fh *fh, 1188 struct v4l2_subdev_pad_config *cfg,
1189 struct v4l2_subdev_selection *sel) 1189 struct v4l2_subdev_selection *sel)
1190{ 1190{
1191 struct s5k6aa *s5k6aa = to_s5k6aa(sd); 1191 struct s5k6aa *s5k6aa = to_s5k6aa(sd);
@@ -1197,13 +1197,13 @@ static int s5k6aa_set_selection(struct v4l2_subdev *sd,
1197 return -EINVAL; 1197 return -EINVAL;
1198 1198
1199 mutex_lock(&s5k6aa->lock); 1199 mutex_lock(&s5k6aa->lock);
1200 crop_r = __s5k6aa_get_crop_rect(s5k6aa, fh, sel->which); 1200 crop_r = __s5k6aa_get_crop_rect(s5k6aa, cfg, sel->which);
1201 1201
1202 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 1202 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
1203 mf = &s5k6aa->preset->mbus_fmt; 1203 mf = &s5k6aa->preset->mbus_fmt;
1204 s5k6aa->apply_crop = 1; 1204 s5k6aa->apply_crop = 1;
1205 } else { 1205 } else {
1206 mf = v4l2_subdev_get_try_format(fh, 0); 1206 mf = v4l2_subdev_get_try_format(sd, cfg, 0);
1207 } 1207 }
1208 v4l_bound_align_image(&sel->r.width, mf->width, 1208 v4l_bound_align_image(&sel->r.width, mf->width,
1209 S5K6AA_WIN_WIDTH_MAX, 1, 1209 S5K6AA_WIN_WIDTH_MAX, 1,
@@ -1424,8 +1424,8 @@ static int s5k6aa_initialize_ctrls(struct s5k6aa *s5k6aa)
1424 */ 1424 */
1425static int s5k6aa_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1425static int s5k6aa_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
1426{ 1426{
1427 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(fh, 0); 1427 struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0);
1428 struct v4l2_rect *crop = v4l2_subdev_get_try_crop(fh, 0); 1428 struct v4l2_rect *crop = v4l2_subdev_get_try_crop(sd, fh->pad, 0);
1429 1429
1430 format->colorspace = s5k6aa_formats[0].colorspace; 1430 format->colorspace = s5k6aa_formats[0].colorspace;
1431 format->code = s5k6aa_formats[0].code; 1431 format->code = s5k6aa_formats[0].code;
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index d47eff5d3101..c73deb0432d7 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -1557,7 +1557,7 @@ static int smiapp_set_stream(struct v4l2_subdev *subdev, int enable)
1557} 1557}
1558 1558
1559static int smiapp_enum_mbus_code(struct v4l2_subdev *subdev, 1559static int smiapp_enum_mbus_code(struct v4l2_subdev *subdev,
1560 struct v4l2_subdev_fh *fh, 1560 struct v4l2_subdev_pad_config *cfg,
1561 struct v4l2_subdev_mbus_code_enum *code) 1561 struct v4l2_subdev_mbus_code_enum *code)
1562{ 1562{
1563 struct i2c_client *client = v4l2_get_subdevdata(subdev); 1563 struct i2c_client *client = v4l2_get_subdevdata(subdev);
@@ -1611,13 +1611,13 @@ static u32 __smiapp_get_mbus_code(struct v4l2_subdev *subdev,
1611} 1611}
1612 1612
1613static int __smiapp_get_format(struct v4l2_subdev *subdev, 1613static int __smiapp_get_format(struct v4l2_subdev *subdev,
1614 struct v4l2_subdev_fh *fh, 1614 struct v4l2_subdev_pad_config *cfg,
1615 struct v4l2_subdev_format *fmt) 1615 struct v4l2_subdev_format *fmt)
1616{ 1616{
1617 struct smiapp_subdev *ssd = to_smiapp_subdev(subdev); 1617 struct smiapp_subdev *ssd = to_smiapp_subdev(subdev);
1618 1618
1619 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1619 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
1620 fmt->format = *v4l2_subdev_get_try_format(fh, fmt->pad); 1620 fmt->format = *v4l2_subdev_get_try_format(subdev, cfg, fmt->pad);
1621 } else { 1621 } else {
1622 struct v4l2_rect *r; 1622 struct v4l2_rect *r;
1623 1623
@@ -1636,21 +1636,21 @@ static int __smiapp_get_format(struct v4l2_subdev *subdev,
1636} 1636}
1637 1637
1638static int smiapp_get_format(struct v4l2_subdev *subdev, 1638static int smiapp_get_format(struct v4l2_subdev *subdev,
1639 struct v4l2_subdev_fh *fh, 1639 struct v4l2_subdev_pad_config *cfg,
1640 struct v4l2_subdev_format *fmt) 1640 struct v4l2_subdev_format *fmt)
1641{ 1641{
1642 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 1642 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
1643 int rval; 1643 int rval;
1644 1644
1645 mutex_lock(&sensor->mutex); 1645 mutex_lock(&sensor->mutex);
1646 rval = __smiapp_get_format(subdev, fh, fmt); 1646 rval = __smiapp_get_format(subdev, cfg, fmt);
1647 mutex_unlock(&sensor->mutex); 1647 mutex_unlock(&sensor->mutex);
1648 1648
1649 return rval; 1649 return rval;
1650} 1650}
1651 1651
1652static void smiapp_get_crop_compose(struct v4l2_subdev *subdev, 1652static void smiapp_get_crop_compose(struct v4l2_subdev *subdev,
1653 struct v4l2_subdev_fh *fh, 1653 struct v4l2_subdev_pad_config *cfg,
1654 struct v4l2_rect **crops, 1654 struct v4l2_rect **crops,
1655 struct v4l2_rect **comps, int which) 1655 struct v4l2_rect **comps, int which)
1656{ 1656{
@@ -1666,12 +1666,12 @@ static void smiapp_get_crop_compose(struct v4l2_subdev *subdev,
1666 } else { 1666 } else {
1667 if (crops) { 1667 if (crops) {
1668 for (i = 0; i < subdev->entity.num_pads; i++) { 1668 for (i = 0; i < subdev->entity.num_pads; i++) {
1669 crops[i] = v4l2_subdev_get_try_crop(fh, i); 1669 crops[i] = v4l2_subdev_get_try_crop(subdev, cfg, i);
1670 BUG_ON(!crops[i]); 1670 BUG_ON(!crops[i]);
1671 } 1671 }
1672 } 1672 }
1673 if (comps) { 1673 if (comps) {
1674 *comps = v4l2_subdev_get_try_compose(fh, 1674 *comps = v4l2_subdev_get_try_compose(subdev, cfg,
1675 SMIAPP_PAD_SINK); 1675 SMIAPP_PAD_SINK);
1676 BUG_ON(!*comps); 1676 BUG_ON(!*comps);
1677 } 1677 }
@@ -1680,14 +1680,14 @@ static void smiapp_get_crop_compose(struct v4l2_subdev *subdev,
1680 1680
1681/* Changes require propagation only on sink pad. */ 1681/* Changes require propagation only on sink pad. */
1682static void smiapp_propagate(struct v4l2_subdev *subdev, 1682static void smiapp_propagate(struct v4l2_subdev *subdev,
1683 struct v4l2_subdev_fh *fh, int which, 1683 struct v4l2_subdev_pad_config *cfg, int which,
1684 int target) 1684 int target)
1685{ 1685{
1686 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 1686 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
1687 struct smiapp_subdev *ssd = to_smiapp_subdev(subdev); 1687 struct smiapp_subdev *ssd = to_smiapp_subdev(subdev);
1688 struct v4l2_rect *comp, *crops[SMIAPP_PADS]; 1688 struct v4l2_rect *comp, *crops[SMIAPP_PADS];
1689 1689
1690 smiapp_get_crop_compose(subdev, fh, crops, &comp, which); 1690 smiapp_get_crop_compose(subdev, cfg, crops, &comp, which);
1691 1691
1692 switch (target) { 1692 switch (target) {
1693 case V4L2_SEL_TGT_CROP: 1693 case V4L2_SEL_TGT_CROP:
@@ -1730,7 +1730,7 @@ static const struct smiapp_csi_data_format
1730} 1730}
1731 1731
1732static int smiapp_set_format_source(struct v4l2_subdev *subdev, 1732static int smiapp_set_format_source(struct v4l2_subdev *subdev,
1733 struct v4l2_subdev_fh *fh, 1733 struct v4l2_subdev_pad_config *cfg,
1734 struct v4l2_subdev_format *fmt) 1734 struct v4l2_subdev_format *fmt)
1735{ 1735{
1736 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 1736 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
@@ -1741,7 +1741,7 @@ static int smiapp_set_format_source(struct v4l2_subdev *subdev,
1741 unsigned int i; 1741 unsigned int i;
1742 int rval; 1742 int rval;
1743 1743
1744 rval = __smiapp_get_format(subdev, fh, fmt); 1744 rval = __smiapp_get_format(subdev, cfg, fmt);
1745 if (rval) 1745 if (rval)
1746 return rval; 1746 return rval;
1747 1747
@@ -1783,7 +1783,7 @@ static int smiapp_set_format_source(struct v4l2_subdev *subdev,
1783} 1783}
1784 1784
1785static int smiapp_set_format(struct v4l2_subdev *subdev, 1785static int smiapp_set_format(struct v4l2_subdev *subdev,
1786 struct v4l2_subdev_fh *fh, 1786 struct v4l2_subdev_pad_config *cfg,
1787 struct v4l2_subdev_format *fmt) 1787 struct v4l2_subdev_format *fmt)
1788{ 1788{
1789 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 1789 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
@@ -1795,7 +1795,7 @@ static int smiapp_set_format(struct v4l2_subdev *subdev,
1795 if (fmt->pad == ssd->source_pad) { 1795 if (fmt->pad == ssd->source_pad) {
1796 int rval; 1796 int rval;
1797 1797
1798 rval = smiapp_set_format_source(subdev, fh, fmt); 1798 rval = smiapp_set_format_source(subdev, cfg, fmt);
1799 1799
1800 mutex_unlock(&sensor->mutex); 1800 mutex_unlock(&sensor->mutex);
1801 1801
@@ -1817,7 +1817,7 @@ static int smiapp_set_format(struct v4l2_subdev *subdev,
1817 sensor->limits[SMIAPP_LIMIT_MIN_Y_OUTPUT_SIZE], 1817 sensor->limits[SMIAPP_LIMIT_MIN_Y_OUTPUT_SIZE],
1818 sensor->limits[SMIAPP_LIMIT_MAX_Y_OUTPUT_SIZE]); 1818 sensor->limits[SMIAPP_LIMIT_MAX_Y_OUTPUT_SIZE]);
1819 1819
1820 smiapp_get_crop_compose(subdev, fh, crops, NULL, fmt->which); 1820 smiapp_get_crop_compose(subdev, cfg, crops, NULL, fmt->which);
1821 1821
1822 crops[ssd->sink_pad]->left = 0; 1822 crops[ssd->sink_pad]->left = 0;
1823 crops[ssd->sink_pad]->top = 0; 1823 crops[ssd->sink_pad]->top = 0;
@@ -1825,7 +1825,7 @@ static int smiapp_set_format(struct v4l2_subdev *subdev,
1825 crops[ssd->sink_pad]->height = fmt->format.height; 1825 crops[ssd->sink_pad]->height = fmt->format.height;
1826 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) 1826 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE)
1827 ssd->sink_fmt = *crops[ssd->sink_pad]; 1827 ssd->sink_fmt = *crops[ssd->sink_pad];
1828 smiapp_propagate(subdev, fh, fmt->which, 1828 smiapp_propagate(subdev, cfg, fmt->which,
1829 V4L2_SEL_TGT_CROP); 1829 V4L2_SEL_TGT_CROP);
1830 1830
1831 mutex_unlock(&sensor->mutex); 1831 mutex_unlock(&sensor->mutex);
@@ -1878,7 +1878,7 @@ static int scaling_goodness(struct v4l2_subdev *subdev, int w, int ask_w,
1878} 1878}
1879 1879
1880static void smiapp_set_compose_binner(struct v4l2_subdev *subdev, 1880static void smiapp_set_compose_binner(struct v4l2_subdev *subdev,
1881 struct v4l2_subdev_fh *fh, 1881 struct v4l2_subdev_pad_config *cfg,
1882 struct v4l2_subdev_selection *sel, 1882 struct v4l2_subdev_selection *sel,
1883 struct v4l2_rect **crops, 1883 struct v4l2_rect **crops,
1884 struct v4l2_rect *comp) 1884 struct v4l2_rect *comp)
@@ -1926,7 +1926,7 @@ static void smiapp_set_compose_binner(struct v4l2_subdev *subdev,
1926 * result. 1926 * result.
1927 */ 1927 */
1928static void smiapp_set_compose_scaler(struct v4l2_subdev *subdev, 1928static void smiapp_set_compose_scaler(struct v4l2_subdev *subdev,
1929 struct v4l2_subdev_fh *fh, 1929 struct v4l2_subdev_pad_config *cfg,
1930 struct v4l2_subdev_selection *sel, 1930 struct v4l2_subdev_selection *sel,
1931 struct v4l2_rect **crops, 1931 struct v4l2_rect **crops,
1932 struct v4l2_rect *comp) 1932 struct v4l2_rect *comp)
@@ -2042,25 +2042,25 @@ static void smiapp_set_compose_scaler(struct v4l2_subdev *subdev,
2042} 2042}
2043/* We're only called on source pads. This function sets scaling. */ 2043/* We're only called on source pads. This function sets scaling. */
2044static int smiapp_set_compose(struct v4l2_subdev *subdev, 2044static int smiapp_set_compose(struct v4l2_subdev *subdev,
2045 struct v4l2_subdev_fh *fh, 2045 struct v4l2_subdev_pad_config *cfg,
2046 struct v4l2_subdev_selection *sel) 2046 struct v4l2_subdev_selection *sel)
2047{ 2047{
2048 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 2048 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
2049 struct smiapp_subdev *ssd = to_smiapp_subdev(subdev); 2049 struct smiapp_subdev *ssd = to_smiapp_subdev(subdev);
2050 struct v4l2_rect *comp, *crops[SMIAPP_PADS]; 2050 struct v4l2_rect *comp, *crops[SMIAPP_PADS];
2051 2051
2052 smiapp_get_crop_compose(subdev, fh, crops, &comp, sel->which); 2052 smiapp_get_crop_compose(subdev, cfg, crops, &comp, sel->which);
2053 2053
2054 sel->r.top = 0; 2054 sel->r.top = 0;
2055 sel->r.left = 0; 2055 sel->r.left = 0;
2056 2056
2057 if (ssd == sensor->binner) 2057 if (ssd == sensor->binner)
2058 smiapp_set_compose_binner(subdev, fh, sel, crops, comp); 2058 smiapp_set_compose_binner(subdev, cfg, sel, crops, comp);
2059 else 2059 else
2060 smiapp_set_compose_scaler(subdev, fh, sel, crops, comp); 2060 smiapp_set_compose_scaler(subdev, cfg, sel, crops, comp);
2061 2061
2062 *comp = sel->r; 2062 *comp = sel->r;
2063 smiapp_propagate(subdev, fh, sel->which, 2063 smiapp_propagate(subdev, cfg, sel->which,
2064 V4L2_SEL_TGT_COMPOSE); 2064 V4L2_SEL_TGT_COMPOSE);
2065 2065
2066 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) 2066 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE)
@@ -2113,7 +2113,7 @@ static int __smiapp_sel_supported(struct v4l2_subdev *subdev,
2113} 2113}
2114 2114
2115static int smiapp_set_crop(struct v4l2_subdev *subdev, 2115static int smiapp_set_crop(struct v4l2_subdev *subdev,
2116 struct v4l2_subdev_fh *fh, 2116 struct v4l2_subdev_pad_config *cfg,
2117 struct v4l2_subdev_selection *sel) 2117 struct v4l2_subdev_selection *sel)
2118{ 2118{
2119 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 2119 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
@@ -2121,7 +2121,7 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,
2121 struct v4l2_rect *src_size, *crops[SMIAPP_PADS]; 2121 struct v4l2_rect *src_size, *crops[SMIAPP_PADS];
2122 struct v4l2_rect _r; 2122 struct v4l2_rect _r;
2123 2123
2124 smiapp_get_crop_compose(subdev, fh, crops, NULL, sel->which); 2124 smiapp_get_crop_compose(subdev, cfg, crops, NULL, sel->which);
2125 2125
2126 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 2126 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
2127 if (sel->pad == ssd->sink_pad) 2127 if (sel->pad == ssd->sink_pad)
@@ -2132,15 +2132,15 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,
2132 if (sel->pad == ssd->sink_pad) { 2132 if (sel->pad == ssd->sink_pad) {
2133 _r.left = 0; 2133 _r.left = 0;
2134 _r.top = 0; 2134 _r.top = 0;
2135 _r.width = v4l2_subdev_get_try_format(fh, sel->pad) 2135 _r.width = v4l2_subdev_get_try_format(subdev, cfg, sel->pad)
2136 ->width; 2136 ->width;
2137 _r.height = v4l2_subdev_get_try_format(fh, sel->pad) 2137 _r.height = v4l2_subdev_get_try_format(subdev, cfg, sel->pad)
2138 ->height; 2138 ->height;
2139 src_size = &_r; 2139 src_size = &_r;
2140 } else { 2140 } else {
2141 src_size = 2141 src_size =
2142 v4l2_subdev_get_try_compose( 2142 v4l2_subdev_get_try_compose(
2143 fh, ssd->sink_pad); 2143 subdev, cfg, ssd->sink_pad);
2144 } 2144 }
2145 } 2145 }
2146 2146
@@ -2158,14 +2158,14 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,
2158 *crops[sel->pad] = sel->r; 2158 *crops[sel->pad] = sel->r;
2159 2159
2160 if (ssd != sensor->pixel_array && sel->pad == SMIAPP_PAD_SINK) 2160 if (ssd != sensor->pixel_array && sel->pad == SMIAPP_PAD_SINK)
2161 smiapp_propagate(subdev, fh, sel->which, 2161 smiapp_propagate(subdev, cfg, sel->which,
2162 V4L2_SEL_TGT_CROP); 2162 V4L2_SEL_TGT_CROP);
2163 2163
2164 return 0; 2164 return 0;
2165} 2165}
2166 2166
2167static int __smiapp_get_selection(struct v4l2_subdev *subdev, 2167static int __smiapp_get_selection(struct v4l2_subdev *subdev,
2168 struct v4l2_subdev_fh *fh, 2168 struct v4l2_subdev_pad_config *cfg,
2169 struct v4l2_subdev_selection *sel) 2169 struct v4l2_subdev_selection *sel)
2170{ 2170{
2171 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 2171 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
@@ -2178,13 +2178,13 @@ static int __smiapp_get_selection(struct v4l2_subdev *subdev,
2178 if (ret) 2178 if (ret)
2179 return ret; 2179 return ret;
2180 2180
2181 smiapp_get_crop_compose(subdev, fh, crops, &comp, sel->which); 2181 smiapp_get_crop_compose(subdev, cfg, crops, &comp, sel->which);
2182 2182
2183 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 2183 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
2184 sink_fmt = ssd->sink_fmt; 2184 sink_fmt = ssd->sink_fmt;
2185 } else { 2185 } else {
2186 struct v4l2_mbus_framefmt *fmt = 2186 struct v4l2_mbus_framefmt *fmt =
2187 v4l2_subdev_get_try_format(fh, ssd->sink_pad); 2187 v4l2_subdev_get_try_format(subdev, cfg, ssd->sink_pad);
2188 2188
2189 sink_fmt.left = 0; 2189 sink_fmt.left = 0;
2190 sink_fmt.top = 0; 2190 sink_fmt.top = 0;
@@ -2220,20 +2220,20 @@ static int __smiapp_get_selection(struct v4l2_subdev *subdev,
2220} 2220}
2221 2221
2222static int smiapp_get_selection(struct v4l2_subdev *subdev, 2222static int smiapp_get_selection(struct v4l2_subdev *subdev,
2223 struct v4l2_subdev_fh *fh, 2223 struct v4l2_subdev_pad_config *cfg,
2224 struct v4l2_subdev_selection *sel) 2224 struct v4l2_subdev_selection *sel)
2225{ 2225{
2226 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 2226 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
2227 int rval; 2227 int rval;
2228 2228
2229 mutex_lock(&sensor->mutex); 2229 mutex_lock(&sensor->mutex);
2230 rval = __smiapp_get_selection(subdev, fh, sel); 2230 rval = __smiapp_get_selection(subdev, cfg, sel);
2231 mutex_unlock(&sensor->mutex); 2231 mutex_unlock(&sensor->mutex);
2232 2232
2233 return rval; 2233 return rval;
2234} 2234}
2235static int smiapp_set_selection(struct v4l2_subdev *subdev, 2235static int smiapp_set_selection(struct v4l2_subdev *subdev,
2236 struct v4l2_subdev_fh *fh, 2236 struct v4l2_subdev_pad_config *cfg,
2237 struct v4l2_subdev_selection *sel) 2237 struct v4l2_subdev_selection *sel)
2238{ 2238{
2239 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev); 2239 struct smiapp_sensor *sensor = to_smiapp_sensor(subdev);
@@ -2259,10 +2259,10 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev,
2259 2259
2260 switch (sel->target) { 2260 switch (sel->target) {
2261 case V4L2_SEL_TGT_CROP: 2261 case V4L2_SEL_TGT_CROP:
2262 ret = smiapp_set_crop(subdev, fh, sel); 2262 ret = smiapp_set_crop(subdev, cfg, sel);
2263 break; 2263 break;
2264 case V4L2_SEL_TGT_COMPOSE: 2264 case V4L2_SEL_TGT_COMPOSE:
2265 ret = smiapp_set_compose(subdev, fh, sel); 2265 ret = smiapp_set_compose(subdev, cfg, sel);
2266 break; 2266 break;
2267 default: 2267 default:
2268 ret = -EINVAL; 2268 ret = -EINVAL;
@@ -2841,8 +2841,8 @@ static int smiapp_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
2841 2841
2842 for (i = 0; i < ssd->npads; i++) { 2842 for (i = 0; i < ssd->npads; i++) {
2843 struct v4l2_mbus_framefmt *try_fmt = 2843 struct v4l2_mbus_framefmt *try_fmt =
2844 v4l2_subdev_get_try_format(fh, i); 2844 v4l2_subdev_get_try_format(sd, fh->pad, i);
2845 struct v4l2_rect *try_crop = v4l2_subdev_get_try_crop(fh, i); 2845 struct v4l2_rect *try_crop = v4l2_subdev_get_try_crop(sd, fh->pad, i);
2846 struct v4l2_rect *try_comp; 2846 struct v4l2_rect *try_comp;
2847 2847
2848 try_fmt->width = sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1; 2848 try_fmt->width = sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1;
@@ -2858,7 +2858,7 @@ static int smiapp_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
2858 if (ssd != sensor->pixel_array) 2858 if (ssd != sensor->pixel_array)
2859 continue; 2859 continue;
2860 2860
2861 try_comp = v4l2_subdev_get_try_compose(fh, i); 2861 try_comp = v4l2_subdev_get_try_compose(sd, fh->pad, i);
2862 *try_comp = *try_crop; 2862 *try_comp = *try_crop;
2863 } 2863 }
2864 2864
diff --git a/drivers/media/i2c/tvp514x.c b/drivers/media/i2c/tvp514x.c
index c6b3dc541cc2..1c6bc306ecdc 100644
--- a/drivers/media/i2c/tvp514x.c
+++ b/drivers/media/i2c/tvp514x.c
@@ -923,13 +923,13 @@ static const struct v4l2_ctrl_ops tvp514x_ctrl_ops = {
923/** 923/**
924 * tvp514x_enum_mbus_code() - V4L2 decoder interface handler for enum_mbus_code 924 * tvp514x_enum_mbus_code() - V4L2 decoder interface handler for enum_mbus_code
925 * @sd: pointer to standard V4L2 sub-device structure 925 * @sd: pointer to standard V4L2 sub-device structure
926 * @fh: file handle 926 * @cfg: pad configuration
927 * @code: pointer to v4l2_subdev_mbus_code_enum structure 927 * @code: pointer to v4l2_subdev_mbus_code_enum structure
928 * 928 *
929 * Enumertaes mbus codes supported 929 * Enumertaes mbus codes supported
930 */ 930 */
931static int tvp514x_enum_mbus_code(struct v4l2_subdev *sd, 931static int tvp514x_enum_mbus_code(struct v4l2_subdev *sd,
932 struct v4l2_subdev_fh *fh, 932 struct v4l2_subdev_pad_config *cfg,
933 struct v4l2_subdev_mbus_code_enum *code) 933 struct v4l2_subdev_mbus_code_enum *code)
934{ 934{
935 u32 pad = code->pad; 935 u32 pad = code->pad;
@@ -950,13 +950,13 @@ static int tvp514x_enum_mbus_code(struct v4l2_subdev *sd,
950/** 950/**
951 * tvp514x_get_pad_format() - V4L2 decoder interface handler for get pad format 951 * tvp514x_get_pad_format() - V4L2 decoder interface handler for get pad format
952 * @sd: pointer to standard V4L2 sub-device structure 952 * @sd: pointer to standard V4L2 sub-device structure
953 * @fh: file handle 953 * @cfg: pad configuration
954 * @format: pointer to v4l2_subdev_format structure 954 * @format: pointer to v4l2_subdev_format structure
955 * 955 *
956 * Retrieves pad format which is active or tried based on requirement 956 * Retrieves pad format which is active or tried based on requirement
957 */ 957 */
958static int tvp514x_get_pad_format(struct v4l2_subdev *sd, 958static int tvp514x_get_pad_format(struct v4l2_subdev *sd,
959 struct v4l2_subdev_fh *fh, 959 struct v4l2_subdev_pad_config *cfg,
960 struct v4l2_subdev_format *format) 960 struct v4l2_subdev_format *format)
961{ 961{
962 struct tvp514x_decoder *decoder = to_decoder(sd); 962 struct tvp514x_decoder *decoder = to_decoder(sd);
@@ -979,13 +979,13 @@ static int tvp514x_get_pad_format(struct v4l2_subdev *sd,
979/** 979/**
980 * tvp514x_set_pad_format() - V4L2 decoder interface handler for set pad format 980 * tvp514x_set_pad_format() - V4L2 decoder interface handler for set pad format
981 * @sd: pointer to standard V4L2 sub-device structure 981 * @sd: pointer to standard V4L2 sub-device structure
982 * @fh: file handle 982 * @cfg: pad configuration
983 * @format: pointer to v4l2_subdev_format structure 983 * @format: pointer to v4l2_subdev_format structure
984 * 984 *
985 * Set pad format for the output pad 985 * Set pad format for the output pad
986 */ 986 */
987static int tvp514x_set_pad_format(struct v4l2_subdev *sd, 987static int tvp514x_set_pad_format(struct v4l2_subdev *sd,
988 struct v4l2_subdev_fh *fh, 988 struct v4l2_subdev_pad_config *cfg,
989 struct v4l2_subdev_format *fmt) 989 struct v4l2_subdev_format *fmt)
990{ 990{
991 struct tvp514x_decoder *decoder = to_decoder(sd); 991 struct tvp514x_decoder *decoder = to_decoder(sd);
diff --git a/drivers/media/i2c/tvp7002.c b/drivers/media/i2c/tvp7002.c
index 9233194233eb..787cdfb08749 100644
--- a/drivers/media/i2c/tvp7002.c
+++ b/drivers/media/i2c/tvp7002.c
@@ -846,13 +846,13 @@ static const struct v4l2_ctrl_ops tvp7002_ctrl_ops = {
846/* 846/*
847 * tvp7002_enum_mbus_code() - Enum supported digital video format on pad 847 * tvp7002_enum_mbus_code() - Enum supported digital video format on pad
848 * @sd: pointer to standard V4L2 sub-device structure 848 * @sd: pointer to standard V4L2 sub-device structure
849 * @fh: file handle for the subdev 849 * @cfg: pad configuration
850 * @code: pointer to subdev enum mbus code struct 850 * @code: pointer to subdev enum mbus code struct
851 * 851 *
852 * Enumerate supported digital video formats for pad. 852 * Enumerate supported digital video formats for pad.
853 */ 853 */
854static int 854static int
855tvp7002_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 855tvp7002_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
856 struct v4l2_subdev_mbus_code_enum *code) 856 struct v4l2_subdev_mbus_code_enum *code)
857{ 857{
858 /* Check requested format index is within range */ 858 /* Check requested format index is within range */
@@ -867,13 +867,13 @@ tvp7002_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
867/* 867/*
868 * tvp7002_get_pad_format() - get video format on pad 868 * tvp7002_get_pad_format() - get video format on pad
869 * @sd: pointer to standard V4L2 sub-device structure 869 * @sd: pointer to standard V4L2 sub-device structure
870 * @fh: file handle for the subdev 870 * @cfg: pad configuration
871 * @fmt: pointer to subdev format struct 871 * @fmt: pointer to subdev format struct
872 * 872 *
873 * get video format for pad. 873 * get video format for pad.
874 */ 874 */
875static int 875static int
876tvp7002_get_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 876tvp7002_get_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
877 struct v4l2_subdev_format *fmt) 877 struct v4l2_subdev_format *fmt)
878{ 878{
879 struct tvp7002 *tvp7002 = to_tvp7002(sd); 879 struct tvp7002 *tvp7002 = to_tvp7002(sd);
@@ -890,16 +890,16 @@ tvp7002_get_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
890/* 890/*
891 * tvp7002_set_pad_format() - set video format on pad 891 * tvp7002_set_pad_format() - set video format on pad
892 * @sd: pointer to standard V4L2 sub-device structure 892 * @sd: pointer to standard V4L2 sub-device structure
893 * @fh: file handle for the subdev 893 * @cfg: pad configuration
894 * @fmt: pointer to subdev format struct 894 * @fmt: pointer to subdev format struct
895 * 895 *
896 * set video format for pad. 896 * set video format for pad.
897 */ 897 */
898static int 898static int
899tvp7002_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 899tvp7002_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
900 struct v4l2_subdev_format *fmt) 900 struct v4l2_subdev_format *fmt)
901{ 901{
902 return tvp7002_get_pad_format(sd, fh, fmt); 902 return tvp7002_get_pad_format(sd, cfg, fmt);
903} 903}
904 904
905/* V4L2 core operation handlers */ 905/* V4L2 core operation handlers */