Skip to contentSkip to conversation

Metadata series preparation

PATCH Superseded Sakari Ailus 3 participants 49 messages Feb 11 – Apr 2

Subsystems (162)

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

v2 cover Metadata series preparation

Hi folks,

This smallish set contains patches that prepare for merging the metadata series.

There are simple cleanups but also two noteworthy changes: the addition of the VALIDATE_LATE media link flag and the addition of the new struct v4l2_subdev_client_info struct to the get_fmt, set_fmt, get_selection and set_selection pad operation arguments.

The VALIDATE_LATE allows using the link_validate callback as the way to validate the links connected to the sink pads of video nodes on pipelines with multiple capture video nodes. Without this flag, the entire pipeline will be validated at the time of the first streamon, with the V4L2 pixel (or other) format set on the other capture video nodes at the time, requiring all formats to be set before starting streaming anywhere. But this does generally not match with what the userspace would do, hence the new flag. The patches in the upcoming metadata series version adds the support for the flag to the IPU6 driver.

Secondly, the new struct v4l2_subdev_client_info enables passing around file handler specific client capability information, which is used to differentiate UAPI between existing users and those that are aware of the new common raw sensor model. This is effectively required if we want to add support for the new model to existing raw sensor drivers: the new model is in a direct conflict with how things worked before the model. There still needs to be a single driver internal state, the different UAPIs simply offer a different view to that state. In-kernel users that do not deal with capabilities just use NULL when calling these ops. This also means that whatever client capabilities are being used, there may not be a change to inter-driver interfaces such as get_fmt() when dealing with external pads.

I'm leaving the last Coccinelle-generated patch out this time as it's more than 200 kiB. The patch can be found here <URL:<https://git.linuxtv.org/sailus/media_tree.git/log/?h=metadata-pre>. Patches 11--14 will be squashed together before merging.

The Coccinelle spatch used to generate the 14th patch is below, as is a Perl script to generate another Coccinelle patch doing the rest of the job:

caps.cocci
------------------8<----------------------
@ fmt @
identifier a1, a2, a3;
identifier fn;

@@

fn(struct v4l2_subdev *a1,
+ const struct v4l2_subdev_client_info *ci,
struct v4l2_subdev_state *a2, struct v4l2_subdev_format *a3) {...}

@ sel @
identifier a1, a2, a3;
identifier fn2;

@@

fn2(struct v4l2_subdev *a1,
+ const struct v4l2_subdev_client_info *ci,
struct v4l2_subdev_state *a2, struct v4l2_subdev_selection *a3) {...}

@ fmt_call @
expression a1, a2, a3;
identifier fmt.fn;
@@

fn(a1
+ , NULL
, a2, a3);

@ fmt_call2 @
expression a1, a2, a3;
identifier fmt.fn;
@@

return fn(a1
+ , NULL
, a2, a3);

@ fmt_call3 @
expression ret, a1, a2, a3;
identifier fmt.fn;

@@

ret = fn(a1
+ , NULL
, a2, a3);

@ fmt_call4 @
expression a1, a2, a3;
identifier sel.fn2;
@@

fn2(a1
+ , NULL
, a2, a3);

@ fmt_call5 @
expression a1, a2, a3;
identifier sel.fn2;
@@

return fn2(a1
+ , NULL
, a2, a3);

@ fmt_call6 @
expression ret, a1, a2, a3;
identifier sel.fn2;

@@

ret = fn2(a1
+ , NULL
, a2, a3);

------------------8<----------------------

mk-caps2.pl
------------------8<----------------------
#!/usr/bin/perl -w

my @prefix = (

	"(void)",
	"",
	"ret = ",
	"return "

);

my $state_args = [

	[ "sd", "state", "fmt" ]

];

my $pad_active_args = [

	[ "sd", "pad", "get_fmt", "fmt" ],
	[ "sd", "pad", "set_fmt", "fmt" ],
	[ "sd", "pad", "get_selection", "fmt" ],
	[ "sd", "pad", "set_selection", "fmt" ],

];

my $pad_args = [

	[ "sd", "pad", "get_fmt", "state", "fmt" ],
	[ "sd", "pad", "set_fmt", "state", "fmt" ],
	[ "sd", "pad", "get_selection", "state", "fmt" ],
	[ "sd", "pad", "set_selection", "state", "fmt" ],

];

my $group_args = [

	[ "dev", "group", "pad", "get_fmt", "state", "fmt" ],
	[ "dev", "group", "pad", "set_fmt", "state", "fmt" ],
	[ "dev", "group", "pad", "get_selection", "state", "fmt" ],
	[ "dev", "group", "pad", "set_selection", "state", "fmt" ],

];

my %funcs = (

	# "function_name" => [ arg ref, new arg position from the end ],
	"v4l2_subdev_call" => { args => $pad_args, pos => 1 },
	"v4l2_device_call_all" => { args => $group_args, pos => 1 },
	"v4l2_subdev_get_fmt" => { args => $state_args, pos => 1 },
	"sensor_call" => { args => $pad_args, pos => 1 },
	"saa_call_all" => { args => $pad_args, pos => 1 },
	"call_all" => { args => $pad_args, pos => 1 },
	"v4l2_subdev_call_state_active" => { args => $pad_active_args, newname => "v4l2_subdev_call_ci_state_active" },

);

my $rule;

foreach my $p (@prefix) {
	foreach my $f (keys %funcs) {
		my $aref = $funcs{$f};

		foreach my $i (@{$aref->{args}}) {
			my $newname = $aref->{newname};

			print "@ rule" . $rule++ . " @\n";
			print "symbol $f;\n";
			print map {
				((/_/ || /^pad$/) ?
				"symbol" : "expression") . " $_;\n";
			} @$i;
			my @pre = @$i;
			my @post = splice @pre, $#pre - ($aref->{pos} // 0);
			print "identifier ret;\n" if $p =~ "ret =";
			print "@@\n";
			if (! defined $newname) {
				print "  $p$f(" . join(", ", @pre) . "\n";
				print "+ , NULL\n";
				print "  , " . join(", ", @post) . ");\n";
			} else {
				print "  $p\n";
				print "- $f(\n";
				print "+ $newname(\n";
				print "  " . join(", ", (@pre, @post)) . ");\n";
			}
		}
	}
}

------------------8<----------------------

since v2:

- Address compilation issues. I had only tested on arm64 previously.

- Introduce v4l2_subdev_call_ci_state_active(), to call pad ops with client info argument with active state. Getting around needing a new function doesn't seem easy (probably requires one more layer of indirection I'd like to do without).

Sakari Ailus (14):
media: imx219: Rename "PIXEL_ARRAY" as "CROP"
media: v4l2-subdev: Allow accessing routes with STREAMS client
capability
media: Documentation: Improve LINK_FREQ documentation
media: Documentation: Improve pixel rate calculation documentation
media: v4l2-subdev: Refactor returning routes
media: mc: Separate single link validation into a new function
media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE
media: mc: Don't care about unsettable flags in MEDIA_IOC_LINK_SETUP
media: Document enable_streams and disable_streams behaviour
media: v4l2-subdev: Move subdev client capabilities into a new struct
media: v4l2-subdev: Add struct v4l2_subdev_client_info pointer to pad
ops
media: v4l2-subdev: Add v4l2_subdev_call_ci_active_state
media: v4l2-subdev: Perform client info changes to i2c drivers
media: v4l2-subdev: Add struct v4l2_subdev_client_info argument to pad
ops

 Documentation/driver-api/media/tx-rx.rst      |   9 +-
 .../media/mediactl/media-ioc-setup-link.rst   |   4 +
 .../media/mediactl/media-types.rst            |   5 +
 .../media/v4l/ext-ctrls-image-process.rst     |   4 +-
 drivers/media/i2c/adv7170.c                   |   2 +
 drivers/media/i2c/adv7175.c                   |   2 +
 drivers/media/i2c/adv7180.c                   |   4 +-
 drivers/media/i2c/adv7183.c                   |   4 +-
 drivers/media/i2c/adv748x/adv748x-afe.c       |   4 +-
 drivers/media/i2c/adv748x/adv748x-csi2.c      |   3 +-
 drivers/media/i2c/adv748x/adv748x-hdmi.c      |   4 +-
 drivers/media/i2c/adv7511-v4l2.c              |   2 +
 drivers/media/i2c/adv7604.c                   |   3 +
 drivers/media/i2c/adv7842.c                   |   4 +-
 drivers/media/i2c/ak881x.c                    |   2 +
 drivers/media/i2c/alvium-csi2.c               |   3 +
 drivers/media/i2c/ar0521.c                    |   2 +
 drivers/media/i2c/ccs/ccs-core.c              |  15 +-
 drivers/media/i2c/cx25840/cx25840-core.c      |   1 +
 drivers/media/i2c/ds90ub913.c                 |   3 +-
 drivers/media/i2c/ds90ub953.c                 |   3 +-
 drivers/media/i2c/ds90ub960.c                 |   3 +-
 drivers/media/i2c/et8ek8/et8ek8_driver.c      |   2 +
 drivers/media/i2c/gc0308.c                    |   1 +
 drivers/media/i2c/gc0310.c                    |   1 +
 drivers/media/i2c/gc05a2.c                    |   4 +-
 drivers/media/i2c/gc08a3.c                    |   4 +-
 drivers/media/i2c/gc2145.c                    |   2 +
 drivers/media/i2c/hi556.c                     |   3 +
 drivers/media/i2c/hi846.c                     |   3 +
 drivers/media/i2c/hi847.c                     |   2 +
 drivers/media/i2c/imx111.c                    |   1 +
 drivers/media/i2c/imx208.c                    |   2 +
 drivers/media/i2c/imx214.c                    |   4 +-
 drivers/media/i2c/imx219.c                    |  32 ++--
 drivers/media/i2c/imx258.c                    |   3 +
 drivers/media/i2c/imx274.c                    |   4 +
 drivers/media/i2c/imx283.c                    |   2 +
 drivers/media/i2c/imx290.c                    |   4 +-
 drivers/media/i2c/imx296.c                    |   7 +-
 drivers/media/i2c/imx319.c                    |   2 +
 drivers/media/i2c/imx334.c                    |   4 +-
 drivers/media/i2c/imx335.c                    |   4 +-
 drivers/media/i2c/imx355.c                    |   2 +
 drivers/media/i2c/imx412.c                    |   4 +-
 drivers/media/i2c/imx415.c                    |   4 +-
 drivers/media/i2c/isl7998x.c                  |   2 +
 drivers/media/i2c/lt6911uxe.c                 |   5 +-
 drivers/media/i2c/max9286.c                   |   3 +-
 drivers/media/i2c/max96714.c                  |   3 +-
 drivers/media/i2c/max96717.c                  |   3 +-
 drivers/media/i2c/ml86v7667.c                 |   1 +
 drivers/media/i2c/mt9m001.c                   |   6 +-
 drivers/media/i2c/mt9m111.c                   |   4 +
 drivers/media/i2c/mt9m114.c                   |   6 +
 drivers/media/i2c/mt9p031.c                   |   4 +
 drivers/media/i2c/mt9t112.c                   |   4 +
 drivers/media/i2c/mt9v011.c                   |   1 +
 drivers/media/i2c/mt9v032.c                   |   4 +
 drivers/media/i2c/mt9v111.c                   |   2 +
 drivers/media/i2c/og01a1b.c                   |   2 +
 drivers/media/i2c/og0ve1b.c                   |   3 +-
 drivers/media/i2c/os05b10.c                   |   2 +
 drivers/media/i2c/ov01a10.c                   |   3 +
 drivers/media/i2c/ov02a10.c                   |   4 +-
 drivers/media/i2c/ov02c10.c                   |   1 +
 drivers/media/i2c/ov02e10.c                   |   2 +
 drivers/media/i2c/ov08d10.c                   |   2 +
 drivers/media/i2c/ov08x40.c                   |   2 +
 drivers/media/i2c/ov13858.c                   |   2 +
 drivers/media/i2c/ov13b10.c                   |   2 +
 drivers/media/i2c/ov2640.c                    |   3 +
 drivers/media/i2c/ov2659.c                    |   2 +
 drivers/media/i2c/ov2680.c                    |   4 +
 drivers/media/i2c/ov2685.c                    |   3 +
 drivers/media/i2c/ov2735.c                    |   4 +-
 drivers/media/i2c/ov2740.c                    |   1 +
 drivers/media/i2c/ov4689.c                    |   2 +
 drivers/media/i2c/ov5640.c                    |   3 +
 drivers/media/i2c/ov5645.c                    |   4 +-
 drivers/media/i2c/ov5647.c                    |   3 +
 drivers/media/i2c/ov5648.c                    |   2 +
 drivers/media/i2c/ov5670.c                    |   3 +
 drivers/media/i2c/ov5675.c                    |   3 +
 drivers/media/i2c/ov5693.c                    |   4 +
 drivers/media/i2c/ov5695.c                    |   2 +
 drivers/media/i2c/ov6211.c                    |   3 +-
 drivers/media/i2c/ov64a40.c                   |   2 +
 drivers/media/i2c/ov7251.c                    |   5 +-
 drivers/media/i2c/ov7670.c                    |   2 +
 drivers/media/i2c/ov772x.c                    |   3 +
 drivers/media/i2c/ov7740.c                    |   2 +
 drivers/media/i2c/ov8856.c                    |   2 +
 drivers/media/i2c/ov8858.c                    |   3 +-
 drivers/media/i2c/ov8865.c                    |   3 +
 drivers/media/i2c/ov9282.c                    |   5 +-
 drivers/media/i2c/ov9640.c                    |   2 +
 drivers/media/i2c/ov9650.c                    |   2 +
 drivers/media/i2c/ov9734.c                    |   2 +
 drivers/media/i2c/rdacm20.c                   |   1 +
 drivers/media/i2c/rdacm21.c                   |   1 +
 drivers/media/i2c/rj54n1cb0c.c                |   4 +
 drivers/media/i2c/s5c73m3/s5c73m3-core.c      |   4 +
 drivers/media/i2c/s5k3m5.c                    |   4 +-
 drivers/media/i2c/s5k5baf.c                   |   4 +
 drivers/media/i2c/s5k6a3.c                    |   2 +
 drivers/media/i2c/s5kjn1.c                    |   4 +-
 drivers/media/i2c/saa6752hs.c                 |   2 +
 drivers/media/i2c/saa7115.c                   |   1 +
 drivers/media/i2c/saa717x.c                   |   1 +
 drivers/media/i2c/st-mipid02.c                |   1 +
 drivers/media/i2c/tc358743.c                  |   4 +-
 drivers/media/i2c/tc358746.c                  |   3 +-
 drivers/media/i2c/tda1997x.c                  |   2 +
 drivers/media/i2c/thp7312.c                   |   1 +
 drivers/media/i2c/tvp514x.c                   |   2 +
 drivers/media/i2c/tvp5150.c                   |   3 +
 drivers/media/i2c/tvp7002.c                   |   4 +-
 drivers/media/i2c/tw9900.c                    |   2 +
 drivers/media/i2c/tw9910.c                    |   3 +
 drivers/media/i2c/vd55g1.c                    |   4 +-
 drivers/media/i2c/vd56g3.c                    |   4 +-
 drivers/media/i2c/vgxy61.c                    |   5 +-
 drivers/media/mc/mc-entity.c                  | 144 +++++++++++++-----
 drivers/media/pci/cobalt/cobalt-driver.c      |   8 +-
 drivers/media/pci/cobalt/cobalt-v4l2.c        |  14 +-
 drivers/media/pci/cx18/cx18-av-core.c         |   1 +
 drivers/media/pci/cx18/cx18-controls.c        |   2 +-
 drivers/media/pci/cx18/cx18-ioctl.c           |   2 +-
 drivers/media/pci/cx23885/cx23885-video.c     |   4 +-
 drivers/media/pci/intel/ipu3/ipu3-cio2.c      |   5 +-
 drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c |   2 +
 .../media/pci/intel/ipu6/ipu6-isys-subdev.c   |   3 +-
 .../media/pci/intel/ipu6/ipu6-isys-subdev.h   |   1 +
 drivers/media/pci/intel/ivsc/mei_csi.c        |   1 +
 drivers/media/pci/ivtv/ivtv-controls.c        |   2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c           |   2 +-
 drivers/media/pci/saa7134/saa7134-empress.c   |   6 +-
 .../platform/amlogic/c3/isp/c3-isp-capture.c  |   2 +-
 .../platform/amlogic/c3/isp/c3-isp-core.c     |   1 +
 .../platform/amlogic/c3/isp/c3-isp-resizer.c  |   3 +
 .../amlogic/c3/mipi-adapter/c3-mipi-adap.c    |   3 +-
 .../amlogic/c3/mipi-csi2/c3-mipi-csi2.c       |   3 +-
 .../platform/arm/mali-c55/mali-c55-capture.c  |   2 +-
 .../platform/arm/mali-c55/mali-c55-isp.c      |   5 +-
 .../platform/arm/mali-c55/mali-c55-resizer.c  |  15 +-
 .../platform/arm/mali-c55/mali-c55-tpg.c      |   1 +
 drivers/media/platform/atmel/atmel-isi.c      |   4 +-
 .../media/platform/broadcom/bcm2835-unicam.c  |   3 +-
 drivers/media/platform/cadence/cdns-csi2rx.c  |   7 +-
 drivers/media/platform/cadence/cdns-csi2tx.c  |   7 +-
 drivers/media/platform/intel/pxa_camera.c     |   6 +-
 drivers/media/platform/marvell/mcam-core.c    |   4 +-
 .../platform/microchip/microchip-csi2dc.c     |   2 +
 .../platform/microchip/microchip-isc-base.c   |   1 +
 .../platform/microchip/microchip-isc-scaler.c |   3 +
 drivers/media/platform/nxp/imx-mipi-csis.c    |   5 +-
 drivers/media/platform/nxp/imx7-media-csi.c   |   3 +-
 .../platform/nxp/imx8-isi/imx8-isi-crossbar.c |   3 +-
 .../platform/nxp/imx8-isi/imx8-isi-pipe.c     |   3 +
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c |   3 +-
 .../media/platform/qcom/camss/camss-csid.c    |   4 +-
 .../media/platform/qcom/camss/camss-csiphy.c  |   4 +-
 .../media/platform/qcom/camss/camss-ispif.c   |   4 +-
 drivers/media/platform/qcom/camss/camss-vfe.c |  17 ++-
 .../media/platform/qcom/camss/camss-video.c   |   2 +-
 .../media/platform/raspberrypi/rp1-cfe/csi2.c |   1 +
 .../platform/raspberrypi/rp1-cfe/pisp-fe.c    |   3 +-
 drivers/media/platform/renesas/rcar-csi2.c    |   3 +-
 .../media/platform/renesas/rcar-isp/csisp.c   |   3 +-
 .../platform/renesas/rcar-vin/rcar-v4l2.c     |   2 +-
 drivers/media/platform/renesas/renesas-ceu.c  |   7 +-
 .../platform/renesas/rzg2l-cru/rzg2l-csi2.c   |   3 +-
 .../platform/renesas/rzg2l-cru/rzg2l-ip.c     |   3 +-
 .../platform/renesas/rzg2l-cru/rzg2l-video.c  |   2 +-
 .../renesas/rzv2h-ivc/rzv2h-ivc-subdev.c      |   3 +-
 .../media/platform/renesas/vsp1/vsp1_brx.c    |   3 +
 .../media/platform/renesas/vsp1/vsp1_clu.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_drm.c    |  26 ++--
 .../media/platform/renesas/vsp1/vsp1_entity.c |   4 +-
 .../media/platform/renesas/vsp1/vsp1_histo.c  |   9 +-
 .../media/platform/renesas/vsp1/vsp1_hsit.c   |   1 +
 .../media/platform/renesas/vsp1/vsp1_iif.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_lif.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_lut.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_rwpf.c   |   3 +
 .../media/platform/renesas/vsp1/vsp1_sru.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_uds.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_uif.c    |   3 +
 .../media/platform/renesas/vsp1/vsp1_video.c  |   2 +-
 .../media/platform/renesas/vsp1/vsp1_vspx.c   |   3 +-
 .../platform/rockchip/rkcif/rkcif-interface.c |   5 +-
 .../platform/rockchip/rkisp1/rkisp1-capture.c |   2 +-
 .../platform/rockchip/rkisp1/rkisp1-csi.c     |   3 +-
 .../platform/rockchip/rkisp1/rkisp1-isp.c     |   3 +
 .../platform/rockchip/rkisp1/rkisp1-resizer.c |   3 +
 .../samsung/exynos4-is/fimc-capture.c         |  13 +-
 .../samsung/exynos4-is/fimc-isp-video.c       |   5 +-
 .../platform/samsung/exynos4-is/fimc-isp.c    |   2 +
 .../platform/samsung/exynos4-is/fimc-lite.c   |   8 +-
 .../platform/samsung/exynos4-is/mipi-csis.c   |   2 +
 .../samsung/s3c-camif/camif-capture.c         |   7 +-
 .../platform/samsung/s3c-camif/camif-core.c   |   4 +-
 drivers/media/platform/st/stm32/stm32-csi.c   |   1 +
 drivers/media/platform/st/stm32/stm32-dcmi.c  |   6 +-
 .../st/stm32/stm32-dcmipp/dcmipp-bytecap.c    |   3 +-
 .../st/stm32/stm32-dcmipp/dcmipp-byteproc.c   |   3 +
 .../st/stm32/stm32-dcmipp/dcmipp-input.c      |   1 +
 .../platform/sunxi/sun4i-csi/sun4i_v4l2.c     |   2 +
 .../sunxi/sun6i-csi/sun6i_csi_bridge.c        |   2 +
 .../sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c   |   2 +
 .../sun8i_a83t_mipi_csi2.c                    |   2 +
 .../media/platform/ti/am437x/am437x-vpfe.c    |   4 +-
 drivers/media/platform/ti/cal/cal-camerarx.c  |   3 +-
 drivers/media/platform/ti/cal/cal-video.c     |   6 +-
 .../media/platform/ti/davinci/vpif_capture.c  |   2 +-
 .../platform/ti/j721e-csi2rx/j721e-csi2rx.c   |   2 +-
 drivers/media/platform/ti/omap3isp/ispccdc.c  |   6 +-
 drivers/media/platform/ti/omap3isp/ispccp2.c  |   4 +-
 drivers/media/platform/ti/omap3isp/ispcsi2.c  |   4 +-
 .../media/platform/ti/omap3isp/isppreview.c   |   6 +-
 .../media/platform/ti/omap3isp/ispresizer.c   |   6 +-
 drivers/media/platform/ti/omap3isp/ispvideo.c |  12 +-
 drivers/media/platform/ti/vpe/vip.c           |   7 +-
 drivers/media/platform/via/via-camera.c       |   4 +-
 drivers/media/platform/video-mux.c            |   1 +
 .../media/platform/xilinx/xilinx-csi2rxss.c   |   2 +
 drivers/media/platform/xilinx/xilinx-dma.c    |   2 +-
 drivers/media/platform/xilinx/xilinx-tpg.c    |   2 +
 drivers/media/test-drivers/vimc/vimc-common.c |   2 +-
 .../media/test-drivers/vimc/vimc-debayer.c    |   3 +-
 drivers/media/test-drivers/vimc/vimc-scaler.c |   3 +
 drivers/media/test-drivers/vimc/vimc-sensor.c |   1 +
 drivers/media/usb/cx231xx/cx231xx-417.c       |   2 +-
 drivers/media/usb/cx231xx/cx231xx-video.c     |   4 +-
 drivers/media/usb/dvb-usb/cxusb-analog.c      |   6 +-
 drivers/media/usb/em28xx/em28xx-camera.c      |   2 +-
 drivers/media/usb/go7007/go7007-v4l2.c        |   2 +-
 drivers/media/usb/go7007/s2250-board.c        |   1 +
 drivers/media/usb/pvrusb2/pvrusb2-hdw.c       |   2 +-
 drivers/media/v4l2-core/v4l2-subdev.c         | 117 +++++++++-----
 .../media/atomisp/i2c/atomisp-gc2235.c        |   2 +
 .../media/atomisp/i2c/atomisp-ov2722.c        |   2 +
 .../staging/media/atomisp/pci/atomisp_cmd.c   |  16 +-
 .../staging/media/atomisp/pci/atomisp_csi2.c  |   2 +
 .../media/atomisp/pci/atomisp_subdev.c        |   4 +
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |   8 +-
 .../media/deprecated/atmel/atmel-isc-base.c   |   4 +-
 drivers/staging/media/imx/imx-ic-prp.c        |   2 +
 drivers/staging/media/imx/imx-ic-prpencvf.c   |   2 +
 drivers/staging/media/imx/imx-media-capture.c |  14 +-
 drivers/staging/media/imx/imx-media-csi.c     |   4 +
 drivers/staging/media/imx/imx-media-utils.c   |   2 +-
 drivers/staging/media/imx/imx-media-vdic.c    |   2 +
 drivers/staging/media/imx/imx6-mipi-csi2.c    |   2 +
 drivers/staging/media/ipu3/ipu3-v4l2.c        |   4 +
 drivers/staging/media/ipu7/ipu7-isys-csi2.c   |   2 +
 drivers/staging/media/ipu7/ipu7-isys-subdev.c |   3 +-
 .../staging/media/starfive/camss/stf-isp.c    |  12 +-
 .../staging/media/starfive/camss/stf-video.c  |   2 +-
 .../media/sunxi/sun6i-isp/sun6i_isp_proc.c    |   2 +
 drivers/staging/media/tegra-video/csi.c       |   2 +
 drivers/staging/media/tegra-video/vi.c        |  13 +-
 include/media/v4l2-subdev.h                   |  77 ++++++++--
 include/uapi/linux/media.h                    |   1 +
 265 files changed, 969 insertions(+), 324 deletions(-)
Signature · 1 line
2.47.3
author maintainer
#1 lore raw

PATCH v2 1/14 media: imx219: Rename "PIXEL_ARRAY" as "CROP"

The imx219 driver uses macros for denoting different aspects of the pixel array. The values used for IMX219_PIXEL_ARRAY_* macros imply a crop configuration however, not the size of the pixel array. Reflect this in the naming, too.

---
 drivers/media/i2c/imx219.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/media/i2c/imx219.c +14 -14
index fee63bc106d9..54622c406a03 100644
@@ -142,10 +142,10 @@
 /* IMX219 native and active pixel array size. */
 #define IMX219_NATIVE_WIDTH		3296U
 #define IMX219_NATIVE_HEIGHT		2480U
-#define IMX219_PIXEL_ARRAY_LEFT		8U
-#define IMX219_PIXEL_ARRAY_TOP		8U
-#define IMX219_PIXEL_ARRAY_WIDTH	3280U
-#define IMX219_PIXEL_ARRAY_HEIGHT	2464U
+#define IMX219_CROP_LEFT		8U
+#define IMX219_CROP_TOP			8U
+#define IMX219_CROP_WIDTH		3280U
+#define IMX219_CROP_HEIGHT		2464U
 
 /* Mode : resolution and related config&values */
 struct imx219_mode {
@@ -675,13 +675,13 @@ static int imx219_set_framefmt(struct imx219 *imx219,
 	bpp = imx219_get_format_bpp(format);
 
 	cci_write(imx219->regmap, IMX219_REG_X_ADD_STA_A,
-		  crop->left - IMX219_PIXEL_ARRAY_LEFT, &ret);
+		  crop->left - IMX219_CROP_LEFT, &ret);
 	cci_write(imx219->regmap, IMX219_REG_X_ADD_END_A,
-		  crop->left - IMX219_PIXEL_ARRAY_LEFT + crop->width - 1, &ret);
+		  crop->left - IMX219_CROP_LEFT + crop->width - 1, &ret);
 	cci_write(imx219->regmap, IMX219_REG_Y_ADD_STA_A,
-		  crop->top - IMX219_PIXEL_ARRAY_TOP, &ret);
+		  crop->top - IMX219_CROP_TOP, &ret);
 	cci_write(imx219->regmap, IMX219_REG_Y_ADD_END_A,
-		  crop->top - IMX219_PIXEL_ARRAY_TOP + crop->height - 1, &ret);
+		  crop->top - IMX219_CROP_TOP + crop->height - 1, &ret);
 
 	imx219_get_binning(state, &bin_h, &bin_v);
 	cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_H, bin_h, &ret);
@@ -867,8 +867,8 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
 	 * Use binning to maximize the crop rectangle size, and centre it in the
 	 * sensor.
 	 */
-	bin_h = min(IMX219_PIXEL_ARRAY_WIDTH / format->width, 2U);
-	bin_v = min(IMX219_PIXEL_ARRAY_HEIGHT / format->height, 2U);
+	bin_h = min(IMX219_CROP_WIDTH / format->width, 2U);
+	bin_v = min(IMX219_CROP_HEIGHT / format->height, 2U);
 
 	/* Ensure bin_h and bin_v are same to avoid 1:2 or 2:1 stretching */
 	binning = min(bin_h, bin_v);
@@ -967,10 +967,10 @@ static int imx219_get_selection(struct v4l2_subdev *sd,
 
 	case V4L2_SEL_TGT_CROP_DEFAULT:
 	case V4L2_SEL_TGT_CROP_BOUNDS:
-		sel->r.top = IMX219_PIXEL_ARRAY_TOP;
-		sel->r.left = IMX219_PIXEL_ARRAY_LEFT;
-		sel->r.width = IMX219_PIXEL_ARRAY_WIDTH;
-		sel->r.height = IMX219_PIXEL_ARRAY_HEIGHT;
+		sel->r.top = IMX219_CROP_TOP;
+		sel->r.left = IMX219_CROP_LEFT;
+		sel->r.width = IMX219_CROP_WIDTH;
+		sel->r.height = IMX219_CROP_HEIGHT;
 
 		return 0;
 	}
Signature · 1 line
2.47.3
maintainer Acked-by on v2 1/14
#2 lore raw

Re: [PATCH v2 01/14] media: imx219: Rename "PIXEL_ARRAY" as "CROP"

Hi Sakari
How is this related to the metadata seris ? :)

Shouldn't we aim to fast track that series instead of adding more things as requisites ?

Quoted 4 lines · Sakari Ailus

The imx219 driver uses macros for denoting different aspects of the pixel array. The values used for IMX219_PIXEL_ARRAY_* macros imply a crop configuration however, not the size of the pixel array. Reflect this in the naming, too.

3280x2464 is the active pixel array area, according to the datasheet. I guess one can claim is the default crop (it is in facts used as DEFAULT_CROP and CROP_BOUNDS rectangle), so:

Quoted 73 lines
---
 drivers/media/i2c/imx219.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/media/i2c/imx219.c +14 -15
index fee63bc106d9..54622c406a03 100644
@@ -142,10 +142,10 @@
 /* IMX219 native and active pixel array size. */
 #define IMX219_NATIVE_WIDTH		3296U
 #define IMX219_NATIVE_HEIGHT		2480U
-#define IMX219_PIXEL_ARRAY_LEFT		8U
-#define IMX219_PIXEL_ARRAY_TOP		8U
-#define IMX219_PIXEL_ARRAY_WIDTH	3280U
-#define IMX219_PIXEL_ARRAY_HEIGHT	2464U
+#define IMX219_CROP_LEFT		8U
+#define IMX219_CROP_TOP			8U
+#define IMX219_CROP_WIDTH		3280U
+#define IMX219_CROP_HEIGHT		2464U
 
 /* Mode : resolution and related config&values */
 struct imx219_mode {
@@ -675,13 +675,13 @@ static int imx219_set_framefmt(struct imx219 *imx219,
 	bpp = imx219_get_format_bpp(format);
 
 	cci_write(imx219->regmap, IMX219_REG_X_ADD_STA_A,
-		  crop->left - IMX219_PIXEL_ARRAY_LEFT, &ret);
+		  crop->left - IMX219_CROP_LEFT, &ret);
 	cci_write(imx219->regmap, IMX219_REG_X_ADD_END_A,
-		  crop->left - IMX219_PIXEL_ARRAY_LEFT + crop->width - 1, &ret);
+		  crop->left - IMX219_CROP_LEFT + crop->width - 1, &ret);
 	cci_write(imx219->regmap, IMX219_REG_Y_ADD_STA_A,
-		  crop->top - IMX219_PIXEL_ARRAY_TOP, &ret);
+		  crop->top - IMX219_CROP_TOP, &ret);
 	cci_write(imx219->regmap, IMX219_REG_Y_ADD_END_A,
-		  crop->top - IMX219_PIXEL_ARRAY_TOP + crop->height - 1, &ret);
+		  crop->top - IMX219_CROP_TOP + crop->height - 1, &ret);
 
 	imx219_get_binning(state, &bin_h, &bin_v);
 	cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_H, bin_h, &ret);
@@ -867,8 +867,8 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
 	 * Use binning to maximize the crop rectangle size, and centre it in the
 	 * sensor.
 	 */
-	bin_h = min(IMX219_PIXEL_ARRAY_WIDTH / format->width, 2U);
-	bin_v = min(IMX219_PIXEL_ARRAY_HEIGHT / format->height, 2U);
+	bin_h = min(IMX219_CROP_WIDTH / format->width, 2U);
+	bin_v = min(IMX219_CROP_HEIGHT / format->height, 2U);
 
 	/* Ensure bin_h and bin_v are same to avoid 1:2 or 2:1 stretching */
 	binning = min(bin_h, bin_v);
@@ -967,10 +967,10 @@ static int imx219_get_selection(struct v4l2_subdev *sd,
 
 	case V4L2_SEL_TGT_CROP_DEFAULT:
 	case V4L2_SEL_TGT_CROP_BOUNDS:
-		sel->r.top = IMX219_PIXEL_ARRAY_TOP;
-		sel->r.left = IMX219_PIXEL_ARRAY_LEFT;
-		sel->r.width = IMX219_PIXEL_ARRAY_WIDTH;
-		sel->r.height = IMX219_PIXEL_ARRAY_HEIGHT;
+		sel->r.top = IMX219_CROP_TOP;
+		sel->r.left = IMX219_CROP_LEFT;
+		sel->r.width = IMX219_CROP_WIDTH;
+		sel->r.height = IMX219_CROP_HEIGHT;
 
 		return 0;
 	}
--

2.47.3

author maintainer
#3 lore raw

Re: [PATCH v2 01/14] media: imx219: Rename "PIXEL_ARRAY" as "CROP"

Hi Jacopo,

Quoted 2 lines · Jacopo Mondi

Hi Sakari
How is this related to the metadata seris ? :)

It's related as I'm working on the imx219 driver to add support for the common raw sensor model to it.

Quoted 3 lines

Shouldn't we aim to fast track that series instead of adding more things as requisites ?

The intent here is to merge early what can be merged early, to avoid making the series unnecessarily large.

Quoted 10 lines · Sakari Ailus
Quoted 4 lines

The imx219 driver uses macros for denoting different aspects of the pixel array. The values used for IMX219_PIXEL_ARRAY_* macros imply a crop configuration however, not the size of the pixel array. Reflect this in the naming, too.

3280x2464 is the active pixel array area, according to the datasheet. I guess one can claim is the default crop (it is in facts used as DEFAULT_CROP and CROP_BOUNDS rectangle), so:

It's a good question what should be done with this. I took another glance to the datasheet and inded the borders are said to be "InValid" pixels without further explaining what it actually means. Probably nothing apart from the vendor making no guarantees of the quality, even if in practice there might be no difference.

To me this border area looks like extra rows and columns of pixels to counter the ISPs effectively dropping a few rows and columns while still keeping the resulting image slightly larger than 8 Mp.

Have you tried capturing these pixels?

Quoted 2 lines

Thank you.

Quoted 70 lines
Quoted 70 lines
---
 drivers/media/i2c/imx219.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/media/i2c/imx219.c +14 -14
index fee63bc106d9..54622c406a03 100644
@@ -142,10 +142,10 @@
 /* IMX219 native and active pixel array size. */
 #define IMX219_NATIVE_WIDTH		3296U
 #define IMX219_NATIVE_HEIGHT		2480U
-#define IMX219_PIXEL_ARRAY_LEFT		8U
-#define IMX219_PIXEL_ARRAY_TOP		8U
-#define IMX219_PIXEL_ARRAY_WIDTH	3280U
-#define IMX219_PIXEL_ARRAY_HEIGHT	2464U
+#define IMX219_CROP_LEFT		8U
+#define IMX219_CROP_TOP			8U
+#define IMX219_CROP_WIDTH		3280U
+#define IMX219_CROP_HEIGHT		2464U
 
 /* Mode : resolution and related config&values */
 struct imx219_mode {
@@ -675,13 +675,13 @@ static int imx219_set_framefmt(struct imx219 *imx219,
 	bpp = imx219_get_format_bpp(format);
 
 	cci_write(imx219->regmap, IMX219_REG_X_ADD_STA_A,
-		  crop->left - IMX219_PIXEL_ARRAY_LEFT, &ret);
+		  crop->left - IMX219_CROP_LEFT, &ret);
 	cci_write(imx219->regmap, IMX219_REG_X_ADD_END_A,
-		  crop->left - IMX219_PIXEL_ARRAY_LEFT + crop->width - 1, &ret);
+		  crop->left - IMX219_CROP_LEFT + crop->width - 1, &ret);
 	cci_write(imx219->regmap, IMX219_REG_Y_ADD_STA_A,
-		  crop->top - IMX219_PIXEL_ARRAY_TOP, &ret);
+		  crop->top - IMX219_CROP_TOP, &ret);
 	cci_write(imx219->regmap, IMX219_REG_Y_ADD_END_A,
-		  crop->top - IMX219_PIXEL_ARRAY_TOP + crop->height - 1, &ret);
+		  crop->top - IMX219_CROP_TOP + crop->height - 1, &ret);
 
 	imx219_get_binning(state, &bin_h, &bin_v);
 	cci_write(imx219->regmap, IMX219_REG_BINNING_MODE_H, bin_h, &ret);
@@ -867,8 +867,8 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
 	 * Use binning to maximize the crop rectangle size, and centre it in the
 	 * sensor.
 	 */
-	bin_h = min(IMX219_PIXEL_ARRAY_WIDTH / format->width, 2U);
-	bin_v = min(IMX219_PIXEL_ARRAY_HEIGHT / format->height, 2U);
+	bin_h = min(IMX219_CROP_WIDTH / format->width, 2U);
+	bin_v = min(IMX219_CROP_HEIGHT / format->height, 2U);
 
 	/* Ensure bin_h and bin_v are same to avoid 1:2 or 2:1 stretching */
 	binning = min(bin_h, bin_v);
@@ -967,10 +967,10 @@ static int imx219_get_selection(struct v4l2_subdev *sd,
 
 	case V4L2_SEL_TGT_CROP_DEFAULT:
 	case V4L2_SEL_TGT_CROP_BOUNDS:
-		sel->r.top = IMX219_PIXEL_ARRAY_TOP;
-		sel->r.left = IMX219_PIXEL_ARRAY_LEFT;
-		sel->r.width = IMX219_PIXEL_ARRAY_WIDTH;
-		sel->r.height = IMX219_PIXEL_ARRAY_HEIGHT;
+		sel->r.top = IMX219_CROP_TOP;
+		sel->r.left = IMX219_CROP_LEFT;
+		sel->r.width = IMX219_CROP_WIDTH;
+		sel->r.height = IMX219_CROP_HEIGHT;
 
 		return 0;
 	}
Signature · 3 lines
Kind regards,

Sakari Ailus
author maintainer
#4 lore raw

PATCH v2 2/14 media: v4l2-subdev: Allow accessing routes with STREAMS client capability

In reply to Sakari Ailus

Disable access to routes when the STREAMS client capability bit isn't set. Routes aren't relevant otherwise anyway.

---
 drivers/media/v4l2-core/v4l2-subdev.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/media/v4l2-core/v4l2-subdev.c +6 -0
index 66842b975f91..b2105c34478e 100644
@@ -1008,6 +1008,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
 			return -ENOIOCTLCMD;
 
+		if (!client_supports_streams)
+			return -EINVAL;
+
 		memset(routing->reserved, 0, sizeof(routing->reserved));
 
 		krouting = &state->routing;
@@ -1035,6 +1038,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
 			return -ENOIOCTLCMD;
 
+		if (!client_supports_streams)
+			return -EINVAL;
+
 		if (routing->which != V4L2_SUBDEV_FORMAT_TRY && ro_subdev)
 			return -EPERM;
 
Signature · 1 line
2.47.3
maintainer Reviewed-by on v2 2/14
#5 lore raw

Re: [PATCH v2 02/14] media: v4l2-subdev: Allow accessing routes with STREAMS client capability

Hi Sakari

Quoted 4 lines · Sakari Ailus

Disable access to routes when the STREAMS client capability bit isn't set. Routes aren't relevant otherwise anyway.

Thanks
j

Quoted 32 lines
---
 drivers/media/v4l2-core/v4l2-subdev.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/media/v4l2-core/v4l2-subdev.c +6 -1
index 66842b975f91..b2105c34478e 100644
@@ -1008,6 +1008,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
 			return -ENOIOCTLCMD;
 
+		if (!client_supports_streams)
+			return -EINVAL;
+
 		memset(routing->reserved, 0, sizeof(routing->reserved));
 
 		krouting = &state->routing;
@@ -1035,6 +1038,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
 			return -ENOIOCTLCMD;
 
+		if (!client_supports_streams)
+			return -EINVAL;
+
 		if (routing->which != V4L2_SUBDEV_FORMAT_TRY && ro_subdev)
 			return -EPERM;
 
--

2.47.3

#6 lore raw

Re: [PATCH v2 02/14] media: v4l2-subdev: Allow accessing routes with STREAMS client capability

In reply to Sakari Ailus

Hi Sakari,

Quoted 4 lines · Sakari Ailus

Disable access to routes when the STREAMS client capability bit isn't set. Routes aren't relevant otherwise anyway.

Reviewed-by <[email protected]>

Quoted 31 lines
---
  drivers/media/v4l2-core/v4l2-subdev.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/media/v4l2-core/v4l2-subdev.c +6 -1
index 66842b975f91..b2105c34478e 100644
@@ -1008,6 +1008,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
                         return -ENOIOCTLCMD;
 
+               if (!client_supports_streams)
+                       return -EINVAL;
+
                 memset(routing->reserved, 0, sizeof(routing->reserved));
 
                 krouting = &state->routing;
@@ -1035,6 +1038,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
                         return -ENOIOCTLCMD;
 
+               if (!client_supports_streams)
+                       return -EINVAL;
+
                 if (routing->which != V4L2_SUBDEV_FORMAT_TRY && ro_subdev)
                         return -EPERM;
 
--

2.47.3

author maintainer Reviewed-by Mirela Rabulea
#7 lore raw

Re: [PATCH v2 02/14] media: v4l2-subdev: Allow accessing routes with STREAMS client capability

Hi Mirela,

Quoted 8 lines · Mirela Rabulea

Hi Sakari,

Quoted 4 lines · Sakari Ailus

Disable access to routes when the STREAMS client capability bit isn't set. Routes aren't relevant otherwise anyway.

Reviewed-by <[email protected]>

Let me know if you meant something else than:

Signature · 1 line
Sakari Ailus
author maintainer
#8 lore raw

PATCH v2 3/14 media: Documentation: Improve LINK_FREQ documentation

In reply to Sakari Ailus

Add a reference to the LINK_FREQ control and precise the meaning of the control as for C-PHY the matter is less obvious.

---
 Documentation/driver-api/media/tx-rx.rst                      | 3 ++-
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst       | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
Documentation/driver-api/media/tx-rx.rst +2 -1
index 22e1b13ecde9..7df2407817b3 100644
@@ -93,7 +93,8 @@ where
    * - variable or constant
      - description
    * - link_freq
-     - The value of the ``V4L2_CID_LINK_FREQ`` integer64 menu item.
+     - The value of the :ref:`V4L2_CID_LINK_FREQ <v4l2-cid-link-freq>` integer64
+       menu item.
    * - nr_of_lanes
      - Number of data lanes used on the CSI-2 link.
    * - 2
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +3 -1
index 6d516f041ca2..ee88933256dd 100644
@@ -24,7 +24,9 @@ Image Process Control IDs
 .. _v4l2-cid-link-freq:
 
 ``V4L2_CID_LINK_FREQ (integer menu)``
-    The frequency of the data bus (e.g. parallel or CSI-2).
+    The fundamental frequency of the operating symbol rate (serial interfaces
+    such as CSI-2) or the sampling rate (parallel interfaces such as DVP or
+    Bt.565) of the data interface.
 
 .. _v4l2-cid-pixel-rate:
 
Signature · 1 line
2.47.3
maintainer Reviewed-by on v2 3/14
#9 lore raw

Re: [PATCH v2 03/14] media: Documentation: Improve LINK_FREQ documentation

Hi Sakari

Quoted 28 lines · Sakari Ailus

Add a reference to the LINK_FREQ control and precise the meaning of the control as for C-PHY the matter is less obvious.

---
 Documentation/driver-api/media/tx-rx.rst                      | 3 ++-
 .../userspace-api/media/v4l/ext-ctrls-image-process.rst       | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
Documentation/driver-api/media/tx-rx.rst +2 -1
index 22e1b13ecde9..7df2407817b3 100644
@@ -93,7 +93,8 @@ where
    * - variable or constant
      - description
    * - link_freq
-     - The value of the ``V4L2_CID_LINK_FREQ`` integer64 menu item.
+     - The value of the :ref:`V4L2_CID_LINK_FREQ <v4l2-cid-link-freq>` integer64
+       menu item.
    * - nr_of_lanes
      - Number of data lanes used on the CSI-2 link.
    * - 2
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +0 -0
index 6d516f041ca2..ee88933256dd 100644

Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst Image Process Control IDs · line 27

Quoted 5 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +1 -1
@@ -24,7 +24,9 @@ Image Process Control IDs
 .. _v4l2-cid-link-freq:
 
 ``V4L2_CID_LINK_FREQ (integer menu)``
-    The frequency of the data bus (e.g. parallel or CSI-2).
+    The fundamental frequency of the operating symbol rate (serial interfaces

Or just: "The symbol rate frequency" ?

Quoted 9 lines
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +2 -1
+    such as CSI-2) or the sampling rate (parallel interfaces such as DVP or
+    Bt.565) of the data interface.
 
 .. _v4l2-cid-pixel-rate:
 
--

2.47.3

Reviewed-by on v2 3/14
#10 lore raw

Re: [PATCH v2 03/14] media: Documentation: Improve LINK_FREQ documentation

In reply to Sakari Ailus

Hi Sakari,

Quoted 1 line · Sakari Ailus

Add a reference to the LINK_FREQ control and precise the meaning of the

Precise is not a verb, maybe use clarify instead.

Other than that,

Quoted 40 lines

control as for C-PHY the matter is less obvious.

---
  Documentation/driver-api/media/tx-rx.rst                      | 3 ++-
  .../userspace-api/media/v4l/ext-ctrls-image-process.rst       | 4 +++-
  2 files changed, 5 insertions(+), 2 deletions(-)
Documentation/driver-api/media/tx-rx.rst +2 -1
index 22e1b13ecde9..7df2407817b3 100644
@@ -93,7 +93,8 @@ where
     * - variable or constant
       - description
     * - link_freq
-     - The value of the ``V4L2_CID_LINK_FREQ`` integer64 menu item.
+     - The value of the :ref:`V4L2_CID_LINK_FREQ <v4l2-cid-link-freq>` integer64
+       menu item.
     * - nr_of_lanes
       - Number of data lanes used on the CSI-2 link.
     * - 2
Documentation/userspace-api/media/v4l/ext-ctrls-image-process.rst +3 -2
index 6d516f041ca2..ee88933256dd 100644
@@ -24,7 +24,9 @@ Image Process Control IDs
  .. _v4l2-cid-link-freq:
 
  ``V4L2_CID_LINK_FREQ (integer menu)``
-    The frequency of the data bus (e.g. parallel or CSI-2).
+    The fundamental frequency of the operating symbol rate (serial interfaces
+    such as CSI-2) or the sampling rate (parallel interfaces such as DVP or
+    Bt.565) of the data interface.
 
  .. _v4l2-cid-pixel-rate:
 
--

2.47.3

author maintainer
#11 lore raw

Re: [PATCH v2 03/14] media: Documentation: Improve LINK_FREQ documentation

Hi Mirela,

Thank you for the review.

Quoted 6 lines · Mirela Rabulea

Hi Sakari,

Quoted 1 line · Sakari Ailus

Add a reference to the LINK_FREQ control and precise the meaning of the

Precise is not a verb, maybe use clarify instead.

I'll use that for v3.

Quoted 4 lines

Other than that,

Thanks!

Signature · 3 lines
Kind regards,

Sakari Ailus
author maintainer
#12 lore raw

PATCH v2 4/14 media: Documentation: Improve pixel rate calculation documentation

In reply to Sakari Ailus

Improve documentation on calculating the pixel rate, by adding references to relevant functions and mentioning V4L2 fwnode endpoint instead of OF endpoint.

---
 Documentation/driver-api/media/tx-rx.rst | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/driver-api/media/tx-rx.rst +5 -1
index 7df2407817b3..9b231fa0216a 100644
@@ -104,7 +104,11 @@ where
    * - k
      - 16 for D-PHY and 7 for C-PHY.
 
-Information on whether D-PHY or C-PHY is used, and the value of ``nr_of_lanes``, can be obtained from the OF endpoint configuration.
+Information on whether D-PHY or C-PHY is used as well as the value of
+``nr_of_lanes`` can be obtained from the V4L2 endpoint configuration; see
+:c:func:`v4l2_fwnode_endpoint_alloc_parse()`,
+:c:func:`v4l2_fwnode_endpoint_parse()` and
+:c:func:`v4l2_get_active_data_lanes()`.
 
 .. note::
 
Signature · 1 line
2.47.3
maintainer Reviewed-by on v2 4/14
#13 lore raw

Re: [PATCH v2 04/14] media: Documentation: Improve pixel rate calculation documentation

Hi Sakari

Quoted 5 lines · Sakari Ailus

Improve documentation on calculating the pixel rate, by adding references to relevant functions and mentioning V4L2 fwnode endpoint instead of OF endpoint.

Thanks
j

Quoted 25 lines
---
 Documentation/driver-api/media/tx-rx.rst | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/driver-api/media/tx-rx.rst +5 -2
index 7df2407817b3..9b231fa0216a 100644
@@ -104,7 +104,11 @@ where
    * - k
      - 16 for D-PHY and 7 for C-PHY.
 
-Information on whether D-PHY or C-PHY is used, and the value of ``nr_of_lanes``, can be obtained from the OF endpoint configuration.
+Information on whether D-PHY or C-PHY is used as well as the value of
+``nr_of_lanes`` can be obtained from the V4L2 endpoint configuration; see
+:c:func:`v4l2_fwnode_endpoint_alloc_parse()`,
+:c:func:`v4l2_fwnode_endpoint_parse()` and
+:c:func:`v4l2_get_active_data_lanes()`.
 
 .. note::
 
--

2.47.3

Reviewed-by on v2 4/14
#14 lore raw

Re: [PATCH v2 04/14] media: Documentation: Improve pixel rate calculation documentation

In reply to Sakari Ailus

Hi Sakari,

Quoted 5 lines · Sakari Ailus

Improve documentation on calculating the pixel rate, by adding references to relevant functions and mentioning V4L2 fwnode endpoint instead of OF endpoint.

Quoted 24 lines
---
  Documentation/driver-api/media/tx-rx.rst | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
Documentation/driver-api/media/tx-rx.rst +5 -2
index 7df2407817b3..9b231fa0216a 100644
@@ -104,7 +104,11 @@ where
     * - k
       - 16 for D-PHY and 7 for C-PHY.
 
-Information on whether D-PHY or C-PHY is used, and the value of ``nr_of_lanes``, can be obtained from the OF endpoint configuration.
+Information on whether D-PHY or C-PHY is used as well as the value of
+``nr_of_lanes`` can be obtained from the V4L2 endpoint configuration; see
+:c:func:`v4l2_fwnode_endpoint_alloc_parse()`,
+:c:func:`v4l2_fwnode_endpoint_parse()` and
+:c:func:`v4l2_get_active_data_lanes()`.
 
  .. note::
 
--

2.47.3

author maintainer
#15 lore raw

PATCH v2 5/14 media: v4l2-subdev: Refactor returning routes

In reply to Sakari Ailus

Refactor returning the routes by adding a new function that essentially does a memcopy and sets the number of the number of the routes in the routing table.

---
 drivers/media/v4l2-core/v4l2-subdev.c | 40 +++++++++++++++------------
 1 file changed, 22 insertions(+), 18 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +22 -18
index b2105c34478e..8a433d074587 100644
@@ -629,6 +629,19 @@ subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh,
 			     v4l2_subdev_get_unlocked_active_state(sd);
 }
 
+static void subdev_copy_fix_routes(struct v4l2_subdev_routing *routing,
+				   const struct v4l2_subdev_route *src,
+				   u32 copy_routes, u32 num_routes)
+{
+	struct v4l2_subdev_route *routes =
+		(struct v4l2_subdev_route *)(uintptr_t)routing->routes;
+
+	for (u32 i = 0; i < copy_routes; i++)
+		routes[i] = src[i];
+
+	routing->num_routes = num_routes;
+}
+
 static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 			    struct v4l2_subdev_state *state)
 {
@@ -1000,7 +1013,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
 	case VIDIOC_SUBDEV_G_ROUTING: {
 		struct v4l2_subdev_routing *routing = arg;
-		struct v4l2_subdev_krouting *krouting;
 
 		if (!v4l2_subdev_enable_streams_api)
 			return -ENOIOCTLCMD;
@@ -1013,13 +1025,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
 		memset(routing->reserved, 0, sizeof(routing->reserved));
 
-		krouting = &state->routing;
-
-		memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-		       krouting->routes,
-		       min(krouting->num_routes, routing->len_routes) *
-		       sizeof(*krouting->routes));
-		routing->num_routes = krouting->num_routes;
+		subdev_copy_fix_routes(routing, state->routing.routes,
+				       routing->len_routes,
+				       state->routing.num_routes);
 
 		return 0;
 	}
@@ -1090,11 +1098,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		 * the routing table.
 		 */
 		if (!v4l2_subdev_has_op(sd, pad, set_routing)) {
-			memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-			       state->routing.routes,
-			       min(state->routing.num_routes, routing->len_routes) *
-			       sizeof(*state->routing.routes));
-			routing->num_routes = state->routing.num_routes;
+			subdev_copy_fix_routes(routing, state->routing.routes,
+					       routing->len_routes,
+					       state->routing.num_routes);
 
 			return 0;
 		}
@@ -1108,11 +1114,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		if (rval < 0)
 			return rval;
 
-		memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-		       state->routing.routes,
-		       min(state->routing.num_routes, routing->len_routes) *
-		       sizeof(*state->routing.routes));
-		routing->num_routes = state->routing.num_routes;
+		subdev_copy_fix_routes(routing, state->routing.routes,
+				       routing->len_routes,
+				       state->routing.num_routes);
 
 		return 0;
 	}
Signature · 1 line
2.47.3
maintainer
#16 lore raw

Re: [PATCH v2 05/14] media: v4l2-subdev: Refactor returning routes

Hi Sakari

Quoted 14 lines · Sakari Ailus

Refactor returning the routes by adding a new function that essentially does a memcopy and sets the number of the number of the routes in the routing table.

---
 drivers/media/v4l2-core/v4l2-subdev.c | 40 +++++++++++++++------------
 1 file changed, 22 insertions(+), 18 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +0 -0
index b2105c34478e..8a433d074587 100644

drivers/media/v4l2-core/v4l2-subdev.c subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh, · line 632

Quoted 4 lines
drivers/media/v4l2-core/v4l2-subdev.c +1 -0
@@ -629,6 +629,19 @@ subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh,
 			     v4l2_subdev_get_unlocked_active_state(sd);
 }
 
+static void subdev_copy_fix_routes(struct v4l2_subdev_routing *routing,

or just subdev_copy_routes()

drivers/media/v4l2-core/v4l2-subdev.c subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh, · line 639

Quoted 7 lines
drivers/media/v4l2-core/v4l2-subdev.c +7 -0
+				   const struct v4l2_subdev_route *src,
+				   u32 copy_routes, u32 num_routes)
+{
+	struct v4l2_subdev_route *routes =
+		(struct v4l2_subdev_route *)(uintptr_t)routing->routes;
+
+	for (u32 i = 0; i < copy_routes; i++)

Shouldn't this copy the min(copy_routes, num_routes) as the callers used to do ?

Even better, shouldn't we just accept one 'dest' and one 'source' v4l2_subdev_routing arguments and make sure we don't copy more than min(dest->num_routes, source->num_routes) ?

Having the number of routes being passed in by the caller opens the door for memory errors.

Quoted 67 lines
drivers/media/v4l2-core/v4l2-subdev.c +14 -19
+		routes[i] = src[i];
+
+	routing->num_routes = num_routes;
+}
+
 static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 			    struct v4l2_subdev_state *state)
 {
@@ -1000,7 +1013,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
 	case VIDIOC_SUBDEV_G_ROUTING: {
 		struct v4l2_subdev_routing *routing = arg;
-		struct v4l2_subdev_krouting *krouting;
 
 		if (!v4l2_subdev_enable_streams_api)
 			return -ENOIOCTLCMD;
@@ -1013,13 +1025,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
 		memset(routing->reserved, 0, sizeof(routing->reserved));
 
-		krouting = &state->routing;
-
-		memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-		       krouting->routes,
-		       min(krouting->num_routes, routing->len_routes) *
-		       sizeof(*krouting->routes));
-		routing->num_routes = krouting->num_routes;
+		subdev_copy_fix_routes(routing, state->routing.routes,
+				       routing->len_routes,
+				       state->routing.num_routes);
 
 		return 0;
 	}
@@ -1090,11 +1098,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		 * the routing table.
 		 */
 		if (!v4l2_subdev_has_op(sd, pad, set_routing)) {
-			memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-			       state->routing.routes,
-			       min(state->routing.num_routes, routing->len_routes) *
-			       sizeof(*state->routing.routes));
-			routing->num_routes = state->routing.num_routes;
+			subdev_copy_fix_routes(routing, state->routing.routes,
+					       routing->len_routes,
+					       state->routing.num_routes);
 
 			return 0;
 		}
@@ -1108,11 +1114,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		if (rval < 0)
 			return rval;
 
-		memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-		       state->routing.routes,
-		       min(state->routing.num_routes, routing->len_routes) *
-		       sizeof(*state->routing.routes));
-		routing->num_routes = state->routing.num_routes;
+		subdev_copy_fix_routes(routing, state->routing.routes,
+				       routing->len_routes,
+				       state->routing.num_routes);
 
 		return 0;
 	}
--

2.47.3

author maintainer
#17 lore raw

Re: [PATCH v2 05/14] media: v4l2-subdev: Refactor returning routes

Hi Jacopo,

Quoted 24 lines · Jacopo Mondi

Hi Sakari

Quoted 14 lines · Sakari Ailus

Refactor returning the routes by adding a new function that essentially does a memcopy and sets the number of the number of the routes in the routing table.

---
 drivers/media/v4l2-core/v4l2-subdev.c | 40 +++++++++++++++------------
 1 file changed, 22 insertions(+), 18 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +0 -0
index b2105c34478e..8a433d074587 100644

drivers/media/v4l2-core/v4l2-subdev.c subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh, · line 632

Quoted 4 lines
drivers/media/v4l2-core/v4l2-subdev.c +1 -0
@@ -629,6 +629,19 @@ subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh,
 			     v4l2_subdev_get_unlocked_active_state(sd);
 }
 
+static void subdev_copy_fix_routes(struct v4l2_subdev_routing *routing,

or just subdev_copy_routes()

Quoted 10 lines

drivers/media/v4l2-core/v4l2-subdev.c subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh, · line 639

Quoted 7 lines
drivers/media/v4l2-core/v4l2-subdev.c +7 -0
+				   const struct v4l2_subdev_route *src,
+				   u32 copy_routes, u32 num_routes)
+{
+	struct v4l2_subdev_route *routes =
+		(struct v4l2_subdev_route *)(uintptr_t)routing->routes;
+
+	for (u32 i = 0; i < copy_routes; i++)

Shouldn't this copy the min(copy_routes, num_routes) as the callers used to do ?

Indeed. I'll fix that for v3.

Quoted 7 lines

Even better, shouldn't we just accept one 'dest' and one 'source' v4l2_subdev_routing arguments and make sure we don't copy more than min(dest->num_routes, source->num_routes) ?

Having the number of routes being passed in by the caller opens the door for memory errors.

The arguments indeed appear to be the same for all callers; I'll refactor this for v3.

Quoted 65 lines
Quoted 65 lines
drivers/media/v4l2-core/v4l2-subdev.c +14 -18
+		routes[i] = src[i];
+
+	routing->num_routes = num_routes;
+}
+
 static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 			    struct v4l2_subdev_state *state)
 {
@@ -1000,7 +1013,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
 	case VIDIOC_SUBDEV_G_ROUTING: {
 		struct v4l2_subdev_routing *routing = arg;
-		struct v4l2_subdev_krouting *krouting;
 
 		if (!v4l2_subdev_enable_streams_api)
 			return -ENOIOCTLCMD;
@@ -1013,13 +1025,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
 		memset(routing->reserved, 0, sizeof(routing->reserved));
 
-		krouting = &state->routing;
-
-		memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-		       krouting->routes,
-		       min(krouting->num_routes, routing->len_routes) *
-		       sizeof(*krouting->routes));
-		routing->num_routes = krouting->num_routes;
+		subdev_copy_fix_routes(routing, state->routing.routes,
+				       routing->len_routes,
+				       state->routing.num_routes);
 
 		return 0;
 	}
@@ -1090,11 +1098,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		 * the routing table.
 		 */
 		if (!v4l2_subdev_has_op(sd, pad, set_routing)) {
-			memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-			       state->routing.routes,
-			       min(state->routing.num_routes, routing->len_routes) *
-			       sizeof(*state->routing.routes));
-			routing->num_routes = state->routing.num_routes;
+			subdev_copy_fix_routes(routing, state->routing.routes,
+					       routing->len_routes,
+					       state->routing.num_routes);
 
 			return 0;
 		}
@@ -1108,11 +1114,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		if (rval < 0)
 			return rval;
 
-		memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-		       state->routing.routes,
-		       min(state->routing.num_routes, routing->len_routes) *
-		       sizeof(*state->routing.routes));
-		routing->num_routes = state->routing.num_routes;
+		subdev_copy_fix_routes(routing, state->routing.routes,
+				       routing->len_routes,
+				       state->routing.num_routes);
 
 		return 0;
 	}
Signature · 3 lines
Regards,

Sakari Ailus
#18 lore raw

Re: [PATCH v2 05/14] media: v4l2-subdev: Refactor returning routes

In reply to Sakari Ailus

Hi Sakari,

Quoted 2 lines · Sakari Ailus

Refactor returning the routes by adding a new function that essentially does a memcopy and sets the number of the number of the routes in the

Repetition "The number of the number"

Quoted 17 lines

routing table.

---
  drivers/media/v4l2-core/v4l2-subdev.c | 40 +++++++++++++++------------
  1 file changed, 22 insertions(+), 18 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +2 -0
index b2105c34478e..8a433d074587 100644
@@ -629,6 +629,19 @@ subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh,
                              v4l2_subdev_get_unlocked_active_state(sd);
  }
 
+static void subdev_copy_fix_routes(struct v4l2_subdev_routing *routing,
+                                  const struct v4l2_subdev_route *src,

drivers/media/v4l2-core/v4l2-subdev.c subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh, · line 643

Quoted 10 lines
drivers/media/v4l2-core/v4l2-subdev.c +10 -0
+                                  u32 copy_routes, u32 num_routes)
+{
+       struct v4l2_subdev_route *routes =
+               (struct v4l2_subdev_route *)(uintptr_t)routing->routes;
+
+       for (u32 i = 0; i < copy_routes; i++)
+               routes[i] = src[i];
+
+       routing->num_routes = num_routes;
+}

The function just copies routes, no fixing, so I agree with Jacopo's comment, subdev_copy_routes seems like a better name.

Clear names for src/dest sound better, and also address the case when copy_routes>num_routes, at the calling place it was min(state->routing.num_routes, routing->len_routes).

Regards,

Mirela

Quoted 62 lines
drivers/media/v4l2-core/v4l2-subdev.c +10 -19
+
  static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                             struct v4l2_subdev_state *state)
  {
@@ -1000,7 +1013,6 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
         case VIDIOC_SUBDEV_G_ROUTING: {
                 struct v4l2_subdev_routing *routing = arg;
-               struct v4l2_subdev_krouting *krouting;
 
                 if (!v4l2_subdev_enable_streams_api)
                         return -ENOIOCTLCMD;
@@ -1013,13 +1025,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
                 memset(routing->reserved, 0, sizeof(routing->reserved));
 
-               krouting = &state->routing;
-
-               memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-                      krouting->routes,
-                      min(krouting->num_routes, routing->len_routes) *
-                      sizeof(*krouting->routes));
-               routing->num_routes = krouting->num_routes;
+               subdev_copy_fix_routes(routing, state->routing.routes,
+                                      routing->len_routes,
+                                      state->routing.num_routes);
 
                 return 0;
         }
@@ -1090,11 +1098,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                  * the routing table.
                  */
                 if (!v4l2_subdev_has_op(sd, pad, set_routing)) {
-                       memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-                              state->routing.routes,
-                              min(state->routing.num_routes, routing->len_routes) *
-                              sizeof(*state->routing.routes));
-                       routing->num_routes = state->routing.num_routes;
+                       subdev_copy_fix_routes(routing, state->routing.routes,
+                                              routing->len_routes,
+                                              state->routing.num_routes);
 
                         return 0;
                 }
@@ -1108,11 +1114,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                 if (rval < 0)
                         return rval;
 
-               memcpy((struct v4l2_subdev_route *)(uintptr_t)routing->routes,
-                      state->routing.routes,
-                      min(state->routing.num_routes, routing->len_routes) *
-                      sizeof(*state->routing.routes));
-               routing->num_routes = state->routing.num_routes;
+               subdev_copy_fix_routes(routing, state->routing.routes,
+                                      routing->len_routes,
+                                      state->routing.num_routes);
 
                 return 0;
         }
--

2.47.3

author maintainer
#19 lore raw

Re: [PATCH v2 05/14] media: v4l2-subdev: Refactor returning routes

Hi Mirela,

Quoted 6 lines · Mirela Rabulea

Hi Sakari,

Quoted 2 lines · Sakari Ailus

Refactor returning the routes by adding a new function that essentially does a memcopy and sets the number of the number of the routes in the

Repetition "The number of the number"

Fixed for v3.

Quoted 31 lines
Quoted 17 lines

routing table.

---
  drivers/media/v4l2-core/v4l2-subdev.c | 40 +++++++++++++++------------
  1 file changed, 22 insertions(+), 18 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +2 -0
index b2105c34478e..8a433d074587 100644
@@ -629,6 +629,19 @@ subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh,
                              v4l2_subdev_get_unlocked_active_state(sd);
  }
 
+static void subdev_copy_fix_routes(struct v4l2_subdev_routing *routing,
+                                  const struct v4l2_subdev_route *src,

drivers/media/v4l2-core/v4l2-subdev.c subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh, · line 643

Quoted 10 lines
drivers/media/v4l2-core/v4l2-subdev.c +10 -0
+                                  u32 copy_routes, u32 num_routes)
+{
+       struct v4l2_subdev_route *routes =
+               (struct v4l2_subdev_route *)(uintptr_t)routing->routes;
+
+       for (u32 i = 0; i < copy_routes; i++)
+               routes[i] = src[i];
+
+       routing->num_routes = num_routes;
+}

The function just copies routes, no fixing, so I agree with Jacopo's comment, subdev_copy_routes seems like a better name.

Quoted 3 lines

Clear names for src/dest sound better, and also address the case when copy_routes>num_routes, at the calling place it was min(state->routing.num_routes, routing->len_routes).

I agree. I'll also change the arguments to just include the routing struct and the state -- all the callers already use these. How about calling it copy_routes_state_to_routing()?

Signature · 3 lines
Regards,

Sakari Ailus
#20 lore raw

Re: Re: [PATCH v2 05/14] media: v4l2-subdev: Refactor returning routes

Hi Sakari,

Quoted 9 lines · Sakari Ailus
Quoted 6 lines

The function just copies routes, no fixing, so I agree with Jacopo's comment, subdev_copy_routes seems like a better name.

Clear names for src/dest sound better, and also address the case when copy_routes>num_routes, at the calling place it was min(state->routing.num_routes, routing->len_routes).

I agree. I'll also change the arguments to just include the routing struct and the state -- all the callers already use these. How about calling it copy_routes_state_to_routing()?

Ok.

Regards,

Mirela

Quoted 5 lines

--
Regards,

Sakari Ailus

author maintainer
#21 lore raw

PATCH v2 6/14 media: mc: Separate single link validation into a new function

In reply to Sakari Ailus

Add a new function __media_pipeline_validate_one() to validate a single link in a pipeline. This will soon be used for performing validation in multiple phases.

---
 drivers/media/mc/mc-entity.c | 80 +++++++++++++++++++++---------------
 1 file changed, 47 insertions(+), 33 deletions(-)
drivers/media/mc/mc-entity.c +47 -33
index 9519a537bfa2..ef959e9bb313 100644
@@ -768,6 +768,49 @@ static int media_pipeline_populate(struct media_pipeline *pipe,
 	return ret;
 }
 
+static int
+__media_pipeline_validate_one(struct media_pad *origin,
+			      struct media_pipeline *pipe,
+			      struct media_pad *pad, struct media_link *link,
+			      bool *has_enabled_link)
+{
+	struct media_device *mdev = origin->graph_obj.mdev;
+	struct media_entity *entity = pad->entity;
+	int ret;
+
+	/* Record if the pad has links and enabled links. */
+	if (link->flags & MEDIA_LNK_FL_ENABLED && has_enabled_link)
+		*has_enabled_link = true;
+
+	/*
+	 * Validate the link if it's enabled and has the
+	 * current pad as its sink.
+	 */
+	if (!(link->flags & MEDIA_LNK_FL_ENABLED))
+		return 0;
+
+	if (link->sink != pad)
+		return 0;
+
+	if (!entity->ops || !entity->ops->link_validate)
+		return 0;
+
+	ret = entity->ops->link_validate(link);
+	if (ret) {
+		dev_dbg(mdev->dev,
+			"Link '%s':%u -> '%s':%u failed validation: %d\n",
+			link->source->entity->name, link->source->index,
+			link->sink->entity->name, link->sink->index, ret);
+		return ret;
+	}
+
+	dev_dbg(mdev->dev, "Link '%s':%u -> '%s':%u is valid\n",
+		link->source->entity->name, link->source->index,
+		link->sink->entity->name, link->sink->index);
+
+	return 0;
+}
+
 __must_check int __media_pipeline_start(struct media_pad *origin,
 					struct media_pipeline *pipe)
 {
@@ -838,40 +881,11 @@ __must_check int __media_pipeline_start(struct media_pad *origin,
 			if (link->sink != pad && link->source != pad)
 				continue;
 
-			/* Record if the pad has links and enabled links. */
-			if (link->flags & MEDIA_LNK_FL_ENABLED)
-				has_enabled_link = true;
-
-			/*
-			 * Validate the link if it's enabled and has the
-			 * current pad as its sink.
-			 */
-			if (!(link->flags & MEDIA_LNK_FL_ENABLED))
-				continue;
-
-			if (link->sink != pad)
-				continue;
-
-			if (!entity->ops || !entity->ops->link_validate)
-				continue;
-
-			ret = entity->ops->link_validate(link);
-			if (ret) {
-				dev_dbg(mdev->dev,
-					"Link '%s':%u -> '%s':%u failed validation: %d\n",
-					link->source->entity->name,
-					link->source->index,
-					link->sink->entity->name,
-					link->sink->index, ret);
+			ret = __media_pipeline_validate_one(origin, pipe,
+							    origin, link,
+							    &has_enabled_link);
+			if (ret)
 				goto error;
-			}
-
-			dev_dbg(mdev->dev,
-				"Link '%s':%u -> '%s':%u is valid\n",
-				link->source->entity->name,
-				link->source->index,
-				link->sink->entity->name,
-				link->sink->index);
 		}
 
 		/*
Signature · 1 line
2.47.3
#22 lore raw

Re: [PATCH v2 06/14] media: mc: Separate single link validation into a new function

Hi Sakari,

Quoted 14 lines · Sakari Ailus

Add a new function __media_pipeline_validate_one() to validate a single link in a pipeline. This will soon be used for performing validation in multiple phases.

---
  drivers/media/mc/mc-entity.c | 80 +++++++++++++++++++++---------------
  1 file changed, 47 insertions(+), 33 deletions(-)
drivers/media/mc/mc-entity.c +0 -0
index 9519a537bfa2..ef959e9bb313 100644

drivers/media/mc/mc-entity.c static int media_pipeline_populate(struct media_pipeline *pipe, · line 773

Quoted 6 lines
drivers/media/mc/mc-entity.c +3 -0
@@ -768,6 +768,49 @@ static int media_pipeline_populate(struct media_pipeline *pipe,
         return ret;
  }
 
+static int
+__media_pipeline_validate_one(struct media_pad *origin,
+                             struct media_pipeline *pipe,

pipe parameter is not used

Quoted 65 lines
drivers/media/mc/mc-entity.c +40 -18
+                             struct media_pad *pad, struct media_link *link,
+                             bool *has_enabled_link)
+{
+       struct media_device *mdev = origin->graph_obj.mdev;
+       struct media_entity *entity = pad->entity;
+       int ret;
+
+       /* Record if the pad has links and enabled links. */
+       if (link->flags & MEDIA_LNK_FL_ENABLED && has_enabled_link)
+               *has_enabled_link = true;
+
+       /*
+        * Validate the link if it's enabled and has the
+        * current pad as its sink.
+        */
+       if (!(link->flags & MEDIA_LNK_FL_ENABLED))
+               return 0;
+
+       if (link->sink != pad)
+               return 0;
+
+       if (!entity->ops || !entity->ops->link_validate)
+               return 0;
+
+       ret = entity->ops->link_validate(link);
+       if (ret) {
+               dev_dbg(mdev->dev,
+                       "Link '%s':%u -> '%s':%u failed validation: %d\n",
+                       link->source->entity->name, link->source->index,
+                       link->sink->entity->name, link->sink->index, ret);
+               return ret;
+       }
+
+       dev_dbg(mdev->dev, "Link '%s':%u -> '%s':%u is valid\n",
+               link->source->entity->name, link->source->index,
+               link->sink->entity->name, link->sink->index);
+
+       return 0;
+}
+
  __must_check int __media_pipeline_start(struct media_pad *origin,
                                         struct media_pipeline *pipe)
  {
@@ -838,40 +881,11 @@ __must_check int __media_pipeline_start(struct media_pad *origin,
                         if (link->sink != pad && link->source != pad)
                                 continue;
 
-                       /* Record if the pad has links and enabled links. */
-                       if (link->flags & MEDIA_LNK_FL_ENABLED)
-                               has_enabled_link = true;
-
-                       /*
-                        * Validate the link if it's enabled and has the
-                        * current pad as its sink.
-                        */
-                       if (!(link->flags & MEDIA_LNK_FL_ENABLED))
-                               continue;
-
-                       if (link->sink != pad)
-                               continue;
-
-                       if (!entity->ops || !entity->ops->link_validate)
-                               continue;
-
-                       ret = entity->ops->link_validate(link);

drivers/media/mc/mc-entity.c __must_check int __media_pipeline_start(struct media_pad *origin, · line 886

Quoted 10 lines
drivers/media/mc/mc-entity.c +3 -7
-                       if (ret) {
-                               dev_dbg(mdev->dev,
-                                       "Link '%s':%u -> '%s':%u failed validation: %d\n",
-                                       link->source->entity->name,
-                                       link->source->index,
-                                       link->sink->entity->name,
-                                       link->sink->index, ret);
+                       ret = __media_pipeline_validate_one(origin, pipe,
+                                                           origin, link,
+                                                           &has_enabled_link);

Shouldn't this be __media_pipeline_validate_one(origin, pipe, pad, link, &has_enabled_link) ?

Also, before refactoring, there were 2 checks, I think the first one was unnecessary:

                        if (link->sink != pad && link->source != pad)
                                continue;
The second one was more complete, it is the check that should remain in the end, either before calling the new function, or inside the function, but please adjust also the comments according to the actual code:
                       if (link->sink != pad)
                               continue;

Regards,

Mirela

Quoted 16 lines
drivers/media/mc/mc-entity.c +1 -9
+                       if (ret)
                                 goto error;
-                       }
-
-                       dev_dbg(mdev->dev,
-                               "Link '%s':%u -> '%s':%u is valid\n",
-                               link->source->entity->name,
-                               link->source->index,
-                               link->sink->entity->name,
-                               link->sink->index);
                 }
 
                 /*
--

2.47.3

author maintainer
#23 lore raw

Re: [PATCH v2 06/14] media: mc: Separate single link validation into a new function

Hi Mirela,

Quoted 20 lines · Mirela Rabulea

Hi Sakari,

Quoted 17 lines · Sakari Ailus

Add a new function __media_pipeline_validate_one() to validate a single link in a pipeline. This will soon be used for performing validation in multiple phases.

---
  drivers/media/mc/mc-entity.c | 80 +++++++++++++++++++++---------------
  1 file changed, 47 insertions(+), 33 deletions(-)
drivers/media/mc/mc-entity.c +0 -0
index 9519a537bfa2..ef959e9bb313 100644
@@ -768,6 +768,49 @@ static int media_pipeline_populate(struct media_pipeline *pipe,
         return ret;
  }
 
Quoted 4 lines

drivers/media/mc/mc-entity.c static int media_pipeline_populate(struct media_pipeline *pipe, · line 773

Quoted 3 lines
drivers/media/mc/mc-entity.c +3 -0
+static int
+__media_pipeline_validate_one(struct media_pad *origin,
+                             struct media_pipeline *pipe,

pipe parameter is not used

I'll remove it for v3.

Quoted 70 lines
Quoted 70 lines
drivers/media/mc/mc-entity.c +40 -23
+                             struct media_pad *pad, struct media_link *link,
+                             bool *has_enabled_link)
+{
+       struct media_device *mdev = origin->graph_obj.mdev;
+       struct media_entity *entity = pad->entity;
+       int ret;
+
+       /* Record if the pad has links and enabled links. */
+       if (link->flags & MEDIA_LNK_FL_ENABLED && has_enabled_link)
+               *has_enabled_link = true;
+
+       /*
+        * Validate the link if it's enabled and has the
+        * current pad as its sink.
+        */
+       if (!(link->flags & MEDIA_LNK_FL_ENABLED))
+               return 0;
+
+       if (link->sink != pad)
+               return 0;
+
+       if (!entity->ops || !entity->ops->link_validate)
+               return 0;
+
+       ret = entity->ops->link_validate(link);
+       if (ret) {
+               dev_dbg(mdev->dev,
+                       "Link '%s':%u -> '%s':%u failed validation: %d\n",
+                       link->source->entity->name, link->source->index,
+                       link->sink->entity->name, link->sink->index, ret);
+               return ret;
+       }
+
+       dev_dbg(mdev->dev, "Link '%s':%u -> '%s':%u is valid\n",
+               link->source->entity->name, link->source->index,
+               link->sink->entity->name, link->sink->index);
+
+       return 0;
+}
+
  __must_check int __media_pipeline_start(struct media_pad *origin,
                                         struct media_pipeline *pipe)
  {
@@ -838,40 +881,11 @@ __must_check int __media_pipeline_start(struct media_pad *origin,
                         if (link->sink != pad && link->source != pad)
                                 continue;
 
-                       /* Record if the pad has links and enabled links. */
-                       if (link->flags & MEDIA_LNK_FL_ENABLED)
-                               has_enabled_link = true;
-
-                       /*
-                        * Validate the link if it's enabled and has the
-                        * current pad as its sink.
-                        */
-                       if (!(link->flags & MEDIA_LNK_FL_ENABLED))
-                               continue;
-
-                       if (link->sink != pad)
-                               continue;
-
-                       if (!entity->ops || !entity->ops->link_validate)
-                               continue;
-
-                       ret = entity->ops->link_validate(link);
-                       if (ret) {
-                               dev_dbg(mdev->dev,
-                                       "Link '%s':%u -> '%s':%u failed validation: %d\n",
-                                       link->source->entity->name,
-                                       link->source->index,
Quoted 8 lines

drivers/media/mc/mc-entity.c __must_check int __media_pipeline_start(struct media_pad *origin, · line 886

Quoted 5 lines
drivers/media/mc/mc-entity.c +3 -2
-                                       link->sink->entity->name,
-                                       link->sink->index, ret);
+                       ret = __media_pipeline_validate_one(origin, pipe,
+                                                           origin, link,
+                                                           &has_enabled_link);

Shouldn't this be __media_pipeline_validate_one(origin, pipe, pad, link, &has_enabled_link) ?

Yes, good find! This would have been bitten us later...

Quoted 11 lines

Also, before refactoring, there were 2 checks, I think the first one was unnecessary:

                        if (link->sink != pad && link->source != pad) continue;
The second one was more complete, it is the check that should remain in the end, either before calling the new function, or inside the function, but please adjust also the comments according to the actual code:
                       if (link->sink != pad)
                               continue;

There are two checks in order to collect information on enabled links to the pad (first check) and perform validation on sink pads only (second check). Both should remain.

There's additional cleanup that can be done on the conditions here; I'll prepend a new patch for that.

Signature · 3 lines
Kind regards,

Sakari Ailus
author maintainer
#24 lore raw

PATCH v2 7/14 media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE

In reply to Sakari Ailus

Add MEDIA_LNK_FL_VALIDATE_LATE flag to support late validation of links. This is serving the use case where video devices are configured and started streaming indepenently of each other but this sequence may be run in series, in such a way that a video device in a pipeline starts streaming before another one is configured.

Before this flag, drivers have resorted to implementing the link validation separately for the video nodes as part of streaming start sequence.

media_pipeline_start() shall be called on each leaf entity connected to the graph with a link where MEDIA_LNK_FL_VALIDATE_LATE is set before uphardware operation.

---
 .../media/mediactl/media-ioc-setup-link.rst   |  4 ++
 .../media/mediactl/media-types.rst            |  5 ++
 drivers/media/mc/mc-entity.c                  | 58 ++++++++++++++++++-
 include/uapi/linux/media.h                    |  1 +
 4 files changed, 66 insertions(+), 2 deletions(-)
Documentation/userspace-api/media/mediactl/media-ioc-setup-link.rst +4 -0
index 23208300cb61..7a9a43c71cde 100644
@@ -49,6 +49,10 @@ Only links marked with the ``DYNAMIC`` link flag can be enabled/disabled
 while streaming media data. Attempting to enable or disable a streaming
 non-dynamic link will return an ``EBUSY`` error code.
 
+The ``VALIDATE_LATE`` flag is used to signal that the validation of the link may
+be delayed until actual hardware operation even if the rest of the pipeline
+would be validated at an earlier point of time.
+
 If the specified link can't be found the driver returns with an ``EINVAL``
 error code.
 
Documentation/userspace-api/media/mediactl/media-types.rst +5 -0
index 6332e8395263..d6a690655a01 100644
@@ -391,6 +391,7 @@ must be set for every pad.
 .. _MEDIA-LNK-FL-ENABLED:
 .. _MEDIA-LNK-FL-IMMUTABLE:
 .. _MEDIA-LNK-FL-DYNAMIC:
+.. _MEDIA-LNK-FL-VALIDATE-LATE:
 .. _MEDIA-LNK-FL-LINK-TYPE:
 
 .. flat-table:: Media link flags
@@ -410,6 +411,10 @@ must be set for every pad.
        -  The link enabled state can be modified during streaming. This flag
 	  is set by drivers and is read-only for applications.
 
+    *  -  ``MEDIA_LNK_FL_VALIDATE_LATE``
+       -  The validation of the link may be delayed up to until the start of
+	  hardware operation.
+
     *  -  ``MEDIA_LNK_FL_LINK_TYPE``
        -  This is a bitmask that defines the type of the link. The following
 	  link types are currently supported:
drivers/media/mc/mc-entity.c +56 -2

91 lines not on this page · raw message

include/uapi/linux/media.h +1 -0
index 1c80b1d6bbaf..c96e2118ea99 100644
@@ -219,6 +219,7 @@ struct media_pad_desc {
 #define MEDIA_LNK_FL_ENABLED			(1U << 0)
 #define MEDIA_LNK_FL_IMMUTABLE			(1U << 1)
 #define MEDIA_LNK_FL_DYNAMIC			(1U << 2)
+#define MEDIA_LNK_FL_VALIDATE_LATE		(1U << 3)
 
 #define MEDIA_LNK_FL_LINK_TYPE			(0xf << 28)
 #  define MEDIA_LNK_FL_DATA_LINK		(0U << 28)
Signature · 1 line
2.47.3
#25 lore raw

Re: [PATCH v2 07/14] media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE

Hi Sakari,

Quoted 84 lines · Sakari Ailus

Add MEDIA_LNK_FL_VALIDATE_LATE flag to support late validation of links. This is serving the use case where video devices are configured and started streaming indepenently of each other but this sequence may be run in series, in such a way that a video device in a pipeline starts streaming before another one is configured.

Before this flag, drivers have resorted to implementing the link validation separately for the video nodes as part of streaming start sequence.

media_pipeline_start() shall be called on each leaf entity connected to the graph with a link where MEDIA_LNK_FL_VALIDATE_LATE is set before uphardware operation.

---
  .../media/mediactl/media-ioc-setup-link.rst   |  4 ++
  .../media/mediactl/media-types.rst            |  5 ++
  drivers/media/mc/mc-entity.c                  | 58 ++++++++++++++++++-
  include/uapi/linux/media.h                    |  1 +
  4 files changed, 66 insertions(+), 2 deletions(-)
Documentation/userspace-api/media/mediactl/media-ioc-setup-link.rst +4 -0
index 23208300cb61..7a9a43c71cde 100644
@@ -49,6 +49,10 @@ Only links marked with the ``DYNAMIC`` link flag can be enabled/disabled
  while streaming media data. Attempting to enable or disable a streaming
  non-dynamic link will return an ``EBUSY`` error code.
 
+The ``VALIDATE_LATE`` flag is used to signal that the validation of the link may
+be delayed until actual hardware operation even if the rest of the pipeline
+would be validated at an earlier point of time.
+
  If the specified link can't be found the driver returns with an ``EINVAL``
  error code.
 
Documentation/userspace-api/media/mediactl/media-types.rst +5 -0
index 6332e8395263..d6a690655a01 100644
@@ -391,6 +391,7 @@ must be set for every pad.
  .. _MEDIA-LNK-FL-ENABLED:
  .. _MEDIA-LNK-FL-IMMUTABLE:
  .. _MEDIA-LNK-FL-DYNAMIC:
+.. _MEDIA-LNK-FL-VALIDATE-LATE:
  .. _MEDIA-LNK-FL-LINK-TYPE:
 
  .. flat-table:: Media link flags
@@ -410,6 +411,10 @@ must be set for every pad.
         -  The link enabled state can be modified during streaming. This flag
           is set by drivers and is read-only for applications.
 
+    *  -  ``MEDIA_LNK_FL_VALIDATE_LATE``
+       -  The validation of the link may be delayed up to until the start of
+         hardware operation.
+
      *  -  ``MEDIA_LNK_FL_LINK_TYPE``
         -  This is a bitmask that defines the type of the link. The following
           link types are currently supported:
drivers/media/mc/mc-entity.c +4 -1
index ef959e9bb313..b29b519237d6 100644
@@ -772,7 +772,7 @@ static int
  __media_pipeline_validate_one(struct media_pad *origin,
                               struct media_pipeline *pipe,
                               struct media_pad *pad, struct media_link *link,
-                             bool *has_enabled_link)
+                             bool *has_enabled_link, bool skip_validation)
  {
         struct media_device *mdev = origin->graph_obj.mdev;
         struct media_entity *entity = pad->entity;
@@ -782,6 +782,9 @@ __media_pipeline_validate_one(struct media_pad *origin,
         if (link->flags & MEDIA_LNK_FL_ENABLED && has_enabled_link)
                 *has_enabled_link = true;
 
+       if (skip_validation)
+               return 0;
+
         /*
          * Validate the link if it's enabled and has the
          * current pad as its sink.

drivers/media/mc/mc-entity.c __must_check int __media_pipeline_start(struct media_pad *origin, · line 836

Quoted 1 line
drivers/media/mc/mc-entity.c +0 -0
@@ -833,7 +836,24 @@ __must_check int __media_pipeline_start(struct media_pad *origin,
          * valid, so just increase the start count.

The above comment is no longer accurate.

drivers/media/mc/mc-entity.c __must_check int __media_pipeline_start(struct media_pad *origin, · line 842

Quoted 6 lines
drivers/media/mc/mc-entity.c +4 -0
          */
         if (pipe->start_count) {
+               struct media_link *link;
+
+               link = __media_entity_next_link(origin->entity, NULL,
+                                               MEDIA_LNK_FL_DATA_LINK);

This __media_entity_next_link() will retrieve the first data link. Is this guaranteed to be connected to origin pad? Is this intended, or is a check for (link->source == origin || link->sink == origin) also necessary?

Quoted 18 lines
drivers/media/mc/mc-entity.c +13 -0
+               if (link && link->flags & MEDIA_LNK_FL_VALIDATE_LATE) {
+                       dev_dbg(mdev->dev,
+                               "Validating pad '%s':%u late\n",
+                               origin->entity->name, origin->index);
+
+                       ret = __media_pipeline_validate_one(link->sink, pipe,
+                                                           link->sink, link,
+                                                           NULL, false);
+                       if (ret)
+                               return ret;
+               }
+
                 pipe->start_count++;
+
                 return 0;
         }
 

drivers/media/mc/mc-entity.c __must_check int __media_pipeline_start(struct media_pad *origin, · line 905

Quoted 5 lines
drivers/media/mc/mc-entity.c +2 -0
@@ -881,9 +901,16 @@ __must_check int __media_pipeline_start(struct media_pad *origin,
                         if (link->sink != pad && link->source != pad)
                                 continue;
 
+                       /* Skip late-validated links not connected to origin. */
+                       bool skip_validation =

Move skip_validation declaration at beginning of the block.

Regards,

Mirela

Quoted 61 lines
drivers/media/mc/mc-entity.c +33 -1
+                               link->flags & MEDIA_LNK_FL_VALIDATE_LATE &&
+                               (link->sink == origin ||
+                                link->source == origin);
+
                         ret = __media_pipeline_validate_one(origin, pipe,
                                                             origin, link,
-                                                           &has_enabled_link);
+                                                           &has_enabled_link,
+                                                           skip_validation);
                         if (ret)
                                 goto error;
                 }
@@ -1163,6 +1190,33 @@ media_create_pad_link(struct media_entity *source, u16 source_pad,
         if (WARN_ON(!(sink->pads[sink_pad].flags & MEDIA_PAD_FL_SINK)))
                 return -EINVAL;
 
+       /*
+        * With the late validate flag, either source or sink shall have exactly
+        * one pad and no links before this one. Similarly, no links may be
+        * added to entities with a single pad and an existing late-validated
+        * link.
+        */
+       if (flags & MEDIA_LNK_FL_VALIDATE_LATE) {
+               if (!(source->num_pads == 1 && !source->num_links) &&
+                   !(sink->num_pads == 1 && !sink->num_links))
+                       return -EINVAL;
+       } else {
+               struct media_entity *entities[] = { source, sink };
+
+               for (unsigned int i = 0; i < ARRAY_SIZE(entities); i++) {
+                       if (entities[i]->num_pads != 1)
+                               continue;
+
+                       struct media_link *__link =
+                               __media_entity_next_link(entities[i], NULL,
+                                                        MEDIA_LNK_FL_DATA_LINK);
+
+                       if (__link &&
+                           __link->flags & MEDIA_LNK_FL_VALIDATE_LATE)
+                               return -EINVAL;
+               }
+       }
+
         link = media_add_link(&source->links);
         if (link == NULL)
                 return -ENOMEM;
include/uapi/linux/media.h +1 -1
index 1c80b1d6bbaf..c96e2118ea99 100644
@@ -219,6 +219,7 @@ struct media_pad_desc {
  #define MEDIA_LNK_FL_ENABLED                   (1U << 0)
  #define MEDIA_LNK_FL_IMMUTABLE                 (1U << 1)
  #define MEDIA_LNK_FL_DYNAMIC                   (1U << 2)
+#define MEDIA_LNK_FL_VALIDATE_LATE             (1U << 3)
 
  #define MEDIA_LNK_FL_LINK_TYPE                 (0xf << 28)
  #  define MEDIA_LNK_FL_DATA_LINK               (0U << 28)
--

2.47.3

author maintainer
#26 lore raw

Re: [PATCH v2 07/14] media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE

Hi Mirela,

Quoted 80 lines · Mirela Rabulea

Hi Sakari,

Quoted 77 lines · Sakari Ailus

Add MEDIA_LNK_FL_VALIDATE_LATE flag to support late validation of links. This is serving the use case where video devices are configured and started streaming indepenently of each other but this sequence may be run in series, in such a way that a video device in a pipeline starts streaming before another one is configured.

Before this flag, drivers have resorted to implementing the link validation separately for the video nodes as part of streaming start sequence.

media_pipeline_start() shall be called on each leaf entity connected to the graph with a link where MEDIA_LNK_FL_VALIDATE_LATE is set before uphardware operation.

---
  .../media/mediactl/media-ioc-setup-link.rst   |  4 ++
  .../media/mediactl/media-types.rst            |  5 ++
  drivers/media/mc/mc-entity.c                  | 58 ++++++++++++++++++-
  include/uapi/linux/media.h                    |  1 +
  4 files changed, 66 insertions(+), 2 deletions(-)
Documentation/userspace-api/media/mediactl/media-ioc-setup-link.rst +4 -0
index 23208300cb61..7a9a43c71cde 100644
@@ -49,6 +49,10 @@ Only links marked with the ``DYNAMIC`` link flag can be enabled/disabled
  while streaming media data. Attempting to enable or disable a streaming
  non-dynamic link will return an ``EBUSY`` error code.
 
+The ``VALIDATE_LATE`` flag is used to signal that the validation of the link may
+be delayed until actual hardware operation even if the rest of the pipeline
+would be validated at an earlier point of time.
+
  If the specified link can't be found the driver returns with an ``EINVAL``
  error code.
 
Documentation/userspace-api/media/mediactl/media-types.rst +5 -0
index 6332e8395263..d6a690655a01 100644
@@ -391,6 +391,7 @@ must be set for every pad.
  .. _MEDIA-LNK-FL-ENABLED:
  .. _MEDIA-LNK-FL-IMMUTABLE:
  .. _MEDIA-LNK-FL-DYNAMIC:
+.. _MEDIA-LNK-FL-VALIDATE-LATE:
  .. _MEDIA-LNK-FL-LINK-TYPE:
 
  .. flat-table:: Media link flags
@@ -410,6 +411,10 @@ must be set for every pad.
         -  The link enabled state can be modified during streaming. This flag
           is set by drivers and is read-only for applications.
 
+    *  -  ``MEDIA_LNK_FL_VALIDATE_LATE``
+       -  The validation of the link may be delayed up to until the start of
+         hardware operation.
+
      *  -  ``MEDIA_LNK_FL_LINK_TYPE``
         -  This is a bitmask that defines the type of the link. The following
           link types are currently supported:
drivers/media/mc/mc-entity.c +1 -1
index ef959e9bb313..b29b519237d6 100644
@@ -772,7 +772,7 @@ static int
  __media_pipeline_validate_one(struct media_pad *origin,
                               struct media_pipeline *pipe,
                               struct media_pad *pad, struct media_link *link,
-                             bool *has_enabled_link)
+                             bool *has_enabled_link, bool skip_validation)
  {
         struct media_device *mdev = origin->graph_obj.mdev;
         struct media_entity *entity = pad->entity;
@@ -782,6 +782,9 @@ __media_pipeline_validate_one(struct media_pad *origin,
         if (link->flags & MEDIA_LNK_FL_ENABLED && has_enabled_link)
                 *has_enabled_link = true;
 
Quoted 9 lines

drivers/media/mc/mc-entity.c __must_check int __media_pipeline_start(struct media_pad *origin, · line 836

Quoted 8 lines
drivers/media/mc/mc-entity.c +3 -0
+       if (skip_validation)
+               return 0;
+
         /*
          * Validate the link if it's enabled and has the
          * current pad as its sink.
@@ -833,7 +836,24 @@ __must_check int __media_pipeline_start(struct media_pad *origin,
          * valid, so just increase the start count.

The above comment is no longer accurate.

I'll see how to reword this for v3.

Quoted 9 lines

drivers/media/mc/mc-entity.c __must_check int __media_pipeline_start(struct media_pad *origin, · line 842

Quoted 6 lines
drivers/media/mc/mc-entity.c +4 -0
          */
         if (pipe->start_count) {
+               struct media_link *link;
+
+               link = __media_entity_next_link(origin->entity, NULL,
+                                               MEDIA_LNK_FL_DATA_LINK);

This __media_entity_next_link() will retrieve the first data link. Is this guaranteed to be connected to origin pad? Is this intended, or is a check for (link->source == origin || link->sink == origin) also necessary?

I'd say so, when it comes to video nodes, but theoretically the flag could be set on other entities as well, albeit probably erroneously. I think we could add a check there's exacly one pad in the entity and that pad has a single link.

Quoted 17 lines
Quoted 17 lines
drivers/media/mc/mc-entity.c +13 -0
+               if (link && link->flags & MEDIA_LNK_FL_VALIDATE_LATE) {
+                       dev_dbg(mdev->dev,
+                               "Validating pad '%s':%u late\n",
+                               origin->entity->name, origin->index);
+
+                       ret = __media_pipeline_validate_one(link->sink, pipe,
+                                                           link->sink, link,
+                                                           NULL, false);
+                       if (ret)
+                               return ret;
+               }
+
                 pipe->start_count++;
+
                 return 0;
         }
 
Quoted 8 lines

drivers/media/mc/mc-entity.c __must_check int __media_pipeline_start(struct media_pad *origin, · line 905

Quoted 6 lines
drivers/media/mc/mc-entity.c +2 -0
@@ -881,9 +901,16 @@ __must_check int __media_pipeline_start(struct media_pad *origin,
                         if (link->sink != pad && link->source != pad)
                                 continue;
 
+                       /* Skip late-validated links not connected to origin. */
+                       bool skip_validation =

Move skip_validation declaration at beginning of the block.

I'd think it's fine to declare it here, too, but I can move it a few lines up as well.

Quoted 17 lines

Regards,

Mirela

Quoted 12 lines
drivers/media/mc/mc-entity.c +6 -1
+                               link->flags & MEDIA_LNK_FL_VALIDATE_LATE &&
+                               (link->sink == origin ||
+                                link->source == origin);
+
                         ret = __media_pipeline_validate_one(origin, pipe,
                                                             origin, link,
-                                                           &has_enabled_link);
+                                                           &has_enabled_link,
+                                                           skip_validation);
                         if (ret)
                                 goto error;
                 }
Signature · 3 lines
Regards,

Sakari Ailus
author maintainer
#27 lore raw

PATCH v2 8/14 media: mc: Don't care about unsettable flags in MEDIA_IOC_LINK_SETUP

In reply to Sakari Ailus

The implementation of MEDIA_IOC_LINK_SETUP currently requires that all flags that are set by the driver are correctly set as the driver expect. This poses a problem for adding new flags as programs could not work with links that have unknown flags even when the use of these flags wouldn't affect the program.

Ignore the non-settable link flags.

---
 drivers/media/mc/mc-entity.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/mc/mc-entity.c +5 -5
index b29b519237d6..cf72bfb8885c 100644
@@ -1378,7 +1378,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags)
 
 int __media_entity_setup_link(struct media_link *link, u32 flags)
 {
-	const u32 mask = MEDIA_LNK_FL_ENABLED;
+	const u32 settable_flags = MEDIA_LNK_FL_ENABLED;
 	struct media_device *mdev;
 	struct media_pad *source, *sink;
 	int ret = -EBUSY;
@@ -1386,10 +1386,6 @@ int __media_entity_setup_link(struct media_link *link, u32 flags)
 	if (link == NULL)
 		return -EINVAL;
 
-	/* The non-modifiable link flags must not be modified. */
-	if ((link->flags & ~mask) != (flags & ~mask))
-		return -EINVAL;
-
 	if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
 		return link->flags == flags ? 0 : -EINVAL;
 
@@ -1403,6 +1399,10 @@ int __media_entity_setup_link(struct media_link *link, u32 flags)
 	    (media_pad_is_streaming(source) || media_pad_is_streaming(sink)))
 		return -EBUSY;
 
+	/* Only allow changing user-settable flags. */
+	flags &= settable_flags;
+	flags |= link->flags & ~settable_flags;
+
 	mdev = source->graph_obj.mdev;
 
 	if (mdev->ops && mdev->ops->link_notify) {
Signature · 1 line
2.47.3
#28 lore raw

Re: [PATCH v2 08/14] media: mc: Don't care about unsettable flags in MEDIA_IOC_LINK_SETUP

Hi Sakari,

Quoted 2 lines · Sakari Ailus

The implementation of MEDIA_IOC_LINK_SETUP currently requires that all flags that are set by the driver are correctly set as the driver expect.

expect->expects

Quoted 36 lines

This poses a problem for adding new flags as programs could not work with links that have unknown flags even when the use of these flags wouldn't affect the program.

Ignore the non-settable link flags.

---
  drivers/media/mc/mc-entity.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/mc/mc-entity.c +1 -5
index b29b519237d6..cf72bfb8885c 100644
@@ -1378,7 +1378,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags)
 
  int __media_entity_setup_link(struct media_link *link, u32 flags)
  {
-       const u32 mask = MEDIA_LNK_FL_ENABLED;
+       const u32 settable_flags = MEDIA_LNK_FL_ENABLED;
         struct media_device *mdev;
         struct media_pad *source, *sink;
         int ret = -EBUSY;
@@ -1386,10 +1386,6 @@ int __media_entity_setup_link(struct media_link *link, u32 flags)
         if (link == NULL)
                 return -EINVAL;
 
-       /* The non-modifiable link flags must not be modified. */
-       if ((link->flags & ~mask) != (flags & ~mask))
-               return -EINVAL;
-
         if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
                 return link->flags == flags ? 0 : -EINVAL;
 

drivers/media/mc/mc-entity.c int __media_entity_setup_link(struct media_link *link, u32 flags) · line 1405

Quoted 7 lines
drivers/media/mc/mc-entity.c +4 -0
@@ -1403,6 +1399,10 @@ int __media_entity_setup_link(struct media_link *link, u32 flags)
             (media_pad_is_streaming(source) || media_pad_is_streaming(sink)))
                 return -EBUSY;
 
+       /* Only allow changing user-settable flags. */
+       flags &= settable_flags;
+       flags |= link->flags & ~settable_flags;
+

The immutable check now compares before filtering, previously this was after the filtering. Is this change intentional?

Regards,

Mirela

Quoted 6 lines
drivers/media/mc/mc-entity.c +0 -1
         mdev = source->graph_obj.mdev;
 
         if (mdev->ops && mdev->ops->link_notify) {
--

2.47.3

author maintainer
#29 lore raw

Re: [PATCH v2 08/14] media: mc: Don't care about unsettable flags in MEDIA_IOC_LINK_SETUP

Hi Mirela,

Quoted 45 lines · Mirela Rabulea

Hi Sakari,

Quoted 2 lines · Sakari Ailus

The implementation of MEDIA_IOC_LINK_SETUP currently requires that all flags that are set by the driver are correctly set as the driver expect.

expect->expects

Quoted 39 lines

This poses a problem for adding new flags as programs could not work with links that have unknown flags even when the use of these flags wouldn't affect the program.

Ignore the non-settable link flags.

---
  drivers/media/mc/mc-entity.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/mc/mc-entity.c +1 -5
index b29b519237d6..cf72bfb8885c 100644
@@ -1378,7 +1378,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags)
 
  int __media_entity_setup_link(struct media_link *link, u32 flags)
  {
-       const u32 mask = MEDIA_LNK_FL_ENABLED;
+       const u32 settable_flags = MEDIA_LNK_FL_ENABLED;
         struct media_device *mdev;
         struct media_pad *source, *sink;
         int ret = -EBUSY;
@@ -1386,10 +1386,6 @@ int __media_entity_setup_link(struct media_link *link, u32 flags)
         if (link == NULL)
                 return -EINVAL;
 
-       /* The non-modifiable link flags must not be modified. */
-       if ((link->flags & ~mask) != (flags & ~mask))
-               return -EINVAL;
-
         if (link->flags & MEDIA_LNK_FL_IMMUTABLE)
                 return link->flags == flags ? 0 : -EINVAL;
 
@@ -1403,6 +1399,10 @@ int __media_entity_setup_link(struct media_link *link, u32 flags)
             (media_pad_is_streaming(source) || media_pad_is_streaming(sink)))
                 return -EBUSY;
 
Quoted 7 lines

drivers/media/mc/mc-entity.c int __media_entity_setup_link(struct media_link *link, u32 flags) · line 1405

Quoted 4 lines
drivers/media/mc/mc-entity.c +4 -0
+       /* Only allow changing user-settable flags. */
+       flags &= settable_flags;
+       flags |= link->flags & ~settable_flags;
+

The immutable check now compares before filtering, previously this was after the filtering. Is this change intentional?

Indeed; this patch looked different earlier and I forgot to move the condition back to where it was. I'll do that for v3.

Signature · 3 lines
Regards,

Sakari Ailus
author maintainer
#30 lore raw

PATCH v2 9/14 media: Document enable_streams and disable_streams behaviour

In reply to Sakari Ailus

Document that enable_streams may start additional streams and disable_streams may not disable requested streams if other related streams are still enabled.

---
 include/media/v4l2-subdev.h | 7 +++++++
 1 file changed, 7 insertions(+)
include/media/v4l2-subdev.h +7 -0
index a37d9a847196..de2684b15b96 100644
@@ -814,6 +814,10 @@ struct v4l2_subdev_state {
  *	V4L2_SUBDEV_CAP_STREAMS sub-device capability flag can ignore the mask
  *	argument.
  *
+ *	Starting the requested streams may require starting additional
+ *	streams. Streams that are started together due to hardware are called a
+ *	stream group.
+ *
  * @disable_streams: Disable the streams defined in streams_mask on the given
  *	source pad. Subdevs that implement this operation must use the active
  *	state management provided by the subdev core (enabled through a call to
@@ -823,6 +827,9 @@ struct v4l2_subdev_state {
  *	Drivers that support only a single stream without setting the
  *	V4L2_SUBDEV_CAP_STREAMS sub-device capability flag can ignore the mask
  *	argument.
+ *
+ *	A stream group is disabled when one or more streams in the stream
+ *	group are disabled.
  */
 struct v4l2_subdev_pad_ops {
 	int (*enum_mbus_code)(struct v4l2_subdev *sd,
Signature · 1 line
2.47.3
Reviewed-by on v2 9/14
#31 lore raw

Re: [PATCH v2 09/14] media: Document enable_streams and disable_streams behaviour

Hi Sakari,

In the subject, perhaps use improve documentation...as some documentation already exists. Other than that,

Regards,

Mirela

Quoted 38 lines · Sakari Ailus

Document that enable_streams may start additional streams and disable_streams may not disable requested streams if other related streams are still enabled.

---
  include/media/v4l2-subdev.h | 7 +++++++
  1 file changed, 7 insertions(+)
include/media/v4l2-subdev.h +7 -1
index a37d9a847196..de2684b15b96 100644
@@ -814,6 +814,10 @@ struct v4l2_subdev_state {
   *     V4L2_SUBDEV_CAP_STREAMS sub-device capability flag can ignore the mask
   *     argument.
   *
+ *     Starting the requested streams may require starting additional
+ *     streams. Streams that are started together due to hardware are called a
+ *     stream group.
+ *
   * @disable_streams: Disable the streams defined in streams_mask on the given
   *     source pad. Subdevs that implement this operation must use the active
   *     state management provided by the subdev core (enabled through a call to
@@ -823,6 +827,9 @@ struct v4l2_subdev_state {
   *     Drivers that support only a single stream without setting the
   *     V4L2_SUBDEV_CAP_STREAMS sub-device capability flag can ignore the mask
   *     argument.
+ *
+ *     A stream group is disabled when one or more streams in the stream
+ *     group are disabled.
   */
  struct v4l2_subdev_pad_ops {
         int (*enum_mbus_code)(struct v4l2_subdev *sd,
--

2.47.3

author maintainer
#32 lore raw

Re: [PATCH v2 09/14] media: Document enable_streams and disable_streams behaviour

Hi Mirela,

Quoted 6 lines · Mirela Rabulea

Hi Sakari,

In the subject, perhaps use improve documentation...as some documentation already exists. Other than that,

Thanks.

I think this needs to be documented elsewhere, too. Generally there's little documentation on things like this so far.

Signature · 1 line
Sakari Ailus
author maintainer
#33 lore raw

Re: [PATCH v2 09/14] media: Document enable_streams and disable_streams behaviour

In reply to Mirela Rabulea

Hi Mirela,

Quoted 4 lines · Mirela Rabulea

Hi Sakari,

In the subject, perhaps use improve documentation...as some documentation already exists. Other than that,

I'll use "Improve enable_streams and disable_streams documentation".

Quoted 2 lines

Thanks!

Signature · 3 lines
Regards,

Sakari Ailus
author maintainer
#34 lore raw

PATCH v2 10/14 media: v4l2-subdev: Move subdev client capabilities into a new struct

In reply to Sakari Ailus

Add struct v4l2_subdev_client_info to hold sub-device client capability bits that used to be stored in the client_caps field of struct v4l2_subdev_fh. The intent is to enable passing this struct to sub-device pad operation callbacks for capability information. The main reason why this is a new struct instead of a u64 field is that modifying the callback arguments requires touching almost every sub-device driver and that is desirable to avoid in the future, should more than the client capability bits need to be known to the callbacks.

---
 drivers/media/v4l2-core/v4l2-subdev.c |  8 ++++----
 include/media/v4l2-subdev.h           | 12 ++++++++++--
 2 files changed, 14 insertions(+), 6 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +4 -4
index 8a433d074587..79fb4643182a 100644
@@ -611,7 +611,7 @@ subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh,
 	case VIDIOC_SUBDEV_S_FRAME_INTERVAL: {
 		struct v4l2_subdev_frame_interval *fi = arg;
 
-		if (!(subdev_fh->client_caps &
+		if (!(subdev_fh->ci.client_caps &
 		      V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH))
 			fi->which = V4L2_SUBDEV_FORMAT_ACTIVE;
 
@@ -651,7 +651,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 	struct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);
 	bool ro_subdev = test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags);
 	bool streams_subdev = sd->flags & V4L2_SUBDEV_FL_STREAMS;
-	bool client_supports_streams = subdev_fh->client_caps &
+	bool client_supports_streams = subdev_fh->ci.client_caps &
 				       V4L2_SUBDEV_CLIENT_CAP_STREAMS;
 	int rval;
 
@@ -1124,7 +1124,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 	case VIDIOC_SUBDEV_G_CLIENT_CAP: {
 		struct v4l2_subdev_client_capability *client_cap = arg;
 
-		client_cap->capabilities = subdev_fh->client_caps;
+		client_cap->capabilities = subdev_fh->ci.client_caps;
 
 		return 0;
 	}
@@ -1144,7 +1144,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		client_cap->capabilities &= (V4L2_SUBDEV_CLIENT_CAP_STREAMS |
 					     V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH);
 
-		subdev_fh->client_caps = client_cap->capabilities;
+		subdev_fh->ci.client_caps = client_cap->capabilities;
 
 		return 0;
 	}
include/media/v4l2-subdev.h +10 -2
index de2684b15b96..c9fe99ea7841 100644
@@ -734,6 +734,14 @@ struct v4l2_subdev_state {
 	struct v4l2_subdev_stream_configs stream_configs;
 };
 
+/**
+ * struct v4l2_subdev_client_info - Sub-device client information
+ * @client_caps: bitmask of ``V4L2_SUBDEV_CLIENT_CAP_*``
+ */
+struct v4l2_subdev_client_info {
+	u64 client_caps;
+};
+
 /**
  * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
  *
@@ -1129,14 +1137,14 @@ struct v4l2_subdev {
  * @vfh: pointer to &struct v4l2_fh
  * @state: pointer to &struct v4l2_subdev_state
  * @owner: module pointer to the owner of this file handle
- * @client_caps: bitmask of ``V4L2_SUBDEV_CLIENT_CAP_*``
+ * @ci: sub-device client info related to this file handle
  */
 struct v4l2_subdev_fh {
 	struct v4l2_fh vfh;
 	struct module *owner;
 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
 	struct v4l2_subdev_state *state;
-	u64 client_caps;
+	struct v4l2_subdev_client_info ci;
 #endif
 };
 
Signature · 1 line
2.47.3
Reviewed-by on v2 10/14
#35 lore raw

Re: [PATCH v2 10/14] media: v4l2-subdev: Move subdev client capabilities into a new struct

Quoted 10 lines · Sakari Ailus

Add struct v4l2_subdev_client_info to hold sub-device client capability bits that used to be stored in the client_caps field of struct v4l2_subdev_fh. The intent is to enable passing this struct to sub-device pad operation callbacks for capability information. The main reason why this is a new struct instead of a u64 field is that modifying the callback arguments requires touching almost every sub-device driver and that is desirable to avoid in the future, should more than the client capability bits need to be known to the callbacks.

Quoted 84 lines
---
  drivers/media/v4l2-core/v4l2-subdev.c |  8 ++++----
  include/media/v4l2-subdev.h           | 12 ++++++++++--
  2 files changed, 14 insertions(+), 6 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +4 -4
index 8a433d074587..79fb4643182a 100644
@@ -611,7 +611,7 @@ subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh,
         case VIDIOC_SUBDEV_S_FRAME_INTERVAL: {
                 struct v4l2_subdev_frame_interval *fi = arg;
 
-               if (!(subdev_fh->client_caps &
+               if (!(subdev_fh->ci.client_caps &
                       V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH))
                         fi->which = V4L2_SUBDEV_FORMAT_ACTIVE;
 
@@ -651,7 +651,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
         struct v4l2_subdev_fh *subdev_fh = to_v4l2_subdev_fh(vfh);
         bool ro_subdev = test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags);
         bool streams_subdev = sd->flags & V4L2_SUBDEV_FL_STREAMS;
-       bool client_supports_streams = subdev_fh->client_caps &
+       bool client_supports_streams = subdev_fh->ci.client_caps &
                                        V4L2_SUBDEV_CLIENT_CAP_STREAMS;
         int rval;
 
@@ -1124,7 +1124,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
         case VIDIOC_SUBDEV_G_CLIENT_CAP: {
                 struct v4l2_subdev_client_capability *client_cap = arg;
 
-               client_cap->capabilities = subdev_fh->client_caps;
+               client_cap->capabilities = subdev_fh->ci.client_caps;
 
                 return 0;
         }
@@ -1144,7 +1144,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                 client_cap->capabilities &= (V4L2_SUBDEV_CLIENT_CAP_STREAMS |
                                              V4L2_SUBDEV_CLIENT_CAP_INTERVAL_USES_WHICH);
 
-               subdev_fh->client_caps = client_cap->capabilities;
+               subdev_fh->ci.client_caps = client_cap->capabilities;
 
                 return 0;
         }
include/media/v4l2-subdev.h +10 -3
index de2684b15b96..c9fe99ea7841 100644
@@ -734,6 +734,14 @@ struct v4l2_subdev_state {
         struct v4l2_subdev_stream_configs stream_configs;
  };
 
+/**
+ * struct v4l2_subdev_client_info - Sub-device client information
+ * @client_caps: bitmask of ``V4L2_SUBDEV_CLIENT_CAP_*``
+ */
+struct v4l2_subdev_client_info {
+       u64 client_caps;
+};
+
  /**
   * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
   *
@@ -1129,14 +1137,14 @@ struct v4l2_subdev {
   * @vfh: pointer to &struct v4l2_fh
   * @state: pointer to &struct v4l2_subdev_state
   * @owner: module pointer to the owner of this file handle
- * @client_caps: bitmask of ``V4L2_SUBDEV_CLIENT_CAP_*``
+ * @ci: sub-device client info related to this file handle
   */
  struct v4l2_subdev_fh {
         struct v4l2_fh vfh;
         struct module *owner;
  #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
         struct v4l2_subdev_state *state;
-       u64 client_caps;
+       struct v4l2_subdev_client_info ci;
  #endif
  };
 
--

2.47.3

author maintainer
#36 lore raw

PATCH v2 11/14 media: v4l2-subdev: Add struct v4l2_subdev_client_info pointer to pad ops

In reply to Sakari Ailus

Add a pointer to const struct v4l2_subdev_client_info to the get_fmt, set_fmt, get_selection and set_selection sub-device pad ops. The client info struct will soon be used to differentiate UAPI based on client capabilities.

---
 drivers/media/v4l2-core/v4l2-subdev.c | 63 ++++++++++++++++++---------
 include/media/v4l2-subdev.h           |  9 +++-
 2 files changed, 51 insertions(+), 21 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +43 -20
index 79fb4643182a..76ab70a99e86 100644
@@ -245,19 +245,21 @@ static inline int check_format(struct v4l2_subdev *sd,
 }
 
 static int call_get_fmt(struct v4l2_subdev *sd,
+			const struct v4l2_subdev_client_info *ci,
 			struct v4l2_subdev_state *state,
 			struct v4l2_subdev_format *format)
 {
 	return check_format(sd, state, format) ? :
-	       sd->ops->pad->get_fmt(sd, state, format);
+		sd->ops->pad->get_fmt(sd, ci, state, format);
 }
 
 static int call_set_fmt(struct v4l2_subdev *sd,
+			const struct v4l2_subdev_client_info *ci,
 			struct v4l2_subdev_state *state,
 			struct v4l2_subdev_format *format)
 {
 	return check_format(sd, state, format) ? :
-	       sd->ops->pad->set_fmt(sd, state, format);
+		sd->ops->pad->set_fmt(sd, ci, state, format);
 }
 
 static int call_enum_mbus_code(struct v4l2_subdev *sd,
@@ -308,19 +310,21 @@ static inline int check_selection(struct v4l2_subdev *sd,
 }
 
 static int call_get_selection(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *state,
 			      struct v4l2_subdev_selection *sel)
 {
 	return check_selection(sd, state, sel) ? :
-	       sd->ops->pad->get_selection(sd, state, sel);
+		sd->ops->pad->get_selection(sd, ci, state, sel);
 }
 
 static int call_set_selection(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *state,
 			      struct v4l2_subdev_selection *sel)
 {
 	return check_selection(sd, state, sel) ? :
-	       sd->ops->pad->set_selection(sd, state, sel);
+		sd->ops->pad->set_selection(sd, ci, state, sel);
 }
 
 static inline int check_frame_interval(struct v4l2_subdev *sd,
@@ -523,6 +527,21 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
 			v4l2_subdev_unlock_state(state);                   \
 		return ret;                                                \
 	}
+#define DEFINE_STATE_WRAPPER_CI(f, arg_type)                               \
+	static int call_##f##_state(struct v4l2_subdev *sd,		   \
+				    const struct v4l2_subdev_client_info *ci, \
+				    struct v4l2_subdev_state *_state,      \
+				    arg_type *arg) \
+	{                                                                  \
+		struct v4l2_subdev_state *state = _state;                  \
+		int ret;                                                   \
+		if (!_state)                                               \
+			state = v4l2_subdev_lock_and_get_active_state(sd); \
+		ret = call_##f(sd, ci, state, arg);			   \
+		if (!_state && state)                                      \
+			v4l2_subdev_unlock_state(state);                   \
+		return ret;                                                \
+	}
 
 #else /* CONFIG_MEDIA_CONTROLLER */
 
@@ -536,13 +555,13 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
 
 #endif /* CONFIG_MEDIA_CONTROLLER */
 
-DEFINE_STATE_WRAPPER(get_fmt, struct v4l2_subdev_format);
-DEFINE_STATE_WRAPPER(set_fmt, struct v4l2_subdev_format);
+DEFINE_STATE_WRAPPER_CI(get_fmt, struct v4l2_subdev_format);
+DEFINE_STATE_WRAPPER_CI(set_fmt, struct v4l2_subdev_format);
 DEFINE_STATE_WRAPPER(enum_mbus_code, struct v4l2_subdev_mbus_code_enum);
 DEFINE_STATE_WRAPPER(enum_frame_size, struct v4l2_subdev_frame_size_enum);
 DEFINE_STATE_WRAPPER(enum_frame_interval, struct v4l2_subdev_frame_interval_enum);
-DEFINE_STATE_WRAPPER(get_selection, struct v4l2_subdev_selection);
-DEFINE_STATE_WRAPPER(set_selection, struct v4l2_subdev_selection);
+DEFINE_STATE_WRAPPER_CI(get_selection, struct v4l2_subdev_selection);
+DEFINE_STATE_WRAPPER_CI(set_selection, struct v4l2_subdev_selection);
 
 static const struct v4l2_subdev_pad_ops v4l2_subdev_call_pad_wrappers = {
 	.get_fmt		= call_get_fmt_state,
@@ -804,7 +823,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
 		memset(format->reserved, 0, sizeof(format->reserved));
 		memset(format->format.reserved, 0, sizeof(format->format.reserved));
-		return v4l2_subdev_call(sd, pad, get_fmt, state, format);
+		return v4l2_subdev_call(sd, pad, get_fmt, &subdev_fh->ci, state,
+					format);
 	}
 
 	case VIDIOC_SUBDEV_S_FMT: {
@@ -818,7 +838,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
 		memset(format->reserved, 0, sizeof(format->reserved));
 		memset(format->format.reserved, 0, sizeof(format->format.reserved));
-		return v4l2_subdev_call(sd, pad, set_fmt, state, format);
+		return v4l2_subdev_call(sd, pad, set_fmt, &subdev_fh->ci, state,
+					format);
 	}
 
 	case VIDIOC_SUBDEV_G_CROP: {
@@ -835,8 +856,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		sel.stream = crop->stream;
 		sel.target = V4L2_SEL_TGT_CROP;
 
-		rval = v4l2_subdev_call(
-			sd, pad, get_selection, state, &sel);
+		rval = v4l2_subdev_call(sd, pad, get_selection, &subdev_fh->ci,
+					state, &sel);
 
 		crop->rect = sel.r;
 
@@ -861,8 +882,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 		sel.target = V4L2_SEL_TGT_CROP;
 		sel.r = crop->rect;
 
-		rval = v4l2_subdev_call(
-			sd, pad, set_selection, state, &sel);
+		rval = v4l2_subdev_call(sd, pad, set_selection, &subdev_fh->ci,
+					state, &sel);
 
 		crop->rect = sel.r;
 
@@ -932,8 +953,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 			sel->stream = 0;
 
 		memset(sel->reserved, 0, sizeof(sel->reserved));
-		return v4l2_subdev_call(
-			sd, pad, get_selection, state, sel);
+		return v4l2_subdev_call(sd, pad, get_selection, &subdev_fh->ci,
+					state, sel);
 	}
 
 	case VIDIOC_SUBDEV_S_SELECTION: {
@@ -946,8 +967,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 			sel->stream = 0;
 
 		memset(sel->reserved, 0, sizeof(sel->reserved));
-		return v4l2_subdev_call(
-			sd, pad, set_selection, state, sel);
+		return v4l2_subdev_call(sd, pad, set_selection, &subdev_fh->ci,
+					state, sel);
 	}
 
 	case VIDIOC_G_EDID: {
@@ -1348,7 +1369,7 @@ v4l2_subdev_link_validate_get_format(struct media_pad *pad, u32 stream,
 	else
 		state = v4l2_subdev_lock_and_get_active_state(sd);
 
-	ret = v4l2_subdev_call(sd, pad, get_fmt, state, fmt);
+	ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, state, fmt);
 
 	if (!states_locked && state)
 		v4l2_subdev_unlock_state(state);
@@ -1931,7 +1952,9 @@ v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_config
 	return 0;
 }
 
-int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state,
+int v4l2_subdev_get_fmt(struct v4l2_subdev *sd,
+			const struct v4l2_subdev_client_info *ci,
+			struct v4l2_subdev_state *state,
 			struct v4l2_subdev_format *format)
 {
 	struct v4l2_mbus_framefmt *fmt;
include/media/v4l2-subdev.h +8 -1
index c9fe99ea7841..20cf0560c7f9 100644
@@ -850,15 +850,19 @@ struct v4l2_subdev_pad_ops {
 				   struct v4l2_subdev_state *state,
 				   struct v4l2_subdev_frame_interval_enum *fie);
 	int (*get_fmt)(struct v4l2_subdev *sd,
+		       const struct v4l2_subdev_client_info *ci,
 		       struct v4l2_subdev_state *state,
 		       struct v4l2_subdev_format *format);
 	int (*set_fmt)(struct v4l2_subdev *sd,
+		       const struct v4l2_subdev_client_info *ci,
 		       struct v4l2_subdev_state *state,
 		       struct v4l2_subdev_format *format);
 	int (*get_selection)(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_selection *sel);
 	int (*set_selection)(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_selection *sel);
 	int (*get_frame_interval)(struct v4l2_subdev *sd,
@@ -1461,6 +1465,7 @@ __v4l2_subdev_state_get_interval(struct v4l2_subdev_state *state,
  * @sd: subdevice
  * @state: subdevice state
  * @format: pointer to &struct v4l2_subdev_format
+ * @ci: pointer to sub-device client information, including client capabilities
  *
  * Fill @format->format field based on the information in the @format struct.
  *
@@ -1470,7 +1475,9 @@ __v4l2_subdev_state_get_interval(struct v4l2_subdev_state *state,
  *
  * Returns 0 on success, error value otherwise.
  */
-int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state,
+int v4l2_subdev_get_fmt(struct v4l2_subdev *sd,
+			const struct v4l2_subdev_client_info *ci,
+			struct v4l2_subdev_state *state,
 			struct v4l2_subdev_format *format);
 
 /**
Signature · 1 line
2.47.3
#37 lore raw

Re: [PATCH v2 11/14] media: v4l2-subdev: Add struct v4l2_subdev_client_info pointer to pad ops

Hi Sakari,

I get build errors after applying this patch, like:

drivers/media/i2c/imx219.c:1004:20: error: initialization of ‘int (*)(struct v4l2_subdev *, const struct v4l2_subdev_client_info *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)’ from incompatible pointer type ‘int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)’ [-Wincompatible-pointer-types] 1004 |         .set_fmt = imx219_set_pad_format,

I'm not sure if it is fixed later, but after I apply all 14 patches, I still get some build errors (I'm building for ARM64).

See also one other issue below.

Quoted 86 lines · Sakari Ailus

Add a pointer to const struct v4l2_subdev_client_info to the get_fmt, set_fmt, get_selection and set_selection sub-device pad ops. The client info struct will soon be used to differentiate UAPI based on client capabilities.

---
  drivers/media/v4l2-core/v4l2-subdev.c | 63 ++++++++++++++++++---------
  include/media/v4l2-subdev.h           |  9 +++-
  2 files changed, 51 insertions(+), 21 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +23 -4
index 79fb4643182a..76ab70a99e86 100644
@@ -245,19 +245,21 @@ static inline int check_format(struct v4l2_subdev *sd,
  }
 
  static int call_get_fmt(struct v4l2_subdev *sd,
+                       const struct v4l2_subdev_client_info *ci,
                         struct v4l2_subdev_state *state,
                         struct v4l2_subdev_format *format)
  {
         return check_format(sd, state, format) ? :
-              sd->ops->pad->get_fmt(sd, state, format);
+               sd->ops->pad->get_fmt(sd, ci, state, format);
  }
 
  static int call_set_fmt(struct v4l2_subdev *sd,
+                       const struct v4l2_subdev_client_info *ci,
                         struct v4l2_subdev_state *state,
                         struct v4l2_subdev_format *format)
  {
         return check_format(sd, state, format) ? :
-              sd->ops->pad->set_fmt(sd, state, format);
+               sd->ops->pad->set_fmt(sd, ci, state, format);
  }
 
  static int call_enum_mbus_code(struct v4l2_subdev *sd,
@@ -308,19 +310,21 @@ static inline int check_selection(struct v4l2_subdev *sd,
  }
 
  static int call_get_selection(struct v4l2_subdev *sd,
+                             const struct v4l2_subdev_client_info *ci,
                               struct v4l2_subdev_state *state,
                               struct v4l2_subdev_selection *sel)
  {
         return check_selection(sd, state, sel) ? :
-              sd->ops->pad->get_selection(sd, state, sel);
+               sd->ops->pad->get_selection(sd, ci, state, sel);
  }
 
  static int call_set_selection(struct v4l2_subdev *sd,
+                             const struct v4l2_subdev_client_info *ci,
                               struct v4l2_subdev_state *state,
                               struct v4l2_subdev_selection *sel)
  {
         return check_selection(sd, state, sel) ? :
-              sd->ops->pad->set_selection(sd, state, sel);
+               sd->ops->pad->set_selection(sd, ci, state, sel);
  }
 
  static inline int check_frame_interval(struct v4l2_subdev *sd,
@@ -523,6 +527,21 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
                         v4l2_subdev_unlock_state(state);                   \
                 return ret;                                                \
         }
+#define DEFINE_STATE_WRAPPER_CI(f, arg_type)                               \
+       static int call_##f##_state(struct v4l2_subdev *sd,                \
+                                   const struct v4l2_subdev_client_info *ci, \
+                                   struct v4l2_subdev_state *_state,      \
+                                   arg_type *arg) \
+       {                                                                  \
+               struct v4l2_subdev_state *state = _state;                  \
+               int ret;                                                   \
+               if (!_state)                                               \
+                       state = v4l2_subdev_lock_and_get_active_state(sd); \
+               ret = call_##f(sd, ci, state, arg);                        \
+               if (!_state && state)                                      \
+                       v4l2_subdev_unlock_state(state);                   \
+               return ret;                                                \
+       }
 
  #else /* CONFIG_MEDIA_CONTROLLER */
 

drivers/media/v4l2-core/v4l2-subdev.c static int call_s_stream(struct v4l2_subdev *sd, int enable) · line 558

Quoted 6 lines
drivers/media/v4l2-core/v4l2-subdev.c +1 -2
@@ -536,13 +555,13 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
 
  #endif /* CONFIG_MEDIA_CONTROLLER */
 
-DEFINE_STATE_WRAPPER(get_fmt, struct v4l2_subdev_format);
-DEFINE_STATE_WRAPPER(set_fmt, struct v4l2_subdev_format);
+DEFINE_STATE_WRAPPER_CI(get_fmt, struct v4l2_subdev_format);

DEFINE_STATE_WRAPPER_CI is not defined when CONFIG_MEDIA_CONTROLLER is not defined

Regards,

Mirela

Quoted 141 lines
drivers/media/v4l2-core/v4l2-subdev.c +19 -14
+DEFINE_STATE_WRAPPER_CI(set_fmt, struct v4l2_subdev_format);
  DEFINE_STATE_WRAPPER(enum_mbus_code, struct v4l2_subdev_mbus_code_enum);
  DEFINE_STATE_WRAPPER(enum_frame_size, struct v4l2_subdev_frame_size_enum);
  DEFINE_STATE_WRAPPER(enum_frame_interval, struct v4l2_subdev_frame_interval_enum);
-DEFINE_STATE_WRAPPER(get_selection, struct v4l2_subdev_selection);
-DEFINE_STATE_WRAPPER(set_selection, struct v4l2_subdev_selection);
+DEFINE_STATE_WRAPPER_CI(get_selection, struct v4l2_subdev_selection);
+DEFINE_STATE_WRAPPER_CI(set_selection, struct v4l2_subdev_selection);
 
  static const struct v4l2_subdev_pad_ops v4l2_subdev_call_pad_wrappers = {
         .get_fmt                = call_get_fmt_state,
@@ -804,7 +823,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
                 memset(format->reserved, 0, sizeof(format->reserved));
                 memset(format->format.reserved, 0, sizeof(format->format.reserved));
-               return v4l2_subdev_call(sd, pad, get_fmt, state, format);
+               return v4l2_subdev_call(sd, pad, get_fmt, &subdev_fh->ci, state,
+                                       format);
         }
 
         case VIDIOC_SUBDEV_S_FMT: {
@@ -818,7 +838,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
                 memset(format->reserved, 0, sizeof(format->reserved));
                 memset(format->format.reserved, 0, sizeof(format->format.reserved));
-               return v4l2_subdev_call(sd, pad, set_fmt, state, format);
+               return v4l2_subdev_call(sd, pad, set_fmt, &subdev_fh->ci, state,
+                                       format);
         }
 
         case VIDIOC_SUBDEV_G_CROP: {
@@ -835,8 +856,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                 sel.stream = crop->stream;
                 sel.target = V4L2_SEL_TGT_CROP;
 
-               rval = v4l2_subdev_call(
-                       sd, pad, get_selection, state, &sel);
+               rval = v4l2_subdev_call(sd, pad, get_selection, &subdev_fh->ci,
+                                       state, &sel);
 
                 crop->rect = sel.r;
 
@@ -861,8 +882,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                 sel.target = V4L2_SEL_TGT_CROP;
                 sel.r = crop->rect;
 
-               rval = v4l2_subdev_call(
-                       sd, pad, set_selection, state, &sel);
+               rval = v4l2_subdev_call(sd, pad, set_selection, &subdev_fh->ci,
+                                       state, &sel);
 
                 crop->rect = sel.r;
 
@@ -932,8 +953,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                         sel->stream = 0;
 
                 memset(sel->reserved, 0, sizeof(sel->reserved));
-               return v4l2_subdev_call(
-                       sd, pad, get_selection, state, sel);
+               return v4l2_subdev_call(sd, pad, get_selection, &subdev_fh->ci,
+                                       state, sel);
         }
 
         case VIDIOC_SUBDEV_S_SELECTION: {
@@ -946,8 +967,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                         sel->stream = 0;
 
                 memset(sel->reserved, 0, sizeof(sel->reserved));
-               return v4l2_subdev_call(
-                       sd, pad, set_selection, state, sel);
+               return v4l2_subdev_call(sd, pad, set_selection, &subdev_fh->ci,
+                                       state, sel);
         }
 
         case VIDIOC_G_EDID: {
@@ -1348,7 +1369,7 @@ v4l2_subdev_link_validate_get_format(struct media_pad *pad, u32 stream,
         else
                 state = v4l2_subdev_lock_and_get_active_state(sd);
 
-       ret = v4l2_subdev_call(sd, pad, get_fmt, state, fmt);
+       ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, state, fmt);
 
         if (!states_locked && state)
                 v4l2_subdev_unlock_state(state);
@@ -1931,7 +1952,9 @@ v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_config
         return 0;
  }
 
-int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state,
+int v4l2_subdev_get_fmt(struct v4l2_subdev *sd,
+                       const struct v4l2_subdev_client_info *ci,
+                       struct v4l2_subdev_state *state,
                         struct v4l2_subdev_format *format)
  {
         struct v4l2_mbus_framefmt *fmt;
include/media/v4l2-subdev.h +8 -2
index c9fe99ea7841..20cf0560c7f9 100644
@@ -850,15 +850,19 @@ struct v4l2_subdev_pad_ops {
                                    struct v4l2_subdev_state *state,
                                    struct v4l2_subdev_frame_interval_enum *fie);
         int (*get_fmt)(struct v4l2_subdev *sd,
+                      const struct v4l2_subdev_client_info *ci,
                        struct v4l2_subdev_state *state,
                        struct v4l2_subdev_format *format);
         int (*set_fmt)(struct v4l2_subdev *sd,
+                      const struct v4l2_subdev_client_info *ci,
                        struct v4l2_subdev_state *state,
                        struct v4l2_subdev_format *format);
         int (*get_selection)(struct v4l2_subdev *sd,
+                            const struct v4l2_subdev_client_info *ci,
                              struct v4l2_subdev_state *state,
                              struct v4l2_subdev_selection *sel);
         int (*set_selection)(struct v4l2_subdev *sd,
+                            const struct v4l2_subdev_client_info *ci,
                              struct v4l2_subdev_state *state,
                              struct v4l2_subdev_selection *sel);
         int (*get_frame_interval)(struct v4l2_subdev *sd,
@@ -1461,6 +1465,7 @@ __v4l2_subdev_state_get_interval(struct v4l2_subdev_state *state,
   * @sd: subdevice
   * @state: subdevice state
   * @format: pointer to &struct v4l2_subdev_format
+ * @ci: pointer to sub-device client information, including client capabilities
   *
   * Fill @format->format field based on the information in the @format struct.
   *
@@ -1470,7 +1475,9 @@ __v4l2_subdev_state_get_interval(struct v4l2_subdev_state *state,
   *
   * Returns 0 on success, error value otherwise.
   */
-int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state,
+int v4l2_subdev_get_fmt(struct v4l2_subdev *sd,
+                       const struct v4l2_subdev_client_info *ci,
+                       struct v4l2_subdev_state *state,
                         struct v4l2_subdev_format *format);
 
  /**
--

2.47.3

author maintainer
#38 lore raw

Re: [PATCH v2 11/14] media: v4l2-subdev: Add struct v4l2_subdev_client_info pointer to pad ops

Hi Mirela,

Quoted 11 lines · Mirela Rabulea

Hi Sakari,

I get build errors after applying this patch, like:

drivers/media/i2c/imx219.c:1004:20: error: initialization of ‘int (*)(struct v4l2_subdev *, const struct v4l2_subdev_client_info *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)’ from incompatible pointer type ‘int (*)(struct v4l2_subdev *, struct v4l2_subdev_state *, struct v4l2_subdev_format *)’ [-Wincompatible-pointer-types]
 1004 |         .set_fmt = imx219_set_pad_format,

Quoted 2 lines

I'm not sure if it is fixed later, but after I apply all 14 patches, I still get some build errors (I'm building for ARM64).

Yes; I've noticed since posting this version I missed some required changes. I'll address this in v3.

The change here (adding the client info argument) requires merging the last few patches in the set. I've kept the patches separate as there's one generated by Coccinelle entirely.

Quoted 91 lines

See also one other issue below.

Quoted 87 lines · Sakari Ailus

Add a pointer to const struct v4l2_subdev_client_info to the get_fmt, set_fmt, get_selection and set_selection sub-device pad ops. The client info struct will soon be used to differentiate UAPI based on client capabilities.

---
  drivers/media/v4l2-core/v4l2-subdev.c | 63 ++++++++++++++++++---------
  include/media/v4l2-subdev.h           |  9 +++-
  2 files changed, 51 insertions(+), 21 deletions(-)
drivers/media/v4l2-core/v4l2-subdev.c +23 -4
index 79fb4643182a..76ab70a99e86 100644
@@ -245,19 +245,21 @@ static inline int check_format(struct v4l2_subdev *sd,
  }
 
  static int call_get_fmt(struct v4l2_subdev *sd,
+                       const struct v4l2_subdev_client_info *ci,
                         struct v4l2_subdev_state *state,
                         struct v4l2_subdev_format *format)
  {
         return check_format(sd, state, format) ? :
-              sd->ops->pad->get_fmt(sd, state, format);
+               sd->ops->pad->get_fmt(sd, ci, state, format);
  }
 
  static int call_set_fmt(struct v4l2_subdev *sd,
+                       const struct v4l2_subdev_client_info *ci,
                         struct v4l2_subdev_state *state,
                         struct v4l2_subdev_format *format)
  {
         return check_format(sd, state, format) ? :
-              sd->ops->pad->set_fmt(sd, state, format);
+               sd->ops->pad->set_fmt(sd, ci, state, format);
  }
 
  static int call_enum_mbus_code(struct v4l2_subdev *sd,
@@ -308,19 +310,21 @@ static inline int check_selection(struct v4l2_subdev *sd,
  }
 
  static int call_get_selection(struct v4l2_subdev *sd,
+                             const struct v4l2_subdev_client_info *ci,
                               struct v4l2_subdev_state *state,
                               struct v4l2_subdev_selection *sel)
  {
         return check_selection(sd, state, sel) ? :
-              sd->ops->pad->get_selection(sd, state, sel);
+               sd->ops->pad->get_selection(sd, ci, state, sel);
  }
 
  static int call_set_selection(struct v4l2_subdev *sd,
+                             const struct v4l2_subdev_client_info *ci,
                               struct v4l2_subdev_state *state,
                               struct v4l2_subdev_selection *sel)
  {
         return check_selection(sd, state, sel) ? :
-              sd->ops->pad->set_selection(sd, state, sel);
+               sd->ops->pad->set_selection(sd, ci, state, sel);
  }
 
  static inline int check_frame_interval(struct v4l2_subdev *sd,
@@ -523,6 +527,21 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
                         v4l2_subdev_unlock_state(state);                   \
                 return ret;                                                \
         }
+#define DEFINE_STATE_WRAPPER_CI(f, arg_type)                               \
+       static int call_##f##_state(struct v4l2_subdev *sd,                \
+                                   const struct v4l2_subdev_client_info *ci, \
+                                   struct v4l2_subdev_state *_state,      \
+                                   arg_type *arg) \
+       {                                                                  \
+               struct v4l2_subdev_state *state = _state;                  \
+               int ret;                                                   \
+               if (!_state)                                               \
+                       state = v4l2_subdev_lock_and_get_active_state(sd); \
+               ret = call_##f(sd, ci, state, arg);                        \
+               if (!_state && state)                                      \
+                       v4l2_subdev_unlock_state(state);                   \
+               return ret;                                                \
+       }
 
  #else /* CONFIG_MEDIA_CONTROLLER */
 
@@ -536,13 +555,13 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
 
Quoted 8 lines

drivers/media/v4l2-core/v4l2-subdev.c static int call_s_stream(struct v4l2_subdev *sd, int enable) · line 558

Quoted 5 lines
drivers/media/v4l2-core/v4l2-subdev.c +1 -2
  #endif /* CONFIG_MEDIA_CONTROLLER */
 
-DEFINE_STATE_WRAPPER(get_fmt, struct v4l2_subdev_format);
-DEFINE_STATE_WRAPPER(set_fmt, struct v4l2_subdev_format);
+DEFINE_STATE_WRAPPER_CI(get_fmt, struct v4l2_subdev_format);

DEFINE_STATE_WRAPPER_CI is not defined when CONFIG_MEDIA_CONTROLLER is not defined

I'll address that for v3.

Signature · 3 lines
Regards,

Sakari Ailus
author maintainer
#39 lore raw

PATCH v2 12/14 media: v4l2-subdev: Add v4l2_subdev_call_ci_active_state

In reply to Sakari Ailus

Add v4l2_subdev_call_ci_active_state(), to call sub-device pad ops that take struct v4l2_subdev_client_info pointer as an argument.

---
 include/media/v4l2-subdev.h | 49 ++++++++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 11 deletions(-)
include/media/v4l2-subdev.h +38 -11
index 20cf0560c7f9..b22b05534447 100644
@@ -1912,6 +1912,22 @@ extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers;
 		__result;						\
 	})
 
+#define v4l2_subdev_call_waive_fourth(first, second, third, fourth, rest...) \
+	v4l2_subdev_call(first, second, third, ##rest)
+
+#define __v4l2_subdev_call_state_active(call, sd, o, f, args...) \
+	({								\
+		int __result;						\
+		struct v4l2_subdev_state *state;			\
+		state = v4l2_subdev_get_unlocked_active_state(sd);	\
+		if (state)						\
+			v4l2_subdev_lock_state(state);			\
+		__result = call(sd, o, f, NULL, state, ##args);		\
+		if (state)						\
+			v4l2_subdev_unlock_state(state);		\
+		__result;						\
+	})
+
 /**
  * v4l2_subdev_call_state_active - call an operation of a v4l2_subdev which
  *				   takes state as a parameter, passing the
@@ -1930,17 +1946,28 @@ extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers;
  * active state, lock it before calling the op and unlock it after the call.
  */
 #define v4l2_subdev_call_state_active(sd, o, f, args...)		\
-	({								\
-		int __result;						\
-		struct v4l2_subdev_state *state;			\
-		state = v4l2_subdev_get_unlocked_active_state(sd);	\
-		if (state)						\
-			v4l2_subdev_lock_state(state);			\
-		__result = v4l2_subdev_call(sd, o, f, state, ##args);	\
-		if (state)						\
-			v4l2_subdev_unlock_state(state);		\
-		__result;						\
-	})
+	__v4l2_subdev_call_state_active(v4l2_subdev_call_waive_fourth,	\
+					sd, o, f, ##args)
+
+/**
+ * v4l2_subdev_call_ci_state_active - call an operation of a v4l2_subdev which
+ *				      takes state as a parameter, passing the
+ *				      subdev its active state.
+ *
+ * @sd: pointer to the &struct v4l2_subdev
+ * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
+ *     Each element there groups a set of callbacks functions.
+ * @f: callback function to be called.
+ *     The callback functions are defined in groups, according to
+ *     each element at &struct v4l2_subdev_ops.
+ * @args: arguments for @f.
+ *
+ * This macro is just as v4l2_subdev_call_state_active(), with the exception
+ * that it passes NULL as the client info to sub-device ops that need it
+ * (currently pad ops get_fmt, set_fmt, get_selection and set_selection).
+ */
+#define v4l2_subdev_call_ci_state_active(sd, o, f, args...)		\
+	__v4l2_subdev_call_state_active(v4l2_subdev_call, sd, o, f, ##args)
 
 /**
  * v4l2_subdev_call_state_try - call an operation of a v4l2_subdev which
Signature · 1 line
2.47.3
#40 lore raw

Re: [PATCH v2 12/14] media: v4l2-subdev: Add v4l2_subdev_call_ci_active_state

Hi Sakari,

Quoted 13 lines · Sakari Ailus

Add v4l2_subdev_call_ci_active_state(), to call sub-device pad ops that take struct v4l2_subdev_client_info pointer as an argument.

---
  include/media/v4l2-subdev.h | 49 ++++++++++++++++++++++++++++---------
  1 file changed, 38 insertions(+), 11 deletions(-)
include/media/v4l2-subdev.h +0 -0
index 20cf0560c7f9..b22b05534447 100644

include/media/v4l2-subdev.h extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers; · line 1915

Quoted 4 lines
include/media/v4l2-subdev.h +1 -0
@@ -1912,6 +1912,22 @@ extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers;
                 __result;                                               \
         })
 
+#define v4l2_subdev_call_waive_fourth(first, second, third, fourth, rest...) \

waive is not very suggestive, maybe use drop instead?

Regards,

Mirela

Quoted 61 lines
include/media/v4l2-subdev.h +37 -12
+       v4l2_subdev_call(first, second, third, ##rest)
+
+#define __v4l2_subdev_call_state_active(call, sd, o, f, args...) \
+       ({                                                              \
+               int __result;                                           \
+               struct v4l2_subdev_state *state;                        \
+               state = v4l2_subdev_get_unlocked_active_state(sd);      \
+               if (state)                                              \
+                       v4l2_subdev_lock_state(state);                  \
+               __result = call(sd, o, f, NULL, state, ##args);         \
+               if (state)                                              \
+                       v4l2_subdev_unlock_state(state);                \
+               __result;                                               \
+       })
+
  /**
   * v4l2_subdev_call_state_active - call an operation of a v4l2_subdev which
   *                                takes state as a parameter, passing the
@@ -1930,17 +1946,28 @@ extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers;
   * active state, lock it before calling the op and unlock it after the call.
   */
  #define v4l2_subdev_call_state_active(sd, o, f, args...)               \
-       ({                                                              \
-               int __result;                                           \
-               struct v4l2_subdev_state *state;                        \
-               state = v4l2_subdev_get_unlocked_active_state(sd);      \
-               if (state)                                              \
-                       v4l2_subdev_lock_state(state);                  \
-               __result = v4l2_subdev_call(sd, o, f, state, ##args);   \
-               if (state)                                              \
-                       v4l2_subdev_unlock_state(state);                \
-               __result;                                               \
-       })
+       __v4l2_subdev_call_state_active(v4l2_subdev_call_waive_fourth,  \
+                                       sd, o, f, ##args)
+
+/**
+ * v4l2_subdev_call_ci_state_active - call an operation of a v4l2_subdev which
+ *                                   takes state as a parameter, passing the
+ *                                   subdev its active state.
+ *
+ * @sd: pointer to the &struct v4l2_subdev
+ * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
+ *     Each element there groups a set of callbacks functions.
+ * @f: callback function to be called.
+ *     The callback functions are defined in groups, according to
+ *     each element at &struct v4l2_subdev_ops.
+ * @args: arguments for @f.
+ *
+ * This macro is just as v4l2_subdev_call_state_active(), with the exception
+ * that it passes NULL as the client info to sub-device ops that need it
+ * (currently pad ops get_fmt, set_fmt, get_selection and set_selection).
+ */
+#define v4l2_subdev_call_ci_state_active(sd, o, f, args...)            \
+       __v4l2_subdev_call_state_active(v4l2_subdev_call, sd, o, f, ##args)
 
  /**
   * v4l2_subdev_call_state_try - call an operation of a v4l2_subdev which
--

2.47.3

author maintainer
#41 lore raw

Re: [PATCH v2 12/14] media: v4l2-subdev: Add v4l2_subdev_call_ci_active_state

Hi Mirela,

Quoted 19 lines · Mirela Rabulea

Hi Sakari,

Quoted 16 lines · Sakari Ailus

Add v4l2_subdev_call_ci_active_state(), to call sub-device pad ops that take struct v4l2_subdev_client_info pointer as an argument.

---
  include/media/v4l2-subdev.h | 49 ++++++++++++++++++++++++++++---------
  1 file changed, 38 insertions(+), 11 deletions(-)
include/media/v4l2-subdev.h +0 -0
index 20cf0560c7f9..b22b05534447 100644
@@ -1912,6 +1912,22 @@ extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers;
                 __result;                                               \
         })
 
Quoted 3 lines

include/media/v4l2-subdev.h extern const struct v4l2_subdev_ops v4l2_subdev_call_wrappers; · line 1915

Quoted 1 line
include/media/v4l2-subdev.h +1 -0
+#define v4l2_subdev_call_waive_fourth(first, second, third, fourth, rest...) \

waive is not very suggestive, maybe use drop instead?

I'll use that for v3.

Signature · 1 line
Sakari Ailus
author maintainer
#42 lore raw

PATCH v2 13/14 media: v4l2-subdev: Perform client info changes to i2c drivers

In reply to Sakari Ailus

Perform client info argument related changes to two i2c drivers (s5k5baf and tc358743). These changes are not done by Coccinelle scripts in the following patch and will be squashed to the previous patch eventually.

---
 drivers/media/i2c/s5k5baf.c                     | 1 +
 drivers/media/i2c/tc358743.c                    | 2 +-
 drivers/media/pci/intel/ipu6/ipu6-isys-subdev.h | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)
drivers/media/i2c/s5k5baf.c +1 -0
index d1d00eca8708..a580b7e63302 100644
@@ -1463,6 +1463,7 @@ static bool s5k5baf_cmp_rect(const struct v4l2_rect *r1,
 }
 
 static int s5k5baf_set_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/tc358743.c +1 -1
index a0ca19359c43..59f509aa1939 100644
@@ -1822,7 +1822,7 @@ static int tc358743_set_fmt(struct v4l2_subdev *sd,
 	struct tc358743_state *state = to_state(sd);
 
 	u32 code = format->format.code; /* is overwritten by get_fmt */
-	int ret = tc358743_get_fmt(sd, sd_state, format);
+	int ret = tc358743_get_fmt(sd, ci, sd_state, format);
 
 	if (code == MEDIA_BUS_FMT_RGB888_1X24 ||
 	    code == MEDIA_BUS_FMT_UYVY8_1X16)
drivers/media/pci/intel/ipu6/ipu6-isys-subdev.h +1 -0
index 35069099c364..d4f76d513dc6 100644
@@ -31,6 +31,7 @@ bool ipu6_isys_is_bayer_format(u32 code);
 u32 ipu6_isys_convert_bayer_order(u32 code, int x, int y);
 
 int ipu6_isys_subdev_set_fmt(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *fmt);
 int ipu6_isys_subdev_enum_mbus_code(struct v4l2_subdev *sd,
Signature · 1 line
2.47.3
author maintainer
#43 lore raw

PATCH v2 14/14 media: v4l2-subdev: Add struct v4l2_subdev_client_info argument to pad ops

In reply to Sakari Ailus

Add const struct v4l2_subdev_client_info argument to the sub-device pad ops get_fmt, set_fmt, get_selection and set_selection. This patch has been entirely generated using Coccinelle and will be squashed to the previous patch before merging.

---
 drivers/media/i2c/adv7170.c                   |  2 ++
 drivers/media/i2c/adv7175.c                   |  2 ++
 drivers/media/i2c/adv7180.c                   |  4 ++-
 drivers/media/i2c/adv7183.c                   |  4 ++-
 drivers/media/i2c/adv748x/adv748x-afe.c       |  4 ++-
 drivers/media/i2c/adv748x/adv748x-csi2.c      |  3 ++-
 drivers/media/i2c/adv748x/adv748x-hdmi.c      |  4 ++-
 drivers/media/i2c/adv7511-v4l2.c              |  2 ++
 drivers/media/i2c/adv7604.c                   |  3 +++
 drivers/media/i2c/adv7842.c                   |  4 ++-
 drivers/media/i2c/ak881x.c                    |  2 ++
 drivers/media/i2c/alvium-csi2.c               |  3 +++
 drivers/media/i2c/ar0521.c                    |  2 ++
 drivers/media/i2c/ccs/ccs-core.c              | 15 ++++++++---
 drivers/media/i2c/cx25840/cx25840-core.c      |  1 +
 drivers/media/i2c/ds90ub913.c                 |  3 ++-
 drivers/media/i2c/ds90ub953.c                 |  3 ++-
 drivers/media/i2c/ds90ub960.c                 |  3 ++-
 drivers/media/i2c/et8ek8/et8ek8_driver.c      |  2 ++
 drivers/media/i2c/gc0308.c                    |  1 +
 drivers/media/i2c/gc0310.c                    |  1 +
 drivers/media/i2c/gc05a2.c                    |  4 ++-
 drivers/media/i2c/gc08a3.c                    |  4 ++-
 drivers/media/i2c/gc2145.c                    |  2 ++
 drivers/media/i2c/hi556.c                     |  3 +++
 drivers/media/i2c/hi846.c                     |  3 +++
 drivers/media/i2c/hi847.c                     |  2 ++
 drivers/media/i2c/imx111.c                    |  1 +
 drivers/media/i2c/imx208.c                    |  2 ++
 drivers/media/i2c/imx214.c                    |  4 ++-
 drivers/media/i2c/imx219.c                    |  4 ++-
 drivers/media/i2c/imx258.c                    |  3 +++
 drivers/media/i2c/imx274.c                    |  4 +++
 drivers/media/i2c/imx283.c                    |  2 ++
 drivers/media/i2c/imx290.c                    |  4 ++-
 drivers/media/i2c/imx296.c                    |  7 +++--
 drivers/media/i2c/imx319.c                    |  2 ++
 drivers/media/i2c/imx334.c                    |  4 ++-
 drivers/media/i2c/imx335.c                    |  4 ++-
 drivers/media/i2c/imx355.c                    |  2 ++
 drivers/media/i2c/imx412.c                    |  4 ++-
 drivers/media/i2c/imx415.c                    |  4 ++-
 drivers/media/i2c/isl7998x.c                  |  2 ++
 drivers/media/i2c/lt6911uxe.c                 |  5 ++--
 drivers/media/i2c/max9286.c                   |  3 ++-
 drivers/media/i2c/max96714.c                  |  3 ++-
 drivers/media/i2c/max96717.c                  |  3 ++-
 drivers/media/i2c/ml86v7667.c                 |  1 +
 drivers/media/i2c/mt9m001.c                   |  6 ++++-
 drivers/media/i2c/mt9m111.c                   |  4 +++
 drivers/media/i2c/mt9m114.c                   |  6 +++++
 drivers/media/i2c/mt9p031.c                   |  4 +++
 drivers/media/i2c/mt9t112.c                   |  4 +++
 drivers/media/i2c/mt9v011.c                   |  1 +
 drivers/media/i2c/mt9v032.c                   |  4 +++
 drivers/media/i2c/mt9v111.c                   |  2 ++
 drivers/media/i2c/og01a1b.c                   |  2 ++
 drivers/media/i2c/og0ve1b.c                   |  3 ++-
 drivers/media/i2c/os05b10.c                   |  2 ++
 drivers/media/i2c/ov01a10.c                   |  3 +++
 drivers/media/i2c/ov02a10.c                   |  4 ++-
 drivers/media/i2c/ov02c10.c                   |  1 +
 drivers/media/i2c/ov02e10.c                   |  2 ++
 drivers/media/i2c/ov08d10.c                   |  2 ++
 drivers/media/i2c/ov08x40.c                   |  2 ++
 drivers/media/i2c/ov13858.c                   |  2 ++
 drivers/media/i2c/ov13b10.c                   |  2 ++
 drivers/media/i2c/ov2640.c                    |  3 +++
 drivers/media/i2c/ov2659.c                    |  2 ++
 drivers/media/i2c/ov2680.c                    |  4 +++
 drivers/media/i2c/ov2685.c                    |  3 +++
 drivers/media/i2c/ov2735.c                    |  4 ++-
 drivers/media/i2c/ov2740.c                    |  1 +
 drivers/media/i2c/ov4689.c                    |  2 ++
 drivers/media/i2c/ov5640.c                    |  3 +++
 drivers/media/i2c/ov5645.c                    |  4 ++-
 drivers/media/i2c/ov5647.c                    |  3 +++
 drivers/media/i2c/ov5648.c                    |  2 ++
 drivers/media/i2c/ov5670.c                    |  3 +++
 drivers/media/i2c/ov5675.c                    |  3 +++
 drivers/media/i2c/ov5693.c                    |  4 +++
 drivers/media/i2c/ov5695.c                    |  2 ++
 drivers/media/i2c/ov6211.c                    |  3 ++-
 drivers/media/i2c/ov64a40.c                   |  2 ++
 drivers/media/i2c/ov7251.c                    |  5 +++-
 drivers/media/i2c/ov7670.c                    |  2 ++
 drivers/media/i2c/ov772x.c                    |  3 +++
 drivers/media/i2c/ov7740.c                    |  2 ++
 drivers/media/i2c/ov8856.c                    |  2 ++
 drivers/media/i2c/ov8858.c                    |  3 ++-
 drivers/media/i2c/ov8865.c                    |  3 +++
 drivers/media/i2c/ov9282.c                    |  5 +++-
 drivers/media/i2c/ov9640.c                    |  2 ++
 drivers/media/i2c/ov9650.c                    |  2 ++
 drivers/media/i2c/ov9734.c                    |  2 ++
 drivers/media/i2c/rdacm20.c                   |  1 +
 drivers/media/i2c/rdacm21.c                   |  1 +
 drivers/media/i2c/rj54n1cb0c.c                |  4 +++
 drivers/media/i2c/s5c73m3/s5c73m3-core.c      |  4 +++
 drivers/media/i2c/s5k3m5.c                    |  4 ++-
 drivers/media/i2c/s5k5baf.c                   |  3 +++
 drivers/media/i2c/s5k6a3.c                    |  2 ++
 drivers/media/i2c/s5kjn1.c                    |  4 ++-
 drivers/media/i2c/saa6752hs.c                 |  2 ++
 drivers/media/i2c/saa7115.c                   |  1 +
 drivers/media/i2c/saa717x.c                   |  1 +
 drivers/media/i2c/st-mipid02.c                |  1 +
 drivers/media/i2c/tc358743.c                  |  2 ++
 drivers/media/i2c/tc358746.c                  |  3 ++-
 drivers/media/i2c/tda1997x.c                  |  2 ++
 drivers/media/i2c/thp7312.c                   |  1 +
 drivers/media/i2c/tvp514x.c                   |  2 ++
 drivers/media/i2c/tvp5150.c                   |  3 +++
 drivers/media/i2c/tvp7002.c                   |  4 ++-
 drivers/media/i2c/tw9900.c                    |  2 ++
 drivers/media/i2c/tw9910.c                    |  3 +++
 drivers/media/i2c/vd55g1.c                    |  4 ++-
 drivers/media/i2c/vd56g3.c                    |  4 ++-
 drivers/media/i2c/vgxy61.c                    |  5 +++-
 drivers/media/pci/cobalt/cobalt-driver.c      |  8 +++---
 drivers/media/pci/cobalt/cobalt-v4l2.c        | 14 +++++-----
 drivers/media/pci/cx18/cx18-av-core.c         |  1 +
 drivers/media/pci/cx18/cx18-controls.c        |  2 +-
 drivers/media/pci/cx18/cx18-ioctl.c           |  2 +-
 drivers/media/pci/cx23885/cx23885-video.c     |  4 +--
 drivers/media/pci/intel/ipu3/ipu3-cio2.c      |  5 ++--
 drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c |  2 ++
 .../media/pci/intel/ipu6/ipu6-isys-subdev.c   |  3 ++-
 drivers/media/pci/intel/ivsc/mei_csi.c        |  1 +
 drivers/media/pci/ivtv/ivtv-controls.c        |  2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c           |  2 +-
 drivers/media/pci/saa7134/saa7134-empress.c   |  6 ++---
 .../platform/amlogic/c3/isp/c3-isp-capture.c  |  2 +-
 .../platform/amlogic/c3/isp/c3-isp-core.c     |  1 +
 .../platform/amlogic/c3/isp/c3-isp-resizer.c  |  3 +++
 .../amlogic/c3/mipi-adapter/c3-mipi-adap.c    |  3 ++-
 .../amlogic/c3/mipi-csi2/c3-mipi-csi2.c       |  3 ++-
 .../platform/arm/mali-c55/mali-c55-capture.c  |  2 +-
 .../platform/arm/mali-c55/mali-c55-isp.c      |  5 +++-
 .../platform/arm/mali-c55/mali-c55-resizer.c  | 15 ++++++++---
 .../platform/arm/mali-c55/mali-c55-tpg.c      |  1 +
 drivers/media/platform/atmel/atmel-isi.c      |  4 +--
 .../media/platform/broadcom/bcm2835-unicam.c  |  3 ++-
 drivers/media/platform/cadence/cdns-csi2rx.c  |  7 ++---
 drivers/media/platform/cadence/cdns-csi2tx.c  |  7 +++--
 drivers/media/platform/intel/pxa_camera.c     |  6 ++---
 drivers/media/platform/marvell/mcam-core.c    |  4 +--
 .../platform/microchip/microchip-csi2dc.c     |  2 ++
 .../platform/microchip/microchip-isc-base.c   |  1 +
 .../platform/microchip/microchip-isc-scaler.c |  3 +++
 drivers/media/platform/nxp/imx-mipi-csis.c    |  5 ++--
 drivers/media/platform/nxp/imx7-media-csi.c   |  3 ++-
 .../platform/nxp/imx8-isi/imx8-isi-crossbar.c |  3 ++-
 .../platform/nxp/imx8-isi/imx8-isi-pipe.c     |  3 +++
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c |  3 ++-
 .../media/platform/qcom/camss/camss-csid.c    |  4 ++-
 .../media/platform/qcom/camss/camss-csiphy.c  |  4 ++-
 .../media/platform/qcom/camss/camss-ispif.c   |  4 ++-
 drivers/media/platform/qcom/camss/camss-vfe.c | 17 +++++++-----
 .../media/platform/qcom/camss/camss-video.c   |  2 +-
 .../media/platform/raspberrypi/rp1-cfe/csi2.c |  1 +
 .../platform/raspberrypi/rp1-cfe/pisp-fe.c    |  3 ++-
 drivers/media/platform/renesas/rcar-csi2.c    |  3 ++-
 .../media/platform/renesas/rcar-isp/csisp.c   |  3 ++-
 .../platform/renesas/rcar-vin/rcar-v4l2.c     |  2 +-
 drivers/media/platform/renesas/renesas-ceu.c  |  7 ++---
 .../platform/renesas/rzg2l-cru/rzg2l-csi2.c   |  3 ++-
 .../platform/renesas/rzg2l-cru/rzg2l-ip.c     |  3 ++-
 .../platform/renesas/rzg2l-cru/rzg2l-video.c  |  2 +-
 .../renesas/rzv2h-ivc/rzv2h-ivc-subdev.c      |  3 ++-
 .../media/platform/renesas/vsp1/vsp1_brx.c    |  3 +++
 .../media/platform/renesas/vsp1/vsp1_clu.c    |  1 +
 .../media/platform/renesas/vsp1/vsp1_drm.c    | 26 ++++++++++++-------
 .../media/platform/renesas/vsp1/vsp1_entity.c |  4 ++-
 .../media/platform/renesas/vsp1/vsp1_histo.c  |  9 +++++--
 .../media/platform/renesas/vsp1/vsp1_hsit.c   |  1 +
 .../media/platform/renesas/vsp1/vsp1_iif.c    |  1 +
 .../media/platform/renesas/vsp1/vsp1_lif.c    |  1 +
 .../media/platform/renesas/vsp1/vsp1_lut.c    |  1 +
 .../media/platform/renesas/vsp1/vsp1_rwpf.c   |  3 +++
 .../media/platform/renesas/vsp1/vsp1_sru.c    |  1 +
 .../media/platform/renesas/vsp1/vsp1_uds.c    |  1 +
 .../media/platform/renesas/vsp1/vsp1_uif.c    |  3 +++
 .../media/platform/renesas/vsp1/vsp1_video.c  |  2 +-
 .../media/platform/renesas/vsp1/vsp1_vspx.c   |  3 ++-
 .../platform/rockchip/rkcif/rkcif-interface.c |  5 +++-
 .../platform/rockchip/rkisp1/rkisp1-capture.c |  2 +-
 .../platform/rockchip/rkisp1/rkisp1-csi.c     |  3 ++-
 .../platform/rockchip/rkisp1/rkisp1-isp.c     |  3 +++
 .../platform/rockchip/rkisp1/rkisp1-resizer.c |  3 +++
 .../samsung/exynos4-is/fimc-capture.c         | 13 +++++++---
 .../samsung/exynos4-is/fimc-isp-video.c       |  5 ++--
 .../platform/samsung/exynos4-is/fimc-isp.c    |  2 ++
 .../platform/samsung/exynos4-is/fimc-lite.c   |  8 ++++--
 .../platform/samsung/exynos4-is/mipi-csis.c   |  2 ++
 .../samsung/s3c-camif/camif-capture.c         |  7 ++++-
 .../platform/samsung/s3c-camif/camif-core.c   |  4 +--
 drivers/media/platform/st/stm32/stm32-csi.c   |  1 +
 drivers/media/platform/st/stm32/stm32-dcmi.c  |  6 ++---
 .../st/stm32/stm32-dcmipp/dcmipp-bytecap.c    |  3 ++-
 .../st/stm32/stm32-dcmipp/dcmipp-byteproc.c   |  3 +++
 .../st/stm32/stm32-dcmipp/dcmipp-input.c      |  1 +
 .../platform/sunxi/sun4i-csi/sun4i_v4l2.c     |  2 ++
 .../sunxi/sun6i-csi/sun6i_csi_bridge.c        |  2 ++
 .../sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c   |  2 ++
 .../sun8i_a83t_mipi_csi2.c                    |  2 ++
 .../media/platform/ti/am437x/am437x-vpfe.c    |  4 +--
 drivers/media/platform/ti/cal/cal-camerarx.c  |  3 ++-
 drivers/media/platform/ti/cal/cal-video.c     |  6 ++---
 .../media/platform/ti/davinci/vpif_capture.c  |  2 +-
 .../platform/ti/j721e-csi2rx/j721e-csi2rx.c   |  2 +-
 drivers/media/platform/ti/omap3isp/ispccdc.c  |  6 ++++-
 drivers/media/platform/ti/omap3isp/ispccp2.c  |  4 ++-
 drivers/media/platform/ti/omap3isp/ispcsi2.c  |  4 ++-
 .../media/platform/ti/omap3isp/isppreview.c   |  6 ++++-
 .../media/platform/ti/omap3isp/ispresizer.c   |  6 ++++-
 drivers/media/platform/ti/omap3isp/ispvideo.c | 12 ++++-----
 drivers/media/platform/ti/vpe/vip.c           |  7 ++---
 drivers/media/platform/via/via-camera.c       |  4 +--
 drivers/media/platform/video-mux.c            |  1 +
 .../media/platform/xilinx/xilinx-csi2rxss.c   |  2 ++
 drivers/media/platform/xilinx/xilinx-dma.c    |  2 +-
 drivers/media/platform/xilinx/xilinx-tpg.c    |  2 ++
 drivers/media/test-drivers/vimc/vimc-common.c |  2 +-
 .../media/test-drivers/vimc/vimc-debayer.c    |  3 ++-
 drivers/media/test-drivers/vimc/vimc-scaler.c |  3 +++
 drivers/media/test-drivers/vimc/vimc-sensor.c |  1 +
 drivers/media/usb/cx231xx/cx231xx-417.c       |  2 +-
 drivers/media/usb/cx231xx/cx231xx-video.c     |  4 +--
 drivers/media/usb/dvb-usb/cxusb-analog.c      |  6 +++--
 drivers/media/usb/em28xx/em28xx-camera.c      |  2 +-
 drivers/media/usb/go7007/go7007-v4l2.c        |  2 +-
 drivers/media/usb/go7007/s2250-board.c        |  1 +
 drivers/media/usb/pvrusb2/pvrusb2-hdw.c       |  2 +-
 .../media/atomisp/i2c/atomisp-gc2235.c        |  2 ++
 .../media/atomisp/i2c/atomisp-ov2722.c        |  2 ++
 .../staging/media/atomisp/pci/atomisp_cmd.c   | 16 ++++++++----
 .../staging/media/atomisp/pci/atomisp_csi2.c  |  2 ++
 .../media/atomisp/pci/atomisp_subdev.c        |  4 +++
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |  8 +++---
 .../media/deprecated/atmel/atmel-isc-base.c   |  4 +--
 drivers/staging/media/imx/imx-ic-prp.c        |  2 ++
 drivers/staging/media/imx/imx-ic-prpencvf.c   |  2 ++
 drivers/staging/media/imx/imx-media-capture.c | 14 ++++++----
 drivers/staging/media/imx/imx-media-csi.c     |  4 +++
 drivers/staging/media/imx/imx-media-utils.c   |  2 +-
 drivers/staging/media/imx/imx-media-vdic.c    |  2 ++
 drivers/staging/media/imx/imx6-mipi-csi2.c    |  2 ++
 drivers/staging/media/ipu3/ipu3-v4l2.c        |  4 +++
 drivers/staging/media/ipu7/ipu7-isys-csi2.c   |  2 ++
 drivers/staging/media/ipu7/ipu7-isys-subdev.c |  3 ++-
 .../staging/media/starfive/camss/stf-isp.c    | 12 ++++++---
 .../staging/media/starfive/camss/stf-video.c  |  2 +-
 .../media/sunxi/sun6i-isp/sun6i_isp_proc.c    |  2 ++
 drivers/staging/media/tegra-video/csi.c       |  2 ++
 drivers/staging/media/tegra-video/vi.c        | 13 +++++-----
 256 files changed, 688 insertions(+), 212 deletions(-)
drivers/media/i2c/adv7170.c +2 -0
index ef8682b980b4..6ad3dab4c79b 100644
@@ -261,6 +261,7 @@ static int adv7170_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int adv7170_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -284,6 +285,7 @@ static int adv7170_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int adv7170_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/adv7175.c +2 -0
index 384da1ec5bf9..6ef4d53c2781 100644
@@ -299,6 +299,7 @@ static int adv7175_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int adv7175_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -322,6 +323,7 @@ static int adv7175_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int adv7175_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/adv7180.c +3 -1
index 669b0b3165b1..a5e6aa5a77e7 100644
@@ -755,6 +755,7 @@ static int adv7180_set_field_mode(struct adv7180_state *state)
 }
 
 static int adv7180_get_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *format)
 {
@@ -771,6 +772,7 @@ static int adv7180_get_pad_format(struct v4l2_subdev *sd,
 }
 
 static int adv7180_set_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *format)
 {
@@ -808,7 +810,7 @@ static int adv7180_init_state(struct v4l2_subdev *sd,
 		: V4L2_SUBDEV_FORMAT_ACTIVE,
 	};
 
-	return adv7180_set_pad_format(sd, sd_state, &fmt);
+	return adv7180_set_pad_format(sd, NULL, sd_state, &fmt);
 }
 
 static int adv7180_get_mbus_config(struct v4l2_subdev *sd,
drivers/media/i2c/adv7183.c +3 -1
index 25a31a6dd456..7b8afc225b4a 100644
@@ -420,6 +420,7 @@ static int adv7183_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int adv7183_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -446,6 +447,7 @@ static int adv7183_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int adv7183_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -598,7 +600,7 @@ static int adv7183_probe(struct i2c_client *client)
 	adv7183_s_std(sd, decoder->std);
 	fmt.format.width = 720;
 	fmt.format.height = 576;
-	adv7183_set_fmt(sd, NULL, &fmt);
+	adv7183_set_fmt(sd, NULL, NULL, &fmt);
 
 	/* initialize the hardware to the default control values */
 	ret = v4l2_ctrl_handler_setup(hdl);
drivers/media/i2c/adv748x/adv748x-afe.c +3 -1
index 678199196b84..d487cef3a979 100644
@@ -326,6 +326,7 @@ static int adv748x_afe_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int adv748x_afe_get_format(struct v4l2_subdev *sd,
+				      const struct v4l2_subdev_client_info *ci,
 				      struct v4l2_subdev_state *sd_state,
 				      struct v4l2_subdev_format *sdformat)
 {
@@ -349,6 +350,7 @@ static int adv748x_afe_get_format(struct v4l2_subdev *sd,
 }
 
 static int adv748x_afe_set_format(struct v4l2_subdev *sd,
+				      const struct v4l2_subdev_client_info *ci,
 				      struct v4l2_subdev_state *sd_state,
 				      struct v4l2_subdev_format *sdformat)
 {
@@ -359,7 +361,7 @@ static int adv748x_afe_set_format(struct v4l2_subdev *sd,
 		return -EINVAL;
 
 	if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-		return adv748x_afe_get_format(sd, sd_state, sdformat);
+		return adv748x_afe_get_format(sd, NULL, sd_state, sdformat);
 
 	mbusformat = v4l2_subdev_state_get_format(sd_state, sdformat->pad);
 	*mbusformat = sdformat->format;
drivers/media/i2c/adv748x/adv748x-csi2.c +2 -1
index ebe7da8ebed7..aa7515266c3a 100644
@@ -226,6 +226,7 @@ static bool adv748x_csi2_is_fmt_supported(struct adv748x_csi2 *tx, u32 code)
 }
 
 static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
+				   const struct v4l2_subdev_client_info *ci,
 				   struct v4l2_subdev_state *sd_state,
 				   struct v4l2_subdev_format *sdformat)
 {
@@ -233,7 +234,7 @@ static int adv748x_csi2_set_format(struct v4l2_subdev *sd,
 	struct v4l2_mbus_framefmt *mbusformat;
 
 	if (sdformat->pad == ADV748X_CSI2_SOURCE)
-		return v4l2_subdev_get_fmt(sd, sd_state, sdformat);
+		return v4l2_subdev_get_fmt(sd, NULL, sd_state, sdformat);
 
 	/*
 	 * Make sure the format is supported, if not default it to
drivers/media/i2c/adv748x/adv748x-hdmi.c +3 -1
index b154dea29ba2..63819d5d218e 100644
@@ -418,6 +418,7 @@ static int adv748x_hdmi_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int adv748x_hdmi_get_format(struct v4l2_subdev *sd,
+				   const struct v4l2_subdev_client_info *ci,
 				   struct v4l2_subdev_state *sd_state,
 				   struct v4l2_subdev_format *sdformat)
 {
@@ -440,6 +441,7 @@ static int adv748x_hdmi_get_format(struct v4l2_subdev *sd,
 }
 
 static int adv748x_hdmi_set_format(struct v4l2_subdev *sd,
+				   const struct v4l2_subdev_client_info *ci,
 				   struct v4l2_subdev_state *sd_state,
 				   struct v4l2_subdev_format *sdformat)
 {
@@ -449,7 +451,7 @@ static int adv748x_hdmi_set_format(struct v4l2_subdev *sd,
 		return -EINVAL;
 
 	if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE)
-		return adv748x_hdmi_get_format(sd, sd_state, sdformat);
+		return adv748x_hdmi_get_format(sd, NULL, sd_state, sdformat);
 
 	mbusformat = v4l2_subdev_state_get_format(sd_state, sdformat->pad);
 	*mbusformat = sdformat->format;
drivers/media/i2c/adv7511-v4l2.c +2 -0
index 853c7806de92..159d4d93b133 100644
@@ -1241,6 +1241,7 @@ static void adv7511_fill_format(struct adv7511_state *state,
 }
 
 static int adv7511_get_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
@@ -1273,6 +1274,7 @@ static int adv7511_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int adv7511_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
drivers/media/i2c/adv7604.c +3 -0
index 67116a4ef134..94a874f2fed4 100644
@@ -1920,6 +1920,7 @@ static void adv76xx_setup_format(struct adv76xx_state *state)
 }
 
 static int adv76xx_get_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -1943,6 +1944,7 @@ static int adv76xx_get_format(struct v4l2_subdev *sd,
 }
 
 static int adv76xx_get_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -1963,6 +1965,7 @@ static int adv76xx_get_selection(struct v4l2_subdev *sd,
 }
 
 static int adv76xx_set_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
drivers/media/i2c/adv7842.c +3 -1
index ea6966c0605e..1c0755c79b3e 100644
@@ -2072,6 +2072,7 @@ static void adv7842_setup_format(struct adv7842_state *state)
 }
 
 static int adv7842_get_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -2110,6 +2111,7 @@ static int adv7842_get_format(struct v4l2_subdev *sd,
 }
 
 static int adv7842_set_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -2120,7 +2122,7 @@ static int adv7842_set_format(struct v4l2_subdev *sd,
 		return -EINVAL;
 
 	if (state->mode == ADV7842_MODE_SDP)
-		return adv7842_get_format(sd, sd_state, format);
+		return adv7842_get_format(sd, NULL, sd_state, format);
 
 	info = adv7842_format_info(state, format->format.code);
 	if (info == NULL)
drivers/media/i2c/ak881x.c +2 -0
index ee575d01a676..7d96b0cdec36 100644
@@ -91,6 +91,7 @@ static int ak881x_s_register(struct v4l2_subdev *sd,
 #endif
 
 static int ak881x_fill_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -122,6 +123,7 @@ static int ak881x_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int ak881x_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/alvium-csi2.c +3 -0
index 1f088acecf36..a213f92f4af0 100644
@@ -1887,6 +1887,7 @@ static int alvium_init_state(struct v4l2_subdev *sd,
 }
 
 static int alvium_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -1922,6 +1923,7 @@ static int alvium_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int alvium_set_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1957,6 +1959,7 @@ static int alvium_set_selection(struct v4l2_subdev *sd,
 }
 
 static int alvium_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ar0521.c +2 -0
index f156058500e3..8e23467cf26b 100644
@@ -437,6 +437,7 @@ static void ar0521_adj_fmt(struct v4l2_mbus_framefmt *fmt)
 }
 
 static int ar0521_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -457,6 +458,7 @@ static int ar0521_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int ar0521_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
drivers/media/i2c/ccs/ccs-core.c +11 -4
index 9c7f340ca9a1..aa3bf7d6efc5 100644
@@ -2146,6 +2146,7 @@ static u32 ccs_get_mbus_code(struct v4l2_subdev *subdev, unsigned int pad)
 }
 
 static int ccs_get_format(struct v4l2_subdev *subdev,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -2187,6 +2188,7 @@ static void ccs_propagate(struct v4l2_subdev *subdev,
 }
 
 static int ccs_set_format_source(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -2198,7 +2200,7 @@ static int ccs_set_format_source(struct v4l2_subdev *subdev,
 	unsigned int i;
 	int rval;
 
-	rval = ccs_get_format(subdev, sd_state, fmt);
+	rval = ccs_get_format(subdev, NULL, sd_state, fmt);
 	if (rval)
 		return rval;
 
@@ -2240,6 +2242,7 @@ static int ccs_set_format_source(struct v4l2_subdev *subdev,
 }
 
 static int ccs_set_format(struct v4l2_subdev *subdev,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -2250,7 +2253,7 @@ static int ccs_set_format(struct v4l2_subdev *subdev,
 	if (fmt->pad == ssd->source_pad) {
 		int rval;
 
-		rval = ccs_set_format_source(subdev, sd_state, fmt);
+		rval = ccs_set_format_source(subdev, NULL, sd_state, fmt);
 
 		return rval;
 	}
@@ -2465,6 +2468,7 @@ static void ccs_set_compose_scaler(struct v4l2_subdev *subdev,
 }
 /* We're only called on source pads. This function sets scaling. */
 static int ccs_set_compose(struct v4l2_subdev *subdev,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_selection *sel)
 {
@@ -2534,6 +2538,7 @@ static int ccs_sel_supported(struct v4l2_subdev *subdev,
 }
 
 static int ccs_set_crop(struct v4l2_subdev *subdev,
+			const struct v4l2_subdev_client_info *ci,
 			struct v4l2_subdev_state *sd_state,
 			struct v4l2_subdev_selection *sel)
 {
@@ -2585,6 +2590,7 @@ static void ccs_get_native_size(struct ccs_subdev *ssd, struct v4l2_rect *r)
 }
 
 static int ccs_get_selection(struct v4l2_subdev *subdev,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_selection *sel)
 {
@@ -2631,6 +2637,7 @@ static int ccs_get_selection(struct v4l2_subdev *subdev,
 }
 
 static int ccs_set_selection(struct v4l2_subdev *subdev,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_selection *sel)
 {
@@ -2653,10 +2660,10 @@ static int ccs_set_selection(struct v4l2_subdev *subdev,
 
 	switch (sel->target) {
 	case V4L2_SEL_TGT_CROP:
-		ret = ccs_set_crop(subdev, sd_state, sel);
+		ret = ccs_set_crop(subdev, NULL, sd_state, sel);
 		break;
 	case V4L2_SEL_TGT_COMPOSE:
-		ret = ccs_set_compose(subdev, sd_state, sel);
+		ret = ccs_set_compose(subdev, NULL, sd_state, sel);
 		break;
 	default:
 		ret = -EINVAL;
drivers/media/i2c/cx25840/cx25840-core.c +1 -0
index a86306304330..b880f346dfb2 100644
@@ -1746,6 +1746,7 @@ static int cx25840_s_ctrl(struct v4l2_ctrl *ctrl)
 /* ----------------------------------------------------------------------- */
 
 static int cx25840_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
drivers/media/i2c/ds90ub913.c +2 -1
index e97e499b04e6..6f6e963e1d03 100644
@@ -430,6 +430,7 @@ static int ub913_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
 }
 
 static int ub913_set_fmt(struct v4l2_subdev *sd,
+			 const struct v4l2_subdev_client_info *ci,
 			 struct v4l2_subdev_state *state,
 			 struct v4l2_subdev_format *format)
 {
@@ -443,7 +444,7 @@ static int ub913_set_fmt(struct v4l2_subdev *sd,
 
 	/* Source format is fully defined by the sink format, so not settable */
 	if (format->pad == UB913_PAD_SOURCE)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	finfo = ub913_find_format(format->format.code);
 	if (!finfo) {
drivers/media/i2c/ds90ub953.c +2 -1
index daefdb108fbf..cbb1cb2837f8 100644
@@ -485,6 +485,7 @@ static int ub953_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
 }
 
 static int ub953_set_fmt(struct v4l2_subdev *sd,
+			 const struct v4l2_subdev_client_info *ci,
 			 struct v4l2_subdev_state *state,
 			 struct v4l2_subdev_format *format)
 {
@@ -497,7 +498,7 @@ static int ub953_set_fmt(struct v4l2_subdev *sd,
 
 	/* No transcoding, source and sink formats must match. */
 	if (format->pad == UB953_PAD_SOURCE)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	/* Set sink format */
 	fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream);
drivers/media/i2c/ds90ub960.c +2 -1
index 3156f6d6c6de..e0564f0a2a10 100644
@@ -3985,6 +3985,7 @@ static int ub960_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
 }
 
 static int ub960_set_fmt(struct v4l2_subdev *sd,
+			 const struct v4l2_subdev_client_info *ci,
 			 struct v4l2_subdev_state *state,
 			 struct v4l2_subdev_format *format)
 {
@@ -3996,7 +3997,7 @@ static int ub960_set_fmt(struct v4l2_subdev *sd,
 
 	/* No transcoding, source and sink formats must match. */
 	if (ub960_pad_is_source(priv, format->pad))
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	/*
 	 * Default to the first format if the requested media bus code isn't
drivers/media/i2c/et8ek8/et8ek8_driver.c +2 -0
index 50121c3e5b48..915bd60f3ac4 100644
@@ -996,6 +996,7 @@ __et8ek8_get_pad_format(struct et8ek8_sensor *sensor,
 }
 
 static int et8ek8_get_pad_format(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -1013,6 +1014,7 @@ static int et8ek8_get_pad_format(struct v4l2_subdev *subdev,
 }
 
 static int et8ek8_set_pad_format(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/gc0308.c +1 -0
index cbcda0e18ff1..064766b6f627 100644
@@ -1044,6 +1044,7 @@ static void gc0308_update_pad_format(const struct gc0308_frame_size *mode,
 }
 
 static int gc0308_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/gc0310.c +1 -0
index 7af4d66f42a0..741ec64a2d68 100644
@@ -362,6 +362,7 @@ static void gc0310_fill_format(struct v4l2_mbus_framefmt *fmt)
 }
 
 static int gc0310_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/gc05a2.c +3 -1
index 8ba17f80fffe..e2cae5f3f77e 100644
@@ -731,6 +731,7 @@ static void gc05a2_update_pad_format(struct gc05a2 *gc08a3,
 }
 
 static int gc05a2_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -762,6 +763,7 @@ static int gc05a2_set_format(struct v4l2_subdev *sd,
 }
 
 static int gc05a2_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -796,7 +798,7 @@ static int gc05a2_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	gc05a2_set_format(sd, state, &fmt);
+	gc05a2_set_format(sd, NULL, state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/gc08a3.c +3 -1
index 11fd936db9c3..ce80976e3a2a 100644
@@ -706,6 +706,7 @@ static void gc08a3_update_pad_format(struct gc08a3 *gc08a3,
 }
 
 static int gc08a3_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -738,6 +739,7 @@ static int gc08a3_set_format(struct v4l2_subdev *sd,
 }
 
 static int gc08a3_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -772,7 +774,7 @@ static int gc08a3_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	gc08a3_set_format(sd, state, &fmt);
+	gc08a3_set_format(sd, NULL, state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/gc2145.c +2 -0
index b215963a2648..661a59641f19 100644
@@ -709,6 +709,7 @@ static int gc2145_init_state(struct v4l2_subdev *sd,
 }
 
 static int gc2145_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -774,6 +775,7 @@ static int gc2145_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int gc2145_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/hi556.c +3 -0
index de573cee4451..58d912db4f2f 100644
@@ -960,6 +960,7 @@ __hi556_get_pad_crop(struct hi556 *hi556,
 }
 
 static int hi556_get_selection(struct v4l2_subdev *sd,
+			       const struct v4l2_subdev_client_info *ci,
 			       struct v4l2_subdev_state *sd_state,
 			       struct v4l2_subdev_selection *sel)
 {
@@ -1071,6 +1072,7 @@ static int hi556_set_stream(struct v4l2_subdev *sd, int enable)
 }
 
 static int hi556_set_format(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *fmt)
 {
@@ -1113,6 +1115,7 @@ static int hi556_set_format(struct v4l2_subdev *sd,
 }
 
 static int hi556_get_format(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/hi846.c +3 -0
index a3f77b8434ca..802c79ac5f93 100644
@@ -1688,6 +1688,7 @@ static int __maybe_unused hi846_resume(struct device *dev)
 }
 
 static int hi846_set_format(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *format)
 {
@@ -1775,6 +1776,7 @@ static int hi846_set_format(struct v4l2_subdev *sd,
 }
 
 static int hi846_get_format(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *format)
 {
@@ -1840,6 +1842,7 @@ static int hi846_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int hi846_get_selection(struct v4l2_subdev *sd,
+			       const struct v4l2_subdev_client_info *ci,
 			       struct v4l2_subdev_state *sd_state,
 			       struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/hi847.c +2 -0
index def01aa07b2f..6ddb5cf9b6ba 100644
@@ -2639,6 +2639,7 @@ static int hi847_set_stream(struct v4l2_subdev *sd, int enable)
 }
 
 static int hi847_set_format(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *fmt)
 {
@@ -2682,6 +2683,7 @@ static int hi847_set_format(struct v4l2_subdev *sd,
 }
 
 static int hi847_get_format(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/imx111.c +1 -0
index 8eb919788ef7..5b860fa052b1 100644
@@ -1122,6 +1122,7 @@ static int imx111_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int imx111_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *format)
 {
drivers/media/i2c/imx208.c +2 -0
index d5350bb46f14..16407ff86f53 100644
@@ -560,6 +560,7 @@ static int __imx208_get_pad_format(struct imx208 *imx208,
 }
 
 static int imx208_get_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -574,6 +575,7 @@ static int imx208_get_pad_format(struct v4l2_subdev *sd,
 }
 
 static int imx208_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/imx214.c +3 -1
index d4945b192776..96833f2bf287 100644
@@ -662,6 +662,7 @@ static const struct v4l2_subdev_core_ops imx214_core_ops = {
 };
 
 static int imx214_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *format)
 {
@@ -717,6 +718,7 @@ static int imx214_set_format(struct v4l2_subdev *sd,
 }
 
 static int imx214_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -754,7 +756,7 @@ static int imx214_entity_init_state(struct v4l2_subdev *subdev,
 	fmt.format.width = imx214_modes[0].width;
 	fmt.format.height = imx214_modes[0].height;
 
-	imx214_set_format(subdev, sd_state, &fmt);
+	imx214_set_format(subdev, NULL, sd_state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/imx219.c +3 -1
index 54622c406a03..d8c8e954ffa8 100644
@@ -829,6 +829,7 @@ static int imx219_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int imx219_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -949,6 +950,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
 }
 
 static int imx219_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -991,7 +993,7 @@ static int imx219_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	return imx219_set_pad_format(sd, state, &fmt);
+	return imx219_set_pad_format(sd, NULL, state, &fmt);
 }
 
 static const struct v4l2_subdev_video_ops imx219_video_ops = {
drivers/media/i2c/imx258.c +3 -0
index e50dcfd830f5..dc95bc28abe5 100644
@@ -887,6 +887,7 @@ static int __imx258_get_pad_format(struct imx258 *imx258,
 }
 
 static int imx258_get_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -901,6 +902,7 @@ static int imx258_get_pad_format(struct v4l2_subdev *sd,
 }
 
 static int imx258_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -976,6 +978,7 @@ __imx258_get_pad_crop(struct imx258 *imx258,
 }
 
 static int imx258_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/imx274.c +4 -0
index 8ec78b60bea6..cac24387eb27 100644
@@ -1070,6 +1070,7 @@ static int __imx274_change_compose(struct stimx274 *imx274,
  * Return: 0 on success
  */
 static int imx274_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -1092,6 +1093,7 @@ static int imx274_get_fmt(struct v4l2_subdev *sd,
  * Return: 0 on success
  */
 static int imx274_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -1125,6 +1127,7 @@ static int imx274_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int imx274_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1241,6 +1244,7 @@ static int imx274_set_selection_crop(struct stimx274 *imx274,
 }
 
 static int imx274_set_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/imx283.c +2 -0
index 8ab63ad8f385..b122c1967846 100644
@@ -953,6 +953,7 @@ static void imx283_set_framing_limits(struct imx283 *imx283,
 }
 
 static int imx283_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -1246,6 +1247,7 @@ static int imx283_identify_module(struct imx283 *imx283)
 }
 
 static int imx283_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/imx290.c +3 -1
index 21cbc81cb2ed..d562a9aa455c 100644
@@ -1149,6 +1149,7 @@ static int imx290_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int imx290_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -1187,6 +1188,7 @@ static int imx290_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int imx290_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1246,7 +1248,7 @@ static int imx290_entity_init_state(struct v4l2_subdev *subdev,
 		},
 	};
 
-	imx290_set_fmt(subdev, sd_state, &fmt);
+	imx290_set_fmt(subdev, NULL, sd_state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/imx296.c +5 -2
index 69636db11a2b..74bb295799fd 100644
@@ -675,6 +675,7 @@ static int imx296_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int imx296_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -726,6 +727,7 @@ static int imx296_set_format(struct v4l2_subdev *sd,
 }
 
 static int imx296_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -751,6 +753,7 @@ static int imx296_get_selection(struct v4l2_subdev *sd,
 }
 
 static int imx296_set_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -812,8 +815,8 @@ static int imx296_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	imx296_set_selection(sd, state, &sel);
-	imx296_set_format(sd, state, &format);
+	imx296_set_selection(sd, NULL, state, &sel);
+	imx296_set_format(sd, NULL, state, &format);
 
 	return 0;
 }
drivers/media/i2c/imx319.c +2 -0
index 953310ef3046..097e29544d01 100644
@@ -2015,6 +2015,7 @@ static int imx319_do_get_pad_format(struct imx319 *imx319,
 }
 
 static int imx319_get_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -2030,6 +2031,7 @@ static int imx319_get_pad_format(struct v4l2_subdev *sd,
 
 static int
 imx319_set_pad_format(struct v4l2_subdev *sd,
+		      const struct v4l2_subdev_client_info *ci,
 		      struct v4l2_subdev_state *sd_state,
 		      struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/imx334.c +3 -1
index 9654f9268056..a67994e412e4 100644
@@ -758,6 +758,7 @@ static void imx334_fill_pad_format(struct imx334 *imx334,
  * Return: 0 if successful, error code otherwise.
  */
 static int imx334_get_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -785,6 +786,7 @@ static int imx334_get_pad_format(struct v4l2_subdev *sd,
  * Return: 0 if successful, error code otherwise.
  */
 static int imx334_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -837,7 +839,7 @@ static int imx334_init_state(struct v4l2_subdev *sd,
 				 ~(imx334->link_freq_bitmap),
 				 __ffs(imx334->link_freq_bitmap));
 
-	return imx334_set_pad_format(sd, sd_state, &fmt);
+	return imx334_set_pad_format(sd, NULL, sd_state, &fmt);
 }
 
 static int imx334_set_framefmt(struct imx334 *imx334)
drivers/media/i2c/imx335.c +3 -1
index 5790aa4fabeb..691750530976 100644
@@ -880,6 +880,7 @@ static void imx335_fill_pad_format(struct imx335 *imx335,
  * Return: 0 if successful, error code otherwise.
  */
 static int imx335_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -944,7 +945,7 @@ static int imx335_init_state(struct v4l2_subdev *sd,
 				 ~(imx335->link_freq_bitmap),
 				 __ffs(imx335->link_freq_bitmap));
 
-	return imx335_set_pad_format(sd, sd_state, &fmt);
+	return imx335_set_pad_format(sd, NULL, sd_state, &fmt);
 }
 
 /**
@@ -956,6 +957,7 @@ static int imx335_init_state(struct v4l2_subdev *sd,
  * Return: 0 if successful, error code otherwise.
  */
 static int imx335_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/imx355.c +2 -0
index 776107efe386..11a0b8749983 100644
@@ -1314,6 +1314,7 @@ static int imx355_do_get_pad_format(struct imx355 *imx355,
 }
 
 static int imx355_get_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -1329,6 +1330,7 @@ static int imx355_get_pad_format(struct v4l2_subdev *sd,
 
 static int
 imx355_set_pad_format(struct v4l2_subdev *sd,
+		      const struct v4l2_subdev_client_info *ci,
 		      struct v4l2_subdev_state *sd_state,
 		      struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/imx412.c +3 -1
index b3826f803547..68bccafbde06 100644
@@ -710,6 +710,7 @@ static void imx412_fill_pad_format(struct imx412 *imx412,
  * Return: 0 if successful, error code otherwise.
  */
 static int imx412_get_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -740,6 +741,7 @@ static int imx412_get_pad_format(struct v4l2_subdev *sd,
  * Return: 0 if successful, error code otherwise.
  */
 static int imx412_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -784,7 +786,7 @@ static int imx412_init_state(struct v4l2_subdev *sd,
 	fmt.which = sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
 	imx412_fill_pad_format(imx412, &supported_mode, &fmt);
 
-	return imx412_set_pad_format(sd, sd_state, &fmt);
+	return imx412_set_pad_format(sd, NULL, sd_state, &fmt);
 }
 
 /**
drivers/media/i2c/imx415.c +3 -1
index 0b424c17e880..f70c36e45a25 100644
@@ -1021,6 +1021,7 @@ static int imx415_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int imx415_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -1042,6 +1043,7 @@ static int imx415_set_format(struct v4l2_subdev *sd,
 }
 
 static int imx415_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1070,7 +1072,7 @@ static int imx415_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	imx415_set_format(sd, state, &format);
+	imx415_set_format(sd, NULL, state, &format);
 
 	return 0;
 }
drivers/media/i2c/isl7998x.c +2 -0
index 5ffd53e005ee..356fc020cb45 100644
@@ -997,6 +997,7 @@ static int isl7998x_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int isl7998x_get_fmt(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *format)
 {
@@ -1027,6 +1028,7 @@ static int isl7998x_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int isl7998x_set_fmt(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *format)
 {
drivers/media/i2c/lt6911uxe.c +3 -2
index bdefdd157e69..c9da174dbfa6 100644
@@ -384,6 +384,7 @@ static int lt6911uxe_disable_streams(struct v4l2_subdev *sd,
 }
 
 static int lt6911uxe_set_format(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_format *fmt)
 {
@@ -439,7 +440,7 @@ static int lt6911uxe_init_state(struct v4l2_subdev *sd,
 		: V4L2_SUBDEV_FORMAT_ACTIVE,
 	};
 
-	return lt6911uxe_set_format(sd, sd_state, &fmt);
+	return lt6911uxe_set_format(sd, NULL, sd_state, &fmt);
 }
 
 static const struct v4l2_subdev_video_ops lt6911uxe_video_ops = {
@@ -562,7 +563,7 @@ static irqreturn_t lt6911uxe_threaded_irq_fn(int irq, void *dev_id)
 	 * As a HDMI to CSI2 bridge, it needs to update the format in time
 	 * when the HDMI source changes.
 	 */
-	lt6911uxe_set_format(sd, state, &fmt);
+	lt6911uxe_set_format(sd, NULL, state, &fmt);
 	v4l2_subdev_unlock_state(state);
 
 	return IRQ_HANDLED;
drivers/media/i2c/max9286.c +2 -1
index e6e214f8294b..fd48907a9d2b 100644
@@ -910,6 +910,7 @@ static int max9286_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int max9286_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *state,
 			   struct v4l2_subdev_format *format)
 {
@@ -922,7 +923,7 @@ static int max9286_set_fmt(struct v4l2_subdev *sd,
 	 * from the sinks.
 	 */
 	if (format->pad == MAX9286_SRC_PAD)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	/* Validate the format. */
 	for (i = 0; i < ARRAY_SIZE(max9286_formats); ++i) {
drivers/media/i2c/max96714.c +2 -1
index e3e625e6f11a..e64d327fee21 100644
@@ -327,6 +327,7 @@ static int max96714_disable_streams(struct v4l2_subdev *sd,
 }
 
 static int max96714_set_fmt(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *state,
 			    struct v4l2_subdev_format *format)
 {
@@ -339,7 +340,7 @@ static int max96714_set_fmt(struct v4l2_subdev *sd,
 
 	/* No transcoding, source and sink formats must match. */
 	if (format->pad == MAX96714_PAD_SOURCE)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream);
 	if (!fmt)
drivers/media/i2c/max96717.c +2 -1
index 72f021b1a7b9..58bb2bf341db 100644
@@ -414,6 +414,7 @@ static int max96717_set_routing(struct v4l2_subdev *sd,
 }
 
 static int max96717_set_fmt(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *state,
 			    struct v4l2_subdev_format *format)
 {
@@ -427,7 +428,7 @@ static int max96717_set_fmt(struct v4l2_subdev *sd,
 
 	/* No transcoding, source and sink formats must match. */
 	if (format->pad == MAX96717_PAD_SOURCE)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	/* Set sink format */
 	fmt = v4l2_subdev_state_get_format(state, format->pad, format->stream);
drivers/media/i2c/ml86v7667.c +1 -0
index 57ba3693649a..0db1e8114751 100644
@@ -200,6 +200,7 @@ static int ml86v7667_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int ml86v7667_fill_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/mt9m001.c +5 -1
index 7a6114d18dfc..139154957571 100644
@@ -248,6 +248,7 @@ static int mt9m001_s_stream(struct v4l2_subdev *sd, int enable)
 }
 
 static int mt9m001_set_selection(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_selection *sel)
 {
@@ -289,6 +290,7 @@ static int mt9m001_set_selection(struct v4l2_subdev *sd,
 }
 
 static int mt9m001_get_selection(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_selection *sel)
 {
@@ -314,6 +316,7 @@ static int mt9m001_get_selection(struct v4l2_subdev *sd,
 }
 
 static int mt9m001_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -359,7 +362,7 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd,
 	int ret;
 
 	/* No support for scaling so far, just crop. TODO: use skipping */
-	ret = mt9m001_set_selection(sd, NULL, &sel);
+	ret = mt9m001_set_selection(sd, NULL, NULL, &sel);
 	if (!ret) {
 		mf->width	= mt9m001->rect.width;
 		mf->height	= mt9m001->rect.height;
@@ -371,6 +374,7 @@ static int mt9m001_s_fmt(struct v4l2_subdev *sd,
 }
 
 static int mt9m001_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/mt9m111.c +4 -0
index 3532c7c38bec..ac4461b465cf 100644
@@ -446,6 +446,7 @@ static int mt9m111_reset(struct mt9m111 *mt9m111)
 }
 
 static int mt9m111_set_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -490,6 +491,7 @@ static int mt9m111_set_selection(struct v4l2_subdev *sd,
 }
 
 static int mt9m111_get_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -515,6 +517,7 @@ static int mt9m111_get_selection(struct v4l2_subdev *sd,
 }
 
 static int mt9m111_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -617,6 +620,7 @@ static int mt9m111_set_pixfmt(struct mt9m111 *mt9m111,
 }
 
 static int mt9m111_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/mt9m114.c +6 -0
index 16b0ace15813..36ccee403117 100644
@@ -1249,6 +1249,7 @@ static int mt9m114_pa_enum_framesizes(struct v4l2_subdev *sd,
 }
 
 static int mt9m114_pa_set_fmt(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *state,
 			      struct v4l2_subdev_format *fmt)
 {
@@ -1276,6 +1277,7 @@ static int mt9m114_pa_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int mt9m114_pa_get_selection(struct v4l2_subdev *sd,
+				    const struct v4l2_subdev_client_info *ci,
 				    struct v4l2_subdev_state *state,
 				    struct v4l2_subdev_selection *sel)
 {
@@ -1299,6 +1301,7 @@ static int mt9m114_pa_get_selection(struct v4l2_subdev *sd,
 }
 
 static int mt9m114_pa_set_selection(struct v4l2_subdev *sd,
+				    const struct v4l2_subdev_client_info *ci,
 				    struct v4l2_subdev_state *state,
 				    struct v4l2_subdev_selection *sel)
 {
@@ -1872,6 +1875,7 @@ static void mt9m114_ifp_update_sel_and_src_fmt(struct v4l2_subdev_state *state)
 }
 
 static int mt9m114_ifp_set_fmt(struct v4l2_subdev *sd,
+			       const struct v4l2_subdev_client_info *ci,
 			       struct v4l2_subdev_state *state,
 			       struct v4l2_subdev_format *fmt)
 {
@@ -1918,6 +1922,7 @@ static int mt9m114_ifp_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int mt9m114_ifp_get_selection(struct v4l2_subdev *sd,
+				     const struct v4l2_subdev_client_info *ci,
 				     struct v4l2_subdev_state *state,
 				     struct v4l2_subdev_selection *sel)
 {
@@ -1977,6 +1982,7 @@ static int mt9m114_ifp_get_selection(struct v4l2_subdev *sd,
 }
 
 static int mt9m114_ifp_set_selection(struct v4l2_subdev *sd,
+				     const struct v4l2_subdev_client_info *ci,
 				     struct v4l2_subdev_state *state,
 				     struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/mt9p031.c +4 -0
index 1500ee4db47e..119eaf759233 100644
@@ -574,6 +574,7 @@ __mt9p031_get_pad_crop(struct mt9p031 *mt9p031,
 }
 
 static int mt9p031_get_format(struct v4l2_subdev *subdev,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
@@ -585,6 +586,7 @@ static int mt9p031_get_format(struct v4l2_subdev *subdev,
 }
 
 static int mt9p031_set_format(struct v4l2_subdev *subdev,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -623,6 +625,7 @@ static int mt9p031_set_format(struct v4l2_subdev *subdev,
 }
 
 static int mt9p031_get_selection(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -647,6 +650,7 @@ static int mt9p031_get_selection(struct v4l2_subdev *subdev,
 }
 
 static int mt9p031_set_selection(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/mt9t112.c +4 -0
index 2d2c840fc002..97452ab2bd89 100644
@@ -872,6 +872,7 @@ static int mt9t112_set_params(struct mt9t112_priv *priv,
 }
 
 static int mt9t112_get_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -897,6 +898,7 @@ static int mt9t112_get_selection(struct v4l2_subdev *sd,
 }
 
 static int mt9t112_set_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -912,6 +914,7 @@ static int mt9t112_set_selection(struct v4l2_subdev *sd,
 }
 
 static int mt9t112_get_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
@@ -953,6 +956,7 @@ static int mt9t112_s_fmt(struct v4l2_subdev *sd,
 }
 
 static int mt9t112_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
drivers/media/i2c/mt9v011.c +1 -0
index 055b7915260a..d6faa4974bf8 100644
@@ -336,6 +336,7 @@ static int mt9v011_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int mt9v011_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/mt9v032.c +4 -0
index d4359d5b92bb..994bb7aa0cb5 100644
@@ -468,6 +468,7 @@ static int mt9v032_enum_frame_size(struct v4l2_subdev *subdev,
 }
 
 static int mt9v032_get_format(struct v4l2_subdev *subdev,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -503,6 +504,7 @@ static unsigned int mt9v032_calc_ratio(unsigned int input, unsigned int output)
 }
 
 static int mt9v032_set_format(struct v4l2_subdev *subdev,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -547,6 +549,7 @@ static int mt9v032_set_format(struct v4l2_subdev *subdev,
 }
 
 static int mt9v032_get_selection(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -561,6 +564,7 @@ static int mt9v032_get_selection(struct v4l2_subdev *subdev,
 }
 
 static int mt9v032_set_selection(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/mt9v111.c +2 -0
index 64a758c95ab7..6b7d72efb3e7 100644
@@ -868,6 +868,7 @@ static int mt9v111_enum_frame_size(struct v4l2_subdev *subdev,
 }
 
 static int mt9v111_get_format(struct v4l2_subdev *subdev,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -886,6 +887,7 @@ static int mt9v111_get_format(struct v4l2_subdev *subdev,
 }
 
 static int mt9v111_set_format(struct v4l2_subdev *subdev,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
drivers/media/i2c/og01a1b.c +2 -0
index c7184de6251a..6696aa3aac55 100644
@@ -759,6 +759,7 @@ static int og01a1b_set_stream(struct v4l2_subdev *sd, int enable)
 }
 
 static int og01a1b_set_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
@@ -800,6 +801,7 @@ static int og01a1b_set_format(struct v4l2_subdev *sd,
 }
 
 static int og01a1b_get_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/og0ve1b.c +2 -1
index 84a28cdcade1..84682389d989 100644
@@ -481,6 +481,7 @@ static int og0ve1b_disable_streams(struct v4l2_subdev *sd,
 }
 
 static int og0ve1b_set_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *state,
 				  struct v4l2_subdev_format *fmt)
 {
@@ -544,7 +545,7 @@ static int og0ve1b_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	og0ve1b_set_pad_format(sd, state, &fmt);
+	og0ve1b_set_pad_format(sd, NULL, state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/os05b10.c +2 -0
index e0453c988e4a..a46cfa513e98 100644
@@ -595,6 +595,7 @@ static int os05b10_set_framing_limits(struct os05b10 *os05b10,
 }
 
 static int os05b10_set_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *fmt)
 {
@@ -624,6 +625,7 @@ static int os05b10_set_pad_format(struct v4l2_subdev *sd,
 }
 
 static int os05b10_get_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov01a10.c +3 -0
index 8a29e5b4b6ba..b9a7dacd603e 100644
@@ -634,6 +634,7 @@ static void ov01a10_update_blank_ctrls(struct ov01a10 *ov01a10,
 }
 
 static int ov01a10_set_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
@@ -715,6 +716,7 @@ static int ov01a10_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int ov01a10_get_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -747,6 +749,7 @@ static int ov01a10_get_selection(struct v4l2_subdev *sd,
 }
 
 static int ov01a10_set_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov02a10.c +3 -1
index 70d9d7c43f18..18fe36287a76 100644
@@ -296,6 +296,7 @@ static void ov02a10_fill_fmt(const struct ov02a10_mode *mode,
 }
 
 static int ov02a10_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -328,6 +329,7 @@ static int ov02a10_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov02a10_get_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -523,7 +525,7 @@ static int ov02a10_init_state(struct v4l2_subdev *sd,
 		}
 	};
 
-	ov02a10_set_fmt(sd, sd_state, &fmt);
+	ov02a10_set_fmt(sd, NULL, sd_state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/ov02c10.c +1 -0
index b1e540eb8326..fdb399ab01a4 100644
@@ -707,6 +707,7 @@ static int ov02c10_power_on(struct device *dev)
 }
 
 static int ov02c10_set_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov02e10.c +2 -0
index 4a64cba99991..fde8cdf4b88f 100644
@@ -590,6 +590,7 @@ static int ov02e10_power_on(struct device *dev)
 }
 
 static int ov02e10_set_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
@@ -642,6 +643,7 @@ static int ov02e10_set_format(struct v4l2_subdev *sd,
 }
 
 static int ov02e10_get_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov08d10.c +2 -0
index 43ec2a1f2fcf..8294f2d2f312 100644
@@ -1128,6 +1128,7 @@ static int ov08d10_set_stream(struct v4l2_subdev *sd, int enable)
 }
 
 static int ov08d10_set_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
@@ -1176,6 +1177,7 @@ static int ov08d10_set_format(struct v4l2_subdev *sd,
 }
 
 static int ov08d10_get_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov08x40.c +2 -0
index 5eaf454f4763..1bbe8f056e08 100644
@@ -1829,6 +1829,7 @@ static int ov08x40_do_get_pad_format(struct ov08x40 *ov08x,
 }
 
 static int ov08x40_get_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *fmt)
 {
@@ -1844,6 +1845,7 @@ static int ov08x40_get_pad_format(struct v4l2_subdev *sd,
 
 static int
 ov08x40_set_pad_format(struct v4l2_subdev *sd,
+		       const struct v4l2_subdev_client_info *ci,
 		       struct v4l2_subdev_state *sd_state,
 		       struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov13858.c +2 -0
index 162b49046990..aa48abfb4eb5 100644
@@ -1330,6 +1330,7 @@ static int ov13858_do_get_pad_format(struct ov13858 *ov13858,
 }
 
 static int ov13858_get_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *fmt)
 {
@@ -1345,6 +1346,7 @@ static int ov13858_get_pad_format(struct v4l2_subdev *sd,
 
 static int
 ov13858_set_pad_format(struct v4l2_subdev *sd,
+		       const struct v4l2_subdev_client_info *ci,
 		       struct v4l2_subdev_state *sd_state,
 		       struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov13b10.c +2 -0
index 5421874732bc..a96c045b913f 100644
@@ -1096,6 +1096,7 @@ static int ov13b10_do_get_pad_format(struct ov13b10 *ov13b,
 }
 
 static int ov13b10_get_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *fmt)
 {
@@ -1111,6 +1112,7 @@ static int ov13b10_get_pad_format(struct v4l2_subdev *sd,
 
 static int
 ov13b10_set_pad_format(struct v4l2_subdev *sd,
+		       const struct v4l2_subdev_client_info *ci,
 		       struct v4l2_subdev_state *sd_state,
 		       struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov2640.c +3 -0
index d27fc2df64e6..8b9b3b951bc2 100644
@@ -909,6 +909,7 @@ static int ov2640_set_params(struct i2c_client *client,
 }
 
 static int ov2640_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -938,6 +939,7 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov2640_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -1028,6 +1030,7 @@ static int ov2640_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int ov2640_get_selection(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov2659.c +2 -0
index 061401b020fc..479cbff65f84 100644
@@ -1022,6 +1022,7 @@ static int ov2659_enum_frame_sizes(struct v4l2_subdev *sd,
 }
 
 static int ov2659_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -1080,6 +1081,7 @@ static void __ov2659_try_frame_size(struct v4l2_mbus_framefmt *mf,
 }
 
 static int ov2659_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov2680.c +4 -0
index 78e63bd1b35b..e817297d9596 100644
@@ -623,6 +623,7 @@ static int ov2680_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int ov2680_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -640,6 +641,7 @@ static int ov2680_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov2680_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -704,6 +706,7 @@ static int ov2680_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov2680_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -734,6 +737,7 @@ static int ov2680_get_selection(struct v4l2_subdev *sd,
 }
 
 static int ov2680_set_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov2685.c +3 -0
index 4911a4eea126..f9a5c5075fc9 100644
@@ -340,6 +340,7 @@ static void ov2685_fill_fmt(const struct ov2685_mode *mode,
 }
 
 static int ov2685_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -353,6 +354,7 @@ static int ov2685_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov2685_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -413,6 +415,7 @@ __ov2685_get_pad_crop(struct ov2685 *ov2685,
 }
 
 static int ov2685_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov2735.c +3 -1
index dcb1add1fd9f..90d8be72b559 100644
@@ -674,6 +674,7 @@ static int ov2735_disable_streams(struct v4l2_subdev *sd,
 }
 
 static int ov2735_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -742,6 +743,7 @@ static int ov2735_set_framing_limits(struct ov2735 *ov2735,
 }
 
 static int ov2735_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -792,7 +794,7 @@ static int ov2735_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	ov2735_set_pad_format(sd, state, &fmt);
+	ov2735_set_pad_format(sd, NULL, state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/ov2740.c +1 -0
index fb590dfadda1..4023b5b7ca82 100644
@@ -1023,6 +1023,7 @@ static int ov2740_set_stream(struct v4l2_subdev *sd, int enable)
 }
 
 static int ov2740_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov4689.c +2 -0
index a59d25b09b5b..466b6f74d982 100644
@@ -330,6 +330,7 @@ static void ov4689_fill_fmt(const struct ov4689_mode *mode,
 }
 
 static int ov4689_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -385,6 +386,7 @@ static int ov4689_enable_test_pattern(struct ov4689 *ov4689, u32 pattern)
 }
 
 static int ov4689_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov5640.c +3 -0
index 85ecc23b3587..051e066d3e8e 100644
@@ -2786,6 +2786,7 @@ static int ov5640_try_frame_interval(struct ov5640_dev *sensor,
 }
 
 static int ov5640_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -2948,6 +2949,7 @@ static int ov5640_update_pixel_rate(struct ov5640_dev *sensor)
 }
 
 static int ov5640_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -2994,6 +2996,7 @@ static int ov5640_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov5640_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov5645.c +3 -1
index b10d408034a1..149b09aafa72 100644
@@ -848,6 +848,7 @@ static int ov5645_enum_frame_size(struct v4l2_subdev *subdev,
 }
 
 static int ov5645_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *format)
 {
@@ -905,12 +906,13 @@ static int ov5645_init_state(struct v4l2_subdev *subdev,
 		},
 	};
 
-	ov5645_set_format(subdev, sd_state, &fmt);
+	ov5645_set_format(subdev, NULL, sd_state, &fmt);
 
 	return 0;
 }
 
 static int ov5645_get_selection(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov5647.c +3 -0
index 6a46ef7233ac..1c82355f2b5d 100644
@@ -762,6 +762,7 @@ static int ov5647_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int ov5647_get_pad_fmt(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -787,6 +788,7 @@ static int ov5647_get_pad_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov5647_set_pad_fmt(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -837,6 +839,7 @@ static int ov5647_set_pad_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov5647_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov5648.c +2 -0
index f0b839cd65f1..29583025f081 100644
@@ -2194,6 +2194,7 @@ static void ov5648_mbus_format_fill(struct v4l2_mbus_framefmt *mbus_format,
 }
 
 static int ov5648_get_fmt(struct v4l2_subdev *subdev,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -2215,6 +2216,7 @@ static int ov5648_get_fmt(struct v4l2_subdev *subdev,
 }
 
 static int ov5648_set_fmt(struct v4l2_subdev *subdev,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
drivers/media/i2c/ov5670.c +3 -0
index 04b3183b7bcb..1d3b3e8aae8e 100644
@@ -2272,6 +2272,7 @@ static int ov5670_do_get_pad_format(struct ov5670 *ov5670,
 }
 
 static int ov5670_get_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -2286,6 +2287,7 @@ static int ov5670_get_pad_format(struct v4l2_subdev *sd,
 }
 
 static int ov5670_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -2554,6 +2556,7 @@ __ov5670_get_pad_crop(struct ov5670 *sensor, struct v4l2_subdev_state *state,
 }
 
 static int ov5670_get_selection(struct v4l2_subdev *subdev,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov5675.c +3 -0
index ea26df328189..93fe1207fc0c 100644
@@ -1016,6 +1016,7 @@ static int ov5675_power_on(struct device *dev)
 }
 
 static int ov5675_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -1057,6 +1058,7 @@ static int ov5675_set_format(struct v4l2_subdev *sd,
 }
 
 static int ov5675_get_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -1075,6 +1077,7 @@ static int ov5675_get_format(struct v4l2_subdev *sd,
 }
 
 static int ov5675_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov5693.c +4 -0
index 4cc796bbee92..d624f5c476f9 100644
@@ -796,6 +796,7 @@ __ov5693_get_pad_crop(struct ov5693_device *ov5693,
 }
 
 static int ov5693_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *state,
 			  struct v4l2_subdev_format *format)
 {
@@ -807,6 +808,7 @@ static int ov5693_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov5693_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *state,
 			  struct v4l2_subdev_format *format)
 {
@@ -882,6 +884,7 @@ static int ov5693_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov5693_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -915,6 +918,7 @@ static int ov5693_get_selection(struct v4l2_subdev *sd,
 }
 
 static int ov5693_set_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov5695.c +2 -0
index 5bb6ce7b3237..71c0f3f5c203 100644
@@ -805,6 +805,7 @@ ov5695_find_best_fit(struct v4l2_subdev_format *fmt)
 }
 
 static int ov5695_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -838,6 +839,7 @@ static int ov5695_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov5695_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov6211.c +2 -1
index 034d5d57d67e..2ad31b2c5249 100644
@@ -459,6 +459,7 @@ static int ov6211_disable_streams(struct v4l2_subdev *sd,
 }
 
 static int ov6211_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -522,7 +523,7 @@ static int ov6211_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	ov6211_set_pad_format(sd, state, &fmt);
+	ov6211_set_pad_format(sd, NULL, state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/ov64a40.c +2 -0
index 78b62c169b99..7beddf480b8a 100644
@@ -3107,6 +3107,7 @@ static int ov64a40_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int ov64a40_get_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -3138,6 +3139,7 @@ static int ov64a40_get_selection(struct v4l2_subdev *sd,
 }
 
 static int ov64a40_set_format(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *state,
 			      struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov7251.c +4 -1
index 27afc3fc0175..32da4630fd9c 100644
@@ -1150,6 +1150,7 @@ __ov7251_get_pad_format(struct ov7251 *ov7251,
 }
 
 static int ov7251_get_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *format)
 {
@@ -1214,6 +1215,7 @@ ov7251_find_mode_by_ival(struct ov7251 *ov7251, struct v4l2_fract *timeperframe)
 }
 
 static int ov7251_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *format)
 {
@@ -1296,12 +1298,13 @@ static int ov7251_init_state(struct v4l2_subdev *subdev,
 		}
 	};
 
-	ov7251_set_format(subdev, sd_state, &fmt);
+	ov7251_set_format(subdev, NULL, sd_state, &fmt);
 
 	return 0;
 }
 
 static int ov7251_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov7670.c +2 -0
index 0cb96b6c9990..125a80256f34 100644
@@ -1098,6 +1098,7 @@ static int ov7670_apply_fmt(struct v4l2_subdev *sd)
  * Set a format.
  */
 static int ov7670_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -1133,6 +1134,7 @@ static int ov7670_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov7670_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
drivers/media/i2c/ov772x.c +3 -0
index 062e1023a411..66123d9a7b98 100644
@@ -1171,6 +1171,7 @@ static int ov772x_set_params(struct ov772x_priv *priv,
 }
 
 static int ov772x_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1193,6 +1194,7 @@ static int ov772x_get_selection(struct v4l2_subdev *sd,
 }
 
 static int ov772x_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -1212,6 +1214,7 @@ static int ov772x_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov772x_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
drivers/media/i2c/ov7740.c +2 -0
index 632fb80469be..7f637703b865 100644
@@ -766,6 +766,7 @@ static int ov7740_try_fmt_internal(struct v4l2_subdev *sd,
 }
 
 static int ov7740_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -808,6 +809,7 @@ static int ov7740_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov7740_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
drivers/media/i2c/ov8856.c +2 -0
index e2998cfa0d18..7484df2a2d33 100644
@@ -2115,6 +2115,7 @@ static int ov8856_power_off(struct device *dev)
 }
 
 static int ov8856_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -2161,6 +2162,7 @@ static int ov8856_set_format(struct v4l2_subdev *sd,
 }
 
 static int ov8856_get_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov8858.c +2 -1
index 3f45f7fab833..0bfc4350a8c9 100644
@@ -1409,6 +1409,7 @@ static const struct v4l2_subdev_video_ops ov8858_video_ops = {
  */
 
 static int ov8858_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -1486,7 +1487,7 @@ static int ov8858_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	ov8858_set_fmt(sd, sd_state, &fmt);
+	ov8858_set_fmt(sd, NULL, sd_state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/ov8865.c +3 -0
index a8586df14f77..35871264fc96 100644
@@ -2668,6 +2668,7 @@ static void ov8865_mbus_format_fill(struct v4l2_mbus_framefmt *mbus_format,
 }
 
 static int ov8865_get_fmt(struct v4l2_subdev *subdev,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -2689,6 +2690,7 @@ static int ov8865_get_fmt(struct v4l2_subdev *subdev,
 }
 
 static int ov8865_set_fmt(struct v4l2_subdev *subdev,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -2797,6 +2799,7 @@ __ov8865_get_pad_crop(struct ov8865_sensor *sensor,
 }
 
 static int ov8865_get_selection(struct v4l2_subdev *subdev,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov9282.c +4 -1
index ded9b2044ff8..d94d2f88937f 100644
@@ -963,6 +963,7 @@ static void ov9282_fill_pad_format(struct ov9282 *ov9282,
  * Return: 0 if successful, error code otherwise.
  */
 static int ov9282_get_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -994,6 +995,7 @@ static int ov9282_get_pad_format(struct v4l2_subdev *sd,
  * Return: 0 if successful, error code otherwise.
  */
 static int ov9282_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -1051,7 +1053,7 @@ static int ov9282_init_state(struct v4l2_subdev *sd,
 	ov9282_fill_pad_format(ov9282, &supported_modes[DEFAULT_MODE],
 			       ov9282->code, &fmt);
 
-	return ov9282_set_pad_format(sd, sd_state, &fmt);
+	return ov9282_set_pad_format(sd, NULL, sd_state, &fmt);
 }
 
 static const struct v4l2_rect *
@@ -1070,6 +1072,7 @@ __ov9282_get_pad_crop(struct ov9282 *ov9282,
 }
 
 static int ov9282_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov9640.c +2 -0
index 2190c52b1433..12c430b5dc80 100644
@@ -519,6 +519,7 @@ static int ov9640_s_fmt(struct v4l2_subdev *sd,
 }
 
 static int ov9640_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -563,6 +564,7 @@ static int ov9640_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int ov9640_get_selection(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/ov9650.c +2 -0
index c94e8fe29f22..4f7e9cf47f1d 100644
@@ -1181,6 +1181,7 @@ static int ov965x_set_frame_interval(struct v4l2_subdev *sd,
 }
 
 static int ov965x_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -1226,6 +1227,7 @@ static void __ov965x_try_frame_size(struct v4l2_mbus_framefmt *mf,
 }
 
 static int ov965x_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/ov9734.c +2 -0
index 0eaf33807fc9..ea7ea871f7fb 100644
@@ -681,6 +681,7 @@ static int ov9734_set_stream(struct v4l2_subdev *sd, int enable)
 }
 
 static int ov9734_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -722,6 +723,7 @@ static int ov9734_set_format(struct v4l2_subdev *sd,
 }
 
 static int ov9734_get_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/rdacm20.c +1 -0
index 52e8e2620b4d..51dc3a2bf4e3 100644
@@ -415,6 +415,7 @@ static int rdacm20_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int rdacm20_get_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
drivers/media/i2c/rdacm21.c +1 -0
index bcab462708c7..433227548371 100644
@@ -294,6 +294,7 @@ static int rdacm21_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int rdacm21_get_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
drivers/media/i2c/rj54n1cb0c.c +4 -0
index e95342d706c3..99069d655631 100644
@@ -541,6 +541,7 @@ static int rj54n1_sensor_scale(struct v4l2_subdev *sd, s32 *in_w, s32 *in_h,
 			       s32 *out_w, s32 *out_h);
 
 static int rj54n1_set_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -578,6 +579,7 @@ static int rj54n1_set_selection(struct v4l2_subdev *sd,
 }
 
 static int rj54n1_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -603,6 +605,7 @@ static int rj54n1_get_selection(struct v4l2_subdev *sd,
 }
 
 static int rj54n1_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -973,6 +976,7 @@ static int rj54n1_reg_init(struct i2c_client *client)
 }
 
 static int rj54n1_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/s5c73m3/s5c73m3-core.c +4 -0
index ab31ee2b596b..e81ffe3571d3 100644
@@ -995,6 +995,7 @@ static int s5c73m3_oif_get_pad_code(int pad, int index)
 }
 
 static int s5c73m3_get_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -1030,6 +1031,7 @@ static int s5c73m3_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int s5c73m3_oif_get_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -1069,6 +1071,7 @@ static int s5c73m3_oif_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int s5c73m3_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -1108,6 +1111,7 @@ static int s5c73m3_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int s5c73m3_oif_set_fmt(struct v4l2_subdev *sd,
+			 const struct v4l2_subdev_client_info *ci,
 			 struct v4l2_subdev_state *sd_state,
 			 struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/s5k3m5.c +3 -1
index c591b580d2e7..bdf5bea78685 100644
@@ -958,6 +958,7 @@ static void s5k3m5_update_pad_format(struct s5k3m5 *s5k3m5,
 }
 
 static int s5k3m5_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -1038,6 +1039,7 @@ static int s5k3m5_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int s5k3m5_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1075,7 +1077,7 @@ static int s5k3m5_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	s5k3m5_set_pad_format(sd, state, &fmt);
+	s5k3m5_set_pad_format(sd, NULL, state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/s5k5baf.c +3 -0
index a580b7e63302..2b786829effd 100644
@@ -1276,6 +1276,7 @@ static int s5k5baf_try_isp_format(struct v4l2_mbus_framefmt *mf)
 }
 
 static int s5k5baf_get_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -1307,6 +1308,7 @@ static int s5k5baf_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int s5k5baf_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -1370,6 +1372,7 @@ static int s5k5baf_is_bound_target(u32 target)
 }
 
 static int s5k5baf_get_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/s5k6a3.c +2 -0
index ba6477e88da3..eebe1bfa3897 100644
@@ -131,6 +131,7 @@ static struct v4l2_mbus_framefmt *__s5k6a3_get_format(
 }
 
 static int s5k6a3_set_fmt(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *fmt)
 {
@@ -149,6 +150,7 @@ static int s5k6a3_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int s5k6a3_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/s5kjn1.c +3 -1
index a707cb740556..80d713ba3a1e 100644
@@ -985,6 +985,7 @@ static void s5kjn1_update_pad_format(struct s5kjn1 *s5kjn1,
 }
 
 static int s5kjn1_set_pad_format(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -1065,6 +1066,7 @@ static int s5kjn1_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int s5kjn1_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1102,7 +1104,7 @@ static int s5kjn1_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	s5kjn1_set_pad_format(sd, state, &fmt);
+	s5kjn1_set_pad_format(sd, NULL, state, &fmt);
 
 	return 0;
 }
drivers/media/i2c/saa6752hs.c +2 -0
index 1c0031ba43b4..cb3c0b877f46 100644
@@ -543,6 +543,7 @@ static int saa6752hs_init(struct v4l2_subdev *sd, u32 leading_null_bytes)
 }
 
 static int saa6752hs_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -563,6 +564,7 @@ static int saa6752hs_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int saa6752hs_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/saa7115.c +1 -0
index 48d6730d9271..1eaa28d21364 100644
@@ -1159,6 +1159,7 @@ static int saa711x_s_sliced_fmt(struct v4l2_subdev *sd, struct v4l2_sliced_vbi_f
 }
 
 static int saa711x_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/saa717x.c +1 -0
index 713331be947c..65f8dccb8c59 100644
@@ -980,6 +980,7 @@ static int saa717x_s_register(struct v4l2_subdev *sd, const struct v4l2_dbg_regi
 #endif
 
 static int saa717x_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/st-mipid02.c +1 -0
index 4675181af5fb..f9eabd9632d3 100644
@@ -597,6 +597,7 @@ static int mipid02_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int mipid02_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/tc358743.c +2 -0
index 59f509aa1939..f36632cba2f5 100644
@@ -1797,6 +1797,7 @@ static u32 tc358743_g_colorspace(u32 code)
 }
 
 static int tc358743_get_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
@@ -1816,6 +1817,7 @@ static int tc358743_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int tc358743_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/i2c/tc358746.c +2 -1
index 86d9ba3ea4e5..b088e8d32aff 100644
@@ -873,6 +873,7 @@ static int tc358746_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int tc358746_set_fmt(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *format)
 {
@@ -881,7 +882,7 @@ static int tc358746_set_fmt(struct v4l2_subdev *sd,
 
 	/* Source follows the sink */
 	if (format->pad == TC358746_SOURCE)
-		return v4l2_subdev_get_fmt(sd, sd_state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, sd_state, format);
 
 	sink_fmt = v4l2_subdev_state_get_format(sd_state, TC358746_SINK);
 
drivers/media/i2c/tda1997x.c +2 -0
index 3532766cd795..f6b34331c90e 100644
@@ -1776,6 +1776,7 @@ static void tda1997x_fill_format(struct tda1997x_state *state,
 }
 
 static int tda1997x_get_format(struct v4l2_subdev *sd,
+			       const struct v4l2_subdev_client_info *ci,
 			       struct v4l2_subdev_state *sd_state,
 			       struct v4l2_subdev_format *format)
 {
@@ -1798,6 +1799,7 @@ static int tda1997x_get_format(struct v4l2_subdev *sd,
 }
 
 static int tda1997x_set_format(struct v4l2_subdev *sd,
+			       const struct v4l2_subdev_client_info *ci,
 			       struct v4l2_subdev_state *sd_state,
 			       struct v4l2_subdev_format *format)
 {
drivers/media/i2c/thp7312.c +1 -0
index 775cfba188d8..f1c7f149c06c 100644
@@ -729,6 +729,7 @@ static int thp7312_enum_frame_interval(struct v4l2_subdev *sd,
 }
 
 static int thp7312_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
drivers/media/i2c/tvp514x.c +2 -0
index f9c9c80c33ac..00962a09461d 100644
@@ -886,6 +886,7 @@ static int tvp514x_enum_mbus_code(struct v4l2_subdev *sd,
  * Retrieves pad format which is active or tried based on requirement
  */
 static int tvp514x_get_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *format)
 {
@@ -918,6 +919,7 @@ static int tvp514x_get_pad_format(struct v4l2_subdev *sd,
  * Set pad format for the output pad
  */
 static int tvp514x_set_pad_format(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *sd_state,
 				  struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/tvp5150.c +3 -0
index e3675c744d9e..0237aaabf3df 100644
@@ -1045,6 +1045,7 @@ tvp5150_get_pad_crop(struct tvp5150 *decoder,
 }
 
 static int tvp5150_fill_fmt(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *format)
 {
@@ -1104,6 +1105,7 @@ static void tvp5150_set_hw_selection(struct v4l2_subdev *sd,
 }
 
 static int tvp5150_set_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -1156,6 +1158,7 @@ static int tvp5150_set_selection(struct v4l2_subdev *sd,
 }
 
 static int tvp5150_get_selection(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_selection *sel)
 {
drivers/media/i2c/tvp7002.c +3 -1
index c09a5bd71fd0..912ab5a1a53b 100644
@@ -830,6 +830,7 @@ tvp7002_enum_mbus_code(struct v4l2_subdev *sd,
  */
 static int
 tvp7002_get_pad_format(struct v4l2_subdev *sd,
+		       const struct v4l2_subdev_client_info *ci,
 		       struct v4l2_subdev_state *sd_state,
 		       struct v4l2_subdev_format *fmt)
 {
@@ -854,10 +855,11 @@ tvp7002_get_pad_format(struct v4l2_subdev *sd,
  */
 static int
 tvp7002_set_pad_format(struct v4l2_subdev *sd,
+		       const struct v4l2_subdev_client_info *ci,
 		       struct v4l2_subdev_state *sd_state,
 		       struct v4l2_subdev_format *fmt)
 {
-	return tvp7002_get_pad_format(sd, sd_state, fmt);
+	return tvp7002_get_pad_format(sd, NULL, sd_state, fmt);
 }
 
 /* V4L2 core operation handlers */
drivers/media/i2c/tw9900.c +2 -0
index 53efdeaed1db..8aa5c7aeeb75 100644
@@ -184,6 +184,7 @@ static void tw9900_fill_fmt(const struct tw9900_mode *mode,
 }
 
 static int tw9900_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -198,6 +199,7 @@ static int tw9900_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int tw9900_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
drivers/media/i2c/tw9910.c +3 -0
index f3e400304e04..ea30f1b88951 100644
@@ -715,6 +715,7 @@ static int tw9910_set_frame(struct v4l2_subdev *sd, u32 *width, u32 *height)
 }
 
 static int tw9910_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -741,6 +742,7 @@ static int tw9910_get_selection(struct v4l2_subdev *sd,
 }
 
 static int tw9910_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -792,6 +794,7 @@ static int tw9910_s_fmt(struct v4l2_subdev *sd,
 }
 
 static int tw9910_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
drivers/media/i2c/vd55g1.c +3 -1
index 78d18c028154..513d2262b401 100644
@@ -1217,6 +1217,7 @@ static int vd55g1_patch(struct vd55g1 *sensor)
 }
 
 static int vd55g1_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1300,6 +1301,7 @@ static int vd55g1_new_format_change_controls(struct vd55g1 *sensor,
 }
 
 static int vd55g1_set_pad_fmt(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *sd_fmt)
 {
@@ -1365,7 +1367,7 @@ static int vd55g1_init_state(struct v4l2_subdev *sd,
 			      vd55g1_get_fmt_code(sensor, VD55G1_MBUS_CODE_DEF),
 			      &fmt.format);
 
-	return vd55g1_set_pad_fmt(sd, sd_state, &fmt);
+	return vd55g1_set_pad_fmt(sd, NULL, sd_state, &fmt);
 }
 
 static int vd55g1_enum_frame_size(struct v4l2_subdev *sd,
drivers/media/i2c/vd56g3.c +3 -1
index 157acea9e286..ca0dd1b24072 100644
@@ -823,6 +823,7 @@ static void vd56g3_update_img_pad_format(struct vd56g3 *sensor,
 }
 
 static int vd56g3_set_pad_fmt(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *sd_fmt)
 {
@@ -858,6 +859,7 @@ static int vd56g3_set_pad_fmt(struct v4l2_subdev *sd,
 }
 
 static int vd56g3_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -1038,7 +1040,7 @@ static int vd56g3_init_state(struct v4l2_subdev *sd,
 		},
 	};
 
-	return vd56g3_set_pad_fmt(sd, sd_state, &fmt);
+	return vd56g3_set_pad_fmt(sd, NULL, sd_state, &fmt);
 }
 
 static const struct v4l2_subdev_video_ops vd56g3_video_ops = {
drivers/media/i2c/vgxy61.c +4 -1
index d64d0099e6fe..aa1ac9221151 100644
@@ -652,6 +652,7 @@ static int vgxy61_try_fmt_internal(struct v4l2_subdev *sd,
 }
 
 static int vgxy61_get_selection(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *sd_state,
 				struct v4l2_subdev_selection *sel)
 {
@@ -687,6 +688,7 @@ static int vgxy61_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int vgxy61_get_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -1197,6 +1199,7 @@ static int vgxy61_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad,
 }
 
 static int vgxy61_set_fmt(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -1260,7 +1263,7 @@ static int vgxy61_init_state(struct v4l2_subdev *sd,
 	vgxy61_fill_framefmt(sensor, sensor->current_mode, &fmt.format,
 			     VGXY61_MEDIA_BUS_FMT_DEF);
 
-	return vgxy61_set_fmt(sd, sd_state, &fmt);
+	return vgxy61_set_fmt(sd, NULL, sd_state, &fmt);
 }
 
 static int vgxy61_s_ctrl(struct v4l2_ctrl *ctrl)
drivers/media/pci/cobalt/cobalt-driver.c +4 -4
index b7695705fdee..2936f7740add 100644
@@ -525,8 +525,8 @@ static int cobalt_subdevs_init(struct cobalt *cobalt)
 				&cobalt_edid);
 		if (err)
 			return err;
-		err = v4l2_subdev_call(s[i].sd, pad, set_fmt, NULL,
-				&sd_fmt);
+		err = v4l2_subdev_call(s[i].sd, pad, set_fmt, NULL, NULL,
+				       &sd_fmt);
 		if (err)
 			return err;
 		/* Reset channel video module */
@@ -609,8 +609,8 @@ static int cobalt_subdevs_hsma_init(struct cobalt *cobalt)
 
 		if (err)
 			return err;
-		err = v4l2_subdev_call(s->sd, pad, set_fmt, NULL,
-				&sd_fmt);
+		err = v4l2_subdev_call(s->sd, pad, set_fmt, NULL, NULL,
+				       &sd_fmt);
 		if (err)
 			return err;
 		cobalt->have_hsma_rx = true;
drivers/media/pci/cobalt/cobalt-v4l2.c +7 -7
index 51fd9576c6c2..bca8cc6cd4f7 100644
@@ -172,7 +172,7 @@ static void cobalt_enable_output(struct cobalt_stream *s)
 		sd_fmt.format.code = MEDIA_BUS_FMT_RGB888_1X24;
 		break;
 	}
-	v4l2_subdev_call(s->sd, pad, set_fmt, NULL, &sd_fmt);
+	v4l2_subdev_call(s->sd, pad, set_fmt, NULL, NULL, &sd_fmt);
 
 	iowrite32(0, &vo->control);
 	/* 1080p60 */
@@ -223,14 +223,14 @@ static void cobalt_enable_input(struct cobalt_stream *s)
 		iowrite32(M00235_CONTROL_BITMAP_ENABLE_MSK |
 			  (1 << M00235_CONTROL_BITMAP_PACK_FORMAT_OFST),
 			  &packer->control);
-		v4l2_subdev_call(s->sd, pad, set_fmt, NULL,
+		v4l2_subdev_call(s->sd, pad, set_fmt, NULL, NULL,
 				 &sd_fmt_yuyv);
 		break;
 	case V4L2_PIX_FMT_RGB24:
 		iowrite32(M00235_CONTROL_BITMAP_ENABLE_MSK |
 			  (2 << M00235_CONTROL_BITMAP_PACK_FORMAT_OFST),
 			  &packer->control);
-		v4l2_subdev_call(s->sd, pad, set_fmt, NULL,
+		v4l2_subdev_call(s->sd, pad, set_fmt, NULL, NULL,
 				 &sd_fmt_rgb);
 		break;
 	case V4L2_PIX_FMT_BGR32:
@@ -238,7 +238,7 @@ static void cobalt_enable_input(struct cobalt_stream *s)
 			  M00235_CONTROL_BITMAP_ENDIAN_FORMAT_MSK |
 			  (3 << M00235_CONTROL_BITMAP_PACK_FORMAT_OFST),
 			  &packer->control);
-		v4l2_subdev_call(s->sd, pad, set_fmt, NULL,
+		v4l2_subdev_call(s->sd, pad, set_fmt, NULL, NULL,
 				 &sd_fmt_rgb);
 		break;
 	}
@@ -716,7 +716,7 @@ static int cobalt_g_fmt_vid_cap(struct file *file, void *priv,
 			.which = V4L2_SUBDEV_FORMAT_ACTIVE,
 		};
 
-		v4l2_subdev_call(s->sd, pad, get_fmt, NULL, &sd_fmt);
+		v4l2_subdev_call(s->sd, pad, get_fmt, NULL, NULL, &sd_fmt);
 		v4l2_fill_pix_format(pix, &sd_fmt.format);
 	}
 
@@ -760,7 +760,7 @@ static int cobalt_try_fmt_vid_cap(struct file *file, void *priv,
 			.which = V4L2_SUBDEV_FORMAT_ACTIVE,
 		};
 
-		v4l2_subdev_call(s->sd, pad, get_fmt, NULL, &sd_fmt);
+		v4l2_subdev_call(s->sd, pad, get_fmt, NULL, NULL, &sd_fmt);
 		v4l2_fill_pix_format(pix, &sd_fmt.format);
 	}
 
@@ -938,7 +938,7 @@ static int cobalt_s_fmt_vid_out(struct file *file, void *priv,
 	s->ycbcr_enc = pix->ycbcr_enc;
 	s->quantization = pix->quantization;
 	v4l2_fill_mbus_format(&sd_fmt.format, pix, code);
-	v4l2_subdev_call(s->sd, pad, set_fmt, NULL, &sd_fmt);
+	v4l2_subdev_call(s->sd, pad, set_fmt, NULL, NULL, &sd_fmt);
 	return 0;
 }
 
drivers/media/pci/cx18/cx18-av-core.c +1 -0
index 4fb19d26ee29..f5961853eeae 100644
@@ -930,6 +930,7 @@ static int cx18_av_s_ctrl(struct v4l2_ctrl *ctrl)
 }
 
 static int cx18_av_set_fmt(struct v4l2_subdev *sd,
+		const struct v4l2_subdev_client_info *ci,
 		struct v4l2_subdev_state *sd_state,
 		struct v4l2_subdev_format *format)
 {
drivers/media/pci/cx18/cx18-controls.c +1 -1
index 78eadad8b6e8..41f388ba22ab 100644
@@ -85,7 +85,7 @@ static int cx18_s_video_encoding(struct cx2341x_handler *cxhdl, u32 val)
 	fmt->width = cxhdl->width / (is_mpeg1 ? 2 : 1);
 	fmt->height = cxhdl->height;
 	fmt->code = MEDIA_BUS_FMT_FIXED;
-	v4l2_subdev_call(cx->sd_av, pad, set_fmt, NULL, &format);
+	v4l2_subdev_call(cx->sd_av, pad, set_fmt, NULL, NULL, &format);
 	return 0;
 }
 
drivers/media/pci/cx18/cx18-ioctl.c +1 -1
index 0d676a57e24e..6f8d7f700016 100644
@@ -150,7 +150,7 @@ static int cx18_s_fmt_vid_cap(struct file *file, void *fh,
 	format.format.width = cx->cxhdl.width = w;
 	format.format.height = cx->cxhdl.height = h;
 	format.format.code = MEDIA_BUS_FMT_FIXED;
-	v4l2_subdev_call(cx->sd_av, pad, set_fmt, NULL, &format);
+	v4l2_subdev_call(cx->sd_av, pad, set_fmt, NULL, NULL, &format);
 	return cx18_g_fmt_vid_cap(file, fh, fmt);
 }
 
drivers/media/pci/cx23885/cx23885-video.c +2 -2
index 14d219fd1d8a..94ce00154e1f 100644
@@ -134,7 +134,7 @@ int cx23885_set_tvnorm(struct cx23885_dev *dev, v4l2_std_id norm)
 	format.format.width = dev->width;
 	format.format.height = dev->height;
 	format.format.field = dev->field;
-	call_all(dev, pad, set_fmt, NULL, &format);
+	call_all(dev, pad, set_fmt, NULL, NULL, &format);
 
 	return 0;
 }
@@ -619,7 +619,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
 	dprintk(2, "%s() width=%d height=%d field=%d\n", __func__,
 		dev->width, dev->height, dev->field);
 	v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
-	call_all(dev, pad, set_fmt, NULL, &format);
+	call_all(dev, pad, set_fmt, NULL, NULL, &format);
 	v4l2_fill_pix_format(&f->fmt.pix, &format.format);
 	/* set_fmt overwrites f->fmt.pix.field, restore it */
 	f->fmt.pix.field = dev->field;
drivers/media/pci/intel/ipu3/ipu3-cio2.c +3 -2
index 986b9afd7cb5..8b3f4d732fd7 100644
@@ -1229,6 +1229,7 @@ static int cio2_subdev_init_state(struct v4l2_subdev *sd,
 }
 
 static int cio2_subdev_set_fmt(struct v4l2_subdev *sd,
+			       const struct v4l2_subdev_client_info *ci,
 			       struct v4l2_subdev_state *sd_state,
 			       struct v4l2_subdev_format *fmt)
 {
@@ -1241,7 +1242,7 @@ static int cio2_subdev_set_fmt(struct v4l2_subdev *sd,
 	 * source always propagates from sink
 	 */
 	if (fmt->pad == CIO2_PAD_SOURCE)
-		return v4l2_subdev_get_fmt(sd, sd_state, fmt);
+		return v4l2_subdev_get_fmt(sd, NULL, sd_state, fmt);
 
 	fmt->format.code = formats[0].mbus_code;
 
@@ -1287,7 +1288,7 @@ static int cio2_subdev_link_validate_get_format(struct media_pad *pad,
 		memset(fmt, 0, sizeof(*fmt));
 		fmt->which = V4L2_SUBDEV_FORMAT_ACTIVE;
 		fmt->pad = pad->index;
-		return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt);
+		return v4l2_subdev_call(sd, pad, get_fmt, NULL, NULL, fmt);
 	}
 
 	return -EINVAL;
drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c +2 -0
index 7e539a0c6c92..f64d8d9a6281 100644
@@ -403,6 +403,7 @@ static int ipu6_isys_csi2_disable_streams(struct v4l2_subdev *sd,
 }
 
 static int ipu6_isys_csi2_set_sel(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *state,
 				  struct v4l2_subdev_selection *sel)
 {
@@ -454,6 +455,7 @@ static int ipu6_isys_csi2_set_sel(struct v4l2_subdev *sd,
 }
 
 static int ipu6_isys_csi2_get_sel(struct v4l2_subdev *sd,
+				  const struct v4l2_subdev_client_info *ci,
 				  struct v4l2_subdev_state *state,
 				  struct v4l2_subdev_selection *sel)
 {
drivers/media/pci/intel/ipu6/ipu6-isys-subdev.c +2 -1
index dbd6f76a066d..5dacc0a2aa9f 100644
@@ -160,6 +160,7 @@ u32 ipu6_isys_convert_bayer_order(u32 code, int x, int y)
 }
 
 int ipu6_isys_subdev_set_fmt(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *format)
 {
@@ -174,7 +175,7 @@ int ipu6_isys_subdev_set_fmt(struct v4l2_subdev *sd,
 	/* No transcoding, source and sink formats must match. */
 	if ((sd->entity.pads[format->pad].flags & MEDIA_PAD_FL_SOURCE) &&
 	    sd->entity.num_pads > 1)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	format->format.width = clamp(format->format.width, IPU6_ISYS_MIN_WIDTH,
 				     IPU6_ISYS_MAX_WIDTH);
drivers/media/pci/intel/ivsc/mei_csi.c +1 -0
index c2917e156345..f1dcf498cae7 100644
@@ -338,6 +338,7 @@ static int mei_csi_init_state(struct v4l2_subdev *sd,
 }
 
 static int mei_csi_set_fmt(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *format)
 {
drivers/media/pci/ivtv/ivtv-controls.c +1 -1
index f087a12c4ebd..816e634de1eb 100644
@@ -60,7 +60,7 @@ static int ivtv_s_video_encoding(struct cx2341x_handler *cxhdl, u32 val)
 	format.format.width = cxhdl->width / (is_mpeg1 ? 2 : 1);
 	format.format.height = cxhdl->height;
 	format.format.code = MEDIA_BUS_FMT_FIXED;
-	v4l2_subdev_call(itv->sd_video, pad, set_fmt, NULL, &format);
+	v4l2_subdev_call(itv->sd_video, pad, set_fmt, NULL, NULL, &format);
 	return 0;
 }
 
drivers/media/pci/ivtv/ivtv-ioctl.c +1 -1
index 8d5ea3aec06f..9eaaa4087b2a 100644
@@ -591,7 +591,7 @@ static int ivtv_s_fmt_vid_cap(struct file *file, void *fh, struct v4l2_format *f
 	format.format.width = fmt->fmt.pix.width;
 	format.format.height = h;
 	format.format.code = MEDIA_BUS_FMT_FIXED;
-	v4l2_subdev_call(itv->sd_video, pad, set_fmt, NULL, &format);
+	v4l2_subdev_call(itv->sd_video, pad, set_fmt, NULL, NULL, &format);
 	return ivtv_g_fmt_vid_cap(file, fh, fmt);
 }
 
drivers/media/pci/saa7134/saa7134-empress.c +3 -3
index 8c4f70e4177d..e851dd06416d 100644
@@ -103,7 +103,7 @@ static int empress_g_fmt_vid_cap(struct file *file, void *priv,
 	};
 	struct v4l2_mbus_framefmt *mbus_fmt = &fmt.format;
 
-	saa_call_all(dev, pad, get_fmt, NULL, &fmt);
+	saa_call_all(dev, pad, get_fmt, NULL, NULL, &fmt);
 
 	v4l2_fill_pix_format(&f->fmt.pix, mbus_fmt);
 	f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
@@ -122,7 +122,7 @@ static int empress_s_fmt_vid_cap(struct file *file, void *priv,
 	};
 
 	v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
-	saa_call_all(dev, pad, set_fmt, NULL, &format);
+	saa_call_all(dev, pad, set_fmt, NULL, NULL, &format);
 	v4l2_fill_pix_format(&f->fmt.pix, &format.format);
 
 	f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
@@ -145,7 +145,7 @@ static int empress_try_fmt_vid_cap(struct file *file, void *priv,
 	};
 
 	v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED);
-	saa_call_all(dev, pad, set_fmt, &pad_state, &format);
+	saa_call_all(dev, pad, set_fmt, NULL, &pad_state, &format);
 	v4l2_fill_pix_format(&f->fmt.pix, &format.format);
 
 	f->fmt.pix.pixelformat  = V4L2_PIX_FMT_MPEG;
drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c +1 -1
index 11d85f5342f0..41ae490d628c 100644
@@ -517,7 +517,7 @@ static int c3_isp_cap_link_validate(struct media_link *link)
 	};
 	int ret;
 
-	ret = v4l2_subdev_call_state_active(sd, pad, get_fmt, &src_fmt);
+	ret = v4l2_subdev_call_ci_state_active(sd, pad, get_fmt, &src_fmt);
 	if (ret)
 		return ret;
 
drivers/media/platform/amlogic/c3/isp/c3-isp-core.c +1 -0
index ff6413fff889..553c808f8f3b 100644
@@ -461,6 +461,7 @@ static void c3_isp_core_set_source_fmt(struct v4l2_subdev_state *state,
 }
 
 static int c3_isp_core_set_fmt(struct v4l2_subdev *sd,
+			       const struct v4l2_subdev_client_info *ci,
 			       struct v4l2_subdev_state *state,
 			       struct v4l2_subdev_format *format)
 {
drivers/media/platform/amlogic/c3/isp/c3-isp-resizer.c +3 -0
index 453a889e0b27..1f9c16eb0842 100644
@@ -621,6 +621,7 @@ static void c3_isp_rsz_set_source_fmt(struct v4l2_subdev_state *state,
 }
 
 static int c3_isp_rsz_set_fmt(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *state,
 			      struct v4l2_subdev_format *format)
 {
@@ -633,6 +634,7 @@ static int c3_isp_rsz_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int c3_isp_rsz_get_selection(struct v4l2_subdev *sd,
+				    const struct v4l2_subdev_client_info *ci,
 				    struct v4l2_subdev_state *state,
 				    struct v4l2_subdev_selection *sel)
 {
@@ -674,6 +676,7 @@ static int c3_isp_rsz_get_selection(struct v4l2_subdev *sd,
 }
 
 static int c3_isp_rsz_set_selection(struct v4l2_subdev *sd,
+				    const struct v4l2_subdev_client_info *ci,
 				    struct v4l2_subdev_state *state,
 				    struct v4l2_subdev_selection *sel)
 {
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c +2 -1
index 4bd98fb9c7e9..4c6ea03c9c38 100644
@@ -521,6 +521,7 @@ static int c3_mipi_adap_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int c3_mipi_adap_set_fmt(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_format *format)
 {
@@ -528,7 +529,7 @@ static int c3_mipi_adap_set_fmt(struct v4l2_subdev *sd,
 	const struct c3_adap_pix_format *pix_format;
 
 	if (format->pad != C3_MIPI_ADAP_PAD_SINK)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	pix_format = c3_mipi_adap_find_format(format->format.code);
 	if (!pix_format)
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c +2 -1
index b9e4ef3fc308..923f65648629 100644
@@ -491,6 +491,7 @@ static int c3_mipi_csi_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int c3_mipi_csi_set_fmt(struct v4l2_subdev *sd,
+			       const struct v4l2_subdev_client_info *ci,
 			       struct v4l2_subdev_state *state,
 			       struct v4l2_subdev_format *format)
 {
@@ -498,7 +499,7 @@ static int c3_mipi_csi_set_fmt(struct v4l2_subdev *sd,
 	unsigned int i;
 
 	if (format->pad != C3_MIPI_CSI2_PAD_SINK)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	fmt = v4l2_subdev_state_get_format(state, format->pad);
 
drivers/media/platform/arm/mali-c55/mali-c55-capture.c +1 -1
index 7aaa5c3f7354..efdc69cedcb1 100644
@@ -291,7 +291,7 @@ static int mali_c55_link_validate(struct media_link *link)
 	};
 	int ret;
 
-	ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, &sd_fmt);
+	ret = v4l2_subdev_call(sd, pad, get_fmt, NULL, NULL, &sd_fmt);
 	if (ret)
 		return ret;
 
drivers/media/platform/arm/mali-c55/mali-c55-isp.c +4 -1
index 497f25fbdd13..e04aa27be51d 100644
@@ -230,6 +230,7 @@ static int mali_c55_isp_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_isp_set_fmt(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_format *format)
 {
@@ -244,7 +245,7 @@ static int mali_c55_isp_set_fmt(struct v4l2_subdev *sd,
 	 * format.
 	 */
 	if (format->pad != MALI_C55_ISP_PAD_SINK_VIDEO)
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	sink_fmt = v4l2_subdev_state_get_format(state,
 						MALI_C55_ISP_PAD_SINK_VIDEO);
@@ -292,6 +293,7 @@ static int mali_c55_isp_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_isp_get_selection(struct v4l2_subdev *sd,
+				      const struct v4l2_subdev_client_info *ci,
 				      struct v4l2_subdev_state *state,
 				      struct v4l2_subdev_selection *sel)
 {
@@ -305,6 +307,7 @@ static int mali_c55_isp_get_selection(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_isp_set_selection(struct v4l2_subdev *sd,
+				      const struct v4l2_subdev_client_info *ci,
 				      struct v4l2_subdev_state *state,
 				      struct v4l2_subdev_selection *sel)
 {
drivers/media/platform/arm/mali-c55/mali-c55-resizer.c +11 -4
index a8d739af74b6..3ac117b59483 100644
@@ -715,6 +715,7 @@ static int mali_c55_rsz_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_rsz_set_sink_fmt(struct v4l2_subdev *sd,
+				     const struct v4l2_subdev_client_info *ci,
 				     struct v4l2_subdev_state *state,
 				     struct v4l2_subdev_format *format)
 {
@@ -773,6 +774,7 @@ static int mali_c55_rsz_set_sink_fmt(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_rsz_set_source_fmt(struct v4l2_subdev *sd,
+				       const struct v4l2_subdev_client_info *ci,
 				       struct v4l2_subdev_state *state,
 				       struct v4l2_subdev_format *format)
 {
@@ -812,6 +814,7 @@ static int mali_c55_rsz_set_source_fmt(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_rsz_set_fmt(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_format *format)
 {
@@ -826,12 +829,13 @@ static int mali_c55_rsz_set_fmt(struct v4l2_subdev *sd,
 
 	if (format->pad == MALI_C55_RSZ_SINK_PAD ||
 	    format->pad == MALI_C55_RSZ_SINK_BYPASS_PAD)
-		return mali_c55_rsz_set_sink_fmt(sd, state, format);
+		return mali_c55_rsz_set_sink_fmt(sd, NULL, state, format);
 
-	return mali_c55_rsz_set_source_fmt(sd, state, format);
+	return mali_c55_rsz_set_source_fmt(sd, NULL, state, format);
 }
 
 static int mali_c55_rsz_get_selection(struct v4l2_subdev *sd,
+				      const struct v4l2_subdev_client_info *ci,
 				      struct v4l2_subdev_state *state,
 				      struct v4l2_subdev_selection *sel)
 {
@@ -850,6 +854,7 @@ static int mali_c55_rsz_get_selection(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_rsz_set_crop(struct v4l2_subdev *sd,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *state,
 				 struct v4l2_subdev_selection *sel)
 {
@@ -908,6 +913,7 @@ static int mali_c55_rsz_set_crop(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_rsz_set_compose(struct v4l2_subdev *sd,
+				    const struct v4l2_subdev_client_info *ci,
 				    struct v4l2_subdev_state *state,
 				    struct v4l2_subdev_selection *sel)
 {
@@ -956,6 +962,7 @@ static int mali_c55_rsz_set_compose(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_rsz_set_selection(struct v4l2_subdev *sd,
+				      const struct v4l2_subdev_client_info *ci,
 				      struct v4l2_subdev_state *state,
 				      struct v4l2_subdev_selection *sel)
 {
@@ -963,10 +970,10 @@ static int mali_c55_rsz_set_selection(struct v4l2_subdev *sd,
 		return -EINVAL;
 
 	if (sel->target == V4L2_SEL_TGT_CROP)
-		return mali_c55_rsz_set_crop(sd, state, sel);
+		return mali_c55_rsz_set_crop(sd, NULL, state, sel);
 
 	if (sel->target == V4L2_SEL_TGT_COMPOSE)
-		return mali_c55_rsz_set_compose(sd, state, sel);
+		return mali_c55_rsz_set_compose(sd, NULL, state, sel);
 
 	return -EINVAL;
 }
drivers/media/platform/arm/mali-c55/mali-c55-tpg.c +1 -0
index 1af5d2759a83..22d58d8dfdbb 100644
@@ -180,6 +180,7 @@ static int mali_c55_tpg_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int mali_c55_tpg_set_fmt(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_format *format)
 {
drivers/media/platform/atmel/atmel-isi.c +2 -2
index a05a744cbb75..f5e85271a275 100644
@@ -609,7 +609,7 @@ static int isi_try_fmt(struct atmel_isi *isi, struct v4l2_format *f,
 
 	isi_try_fse(isi, isi_fmt, &pad_state);
 
-	ret = v4l2_subdev_call(isi->entity.subdev, pad, set_fmt,
+	ret = v4l2_subdev_call(isi->entity.subdev, pad, set_fmt, NULL,
 			       &pad_state, &format);
 	if (ret < 0)
 		return ret;
@@ -641,7 +641,7 @@ static int isi_set_fmt(struct atmel_isi *isi, struct v4l2_format *f)
 	v4l2_fill_mbus_format(&format.format, &f->fmt.pix,
 			      current_fmt->mbus_code);
 	ret = v4l2_subdev_call(isi->entity.subdev, pad,
-			       set_fmt, NULL, &format);
+			       set_fmt, NULL, NULL, &format);
 	if (ret < 0)
 		return ret;
 
drivers/media/platform/broadcom/bcm2835-unicam.c +2 -1
index f10064107d54..7917afa7343e 100644
@@ -1331,6 +1331,7 @@ static int unicam_subdev_enum_frame_size(struct v4l2_subdev *sd,
 }
 
 static int unicam_subdev_set_format(struct v4l2_subdev *sd,
+				    const struct v4l2_subdev_client_info *ci,
 				    struct v4l2_subdev_state *state,
 				    struct v4l2_subdev_format *format)
 {
@@ -1346,7 +1347,7 @@ static int unicam_subdev_set_format(struct v4l2_subdev *sd,
 
 	/* No transcoding, source and sink formats must match. */
 	if (unicam_sd_pad_is_source(format->pad))
-		return v4l2_subdev_get_fmt(sd, state, format);
+		return v4l2_subdev_get_fmt(sd, NULL, state, format);
 
 	/*
 	 * Allowed formats for the stream on the sink pad depend on what source
drivers/media/platform/cadence/cdns-csi2rx.c +4 -3
index 8c19f125da3e..74aa925c9fd2 100644
@@ -276,7 +276,7 @@ static int csi2rx_configure_ext_dphy(struct csi2rx_priv *csi2rx)
 	s64 link_freq;
 	int ret;
 
-	ret = v4l2_subdev_call_state_active(&csi2rx->subdev, pad, get_fmt,
+	ret = v4l2_subdev_call_ci_state_active(&csi2rx->subdev, pad, get_fmt,
 					    &sd_fmt);
 	if (ret < 0)
 		return ret;
@@ -532,6 +532,7 @@ static int csi2rx_enum_mbus_code(struct v4l2_subdev *subdev,
 }
 
 static int csi2rx_set_fmt(struct v4l2_subdev *subdev,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *state,
 			  struct v4l2_subdev_format *format)
 {
@@ -540,7 +541,7 @@ static int csi2rx_set_fmt(struct v4l2_subdev *subdev,
 
 	/* No transcoding, source and sink formats must match. */
 	if (format->pad != CSI2RX_PAD_SINK)
-		return v4l2_subdev_get_fmt(subdev, state, format);
+		return v4l2_subdev_get_fmt(subdev, NULL, state, format);
 
 	if (!csi2rx_get_fmt_by_code(format->format.code))
 		format->format.code = formats[0].code;
@@ -577,7 +578,7 @@ static int csi2rx_init_state(struct v4l2_subdev *subdev,
 		},
 	};
 
-	return csi2rx_set_fmt(subdev, state, &format);
+	return csi2rx_set_fmt(subdev, NULL, state, &format);
 }
 
 int cdns_csi2rx_negotiate_ppc(struct v4l2_subdev *subdev, unsigned int pad,
drivers/media/platform/cadence/cdns-csi2tx.c +5 -2
index e22b133f346d..dfb7124f14b9 100644
@@ -170,6 +170,7 @@ static int csi2tx_enum_mbus_code(struct v4l2_subdev *subdev,
 
 static struct v4l2_mbus_framefmt *
 __csi2tx_get_pad_format(struct v4l2_subdev *subdev,
+			const struct v4l2_subdev_client_info *ci,
 			struct v4l2_subdev_state *sd_state,
 			struct v4l2_subdev_format *fmt)
 {
@@ -182,6 +183,7 @@ __csi2tx_get_pad_format(struct v4l2_subdev *subdev,
 }
 
 static int csi2tx_get_pad_format(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -191,7 +193,7 @@ static int csi2tx_get_pad_format(struct v4l2_subdev *subdev,
 	if (fmt->pad == CSI2TX_PAD_SOURCE)
 		return -EINVAL;
 
-	format = __csi2tx_get_pad_format(subdev, sd_state, fmt);
+	format = __csi2tx_get_pad_format(subdev, NULL, sd_state, fmt);
 	if (!format)
 		return -EINVAL;
 
@@ -201,6 +203,7 @@ static int csi2tx_get_pad_format(struct v4l2_subdev *subdev,
 }
 
 static int csi2tx_set_pad_format(struct v4l2_subdev *subdev,
+				 const struct v4l2_subdev_client_info *ci,
 				 struct v4l2_subdev_state *sd_state,
 				 struct v4l2_subdev_format *fmt)
 {
@@ -214,7 +217,7 @@ static int csi2tx_set_pad_format(struct v4l2_subdev *subdev,
 	if (!csi2tx_get_fmt_from_mbus(fmt->format.code))
 		src_format = &fmt_default;
 
-	dst_format = __csi2tx_get_pad_format(subdev, sd_state, fmt);
+	dst_format = __csi2tx_get_pad_format(subdev, NULL, sd_state, fmt);
 	if (!dst_format)
 		return -EINVAL;
 
drivers/media/platform/intel/pxa_camera.c +3 -3
index bef1e7137f23..4458373ce1bc 100644
@@ -1819,7 +1819,7 @@ static int pxac_vidioc_try_fmt_vid_cap(struct file *filp, void *priv,
 			      pixfmt == V4L2_PIX_FMT_YUV422P ? 4 : 0);
 
 	v4l2_fill_mbus_format(mf, pix, xlate->code);
-	ret = sensor_call(pcdev, pad, set_fmt, &pad_state, &format);
+	ret = sensor_call(pcdev, pad, set_fmt, NULL, &pad_state, &format);
 	if (ret < 0)
 		return ret;
 
@@ -1882,7 +1882,7 @@ static int pxac_vidioc_s_fmt_vid_cap(struct file *filp, void *priv,
 	xlate = pxa_mbus_xlate_by_fourcc(pcdev->user_formats,
 					 pix->pixelformat);
 	v4l2_fill_mbus_format(&format.format, pix, xlate->code);
-	ret = sensor_call(pcdev, pad, set_fmt, NULL, &format);
+	ret = sensor_call(pcdev, pad, set_fmt, NULL, NULL, &format);
 	if (ret < 0) {
 		dev_warn(pcdev_to_dev(pcdev),
 			 "Failed to configure for format %x\n",
@@ -2091,7 +2091,7 @@ static int pxa_camera_sensor_bound(struct v4l2_async_notifier *notifier,
 	if (err)
 		goto out;
 
-	err = sensor_call(pcdev, pad, set_fmt, NULL, &format);
+	err = sensor_call(pcdev, pad, set_fmt, NULL, NULL, &format);
 	if (err)
 		goto out_sensor_poweroff;
 
drivers/media/platform/marvell/mcam-core.c +2 -2
index b8360d37000a..227fbecd8488 100644
@@ -1022,7 +1022,7 @@ static int mcam_cam_configure(struct mcam_camera *cam)
 	v4l2_fill_mbus_format(&format.format, &cam->pix_format, cam->mbus_code);
 	ret = sensor_call(cam, core, init, 0);
 	if (ret == 0)
-		ret = sensor_call(cam, pad, set_fmt, NULL, &format);
+		ret = sensor_call(cam, pad, set_fmt, NULL, NULL, &format);
 	/*
 	 * OV7670 does weird things if flip is set *before* format...
 	 */
@@ -1362,7 +1362,7 @@ static int mcam_vidioc_try_fmt_vid_cap(struct file *filp, void *priv,
 	f = mcam_find_format(pix->pixelformat);
 	pix->pixelformat = f->pixelformat;
 	v4l2_fill_mbus_format(&format.format, pix, f->mbus_code);
-	ret = sensor_call(cam, pad, set_fmt, &pad_state, &format);
+	ret = sensor_call(cam, pad, set_fmt, NULL, &pad_state, &format);
 	v4l2_fill_pix_format(pix, &format.format);
 	pix->bytesperline = pix->width * f->bpp;
 	switch (f->pixelformat) {
drivers/media/platform/microchip/microchip-csi2dc.c +2 -0
index 70303a0b6919..4d826612d04e 100644
@@ -225,6 +225,7 @@ static int csi2dc_enum_mbus_code(struct v4l2_subdev *csi2dc_sd,
 }
 
 static int csi2dc_get_fmt(struct v4l2_subdev *csi2dc_sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *format)
 {
@@ -245,6 +246,7 @@ static int csi2dc_get_fmt(struct v4l2_subdev *csi2dc_sd,
 }
 
 static int csi2dc_set_fmt(struct v4l2_subdev *csi2dc_sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *req_fmt)
 {
drivers/media/platform/microchip/microchip-isc-base.c +1 -0
index a7cdc743fda7..f4570799a139 100644
@@ -916,6 +916,7 @@ static int isc_link_validate(struct media_link *link)
 
 	/* Get current format from subdev */
 	ret = v4l2_subdev_call(isc->current_subdev->sd, pad, get_fmt, NULL,
+			       NULL,
 			       &format);
 	if (ret)
 		return ret;
drivers/media/platform/microchip/microchip-isc-scaler.c +3 -0
index e83463543e21..6f8f2e63e971 100644
@@ -26,6 +26,7 @@ static void isc_scaler_prepare_fmt(struct v4l2_mbus_framefmt *framefmt)
 };
 
 static int isc_scaler_get_fmt(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *format)
 {
@@ -46,6 +47,7 @@ static int isc_scaler_get_fmt(struct v4l2_subdev *sd,
 }
 
 static int isc_scaler_set_fmt(struct v4l2_subdev *sd,
+			      const struct v4l2_subdev_client_info *ci,
 			      struct v4l2_subdev_state *sd_state,
 			      struct v4l2_subdev_format *req_fmt)
 {
@@ -124,6 +126,7 @@ static int isc_scaler_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int isc_scaler_g_sel(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_selection *sel)
 {
drivers/media/platform/nxp/imx-mipi-csis.c +3 -2
index 088b2945aee3..bc0779896076 100644
@@ -1103,6 +1103,7 @@ static int mipi_csis_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int mipi_csis_set_fmt(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *state,
 			     struct v4l2_subdev_format *sdformat)
 {
@@ -1115,7 +1116,7 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd,
 	 * modified.
 	 */
 	if (sdformat->pad == CSIS_PAD_SOURCE)
-		return v4l2_subdev_get_fmt(sd, state, sdformat);
+		return v4l2_subdev_get_fmt(sd, NULL, state, sdformat);
 
 	if (sdformat->pad != CSIS_PAD_SINK)
 		return -EINVAL;
@@ -1224,7 +1225,7 @@ static int mipi_csis_init_state(struct v4l2_subdev *sd,
 		V4L2_MAP_QUANTIZATION_DEFAULT(false, fmt.format.colorspace,
 					      fmt.format.ycbcr_enc);
 
-	return mipi_csis_set_fmt(sd, state, &fmt);
+	return mipi_csis_set_fmt(sd, NULL, state, &fmt);
 }
 
 static int mipi_csis_log_status(struct v4l2_subdev *sd)
drivers/media/platform/nxp/imx7-media-csi.c +2 -1
index 933a5f39f9f4..cd3778ec060d 100644
@@ -1412,7 +1412,7 @@ static int imx7_csi_video_validate_fmt(struct imx7_csi *csi)
 	int ret;
 
 	/* Retrieve the media bus format on the source subdev. */
-	ret = v4l2_subdev_call_state_active(&csi->sd, pad, get_fmt, &fmt_src);
+	ret = v4l2_subdev_call_ci_state_active(&csi->sd, pad, get_fmt, &fmt_src);
 	if (ret)
 		return ret;
 
@@ -1890,6 +1890,7 @@ static void imx7_csi_try_fmt(struct v4l2_subdev *sd,
 }
 
 static int imx7_csi_set_fmt(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *sdformat)
 {
drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c +2 -1
index 3c26cfef93d1..be751a4de333 100644
@@ -248,6 +248,7 @@ static int mxc_isi_crossbar_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int mxc_isi_crossbar_set_fmt(struct v4l2_subdev *sd,
+				    const struct v4l2_subdev_client_info *ci,
 				    struct v4l2_subdev_state *state,
 				    struct v4l2_subdev_format *fmt)
 {
@@ -264,7 +265,7 @@ static int mxc_isi_crossbar_set_fmt(struct v4l2_subdev *sd,
 	 * can't be modified.
 	 */
 	if (fmt->pad >= xbar->num_sinks)
-		return v4l2_subdev_get_fmt(sd, state, fmt);
+		return v4l2_subdev_get_fmt(sd, NULL, state, fmt);
 
 	/* Validate the requested format. */
 	if (!mxc_isi_bus_format_by_code(fmt->format.code, MXC_ISI_PIPE_PAD_SINK))
drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c +3 -0
index a41c51dd9ce0..423077d7eeea 100644
@@ -448,6 +448,7 @@ static int mxc_isi_pipe_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int mxc_isi_pipe_set_fmt(struct v4l2_subdev *sd,
+				const struct v4l2_subdev_client_info *ci,
 				struct v4l2_subdev_state *state,
 				struct v4l2_subdev_format *fmt)
 {
@@ -543,6 +544,7 @@ static int mxc_isi_pipe_set_fmt(struct v4l2_subdev *sd,
 }
 
 static int mxc_isi_pipe_get_selection(struct v4l2_subdev *sd,
+				      const struct v4l2_subdev_client_info *ci,
 				      struct v4l2_subdev_state *state,
 				      struct v4l2_subdev_selection *sel)
 {
@@ -602,6 +604,7 @@ static int mxc_isi_pipe_get_selection(struct v4l2_subdev *sd,
 }
 
 static int mxc_isi_pipe_set_selection(struct v4l2_subdev *sd,
+				      const struct v4l2_subdev_client_info *ci,
 				      struct v4l2_subdev_state *state,
 				      struct v4l2_subdev_selection *sel)
 {
drivers/media/platform/nxp/imx8mq-mipi-csi2.c +2 -1
index 371b4e81328c..dd6869060673 100644
@@ -621,6 +621,7 @@ static int imx8mq_mipi_csi_enum_mbus_code(struct v4l2_subdev *sd,
 }
 
 static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
+				   const struct v4l2_subdev_client_info *ci,
 				   struct v4l2_subdev_state *sd_state,
 				   struct v4l2_subdev_format *sdformat)
 {
@@ -632,7 +633,7 @@ static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
 	 * modified.
 	 */
 	if (sdformat->pad == MIPI_CSI2_PAD_SOURCE)
-		return v4l2_subdev_get_fmt(sd, sd_state, sdformat);
+		return v4l2_subdev_get_fmt(sd, NULL, sd_state, sdformat);
 
 	if (sdformat->pad != MIPI_CSI2_PAD_SINK)
 		return -EINVAL;
drivers/media/platform/qcom/camss/camss-csid.c +3 -1
index ed1820488c98..d13019a9491b 100644
@@ -961,6 +961,7 @@ static int csid_enum_frame_size(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int csid_get_format(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -985,6 +986,7 @@ static int csid_get_format(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int csid_set_format(struct v4l2_subdev *sd,
+			   const struct v4l2_subdev_client_info *ci,
 			   struct v4l2_subdev_state *sd_state,
 			   struct v4l2_subdev_format *fmt)
 {
@@ -1034,7 +1036,7 @@ static int csid_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
 		}
 	};
 
-	return csid_set_format(sd, fh ? fh->state : NULL, &format);
+	return csid_set_format(sd, NULL, fh ? fh->state : NULL, &format);
 }
 
 /*
drivers/media/platform/qcom/camss/camss-csiphy.c +3 -1
index 62623393f414..cd2e94e9bcdc 100644
@@ -479,6 +479,7 @@ static int csiphy_enum_frame_size(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int csiphy_get_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -503,6 +504,7 @@ static int csiphy_get_format(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int csiphy_set_format(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_format *fmt)
 {
@@ -555,7 +557,7 @@ static int csiphy_init_formats(struct v4l2_subdev *sd,
 		}
 	};
 
-	return csiphy_set_format(sd, fh ? fh->state : NULL, &format);
+	return csiphy_set_format(sd, NULL, fh ? fh->state : NULL, &format);
 }
 
 static bool csiphy_match_clock_name(const char *clock_name, const char *format,
drivers/media/platform/qcom/camss/camss-ispif.c +3 -1
index aaf3caa42d33..9e655b58f7b3 100644
@@ -1013,6 +1013,7 @@ static int ispif_enum_frame_size(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int ispif_get_format(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *fmt)
 {
@@ -1037,6 +1038,7 @@ static int ispif_get_format(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int ispif_set_format(struct v4l2_subdev *sd,
+			    const struct v4l2_subdev_client_info *ci,
 			    struct v4l2_subdev_state *sd_state,
 			    struct v4l2_subdev_format *fmt)
 {
@@ -1085,7 +1087,7 @@ static int ispif_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
 		}
 	};
 
-	return ispif_set_format(sd, fh ? fh->state : NULL, &format);
+	return ispif_set_format(sd, NULL, fh ? fh->state : NULL, &format);
 }
 
 /*
drivers/media/platform/qcom/camss/camss-vfe.c +11 -6
index 5baf0e3d4bc4..89ebecb3c191 100644
@@ -1545,6 +1545,7 @@ static int vfe_enum_frame_size(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int vfe_get_format(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -1561,6 +1562,7 @@ static int vfe_get_format(struct v4l2_subdev *sd,
 }
 
 static int vfe_set_selection(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_selection *sel);
 
@@ -1573,6 +1575,7 @@ static int vfe_set_selection(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int vfe_set_format(struct v4l2_subdev *sd,
+			  const struct v4l2_subdev_client_info *ci,
 			  struct v4l2_subdev_state *sd_state,
 			  struct v4l2_subdev_format *fmt)
 {
@@ -1607,7 +1610,7 @@ static int vfe_set_format(struct v4l2_subdev *sd,
 		sel.target = V4L2_SEL_TGT_COMPOSE;
 		sel.r.width = fmt->format.width;
 		sel.r.height = fmt->format.height;
-		ret = vfe_set_selection(sd, sd_state, &sel);
+		ret = vfe_set_selection(sd, NULL, sd_state, &sel);
 		if (ret < 0)
 			return ret;
 	}
@@ -1624,6 +1627,7 @@ static int vfe_set_format(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int vfe_get_selection(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_selection *sel)
 {
@@ -1640,7 +1644,7 @@ static int vfe_get_selection(struct v4l2_subdev *sd,
 		case V4L2_SEL_TGT_COMPOSE_BOUNDS:
 			fmt.pad = sel->pad;
 			fmt.which = sel->which;
-			ret = vfe_get_format(sd, sd_state, &fmt);
+			ret = vfe_get_format(sd, NULL, sd_state, &fmt);
 			if (ret < 0)
 				return ret;
 
@@ -1694,6 +1698,7 @@ static int vfe_get_selection(struct v4l2_subdev *sd,
  * Return -EINVAL or zero on success
  */
 static int vfe_set_selection(struct v4l2_subdev *sd,
+			     const struct v4l2_subdev_client_info *ci,
 			     struct v4l2_subdev_state *sd_state,
 			     struct v4l2_subdev_selection *sel)
 {
@@ -1720,7 +1725,7 @@ static int vfe_set_selection(struct v4l2_subdev *sd,
 		crop.pad = MSM_VFE_PAD_SRC;
 		crop.target = V4L2_SEL_TGT_CROP;
 		crop.r = *rect;
-		ret = vfe_set_selection(sd, sd_state, &crop);
+		ret = vfe_set_selection(sd, NULL, sd_state, &crop);
 	} else if (sel->target == V4L2_SEL_TGT_CROP &&
 		sel->pad == MSM_VFE_PAD_SRC) {
 		struct v4l2_subdev_format fmt = { 0 };
@@ -1735,13 +1740,13 @@ static int vfe_set_selection(struct v4l2_subdev *sd,
 		/* Reset source pad format width and height */
 		fmt.which = sel->which;
 		fmt.pad = MSM_VFE_PAD_SRC;
-		ret = vfe_get_format(sd, sd_state, &fmt);
+		ret = vfe_get_format(sd, NULL, sd_state, &fmt);
 		if (ret < 0)
 			return ret;
 
 		fmt.format.width = rect->width;
 		fmt.format.height = rect->height;
-		ret = vfe_set_format(sd, sd_state, &fmt);
+		ret = vfe_set_format(sd, NULL, sd_state, &fmt);
 	} else {
 		ret = -EINVAL;
 	}
@@ -1771,7 +1776,7 @@ static int vfe_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
 		}
 	};
 
-	return vfe_set_format(sd, fh ? fh->state : NULL, &format);
+	return vfe_set_format(sd, NULL, fh ? fh->state : NULL, &format);
 }
 
 /*
drivers/media/platform/qcom/camss/camss-video.c +1 -1
index 831486e14754..931a5f4cfc45 100644
@@ -96,7 +96,7 @@ static int video_get_subdev_format(struct camss_video *video,
 
 	fmt.pad = pad;
 
-	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
+	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, NULL, &fmt);
 	if (ret)
 		return ret;
 
drivers/media/platform/raspberrypi/rp1-cfe/csi2.c +1 -0
index 104908afbf41..66d0dde6d840 100644
@@ -404,6 +404,7 @@ static int csi2_init_state(struct v4l2_subdev *sd,
 }
 
[… more lines in the raw message]

Lines of this file are not shown. View the raw message.

drivers/media/platform/raspberrypi/rp1-cfe/pisp-fe.c +2 -1
index 05762b1be2bc..1de48432fcc2 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/rcar-csi2.c +2 -1
index d1b31ab8b8c4..68e25851c9e8 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/rcar-isp/csisp.c +2 -1
index 1eb29a0b774a..2078b2284f8e 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/rcar-vin/rcar-v4l2.c +1 -1
index 079dbaf016c2..665b5a1c4a85 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/renesas-ceu.c +4 -3
index deed49d0fb10..ce82d50e1167 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/rzg2l-cru/rzg2l-csi2.c +2 -1
index 0fbdae280fdc..b0cf0d4d39d0 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/rzg2l-cru/rzg2l-ip.c +2 -1
index 5f2c87858bfe..21dd0162fd6e 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/rzg2l-cru/rzg2l-video.c +1 -1
index 162e2ace6931..eb629368c30d 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/rzv2h-ivc/rzv2h-ivc-subdev.c +2 -1
index b1659544eaa0..7a4ffd7fb2e4 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_brx.c +3 -0
index 5fc2e5a3bb30..af4297906136 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_clu.c +1 -0
index 98645bd2a983..08e436d613a5 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_drm.c +16 -10
index 15d266439564..f91e1095b6e6 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_entity.c +3 -1
index a6680d531872..d67e7bd3a4c7 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_histo.c +7 -2
index 390ea50f1595..904f563b1ef3 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_hsit.c +1 -0
index 1fcd1967d3b2..1dd726c28274 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_iif.c +1 -0
index 5dd62bebbe8c..d0e7cd8dcdc0 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_lif.c +1 -0
index b3d83d1c5306..c71124ace45d 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_lut.c +1 -0
index dd264e6532e0..5f6fb041db58 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_rwpf.c +3 -0
index 9c8085d5d306..7f2e4b92b936 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_sru.c +1 -0
index bba2872afaf2..26631fea8771 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_uds.c +1 -0
index 2db473b6f83c..0003c71a07f0 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_uif.c +3 -0
index edaf28b544d2..15c1d656c037 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_video.c +1 -1
index 75f9a1a85d55..d9042a1fdf9a 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/renesas/vsp1/vsp1_vspx.c +2 -1
index 1673479be0ff..5c39bacfb13f 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/rockchip/rkcif/rkcif-interface.c +4 -1
index 523103872b7a..72eac1e49577 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +1 -1
index 6dcefd144d5a..1be13a207da3 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/rockchip/rkisp1/rkisp1-csi.c +2 -1
index ddc6182f3e4b..e59d552d6746 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +3 -0
index 2311672cedb1..4043a75ca3f0 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c +3 -0
index 8e6b753d3081..5926917434af 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/samsung/exynos4-is/fimc-capture.c +10 -3
index 5b412afd7d60..1e83a6f858ce 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/samsung/exynos4-is/fimc-isp-video.c +3 -2
index ad219ac1b951..cabab7f0bd8b 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/samsung/exynos4-is/fimc-isp.c +2 -0
index 3c5d7bee2655..b3b4aa21d118 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/samsung/exynos4-is/fimc-lite.c +6 -2
index 8be20fd32d1c..1036b9b3e0d5 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/samsung/exynos4-is/mipi-csis.c +2 -0
index 452880b5350c..788c517d84ef 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/samsung/s3c-camif/camif-capture.c +6 -1
index ed1a1d693293..7bde9d0af1a3 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/samsung/s3c-camif/camif-core.c +2 -2
index 221e3c447f36..3b44259ce515 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/st/stm32/stm32-csi.c +1 -0
index fd2b6dfbd44c..8a07032646ca 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/st/stm32/stm32-dcmi.c +3 -3
index 13762861b769..0f1faf80c3ea 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c +2 -1
index 19e6b187be22..e16f008587f5 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c +3 -0
index f9e4a3a9ef3f..76b851cdf9e0 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c +1 -0
index c4bc76909b1c..5a9417f15700 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c +2 -0
index 744197b0fccb..cdb8a72d945e 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/sunxi/sun6i-csi/sun6i_csi_bridge.c +2 -0
index d006d9dd0170..fd3c2d871d17 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c +2 -0
index b06cb73015cd..b11fd2904e1d 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/sun8i_a83t_mipi_csi2.c +2 -0
index dbc51daa4fe3..67d83c4a64ba 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/am437x/am437x-vpfe.c +2 -2
index 1ca559df7e59..7588d73ef8c1 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/cal/cal-camerarx.c +2 -1
index 00a71dac0ff4..293702e701d8 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/cal/cal-video.c +3 -3
index d40e24ab1127..cb97500ca70a 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/davinci/vpif_capture.c +1 -1
index 243c6196b024..ee74d46edf2d 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c +1 -1
index b75aa363d1bf..8dbe8b5f7788 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/omap3isp/ispccdc.c +5 -1
index 9dbf06ac058d..ab03ca363eda 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/omap3isp/ispccp2.c +3 -1
index d668111b44f4..f68e06b9b61c 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/omap3isp/ispcsi2.c +3 -1
index f227042b61b6..80e57b7ee5a7 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/omap3isp/isppreview.c +5 -1
index 3f3b5bd9cdc7..195d4fe83447 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/omap3isp/ispresizer.c +5 -1
index ad0127f5b5cb..67e2fd00ea4e 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/omap3isp/ispvideo.c +6 -6
index 86cb27b6ca4e..1933ed902103 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/ti/vpe/vip.c +4 -3
index d4236ac6d867..5f18ec899657 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/via/via-camera.c +2 -2
index 5702eff664d4..8d0db472b3a0 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/video-mux.c +1 -0
index cba34893258a..b253b260b605 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/xilinx/xilinx-csi2rxss.c +2 -0
index 146131b8f37e..940f56f5f035 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/xilinx/xilinx-dma.c +1 -1
index fcfe0883aba5..307cd202dda0 100644

Lines of this file are not shown. View the raw message.

drivers/media/platform/xilinx/xilinx-tpg.c +2 -0
index 7deec6e37edc..d87fe7d885a9 100644

Lines of this file are not shown. View the raw message.

drivers/media/test-drivers/vimc/vimc-common.c +1 -1
index 4f4fcb26e236..d56bc2103ff6 100644

Lines of this file are not shown. View the raw message.

drivers/media/test-drivers/vimc/vimc-debayer.c +2 -1
index bbb7c7a86df0..23189b46572a 100644

Lines of this file are not shown. View the raw message.

drivers/media/test-drivers/vimc/vimc-scaler.c +3 -0
index 47d0d63865a0..6d7b1a491e83 100644

Lines of this file are not shown. View the raw message.

drivers/media/test-drivers/vimc/vimc-sensor.c +1 -0
index 027767777763..00652835ec03 100644

Lines of this file are not shown. View the raw message.

drivers/media/usb/cx231xx/cx231xx-417.c +1 -1
index c695a97e202b..d0955ea18195 100644

Lines of this file are not shown. View the raw message.

drivers/media/usb/cx231xx/cx231xx-video.c +2 -2
index 2cd4e333bc4b..ec9306a940a8 100644

Lines of this file are not shown. View the raw message.

drivers/media/usb/dvb-usb/cxusb-analog.c +4 -2
index 3bbee1fcbc8d..8c7d0888c721 100644

Lines of this file are not shown. View the raw message.

drivers/media/usb/em28xx/em28xx-camera.c +1 -1
index b5f58dc6dd0f..bc55ad66658c 100644

Lines of this file are not shown. View the raw message.

drivers/media/usb/go7007/go7007-v4l2.c +1 -1
index 2087ffcb85a5..86b853e09ecb 100644

Lines of this file are not shown. View the raw message.

drivers/media/usb/go7007/s2250-board.c +1 -0
index a155b987282f..6b33a50f29d5 100644

Lines of this file are not shown. View the raw message.

drivers/media/usb/pvrusb2/pvrusb2-hdw.c +1 -1
index 5807734ae26c..0b7db11bc7f5 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/atomisp/i2c/atomisp-gc2235.c +2 -0
index 6050637a0def..ef5844a5a966 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/atomisp/i2c/atomisp-ov2722.c +2 -0
index a4519babf37d..ff309f4bd964 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/atomisp/pci/atomisp_cmd.c +11 -5
index a3cd9d3e9ce7..523183f6f04c 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/atomisp/pci/atomisp_csi2.c +2 -0
index 95b9113d75e9..3e864ffc1f1a 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/atomisp/pci/atomisp_subdev.c +4 -0
index 3d56ca83ecb7..68073cde4dd3 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/atomisp/pci/atomisp_v4l2.c +4 -4
index 900a67552d6a..d7656d3d30b6 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/deprecated/atmel/atmel-isc-base.c +2 -2
index fb9ee8547392..4859a027ecba 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/imx/imx-ic-prp.c +2 -0
index 2b80d54006b3..e5616dbef9a9 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/imx/imx-ic-prpencvf.c +2 -0
index 77360bfe081a..bda6a4aff782 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/imx/imx-media-capture.c +9 -5
index e9cef7af000a..3a84b9c45d4e 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/imx/imx-media-csi.c +4 -0
index fd7e37d803e7..1db7ac14132b 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/imx/imx-media-utils.c +1 -1
index 1b5af8945e6b..b62a739ff935 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/imx/imx-media-vdic.c +2 -0
index 86f2b30cb06c..dcf51d115997 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/imx/imx6-mipi-csi2.c +2 -0
index dd8c7b3233bc..51189421244c 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/ipu3/ipu3-v4l2.c +4 -0
index 2f6041d342f4..c9f3d7416080 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/ipu7/ipu7-isys-csi2.c +2 -0
index f34eabfe8a98..fcc7efcf69c3 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/ipu7/ipu7-isys-subdev.c +2 -1
index 67a776033d5b..ca551894833b 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/starfive/camss/stf-isp.c +8 -4
index df7a903fbb1b..41991694c731 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/starfive/camss/stf-video.c +1 -1
index a0420eb6a0aa..ede089ef2de0 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/sunxi/sun6i-isp/sun6i_isp_proc.c +2 -0
index 46a334b602f1..9e9a95178ba3 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/tegra-video/csi.c +2 -0
index 3c3f6e3fd1ec..fdc8f97af266 100644

Lines of this file are not shown. View the raw message.

drivers/staging/media/tegra-video/vi.c +7 -6
index 14b327afe045..01fb6317112a 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.47.3

Part of the diff is not shown here. View the raw message.

maintainer
#44 lore raw
In reply to Sakari Ailus

Hi Sakari

Quoted 10 lines · Sakari Ailus

Hi folks,

This smallish set contains patches that prepare for merging the metadata series.

There are simple cleanups but also two noteworthy changes: the addition of the VALIDATE_LATE media link flag and the addition of the new struct v4l2_subdev_client_info struct to the get_fmt, set_fmt, get_selection and set_selection pad operation arguments.

Quoted 7 lines

The VALIDATE_LATE allows using the link_validate callback as the way to validate the links connected to the sink pads of video nodes on pipelines with multiple capture video nodes. Without this flag, the entire pipeline will be validated at the time of the first streamon, with the V4L2 pixel (or other) format set on the other capture video nodes at the time, requiring all formats to be set before starting streaming anywhere. But this does generally not match with what the userspace would do, hence the

What would userspace do instead ?

Is there a use case for formats not being known at pipeline start time ?

Is the userspace expected to enable all links with the VALIDATE_LATE flags ?

        for_each_video_node() {
                set_format()
                clear_validate_late();
                vidioc_streamon()
        }

As I understand it, the use case is solely delay setting the format on the video device and its sink pads ?

Quoted 9 lines

new flag. The patches in the upcoming metadata series version adds the support for the flag to the IPU6 driver.

Secondly, the new struct v4l2_subdev_client_info enables passing around file handler specific client capability information, which is used to differentiate UAPI between existing users and those that are aware of the new common raw sensor model. This is effectively required if we want to add support for the new model to existing raw sensor drivers: the new model is in a direct conflict with how things worked before the model.

Can you elaborate a little on why a per-ioctl flag is required ? Doesn't this open the door to possible mixups ?

I fail to see what the advantage is over per-subdev_fh client capabilities.

Quoted 6 lines

There still needs to be a single driver internal state, the different UAPIs simply offer a different view to that state. In-kernel users that do not deal with capabilities just use NULL when calling these ops. This also means that whatever client capabilities are being used, there may not be a change to inter-driver interfaces such as get_fmt() when dealing with external pads.

Do we expect drivers that still use in-kernel operation calls to be ported to use streams ?

I'll review the rest of the series in the meantime.

Thanks
j

Quoted 472 lines

I'm leaving the last Coccinelle-generated patch out this time as it's more than 200 kiB. The patch can be found here <URL:<https://git.linuxtv.org/sailus/media_tree.git/log/?h=metadata-pre>. Patches 11--14 will be squashed together before merging.

The Coccinelle spatch used to generate the 14th patch is below, as is a Perl script to generate another Coccinelle patch doing the rest of the job:

caps.cocci
------------------8<----------------------
@ fmt @
identifier a1, a2, a3;
identifier fn;

@@

fn(struct v4l2_subdev *a1,
+ const struct v4l2_subdev_client_info *ci,
struct v4l2_subdev_state *a2, struct v4l2_subdev_format *a3) {...}

@ sel @
identifier a1, a2, a3;
identifier fn2;

@@

fn2(struct v4l2_subdev *a1,
+ const struct v4l2_subdev_client_info *ci,
struct v4l2_subdev_state *a2, struct v4l2_subdev_selection *a3) {...}

@ fmt_call @
expression a1, a2, a3;
identifier fmt.fn;
@@

fn(a1
+ , NULL
, a2, a3);

@ fmt_call2 @
expression a1, a2, a3;
identifier fmt.fn;
@@

return fn(a1
+ , NULL
, a2, a3);

@ fmt_call3 @
expression ret, a1, a2, a3;
identifier fmt.fn;

@@

ret = fn(a1
+ , NULL
, a2, a3);

@ fmt_call4 @
expression a1, a2, a3;
identifier sel.fn2;
@@

fn2(a1
+ , NULL
, a2, a3);

@ fmt_call5 @
expression a1, a2, a3;
identifier sel.fn2;
@@

return fn2(a1
+ , NULL
, a2, a3);

@ fmt_call6 @
expression ret, a1, a2, a3;
identifier sel.fn2;

@@

ret = fn2(a1
+ , NULL
, a2, a3);

------------------8<----------------------

mk-caps2.pl
------------------8<----------------------
#!/usr/bin/perl -w

my @prefix = (

	"(void)",
	"",
	"ret = ",
	"return "

);

my $state_args = [

	[ "sd", "state", "fmt" ]

];

my $pad_active_args = [

	[ "sd", "pad", "get_fmt", "fmt" ],
	[ "sd", "pad", "set_fmt", "fmt" ],
	[ "sd", "pad", "get_selection", "fmt" ],
	[ "sd", "pad", "set_selection", "fmt" ],

];

my $pad_args = [

	[ "sd", "pad", "get_fmt", "state", "fmt" ],
	[ "sd", "pad", "set_fmt", "state", "fmt" ],
	[ "sd", "pad", "get_selection", "state", "fmt" ],
	[ "sd", "pad", "set_selection", "state", "fmt" ],

];

my $group_args = [

	[ "dev", "group", "pad", "get_fmt", "state", "fmt" ],
	[ "dev", "group", "pad", "set_fmt", "state", "fmt" ],
	[ "dev", "group", "pad", "get_selection", "state", "fmt" ],
	[ "dev", "group", "pad", "set_selection", "state", "fmt" ],

];

my %funcs = (

	# "function_name" => [ arg ref, new arg position from the end ],
	"v4l2_subdev_call" => { args => $pad_args, pos => 1 },
	"v4l2_device_call_all" => { args => $group_args, pos => 1 },
	"v4l2_subdev_get_fmt" => { args => $state_args, pos => 1 },
	"sensor_call" => { args => $pad_args, pos => 1 },
	"saa_call_all" => { args => $pad_args, pos => 1 },
	"call_all" => { args => $pad_args, pos => 1 },
	"v4l2_subdev_call_state_active" => { args => $pad_active_args, newname => "v4l2_subdev_call_ci_state_active" },

);

my $rule;

foreach my $p (@prefix) {
	foreach my $f (keys %funcs) {
		my $aref = $funcs{$f};

		foreach my $i (@{$aref->{args}}) {
			my $newname = $aref->{newname};

			print "@ rule" . $rule++ . " @\n";
			print "symbol $f;\n";
			print map {
				((/_/ || /^pad$/) ?
				"symbol" : "expression") . " $_;\n";
			} @$i;
			my @pre = @$i;
			my @post = splice @pre, $#pre - ($aref->{pos} // 0);
			print "identifier ret;\n" if $p =~ "ret =";
			print "@@\n";
			if (! defined $newname) {
				print "  $p$f(" . join(", ", @pre) . "\n";
				print "+ , NULL\n";
				print "  , " . join(", ", @post) . ");\n";
			} else {
				print "  $p\n";
				print "- $f(\n";
				print "+ $newname(\n";
				print "  " . join(", ", (@pre, @post)) . ");\n";
			}
		}
	}
}

------------------8<----------------------

since v2:

- Address compilation issues. I had only tested on arm64 previously.

- Introduce v4l2_subdev_call_ci_state_active(), to call pad ops with client info argument with active state. Getting around needing a new function doesn't seem easy (probably requires one more layer of indirection I'd like to do without).

Sakari Ailus (14):
media: imx219: Rename "PIXEL_ARRAY" as "CROP"
media: v4l2-subdev: Allow accessing routes with STREAMS client
capability
media: Documentation: Improve LINK_FREQ documentation
media: Documentation: Improve pixel rate calculation documentation
media: v4l2-subdev: Refactor returning routes
media: mc: Separate single link validation into a new function
media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE
media: mc: Don't care about unsettable flags in MEDIA_IOC_LINK_SETUP
media: Document enable_streams and disable_streams behaviour
media: v4l2-subdev: Move subdev client capabilities into a new struct
media: v4l2-subdev: Add struct v4l2_subdev_client_info pointer to pad
ops
media: v4l2-subdev: Add v4l2_subdev_call_ci_active_state
media: v4l2-subdev: Perform client info changes to i2c drivers
media: v4l2-subdev: Add struct v4l2_subdev_client_info argument to pad
ops

 Documentation/driver-api/media/tx-rx.rst      |   9 +-
 .../media/mediactl/media-ioc-setup-link.rst   |   4 +
 .../media/mediactl/media-types.rst            |   5 +
 .../media/v4l/ext-ctrls-image-process.rst     |   4 +-
 drivers/media/i2c/adv7170.c                   |   2 +
 drivers/media/i2c/adv7175.c                   |   2 +
 drivers/media/i2c/adv7180.c                   |   4 +-
 drivers/media/i2c/adv7183.c                   |   4 +-
 drivers/media/i2c/adv748x/adv748x-afe.c       |   4 +-
 drivers/media/i2c/adv748x/adv748x-csi2.c      |   3 +-
 drivers/media/i2c/adv748x/adv748x-hdmi.c      |   4 +-
 drivers/media/i2c/adv7511-v4l2.c              |   2 +
 drivers/media/i2c/adv7604.c                   |   3 +
 drivers/media/i2c/adv7842.c                   |   4 +-
 drivers/media/i2c/ak881x.c                    |   2 +
 drivers/media/i2c/alvium-csi2.c               |   3 +
 drivers/media/i2c/ar0521.c                    |   2 +
 drivers/media/i2c/ccs/ccs-core.c              |  15 +-
 drivers/media/i2c/cx25840/cx25840-core.c      |   1 +
 drivers/media/i2c/ds90ub913.c                 |   3 +-
 drivers/media/i2c/ds90ub953.c                 |   3 +-
 drivers/media/i2c/ds90ub960.c                 |   3 +-
 drivers/media/i2c/et8ek8/et8ek8_driver.c      |   2 +
 drivers/media/i2c/gc0308.c                    |   1 +
 drivers/media/i2c/gc0310.c                    |   1 +
 drivers/media/i2c/gc05a2.c                    |   4 +-
 drivers/media/i2c/gc08a3.c                    |   4 +-
 drivers/media/i2c/gc2145.c                    |   2 +
 drivers/media/i2c/hi556.c                     |   3 +
 drivers/media/i2c/hi846.c                     |   3 +
 drivers/media/i2c/hi847.c                     |   2 +
 drivers/media/i2c/imx111.c                    |   1 +
 drivers/media/i2c/imx208.c                    |   2 +
 drivers/media/i2c/imx214.c                    |   4 +-
 drivers/media/i2c/imx219.c                    |  32 ++--
 drivers/media/i2c/imx258.c                    |   3 +
 drivers/media/i2c/imx274.c                    |   4 +
 drivers/media/i2c/imx283.c                    |   2 +
 drivers/media/i2c/imx290.c                    |   4 +-
 drivers/media/i2c/imx296.c                    |   7 +-
 drivers/media/i2c/imx319.c                    |   2 +
 drivers/media/i2c/imx334.c                    |   4 +-
 drivers/media/i2c/imx335.c                    |   4 +-
 drivers/media/i2c/imx355.c                    |   2 +
 drivers/media/i2c/imx412.c                    |   4 +-
 drivers/media/i2c/imx415.c                    |   4 +-
 drivers/media/i2c/isl7998x.c                  |   2 +
 drivers/media/i2c/lt6911uxe.c                 |   5 +-
 drivers/media/i2c/max9286.c                   |   3 +-
 drivers/media/i2c/max96714.c                  |   3 +-
 drivers/media/i2c/max96717.c                  |   3 +-
 drivers/media/i2c/ml86v7667.c                 |   1 +
 drivers/media/i2c/mt9m001.c                   |   6 +-
 drivers/media/i2c/mt9m111.c                   |   4 +
 drivers/media/i2c/mt9m114.c                   |   6 +
 drivers/media/i2c/mt9p031.c                   |   4 +
 drivers/media/i2c/mt9t112.c                   |   4 +
 drivers/media/i2c/mt9v011.c                   |   1 +
 drivers/media/i2c/mt9v032.c                   |   4 +
 drivers/media/i2c/mt9v111.c                   |   2 +
 drivers/media/i2c/og01a1b.c                   |   2 +
 drivers/media/i2c/og0ve1b.c                   |   3 +-
 drivers/media/i2c/os05b10.c                   |   2 +
 drivers/media/i2c/ov01a10.c                   |   3 +
 drivers/media/i2c/ov02a10.c                   |   4 +-
 drivers/media/i2c/ov02c10.c                   |   1 +
 drivers/media/i2c/ov02e10.c                   |   2 +
 drivers/media/i2c/ov08d10.c                   |   2 +
 drivers/media/i2c/ov08x40.c                   |   2 +
 drivers/media/i2c/ov13858.c                   |   2 +
 drivers/media/i2c/ov13b10.c                   |   2 +
 drivers/media/i2c/ov2640.c                    |   3 +
 drivers/media/i2c/ov2659.c                    |   2 +
 drivers/media/i2c/ov2680.c                    |   4 +
 drivers/media/i2c/ov2685.c                    |   3 +
 drivers/media/i2c/ov2735.c                    |   4 +-
 drivers/media/i2c/ov2740.c                    |   1 +
 drivers/media/i2c/ov4689.c                    |   2 +
 drivers/media/i2c/ov5640.c                    |   3 +
 drivers/media/i2c/ov5645.c                    |   4 +-
 drivers/media/i2c/ov5647.c                    |   3 +
 drivers/media/i2c/ov5648.c                    |   2 +
 drivers/media/i2c/ov5670.c                    |   3 +
 drivers/media/i2c/ov5675.c                    |   3 +
 drivers/media/i2c/ov5693.c                    |   4 +
 drivers/media/i2c/ov5695.c                    |   2 +
 drivers/media/i2c/ov6211.c                    |   3 +-
 drivers/media/i2c/ov64a40.c                   |   2 +
 drivers/media/i2c/ov7251.c                    |   5 +-
 drivers/media/i2c/ov7670.c                    |   2 +
 drivers/media/i2c/ov772x.c                    |   3 +
 drivers/media/i2c/ov7740.c                    |   2 +
 drivers/media/i2c/ov8856.c                    |   2 +
 drivers/media/i2c/ov8858.c                    |   3 +-
 drivers/media/i2c/ov8865.c                    |   3 +
 drivers/media/i2c/ov9282.c                    |   5 +-
 drivers/media/i2c/ov9640.c                    |   2 +
 drivers/media/i2c/ov9650.c                    |   2 +
 drivers/media/i2c/ov9734.c                    |   2 +
 drivers/media/i2c/rdacm20.c                   |   1 +
 drivers/media/i2c/rdacm21.c                   |   1 +
 drivers/media/i2c/rj54n1cb0c.c                |   4 +
 drivers/media/i2c/s5c73m3/s5c73m3-core.c      |   4 +
 drivers/media/i2c/s5k3m5.c                    |   4 +-
 drivers/media/i2c/s5k5baf.c                   |   4 +
 drivers/media/i2c/s5k6a3.c                    |   2 +
 drivers/media/i2c/s5kjn1.c                    |   4 +-
 drivers/media/i2c/saa6752hs.c                 |   2 +
 drivers/media/i2c/saa7115.c                   |   1 +
 drivers/media/i2c/saa717x.c                   |   1 +
 drivers/media/i2c/st-mipid02.c                |   1 +
 drivers/media/i2c/tc358743.c                  |   4 +-
 drivers/media/i2c/tc358746.c                  |   3 +-
 drivers/media/i2c/tda1997x.c                  |   2 +
 drivers/media/i2c/thp7312.c                   |   1 +
 drivers/media/i2c/tvp514x.c                   |   2 +
 drivers/media/i2c/tvp5150.c                   |   3 +
 drivers/media/i2c/tvp7002.c                   |   4 +-
 drivers/media/i2c/tw9900.c                    |   2 +
 drivers/media/i2c/tw9910.c                    |   3 +
 drivers/media/i2c/vd55g1.c                    |   4 +-
 drivers/media/i2c/vd56g3.c                    |   4 +-
 drivers/media/i2c/vgxy61.c                    |   5 +-
 drivers/media/mc/mc-entity.c                  | 144 +++++++++++++-----
 drivers/media/pci/cobalt/cobalt-driver.c      |   8 +-
 drivers/media/pci/cobalt/cobalt-v4l2.c        |  14 +-
 drivers/media/pci/cx18/cx18-av-core.c         |   1 +
 drivers/media/pci/cx18/cx18-controls.c        |   2 +-
 drivers/media/pci/cx18/cx18-ioctl.c           |   2 +-
 drivers/media/pci/cx23885/cx23885-video.c     |   4 +-
 drivers/media/pci/intel/ipu3/ipu3-cio2.c      |   5 +-
 drivers/media/pci/intel/ipu6/ipu6-isys-csi2.c |   2 +
 .../media/pci/intel/ipu6/ipu6-isys-subdev.c   |   3 +-
 .../media/pci/intel/ipu6/ipu6-isys-subdev.h   |   1 +
 drivers/media/pci/intel/ivsc/mei_csi.c        |   1 +
 drivers/media/pci/ivtv/ivtv-controls.c        |   2 +-
 drivers/media/pci/ivtv/ivtv-ioctl.c           |   2 +-
 drivers/media/pci/saa7134/saa7134-empress.c   |   6 +-
 .../platform/amlogic/c3/isp/c3-isp-capture.c  |   2 +-
 .../platform/amlogic/c3/isp/c3-isp-core.c     |   1 +
 .../platform/amlogic/c3/isp/c3-isp-resizer.c  |   3 +
 .../amlogic/c3/mipi-adapter/c3-mipi-adap.c    |   3 +-
 .../amlogic/c3/mipi-csi2/c3-mipi-csi2.c       |   3 +-
 .../platform/arm/mali-c55/mali-c55-capture.c  |   2 +-
 .../platform/arm/mali-c55/mali-c55-isp.c      |   5 +-
 .../platform/arm/mali-c55/mali-c55-resizer.c  |  15 +-
 .../platform/arm/mali-c55/mali-c55-tpg.c      |   1 +
 drivers/media/platform/atmel/atmel-isi.c      |   4 +-
 .../media/platform/broadcom/bcm2835-unicam.c  |   3 +-
 drivers/media/platform/cadence/cdns-csi2rx.c  |   7 +-
 drivers/media/platform/cadence/cdns-csi2tx.c  |   7 +-
 drivers/media/platform/intel/pxa_camera.c     |   6 +-
 drivers/media/platform/marvell/mcam-core.c    |   4 +-
 .../platform/microchip/microchip-csi2dc.c     |   2 +
 .../platform/microchip/microchip-isc-base.c   |   1 +
 .../platform/microchip/microchip-isc-scaler.c |   3 +
 drivers/media/platform/nxp/imx-mipi-csis.c    |   5 +-
 drivers/media/platform/nxp/imx7-media-csi.c   |   3 +-
 .../platform/nxp/imx8-isi/imx8-isi-crossbar.c |   3 +-
 .../platform/nxp/imx8-isi/imx8-isi-pipe.c     |   3 +
 drivers/media/platform/nxp/imx8mq-mipi-csi2.c |   3 +-
 .../media/platform/qcom/camss/camss-csid.c    |   4 +-
 .../media/platform/qcom/camss/camss-csiphy.c  |   4 +-
 .../media/platform/qcom/camss/camss-ispif.c   |   4 +-
 drivers/media/platform/qcom/camss/camss-vfe.c |  17 ++-
 .../media/platform/qcom/camss/camss-video.c   |   2 +-
 .../media/platform/raspberrypi/rp1-cfe/csi2.c |   1 +
 .../platform/raspberrypi/rp1-cfe/pisp-fe.c    |   3 +-
 drivers/media/platform/renesas/rcar-csi2.c    |   3 +-
 .../media/platform/renesas/rcar-isp/csisp.c   |   3 +-
 .../platform/renesas/rcar-vin/rcar-v4l2.c     |   2 +-
 drivers/media/platform/renesas/renesas-ceu.c  |   7 +-
 .../platform/renesas/rzg2l-cru/rzg2l-csi2.c   |   3 +-
 .../platform/renesas/rzg2l-cru/rzg2l-ip.c     |   3 +-
 .../platform/renesas/rzg2l-cru/rzg2l-video.c  |   2 +-
 .../renesas/rzv2h-ivc/rzv2h-ivc-subdev.c      |   3 +-
 .../media/platform/renesas/vsp1/vsp1_brx.c    |   3 +
 .../media/platform/renesas/vsp1/vsp1_clu.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_drm.c    |  26 ++--
 .../media/platform/renesas/vsp1/vsp1_entity.c |   4 +-
 .../media/platform/renesas/vsp1/vsp1_histo.c  |   9 +-
 .../media/platform/renesas/vsp1/vsp1_hsit.c   |   1 +
 .../media/platform/renesas/vsp1/vsp1_iif.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_lif.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_lut.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_rwpf.c   |   3 +
 .../media/platform/renesas/vsp1/vsp1_sru.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_uds.c    |   1 +
 .../media/platform/renesas/vsp1/vsp1_uif.c    |   3 +
 .../media/platform/renesas/vsp1/vsp1_video.c  |   2 +-
 .../media/platform/renesas/vsp1/vsp1_vspx.c   |   3 +-
 .../platform/rockchip/rkcif/rkcif-interface.c |   5 +-
 .../platform/rockchip/rkisp1/rkisp1-capture.c |   2 +-
 .../platform/rockchip/rkisp1/rkisp1-csi.c     |   3 +-
 .../platform/rockchip/rkisp1/rkisp1-isp.c     |   3 +
 .../platform/rockchip/rkisp1/rkisp1-resizer.c |   3 +
 .../samsung/exynos4-is/fimc-capture.c         |  13 +-
 .../samsung/exynos4-is/fimc-isp-video.c       |   5 +-
 .../platform/samsung/exynos4-is/fimc-isp.c    |   2 +
 .../platform/samsung/exynos4-is/fimc-lite.c   |   8 +-
 .../platform/samsung/exynos4-is/mipi-csis.c   |   2 +
 .../samsung/s3c-camif/camif-capture.c         |   7 +-
 .../platform/samsung/s3c-camif/camif-core.c   |   4 +-
 drivers/media/platform/st/stm32/stm32-csi.c   |   1 +
 drivers/media/platform/st/stm32/stm32-dcmi.c  |   6 +-
 .../st/stm32/stm32-dcmipp/dcmipp-bytecap.c    |   3 +-
 .../st/stm32/stm32-dcmipp/dcmipp-byteproc.c   |   3 +
 .../st/stm32/stm32-dcmipp/dcmipp-input.c      |   1 +
 .../platform/sunxi/sun4i-csi/sun4i_v4l2.c     |   2 +
 .../sunxi/sun6i-csi/sun6i_csi_bridge.c        |   2 +
 .../sunxi/sun6i-mipi-csi2/sun6i_mipi_csi2.c   |   2 +
 .../sun8i_a83t_mipi_csi2.c                    |   2 +
 .../media/platform/ti/am437x/am437x-vpfe.c    |   4 +-
 drivers/media/platform/ti/cal/cal-camerarx.c  |   3 +-
 drivers/media/platform/ti/cal/cal-video.c     |   6 +-
 .../media/platform/ti/davinci/vpif_capture.c  |   2 +-
 .../platform/ti/j721e-csi2rx/j721e-csi2rx.c   |   2 +-
 drivers/media/platform/ti/omap3isp/ispccdc.c  |   6 +-
 drivers/media/platform/ti/omap3isp/ispccp2.c  |   4 +-
 drivers/media/platform/ti/omap3isp/ispcsi2.c  |   4 +-
 .../media/platform/ti/omap3isp/isppreview.c   |   6 +-
 .../media/platform/ti/omap3isp/ispresizer.c   |   6 +-
 drivers/media/platform/ti/omap3isp/ispvideo.c |  12 +-
 drivers/media/platform/ti/vpe/vip.c           |   7 +-
 drivers/media/platform/via/via-camera.c       |   4 +-
 drivers/media/platform/video-mux.c            |   1 +
 .../media/platform/xilinx/xilinx-csi2rxss.c   |   2 +
 drivers/media/platform/xilinx/xilinx-dma.c    |   2 +-
 drivers/media/platform/xilinx/xilinx-tpg.c    |   2 +
 drivers/media/test-drivers/vimc/vimc-common.c |   2 +-
 .../media/test-drivers/vimc/vimc-debayer.c    |   3 +-
 drivers/media/test-drivers/vimc/vimc-scaler.c |   3 +
 drivers/media/test-drivers/vimc/vimc-sensor.c |   1 +
 drivers/media/usb/cx231xx/cx231xx-417.c       |   2 +-
 drivers/media/usb/cx231xx/cx231xx-video.c     |   4 +-
 drivers/media/usb/dvb-usb/cxusb-analog.c      |   6 +-
 drivers/media/usb/em28xx/em28xx-camera.c      |   2 +-
 drivers/media/usb/go7007/go7007-v4l2.c        |   2 +-
 drivers/media/usb/go7007/s2250-board.c        |   1 +
 drivers/media/usb/pvrusb2/pvrusb2-hdw.c       |   2 +-
 drivers/media/v4l2-core/v4l2-subdev.c         | 117 +++++++++-----
 .../media/atomisp/i2c/atomisp-gc2235.c        |   2 +
 .../media/atomisp/i2c/atomisp-ov2722.c        |   2 +
 .../staging/media/atomisp/pci/atomisp_cmd.c   |  16 +-
 .../staging/media/atomisp/pci/atomisp_csi2.c  |   2 +
 .../media/atomisp/pci/atomisp_subdev.c        |   4 +
 .../staging/media/atomisp/pci/atomisp_v4l2.c  |   8 +-
 .../media/deprecated/atmel/atmel-isc-base.c   |   4 +-
 drivers/staging/media/imx/imx-ic-prp.c        |   2 +
 drivers/staging/media/imx/imx-ic-prpencvf.c   |   2 +
 drivers/staging/media/imx/imx-media-capture.c |  14 +-
 drivers/staging/media/imx/imx-media-csi.c     |   4 +
 drivers/staging/media/imx/imx-media-utils.c   |   2 +-
 drivers/staging/media/imx/imx-media-vdic.c    |   2 +
 drivers/staging/media/imx/imx6-mipi-csi2.c    |   2 +
 drivers/staging/media/ipu3/ipu3-v4l2.c        |   4 +
 drivers/staging/media/ipu7/ipu7-isys-csi2.c   |   2 +
 drivers/staging/media/ipu7/ipu7-isys-subdev.c |   3 +-
 .../staging/media/starfive/camss/stf-isp.c    |  12 +-
 .../staging/media/starfive/camss/stf-video.c  |   2 +-
 .../media/sunxi/sun6i-isp/sun6i_isp_proc.c    |   2 +
 drivers/staging/media/tegra-video/csi.c       |   2 +
 drivers/staging/media/tegra-video/vi.c        |  13 +-
 include/media/v4l2-subdev.h                   |  77 ++++++++--
 include/uapi/linux/media.h                    |   1 +
 265 files changed, 969 insertions(+), 324 deletions(-)

--
2.47.3

author maintainer
#45 lore raw

Hi Jacopo,

Thank you for reviewing this!

Quoted 21 lines · Jacopo Mondi

Hi Sakari

Quoted 10 lines · Sakari Ailus

Hi folks,

This smallish set contains patches that prepare for merging the metadata series.

There are simple cleanups but also two noteworthy changes: the addition of the VALIDATE_LATE media link flag and the addition of the new struct v4l2_subdev_client_info struct to the get_fmt, set_fmt, get_selection and set_selection pad operation arguments.

Quoted 7 lines

The VALIDATE_LATE allows using the link_validate callback as the way to validate the links connected to the sink pads of video nodes on pipelines with multiple capture video nodes. Without this flag, the entire pipeline will be validated at the time of the first streamon, with the V4L2 pixel (or other) format set on the other capture video nodes at the time, requiring all formats to be set before starting streaming anywhere. But this does generally not match with what the userspace would do, hence the

Quoted 3 lines

What would userspace do instead ?

Is there a use case for formats not being known at pipeline start time ?

Yes. Try capturing from two video nodes with e.g. yavta.

I recall the vsp driver does link validation as part of the streamon operation without involving the link_validate callback for this reason.

Quoted 3 lines

Is the userspace expected to enable all links with the VALIDATE_LATE flags ?

It's not supposed to be a user-settable flag. The purpose is really to allow the framework to do the job it's supposed to.

Quoted 9 lines
        for_each_video_node() {
                set_format()
                clear_validate_late();
                vidioc_streamon()
        }

As I understand it, the use case is solely delay setting the format on the video device and its sink pads ?

Correct.

Quoted 11 lines
Quoted 10 lines

new flag. The patches in the upcoming metadata series version adds the support for the flag to the IPU6 driver.

Secondly, the new struct v4l2_subdev_client_info enables passing around file handler specific client capability information, which is used to differentiate UAPI between existing users and those that are aware of the new common raw sensor model. This is effectively required if we want to add support for the new model to existing raw sensor drivers: the new model is in a direct conflict with how things worked before the model.

Quoted 5 lines

Can you elaborate a little on why a per-ioctl flag is required ? Doesn't this open the door to possible mixups ?

I fail to see what the advantage is over per-subdev_fh client capabilities.

It's a per-file handle flag, but the sub-device IOCTL handlers currently don't take the file handle (or information related to it) as an argument. Therefore this needs to be added to the relevant ops -- it could also be all pad ops; it would be possible to avoid adding new functions that take client_info pointer and work on the active state (see the third-last patch).

Quoted 10 lines
Quoted 7 lines

There still needs to be a single driver internal state, the different UAPIs simply offer a different view to that state. In-kernel users that do not deal with capabilities just use NULL when calling these ops. This also means that whatever client capabilities are being used, there may not be a change to inter-driver interfaces such as get_fmt() when dealing with external pads.

Do we expect drivers that still use in-kernel operation calls to be ported to use streams ?

Those that benefit from it can be ported. But interoperability is good between those that use streams than those that don't so there's no hurry.

Quoted 2 lines

I'll review the rest of the series in the meantime.

Thank you. I'm down to ~ 80 patches once these are merged.

Signature · 3 lines
Kind regards,

Sakari Ailus
maintainer
#46 lore raw

Hi Sakari

Quoted 26 lines · Sakari Ailus

Hi Jacopo,

Thank you for reviewing this!

Quoted 21 lines · Jacopo Mondi

Hi Sakari

Quoted 17 lines · Sakari Ailus

Hi folks,

This smallish set contains patches that prepare for merging the metadata series.

There are simple cleanups but also two noteworthy changes: the addition of the VALIDATE_LATE media link flag and the addition of the new struct v4l2_subdev_client_info struct to the get_fmt, set_fmt, get_selection and set_selection pad operation arguments.

The VALIDATE_LATE allows using the link_validate callback as the way to validate the links connected to the sink pads of video nodes on pipelines with multiple capture video nodes. Without this flag, the entire pipeline will be validated at the time of the first streamon, with the V4L2 pixel (or other) format set on the other capture video nodes at the time, requiring all formats to be set before starting streaming anywhere. But this does generally not match with what the userspace would do, hence the

Quoted 6 lines
Quoted 3 lines

What would userspace do instead ?

Is there a use case for formats not being known at pipeline start time ?

Yes. Try capturing from two video nodes with e.g. yavta.

maybe yavta is not the right tool to handle streaming on a complex platform, or should at least be modified to delay start stream after all formats are set up.

Anyway..

Quoted 10 lines

I recall the vsp driver does link validation as part of the streamon operation without involving the link_validate callback for this reason.

Quoted 3 lines

Is the userspace expected to enable all links with the VALIDATE_LATE flags ?

It's not supposed to be a user-settable flag. The purpose is really to allow the framework to do the job it's supposed to.

This doesn't explain me nothing.

The only documentation patch for this in
[PATCH v2 07/14] media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE

just reports:

+The ``VALIDATE_LATE`` flag is used to signal that the validation of the link may +be delayed until actual hardware operation even if the rest of the pipeline +would be validated at an earlier point of time.

in Documentation/userspace-api/media/mediactl/media-ioc-setup-link.rst

Have I missed any other part of the documentation maybe ?

How are drivers supposed to use it ? Create links to multiplexed subdevs with this flag ?

Again, if the problem is a userspace tool not setting up all formats before calling s_stream, a driver flag to accommodate it doesn't seem right.

Quoted 7 lines
Quoted 7 lines
        for_each_video_node() {
                set_format()
                clear_validate_late();
                vidioc_streamon()
        }
Quoted 5 lines
Quoted 2 lines

As I understand it, the use case is solely delay setting the format on the video device and its sink pads ?

Correct.

Still not sure why we should allow that.

I'll ask-again:

Is there a use case for formats not being known at pipeline start time ?

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

new flag. The patches in the upcoming metadata series version adds the support for the flag to the IPU6 driver.

Secondly, the new struct v4l2_subdev_client_info enables passing around file handler specific client capability information, which is used to differentiate UAPI between existing users and those that are aware of the new common raw sensor model. This is effectively required if we want to add support for the new model to existing raw sensor drivers: the new model is in a direct conflict with how things worked before the model.

Quoted 8 lines
Quoted 5 lines

Can you elaborate a little on why a per-ioctl flag is required ? Doesn't this open the door to possible mixups ?

I fail to see what the advantage is over per-subdev_fh client capabilities.

It's a per-file handle flag, but the sub-device IOCTL handlers currently don't take the file handle (or information related to it) as an argument.

Could you elaborate on the reason why the flag should be an operation argument an not a per-file handle setting ?

Quoted 16 lines

Therefore this needs to be added to the relevant ops -- it could also be all pad ops; it would be possible to avoid adding new functions that take client_info pointer and work on the active state (see the third-last patch).

Quoted 10 lines
Quoted 7 lines

There still needs to be a single driver internal state, the different UAPIs simply offer a different view to that state. In-kernel users that do not deal with capabilities just use NULL when calling these ops. This also means that whatever client capabilities are being used, there may not be a change to inter-driver interfaces such as get_fmt() when dealing with external pads.

Do we expect drivers that still use in-kernel operation calls to be ported to use streams ?

Quoted 8 lines

Those that benefit from it can be ported. But interoperability is good between those that use streams than those that don't so there's no hurry.

Quoted 2 lines

I'll review the rest of the series in the meantime.

Thank you. I'm down to ~ 80 patches once these are merged.

I really hoped we could have landed the 66 patch series to start building on it

Quoted 4 lines

--
Kind regards,

Sakari Ailus

author maintainer
#47 lore raw

Hi Jacopo,

Quoted 66 lines · Jacopo Mondi

Hi Sakari

Quoted 26 lines · Sakari Ailus

Hi Jacopo,

Thank you for reviewing this!

Quoted 21 lines · Jacopo Mondi

Hi Sakari

Quoted 17 lines · Sakari Ailus

Hi folks,

This smallish set contains patches that prepare for merging the metadata series.

There are simple cleanups but also two noteworthy changes: the addition of the VALIDATE_LATE media link flag and the addition of the new struct v4l2_subdev_client_info struct to the get_fmt, set_fmt, get_selection and set_selection pad operation arguments.

The VALIDATE_LATE allows using the link_validate callback as the way to validate the links connected to the sink pads of video nodes on pipelines with multiple capture video nodes. Without this flag, the entire pipeline will be validated at the time of the first streamon, with the V4L2 pixel (or other) format set on the other capture video nodes at the time, requiring all formats to be set before starting streaming anywhere. But this does generally not match with what the userspace would do, hence the

Quoted 6 lines
Quoted 3 lines

What would userspace do instead ?

Is there a use case for formats not being known at pipeline start time ?

Yes. Try capturing from two video nodes with e.g. yavta.

maybe yavta is not the right tool to handle streaming on a complex platform, or should at least be modified to delay start stream after all formats are set up.

Anyway..

Quoted 10 lines

I recall the vsp driver does link validation as part of the streamon operation without involving the link_validate callback for this reason.

Quoted 3 lines

Is the userspace expected to enable all links with the VALIDATE_LATE flags ?

It's not supposed to be a user-settable flag. The purpose is really to allow the framework to do the job it's supposed to.

This doesn't explain me nothing.

The only documentation patch for this in
[PATCH v2 07/14] media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE

just reports:

(quoted diff) +3 -0
+The ``VALIDATE_LATE`` flag is used to signal that the validation of the link may
+be delayed until actual hardware operation even if the rest of the pipeline
+would be validated at an earlier point of time.

in Documentation/userspace-api/media/mediactl/media-ioc-setup-link.rst

Quoted 8 lines

Have I missed any other part of the documentation maybe ?

How are drivers supposed to use it ? Create links to multiplexed subdevs with this flag ?

Again, if the problem is a userspace tool not setting up all formats before calling s_stream, a driver flag to accommodate it doesn't seem right.

As I noted earlier, today drivers implement link validation without using the callback. With the flag some of the job can be done by the framework and also the userspace will be aware of the arrangement.

I'd think all drivers supporting multiple streams should use the flag on video nodes.

I'll improve this for v3 to describe this flag is driver-set.

Quoted 11 lines
Quoted 11 lines
Quoted 10 lines

        for_each_video_node() {
                set_format()
                clear_validate_late();
                vidioc_streamon()
        }

As I understand it, the use case is solely delay setting the format on the video device and its sink pads ?

Quoted 8 lines
Quoted 2 lines

Correct.

Still not sure why we should allow that.

I'll ask-again:

Is there a use case for formats not being known at pipeline start time ?

Existing user space and general clumsiness in having to set the format beforehand, especially with test programs, when there is no technical need to do so.

Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Quoted 11 lines

new flag. The patches in the upcoming metadata series version adds the support for the flag to the IPU6 driver.

Secondly, the new struct v4l2_subdev_client_info enables passing around file handler specific client capability information, which is used to differentiate UAPI between existing users and those that are aware of the new common raw sensor model. This is effectively required if we want to add support for the new model to existing raw sensor drivers: the new model is in a direct conflict with how things worked before the model.

Can you elaborate a little on why a per-ioctl flag is required ? Doesn't this open the door to possible mixups ?

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

I fail to see what the advantage is over per-subdev_fh client capabilities.

It's a per-file handle flag, but the sub-device IOCTL handlers currently don't take the file handle (or information related to it) as an argument.

Could you elaborate on the reason why the flag should be an operation argument an not a per-file handle setting ?

It is a per-file handle flag.

Quoted 21 lines
Quoted 21 lines

Therefore this needs to be added to the relevant ops -- it could also be all pad ops; it would be possible to avoid adding new functions that take client_info pointer and work on the active state (see the third-last patch).

Quoted 10 lines
Quoted 7 lines

There still needs to be a single driver internal state, the different UAPIs simply offer a different view to that state. In-kernel users that do not deal with capabilities just use NULL when calling these ops. This also means that whatever client capabilities are being used, there may not be a change to inter-driver interfaces such as get_fmt() when dealing with external pads.

Do we expect drivers that still use in-kernel operation calls to be ported to use streams ?

Those that benefit from it can be ported. But interoperability is good between those that use streams than those that don't so there's no hurry.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I'll review the rest of the series in the meantime.

Thank you. I'm down to ~ 80 patches once these are merged.

I really hoped we could have landed the 66 patch series to start building on it

I'm also for merging it as soon as possible but it needs to be complete before that. There were missing bits in the previous version, in particular related to the common raw sensor model, for which I'm adding support to the imx219 driver.

I also understand Laurent would like to see libcamera to support it before merging it to the kernel and I don't really disagree with that.

Signature · 3 lines
Kind regards,

Sakari Ailus
maintainer
#48 lore raw

Hi Sakari

Quoted 103 lines · Sakari Ailus

Hi Jacopo,

Quoted 66 lines · Jacopo Mondi

Hi Sakari

Quoted 26 lines · Sakari Ailus

Hi Jacopo,

Thank you for reviewing this!

Quoted 21 lines · Jacopo Mondi

Hi Sakari

Quoted 17 lines · Sakari Ailus

Hi folks,

This smallish set contains patches that prepare for merging the metadata series.

There are simple cleanups but also two noteworthy changes: the addition of the VALIDATE_LATE media link flag and the addition of the new struct v4l2_subdev_client_info struct to the get_fmt, set_fmt, get_selection and set_selection pad operation arguments.

The VALIDATE_LATE allows using the link_validate callback as the way to validate the links connected to the sink pads of video nodes on pipelines with multiple capture video nodes. Without this flag, the entire pipeline will be validated at the time of the first streamon, with the V4L2 pixel (or other) format set on the other capture video nodes at the time, requiring all formats to be set before starting streaming anywhere. But this does generally not match with what the userspace would do, hence the

Quoted 6 lines
Quoted 3 lines

What would userspace do instead ?

Is there a use case for formats not being known at pipeline start time ?

Yes. Try capturing from two video nodes with e.g. yavta.

maybe yavta is not the right tool to handle streaming on a complex platform, or should at least be modified to delay start stream after all formats are set up.

Anyway..

Quoted 10 lines

I recall the vsp driver does link validation as part of the streamon operation without involving the link_validate callback for this reason.

Quoted 3 lines

Is the userspace expected to enable all links with the VALIDATE_LATE flags ?

It's not supposed to be a user-settable flag. The purpose is really to allow the framework to do the job it's supposed to.

This doesn't explain me nothing.

The only documentation patch for this in
[PATCH v2 07/14] media: mc: Add MEDIA_LNK_FL_VALIDATE_LATE

just reports:

(quoted diff) +3 -0
+The ``VALIDATE_LATE`` flag is used to signal that the validation of the link may
+be delayed until actual hardware operation even if the rest of the pipeline
+would be validated at an earlier point of time.

in Documentation/userspace-api/media/mediactl/media-ioc-setup-link.rst

Quoted 8 lines

Have I missed any other part of the documentation maybe ?

How are drivers supposed to use it ? Create links to multiplexed subdevs with this flag ?

Again, if the problem is a userspace tool not setting up all formats before calling s_stream, a driver flag to accommodate it doesn't seem right.

As I noted earlier, today drivers implement link validation without using the callback. With the flag some of the job can be done by the framework and also the userspace will be aware of the arrangement.

I'd think all drivers supporting multiple streams should use the flag on video nodes.

I'll improve this for v3 to describe this flag is driver-set.

Quoted 16 lines
Quoted 8 lines
Quoted 8 lines

        for_each_video_node() {
                set_format()
                clear_validate_late();
                vidioc_streamon()
        }
Quoted 5 lines
Quoted 2 lines

As I understand it, the use case is solely delay setting the format on the video device and its sink pads ?

Correct.

Still not sure why we should allow that.

Quoted 8 lines
Quoted 3 lines

I'll ask-again:

Is there a use case for formats not being known at pipeline start time ?

Existing user space and general clumsiness in having to set the format beforehand, especially with test programs, when there is no technical need to do so.

I'm still not 100% on board with this, sorry.

If the flag is meant to be set by drivers on all media links that connect them to a multiplexed source, then the framework could as well do that by inspecting the number of streams on the source subdev ?

Quoted 18 lines
Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 11 lines

new flag. The patches in the upcoming metadata series version adds the support for the flag to the IPU6 driver.

Secondly, the new struct v4l2_subdev_client_info enables passing around file handler specific client capability information, which is used to differentiate UAPI between existing users and those that are aware of the new common raw sensor model. This is effectively required if we want to add support for the new model to existing raw sensor drivers: the new model is in a direct conflict with how things worked before the model.

Can you elaborate a little on why a per-ioctl flag is required ? Doesn't this open the door to possible mixups ?

I fail to see what the advantage is over per-subdev_fh client capabilities.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

It's a per-file handle flag, but the sub-device IOCTL handlers currently don't take the file handle (or information related to it) as an argument.

Could you elaborate on the reason why the flag should be an operation argument an not a per-file handle setting ?

It is a per-file handle flag.

I initially thought this was a setting coming from userspace on a per-ioctl base, which made no sense to me.

Now that I've groked
[PATCH v2 11/14] media: v4l2-subdev: Add struct v4l2_subdev_client_info pointer to pad ops

I understand the intention is to pass to the ioctl handlers the subdev capabilities.

However

We have a state passed to every ioctl operation already, and states are associated to the file handles already.

Wouldn't it be easier to copy the caps flag to the state before calling the ioctl handler instead of adding a new argument to all ioctl handlers in the subsystem ?

Are there reasons I've missed why you consider this not possible ?

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Therefore this needs to be added to the relevant ops -- it could also be all pad ops; it would be possible to avoid adding new functions that take client_info pointer and work on the active state (see the third-last patch).

Ah, exactly.

What did you prevent you from doing this ?

Quoted 24 lines
Quoted 16 lines
Quoted 16 lines
Quoted 11 lines
Quoted 8 lines

There still needs to be a single driver internal state, the different UAPIs simply offer a different view to that state. In-kernel users that do not deal with capabilities just use NULL when calling these ops. This also means that whatever client capabilities are being used, there may not be a change to inter-driver interfaces such as get_fmt() when dealing with external pads.

Do we expect drivers that still use in-kernel operation calls to be ported to use streams ?

Those that benefit from it can be ported. But interoperability is good between those that use streams than those that don't so there's no hurry.

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I'll review the rest of the series in the meantime.

Thank you. I'm down to ~ 80 patches once these are merged.

I really hoped we could have landed the 66 patch series to start building on it

Quoted 8 lines

I'm also for merging it as soon as possible but it needs to be complete before that. There were missing bits in the previous version, in particular related to the common raw sensor model, for which I'm adding support to the imx219 driver.

I also understand Laurent would like to see libcamera to support it before merging it to the kernel and I don't really disagree with that.

libcamera has added support for it 2 (or maybe 3) years ago. For a version of this API that is now outdated, and now we suffer from the fact we need a different flag to signal STREAM capabilities to userspace otherwise libcamera will break on new platforms implementing the model right.

So we would need to 'freeze' this version somehow without merging it, give libcamera time to implement support properly and merge both implementations together ??

Quoted 4 lines

--
Kind regards,

Sakari Ailus