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

media: v4l2-subdev: add subdev-wide state struct

We have 'struct v4l2_subdev_pad_config' which contains configuration for
a single pad used for the TRY functionality, and an array of those
structs is passed to various v4l2_subdev_pad_ops.

I was working on subdev internal routing between pads, and realized that
there's no way to add TRY functionality for routes, which is not pad
specific configuration. Adding a separate struct for try-route config
wouldn't work either, as e.g. set-fmt needs to know the try-route
configuration to propagate the settings.

This patch adds a new struct, 'struct v4l2_subdev_state' (which at the
moment only contains the v4l2_subdev_pad_config array) and the new
struct is used in most of the places where v4l2_subdev_pad_config was
used. All v4l2_subdev_pad_ops functions taking v4l2_subdev_pad_config
are changed to instead take v4l2_subdev_state.

The changes to drivers/media/v4l2-core/v4l2-subdev.c and
include/media/v4l2-subdev.h were written by hand, and all the driver
changes were done with the semantic patch below. The spatch needs to be
applied to a select list of directories. I used the following shell
commands to apply the spatch:

dirs="drivers/media/i2c drivers/media/platform drivers/media/usb drivers/media/test-drivers/vimc drivers/media/pci drivers/staging/media"
for dir in $dirs; do spatch -j8 --dir --include-headers --no-show-diff --in-place --sp-file v4l2-subdev-state.cocci $dir; done

Note that Coccinelle chokes on a few drivers (gcc extensions?). With
minor changes we can make Coccinelle run fine, and these changes can be
reverted after spatch. The diff for these changes is:

For drivers/media/i2c/s5k5baf.c:

@@ -1481,7 +1481,7 @@ static int s5k5baf_set_selection(struct v4l2_subdev *sd,
&s5k5baf_cis_rect,
v4l2_subdev_get_try_crop(sd, cfg, PAD_CIS),
v4l2_subdev_get_try_compose(sd, cfg, PAD_CIS),
- v4l2_subdev_get_try_crop(sd, cfg, PAD_OUT)
+ v4l2_subdev_get_try_crop(sd, cfg, PAD_OUT),
};
s5k5baf_set_rect_and_adjust(rects, rtype, &sel->r);
return 0;

For drivers/media/platform/s3c-camif/camif-capture.c:

@@ -1230,7 +1230,7 @@ static int s3c_camif_subdev_get_fmt(struct v4l2_subdev *sd,
*mf = camif->mbus_fmt;
break;

- case CAMIF_SD_PAD_SOURCE_C...CAMIF_SD_PAD_SOURCE_P:
+ case CAMIF_SD_PAD_SOURCE_C:
/* crop rectangle at camera interface input */
mf->width = camif->camif_crop.width;
mf->height = camif->camif_crop.height;
@@ -1332,7 +1332,7 @@ static int s3c_camif_subdev_set_fmt(struct v4l2_subdev *sd,
}
break;

- case CAMIF_SD_PAD_SOURCE_C...CAMIF_SD_PAD_SOURCE_P:
+ case CAMIF_SD_PAD_SOURCE_C:
/* Pixel format can be only changed on the sink pad. */
mf->code = camif->mbus_fmt.code;
mf->width = crop->width;

The semantic patch is:

// <smpl>

// Change function parameter

@@
identifier func;
identifier cfg;
@@

func(...,
- struct v4l2_subdev_pad_config *cfg
+ struct v4l2_subdev_state *sd_state
, ...)
{
<...
- cfg
+ sd_state
...>
}

// Change function declaration parameter

@@
identifier func;
identifier cfg;
type T;
@@
T func(...,
- struct v4l2_subdev_pad_config *cfg
+ struct v4l2_subdev_state *sd_state
, ...);

// Change function return value

@@
identifier func;
@@
- struct v4l2_subdev_pad_config
+ struct v4l2_subdev_state
*func(...)
{
...
}

// Change function declaration return value

@@
identifier func;
@@
- struct v4l2_subdev_pad_config
+ struct v4l2_subdev_state
*func(...);

// Some drivers pass a local pad_cfg for a single pad to a called function. Wrap it
// inside a pad_state.

@@
identifier func;
identifier pad_cfg;
@@
func(...)
{
...
struct v4l2_subdev_pad_config pad_cfg;
+ struct v4l2_subdev_state pad_state = { .pads = &pad_cfg };

<+...

(
v4l2_subdev_call
|
sensor_call
|
isi_try_fse
|
isc_try_fse
|
saa_call_all
)
(...,
- &pad_cfg
+ &pad_state
,...)

...+>
}

// If the function uses fields from pad_config, access via state->pads

@@
identifier func;
identifier state;
@@
func(...,
struct v4l2_subdev_state *state
, ...)
{
<...
(
- state->try_fmt
+ state->pads->try_fmt
|
- state->try_crop
+ state->pads->try_crop
|
- state->try_compose
+ state->pads->try_compose
)
...>
}

// If the function accesses the filehandle, use fh->state instead

@@
struct v4l2_subdev_fh *fh;
@@
- fh->pad
+ fh->state

@@
struct v4l2_subdev_fh fh;
@@
- fh.pad
+ fh.state

// Start of vsp1 specific

@@
@@
struct vsp1_entity {
...
- struct v4l2_subdev_pad_config *config;
+ struct v4l2_subdev_state *config;
...
};

@@
symbol entity;
@@
vsp1_entity_init(...)
{
...
entity->config =
- v4l2_subdev_alloc_pad_config
+ v4l2_subdev_alloc_state
(&entity->subdev);
...
}

@@
symbol entity;
@@
vsp1_entity_destroy(...)
{
...
- v4l2_subdev_free_pad_config
+ v4l2_subdev_free_state
(entity->config);
...
}

@exists@
identifier func =~ "(^vsp1.*)|(hsit_set_format)|(sru_enum_frame_size)|(sru_set_format)|(uif_get_selection)|(uif_set_selection)|(uds_enum_frame_size)|(uds_set_format)|(brx_set_format)|(brx_get_selection)|(histo_get_selection)|(histo_set_selection)|(brx_set_selection)";
symbol config;
@@
func(...) {
...
- struct v4l2_subdev_pad_config *config;
+ struct v4l2_subdev_state *config;
...
}

// End of vsp1 specific

// Start of rcar specific

@@
identifier sd;
identifier pad_cfg;
@@
rvin_try_format(...)
{
...
- struct v4l2_subdev_pad_config *pad_cfg;
+ struct v4l2_subdev_state *sd_state;
...
- pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+ sd_state = v4l2_subdev_alloc_state(sd);
<...
- pad_cfg
+ sd_state
...>
- v4l2_subdev_free_pad_config(pad_cfg);
+ v4l2_subdev_free_state(sd_state);
...
}

// End of rcar specific

// Start of rockchip specific

@@
identifier func =~ "(rkisp1_rsz_get_pad_fmt)|(rkisp1_rsz_get_pad_crop)|(rkisp1_rsz_register)";
symbol rsz;
symbol pad_cfg;
@@

func(...)
{
+ struct v4l2_subdev_state state = { .pads = rsz->pad_cfg };
...
- rsz->pad_cfg
+ &state
...
}

@@
identifier func =~ "(rkisp1_isp_get_pad_fmt)|(rkisp1_isp_get_pad_crop)";
symbol isp;
symbol pad_cfg;
@@

func(...)
{
+ struct v4l2_subdev_state state = { .pads = isp->pad_cfg };
...
- isp->pad_cfg
+ &state
...
}

@@
symbol rkisp1;
symbol isp;
symbol pad_cfg;
@@

rkisp1_isp_register(...)
{
+ struct v4l2_subdev_state state = { .pads = rkisp1->isp.pad_cfg };
...
- rkisp1->isp.pad_cfg
+ &state
...
}

// End of rockchip specific

// Start of tegra-video specific

@@
identifier sd;
identifier pad_cfg;
@@
__tegra_channel_try_format(...)
{
...
- struct v4l2_subdev_pad_config *pad_cfg;
+ struct v4l2_subdev_state *sd_state;
...
- pad_cfg = v4l2_subdev_alloc_pad_config(sd);
+ sd_state = v4l2_subdev_alloc_state(sd);
<...
- pad_cfg
+ sd_state
...>
- v4l2_subdev_free_pad_config(pad_cfg);
+ v4l2_subdev_free_state(sd_state);
...
}

@@
identifier sd_state;
@@
__tegra_channel_try_format(...)
{
...
struct v4l2_subdev_state *sd_state;
<...
- sd_state->try_crop
+ sd_state->pads->try_crop
...>
}

// End of tegra-video specific

// </smpl>

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

authored by

Tomi Valkeinen and committed by
Mauro Carvalho Chehab
0d346d2a 6f2f49ae

+2165 -1805
+3 -3
drivers/media/i2c/adv7170.c
··· 250 250 } 251 251 252 252 static int adv7170_enum_mbus_code(struct v4l2_subdev *sd, 253 - struct v4l2_subdev_pad_config *cfg, 253 + struct v4l2_subdev_state *sd_state, 254 254 struct v4l2_subdev_mbus_code_enum *code) 255 255 { 256 256 if (code->pad || code->index >= ARRAY_SIZE(adv7170_codes)) ··· 261 261 } 262 262 263 263 static int adv7170_get_fmt(struct v4l2_subdev *sd, 264 - struct v4l2_subdev_pad_config *cfg, 264 + struct v4l2_subdev_state *sd_state, 265 265 struct v4l2_subdev_format *format) 266 266 { 267 267 struct v4l2_mbus_framefmt *mf = &format->format; ··· 284 284 } 285 285 286 286 static int adv7170_set_fmt(struct v4l2_subdev *sd, 287 - struct v4l2_subdev_pad_config *cfg, 287 + struct v4l2_subdev_state *sd_state, 288 288 struct v4l2_subdev_format *format) 289 289 { 290 290 struct v4l2_mbus_framefmt *mf = &format->format;
+3 -3
drivers/media/i2c/adv7175.c
··· 288 288 } 289 289 290 290 static int adv7175_enum_mbus_code(struct v4l2_subdev *sd, 291 - struct v4l2_subdev_pad_config *cfg, 291 + struct v4l2_subdev_state *sd_state, 292 292 struct v4l2_subdev_mbus_code_enum *code) 293 293 { 294 294 if (code->pad || code->index >= ARRAY_SIZE(adv7175_codes)) ··· 299 299 } 300 300 301 301 static int adv7175_get_fmt(struct v4l2_subdev *sd, 302 - struct v4l2_subdev_pad_config *cfg, 302 + struct v4l2_subdev_state *sd_state, 303 303 struct v4l2_subdev_format *format) 304 304 { 305 305 struct v4l2_mbus_framefmt *mf = &format->format; ··· 322 322 } 323 323 324 324 static int adv7175_set_fmt(struct v4l2_subdev *sd, 325 - struct v4l2_subdev_pad_config *cfg, 325 + struct v4l2_subdev_state *sd_state, 326 326 struct v4l2_subdev_format *format) 327 327 { 328 328 struct v4l2_mbus_framefmt *mf = &format->format;
+9 -9
drivers/media/i2c/adv7180.c
··· 633 633 } 634 634 635 635 static int adv7180_enum_mbus_code(struct v4l2_subdev *sd, 636 - struct v4l2_subdev_pad_config *cfg, 636 + struct v4l2_subdev_state *sd_state, 637 637 struct v4l2_subdev_mbus_code_enum *code) 638 638 { 639 639 if (code->index != 0) ··· 699 699 } 700 700 701 701 static int adv7180_get_pad_format(struct v4l2_subdev *sd, 702 - struct v4l2_subdev_pad_config *cfg, 702 + struct v4l2_subdev_state *sd_state, 703 703 struct v4l2_subdev_format *format) 704 704 { 705 705 struct adv7180_state *state = to_state(sd); 706 706 707 707 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 708 - format->format = *v4l2_subdev_get_try_format(sd, cfg, 0); 708 + format->format = *v4l2_subdev_get_try_format(sd, sd_state, 0); 709 709 } else { 710 710 adv7180_mbus_fmt(sd, &format->format); 711 711 format->format.field = state->field; ··· 715 715 } 716 716 717 717 static int adv7180_set_pad_format(struct v4l2_subdev *sd, 718 - struct v4l2_subdev_pad_config *cfg, 718 + struct v4l2_subdev_state *sd_state, 719 719 struct v4l2_subdev_format *format) 720 720 { 721 721 struct adv7180_state *state = to_state(sd); ··· 742 742 adv7180_set_power(state, true); 743 743 } 744 744 } else { 745 - framefmt = v4l2_subdev_get_try_format(sd, cfg, 0); 745 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 746 746 *framefmt = format->format; 747 747 } 748 748 ··· 750 750 } 751 751 752 752 static int adv7180_init_cfg(struct v4l2_subdev *sd, 753 - struct v4l2_subdev_pad_config *cfg) 753 + struct v4l2_subdev_state *sd_state) 754 754 { 755 755 struct v4l2_subdev_format fmt = { 756 - .which = cfg ? V4L2_SUBDEV_FORMAT_TRY 757 - : V4L2_SUBDEV_FORMAT_ACTIVE, 756 + .which = sd_state ? V4L2_SUBDEV_FORMAT_TRY 757 + : V4L2_SUBDEV_FORMAT_ACTIVE, 758 758 }; 759 759 760 - return adv7180_set_pad_format(sd, cfg, &fmt); 760 + return adv7180_set_pad_format(sd, sd_state, &fmt); 761 761 } 762 762 763 763 static int adv7180_get_mbus_config(struct v4l2_subdev *sd,
+4 -4
drivers/media/i2c/adv7183.c
··· 409 409 } 410 410 411 411 static int adv7183_enum_mbus_code(struct v4l2_subdev *sd, 412 - struct v4l2_subdev_pad_config *cfg, 412 + struct v4l2_subdev_state *sd_state, 413 413 struct v4l2_subdev_mbus_code_enum *code) 414 414 { 415 415 if (code->pad || code->index > 0) ··· 420 420 } 421 421 422 422 static int adv7183_set_fmt(struct v4l2_subdev *sd, 423 - struct v4l2_subdev_pad_config *cfg, 423 + struct v4l2_subdev_state *sd_state, 424 424 struct v4l2_subdev_format *format) 425 425 { 426 426 struct adv7183 *decoder = to_adv7183(sd); ··· 443 443 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) 444 444 decoder->fmt = *fmt; 445 445 else 446 - cfg->try_fmt = *fmt; 446 + sd_state->pads->try_fmt = *fmt; 447 447 return 0; 448 448 } 449 449 450 450 static int adv7183_get_fmt(struct v4l2_subdev *sd, 451 - struct v4l2_subdev_pad_config *cfg, 451 + struct v4l2_subdev_state *sd_state, 452 452 struct v4l2_subdev_format *format) 453 453 { 454 454 struct adv7183 *decoder = to_adv7183(sd);
+7 -6
drivers/media/i2c/adv748x/adv748x-afe.c
··· 331 331 } 332 332 333 333 static int adv748x_afe_enum_mbus_code(struct v4l2_subdev *sd, 334 - struct v4l2_subdev_pad_config *cfg, 334 + struct v4l2_subdev_state *sd_state, 335 335 struct v4l2_subdev_mbus_code_enum *code) 336 336 { 337 337 if (code->index != 0) ··· 343 343 } 344 344 345 345 static int adv748x_afe_get_format(struct v4l2_subdev *sd, 346 - struct v4l2_subdev_pad_config *cfg, 346 + struct v4l2_subdev_state *sd_state, 347 347 struct v4l2_subdev_format *sdformat) 348 348 { 349 349 struct adv748x_afe *afe = adv748x_sd_to_afe(sd); ··· 354 354 return -EINVAL; 355 355 356 356 if (sdformat->which == V4L2_SUBDEV_FORMAT_TRY) { 357 - mbusformat = v4l2_subdev_get_try_format(sd, cfg, sdformat->pad); 357 + mbusformat = v4l2_subdev_get_try_format(sd, sd_state, 358 + sdformat->pad); 358 359 sdformat->format = *mbusformat; 359 360 } else { 360 361 adv748x_afe_fill_format(afe, &sdformat->format); ··· 366 365 } 367 366 368 367 static int adv748x_afe_set_format(struct v4l2_subdev *sd, 369 - struct v4l2_subdev_pad_config *cfg, 368 + struct v4l2_subdev_state *sd_state, 370 369 struct v4l2_subdev_format *sdformat) 371 370 { 372 371 struct v4l2_mbus_framefmt *mbusformat; ··· 376 375 return -EINVAL; 377 376 378 377 if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE) 379 - return adv748x_afe_get_format(sd, cfg, sdformat); 378 + return adv748x_afe_get_format(sd, sd_state, sdformat); 380 379 381 - mbusformat = v4l2_subdev_get_try_format(sd, cfg, sdformat->pad); 380 + mbusformat = v4l2_subdev_get_try_format(sd, sd_state, sdformat->pad); 382 381 *mbusformat = sdformat->format; 383 382 384 383 return 0;
+7 -7
drivers/media/i2c/adv748x/adv748x-csi2.c
··· 141 141 142 142 static struct v4l2_mbus_framefmt * 143 143 adv748x_csi2_get_pad_format(struct v4l2_subdev *sd, 144 - struct v4l2_subdev_pad_config *cfg, 144 + struct v4l2_subdev_state *sd_state, 145 145 unsigned int pad, u32 which) 146 146 { 147 147 struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd); 148 148 149 149 if (which == V4L2_SUBDEV_FORMAT_TRY) 150 - return v4l2_subdev_get_try_format(sd, cfg, pad); 150 + return v4l2_subdev_get_try_format(sd, sd_state, pad); 151 151 152 152 return &tx->format; 153 153 } 154 154 155 155 static int adv748x_csi2_get_format(struct v4l2_subdev *sd, 156 - struct v4l2_subdev_pad_config *cfg, 156 + struct v4l2_subdev_state *sd_state, 157 157 struct v4l2_subdev_format *sdformat) 158 158 { 159 159 struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd); 160 160 struct adv748x_state *state = tx->state; 161 161 struct v4l2_mbus_framefmt *mbusformat; 162 162 163 - mbusformat = adv748x_csi2_get_pad_format(sd, cfg, sdformat->pad, 163 + mbusformat = adv748x_csi2_get_pad_format(sd, sd_state, sdformat->pad, 164 164 sdformat->which); 165 165 if (!mbusformat) 166 166 return -EINVAL; ··· 175 175 } 176 176 177 177 static int adv748x_csi2_set_format(struct v4l2_subdev *sd, 178 - struct v4l2_subdev_pad_config *cfg, 178 + struct v4l2_subdev_state *sd_state, 179 179 struct v4l2_subdev_format *sdformat) 180 180 { 181 181 struct adv748x_csi2 *tx = adv748x_sd_to_csi2(sd); ··· 183 183 struct v4l2_mbus_framefmt *mbusformat; 184 184 int ret = 0; 185 185 186 - mbusformat = adv748x_csi2_get_pad_format(sd, cfg, sdformat->pad, 186 + mbusformat = adv748x_csi2_get_pad_format(sd, sd_state, sdformat->pad, 187 187 sdformat->which); 188 188 if (!mbusformat) 189 189 return -EINVAL; ··· 193 193 if (sdformat->pad == ADV748X_CSI2_SOURCE) { 194 194 const struct v4l2_mbus_framefmt *sink_fmt; 195 195 196 - sink_fmt = adv748x_csi2_get_pad_format(sd, cfg, 196 + sink_fmt = adv748x_csi2_get_pad_format(sd, sd_state, 197 197 ADV748X_CSI2_SINK, 198 198 sdformat->which); 199 199
+7 -6
drivers/media/i2c/adv748x/adv748x-hdmi.c
··· 409 409 } 410 410 411 411 static int adv748x_hdmi_enum_mbus_code(struct v4l2_subdev *sd, 412 - struct v4l2_subdev_pad_config *cfg, 412 + struct v4l2_subdev_state *sd_state, 413 413 struct v4l2_subdev_mbus_code_enum *code) 414 414 { 415 415 if (code->index != 0) ··· 421 421 } 422 422 423 423 static int adv748x_hdmi_get_format(struct v4l2_subdev *sd, 424 - struct v4l2_subdev_pad_config *cfg, 424 + struct v4l2_subdev_state *sd_state, 425 425 struct v4l2_subdev_format *sdformat) 426 426 { 427 427 struct adv748x_hdmi *hdmi = adv748x_sd_to_hdmi(sd); ··· 431 431 return -EINVAL; 432 432 433 433 if (sdformat->which == V4L2_SUBDEV_FORMAT_TRY) { 434 - mbusformat = v4l2_subdev_get_try_format(sd, cfg, sdformat->pad); 434 + mbusformat = v4l2_subdev_get_try_format(sd, sd_state, 435 + sdformat->pad); 435 436 sdformat->format = *mbusformat; 436 437 } else { 437 438 adv748x_hdmi_fill_format(hdmi, &sdformat->format); ··· 443 442 } 444 443 445 444 static int adv748x_hdmi_set_format(struct v4l2_subdev *sd, 446 - struct v4l2_subdev_pad_config *cfg, 445 + struct v4l2_subdev_state *sd_state, 447 446 struct v4l2_subdev_format *sdformat) 448 447 { 449 448 struct v4l2_mbus_framefmt *mbusformat; ··· 452 451 return -EINVAL; 453 452 454 453 if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE) 455 - return adv748x_hdmi_get_format(sd, cfg, sdformat); 454 + return adv748x_hdmi_get_format(sd, sd_state, sdformat); 456 455 457 - mbusformat = v4l2_subdev_get_try_format(sd, cfg, sdformat->pad); 456 + mbusformat = v4l2_subdev_get_try_format(sd, sd_state, sdformat->pad); 458 457 *mbusformat = sdformat->format; 459 458 460 459 return 0;
+5 -5
drivers/media/i2c/adv7511-v4l2.c
··· 1216 1216 } 1217 1217 1218 1218 static int adv7511_enum_mbus_code(struct v4l2_subdev *sd, 1219 - struct v4l2_subdev_pad_config *cfg, 1219 + struct v4l2_subdev_state *sd_state, 1220 1220 struct v4l2_subdev_mbus_code_enum *code) 1221 1221 { 1222 1222 if (code->pad != 0) ··· 1247 1247 } 1248 1248 1249 1249 static int adv7511_get_fmt(struct v4l2_subdev *sd, 1250 - struct v4l2_subdev_pad_config *cfg, 1250 + struct v4l2_subdev_state *sd_state, 1251 1251 struct v4l2_subdev_format *format) 1252 1252 { 1253 1253 struct adv7511_state *state = get_adv7511_state(sd); ··· 1261 1261 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1262 1262 struct v4l2_mbus_framefmt *fmt; 1263 1263 1264 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 1264 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 1265 1265 format->format.code = fmt->code; 1266 1266 format->format.colorspace = fmt->colorspace; 1267 1267 format->format.ycbcr_enc = fmt->ycbcr_enc; ··· 1279 1279 } 1280 1280 1281 1281 static int adv7511_set_fmt(struct v4l2_subdev *sd, 1282 - struct v4l2_subdev_pad_config *cfg, 1282 + struct v4l2_subdev_state *sd_state, 1283 1283 struct v4l2_subdev_format *format) 1284 1284 { 1285 1285 struct adv7511_state *state = get_adv7511_state(sd); ··· 1316 1316 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1317 1317 struct v4l2_mbus_framefmt *fmt; 1318 1318 1319 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 1319 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 1320 1320 fmt->code = format->format.code; 1321 1321 fmt->colorspace = format->format.colorspace; 1322 1322 fmt->ycbcr_enc = format->format.ycbcr_enc;
+6 -6
drivers/media/i2c/adv7604.c
··· 1833 1833 } 1834 1834 1835 1835 static int adv76xx_enum_mbus_code(struct v4l2_subdev *sd, 1836 - struct v4l2_subdev_pad_config *cfg, 1836 + struct v4l2_subdev_state *sd_state, 1837 1837 struct v4l2_subdev_mbus_code_enum *code) 1838 1838 { 1839 1839 struct adv76xx_state *state = to_state(sd); ··· 1913 1913 } 1914 1914 1915 1915 static int adv76xx_get_format(struct v4l2_subdev *sd, 1916 - struct v4l2_subdev_pad_config *cfg, 1916 + struct v4l2_subdev_state *sd_state, 1917 1917 struct v4l2_subdev_format *format) 1918 1918 { 1919 1919 struct adv76xx_state *state = to_state(sd); ··· 1926 1926 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1927 1927 struct v4l2_mbus_framefmt *fmt; 1928 1928 1929 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 1929 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 1930 1930 format->format.code = fmt->code; 1931 1931 } else { 1932 1932 format->format.code = state->format->code; ··· 1936 1936 } 1937 1937 1938 1938 static int adv76xx_get_selection(struct v4l2_subdev *sd, 1939 - struct v4l2_subdev_pad_config *cfg, 1939 + struct v4l2_subdev_state *sd_state, 1940 1940 struct v4l2_subdev_selection *sel) 1941 1941 { 1942 1942 struct adv76xx_state *state = to_state(sd); ··· 1956 1956 } 1957 1957 1958 1958 static int adv76xx_set_format(struct v4l2_subdev *sd, 1959 - struct v4l2_subdev_pad_config *cfg, 1959 + struct v4l2_subdev_state *sd_state, 1960 1960 struct v4l2_subdev_format *format) 1961 1961 { 1962 1962 struct adv76xx_state *state = to_state(sd); ··· 1975 1975 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1976 1976 struct v4l2_mbus_framefmt *fmt; 1977 1977 1978 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 1978 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 1979 1979 fmt->code = format->format.code; 1980 1980 } else { 1981 1981 state->format = info;
+6 -6
drivers/media/i2c/adv7842.c
··· 1993 1993 } 1994 1994 1995 1995 static int adv7842_enum_mbus_code(struct v4l2_subdev *sd, 1996 - struct v4l2_subdev_pad_config *cfg, 1996 + struct v4l2_subdev_state *sd_state, 1997 1997 struct v4l2_subdev_mbus_code_enum *code) 1998 1998 { 1999 1999 if (code->index >= ARRAY_SIZE(adv7842_formats)) ··· 2069 2069 } 2070 2070 2071 2071 static int adv7842_get_format(struct v4l2_subdev *sd, 2072 - struct v4l2_subdev_pad_config *cfg, 2072 + struct v4l2_subdev_state *sd_state, 2073 2073 struct v4l2_subdev_format *format) 2074 2074 { 2075 2075 struct adv7842_state *state = to_state(sd); ··· 2097 2097 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 2098 2098 struct v4l2_mbus_framefmt *fmt; 2099 2099 2100 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 2100 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 2101 2101 format->format.code = fmt->code; 2102 2102 } else { 2103 2103 format->format.code = state->format->code; ··· 2107 2107 } 2108 2108 2109 2109 static int adv7842_set_format(struct v4l2_subdev *sd, 2110 - struct v4l2_subdev_pad_config *cfg, 2110 + struct v4l2_subdev_state *sd_state, 2111 2111 struct v4l2_subdev_format *format) 2112 2112 { 2113 2113 struct adv7842_state *state = to_state(sd); ··· 2117 2117 return -EINVAL; 2118 2118 2119 2119 if (state->mode == ADV7842_MODE_SDP) 2120 - return adv7842_get_format(sd, cfg, format); 2120 + return adv7842_get_format(sd, sd_state, format); 2121 2121 2122 2122 info = adv7842_format_info(state, format->format.code); 2123 2123 if (info == NULL) ··· 2129 2129 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 2130 2130 struct v4l2_mbus_framefmt *fmt; 2131 2131 2132 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 2132 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 2133 2133 fmt->code = format->format.code; 2134 2134 } else { 2135 2135 state->format = info;
+3 -3
drivers/media/i2c/ak881x.c
··· 91 91 #endif 92 92 93 93 static int ak881x_fill_fmt(struct v4l2_subdev *sd, 94 - struct v4l2_subdev_pad_config *cfg, 94 + struct v4l2_subdev_state *sd_state, 95 95 struct v4l2_subdev_format *format) 96 96 { 97 97 struct v4l2_mbus_framefmt *mf = &format->format; ··· 111 111 } 112 112 113 113 static int ak881x_enum_mbus_code(struct v4l2_subdev *sd, 114 - struct v4l2_subdev_pad_config *cfg, 114 + struct v4l2_subdev_state *sd_state, 115 115 struct v4l2_subdev_mbus_code_enum *code) 116 116 { 117 117 if (code->pad || code->index) ··· 122 122 } 123 123 124 124 static int ak881x_get_selection(struct v4l2_subdev *sd, 125 - struct v4l2_subdev_pad_config *cfg, 125 + struct v4l2_subdev_state *sd_state, 126 126 struct v4l2_subdev_selection *sel) 127 127 { 128 128 struct i2c_client *client = v4l2_get_subdevdata(sd);
+44 -40
drivers/media/i2c/ccs/ccs-core.c
··· 1944 1944 } 1945 1945 1946 1946 static int ccs_enum_mbus_code(struct v4l2_subdev *subdev, 1947 - struct v4l2_subdev_pad_config *cfg, 1947 + struct v4l2_subdev_state *sd_state, 1948 1948 struct v4l2_subdev_mbus_code_enum *code) 1949 1949 { 1950 1950 struct i2c_client *client = v4l2_get_subdevdata(subdev); ··· 1997 1997 } 1998 1998 1999 1999 static int __ccs_get_format(struct v4l2_subdev *subdev, 2000 - struct v4l2_subdev_pad_config *cfg, 2000 + struct v4l2_subdev_state *sd_state, 2001 2001 struct v4l2_subdev_format *fmt) 2002 2002 { 2003 2003 struct ccs_subdev *ssd = to_ccs_subdev(subdev); 2004 2004 2005 2005 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 2006 - fmt->format = *v4l2_subdev_get_try_format(subdev, cfg, 2006 + fmt->format = *v4l2_subdev_get_try_format(subdev, sd_state, 2007 2007 fmt->pad); 2008 2008 } else { 2009 2009 struct v4l2_rect *r; ··· 2023 2023 } 2024 2024 2025 2025 static int ccs_get_format(struct v4l2_subdev *subdev, 2026 - struct v4l2_subdev_pad_config *cfg, 2026 + struct v4l2_subdev_state *sd_state, 2027 2027 struct v4l2_subdev_format *fmt) 2028 2028 { 2029 2029 struct ccs_sensor *sensor = to_ccs_sensor(subdev); 2030 2030 int rval; 2031 2031 2032 2032 mutex_lock(&sensor->mutex); 2033 - rval = __ccs_get_format(subdev, cfg, fmt); 2033 + rval = __ccs_get_format(subdev, sd_state, fmt); 2034 2034 mutex_unlock(&sensor->mutex); 2035 2035 2036 2036 return rval; 2037 2037 } 2038 2038 2039 2039 static void ccs_get_crop_compose(struct v4l2_subdev *subdev, 2040 - struct v4l2_subdev_pad_config *cfg, 2040 + struct v4l2_subdev_state *sd_state, 2041 2041 struct v4l2_rect **crops, 2042 2042 struct v4l2_rect **comps, int which) 2043 2043 { ··· 2054 2054 if (crops) { 2055 2055 for (i = 0; i < subdev->entity.num_pads; i++) 2056 2056 crops[i] = v4l2_subdev_get_try_crop(subdev, 2057 - cfg, i); 2057 + sd_state, 2058 + i); 2058 2059 } 2059 2060 if (comps) 2060 - *comps = v4l2_subdev_get_try_compose(subdev, cfg, 2061 + *comps = v4l2_subdev_get_try_compose(subdev, sd_state, 2061 2062 CCS_PAD_SINK); 2062 2063 } 2063 2064 } 2064 2065 2065 2066 /* Changes require propagation only on sink pad. */ 2066 2067 static void ccs_propagate(struct v4l2_subdev *subdev, 2067 - struct v4l2_subdev_pad_config *cfg, int which, 2068 + struct v4l2_subdev_state *sd_state, int which, 2068 2069 int target) 2069 2070 { 2070 2071 struct ccs_sensor *sensor = to_ccs_sensor(subdev); 2071 2072 struct ccs_subdev *ssd = to_ccs_subdev(subdev); 2072 2073 struct v4l2_rect *comp, *crops[CCS_PADS]; 2073 2074 2074 - ccs_get_crop_compose(subdev, cfg, crops, &comp, which); 2075 + ccs_get_crop_compose(subdev, sd_state, crops, &comp, which); 2075 2076 2076 2077 switch (target) { 2077 2078 case V4L2_SEL_TGT_CROP: ··· 2112 2111 } 2113 2112 2114 2113 static int ccs_set_format_source(struct v4l2_subdev *subdev, 2115 - struct v4l2_subdev_pad_config *cfg, 2114 + struct v4l2_subdev_state *sd_state, 2116 2115 struct v4l2_subdev_format *fmt) 2117 2116 { 2118 2117 struct ccs_sensor *sensor = to_ccs_sensor(subdev); ··· 2123 2122 unsigned int i; 2124 2123 int rval; 2125 2124 2126 - rval = __ccs_get_format(subdev, cfg, fmt); 2125 + rval = __ccs_get_format(subdev, sd_state, fmt); 2127 2126 if (rval) 2128 2127 return rval; 2129 2128 ··· 2165 2164 } 2166 2165 2167 2166 static int ccs_set_format(struct v4l2_subdev *subdev, 2168 - struct v4l2_subdev_pad_config *cfg, 2167 + struct v4l2_subdev_state *sd_state, 2169 2168 struct v4l2_subdev_format *fmt) 2170 2169 { 2171 2170 struct ccs_sensor *sensor = to_ccs_sensor(subdev); ··· 2177 2176 if (fmt->pad == ssd->source_pad) { 2178 2177 int rval; 2179 2178 2180 - rval = ccs_set_format_source(subdev, cfg, fmt); 2179 + rval = ccs_set_format_source(subdev, sd_state, fmt); 2181 2180 2182 2181 mutex_unlock(&sensor->mutex); 2183 2182 ··· 2199 2198 CCS_LIM(sensor, MIN_Y_OUTPUT_SIZE), 2200 2199 CCS_LIM(sensor, MAX_Y_OUTPUT_SIZE)); 2201 2200 2202 - ccs_get_crop_compose(subdev, cfg, crops, NULL, fmt->which); 2201 + ccs_get_crop_compose(subdev, sd_state, crops, NULL, fmt->which); 2203 2202 2204 2203 crops[ssd->sink_pad]->left = 0; 2205 2204 crops[ssd->sink_pad]->top = 0; ··· 2207 2206 crops[ssd->sink_pad]->height = fmt->format.height; 2208 2207 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) 2209 2208 ssd->sink_fmt = *crops[ssd->sink_pad]; 2210 - ccs_propagate(subdev, cfg, fmt->which, V4L2_SEL_TGT_CROP); 2209 + ccs_propagate(subdev, sd_state, fmt->which, V4L2_SEL_TGT_CROP); 2211 2210 2212 2211 mutex_unlock(&sensor->mutex); 2213 2212 ··· 2259 2258 } 2260 2259 2261 2260 static void ccs_set_compose_binner(struct v4l2_subdev *subdev, 2262 - struct v4l2_subdev_pad_config *cfg, 2261 + struct v4l2_subdev_state *sd_state, 2263 2262 struct v4l2_subdev_selection *sel, 2264 2263 struct v4l2_rect **crops, 2265 2264 struct v4l2_rect *comp) ··· 2307 2306 * result. 2308 2307 */ 2309 2308 static void ccs_set_compose_scaler(struct v4l2_subdev *subdev, 2310 - struct v4l2_subdev_pad_config *cfg, 2309 + struct v4l2_subdev_state *sd_state, 2311 2310 struct v4l2_subdev_selection *sel, 2312 2311 struct v4l2_rect **crops, 2313 2312 struct v4l2_rect *comp) ··· 2422 2421 } 2423 2422 /* We're only called on source pads. This function sets scaling. */ 2424 2423 static int ccs_set_compose(struct v4l2_subdev *subdev, 2425 - struct v4l2_subdev_pad_config *cfg, 2424 + struct v4l2_subdev_state *sd_state, 2426 2425 struct v4l2_subdev_selection *sel) 2427 2426 { 2428 2427 struct ccs_sensor *sensor = to_ccs_sensor(subdev); 2429 2428 struct ccs_subdev *ssd = to_ccs_subdev(subdev); 2430 2429 struct v4l2_rect *comp, *crops[CCS_PADS]; 2431 2430 2432 - ccs_get_crop_compose(subdev, cfg, crops, &comp, sel->which); 2431 + ccs_get_crop_compose(subdev, sd_state, crops, &comp, sel->which); 2433 2432 2434 2433 sel->r.top = 0; 2435 2434 sel->r.left = 0; 2436 2435 2437 2436 if (ssd == sensor->binner) 2438 - ccs_set_compose_binner(subdev, cfg, sel, crops, comp); 2437 + ccs_set_compose_binner(subdev, sd_state, sel, crops, comp); 2439 2438 else 2440 - ccs_set_compose_scaler(subdev, cfg, sel, crops, comp); 2439 + ccs_set_compose_scaler(subdev, sd_state, sel, crops, comp); 2441 2440 2442 2441 *comp = sel->r; 2443 - ccs_propagate(subdev, cfg, sel->which, V4L2_SEL_TGT_COMPOSE); 2442 + ccs_propagate(subdev, sd_state, sel->which, V4L2_SEL_TGT_COMPOSE); 2444 2443 2445 2444 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) 2446 2445 return ccs_pll_blanking_update(sensor); ··· 2487 2486 } 2488 2487 2489 2488 static int ccs_set_crop(struct v4l2_subdev *subdev, 2490 - struct v4l2_subdev_pad_config *cfg, 2489 + struct v4l2_subdev_state *sd_state, 2491 2490 struct v4l2_subdev_selection *sel) 2492 2491 { 2493 2492 struct ccs_sensor *sensor = to_ccs_sensor(subdev); ··· 2495 2494 struct v4l2_rect *src_size, *crops[CCS_PADS]; 2496 2495 struct v4l2_rect _r; 2497 2496 2498 - ccs_get_crop_compose(subdev, cfg, crops, NULL, sel->which); 2497 + ccs_get_crop_compose(subdev, sd_state, crops, NULL, sel->which); 2499 2498 2500 2499 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 2501 2500 if (sel->pad == ssd->sink_pad) ··· 2506 2505 if (sel->pad == ssd->sink_pad) { 2507 2506 _r.left = 0; 2508 2507 _r.top = 0; 2509 - _r.width = v4l2_subdev_get_try_format(subdev, cfg, 2508 + _r.width = v4l2_subdev_get_try_format(subdev, 2509 + sd_state, 2510 2510 sel->pad) 2511 2511 ->width; 2512 - _r.height = v4l2_subdev_get_try_format(subdev, cfg, 2512 + _r.height = v4l2_subdev_get_try_format(subdev, 2513 + sd_state, 2513 2514 sel->pad) 2514 2515 ->height; 2515 2516 src_size = &_r; 2516 2517 } else { 2517 2518 src_size = v4l2_subdev_get_try_compose( 2518 - subdev, cfg, ssd->sink_pad); 2519 + subdev, sd_state, ssd->sink_pad); 2519 2520 } 2520 2521 } 2521 2522 ··· 2535 2532 *crops[sel->pad] = sel->r; 2536 2533 2537 2534 if (ssd != sensor->pixel_array && sel->pad == CCS_PAD_SINK) 2538 - ccs_propagate(subdev, cfg, sel->which, V4L2_SEL_TGT_CROP); 2535 + ccs_propagate(subdev, sd_state, sel->which, V4L2_SEL_TGT_CROP); 2539 2536 2540 2537 return 0; 2541 2538 } ··· 2549 2546 } 2550 2547 2551 2548 static int __ccs_get_selection(struct v4l2_subdev *subdev, 2552 - struct v4l2_subdev_pad_config *cfg, 2549 + struct v4l2_subdev_state *sd_state, 2553 2550 struct v4l2_subdev_selection *sel) 2554 2551 { 2555 2552 struct ccs_sensor *sensor = to_ccs_sensor(subdev); ··· 2562 2559 if (ret) 2563 2560 return ret; 2564 2561 2565 - ccs_get_crop_compose(subdev, cfg, crops, &comp, sel->which); 2562 + ccs_get_crop_compose(subdev, sd_state, crops, &comp, sel->which); 2566 2563 2567 2564 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 2568 2565 sink_fmt = ssd->sink_fmt; 2569 2566 } else { 2570 2567 struct v4l2_mbus_framefmt *fmt = 2571 - v4l2_subdev_get_try_format(subdev, cfg, ssd->sink_pad); 2568 + v4l2_subdev_get_try_format(subdev, sd_state, 2569 + ssd->sink_pad); 2572 2570 2573 2571 sink_fmt.left = 0; 2574 2572 sink_fmt.top = 0; ··· 2600 2596 } 2601 2597 2602 2598 static int ccs_get_selection(struct v4l2_subdev *subdev, 2603 - struct v4l2_subdev_pad_config *cfg, 2599 + struct v4l2_subdev_state *sd_state, 2604 2600 struct v4l2_subdev_selection *sel) 2605 2601 { 2606 2602 struct ccs_sensor *sensor = to_ccs_sensor(subdev); 2607 2603 int rval; 2608 2604 2609 2605 mutex_lock(&sensor->mutex); 2610 - rval = __ccs_get_selection(subdev, cfg, sel); 2606 + rval = __ccs_get_selection(subdev, sd_state, sel); 2611 2607 mutex_unlock(&sensor->mutex); 2612 2608 2613 2609 return rval; 2614 2610 } 2615 2611 2616 2612 static int ccs_set_selection(struct v4l2_subdev *subdev, 2617 - struct v4l2_subdev_pad_config *cfg, 2613 + struct v4l2_subdev_state *sd_state, 2618 2614 struct v4l2_subdev_selection *sel) 2619 2615 { 2620 2616 struct ccs_sensor *sensor = to_ccs_sensor(subdev); ··· 2638 2634 2639 2635 switch (sel->target) { 2640 2636 case V4L2_SEL_TGT_CROP: 2641 - ret = ccs_set_crop(subdev, cfg, sel); 2637 + ret = ccs_set_crop(subdev, sd_state, sel); 2642 2638 break; 2643 2639 case V4L2_SEL_TGT_COMPOSE: 2644 - ret = ccs_set_compose(subdev, cfg, sel); 2640 + ret = ccs_set_compose(subdev, sd_state, sel); 2645 2641 break; 2646 2642 default: 2647 2643 ret = -EINVAL; ··· 3032 3028 3033 3029 for (i = 0; i < ssd->npads; i++) { 3034 3030 struct v4l2_mbus_framefmt *try_fmt = 3035 - v4l2_subdev_get_try_format(sd, fh->pad, i); 3031 + v4l2_subdev_get_try_format(sd, fh->state, i); 3036 3032 struct v4l2_rect *try_crop = 3037 - v4l2_subdev_get_try_crop(sd, fh->pad, i); 3033 + v4l2_subdev_get_try_crop(sd, fh->state, i); 3038 3034 struct v4l2_rect *try_comp; 3039 3035 3040 3036 ccs_get_native_size(ssd, try_crop); ··· 3047 3043 if (ssd != sensor->pixel_array) 3048 3044 continue; 3049 3045 3050 - try_comp = v4l2_subdev_get_try_compose(sd, fh->pad, i); 3046 + try_comp = v4l2_subdev_get_try_compose(sd, fh->state, i); 3051 3047 *try_comp = *try_crop; 3052 3048 } 3053 3049
+1 -1
drivers/media/i2c/cx25840/cx25840-core.c
··· 1746 1746 /* ----------------------------------------------------------------------- */ 1747 1747 1748 1748 static int cx25840_set_fmt(struct v4l2_subdev *sd, 1749 - struct v4l2_subdev_pad_config *cfg, 1749 + struct v4l2_subdev_state *sd_state, 1750 1750 struct v4l2_subdev_format *format) 1751 1751 { 1752 1752 struct v4l2_mbus_framefmt *fmt = &format->format;
+13 -10
drivers/media/i2c/et8ek8/et8ek8_driver.c
··· 882 882 */ 883 883 #define MAX_FMTS 4 884 884 static int et8ek8_enum_mbus_code(struct v4l2_subdev *subdev, 885 - struct v4l2_subdev_pad_config *cfg, 885 + struct v4l2_subdev_state *sd_state, 886 886 struct v4l2_subdev_mbus_code_enum *code) 887 887 { 888 888 struct et8ek8_reglist **list = ··· 920 920 } 921 921 922 922 static int et8ek8_enum_frame_size(struct v4l2_subdev *subdev, 923 - struct v4l2_subdev_pad_config *cfg, 923 + struct v4l2_subdev_state *sd_state, 924 924 struct v4l2_subdev_frame_size_enum *fse) 925 925 { 926 926 struct et8ek8_reglist **list = ··· 958 958 } 959 959 960 960 static int et8ek8_enum_frame_ival(struct v4l2_subdev *subdev, 961 - struct v4l2_subdev_pad_config *cfg, 961 + struct v4l2_subdev_state *sd_state, 962 962 struct v4l2_subdev_frame_interval_enum *fie) 963 963 { 964 964 struct et8ek8_reglist **list = ··· 990 990 991 991 static struct v4l2_mbus_framefmt * 992 992 __et8ek8_get_pad_format(struct et8ek8_sensor *sensor, 993 - struct v4l2_subdev_pad_config *cfg, 993 + struct v4l2_subdev_state *sd_state, 994 994 unsigned int pad, enum v4l2_subdev_format_whence which) 995 995 { 996 996 switch (which) { 997 997 case V4L2_SUBDEV_FORMAT_TRY: 998 - return v4l2_subdev_get_try_format(&sensor->subdev, cfg, pad); 998 + return v4l2_subdev_get_try_format(&sensor->subdev, sd_state, 999 + pad); 999 1000 case V4L2_SUBDEV_FORMAT_ACTIVE: 1000 1001 return &sensor->format; 1001 1002 default: ··· 1005 1004 } 1006 1005 1007 1006 static int et8ek8_get_pad_format(struct v4l2_subdev *subdev, 1008 - struct v4l2_subdev_pad_config *cfg, 1007 + struct v4l2_subdev_state *sd_state, 1009 1008 struct v4l2_subdev_format *fmt) 1010 1009 { 1011 1010 struct et8ek8_sensor *sensor = to_et8ek8_sensor(subdev); 1012 1011 struct v4l2_mbus_framefmt *format; 1013 1012 1014 - format = __et8ek8_get_pad_format(sensor, cfg, fmt->pad, fmt->which); 1013 + format = __et8ek8_get_pad_format(sensor, sd_state, fmt->pad, 1014 + fmt->which); 1015 1015 if (!format) 1016 1016 return -EINVAL; 1017 1017 ··· 1022 1020 } 1023 1021 1024 1022 static int et8ek8_set_pad_format(struct v4l2_subdev *subdev, 1025 - struct v4l2_subdev_pad_config *cfg, 1023 + struct v4l2_subdev_state *sd_state, 1026 1024 struct v4l2_subdev_format *fmt) 1027 1025 { 1028 1026 struct et8ek8_sensor *sensor = to_et8ek8_sensor(subdev); 1029 1027 struct v4l2_mbus_framefmt *format; 1030 1028 struct et8ek8_reglist *reglist; 1031 1029 1032 - format = __et8ek8_get_pad_format(sensor, cfg, fmt->pad, fmt->which); 1030 + format = __et8ek8_get_pad_format(sensor, sd_state, fmt->pad, 1031 + fmt->which); 1033 1032 if (!format) 1034 1033 return -EINVAL; 1035 1034 ··· 1330 1327 struct et8ek8_reglist *reglist; 1331 1328 1332 1329 reglist = et8ek8_reglist_find_type(&meta_reglist, ET8EK8_REGLIST_MODE); 1333 - format = __et8ek8_get_pad_format(sensor, fh->pad, 0, 1330 + format = __et8ek8_get_pad_format(sensor, fh->state, 0, 1334 1331 V4L2_SUBDEV_FORMAT_TRY); 1335 1332 et8ek8_reglist_to_mbus(reglist, format); 1336 1333
+8 -7
drivers/media/i2c/hi556.c
··· 875 875 } 876 876 877 877 static int hi556_set_format(struct v4l2_subdev *sd, 878 - struct v4l2_subdev_pad_config *cfg, 878 + struct v4l2_subdev_state *sd_state, 879 879 struct v4l2_subdev_format *fmt) 880 880 { 881 881 struct hi556 *hi556 = to_hi556(sd); ··· 890 890 mutex_lock(&hi556->mutex); 891 891 hi556_assign_pad_format(mode, &fmt->format); 892 892 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 893 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 893 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 894 894 } else { 895 895 hi556->cur_mode = mode; 896 896 __v4l2_ctrl_s_ctrl(hi556->link_freq, mode->link_freq_index); ··· 917 917 } 918 918 919 919 static int hi556_get_format(struct v4l2_subdev *sd, 920 - struct v4l2_subdev_pad_config *cfg, 920 + struct v4l2_subdev_state *sd_state, 921 921 struct v4l2_subdev_format *fmt) 922 922 { 923 923 struct hi556 *hi556 = to_hi556(sd); 924 924 925 925 mutex_lock(&hi556->mutex); 926 926 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 927 - fmt->format = *v4l2_subdev_get_try_format(&hi556->sd, cfg, 927 + fmt->format = *v4l2_subdev_get_try_format(&hi556->sd, 928 + sd_state, 928 929 fmt->pad); 929 930 else 930 931 hi556_assign_pad_format(hi556->cur_mode, &fmt->format); ··· 936 935 } 937 936 938 937 static int hi556_enum_mbus_code(struct v4l2_subdev *sd, 939 - struct v4l2_subdev_pad_config *cfg, 938 + struct v4l2_subdev_state *sd_state, 940 939 struct v4l2_subdev_mbus_code_enum *code) 941 940 { 942 941 if (code->index > 0) ··· 948 947 } 949 948 950 949 static int hi556_enum_frame_size(struct v4l2_subdev *sd, 951 - struct v4l2_subdev_pad_config *cfg, 950 + struct v4l2_subdev_state *sd_state, 952 951 struct v4l2_subdev_frame_size_enum *fse) 953 952 { 954 953 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 971 970 972 971 mutex_lock(&hi556->mutex); 973 972 hi556_assign_pad_format(&supported_modes[0], 974 - v4l2_subdev_get_try_format(sd, fh->pad, 0)); 973 + v4l2_subdev_get_try_format(sd, fh->state, 0)); 975 974 mutex_unlock(&hi556->mutex); 976 975 977 976 return 0;
+10 -9
drivers/media/i2c/imx208.c
··· 395 395 static int imx208_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 396 396 { 397 397 struct v4l2_mbus_framefmt *try_fmt = 398 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 398 + v4l2_subdev_get_try_format(sd, fh->state, 0); 399 399 400 400 /* Initialize try_fmt */ 401 401 try_fmt->width = supported_modes[0].width; ··· 500 500 }; 501 501 502 502 static int imx208_enum_mbus_code(struct v4l2_subdev *sd, 503 - struct v4l2_subdev_pad_config *cfg, 503 + struct v4l2_subdev_state *sd_state, 504 504 struct v4l2_subdev_mbus_code_enum *code) 505 505 { 506 506 struct imx208 *imx208 = to_imx208(sd); ··· 514 514 } 515 515 516 516 static int imx208_enum_frame_size(struct v4l2_subdev *sd, 517 - struct v4l2_subdev_pad_config *cfg, 517 + struct v4l2_subdev_state *sd_state, 518 518 struct v4l2_subdev_frame_size_enum *fse) 519 519 { 520 520 struct imx208 *imx208 = to_imx208(sd); ··· 544 544 } 545 545 546 546 static int __imx208_get_pad_format(struct imx208 *imx208, 547 - struct v4l2_subdev_pad_config *cfg, 547 + struct v4l2_subdev_state *sd_state, 548 548 struct v4l2_subdev_format *fmt) 549 549 { 550 550 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 551 - fmt->format = *v4l2_subdev_get_try_format(&imx208->sd, cfg, 551 + fmt->format = *v4l2_subdev_get_try_format(&imx208->sd, 552 + sd_state, 552 553 fmt->pad); 553 554 else 554 555 imx208_mode_to_pad_format(imx208, imx208->cur_mode, fmt); ··· 558 557 } 559 558 560 559 static int imx208_get_pad_format(struct v4l2_subdev *sd, 561 - struct v4l2_subdev_pad_config *cfg, 560 + struct v4l2_subdev_state *sd_state, 562 561 struct v4l2_subdev_format *fmt) 563 562 { 564 563 struct imx208 *imx208 = to_imx208(sd); 565 564 int ret; 566 565 567 566 mutex_lock(&imx208->imx208_mx); 568 - ret = __imx208_get_pad_format(imx208, cfg, fmt); 567 + ret = __imx208_get_pad_format(imx208, sd_state, fmt); 569 568 mutex_unlock(&imx208->imx208_mx); 570 569 571 570 return ret; 572 571 } 573 572 574 573 static int imx208_set_pad_format(struct v4l2_subdev *sd, 575 - struct v4l2_subdev_pad_config *cfg, 574 + struct v4l2_subdev_state *sd_state, 576 575 struct v4l2_subdev_format *fmt) 577 576 { 578 577 struct imx208 *imx208 = to_imx208(sd); ··· 591 590 fmt->format.width, fmt->format.height); 592 591 imx208_mode_to_pad_format(imx208, mode, fmt); 593 592 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 594 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 593 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 595 594 } else { 596 595 imx208->cur_mode = mode; 597 596 __v4l2_ctrl_s_ctrl(imx208->link_freq, mode->link_freq_index);
+20 -17
drivers/media/i2c/imx214.c
··· 474 474 } 475 475 476 476 static int imx214_enum_mbus_code(struct v4l2_subdev *sd, 477 - struct v4l2_subdev_pad_config *cfg, 477 + struct v4l2_subdev_state *sd_state, 478 478 struct v4l2_subdev_mbus_code_enum *code) 479 479 { 480 480 if (code->index > 0) ··· 486 486 } 487 487 488 488 static int imx214_enum_frame_size(struct v4l2_subdev *subdev, 489 - struct v4l2_subdev_pad_config *cfg, 489 + struct v4l2_subdev_state *sd_state, 490 490 struct v4l2_subdev_frame_size_enum *fse) 491 491 { 492 492 if (fse->code != IMX214_MBUS_CODE) ··· 534 534 535 535 static struct v4l2_mbus_framefmt * 536 536 __imx214_get_pad_format(struct imx214 *imx214, 537 - struct v4l2_subdev_pad_config *cfg, 537 + struct v4l2_subdev_state *sd_state, 538 538 unsigned int pad, 539 539 enum v4l2_subdev_format_whence which) 540 540 { 541 541 switch (which) { 542 542 case V4L2_SUBDEV_FORMAT_TRY: 543 - return v4l2_subdev_get_try_format(&imx214->sd, cfg, pad); 543 + return v4l2_subdev_get_try_format(&imx214->sd, sd_state, pad); 544 544 case V4L2_SUBDEV_FORMAT_ACTIVE: 545 545 return &imx214->fmt; 546 546 default: ··· 549 549 } 550 550 551 551 static int imx214_get_format(struct v4l2_subdev *sd, 552 - struct v4l2_subdev_pad_config *cfg, 552 + struct v4l2_subdev_state *sd_state, 553 553 struct v4l2_subdev_format *format) 554 554 { 555 555 struct imx214 *imx214 = to_imx214(sd); 556 556 557 557 mutex_lock(&imx214->mutex); 558 - format->format = *__imx214_get_pad_format(imx214, cfg, format->pad, 558 + format->format = *__imx214_get_pad_format(imx214, sd_state, 559 + format->pad, 559 560 format->which); 560 561 mutex_unlock(&imx214->mutex); 561 562 ··· 564 563 } 565 564 566 565 static struct v4l2_rect * 567 - __imx214_get_pad_crop(struct imx214 *imx214, struct v4l2_subdev_pad_config *cfg, 566 + __imx214_get_pad_crop(struct imx214 *imx214, 567 + struct v4l2_subdev_state *sd_state, 568 568 unsigned int pad, enum v4l2_subdev_format_whence which) 569 569 { 570 570 switch (which) { 571 571 case V4L2_SUBDEV_FORMAT_TRY: 572 - return v4l2_subdev_get_try_crop(&imx214->sd, cfg, pad); 572 + return v4l2_subdev_get_try_crop(&imx214->sd, sd_state, pad); 573 573 case V4L2_SUBDEV_FORMAT_ACTIVE: 574 574 return &imx214->crop; 575 575 default: ··· 579 577 } 580 578 581 579 static int imx214_set_format(struct v4l2_subdev *sd, 582 - struct v4l2_subdev_pad_config *cfg, 580 + struct v4l2_subdev_state *sd_state, 583 581 struct v4l2_subdev_format *format) 584 582 { 585 583 struct imx214 *imx214 = to_imx214(sd); ··· 589 587 590 588 mutex_lock(&imx214->mutex); 591 589 592 - __crop = __imx214_get_pad_crop(imx214, cfg, format->pad, format->which); 590 + __crop = __imx214_get_pad_crop(imx214, sd_state, format->pad, 591 + format->which); 593 592 594 593 mode = v4l2_find_nearest_size(imx214_modes, 595 594 ARRAY_SIZE(imx214_modes), width, height, ··· 600 597 __crop->width = mode->width; 601 598 __crop->height = mode->height; 602 599 603 - __format = __imx214_get_pad_format(imx214, cfg, format->pad, 600 + __format = __imx214_get_pad_format(imx214, sd_state, format->pad, 604 601 format->which); 605 602 __format->width = __crop->width; 606 603 __format->height = __crop->height; ··· 620 617 } 621 618 622 619 static int imx214_get_selection(struct v4l2_subdev *sd, 623 - struct v4l2_subdev_pad_config *cfg, 620 + struct v4l2_subdev_state *sd_state, 624 621 struct v4l2_subdev_selection *sel) 625 622 { 626 623 struct imx214 *imx214 = to_imx214(sd); ··· 629 626 return -EINVAL; 630 627 631 628 mutex_lock(&imx214->mutex); 632 - sel->r = *__imx214_get_pad_crop(imx214, cfg, sel->pad, 629 + sel->r = *__imx214_get_pad_crop(imx214, sd_state, sel->pad, 633 630 sel->which); 634 631 mutex_unlock(&imx214->mutex); 635 632 return 0; 636 633 } 637 634 638 635 static int imx214_entity_init_cfg(struct v4l2_subdev *subdev, 639 - struct v4l2_subdev_pad_config *cfg) 636 + struct v4l2_subdev_state *sd_state) 640 637 { 641 638 struct v4l2_subdev_format fmt = { }; 642 639 643 - fmt.which = cfg ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 640 + fmt.which = sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 644 641 fmt.format.width = imx214_modes[0].width; 645 642 fmt.format.height = imx214_modes[0].height; 646 643 647 - imx214_set_format(subdev, cfg, &fmt); 644 + imx214_set_format(subdev, sd_state, &fmt); 648 645 649 646 return 0; 650 647 } ··· 811 808 } 812 809 813 810 static int imx214_enum_frame_interval(struct v4l2_subdev *subdev, 814 - struct v4l2_subdev_pad_config *cfg, 811 + struct v4l2_subdev_state *sd_state, 815 812 struct v4l2_subdev_frame_interval_enum *fie) 816 813 { 817 814 const struct imx214_mode *mode;
+16 -14
drivers/media/i2c/imx219.c
··· 689 689 { 690 690 struct imx219 *imx219 = to_imx219(sd); 691 691 struct v4l2_mbus_framefmt *try_fmt = 692 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 692 + v4l2_subdev_get_try_format(sd, fh->state, 0); 693 693 struct v4l2_rect *try_crop; 694 694 695 695 mutex_lock(&imx219->mutex); ··· 702 702 try_fmt->field = V4L2_FIELD_NONE; 703 703 704 704 /* Initialize try_crop rectangle. */ 705 - try_crop = v4l2_subdev_get_try_crop(sd, fh->pad, 0); 705 + try_crop = v4l2_subdev_get_try_crop(sd, fh->state, 0); 706 706 try_crop->top = IMX219_PIXEL_ARRAY_TOP; 707 707 try_crop->left = IMX219_PIXEL_ARRAY_LEFT; 708 708 try_crop->width = IMX219_PIXEL_ARRAY_WIDTH; ··· 803 803 }; 804 804 805 805 static int imx219_enum_mbus_code(struct v4l2_subdev *sd, 806 - struct v4l2_subdev_pad_config *cfg, 806 + struct v4l2_subdev_state *sd_state, 807 807 struct v4l2_subdev_mbus_code_enum *code) 808 808 { 809 809 struct imx219 *imx219 = to_imx219(sd); ··· 819 819 } 820 820 821 821 static int imx219_enum_frame_size(struct v4l2_subdev *sd, 822 - struct v4l2_subdev_pad_config *cfg, 822 + struct v4l2_subdev_state *sd_state, 823 823 struct v4l2_subdev_frame_size_enum *fse) 824 824 { 825 825 struct imx219 *imx219 = to_imx219(sd); ··· 863 863 } 864 864 865 865 static int __imx219_get_pad_format(struct imx219 *imx219, 866 - struct v4l2_subdev_pad_config *cfg, 866 + struct v4l2_subdev_state *sd_state, 867 867 struct v4l2_subdev_format *fmt) 868 868 { 869 869 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 870 870 struct v4l2_mbus_framefmt *try_fmt = 871 - v4l2_subdev_get_try_format(&imx219->sd, cfg, fmt->pad); 871 + v4l2_subdev_get_try_format(&imx219->sd, sd_state, 872 + fmt->pad); 872 873 /* update the code which could change due to vflip or hflip: */ 873 874 try_fmt->code = imx219_get_format_code(imx219, try_fmt->code); 874 875 fmt->format = *try_fmt; ··· 883 882 } 884 883 885 884 static int imx219_get_pad_format(struct v4l2_subdev *sd, 886 - struct v4l2_subdev_pad_config *cfg, 885 + struct v4l2_subdev_state *sd_state, 887 886 struct v4l2_subdev_format *fmt) 888 887 { 889 888 struct imx219 *imx219 = to_imx219(sd); 890 889 int ret; 891 890 892 891 mutex_lock(&imx219->mutex); 893 - ret = __imx219_get_pad_format(imx219, cfg, fmt); 892 + ret = __imx219_get_pad_format(imx219, sd_state, fmt); 894 893 mutex_unlock(&imx219->mutex); 895 894 896 895 return ret; 897 896 } 898 897 899 898 static int imx219_set_pad_format(struct v4l2_subdev *sd, 900 - struct v4l2_subdev_pad_config *cfg, 899 + struct v4l2_subdev_state *sd_state, 901 900 struct v4l2_subdev_format *fmt) 902 901 { 903 902 struct imx219 *imx219 = to_imx219(sd); ··· 923 922 fmt->format.width, fmt->format.height); 924 923 imx219_update_pad_format(imx219, mode, fmt); 925 924 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 926 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 925 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 927 926 *framefmt = fmt->format; 928 927 } else if (imx219->mode != mode || 929 928 imx219->fmt.code != fmt->format.code) { ··· 980 979 } 981 980 982 981 static const struct v4l2_rect * 983 - __imx219_get_pad_crop(struct imx219 *imx219, struct v4l2_subdev_pad_config *cfg, 982 + __imx219_get_pad_crop(struct imx219 *imx219, 983 + struct v4l2_subdev_state *sd_state, 984 984 unsigned int pad, enum v4l2_subdev_format_whence which) 985 985 { 986 986 switch (which) { 987 987 case V4L2_SUBDEV_FORMAT_TRY: 988 - return v4l2_subdev_get_try_crop(&imx219->sd, cfg, pad); 988 + return v4l2_subdev_get_try_crop(&imx219->sd, sd_state, pad); 989 989 case V4L2_SUBDEV_FORMAT_ACTIVE: 990 990 return &imx219->mode->crop; 991 991 } ··· 995 993 } 996 994 997 995 static int imx219_get_selection(struct v4l2_subdev *sd, 998 - struct v4l2_subdev_pad_config *cfg, 996 + struct v4l2_subdev_state *sd_state, 999 997 struct v4l2_subdev_selection *sel) 1000 998 { 1001 999 switch (sel->target) { ··· 1003 1001 struct imx219 *imx219 = to_imx219(sd); 1004 1002 1005 1003 mutex_lock(&imx219->mutex); 1006 - sel->r = *__imx219_get_pad_crop(imx219, cfg, sel->pad, 1004 + sel->r = *__imx219_get_pad_crop(imx219, sd_state, sel->pad, 1007 1005 sel->which); 1008 1006 mutex_unlock(&imx219->mutex); 1009 1007
+10 -9
drivers/media/i2c/imx258.c
··· 710 710 static int imx258_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 711 711 { 712 712 struct v4l2_mbus_framefmt *try_fmt = 713 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 713 + v4l2_subdev_get_try_format(sd, fh->state, 0); 714 714 715 715 /* Initialize try_fmt */ 716 716 try_fmt->width = supported_modes[0].width; ··· 820 820 }; 821 821 822 822 static int imx258_enum_mbus_code(struct v4l2_subdev *sd, 823 - struct v4l2_subdev_pad_config *cfg, 823 + struct v4l2_subdev_state *sd_state, 824 824 struct v4l2_subdev_mbus_code_enum *code) 825 825 { 826 826 /* Only one bayer order(GRBG) is supported */ ··· 833 833 } 834 834 835 835 static int imx258_enum_frame_size(struct v4l2_subdev *sd, 836 - struct v4l2_subdev_pad_config *cfg, 836 + struct v4l2_subdev_state *sd_state, 837 837 struct v4l2_subdev_frame_size_enum *fse) 838 838 { 839 839 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 860 860 } 861 861 862 862 static int __imx258_get_pad_format(struct imx258 *imx258, 863 - struct v4l2_subdev_pad_config *cfg, 863 + struct v4l2_subdev_state *sd_state, 864 864 struct v4l2_subdev_format *fmt) 865 865 { 866 866 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 867 - fmt->format = *v4l2_subdev_get_try_format(&imx258->sd, cfg, 867 + fmt->format = *v4l2_subdev_get_try_format(&imx258->sd, 868 + sd_state, 868 869 fmt->pad); 869 870 else 870 871 imx258_update_pad_format(imx258->cur_mode, fmt); ··· 874 873 } 875 874 876 875 static int imx258_get_pad_format(struct v4l2_subdev *sd, 877 - struct v4l2_subdev_pad_config *cfg, 876 + struct v4l2_subdev_state *sd_state, 878 877 struct v4l2_subdev_format *fmt) 879 878 { 880 879 struct imx258 *imx258 = to_imx258(sd); 881 880 int ret; 882 881 883 882 mutex_lock(&imx258->mutex); 884 - ret = __imx258_get_pad_format(imx258, cfg, fmt); 883 + ret = __imx258_get_pad_format(imx258, sd_state, fmt); 885 884 mutex_unlock(&imx258->mutex); 886 885 887 886 return ret; 888 887 } 889 888 890 889 static int imx258_set_pad_format(struct v4l2_subdev *sd, 891 - struct v4l2_subdev_pad_config *cfg, 890 + struct v4l2_subdev_state *sd_state, 892 891 struct v4l2_subdev_format *fmt) 893 892 { 894 893 struct imx258 *imx258 = to_imx258(sd); ··· 910 909 fmt->format.width, fmt->format.height); 911 910 imx258_update_pad_format(mode, fmt); 912 911 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 913 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 912 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 914 913 *framefmt = fmt->format; 915 914 } else { 916 915 imx258->cur_mode = mode;
+19 -19
drivers/media/i2c/imx274.c
··· 996 996 * Must be called with imx274->lock locked. 997 997 * 998 998 * @imx274: The device object 999 - * @cfg: The pad config we are editing for TRY requests 999 + * @sd_state: The subdev state we are editing for TRY requests 1000 1000 * @which: V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY from the caller 1001 1001 * @width: Input-output parameter: set to the desired width before 1002 1002 * the call, contains the chosen value after returning successfully ··· 1005 1005 * available (when called from set_fmt) 1006 1006 */ 1007 1007 static int __imx274_change_compose(struct stimx274 *imx274, 1008 - struct v4l2_subdev_pad_config *cfg, 1008 + struct v4l2_subdev_state *sd_state, 1009 1009 u32 which, 1010 1010 u32 *width, 1011 1011 u32 *height, ··· 1019 1019 int best_goodness = INT_MIN; 1020 1020 1021 1021 if (which == V4L2_SUBDEV_FORMAT_TRY) { 1022 - cur_crop = &cfg->try_crop; 1023 - tgt_fmt = &cfg->try_fmt; 1022 + cur_crop = &sd_state->pads->try_crop; 1023 + tgt_fmt = &sd_state->pads->try_fmt; 1024 1024 } else { 1025 1025 cur_crop = &imx274->crop; 1026 1026 tgt_fmt = &imx274->format; ··· 1061 1061 /** 1062 1062 * imx274_get_fmt - Get the pad format 1063 1063 * @sd: Pointer to V4L2 Sub device structure 1064 - * @cfg: Pointer to sub device pad information structure 1064 + * @sd_state: Pointer to sub device state structure 1065 1065 * @fmt: Pointer to pad level media bus format 1066 1066 * 1067 1067 * This function is used to get the pad format information. ··· 1069 1069 * Return: 0 on success 1070 1070 */ 1071 1071 static int imx274_get_fmt(struct v4l2_subdev *sd, 1072 - struct v4l2_subdev_pad_config *cfg, 1072 + struct v4l2_subdev_state *sd_state, 1073 1073 struct v4l2_subdev_format *fmt) 1074 1074 { 1075 1075 struct stimx274 *imx274 = to_imx274(sd); ··· 1083 1083 /** 1084 1084 * imx274_set_fmt - This is used to set the pad format 1085 1085 * @sd: Pointer to V4L2 Sub device structure 1086 - * @cfg: Pointer to sub device pad information structure 1086 + * @sd_state: Pointer to sub device state information structure 1087 1087 * @format: Pointer to pad level media bus format 1088 1088 * 1089 1089 * This function is used to set the pad format. ··· 1091 1091 * Return: 0 on success 1092 1092 */ 1093 1093 static int imx274_set_fmt(struct v4l2_subdev *sd, 1094 - struct v4l2_subdev_pad_config *cfg, 1094 + struct v4l2_subdev_state *sd_state, 1095 1095 struct v4l2_subdev_format *format) 1096 1096 { 1097 1097 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 1100 1100 1101 1101 mutex_lock(&imx274->lock); 1102 1102 1103 - err = __imx274_change_compose(imx274, cfg, format->which, 1103 + err = __imx274_change_compose(imx274, sd_state, format->which, 1104 1104 &fmt->width, &fmt->height, 0); 1105 1105 1106 1106 if (err) ··· 1113 1113 */ 1114 1114 fmt->field = V4L2_FIELD_NONE; 1115 1115 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 1116 - cfg->try_fmt = *fmt; 1116 + sd_state->pads->try_fmt = *fmt; 1117 1117 else 1118 1118 imx274->format = *fmt; 1119 1119 ··· 1124 1124 } 1125 1125 1126 1126 static int imx274_get_selection(struct v4l2_subdev *sd, 1127 - struct v4l2_subdev_pad_config *cfg, 1127 + struct v4l2_subdev_state *sd_state, 1128 1128 struct v4l2_subdev_selection *sel) 1129 1129 { 1130 1130 struct stimx274 *imx274 = to_imx274(sd); ··· 1144 1144 } 1145 1145 1146 1146 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1147 - src_crop = &cfg->try_crop; 1148 - src_fmt = &cfg->try_fmt; 1147 + src_crop = &sd_state->pads->try_crop; 1148 + src_fmt = &sd_state->pads->try_fmt; 1149 1149 } else { 1150 1150 src_crop = &imx274->crop; 1151 1151 src_fmt = &imx274->format; ··· 1179 1179 } 1180 1180 1181 1181 static int imx274_set_selection_crop(struct stimx274 *imx274, 1182 - struct v4l2_subdev_pad_config *cfg, 1182 + struct v4l2_subdev_state *sd_state, 1183 1183 struct v4l2_subdev_selection *sel) 1184 1184 { 1185 1185 struct v4l2_rect *tgt_crop; ··· 1216 1216 sel->r = new_crop; 1217 1217 1218 1218 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) 1219 - tgt_crop = &cfg->try_crop; 1219 + tgt_crop = &sd_state->pads->try_crop; 1220 1220 else 1221 1221 tgt_crop = &imx274->crop; 1222 1222 ··· 1230 1230 1231 1231 /* if crop size changed then reset the output image size */ 1232 1232 if (size_changed) 1233 - __imx274_change_compose(imx274, cfg, sel->which, 1233 + __imx274_change_compose(imx274, sd_state, sel->which, 1234 1234 &new_crop.width, &new_crop.height, 1235 1235 sel->flags); 1236 1236 ··· 1240 1240 } 1241 1241 1242 1242 static int imx274_set_selection(struct v4l2_subdev *sd, 1243 - struct v4l2_subdev_pad_config *cfg, 1243 + struct v4l2_subdev_state *sd_state, 1244 1244 struct v4l2_subdev_selection *sel) 1245 1245 { 1246 1246 struct stimx274 *imx274 = to_imx274(sd); ··· 1249 1249 return -EINVAL; 1250 1250 1251 1251 if (sel->target == V4L2_SEL_TGT_CROP) 1252 - return imx274_set_selection_crop(imx274, cfg, sel); 1252 + return imx274_set_selection_crop(imx274, sd_state, sel); 1253 1253 1254 1254 if (sel->target == V4L2_SEL_TGT_COMPOSE) { 1255 1255 int err; 1256 1256 1257 1257 mutex_lock(&imx274->lock); 1258 - err = __imx274_change_compose(imx274, cfg, sel->which, 1258 + err = __imx274_change_compose(imx274, sd_state, sel->which, 1259 1259 &sel->r.width, &sel->r.height, 1260 1260 sel->flags); 1261 1261 mutex_unlock(&imx274->lock);
+10 -10
drivers/media/i2c/imx290.c
··· 516 516 }; 517 517 518 518 static int imx290_enum_mbus_code(struct v4l2_subdev *sd, 519 - struct v4l2_subdev_pad_config *cfg, 519 + struct v4l2_subdev_state *sd_state, 520 520 struct v4l2_subdev_mbus_code_enum *code) 521 521 { 522 522 if (code->index >= ARRAY_SIZE(imx290_formats)) ··· 528 528 } 529 529 530 530 static int imx290_enum_frame_size(struct v4l2_subdev *sd, 531 - struct v4l2_subdev_pad_config *cfg, 531 + struct v4l2_subdev_state *sd_state, 532 532 struct v4l2_subdev_frame_size_enum *fse) 533 533 { 534 534 const struct imx290 *imx290 = to_imx290(sd); ··· 550 550 } 551 551 552 552 static int imx290_get_fmt(struct v4l2_subdev *sd, 553 - struct v4l2_subdev_pad_config *cfg, 553 + struct v4l2_subdev_state *sd_state, 554 554 struct v4l2_subdev_format *fmt) 555 555 { 556 556 struct imx290 *imx290 = to_imx290(sd); ··· 559 559 mutex_lock(&imx290->lock); 560 560 561 561 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 562 - framefmt = v4l2_subdev_get_try_format(&imx290->sd, cfg, 562 + framefmt = v4l2_subdev_get_try_format(&imx290->sd, sd_state, 563 563 fmt->pad); 564 564 else 565 565 framefmt = &imx290->current_format; ··· 596 596 } 597 597 598 598 static int imx290_set_fmt(struct v4l2_subdev *sd, 599 - struct v4l2_subdev_pad_config *cfg, 600 - struct v4l2_subdev_format *fmt) 599 + struct v4l2_subdev_state *sd_state, 600 + struct v4l2_subdev_format *fmt) 601 601 { 602 602 struct imx290 *imx290 = to_imx290(sd); 603 603 const struct imx290_mode *mode; ··· 624 624 fmt->format.field = V4L2_FIELD_NONE; 625 625 626 626 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 627 - format = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 627 + format = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 628 628 } else { 629 629 format = &imx290->current_format; 630 630 imx290->current_mode = mode; ··· 646 646 } 647 647 648 648 static int imx290_entity_init_cfg(struct v4l2_subdev *subdev, 649 - struct v4l2_subdev_pad_config *cfg) 649 + struct v4l2_subdev_state *sd_state) 650 650 { 651 651 struct v4l2_subdev_format fmt = { 0 }; 652 652 653 - fmt.which = cfg ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 653 + fmt.which = sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 654 654 fmt.format.width = 1920; 655 655 fmt.format.height = 1080; 656 656 657 - imx290_set_fmt(subdev, cfg, &fmt); 657 + imx290_set_fmt(subdev, sd_state, &fmt); 658 658 659 659 return 0; 660 660 }
+9 -9
drivers/media/i2c/imx319.c
··· 1860 1860 { 1861 1861 struct imx319 *imx319 = to_imx319(sd); 1862 1862 struct v4l2_mbus_framefmt *try_fmt = 1863 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 1863 + v4l2_subdev_get_try_format(sd, fh->state, 0); 1864 1864 1865 1865 mutex_lock(&imx319->mutex); 1866 1866 ··· 1947 1947 }; 1948 1948 1949 1949 static int imx319_enum_mbus_code(struct v4l2_subdev *sd, 1950 - struct v4l2_subdev_pad_config *cfg, 1950 + struct v4l2_subdev_state *sd_state, 1951 1951 struct v4l2_subdev_mbus_code_enum *code) 1952 1952 { 1953 1953 struct imx319 *imx319 = to_imx319(sd); ··· 1963 1963 } 1964 1964 1965 1965 static int imx319_enum_frame_size(struct v4l2_subdev *sd, 1966 - struct v4l2_subdev_pad_config *cfg, 1966 + struct v4l2_subdev_state *sd_state, 1967 1967 struct v4l2_subdev_frame_size_enum *fse) 1968 1968 { 1969 1969 struct imx319 *imx319 = to_imx319(sd); ··· 1997 1997 } 1998 1998 1999 1999 static int imx319_do_get_pad_format(struct imx319 *imx319, 2000 - struct v4l2_subdev_pad_config *cfg, 2000 + struct v4l2_subdev_state *sd_state, 2001 2001 struct v4l2_subdev_format *fmt) 2002 2002 { 2003 2003 struct v4l2_mbus_framefmt *framefmt; 2004 2004 struct v4l2_subdev *sd = &imx319->sd; 2005 2005 2006 2006 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 2007 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 2007 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 2008 2008 fmt->format = *framefmt; 2009 2009 } else { 2010 2010 imx319_update_pad_format(imx319, imx319->cur_mode, fmt); ··· 2014 2014 } 2015 2015 2016 2016 static int imx319_get_pad_format(struct v4l2_subdev *sd, 2017 - struct v4l2_subdev_pad_config *cfg, 2017 + struct v4l2_subdev_state *sd_state, 2018 2018 struct v4l2_subdev_format *fmt) 2019 2019 { 2020 2020 struct imx319 *imx319 = to_imx319(sd); 2021 2021 int ret; 2022 2022 2023 2023 mutex_lock(&imx319->mutex); 2024 - ret = imx319_do_get_pad_format(imx319, cfg, fmt); 2024 + ret = imx319_do_get_pad_format(imx319, sd_state, fmt); 2025 2025 mutex_unlock(&imx319->mutex); 2026 2026 2027 2027 return ret; ··· 2029 2029 2030 2030 static int 2031 2031 imx319_set_pad_format(struct v4l2_subdev *sd, 2032 - struct v4l2_subdev_pad_config *cfg, 2032 + struct v4l2_subdev_state *sd_state, 2033 2033 struct v4l2_subdev_format *fmt) 2034 2034 { 2035 2035 struct imx319 *imx319 = to_imx319(sd); ··· 2055 2055 fmt->format.width, fmt->format.height); 2056 2056 imx319_update_pad_format(imx319, mode, fmt); 2057 2057 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 2058 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 2058 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 2059 2059 *framefmt = fmt->format; 2060 2060 } else { 2061 2061 imx319->cur_mode = mode;
+14 -14
drivers/media/i2c/imx334.c
··· 497 497 /** 498 498 * imx334_enum_mbus_code() - Enumerate V4L2 sub-device mbus codes 499 499 * @sd: pointer to imx334 V4L2 sub-device structure 500 - * @cfg: V4L2 sub-device pad configuration 500 + * @sd_state: V4L2 sub-device state 501 501 * @code: V4L2 sub-device code enumeration need to be filled 502 502 * 503 503 * Return: 0 if successful, error code otherwise. 504 504 */ 505 505 static int imx334_enum_mbus_code(struct v4l2_subdev *sd, 506 - struct v4l2_subdev_pad_config *cfg, 506 + struct v4l2_subdev_state *sd_state, 507 507 struct v4l2_subdev_mbus_code_enum *code) 508 508 { 509 509 if (code->index > 0) ··· 517 517 /** 518 518 * imx334_enum_frame_size() - Enumerate V4L2 sub-device frame sizes 519 519 * @sd: pointer to imx334 V4L2 sub-device structure 520 - * @cfg: V4L2 sub-device pad configuration 520 + * @sd_state: V4L2 sub-device state 521 521 * @fsize: V4L2 sub-device size enumeration need to be filled 522 522 * 523 523 * Return: 0 if successful, error code otherwise. 524 524 */ 525 525 static int imx334_enum_frame_size(struct v4l2_subdev *sd, 526 - struct v4l2_subdev_pad_config *cfg, 526 + struct v4l2_subdev_state *sd_state, 527 527 struct v4l2_subdev_frame_size_enum *fsize) 528 528 { 529 529 if (fsize->index > 0) ··· 564 564 /** 565 565 * imx334_get_pad_format() - Get subdevice pad format 566 566 * @sd: pointer to imx334 V4L2 sub-device structure 567 - * @cfg: V4L2 sub-device pad configuration 567 + * @sd_state: V4L2 sub-device state 568 568 * @fmt: V4L2 sub-device format need to be set 569 569 * 570 570 * Return: 0 if successful, error code otherwise. 571 571 */ 572 572 static int imx334_get_pad_format(struct v4l2_subdev *sd, 573 - struct v4l2_subdev_pad_config *cfg, 573 + struct v4l2_subdev_state *sd_state, 574 574 struct v4l2_subdev_format *fmt) 575 575 { 576 576 struct imx334 *imx334 = to_imx334(sd); ··· 580 580 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 581 581 struct v4l2_mbus_framefmt *framefmt; 582 582 583 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 583 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 584 584 fmt->format = *framefmt; 585 585 } else { 586 586 imx334_fill_pad_format(imx334, imx334->cur_mode, fmt); ··· 594 594 /** 595 595 * imx334_set_pad_format() - Set subdevice pad format 596 596 * @sd: pointer to imx334 V4L2 sub-device structure 597 - * @cfg: V4L2 sub-device pad configuration 597 + * @sd_state: V4L2 sub-device state 598 598 * @fmt: V4L2 sub-device format need to be set 599 599 * 600 600 * Return: 0 if successful, error code otherwise. 601 601 */ 602 602 static int imx334_set_pad_format(struct v4l2_subdev *sd, 603 - struct v4l2_subdev_pad_config *cfg, 603 + struct v4l2_subdev_state *sd_state, 604 604 struct v4l2_subdev_format *fmt) 605 605 { 606 606 struct imx334 *imx334 = to_imx334(sd); ··· 615 615 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 616 616 struct v4l2_mbus_framefmt *framefmt; 617 617 618 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 618 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 619 619 *framefmt = fmt->format; 620 620 } else { 621 621 ret = imx334_update_controls(imx334, mode); ··· 631 631 /** 632 632 * imx334_init_pad_cfg() - Initialize sub-device pad configuration 633 633 * @sd: pointer to imx334 V4L2 sub-device structure 634 - * @cfg: V4L2 sub-device pad configuration 634 + * @sd_state: V4L2 sub-device state 635 635 * 636 636 * Return: 0 if successful, error code otherwise. 637 637 */ 638 638 static int imx334_init_pad_cfg(struct v4l2_subdev *sd, 639 - struct v4l2_subdev_pad_config *cfg) 639 + struct v4l2_subdev_state *sd_state) 640 640 { 641 641 struct imx334 *imx334 = to_imx334(sd); 642 642 struct v4l2_subdev_format fmt = { 0 }; 643 643 644 - fmt.which = cfg ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 644 + fmt.which = sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 645 645 imx334_fill_pad_format(imx334, &supported_mode, &fmt); 646 646 647 - return imx334_set_pad_format(sd, cfg, &fmt); 647 + return imx334_set_pad_format(sd, sd_state, &fmt); 648 648 } 649 649 650 650 /**
+9 -9
drivers/media/i2c/imx355.c
··· 1161 1161 { 1162 1162 struct imx355 *imx355 = to_imx355(sd); 1163 1163 struct v4l2_mbus_framefmt *try_fmt = 1164 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 1164 + v4l2_subdev_get_try_format(sd, fh->state, 0); 1165 1165 1166 1166 mutex_lock(&imx355->mutex); 1167 1167 ··· 1248 1248 }; 1249 1249 1250 1250 static int imx355_enum_mbus_code(struct v4l2_subdev *sd, 1251 - struct v4l2_subdev_pad_config *cfg, 1251 + struct v4l2_subdev_state *sd_state, 1252 1252 struct v4l2_subdev_mbus_code_enum *code) 1253 1253 { 1254 1254 struct imx355 *imx355 = to_imx355(sd); ··· 1264 1264 } 1265 1265 1266 1266 static int imx355_enum_frame_size(struct v4l2_subdev *sd, 1267 - struct v4l2_subdev_pad_config *cfg, 1267 + struct v4l2_subdev_state *sd_state, 1268 1268 struct v4l2_subdev_frame_size_enum *fse) 1269 1269 { 1270 1270 struct imx355 *imx355 = to_imx355(sd); ··· 1298 1298 } 1299 1299 1300 1300 static int imx355_do_get_pad_format(struct imx355 *imx355, 1301 - struct v4l2_subdev_pad_config *cfg, 1301 + struct v4l2_subdev_state *sd_state, 1302 1302 struct v4l2_subdev_format *fmt) 1303 1303 { 1304 1304 struct v4l2_mbus_framefmt *framefmt; 1305 1305 struct v4l2_subdev *sd = &imx355->sd; 1306 1306 1307 1307 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1308 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1308 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1309 1309 fmt->format = *framefmt; 1310 1310 } else { 1311 1311 imx355_update_pad_format(imx355, imx355->cur_mode, fmt); ··· 1315 1315 } 1316 1316 1317 1317 static int imx355_get_pad_format(struct v4l2_subdev *sd, 1318 - struct v4l2_subdev_pad_config *cfg, 1318 + struct v4l2_subdev_state *sd_state, 1319 1319 struct v4l2_subdev_format *fmt) 1320 1320 { 1321 1321 struct imx355 *imx355 = to_imx355(sd); 1322 1322 int ret; 1323 1323 1324 1324 mutex_lock(&imx355->mutex); 1325 - ret = imx355_do_get_pad_format(imx355, cfg, fmt); 1325 + ret = imx355_do_get_pad_format(imx355, sd_state, fmt); 1326 1326 mutex_unlock(&imx355->mutex); 1327 1327 1328 1328 return ret; ··· 1330 1330 1331 1331 static int 1332 1332 imx355_set_pad_format(struct v4l2_subdev *sd, 1333 - struct v4l2_subdev_pad_config *cfg, 1333 + struct v4l2_subdev_state *sd_state, 1334 1334 struct v4l2_subdev_format *fmt) 1335 1335 { 1336 1336 struct imx355 *imx355 = to_imx355(sd); ··· 1356 1356 fmt->format.width, fmt->format.height); 1357 1357 imx355_update_pad_format(imx355, mode, fmt); 1358 1358 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1359 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1359 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1360 1360 *framefmt = fmt->format; 1361 1361 } else { 1362 1362 imx355->cur_mode = mode;
+13 -8
drivers/media/i2c/m5mols/m5mols_core.c
··· 539 539 } 540 540 541 541 static struct v4l2_mbus_framefmt *__find_format(struct m5mols_info *info, 542 - struct v4l2_subdev_pad_config *cfg, 542 + struct v4l2_subdev_state *sd_state, 543 543 enum v4l2_subdev_format_whence which, 544 544 enum m5mols_restype type) 545 545 { 546 546 if (which == V4L2_SUBDEV_FORMAT_TRY) 547 - return cfg ? v4l2_subdev_get_try_format(&info->sd, cfg, 0) : NULL; 547 + return sd_state ? v4l2_subdev_get_try_format(&info->sd, 548 + sd_state, 0) : NULL; 548 549 549 550 return &info->ffmt[type]; 550 551 } 551 552 552 - static int m5mols_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 553 + static int m5mols_get_fmt(struct v4l2_subdev *sd, 554 + struct v4l2_subdev_state *sd_state, 553 555 struct v4l2_subdev_format *fmt) 554 556 { 555 557 struct m5mols_info *info = to_m5mols(sd); ··· 560 558 561 559 mutex_lock(&info->lock); 562 560 563 - format = __find_format(info, cfg, fmt->which, info->res_type); 561 + format = __find_format(info, sd_state, fmt->which, info->res_type); 564 562 if (format) 565 563 fmt->format = *format; 566 564 else ··· 570 568 return ret; 571 569 } 572 570 573 - static int m5mols_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 571 + static int m5mols_set_fmt(struct v4l2_subdev *sd, 572 + struct v4l2_subdev_state *sd_state, 574 573 struct v4l2_subdev_format *fmt) 575 574 { 576 575 struct m5mols_info *info = to_m5mols(sd); ··· 585 582 if (ret < 0) 586 583 return ret; 587 584 588 - sfmt = __find_format(info, cfg, fmt->which, type); 585 + sfmt = __find_format(info, sd_state, fmt->which, type); 589 586 if (!sfmt) 590 587 return 0; 591 588 ··· 651 648 652 649 653 650 static int m5mols_enum_mbus_code(struct v4l2_subdev *sd, 654 - struct v4l2_subdev_pad_config *cfg, 651 + struct v4l2_subdev_state *sd_state, 655 652 struct v4l2_subdev_mbus_code_enum *code) 656 653 { 657 654 if (!code || code->index >= SIZE_DEFAULT_FFMT) ··· 912 909 */ 913 910 static int m5mols_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 914 911 { 915 - struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0); 912 + struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, 913 + fh->state, 914 + 0); 916 915 917 916 *format = m5mols_default_ffmt[0]; 918 917 return 0;
+9 -8
drivers/media/i2c/max9286.c
··· 712 712 } 713 713 714 714 static int max9286_enum_mbus_code(struct v4l2_subdev *sd, 715 - struct v4l2_subdev_pad_config *cfg, 715 + struct v4l2_subdev_state *sd_state, 716 716 struct v4l2_subdev_mbus_code_enum *code) 717 717 { 718 718 if (code->pad || code->index > 0) ··· 725 725 726 726 static struct v4l2_mbus_framefmt * 727 727 max9286_get_pad_format(struct max9286_priv *priv, 728 - struct v4l2_subdev_pad_config *cfg, 728 + struct v4l2_subdev_state *sd_state, 729 729 unsigned int pad, u32 which) 730 730 { 731 731 switch (which) { 732 732 case V4L2_SUBDEV_FORMAT_TRY: 733 - return v4l2_subdev_get_try_format(&priv->sd, cfg, pad); 733 + return v4l2_subdev_get_try_format(&priv->sd, sd_state, pad); 734 734 case V4L2_SUBDEV_FORMAT_ACTIVE: 735 735 return &priv->fmt[pad]; 736 736 default: ··· 739 739 } 740 740 741 741 static int max9286_set_fmt(struct v4l2_subdev *sd, 742 - struct v4l2_subdev_pad_config *cfg, 742 + struct v4l2_subdev_state *sd_state, 743 743 struct v4l2_subdev_format *format) 744 744 { 745 745 struct max9286_priv *priv = sd_to_max9286(sd); ··· 760 760 break; 761 761 } 762 762 763 - cfg_fmt = max9286_get_pad_format(priv, cfg, format->pad, format->which); 763 + cfg_fmt = max9286_get_pad_format(priv, sd_state, format->pad, 764 + format->which); 764 765 if (!cfg_fmt) 765 766 return -EINVAL; 766 767 ··· 773 772 } 774 773 775 774 static int max9286_get_fmt(struct v4l2_subdev *sd, 776 - struct v4l2_subdev_pad_config *cfg, 775 + struct v4l2_subdev_state *sd_state, 777 776 struct v4l2_subdev_format *format) 778 777 { 779 778 struct max9286_priv *priv = sd_to_max9286(sd); ··· 789 788 if (pad == MAX9286_SRC_PAD) 790 789 pad = __ffs(priv->bound_sources); 791 790 792 - cfg_fmt = max9286_get_pad_format(priv, cfg, pad, format->which); 791 + cfg_fmt = max9286_get_pad_format(priv, sd_state, pad, format->which); 793 792 if (!cfg_fmt) 794 793 return -EINVAL; 795 794 ··· 833 832 unsigned int i; 834 833 835 834 for (i = 0; i < MAX9286_N_SINKS; i++) { 836 - format = v4l2_subdev_get_try_format(subdev, fh->pad, i); 835 + format = v4l2_subdev_get_try_format(subdev, fh->state, i); 837 836 max9286_init_format(format); 838 837 } 839 838
+2 -2
drivers/media/i2c/ml86v7667.c
··· 188 188 } 189 189 190 190 static int ml86v7667_enum_mbus_code(struct v4l2_subdev *sd, 191 - struct v4l2_subdev_pad_config *cfg, 191 + struct v4l2_subdev_state *sd_state, 192 192 struct v4l2_subdev_mbus_code_enum *code) 193 193 { 194 194 if (code->pad || code->index > 0) ··· 200 200 } 201 201 202 202 static int ml86v7667_fill_fmt(struct v4l2_subdev *sd, 203 - struct v4l2_subdev_pad_config *cfg, 203 + struct v4l2_subdev_state *sd_state, 204 204 struct v4l2_subdev_format *format) 205 205 { 206 206 struct ml86v7667_priv *priv = to_ml86v7667(sd);
+9 -9
drivers/media/i2c/mt9m001.c
··· 254 254 } 255 255 256 256 static int mt9m001_set_selection(struct v4l2_subdev *sd, 257 - struct v4l2_subdev_pad_config *cfg, 257 + struct v4l2_subdev_state *sd_state, 258 258 struct v4l2_subdev_selection *sel) 259 259 { 260 260 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 295 295 } 296 296 297 297 static int mt9m001_get_selection(struct v4l2_subdev *sd, 298 - struct v4l2_subdev_pad_config *cfg, 298 + struct v4l2_subdev_state *sd_state, 299 299 struct v4l2_subdev_selection *sel) 300 300 { 301 301 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 320 320 } 321 321 322 322 static int mt9m001_get_fmt(struct v4l2_subdev *sd, 323 - struct v4l2_subdev_pad_config *cfg, 323 + struct v4l2_subdev_state *sd_state, 324 324 struct v4l2_subdev_format *format) 325 325 { 326 326 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 331 331 return -EINVAL; 332 332 333 333 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 334 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 334 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 335 335 format->format = *mf; 336 336 return 0; 337 337 } ··· 377 377 } 378 378 379 379 static int mt9m001_set_fmt(struct v4l2_subdev *sd, 380 - struct v4l2_subdev_pad_config *cfg, 380 + struct v4l2_subdev_state *sd_state, 381 381 struct v4l2_subdev_format *format) 382 382 { 383 383 struct v4l2_mbus_framefmt *mf = &format->format; ··· 411 411 412 412 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) 413 413 return mt9m001_s_fmt(sd, fmt, mf); 414 - cfg->try_fmt = *mf; 414 + sd_state->pads->try_fmt = *mf; 415 415 return 0; 416 416 } 417 417 ··· 657 657 }; 658 658 659 659 static int mt9m001_init_cfg(struct v4l2_subdev *sd, 660 - struct v4l2_subdev_pad_config *cfg) 660 + struct v4l2_subdev_state *sd_state) 661 661 { 662 662 struct i2c_client *client = v4l2_get_subdevdata(sd); 663 663 struct mt9m001 *mt9m001 = to_mt9m001(client); 664 664 struct v4l2_mbus_framefmt *try_fmt = 665 - v4l2_subdev_get_try_format(sd, cfg, 0); 665 + v4l2_subdev_get_try_format(sd, sd_state, 0); 666 666 667 667 try_fmt->width = MT9M001_MAX_WIDTH; 668 668 try_fmt->height = MT9M001_MAX_HEIGHT; ··· 677 677 } 678 678 679 679 static int mt9m001_enum_mbus_code(struct v4l2_subdev *sd, 680 - struct v4l2_subdev_pad_config *cfg, 680 + struct v4l2_subdev_state *sd_state, 681 681 struct v4l2_subdev_mbus_code_enum *code) 682 682 { 683 683 struct i2c_client *client = v4l2_get_subdevdata(sd);
+21 -17
drivers/media/i2c/mt9m032.c
··· 304 304 */ 305 305 306 306 static int mt9m032_enum_mbus_code(struct v4l2_subdev *subdev, 307 - struct v4l2_subdev_pad_config *cfg, 307 + struct v4l2_subdev_state *sd_state, 308 308 struct v4l2_subdev_mbus_code_enum *code) 309 309 { 310 310 if (code->index != 0) ··· 315 315 } 316 316 317 317 static int mt9m032_enum_frame_size(struct v4l2_subdev *subdev, 318 - struct v4l2_subdev_pad_config *cfg, 318 + struct v4l2_subdev_state *sd_state, 319 319 struct v4l2_subdev_frame_size_enum *fse) 320 320 { 321 321 if (fse->index != 0 || fse->code != MEDIA_BUS_FMT_Y8_1X8) ··· 332 332 /** 333 333 * __mt9m032_get_pad_crop() - get crop rect 334 334 * @sensor: pointer to the sensor struct 335 - * @cfg: v4l2_subdev_pad_config for getting the try crop rect from 335 + * @sd_state: v4l2_subdev_state for getting the try crop rect from 336 336 * @which: select try or active crop rect 337 337 * 338 338 * Returns a pointer the current active or fh relative try crop rect 339 339 */ 340 340 static struct v4l2_rect * 341 - __mt9m032_get_pad_crop(struct mt9m032 *sensor, struct v4l2_subdev_pad_config *cfg, 341 + __mt9m032_get_pad_crop(struct mt9m032 *sensor, 342 + struct v4l2_subdev_state *sd_state, 342 343 enum v4l2_subdev_format_whence which) 343 344 { 344 345 switch (which) { 345 346 case V4L2_SUBDEV_FORMAT_TRY: 346 - return v4l2_subdev_get_try_crop(&sensor->subdev, cfg, 0); 347 + return v4l2_subdev_get_try_crop(&sensor->subdev, sd_state, 0); 347 348 case V4L2_SUBDEV_FORMAT_ACTIVE: 348 349 return &sensor->crop; 349 350 default: ··· 355 354 /** 356 355 * __mt9m032_get_pad_format() - get format 357 356 * @sensor: pointer to the sensor struct 358 - * @cfg: v4l2_subdev_pad_config for getting the try format from 357 + * @sd_state: v4l2_subdev_state for getting the try format from 359 358 * @which: select try or active format 360 359 * 361 360 * Returns a pointer the current active or fh relative try format 362 361 */ 363 362 static struct v4l2_mbus_framefmt * 364 - __mt9m032_get_pad_format(struct mt9m032 *sensor, struct v4l2_subdev_pad_config *cfg, 363 + __mt9m032_get_pad_format(struct mt9m032 *sensor, 364 + struct v4l2_subdev_state *sd_state, 365 365 enum v4l2_subdev_format_whence which) 366 366 { 367 367 switch (which) { 368 368 case V4L2_SUBDEV_FORMAT_TRY: 369 - return v4l2_subdev_get_try_format(&sensor->subdev, cfg, 0); 369 + return v4l2_subdev_get_try_format(&sensor->subdev, sd_state, 370 + 0); 370 371 case V4L2_SUBDEV_FORMAT_ACTIVE: 371 372 return &sensor->format; 372 373 default: ··· 377 374 } 378 375 379 376 static int mt9m032_get_pad_format(struct v4l2_subdev *subdev, 380 - struct v4l2_subdev_pad_config *cfg, 377 + struct v4l2_subdev_state *sd_state, 381 378 struct v4l2_subdev_format *fmt) 382 379 { 383 380 struct mt9m032 *sensor = to_mt9m032(subdev); 384 381 385 382 mutex_lock(&sensor->lock); 386 - fmt->format = *__mt9m032_get_pad_format(sensor, cfg, fmt->which); 383 + fmt->format = *__mt9m032_get_pad_format(sensor, sd_state, fmt->which); 387 384 mutex_unlock(&sensor->lock); 388 385 389 386 return 0; 390 387 } 391 388 392 389 static int mt9m032_set_pad_format(struct v4l2_subdev *subdev, 393 - struct v4l2_subdev_pad_config *cfg, 390 + struct v4l2_subdev_state *sd_state, 394 391 struct v4l2_subdev_format *fmt) 395 392 { 396 393 struct mt9m032 *sensor = to_mt9m032(subdev); ··· 404 401 } 405 402 406 403 /* Scaling is not supported, the format is thus fixed. */ 407 - fmt->format = *__mt9m032_get_pad_format(sensor, cfg, fmt->which); 404 + fmt->format = *__mt9m032_get_pad_format(sensor, sd_state, fmt->which); 408 405 ret = 0; 409 406 410 407 done: ··· 413 410 } 414 411 415 412 static int mt9m032_get_pad_selection(struct v4l2_subdev *subdev, 416 - struct v4l2_subdev_pad_config *cfg, 413 + struct v4l2_subdev_state *sd_state, 417 414 struct v4l2_subdev_selection *sel) 418 415 { 419 416 struct mt9m032 *sensor = to_mt9m032(subdev); ··· 422 419 return -EINVAL; 423 420 424 421 mutex_lock(&sensor->lock); 425 - sel->r = *__mt9m032_get_pad_crop(sensor, cfg, sel->which); 422 + sel->r = *__mt9m032_get_pad_crop(sensor, sd_state, sel->which); 426 423 mutex_unlock(&sensor->lock); 427 424 428 425 return 0; 429 426 } 430 427 431 428 static int mt9m032_set_pad_selection(struct v4l2_subdev *subdev, 432 - struct v4l2_subdev_pad_config *cfg, 429 + struct v4l2_subdev_state *sd_state, 433 430 struct v4l2_subdev_selection *sel) 434 431 { 435 432 struct mt9m032 *sensor = to_mt9m032(subdev); ··· 465 462 rect.height = min_t(unsigned int, rect.height, 466 463 MT9M032_PIXEL_ARRAY_HEIGHT - rect.top); 467 464 468 - __crop = __mt9m032_get_pad_crop(sensor, cfg, sel->which); 465 + __crop = __mt9m032_get_pad_crop(sensor, sd_state, sel->which); 469 466 470 467 if (rect.width != __crop->width || rect.height != __crop->height) { 471 468 /* Reset the output image size if the crop rectangle size has 472 469 * been modified. 473 470 */ 474 - format = __mt9m032_get_pad_format(sensor, cfg, sel->which); 471 + format = __mt9m032_get_pad_format(sensor, sd_state, 472 + sel->which); 475 473 format->width = rect.width; 476 474 format->height = rect.height; 477 475 }
+9 -9
drivers/media/i2c/mt9m111.c
··· 449 449 } 450 450 451 451 static int mt9m111_set_selection(struct v4l2_subdev *sd, 452 - struct v4l2_subdev_pad_config *cfg, 452 + struct v4l2_subdev_state *sd_state, 453 453 struct v4l2_subdev_selection *sel) 454 454 { 455 455 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 493 493 } 494 494 495 495 static int mt9m111_get_selection(struct v4l2_subdev *sd, 496 - struct v4l2_subdev_pad_config *cfg, 496 + struct v4l2_subdev_state *sd_state, 497 497 struct v4l2_subdev_selection *sel) 498 498 { 499 499 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 518 518 } 519 519 520 520 static int mt9m111_get_fmt(struct v4l2_subdev *sd, 521 - struct v4l2_subdev_pad_config *cfg, 521 + struct v4l2_subdev_state *sd_state, 522 522 struct v4l2_subdev_format *format) 523 523 { 524 524 struct v4l2_mbus_framefmt *mf = &format->format; ··· 529 529 530 530 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 531 531 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 532 - mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); 532 + mf = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 533 533 format->format = *mf; 534 534 return 0; 535 535 #else ··· 624 624 } 625 625 626 626 static int mt9m111_set_fmt(struct v4l2_subdev *sd, 627 - struct v4l2_subdev_pad_config *cfg, 627 + struct v4l2_subdev_state *sd_state, 628 628 struct v4l2_subdev_format *format) 629 629 { 630 630 struct v4l2_mbus_framefmt *mf = &format->format; ··· 678 678 mf->xfer_func = V4L2_XFER_FUNC_DEFAULT; 679 679 680 680 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 681 - cfg->try_fmt = *mf; 681 + sd_state->pads->try_fmt = *mf; 682 682 return 0; 683 683 } 684 684 ··· 1100 1100 } 1101 1101 1102 1102 static int mt9m111_enum_mbus_code(struct v4l2_subdev *sd, 1103 - struct v4l2_subdev_pad_config *cfg, 1103 + struct v4l2_subdev_state *sd_state, 1104 1104 struct v4l2_subdev_mbus_code_enum *code) 1105 1105 { 1106 1106 if (code->pad || code->index >= ARRAY_SIZE(mt9m111_colour_fmts)) ··· 1119 1119 } 1120 1120 1121 1121 static int mt9m111_init_cfg(struct v4l2_subdev *sd, 1122 - struct v4l2_subdev_pad_config *cfg) 1122 + struct v4l2_subdev_state *sd_state) 1123 1123 { 1124 1124 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1125 1125 struct v4l2_mbus_framefmt *format = 1126 - v4l2_subdev_get_try_format(sd, cfg, 0); 1126 + v4l2_subdev_get_try_format(sd, sd_state, 0); 1127 1127 1128 1128 format->width = MT9M111_MAX_WIDTH; 1129 1129 format->height = MT9M111_MAX_HEIGHT;
+26 -19
drivers/media/i2c/mt9p031.c
··· 470 470 } 471 471 472 472 static int mt9p031_enum_mbus_code(struct v4l2_subdev *subdev, 473 - struct v4l2_subdev_pad_config *cfg, 473 + struct v4l2_subdev_state *sd_state, 474 474 struct v4l2_subdev_mbus_code_enum *code) 475 475 { 476 476 struct mt9p031 *mt9p031 = to_mt9p031(subdev); ··· 483 483 } 484 484 485 485 static int mt9p031_enum_frame_size(struct v4l2_subdev *subdev, 486 - struct v4l2_subdev_pad_config *cfg, 486 + struct v4l2_subdev_state *sd_state, 487 487 struct v4l2_subdev_frame_size_enum *fse) 488 488 { 489 489 struct mt9p031 *mt9p031 = to_mt9p031(subdev); ··· 501 501 } 502 502 503 503 static struct v4l2_mbus_framefmt * 504 - __mt9p031_get_pad_format(struct mt9p031 *mt9p031, struct v4l2_subdev_pad_config *cfg, 504 + __mt9p031_get_pad_format(struct mt9p031 *mt9p031, 505 + struct v4l2_subdev_state *sd_state, 505 506 unsigned int pad, u32 which) 506 507 { 507 508 switch (which) { 508 509 case V4L2_SUBDEV_FORMAT_TRY: 509 - return v4l2_subdev_get_try_format(&mt9p031->subdev, cfg, pad); 510 + return v4l2_subdev_get_try_format(&mt9p031->subdev, sd_state, 511 + pad); 510 512 case V4L2_SUBDEV_FORMAT_ACTIVE: 511 513 return &mt9p031->format; 512 514 default: ··· 517 515 } 518 516 519 517 static struct v4l2_rect * 520 - __mt9p031_get_pad_crop(struct mt9p031 *mt9p031, struct v4l2_subdev_pad_config *cfg, 521 - unsigned int pad, u32 which) 518 + __mt9p031_get_pad_crop(struct mt9p031 *mt9p031, 519 + struct v4l2_subdev_state *sd_state, 520 + unsigned int pad, u32 which) 522 521 { 523 522 switch (which) { 524 523 case V4L2_SUBDEV_FORMAT_TRY: 525 - return v4l2_subdev_get_try_crop(&mt9p031->subdev, cfg, pad); 524 + return v4l2_subdev_get_try_crop(&mt9p031->subdev, sd_state, 525 + pad); 526 526 case V4L2_SUBDEV_FORMAT_ACTIVE: 527 527 return &mt9p031->crop; 528 528 default: ··· 533 529 } 534 530 535 531 static int mt9p031_get_format(struct v4l2_subdev *subdev, 536 - struct v4l2_subdev_pad_config *cfg, 532 + struct v4l2_subdev_state *sd_state, 537 533 struct v4l2_subdev_format *fmt) 538 534 { 539 535 struct mt9p031 *mt9p031 = to_mt9p031(subdev); 540 536 541 - fmt->format = *__mt9p031_get_pad_format(mt9p031, cfg, fmt->pad, 537 + fmt->format = *__mt9p031_get_pad_format(mt9p031, sd_state, fmt->pad, 542 538 fmt->which); 543 539 return 0; 544 540 } 545 541 546 542 static int mt9p031_set_format(struct v4l2_subdev *subdev, 547 - struct v4l2_subdev_pad_config *cfg, 543 + struct v4l2_subdev_state *sd_state, 548 544 struct v4l2_subdev_format *format) 549 545 { 550 546 struct mt9p031 *mt9p031 = to_mt9p031(subdev); ··· 555 551 unsigned int hratio; 556 552 unsigned int vratio; 557 553 558 - __crop = __mt9p031_get_pad_crop(mt9p031, cfg, format->pad, 554 + __crop = __mt9p031_get_pad_crop(mt9p031, sd_state, format->pad, 559 555 format->which); 560 556 561 557 /* Clamp the width and height to avoid dividing by zero. */ ··· 571 567 hratio = DIV_ROUND_CLOSEST(__crop->width, width); 572 568 vratio = DIV_ROUND_CLOSEST(__crop->height, height); 573 569 574 - __format = __mt9p031_get_pad_format(mt9p031, cfg, format->pad, 570 + __format = __mt9p031_get_pad_format(mt9p031, sd_state, format->pad, 575 571 format->which); 576 572 __format->width = __crop->width / hratio; 577 573 __format->height = __crop->height / vratio; ··· 582 578 } 583 579 584 580 static int mt9p031_get_selection(struct v4l2_subdev *subdev, 585 - struct v4l2_subdev_pad_config *cfg, 581 + struct v4l2_subdev_state *sd_state, 586 582 struct v4l2_subdev_selection *sel) 587 583 { 588 584 struct mt9p031 *mt9p031 = to_mt9p031(subdev); ··· 590 586 if (sel->target != V4L2_SEL_TGT_CROP) 591 587 return -EINVAL; 592 588 593 - sel->r = *__mt9p031_get_pad_crop(mt9p031, cfg, sel->pad, sel->which); 589 + sel->r = *__mt9p031_get_pad_crop(mt9p031, sd_state, sel->pad, 590 + sel->which); 594 591 return 0; 595 592 } 596 593 597 594 static int mt9p031_set_selection(struct v4l2_subdev *subdev, 598 - struct v4l2_subdev_pad_config *cfg, 595 + struct v4l2_subdev_state *sd_state, 599 596 struct v4l2_subdev_selection *sel) 600 597 { 601 598 struct mt9p031 *mt9p031 = to_mt9p031(subdev); ··· 626 621 rect.height = min_t(unsigned int, rect.height, 627 622 MT9P031_PIXEL_ARRAY_HEIGHT - rect.top); 628 623 629 - __crop = __mt9p031_get_pad_crop(mt9p031, cfg, sel->pad, sel->which); 624 + __crop = __mt9p031_get_pad_crop(mt9p031, sd_state, sel->pad, 625 + sel->which); 630 626 631 627 if (rect.width != __crop->width || rect.height != __crop->height) { 632 628 /* Reset the output image size if the crop rectangle size has 633 629 * been modified. 634 630 */ 635 - __format = __mt9p031_get_pad_format(mt9p031, cfg, sel->pad, 631 + __format = __mt9p031_get_pad_format(mt9p031, sd_state, 632 + sel->pad, 636 633 sel->which); 637 634 __format->width = rect.width; 638 635 __format->height = rect.height; ··· 949 942 struct v4l2_mbus_framefmt *format; 950 943 struct v4l2_rect *crop; 951 944 952 - crop = v4l2_subdev_get_try_crop(subdev, fh->pad, 0); 945 + crop = v4l2_subdev_get_try_crop(subdev, fh->state, 0); 953 946 crop->left = MT9P031_COLUMN_START_DEF; 954 947 crop->top = MT9P031_ROW_START_DEF; 955 948 crop->width = MT9P031_WINDOW_WIDTH_DEF; 956 949 crop->height = MT9P031_WINDOW_HEIGHT_DEF; 957 950 958 - format = v4l2_subdev_get_try_format(subdev, fh->pad, 0); 951 + format = v4l2_subdev_get_try_format(subdev, fh->state, 0); 959 952 960 953 if (mt9p031->model == MT9P031_MODEL_MONOCHROME) 961 954 format->code = MEDIA_BUS_FMT_Y12_1X12;
+26 -18
drivers/media/i2c/mt9t001.c
··· 252 252 */ 253 253 254 254 static struct v4l2_mbus_framefmt * 255 - __mt9t001_get_pad_format(struct mt9t001 *mt9t001, struct v4l2_subdev_pad_config *cfg, 255 + __mt9t001_get_pad_format(struct mt9t001 *mt9t001, 256 + struct v4l2_subdev_state *sd_state, 256 257 unsigned int pad, enum v4l2_subdev_format_whence which) 257 258 { 258 259 switch (which) { 259 260 case V4L2_SUBDEV_FORMAT_TRY: 260 - return v4l2_subdev_get_try_format(&mt9t001->subdev, cfg, pad); 261 + return v4l2_subdev_get_try_format(&mt9t001->subdev, sd_state, 262 + pad); 261 263 case V4L2_SUBDEV_FORMAT_ACTIVE: 262 264 return &mt9t001->format; 263 265 default: ··· 268 266 } 269 267 270 268 static struct v4l2_rect * 271 - __mt9t001_get_pad_crop(struct mt9t001 *mt9t001, struct v4l2_subdev_pad_config *cfg, 269 + __mt9t001_get_pad_crop(struct mt9t001 *mt9t001, 270 + struct v4l2_subdev_state *sd_state, 272 271 unsigned int pad, enum v4l2_subdev_format_whence which) 273 272 { 274 273 switch (which) { 275 274 case V4L2_SUBDEV_FORMAT_TRY: 276 - return v4l2_subdev_get_try_crop(&mt9t001->subdev, cfg, pad); 275 + return v4l2_subdev_get_try_crop(&mt9t001->subdev, sd_state, 276 + pad); 277 277 case V4L2_SUBDEV_FORMAT_ACTIVE: 278 278 return &mt9t001->crop; 279 279 default: ··· 339 335 } 340 336 341 337 static int mt9t001_enum_mbus_code(struct v4l2_subdev *subdev, 342 - struct v4l2_subdev_pad_config *cfg, 338 + struct v4l2_subdev_state *sd_state, 343 339 struct v4l2_subdev_mbus_code_enum *code) 344 340 { 345 341 if (code->index > 0) ··· 350 346 } 351 347 352 348 static int mt9t001_enum_frame_size(struct v4l2_subdev *subdev, 353 - struct v4l2_subdev_pad_config *cfg, 349 + struct v4l2_subdev_state *sd_state, 354 350 struct v4l2_subdev_frame_size_enum *fse) 355 351 { 356 352 if (fse->index >= 8 || fse->code != MEDIA_BUS_FMT_SGRBG10_1X10) ··· 365 361 } 366 362 367 363 static int mt9t001_get_format(struct v4l2_subdev *subdev, 368 - struct v4l2_subdev_pad_config *cfg, 364 + struct v4l2_subdev_state *sd_state, 369 365 struct v4l2_subdev_format *format) 370 366 { 371 367 struct mt9t001 *mt9t001 = to_mt9t001(subdev); 372 368 373 - format->format = *__mt9t001_get_pad_format(mt9t001, cfg, format->pad, 369 + format->format = *__mt9t001_get_pad_format(mt9t001, sd_state, 370 + format->pad, 374 371 format->which); 375 372 return 0; 376 373 } 377 374 378 375 static int mt9t001_set_format(struct v4l2_subdev *subdev, 379 - struct v4l2_subdev_pad_config *cfg, 376 + struct v4l2_subdev_state *sd_state, 380 377 struct v4l2_subdev_format *format) 381 378 { 382 379 struct mt9t001 *mt9t001 = to_mt9t001(subdev); ··· 388 383 unsigned int hratio; 389 384 unsigned int vratio; 390 385 391 - __crop = __mt9t001_get_pad_crop(mt9t001, cfg, format->pad, 386 + __crop = __mt9t001_get_pad_crop(mt9t001, sd_state, format->pad, 392 387 format->which); 393 388 394 389 /* Clamp the width and height to avoid dividing by zero. */ ··· 404 399 hratio = DIV_ROUND_CLOSEST(__crop->width, width); 405 400 vratio = DIV_ROUND_CLOSEST(__crop->height, height); 406 401 407 - __format = __mt9t001_get_pad_format(mt9t001, cfg, format->pad, 402 + __format = __mt9t001_get_pad_format(mt9t001, sd_state, format->pad, 408 403 format->which); 409 404 __format->width = __crop->width / hratio; 410 405 __format->height = __crop->height / vratio; ··· 415 410 } 416 411 417 412 static int mt9t001_get_selection(struct v4l2_subdev *subdev, 418 - struct v4l2_subdev_pad_config *cfg, 413 + struct v4l2_subdev_state *sd_state, 419 414 struct v4l2_subdev_selection *sel) 420 415 { 421 416 struct mt9t001 *mt9t001 = to_mt9t001(subdev); ··· 423 418 if (sel->target != V4L2_SEL_TGT_CROP) 424 419 return -EINVAL; 425 420 426 - sel->r = *__mt9t001_get_pad_crop(mt9t001, cfg, sel->pad, sel->which); 421 + sel->r = *__mt9t001_get_pad_crop(mt9t001, sd_state, sel->pad, 422 + sel->which); 427 423 return 0; 428 424 } 429 425 430 426 static int mt9t001_set_selection(struct v4l2_subdev *subdev, 431 - struct v4l2_subdev_pad_config *cfg, 427 + struct v4l2_subdev_state *sd_state, 432 428 struct v4l2_subdev_selection *sel) 433 429 { 434 430 struct mt9t001 *mt9t001 = to_mt9t001(subdev); ··· 461 455 rect.height = min_t(unsigned int, rect.height, 462 456 MT9T001_PIXEL_ARRAY_HEIGHT - rect.top); 463 457 464 - __crop = __mt9t001_get_pad_crop(mt9t001, cfg, sel->pad, sel->which); 458 + __crop = __mt9t001_get_pad_crop(mt9t001, sd_state, sel->pad, 459 + sel->which); 465 460 466 461 if (rect.width != __crop->width || rect.height != __crop->height) { 467 462 /* Reset the output image size if the crop rectangle size has 468 463 * been modified. 469 464 */ 470 - __format = __mt9t001_get_pad_format(mt9t001, cfg, sel->pad, 465 + __format = __mt9t001_get_pad_format(mt9t001, sd_state, 466 + sel->pad, 471 467 sel->which); 472 468 __format->width = rect.width; 473 469 __format->height = rect.height; ··· 806 798 struct v4l2_mbus_framefmt *format; 807 799 struct v4l2_rect *crop; 808 800 809 - crop = v4l2_subdev_get_try_crop(subdev, fh->pad, 0); 801 + crop = v4l2_subdev_get_try_crop(subdev, fh->state, 0); 810 802 crop->left = MT9T001_COLUMN_START_DEF; 811 803 crop->top = MT9T001_ROW_START_DEF; 812 804 crop->width = MT9T001_WINDOW_WIDTH_DEF + 1; 813 805 crop->height = MT9T001_WINDOW_HEIGHT_DEF + 1; 814 806 815 - format = v4l2_subdev_get_try_format(subdev, fh->pad, 0); 807 + format = v4l2_subdev_get_try_format(subdev, fh->state, 0); 816 808 format->code = MEDIA_BUS_FMT_SGRBG10_1X10; 817 809 format->width = MT9T001_WINDOW_WIDTH_DEF + 1; 818 810 format->height = MT9T001_WINDOW_HEIGHT_DEF + 1;
+7 -7
drivers/media/i2c/mt9t112.c
··· 872 872 } 873 873 874 874 static int mt9t112_get_selection(struct v4l2_subdev *sd, 875 - struct v4l2_subdev_pad_config *cfg, 876 - struct v4l2_subdev_selection *sel) 875 + struct v4l2_subdev_state *sd_state, 876 + struct v4l2_subdev_selection *sel) 877 877 { 878 878 struct i2c_client *client = v4l2_get_subdevdata(sd); 879 879 struct mt9t112_priv *priv = to_mt9t112(client); ··· 897 897 } 898 898 899 899 static int mt9t112_set_selection(struct v4l2_subdev *sd, 900 - struct v4l2_subdev_pad_config *cfg, 900 + struct v4l2_subdev_state *sd_state, 901 901 struct v4l2_subdev_selection *sel) 902 902 { 903 903 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 912 912 } 913 913 914 914 static int mt9t112_get_fmt(struct v4l2_subdev *sd, 915 - struct v4l2_subdev_pad_config *cfg, 915 + struct v4l2_subdev_state *sd_state, 916 916 struct v4l2_subdev_format *format) 917 917 { 918 918 struct v4l2_mbus_framefmt *mf = &format->format; ··· 953 953 } 954 954 955 955 static int mt9t112_set_fmt(struct v4l2_subdev *sd, 956 - struct v4l2_subdev_pad_config *cfg, 956 + struct v4l2_subdev_state *sd_state, 957 957 struct v4l2_subdev_format *format) 958 958 { 959 959 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 982 982 983 983 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) 984 984 return mt9t112_s_fmt(sd, mf); 985 - cfg->try_fmt = *mf; 985 + sd_state->pads->try_fmt = *mf; 986 986 987 987 return 0; 988 988 } 989 989 990 990 static int mt9t112_enum_mbus_code(struct v4l2_subdev *sd, 991 - struct v4l2_subdev_pad_config *cfg, 991 + struct v4l2_subdev_state *sd_state, 992 992 struct v4l2_subdev_mbus_code_enum *code) 993 993 { 994 994 struct i2c_client *client = v4l2_get_subdevdata(sd);
+3 -3
drivers/media/i2c/mt9v011.c
··· 327 327 } 328 328 329 329 static int mt9v011_enum_mbus_code(struct v4l2_subdev *sd, 330 - struct v4l2_subdev_pad_config *cfg, 330 + struct v4l2_subdev_state *sd_state, 331 331 struct v4l2_subdev_mbus_code_enum *code) 332 332 { 333 333 if (code->pad || code->index > 0) ··· 338 338 } 339 339 340 340 static int mt9v011_set_fmt(struct v4l2_subdev *sd, 341 - struct v4l2_subdev_pad_config *cfg, 341 + struct v4l2_subdev_state *sd_state, 342 342 struct v4l2_subdev_format *format) 343 343 { 344 344 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 358 358 359 359 set_res(sd); 360 360 } else { 361 - cfg->try_fmt = *fmt; 361 + sd_state->pads->try_fmt = *fmt; 362 362 } 363 363 364 364 return 0;
+26 -18
drivers/media/i2c/mt9v032.c
··· 349 349 */ 350 350 351 351 static struct v4l2_mbus_framefmt * 352 - __mt9v032_get_pad_format(struct mt9v032 *mt9v032, struct v4l2_subdev_pad_config *cfg, 352 + __mt9v032_get_pad_format(struct mt9v032 *mt9v032, 353 + struct v4l2_subdev_state *sd_state, 353 354 unsigned int pad, enum v4l2_subdev_format_whence which) 354 355 { 355 356 switch (which) { 356 357 case V4L2_SUBDEV_FORMAT_TRY: 357 - return v4l2_subdev_get_try_format(&mt9v032->subdev, cfg, pad); 358 + return v4l2_subdev_get_try_format(&mt9v032->subdev, sd_state, 359 + pad); 358 360 case V4L2_SUBDEV_FORMAT_ACTIVE: 359 361 return &mt9v032->format; 360 362 default: ··· 365 363 } 366 364 367 365 static struct v4l2_rect * 368 - __mt9v032_get_pad_crop(struct mt9v032 *mt9v032, struct v4l2_subdev_pad_config *cfg, 366 + __mt9v032_get_pad_crop(struct mt9v032 *mt9v032, 367 + struct v4l2_subdev_state *sd_state, 369 368 unsigned int pad, enum v4l2_subdev_format_whence which) 370 369 { 371 370 switch (which) { 372 371 case V4L2_SUBDEV_FORMAT_TRY: 373 - return v4l2_subdev_get_try_crop(&mt9v032->subdev, cfg, pad); 372 + return v4l2_subdev_get_try_crop(&mt9v032->subdev, sd_state, 373 + pad); 374 374 case V4L2_SUBDEV_FORMAT_ACTIVE: 375 375 return &mt9v032->crop; 376 376 default: ··· 429 425 } 430 426 431 427 static int mt9v032_enum_mbus_code(struct v4l2_subdev *subdev, 432 - struct v4l2_subdev_pad_config *cfg, 428 + struct v4l2_subdev_state *sd_state, 433 429 struct v4l2_subdev_mbus_code_enum *code) 434 430 { 435 431 struct mt9v032 *mt9v032 = to_mt9v032(subdev); ··· 442 438 } 443 439 444 440 static int mt9v032_enum_frame_size(struct v4l2_subdev *subdev, 445 - struct v4l2_subdev_pad_config *cfg, 441 + struct v4l2_subdev_state *sd_state, 446 442 struct v4l2_subdev_frame_size_enum *fse) 447 443 { 448 444 struct mt9v032 *mt9v032 = to_mt9v032(subdev); ··· 461 457 } 462 458 463 459 static int mt9v032_get_format(struct v4l2_subdev *subdev, 464 - struct v4l2_subdev_pad_config *cfg, 460 + struct v4l2_subdev_state *sd_state, 465 461 struct v4l2_subdev_format *format) 466 462 { 467 463 struct mt9v032 *mt9v032 = to_mt9v032(subdev); 468 464 469 - format->format = *__mt9v032_get_pad_format(mt9v032, cfg, format->pad, 465 + format->format = *__mt9v032_get_pad_format(mt9v032, sd_state, 466 + format->pad, 470 467 format->which); 471 468 return 0; 472 469 } ··· 497 492 } 498 493 499 494 static int mt9v032_set_format(struct v4l2_subdev *subdev, 500 - struct v4l2_subdev_pad_config *cfg, 495 + struct v4l2_subdev_state *sd_state, 501 496 struct v4l2_subdev_format *format) 502 497 { 503 498 struct mt9v032 *mt9v032 = to_mt9v032(subdev); ··· 508 503 unsigned int hratio; 509 504 unsigned int vratio; 510 505 511 - __crop = __mt9v032_get_pad_crop(mt9v032, cfg, format->pad, 506 + __crop = __mt9v032_get_pad_crop(mt9v032, sd_state, format->pad, 512 507 format->which); 513 508 514 509 /* Clamp the width and height to avoid dividing by zero. */ ··· 524 519 hratio = mt9v032_calc_ratio(__crop->width, width); 525 520 vratio = mt9v032_calc_ratio(__crop->height, height); 526 521 527 - __format = __mt9v032_get_pad_format(mt9v032, cfg, format->pad, 522 + __format = __mt9v032_get_pad_format(mt9v032, sd_state, format->pad, 528 523 format->which); 529 524 __format->width = __crop->width / hratio; 530 525 __format->height = __crop->height / vratio; ··· 541 536 } 542 537 543 538 static int mt9v032_get_selection(struct v4l2_subdev *subdev, 544 - struct v4l2_subdev_pad_config *cfg, 539 + struct v4l2_subdev_state *sd_state, 545 540 struct v4l2_subdev_selection *sel) 546 541 { 547 542 struct mt9v032 *mt9v032 = to_mt9v032(subdev); ··· 549 544 if (sel->target != V4L2_SEL_TGT_CROP) 550 545 return -EINVAL; 551 546 552 - sel->r = *__mt9v032_get_pad_crop(mt9v032, cfg, sel->pad, sel->which); 547 + sel->r = *__mt9v032_get_pad_crop(mt9v032, sd_state, sel->pad, 548 + sel->which); 553 549 return 0; 554 550 } 555 551 556 552 static int mt9v032_set_selection(struct v4l2_subdev *subdev, 557 - struct v4l2_subdev_pad_config *cfg, 553 + struct v4l2_subdev_state *sd_state, 558 554 struct v4l2_subdev_selection *sel) 559 555 { 560 556 struct mt9v032 *mt9v032 = to_mt9v032(subdev); ··· 587 581 rect.height = min_t(unsigned int, 588 582 rect.height, MT9V032_PIXEL_ARRAY_HEIGHT - rect.top); 589 583 590 - __crop = __mt9v032_get_pad_crop(mt9v032, cfg, sel->pad, sel->which); 584 + __crop = __mt9v032_get_pad_crop(mt9v032, sd_state, sel->pad, 585 + sel->which); 591 586 592 587 if (rect.width != __crop->width || rect.height != __crop->height) { 593 588 /* Reset the output image size if the crop rectangle size has 594 589 * been modified. 595 590 */ 596 - __format = __mt9v032_get_pad_format(mt9v032, cfg, sel->pad, 591 + __format = __mt9v032_get_pad_format(mt9v032, sd_state, 592 + sel->pad, 597 593 sel->which); 598 594 __format->width = rect.width; 599 595 __format->height = rect.height; ··· 930 922 struct v4l2_mbus_framefmt *format; 931 923 struct v4l2_rect *crop; 932 924 933 - crop = v4l2_subdev_get_try_crop(subdev, fh->pad, 0); 925 + crop = v4l2_subdev_get_try_crop(subdev, fh->state, 0); 934 926 crop->left = MT9V032_COLUMN_START_DEF; 935 927 crop->top = MT9V032_ROW_START_DEF; 936 928 crop->width = MT9V032_WINDOW_WIDTH_DEF; 937 929 crop->height = MT9V032_WINDOW_HEIGHT_DEF; 938 930 939 - format = v4l2_subdev_get_try_format(subdev, fh->pad, 0); 931 + format = v4l2_subdev_get_try_format(subdev, fh->state, 0); 940 932 941 933 if (mt9v032->model->color) 942 934 format->code = MEDIA_BUS_FMT_SGRBG10_1X10;
+13 -12
drivers/media/i2c/mt9v111.c
··· 791 791 792 792 static struct v4l2_mbus_framefmt *__mt9v111_get_pad_format( 793 793 struct mt9v111_dev *mt9v111, 794 - struct v4l2_subdev_pad_config *cfg, 794 + struct v4l2_subdev_state *sd_state, 795 795 unsigned int pad, 796 796 enum v4l2_subdev_format_whence which) 797 797 { 798 798 switch (which) { 799 799 case V4L2_SUBDEV_FORMAT_TRY: 800 800 #if IS_ENABLED(CONFIG_VIDEO_V4L2_SUBDEV_API) 801 - return v4l2_subdev_get_try_format(&mt9v111->sd, cfg, pad); 801 + return v4l2_subdev_get_try_format(&mt9v111->sd, sd_state, pad); 802 802 #else 803 - return &cfg->try_fmt; 803 + return &sd_state->pads->try_fmt; 804 804 #endif 805 805 case V4L2_SUBDEV_FORMAT_ACTIVE: 806 806 return &mt9v111->fmt; ··· 810 810 } 811 811 812 812 static int mt9v111_enum_mbus_code(struct v4l2_subdev *subdev, 813 - struct v4l2_subdev_pad_config *cfg, 813 + struct v4l2_subdev_state *sd_state, 814 814 struct v4l2_subdev_mbus_code_enum *code) 815 815 { 816 816 if (code->pad || code->index > ARRAY_SIZE(mt9v111_formats) - 1) ··· 822 822 } 823 823 824 824 static int mt9v111_enum_frame_interval(struct v4l2_subdev *sd, 825 - struct v4l2_subdev_pad_config *cfg, 825 + struct v4l2_subdev_state *sd_state, 826 826 struct v4l2_subdev_frame_interval_enum *fie) 827 827 { 828 828 unsigned int i; ··· 845 845 } 846 846 847 847 static int mt9v111_enum_frame_size(struct v4l2_subdev *subdev, 848 - struct v4l2_subdev_pad_config *cfg, 848 + struct v4l2_subdev_state *sd_state, 849 849 struct v4l2_subdev_frame_size_enum *fse) 850 850 { 851 851 if (fse->pad || fse->index >= ARRAY_SIZE(mt9v111_frame_sizes)) ··· 860 860 } 861 861 862 862 static int mt9v111_get_format(struct v4l2_subdev *subdev, 863 - struct v4l2_subdev_pad_config *cfg, 863 + struct v4l2_subdev_state *sd_state, 864 864 struct v4l2_subdev_format *format) 865 865 { 866 866 struct mt9v111_dev *mt9v111 = sd_to_mt9v111(subdev); ··· 869 869 return -EINVAL; 870 870 871 871 mutex_lock(&mt9v111->stream_mutex); 872 - format->format = *__mt9v111_get_pad_format(mt9v111, cfg, format->pad, 872 + format->format = *__mt9v111_get_pad_format(mt9v111, sd_state, 873 + format->pad, 873 874 format->which); 874 875 mutex_unlock(&mt9v111->stream_mutex); 875 876 ··· 878 877 } 879 878 880 879 static int mt9v111_set_format(struct v4l2_subdev *subdev, 881 - struct v4l2_subdev_pad_config *cfg, 880 + struct v4l2_subdev_state *sd_state, 882 881 struct v4l2_subdev_format *format) 883 882 { 884 883 struct mt9v111_dev *mt9v111 = sd_to_mt9v111(subdev); ··· 926 925 new_fmt.height = mt9v111_frame_sizes[idx].height; 927 926 928 927 /* Update the device (or pad) format if it has changed. */ 929 - __fmt = __mt9v111_get_pad_format(mt9v111, cfg, format->pad, 928 + __fmt = __mt9v111_get_pad_format(mt9v111, sd_state, format->pad, 930 929 format->which); 931 930 932 931 /* Format hasn't changed, stop here. */ ··· 955 954 } 956 955 957 956 static int mt9v111_init_cfg(struct v4l2_subdev *subdev, 958 - struct v4l2_subdev_pad_config *cfg) 957 + struct v4l2_subdev_state *sd_state) 959 958 { 960 - cfg->try_fmt = mt9v111_def_fmt; 959 + sd_state->pads->try_fmt = mt9v111_def_fmt; 961 960 962 961 return 0; 963 962 }
+11 -8
drivers/media/i2c/noon010pc30.c
··· 488 488 } 489 489 490 490 static int noon010_enum_mbus_code(struct v4l2_subdev *sd, 491 - struct v4l2_subdev_pad_config *cfg, 491 + struct v4l2_subdev_state *sd_state, 492 492 struct v4l2_subdev_mbus_code_enum *code) 493 493 { 494 494 if (code->index >= ARRAY_SIZE(noon010_formats)) ··· 499 499 } 500 500 501 501 static int noon010_get_fmt(struct v4l2_subdev *sd, 502 - struct v4l2_subdev_pad_config *cfg, 502 + struct v4l2_subdev_state *sd_state, 503 503 struct v4l2_subdev_format *fmt) 504 504 { 505 505 struct noon010_info *info = to_noon010(sd); 506 506 struct v4l2_mbus_framefmt *mf; 507 507 508 508 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 509 - if (cfg) { 510 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 509 + if (sd_state) { 510 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 511 511 fmt->format = *mf; 512 512 } 513 513 return 0; ··· 539 539 return &noon010_formats[i]; 540 540 } 541 541 542 - static int noon010_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 542 + static int noon010_set_fmt(struct v4l2_subdev *sd, 543 + struct v4l2_subdev_state *sd_state, 543 544 struct v4l2_subdev_format *fmt) 544 545 { 545 546 struct noon010_info *info = to_noon010(sd); ··· 555 554 fmt->format.field = V4L2_FIELD_NONE; 556 555 557 556 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 558 - if (cfg) { 559 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 557 + if (sd_state) { 558 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 560 559 *mf = fmt->format; 561 560 } 562 561 return 0; ··· 638 637 639 638 static int noon010_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 640 639 { 641 - struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0); 640 + struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, 641 + fh->state, 642 + 0); 642 643 643 644 mf->width = noon010_sizes[0].width; 644 645 mf->height = noon010_sizes[0].height;
+9 -8
drivers/media/i2c/ov02a10.c
··· 295 295 } 296 296 297 297 static int ov02a10_set_fmt(struct v4l2_subdev *sd, 298 - struct v4l2_subdev_pad_config *cfg, 298 + struct v4l2_subdev_state *sd_state, 299 299 struct v4l2_subdev_format *fmt) 300 300 { 301 301 struct ov02a10 *ov02a10 = to_ov02a10(sd); ··· 315 315 ov02a10_fill_fmt(ov02a10->cur_mode, mbus_fmt); 316 316 317 317 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 318 - frame_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 318 + frame_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 319 319 else 320 320 frame_fmt = &ov02a10->fmt; 321 321 ··· 327 327 } 328 328 329 329 static int ov02a10_get_fmt(struct v4l2_subdev *sd, 330 - struct v4l2_subdev_pad_config *cfg, 330 + struct v4l2_subdev_state *sd_state, 331 331 struct v4l2_subdev_format *fmt) 332 332 { 333 333 struct ov02a10 *ov02a10 = to_ov02a10(sd); ··· 336 336 mutex_lock(&ov02a10->mutex); 337 337 338 338 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 339 - fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 339 + fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, 340 + fmt->pad); 340 341 } else { 341 342 fmt->format = ov02a10->fmt; 342 343 mbus_fmt->code = ov02a10->fmt.code; ··· 350 349 } 351 350 352 351 static int ov02a10_enum_mbus_code(struct v4l2_subdev *sd, 353 - struct v4l2_subdev_pad_config *cfg, 352 + struct v4l2_subdev_state *sd_state, 354 353 struct v4l2_subdev_mbus_code_enum *code) 355 354 { 356 355 struct ov02a10 *ov02a10 = to_ov02a10(sd); ··· 364 363 } 365 364 366 365 static int ov02a10_enum_frame_sizes(struct v4l2_subdev *sd, 367 - struct v4l2_subdev_pad_config *cfg, 366 + struct v4l2_subdev_state *sd_state, 368 367 struct v4l2_subdev_frame_size_enum *fse) 369 368 { 370 369 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 512 511 } 513 512 514 513 static int ov02a10_entity_init_cfg(struct v4l2_subdev *sd, 515 - struct v4l2_subdev_pad_config *cfg) 514 + struct v4l2_subdev_state *sd_state) 516 515 { 517 516 struct v4l2_subdev_format fmt = { 518 517 .which = V4L2_SUBDEV_FORMAT_TRY, ··· 522 521 } 523 522 }; 524 523 525 - ov02a10_set_fmt(sd, cfg, &fmt); 524 + ov02a10_set_fmt(sd, sd_state, &fmt); 526 525 527 526 return 0; 528 527 }
+9 -9
drivers/media/i2c/ov13858.c
··· 1150 1150 { 1151 1151 struct ov13858 *ov13858 = to_ov13858(sd); 1152 1152 struct v4l2_mbus_framefmt *try_fmt = v4l2_subdev_get_try_format(sd, 1153 - fh->pad, 1153 + fh->state, 1154 1154 0); 1155 1155 1156 1156 mutex_lock(&ov13858->mutex); ··· 1275 1275 }; 1276 1276 1277 1277 static int ov13858_enum_mbus_code(struct v4l2_subdev *sd, 1278 - struct v4l2_subdev_pad_config *cfg, 1278 + struct v4l2_subdev_state *sd_state, 1279 1279 struct v4l2_subdev_mbus_code_enum *code) 1280 1280 { 1281 1281 /* Only one bayer order(GRBG) is supported */ ··· 1288 1288 } 1289 1289 1290 1290 static int ov13858_enum_frame_size(struct v4l2_subdev *sd, 1291 - struct v4l2_subdev_pad_config *cfg, 1291 + struct v4l2_subdev_state *sd_state, 1292 1292 struct v4l2_subdev_frame_size_enum *fse) 1293 1293 { 1294 1294 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 1315 1315 } 1316 1316 1317 1317 static int ov13858_do_get_pad_format(struct ov13858 *ov13858, 1318 - struct v4l2_subdev_pad_config *cfg, 1318 + struct v4l2_subdev_state *sd_state, 1319 1319 struct v4l2_subdev_format *fmt) 1320 1320 { 1321 1321 struct v4l2_mbus_framefmt *framefmt; 1322 1322 struct v4l2_subdev *sd = &ov13858->sd; 1323 1323 1324 1324 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1325 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1325 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1326 1326 fmt->format = *framefmt; 1327 1327 } else { 1328 1328 ov13858_update_pad_format(ov13858->cur_mode, fmt); ··· 1332 1332 } 1333 1333 1334 1334 static int ov13858_get_pad_format(struct v4l2_subdev *sd, 1335 - struct v4l2_subdev_pad_config *cfg, 1335 + struct v4l2_subdev_state *sd_state, 1336 1336 struct v4l2_subdev_format *fmt) 1337 1337 { 1338 1338 struct ov13858 *ov13858 = to_ov13858(sd); 1339 1339 int ret; 1340 1340 1341 1341 mutex_lock(&ov13858->mutex); 1342 - ret = ov13858_do_get_pad_format(ov13858, cfg, fmt); 1342 + ret = ov13858_do_get_pad_format(ov13858, sd_state, fmt); 1343 1343 mutex_unlock(&ov13858->mutex); 1344 1344 1345 1345 return ret; ··· 1347 1347 1348 1348 static int 1349 1349 ov13858_set_pad_format(struct v4l2_subdev *sd, 1350 - struct v4l2_subdev_pad_config *cfg, 1350 + struct v4l2_subdev_state *sd_state, 1351 1351 struct v4l2_subdev_format *fmt) 1352 1352 { 1353 1353 struct ov13858 *ov13858 = to_ov13858(sd); ··· 1371 1371 fmt->format.width, fmt->format.height); 1372 1372 ov13858_update_pad_format(mode, fmt); 1373 1373 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1374 - framefmt = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1374 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1375 1375 *framefmt = fmt->format; 1376 1376 } else { 1377 1377 ov13858->cur_mode = mode;
+8 -8
drivers/media/i2c/ov2640.c
··· 913 913 } 914 914 915 915 static int ov2640_get_fmt(struct v4l2_subdev *sd, 916 - struct v4l2_subdev_pad_config *cfg, 916 + struct v4l2_subdev_state *sd_state, 917 917 struct v4l2_subdev_format *format) 918 918 { 919 919 struct v4l2_mbus_framefmt *mf = &format->format; ··· 925 925 926 926 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 927 927 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 928 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 928 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 929 929 format->format = *mf; 930 930 return 0; 931 931 #else ··· 946 946 } 947 947 948 948 static int ov2640_set_fmt(struct v4l2_subdev *sd, 949 - struct v4l2_subdev_pad_config *cfg, 949 + struct v4l2_subdev_state *sd_state, 950 950 struct v4l2_subdev_format *format) 951 951 { 952 952 struct v4l2_mbus_framefmt *mf = &format->format; ··· 996 996 /* select format */ 997 997 priv->cfmt_code = mf->code; 998 998 } else { 999 - cfg->try_fmt = *mf; 999 + sd_state->pads->try_fmt = *mf; 1000 1000 } 1001 1001 out: 1002 1002 mutex_unlock(&priv->lock); ··· 1005 1005 } 1006 1006 1007 1007 static int ov2640_init_cfg(struct v4l2_subdev *sd, 1008 - struct v4l2_subdev_pad_config *cfg) 1008 + struct v4l2_subdev_state *sd_state) 1009 1009 { 1010 1010 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1011 1011 struct v4l2_mbus_framefmt *try_fmt = 1012 - v4l2_subdev_get_try_format(sd, cfg, 0); 1012 + v4l2_subdev_get_try_format(sd, sd_state, 0); 1013 1013 const struct ov2640_win_size *win = 1014 1014 ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT); 1015 1015 ··· 1026 1026 } 1027 1027 1028 1028 static int ov2640_enum_mbus_code(struct v4l2_subdev *sd, 1029 - struct v4l2_subdev_pad_config *cfg, 1029 + struct v4l2_subdev_state *sd_state, 1030 1030 struct v4l2_subdev_mbus_code_enum *code) 1031 1031 { 1032 1032 if (code->pad || code->index >= ARRAY_SIZE(ov2640_codes)) ··· 1037 1037 } 1038 1038 1039 1039 static int ov2640_get_selection(struct v4l2_subdev *sd, 1040 - struct v4l2_subdev_pad_config *cfg, 1040 + struct v4l2_subdev_state *sd_state, 1041 1041 struct v4l2_subdev_selection *sel) 1042 1042 { 1043 1043 if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE)
+7 -7
drivers/media/i2c/ov2659.c
··· 980 980 */ 981 981 982 982 static int ov2659_enum_mbus_code(struct v4l2_subdev *sd, 983 - struct v4l2_subdev_pad_config *cfg, 983 + struct v4l2_subdev_state *sd_state, 984 984 struct v4l2_subdev_mbus_code_enum *code) 985 985 { 986 986 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 996 996 } 997 997 998 998 static int ov2659_enum_frame_sizes(struct v4l2_subdev *sd, 999 - struct v4l2_subdev_pad_config *cfg, 999 + struct v4l2_subdev_state *sd_state, 1000 1000 struct v4l2_subdev_frame_size_enum *fse) 1001 1001 { 1002 1002 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 1022 1022 } 1023 1023 1024 1024 static int ov2659_get_fmt(struct v4l2_subdev *sd, 1025 - struct v4l2_subdev_pad_config *cfg, 1025 + struct v4l2_subdev_state *sd_state, 1026 1026 struct v4l2_subdev_format *fmt) 1027 1027 { 1028 1028 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 1034 1034 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1035 1035 struct v4l2_mbus_framefmt *mf; 1036 1036 1037 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 1037 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 1038 1038 mutex_lock(&ov2659->lock); 1039 1039 fmt->format = *mf; 1040 1040 mutex_unlock(&ov2659->lock); ··· 1084 1084 } 1085 1085 1086 1086 static int ov2659_set_fmt(struct v4l2_subdev *sd, 1087 - struct v4l2_subdev_pad_config *cfg, 1087 + struct v4l2_subdev_state *sd_state, 1088 1088 struct v4l2_subdev_format *fmt) 1089 1089 { 1090 1090 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 1114 1114 1115 1115 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1116 1116 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1117 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1117 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1118 1118 *mf = fmt->format; 1119 1119 #endif 1120 1120 } else { ··· 1311 1311 { 1312 1312 struct i2c_client *client = v4l2_get_subdevdata(sd); 1313 1313 struct v4l2_mbus_framefmt *format = 1314 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 1314 + v4l2_subdev_get_try_format(sd, fh->state, 0); 1315 1315 1316 1316 dev_dbg(&client->dev, "%s:\n", __func__); 1317 1317
+12 -11
drivers/media/i2c/ov2680.c
··· 645 645 } 646 646 647 647 static int ov2680_enum_mbus_code(struct v4l2_subdev *sd, 648 - struct v4l2_subdev_pad_config *cfg, 648 + struct v4l2_subdev_state *sd_state, 649 649 struct v4l2_subdev_mbus_code_enum *code) 650 650 { 651 651 struct ov2680_dev *sensor = to_ov2680_dev(sd); ··· 659 659 } 660 660 661 661 static int ov2680_get_fmt(struct v4l2_subdev *sd, 662 - struct v4l2_subdev_pad_config *cfg, 662 + struct v4l2_subdev_state *sd_state, 663 663 struct v4l2_subdev_format *format) 664 664 { 665 665 struct ov2680_dev *sensor = to_ov2680_dev(sd); ··· 673 673 674 674 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 675 675 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 676 - fmt = v4l2_subdev_get_try_format(&sensor->sd, cfg, format->pad); 676 + fmt = v4l2_subdev_get_try_format(&sensor->sd, sd_state, 677 + format->pad); 677 678 #else 678 679 ret = -EINVAL; 679 680 #endif ··· 691 690 } 692 691 693 692 static int ov2680_set_fmt(struct v4l2_subdev *sd, 694 - struct v4l2_subdev_pad_config *cfg, 693 + struct v4l2_subdev_state *sd_state, 695 694 struct v4l2_subdev_format *format) 696 695 { 697 696 struct ov2680_dev *sensor = to_ov2680_dev(sd); ··· 722 721 723 722 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 724 723 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 725 - try_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 724 + try_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 726 725 format->format = *try_fmt; 727 726 #endif 728 727 goto unlock; ··· 744 743 } 745 744 746 745 static int ov2680_init_cfg(struct v4l2_subdev *sd, 747 - struct v4l2_subdev_pad_config *cfg) 746 + struct v4l2_subdev_state *sd_state) 748 747 { 749 748 struct v4l2_subdev_format fmt = { 750 - .which = cfg ? V4L2_SUBDEV_FORMAT_TRY 751 - : V4L2_SUBDEV_FORMAT_ACTIVE, 749 + .which = sd_state ? V4L2_SUBDEV_FORMAT_TRY 750 + : V4L2_SUBDEV_FORMAT_ACTIVE, 752 751 .format = { 753 752 .width = 800, 754 753 .height = 600, 755 754 } 756 755 }; 757 756 758 - return ov2680_set_fmt(sd, cfg, &fmt); 757 + return ov2680_set_fmt(sd, sd_state, &fmt); 759 758 } 760 759 761 760 static int ov2680_enum_frame_size(struct v4l2_subdev *sd, 762 - struct v4l2_subdev_pad_config *cfg, 761 + struct v4l2_subdev_state *sd_state, 763 762 struct v4l2_subdev_frame_size_enum *fse) 764 763 { 765 764 int index = fse->index; ··· 776 775 } 777 776 778 777 static int ov2680_enum_frame_interval(struct v4l2_subdev *sd, 779 - struct v4l2_subdev_pad_config *cfg, 778 + struct v4l2_subdev_state *sd_state, 780 779 struct v4l2_subdev_frame_interval_enum *fie) 781 780 { 782 781 struct v4l2_fract tpf;
+5 -5
drivers/media/i2c/ov2685.c
··· 328 328 } 329 329 330 330 static int ov2685_set_fmt(struct v4l2_subdev *sd, 331 - struct v4l2_subdev_pad_config *cfg, 331 + struct v4l2_subdev_state *sd_state, 332 332 struct v4l2_subdev_format *fmt) 333 333 { 334 334 struct ov2685 *ov2685 = to_ov2685(sd); ··· 341 341 } 342 342 343 343 static int ov2685_get_fmt(struct v4l2_subdev *sd, 344 - struct v4l2_subdev_pad_config *cfg, 344 + struct v4l2_subdev_state *sd_state, 345 345 struct v4l2_subdev_format *fmt) 346 346 { 347 347 struct ov2685 *ov2685 = to_ov2685(sd); ··· 353 353 } 354 354 355 355 static int ov2685_enum_mbus_code(struct v4l2_subdev *sd, 356 - struct v4l2_subdev_pad_config *cfg, 356 + struct v4l2_subdev_state *sd_state, 357 357 struct v4l2_subdev_mbus_code_enum *code) 358 358 { 359 359 if (code->index >= ARRAY_SIZE(supported_modes)) ··· 365 365 } 366 366 367 367 static int ov2685_enum_frame_sizes(struct v4l2_subdev *sd, 368 - struct v4l2_subdev_pad_config *cfg, 368 + struct v4l2_subdev_state *sd_state, 369 369 struct v4l2_subdev_frame_size_enum *fse) 370 370 { 371 371 int index = fse->index; ··· 493 493 494 494 mutex_lock(&ov2685->mutex); 495 495 496 - try_fmt = v4l2_subdev_get_try_format(sd, fh->pad, 0); 496 + try_fmt = v4l2_subdev_get_try_format(sd, fh->state, 0); 497 497 /* Initialize try_fmt */ 498 498 ov2685_fill_fmt(&supported_modes[0], try_fmt); 499 499
+8 -7
drivers/media/i2c/ov2740.c
··· 810 810 } 811 811 812 812 static int ov2740_set_format(struct v4l2_subdev *sd, 813 - struct v4l2_subdev_pad_config *cfg, 813 + struct v4l2_subdev_state *sd_state, 814 814 struct v4l2_subdev_format *fmt) 815 815 { 816 816 struct ov2740 *ov2740 = to_ov2740(sd); ··· 825 825 mutex_lock(&ov2740->mutex); 826 826 ov2740_update_pad_format(mode, &fmt->format); 827 827 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 828 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 828 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 829 829 } else { 830 830 ov2740->cur_mode = mode; 831 831 __v4l2_ctrl_s_ctrl(ov2740->link_freq, mode->link_freq_index); ··· 850 850 } 851 851 852 852 static int ov2740_get_format(struct v4l2_subdev *sd, 853 - struct v4l2_subdev_pad_config *cfg, 853 + struct v4l2_subdev_state *sd_state, 854 854 struct v4l2_subdev_format *fmt) 855 855 { 856 856 struct ov2740 *ov2740 = to_ov2740(sd); 857 857 858 858 mutex_lock(&ov2740->mutex); 859 859 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 860 - fmt->format = *v4l2_subdev_get_try_format(&ov2740->sd, cfg, 860 + fmt->format = *v4l2_subdev_get_try_format(&ov2740->sd, 861 + sd_state, 861 862 fmt->pad); 862 863 else 863 864 ov2740_update_pad_format(ov2740->cur_mode, &fmt->format); ··· 869 868 } 870 869 871 870 static int ov2740_enum_mbus_code(struct v4l2_subdev *sd, 872 - struct v4l2_subdev_pad_config *cfg, 871 + struct v4l2_subdev_state *sd_state, 873 872 struct v4l2_subdev_mbus_code_enum *code) 874 873 { 875 874 if (code->index > 0) ··· 881 880 } 882 881 883 882 static int ov2740_enum_frame_size(struct v4l2_subdev *sd, 884 - struct v4l2_subdev_pad_config *cfg, 883 + struct v4l2_subdev_state *sd_state, 885 884 struct v4l2_subdev_frame_size_enum *fse) 886 885 { 887 886 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 904 903 905 904 mutex_lock(&ov2740->mutex); 906 905 ov2740_update_pad_format(&supported_modes[0], 907 - v4l2_subdev_get_try_format(sd, fh->pad, 0)); 906 + v4l2_subdev_get_try_format(sd, fh->state, 0)); 908 907 mutex_unlock(&ov2740->mutex); 909 908 910 909 return 0;
+7 -7
drivers/media/i2c/ov5640.c
··· 2227 2227 } 2228 2228 2229 2229 static int ov5640_get_fmt(struct v4l2_subdev *sd, 2230 - struct v4l2_subdev_pad_config *cfg, 2230 + struct v4l2_subdev_state *sd_state, 2231 2231 struct v4l2_subdev_format *format) 2232 2232 { 2233 2233 struct ov5640_dev *sensor = to_ov5640_dev(sd); ··· 2239 2239 mutex_lock(&sensor->lock); 2240 2240 2241 2241 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 2242 - fmt = v4l2_subdev_get_try_format(&sensor->sd, cfg, 2242 + fmt = v4l2_subdev_get_try_format(&sensor->sd, sd_state, 2243 2243 format->pad); 2244 2244 else 2245 2245 fmt = &sensor->fmt; ··· 2285 2285 } 2286 2286 2287 2287 static int ov5640_set_fmt(struct v4l2_subdev *sd, 2288 - struct v4l2_subdev_pad_config *cfg, 2288 + struct v4l2_subdev_state *sd_state, 2289 2289 struct v4l2_subdev_format *format) 2290 2290 { 2291 2291 struct ov5640_dev *sensor = to_ov5640_dev(sd); ··· 2310 2310 goto out; 2311 2311 2312 2312 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 2313 - fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 2313 + fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 2314 2314 else 2315 2315 fmt = &sensor->fmt; 2316 2316 ··· 2818 2818 } 2819 2819 2820 2820 static int ov5640_enum_frame_size(struct v4l2_subdev *sd, 2821 - struct v4l2_subdev_pad_config *cfg, 2821 + struct v4l2_subdev_state *sd_state, 2822 2822 struct v4l2_subdev_frame_size_enum *fse) 2823 2823 { 2824 2824 if (fse->pad != 0) ··· 2838 2838 2839 2839 static int ov5640_enum_frame_interval( 2840 2840 struct v4l2_subdev *sd, 2841 - struct v4l2_subdev_pad_config *cfg, 2841 + struct v4l2_subdev_state *sd_state, 2842 2842 struct v4l2_subdev_frame_interval_enum *fie) 2843 2843 { 2844 2844 struct ov5640_dev *sensor = to_ov5640_dev(sd); ··· 2924 2924 } 2925 2925 2926 2926 static int ov5640_enum_mbus_code(struct v4l2_subdev *sd, 2927 - struct v4l2_subdev_pad_config *cfg, 2927 + struct v4l2_subdev_state *sd_state, 2928 2928 struct v4l2_subdev_mbus_code_enum *code) 2929 2929 { 2930 2930 if (code->pad != 0)
+20 -18
drivers/media/i2c/ov5645.c
··· 837 837 }; 838 838 839 839 static int ov5645_enum_mbus_code(struct v4l2_subdev *sd, 840 - struct v4l2_subdev_pad_config *cfg, 840 + struct v4l2_subdev_state *sd_state, 841 841 struct v4l2_subdev_mbus_code_enum *code) 842 842 { 843 843 if (code->index > 0) ··· 849 849 } 850 850 851 851 static int ov5645_enum_frame_size(struct v4l2_subdev *subdev, 852 - struct v4l2_subdev_pad_config *cfg, 852 + struct v4l2_subdev_state *sd_state, 853 853 struct v4l2_subdev_frame_size_enum *fse) 854 854 { 855 855 if (fse->code != MEDIA_BUS_FMT_UYVY8_2X8) ··· 868 868 869 869 static struct v4l2_mbus_framefmt * 870 870 __ov5645_get_pad_format(struct ov5645 *ov5645, 871 - struct v4l2_subdev_pad_config *cfg, 871 + struct v4l2_subdev_state *sd_state, 872 872 unsigned int pad, 873 873 enum v4l2_subdev_format_whence which) 874 874 { 875 875 switch (which) { 876 876 case V4L2_SUBDEV_FORMAT_TRY: 877 - return v4l2_subdev_get_try_format(&ov5645->sd, cfg, pad); 877 + return v4l2_subdev_get_try_format(&ov5645->sd, sd_state, pad); 878 878 case V4L2_SUBDEV_FORMAT_ACTIVE: 879 879 return &ov5645->fmt; 880 880 default: ··· 883 883 } 884 884 885 885 static int ov5645_get_format(struct v4l2_subdev *sd, 886 - struct v4l2_subdev_pad_config *cfg, 886 + struct v4l2_subdev_state *sd_state, 887 887 struct v4l2_subdev_format *format) 888 888 { 889 889 struct ov5645 *ov5645 = to_ov5645(sd); 890 890 891 - format->format = *__ov5645_get_pad_format(ov5645, cfg, format->pad, 891 + format->format = *__ov5645_get_pad_format(ov5645, sd_state, 892 + format->pad, 892 893 format->which); 893 894 return 0; 894 895 } 895 896 896 897 static struct v4l2_rect * 897 - __ov5645_get_pad_crop(struct ov5645 *ov5645, struct v4l2_subdev_pad_config *cfg, 898 + __ov5645_get_pad_crop(struct ov5645 *ov5645, 899 + struct v4l2_subdev_state *sd_state, 898 900 unsigned int pad, enum v4l2_subdev_format_whence which) 899 901 { 900 902 switch (which) { 901 903 case V4L2_SUBDEV_FORMAT_TRY: 902 - return v4l2_subdev_get_try_crop(&ov5645->sd, cfg, pad); 904 + return v4l2_subdev_get_try_crop(&ov5645->sd, sd_state, pad); 903 905 case V4L2_SUBDEV_FORMAT_ACTIVE: 904 906 return &ov5645->crop; 905 907 default: ··· 910 908 } 911 909 912 910 static int ov5645_set_format(struct v4l2_subdev *sd, 913 - struct v4l2_subdev_pad_config *cfg, 911 + struct v4l2_subdev_state *sd_state, 914 912 struct v4l2_subdev_format *format) 915 913 { 916 914 struct ov5645 *ov5645 = to_ov5645(sd); ··· 919 917 const struct ov5645_mode_info *new_mode; 920 918 int ret; 921 919 922 - __crop = __ov5645_get_pad_crop(ov5645, cfg, format->pad, 923 - format->which); 920 + __crop = __ov5645_get_pad_crop(ov5645, sd_state, format->pad, 921 + format->which); 924 922 925 923 new_mode = v4l2_find_nearest_size(ov5645_mode_info_data, 926 924 ARRAY_SIZE(ov5645_mode_info_data), ··· 944 942 ov5645->current_mode = new_mode; 945 943 } 946 944 947 - __format = __ov5645_get_pad_format(ov5645, cfg, format->pad, 948 - format->which); 945 + __format = __ov5645_get_pad_format(ov5645, sd_state, format->pad, 946 + format->which); 949 947 __format->width = __crop->width; 950 948 __format->height = __crop->height; 951 949 __format->code = MEDIA_BUS_FMT_UYVY8_2X8; ··· 958 956 } 959 957 960 958 static int ov5645_entity_init_cfg(struct v4l2_subdev *subdev, 961 - struct v4l2_subdev_pad_config *cfg) 959 + struct v4l2_subdev_state *sd_state) 962 960 { 963 961 struct v4l2_subdev_format fmt = { 0 }; 964 962 965 - fmt.which = cfg ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 963 + fmt.which = sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 966 964 fmt.format.width = 1920; 967 965 fmt.format.height = 1080; 968 966 969 - ov5645_set_format(subdev, cfg, &fmt); 967 + ov5645_set_format(subdev, sd_state, &fmt); 970 968 971 969 return 0; 972 970 } 973 971 974 972 static int ov5645_get_selection(struct v4l2_subdev *sd, 975 - struct v4l2_subdev_pad_config *cfg, 973 + struct v4l2_subdev_state *sd_state, 976 974 struct v4l2_subdev_selection *sel) 977 975 { 978 976 struct ov5645 *ov5645 = to_ov5645(sd); ··· 980 978 if (sel->target != V4L2_SEL_TGT_CROP) 981 979 return -EINVAL; 982 980 983 - sel->r = *__ov5645_get_pad_crop(ov5645, cfg, sel->pad, 981 + sel->r = *__ov5645_get_pad_crop(ov5645, sd_state, sel->pad, 984 982 sel->which); 985 983 return 0; 986 984 }
+14 -12
drivers/media/i2c/ov5647.c
··· 856 856 }; 857 857 858 858 static const struct v4l2_rect * 859 - __ov5647_get_pad_crop(struct ov5647 *ov5647, struct v4l2_subdev_pad_config *cfg, 859 + __ov5647_get_pad_crop(struct ov5647 *ov5647, 860 + struct v4l2_subdev_state *sd_state, 860 861 unsigned int pad, enum v4l2_subdev_format_whence which) 861 862 { 862 863 switch (which) { 863 864 case V4L2_SUBDEV_FORMAT_TRY: 864 - return v4l2_subdev_get_try_crop(&ov5647->sd, cfg, pad); 865 + return v4l2_subdev_get_try_crop(&ov5647->sd, sd_state, pad); 865 866 case V4L2_SUBDEV_FORMAT_ACTIVE: 866 867 return &ov5647->mode->crop; 867 868 } ··· 919 918 }; 920 919 921 920 static int ov5647_enum_mbus_code(struct v4l2_subdev *sd, 922 - struct v4l2_subdev_pad_config *cfg, 921 + struct v4l2_subdev_state *sd_state, 923 922 struct v4l2_subdev_mbus_code_enum *code) 924 923 { 925 924 if (code->index > 0) ··· 931 930 } 932 931 933 932 static int ov5647_enum_frame_size(struct v4l2_subdev *sd, 934 - struct v4l2_subdev_pad_config *cfg, 933 + struct v4l2_subdev_state *sd_state, 935 934 struct v4l2_subdev_frame_size_enum *fse) 936 935 { 937 936 const struct v4l2_mbus_framefmt *fmt; ··· 950 949 } 951 950 952 951 static int ov5647_get_pad_fmt(struct v4l2_subdev *sd, 953 - struct v4l2_subdev_pad_config *cfg, 952 + struct v4l2_subdev_state *sd_state, 954 953 struct v4l2_subdev_format *format) 955 954 { 956 955 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 960 959 mutex_lock(&sensor->lock); 961 960 switch (format->which) { 962 961 case V4L2_SUBDEV_FORMAT_TRY: 963 - sensor_format = v4l2_subdev_get_try_format(sd, cfg, format->pad); 962 + sensor_format = v4l2_subdev_get_try_format(sd, sd_state, 963 + format->pad); 964 964 break; 965 965 default: 966 966 sensor_format = &sensor->mode->format; ··· 975 973 } 976 974 977 975 static int ov5647_set_pad_fmt(struct v4l2_subdev *sd, 978 - struct v4l2_subdev_pad_config *cfg, 976 + struct v4l2_subdev_state *sd_state, 979 977 struct v4l2_subdev_format *format) 980 978 { 981 979 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 989 987 /* Update the sensor mode and apply at it at streamon time. */ 990 988 mutex_lock(&sensor->lock); 991 989 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 992 - *v4l2_subdev_get_try_format(sd, cfg, format->pad) = mode->format; 990 + *v4l2_subdev_get_try_format(sd, sd_state, format->pad) = mode->format; 993 991 } else { 994 992 int exposure_max, exposure_def; 995 993 int hblank, vblank; ··· 1022 1020 } 1023 1021 1024 1022 static int ov5647_get_selection(struct v4l2_subdev *sd, 1025 - struct v4l2_subdev_pad_config *cfg, 1023 + struct v4l2_subdev_state *sd_state, 1026 1024 struct v4l2_subdev_selection *sel) 1027 1025 { 1028 1026 switch (sel->target) { ··· 1030 1028 struct ov5647 *sensor = to_sensor(sd); 1031 1029 1032 1030 mutex_lock(&sensor->lock); 1033 - sel->r = *__ov5647_get_pad_crop(sensor, cfg, sel->pad, 1031 + sel->r = *__ov5647_get_pad_crop(sensor, sd_state, sel->pad, 1034 1032 sel->which); 1035 1033 mutex_unlock(&sensor->lock); 1036 1034 ··· 1106 1104 static int ov5647_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1107 1105 { 1108 1106 struct v4l2_mbus_framefmt *format = 1109 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 1110 - struct v4l2_rect *crop = v4l2_subdev_get_try_crop(sd, fh->pad, 0); 1107 + v4l2_subdev_get_try_format(sd, fh->state, 0); 1108 + struct v4l2_rect *crop = v4l2_subdev_get_try_crop(sd, fh->state, 0); 1111 1109 1112 1110 crop->left = OV5647_PIXEL_ARRAY_LEFT; 1113 1111 crop->top = OV5647_PIXEL_ARRAY_TOP;
+7 -7
drivers/media/i2c/ov5648.c
··· 2188 2188 /* Subdev Pad Operations */ 2189 2189 2190 2190 static int ov5648_enum_mbus_code(struct v4l2_subdev *subdev, 2191 - struct v4l2_subdev_pad_config *config, 2191 + struct v4l2_subdev_state *sd_state, 2192 2192 struct v4l2_subdev_mbus_code_enum *code_enum) 2193 2193 { 2194 2194 if (code_enum->index >= ARRAY_SIZE(ov5648_mbus_codes)) ··· 2217 2217 } 2218 2218 2219 2219 static int ov5648_get_fmt(struct v4l2_subdev *subdev, 2220 - struct v4l2_subdev_pad_config *config, 2220 + struct v4l2_subdev_state *sd_state, 2221 2221 struct v4l2_subdev_format *format) 2222 2222 { 2223 2223 struct ov5648_sensor *sensor = ov5648_subdev_sensor(subdev); ··· 2226 2226 mutex_lock(&sensor->mutex); 2227 2227 2228 2228 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 2229 - *mbus_format = *v4l2_subdev_get_try_format(subdev, config, 2229 + *mbus_format = *v4l2_subdev_get_try_format(subdev, sd_state, 2230 2230 format->pad); 2231 2231 else 2232 2232 ov5648_mbus_format_fill(mbus_format, sensor->state.mbus_code, ··· 2238 2238 } 2239 2239 2240 2240 static int ov5648_set_fmt(struct v4l2_subdev *subdev, 2241 - struct v4l2_subdev_pad_config *config, 2241 + struct v4l2_subdev_state *sd_state, 2242 2242 struct v4l2_subdev_format *format) 2243 2243 { 2244 2244 struct ov5648_sensor *sensor = ov5648_subdev_sensor(subdev); ··· 2279 2279 ov5648_mbus_format_fill(mbus_format, mbus_code, mode); 2280 2280 2281 2281 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 2282 - *v4l2_subdev_get_try_format(subdev, config, format->pad) = 2282 + *v4l2_subdev_get_try_format(subdev, sd_state, format->pad) = 2283 2283 *mbus_format; 2284 2284 else if (sensor->state.mode != mode || 2285 2285 sensor->state.mbus_code != mbus_code) ··· 2292 2292 } 2293 2293 2294 2294 static int ov5648_enum_frame_size(struct v4l2_subdev *subdev, 2295 - struct v4l2_subdev_pad_config *config, 2295 + struct v4l2_subdev_state *sd_state, 2296 2296 struct v4l2_subdev_frame_size_enum *size_enum) 2297 2297 { 2298 2298 const struct ov5648_mode *mode; ··· 2309 2309 } 2310 2310 2311 2311 static int ov5648_enum_frame_interval(struct v4l2_subdev *subdev, 2312 - struct v4l2_subdev_pad_config *config, 2312 + struct v4l2_subdev_state *sd_state, 2313 2313 struct v4l2_subdev_frame_interval_enum *interval_enum) 2314 2314 { 2315 2315 const struct ov5648_mode *mode = NULL;
+10 -9
drivers/media/i2c/ov5670.c
··· 1937 1937 { 1938 1938 struct ov5670 *ov5670 = to_ov5670(sd); 1939 1939 struct v4l2_mbus_framefmt *try_fmt = 1940 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 1940 + v4l2_subdev_get_try_format(sd, fh->state, 0); 1941 1941 1942 1942 mutex_lock(&ov5670->mutex); 1943 1943 ··· 2153 2153 } 2154 2154 2155 2155 static int ov5670_enum_mbus_code(struct v4l2_subdev *sd, 2156 - struct v4l2_subdev_pad_config *cfg, 2156 + struct v4l2_subdev_state *sd_state, 2157 2157 struct v4l2_subdev_mbus_code_enum *code) 2158 2158 { 2159 2159 /* Only one bayer order GRBG is supported */ ··· 2166 2166 } 2167 2167 2168 2168 static int ov5670_enum_frame_size(struct v4l2_subdev *sd, 2169 - struct v4l2_subdev_pad_config *cfg, 2169 + struct v4l2_subdev_state *sd_state, 2170 2170 struct v4l2_subdev_frame_size_enum *fse) 2171 2171 { 2172 2172 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 2193 2193 } 2194 2194 2195 2195 static int ov5670_do_get_pad_format(struct ov5670 *ov5670, 2196 - struct v4l2_subdev_pad_config *cfg, 2196 + struct v4l2_subdev_state *sd_state, 2197 2197 struct v4l2_subdev_format *fmt) 2198 2198 { 2199 2199 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 2200 - fmt->format = *v4l2_subdev_get_try_format(&ov5670->sd, cfg, 2200 + fmt->format = *v4l2_subdev_get_try_format(&ov5670->sd, 2201 + sd_state, 2201 2202 fmt->pad); 2202 2203 else 2203 2204 ov5670_update_pad_format(ov5670->cur_mode, fmt); ··· 2207 2206 } 2208 2207 2209 2208 static int ov5670_get_pad_format(struct v4l2_subdev *sd, 2210 - struct v4l2_subdev_pad_config *cfg, 2209 + struct v4l2_subdev_state *sd_state, 2211 2210 struct v4l2_subdev_format *fmt) 2212 2211 { 2213 2212 struct ov5670 *ov5670 = to_ov5670(sd); 2214 2213 int ret; 2215 2214 2216 2215 mutex_lock(&ov5670->mutex); 2217 - ret = ov5670_do_get_pad_format(ov5670, cfg, fmt); 2216 + ret = ov5670_do_get_pad_format(ov5670, sd_state, fmt); 2218 2217 mutex_unlock(&ov5670->mutex); 2219 2218 2220 2219 return ret; 2221 2220 } 2222 2221 2223 2222 static int ov5670_set_pad_format(struct v4l2_subdev *sd, 2224 - struct v4l2_subdev_pad_config *cfg, 2223 + struct v4l2_subdev_state *sd_state, 2225 2224 struct v4l2_subdev_format *fmt) 2226 2225 { 2227 2226 struct ov5670 *ov5670 = to_ov5670(sd); ··· 2239 2238 fmt->format.width, fmt->format.height); 2240 2239 ov5670_update_pad_format(mode, fmt); 2241 2240 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 2242 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 2241 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 2243 2242 } else { 2244 2243 ov5670->cur_mode = mode; 2245 2244 __v4l2_ctrl_s_ctrl(ov5670->link_freq, mode->link_freq_index);
+8 -7
drivers/media/i2c/ov5675.c
··· 923 923 } 924 924 925 925 static int ov5675_set_format(struct v4l2_subdev *sd, 926 - struct v4l2_subdev_pad_config *cfg, 926 + struct v4l2_subdev_state *sd_state, 927 927 struct v4l2_subdev_format *fmt) 928 928 { 929 929 struct ov5675 *ov5675 = to_ov5675(sd); ··· 938 938 mutex_lock(&ov5675->mutex); 939 939 ov5675_update_pad_format(mode, &fmt->format); 940 940 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 941 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 941 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 942 942 } else { 943 943 ov5675->cur_mode = mode; 944 944 __v4l2_ctrl_s_ctrl(ov5675->link_freq, mode->link_freq_index); ··· 964 964 } 965 965 966 966 static int ov5675_get_format(struct v4l2_subdev *sd, 967 - struct v4l2_subdev_pad_config *cfg, 967 + struct v4l2_subdev_state *sd_state, 968 968 struct v4l2_subdev_format *fmt) 969 969 { 970 970 struct ov5675 *ov5675 = to_ov5675(sd); 971 971 972 972 mutex_lock(&ov5675->mutex); 973 973 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 974 - fmt->format = *v4l2_subdev_get_try_format(&ov5675->sd, cfg, 974 + fmt->format = *v4l2_subdev_get_try_format(&ov5675->sd, 975 + sd_state, 975 976 fmt->pad); 976 977 else 977 978 ov5675_update_pad_format(ov5675->cur_mode, &fmt->format); ··· 983 982 } 984 983 985 984 static int ov5675_enum_mbus_code(struct v4l2_subdev *sd, 986 - struct v4l2_subdev_pad_config *cfg, 985 + struct v4l2_subdev_state *sd_state, 987 986 struct v4l2_subdev_mbus_code_enum *code) 988 987 { 989 988 if (code->index > 0) ··· 995 994 } 996 995 997 996 static int ov5675_enum_frame_size(struct v4l2_subdev *sd, 998 - struct v4l2_subdev_pad_config *cfg, 997 + struct v4l2_subdev_state *sd_state, 999 998 struct v4l2_subdev_frame_size_enum *fse) 1000 999 { 1001 1000 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 1018 1017 1019 1018 mutex_lock(&ov5675->mutex); 1020 1019 ov5675_update_pad_format(&supported_modes[0], 1021 - v4l2_subdev_get_try_format(sd, fh->pad, 0)); 1020 + v4l2_subdev_get_try_format(sd, fh->state, 0)); 1022 1021 mutex_unlock(&ov5675->mutex); 1023 1022 1024 1023 return 0;
+8 -7
drivers/media/i2c/ov5695.c
··· 806 806 } 807 807 808 808 static int ov5695_set_fmt(struct v4l2_subdev *sd, 809 - struct v4l2_subdev_pad_config *cfg, 809 + struct v4l2_subdev_state *sd_state, 810 810 struct v4l2_subdev_format *fmt) 811 811 { 812 812 struct ov5695 *ov5695 = to_ov5695(sd); ··· 822 822 fmt->format.field = V4L2_FIELD_NONE; 823 823 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 824 824 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 825 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 825 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 826 826 #endif 827 827 } else { 828 828 ov5695->cur_mode = mode; ··· 841 841 } 842 842 843 843 static int ov5695_get_fmt(struct v4l2_subdev *sd, 844 - struct v4l2_subdev_pad_config *cfg, 844 + struct v4l2_subdev_state *sd_state, 845 845 struct v4l2_subdev_format *fmt) 846 846 { 847 847 struct ov5695 *ov5695 = to_ov5695(sd); ··· 850 850 mutex_lock(&ov5695->mutex); 851 851 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 852 852 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 853 - fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 853 + fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, 854 + fmt->pad); 854 855 #else 855 856 mutex_unlock(&ov5695->mutex); 856 857 return -EINVAL; ··· 868 867 } 869 868 870 869 static int ov5695_enum_mbus_code(struct v4l2_subdev *sd, 871 - struct v4l2_subdev_pad_config *cfg, 870 + struct v4l2_subdev_state *sd_state, 872 871 struct v4l2_subdev_mbus_code_enum *code) 873 872 { 874 873 if (code->index != 0) ··· 879 878 } 880 879 881 880 static int ov5695_enum_frame_sizes(struct v4l2_subdev *sd, 882 - struct v4l2_subdev_pad_config *cfg, 881 + struct v4l2_subdev_state *sd_state, 883 882 struct v4l2_subdev_frame_size_enum *fse) 884 883 { 885 884 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 1053 1052 { 1054 1053 struct ov5695 *ov5695 = to_ov5695(sd); 1055 1054 struct v4l2_mbus_framefmt *try_fmt = 1056 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 1055 + v4l2_subdev_get_try_format(sd, fh->state, 0); 1057 1056 const struct ov5695_mode *def_mode = &supported_modes[0]; 1058 1057 1059 1058 mutex_lock(&ov5695->mutex);
+14 -14
drivers/media/i2c/ov6650.c
··· 467 467 } 468 468 469 469 static int ov6650_get_selection(struct v4l2_subdev *sd, 470 - struct v4l2_subdev_pad_config *cfg, 470 + struct v4l2_subdev_state *sd_state, 471 471 struct v4l2_subdev_selection *sel) 472 472 { 473 473 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 492 492 } 493 493 494 494 static int ov6650_set_selection(struct v4l2_subdev *sd, 495 - struct v4l2_subdev_pad_config *cfg, 495 + struct v4l2_subdev_state *sd_state, 496 496 struct v4l2_subdev_selection *sel) 497 497 { 498 498 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 535 535 } 536 536 537 537 static int ov6650_get_fmt(struct v4l2_subdev *sd, 538 - struct v4l2_subdev_pad_config *cfg, 538 + struct v4l2_subdev_state *sd_state, 539 539 struct v4l2_subdev_format *format) 540 540 { 541 541 struct v4l2_mbus_framefmt *mf = &format->format; ··· 550 550 551 551 /* update media bus format code and frame size */ 552 552 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 553 - mf->width = cfg->try_fmt.width; 554 - mf->height = cfg->try_fmt.height; 555 - mf->code = cfg->try_fmt.code; 553 + mf->width = sd_state->pads->try_fmt.width; 554 + mf->height = sd_state->pads->try_fmt.height; 555 + mf->code = sd_state->pads->try_fmt.code; 556 556 557 557 } else { 558 558 mf->width = priv->rect.width >> priv->half_scale; ··· 668 668 } 669 669 670 670 static int ov6650_set_fmt(struct v4l2_subdev *sd, 671 - struct v4l2_subdev_pad_config *cfg, 671 + struct v4l2_subdev_state *sd_state, 672 672 struct v4l2_subdev_format *format) 673 673 { 674 674 struct v4l2_mbus_framefmt *mf = &format->format; ··· 701 701 702 702 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 703 703 /* store media bus format code and frame size in pad config */ 704 - cfg->try_fmt.width = mf->width; 705 - cfg->try_fmt.height = mf->height; 706 - cfg->try_fmt.code = mf->code; 704 + sd_state->pads->try_fmt.width = mf->width; 705 + sd_state->pads->try_fmt.height = mf->height; 706 + sd_state->pads->try_fmt.code = mf->code; 707 707 708 708 /* return default mbus frame format updated with pad config */ 709 709 *mf = ov6650_def_fmt; 710 - mf->width = cfg->try_fmt.width; 711 - mf->height = cfg->try_fmt.height; 712 - mf->code = cfg->try_fmt.code; 710 + mf->width = sd_state->pads->try_fmt.width; 711 + mf->height = sd_state->pads->try_fmt.height; 712 + mf->code = sd_state->pads->try_fmt.code; 713 713 714 714 } else { 715 715 /* apply new media bus format code and frame size */ ··· 728 728 } 729 729 730 730 static int ov6650_enum_mbus_code(struct v4l2_subdev *sd, 731 - struct v4l2_subdev_pad_config *cfg, 731 + struct v4l2_subdev_state *sd_state, 732 732 struct v4l2_subdev_mbus_code_enum *code) 733 733 { 734 734 if (code->pad || code->index >= ARRAY_SIZE(ov6650_codes))
+21 -18
drivers/media/i2c/ov7251.c
··· 898 898 }; 899 899 900 900 static int ov7251_enum_mbus_code(struct v4l2_subdev *sd, 901 - struct v4l2_subdev_pad_config *cfg, 901 + struct v4l2_subdev_state *sd_state, 902 902 struct v4l2_subdev_mbus_code_enum *code) 903 903 { 904 904 if (code->index > 0) ··· 910 910 } 911 911 912 912 static int ov7251_enum_frame_size(struct v4l2_subdev *subdev, 913 - struct v4l2_subdev_pad_config *cfg, 913 + struct v4l2_subdev_state *sd_state, 914 914 struct v4l2_subdev_frame_size_enum *fse) 915 915 { 916 916 if (fse->code != MEDIA_BUS_FMT_Y10_1X10) ··· 928 928 } 929 929 930 930 static int ov7251_enum_frame_ival(struct v4l2_subdev *subdev, 931 - struct v4l2_subdev_pad_config *cfg, 931 + struct v4l2_subdev_state *sd_state, 932 932 struct v4l2_subdev_frame_interval_enum *fie) 933 933 { 934 934 unsigned int index = fie->index; ··· 950 950 951 951 static struct v4l2_mbus_framefmt * 952 952 __ov7251_get_pad_format(struct ov7251 *ov7251, 953 - struct v4l2_subdev_pad_config *cfg, 953 + struct v4l2_subdev_state *sd_state, 954 954 unsigned int pad, 955 955 enum v4l2_subdev_format_whence which) 956 956 { 957 957 switch (which) { 958 958 case V4L2_SUBDEV_FORMAT_TRY: 959 - return v4l2_subdev_get_try_format(&ov7251->sd, cfg, pad); 959 + return v4l2_subdev_get_try_format(&ov7251->sd, sd_state, pad); 960 960 case V4L2_SUBDEV_FORMAT_ACTIVE: 961 961 return &ov7251->fmt; 962 962 default: ··· 965 965 } 966 966 967 967 static int ov7251_get_format(struct v4l2_subdev *sd, 968 - struct v4l2_subdev_pad_config *cfg, 968 + struct v4l2_subdev_state *sd_state, 969 969 struct v4l2_subdev_format *format) 970 970 { 971 971 struct ov7251 *ov7251 = to_ov7251(sd); 972 972 973 973 mutex_lock(&ov7251->lock); 974 - format->format = *__ov7251_get_pad_format(ov7251, cfg, format->pad, 974 + format->format = *__ov7251_get_pad_format(ov7251, sd_state, 975 + format->pad, 975 976 format->which); 976 977 mutex_unlock(&ov7251->lock); 977 978 ··· 980 979 } 981 980 982 981 static struct v4l2_rect * 983 - __ov7251_get_pad_crop(struct ov7251 *ov7251, struct v4l2_subdev_pad_config *cfg, 982 + __ov7251_get_pad_crop(struct ov7251 *ov7251, 983 + struct v4l2_subdev_state *sd_state, 984 984 unsigned int pad, enum v4l2_subdev_format_whence which) 985 985 { 986 986 switch (which) { 987 987 case V4L2_SUBDEV_FORMAT_TRY: 988 - return v4l2_subdev_get_try_crop(&ov7251->sd, cfg, pad); 988 + return v4l2_subdev_get_try_crop(&ov7251->sd, sd_state, pad); 989 989 case V4L2_SUBDEV_FORMAT_ACTIVE: 990 990 return &ov7251->crop; 991 991 default: ··· 1029 1027 } 1030 1028 1031 1029 static int ov7251_set_format(struct v4l2_subdev *sd, 1032 - struct v4l2_subdev_pad_config *cfg, 1030 + struct v4l2_subdev_state *sd_state, 1033 1031 struct v4l2_subdev_format *format) 1034 1032 { 1035 1033 struct ov7251 *ov7251 = to_ov7251(sd); ··· 1040 1038 1041 1039 mutex_lock(&ov7251->lock); 1042 1040 1043 - __crop = __ov7251_get_pad_crop(ov7251, cfg, format->pad, format->which); 1041 + __crop = __ov7251_get_pad_crop(ov7251, sd_state, format->pad, 1042 + format->which); 1044 1043 1045 1044 new_mode = v4l2_find_nearest_size(ov7251_mode_info_data, 1046 1045 ARRAY_SIZE(ov7251_mode_info_data), ··· 1080 1077 ov7251->current_mode = new_mode; 1081 1078 } 1082 1079 1083 - __format = __ov7251_get_pad_format(ov7251, cfg, format->pad, 1080 + __format = __ov7251_get_pad_format(ov7251, sd_state, format->pad, 1084 1081 format->which); 1085 1082 __format->width = __crop->width; 1086 1083 __format->height = __crop->height; ··· 1101 1098 } 1102 1099 1103 1100 static int ov7251_entity_init_cfg(struct v4l2_subdev *subdev, 1104 - struct v4l2_subdev_pad_config *cfg) 1101 + struct v4l2_subdev_state *sd_state) 1105 1102 { 1106 1103 struct v4l2_subdev_format fmt = { 1107 - .which = cfg ? V4L2_SUBDEV_FORMAT_TRY 1108 - : V4L2_SUBDEV_FORMAT_ACTIVE, 1104 + .which = sd_state ? V4L2_SUBDEV_FORMAT_TRY 1105 + : V4L2_SUBDEV_FORMAT_ACTIVE, 1109 1106 .format = { 1110 1107 .width = 640, 1111 1108 .height = 480 1112 1109 } 1113 1110 }; 1114 1111 1115 - ov7251_set_format(subdev, cfg, &fmt); 1112 + ov7251_set_format(subdev, sd_state, &fmt); 1116 1113 1117 1114 return 0; 1118 1115 } 1119 1116 1120 1117 static int ov7251_get_selection(struct v4l2_subdev *sd, 1121 - struct v4l2_subdev_pad_config *cfg, 1118 + struct v4l2_subdev_state *sd_state, 1122 1119 struct v4l2_subdev_selection *sel) 1123 1120 { 1124 1121 struct ov7251 *ov7251 = to_ov7251(sd); ··· 1127 1124 return -EINVAL; 1128 1125 1129 1126 mutex_lock(&ov7251->lock); 1130 - sel->r = *__ov7251_get_pad_crop(ov7251, cfg, sel->pad, 1127 + sel->r = *__ov7251_get_pad_crop(ov7251, sd_state, sel->pad, 1131 1128 sel->which); 1132 1129 mutex_unlock(&ov7251->lock); 1133 1130
+9 -8
drivers/media/i2c/ov7670.c
··· 960 960 961 961 962 962 static int ov7670_enum_mbus_code(struct v4l2_subdev *sd, 963 - struct v4l2_subdev_pad_config *cfg, 963 + struct v4l2_subdev_state *sd_state, 964 964 struct v4l2_subdev_mbus_code_enum *code) 965 965 { 966 966 if (code->pad || code->index >= N_OV7670_FMTS) ··· 1105 1105 * Set a format. 1106 1106 */ 1107 1107 static int ov7670_set_fmt(struct v4l2_subdev *sd, 1108 - struct v4l2_subdev_pad_config *cfg, 1108 + struct v4l2_subdev_state *sd_state, 1109 1109 struct v4l2_subdev_format *format) 1110 1110 { 1111 1111 struct ov7670_info *info = to_state(sd); ··· 1122 1122 if (ret) 1123 1123 return ret; 1124 1124 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1125 - mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 1125 + mbus_fmt = v4l2_subdev_get_try_format(sd, sd_state, 1126 + format->pad); 1126 1127 *mbus_fmt = format->format; 1127 1128 #endif 1128 1129 return 0; ··· 1145 1144 } 1146 1145 1147 1146 static int ov7670_get_fmt(struct v4l2_subdev *sd, 1148 - struct v4l2_subdev_pad_config *cfg, 1147 + struct v4l2_subdev_state *sd_state, 1149 1148 struct v4l2_subdev_format *format) 1150 1149 { 1151 1150 struct ov7670_info *info = to_state(sd); ··· 1155 1154 1156 1155 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1157 1156 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 1158 - mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 1157 + mbus_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 1159 1158 format->format = *mbus_fmt; 1160 1159 return 0; 1161 1160 #else ··· 1203 1202 static int ov7670_frame_rates[] = { 30, 15, 10, 5, 1 }; 1204 1203 1205 1204 static int ov7670_enum_frame_interval(struct v4l2_subdev *sd, 1206 - struct v4l2_subdev_pad_config *cfg, 1205 + struct v4l2_subdev_state *sd_state, 1207 1206 struct v4l2_subdev_frame_interval_enum *fie) 1208 1207 { 1209 1208 struct ov7670_info *info = to_state(sd); ··· 1242 1241 * Frame size enumeration 1243 1242 */ 1244 1243 static int ov7670_enum_frame_size(struct v4l2_subdev *sd, 1245 - struct v4l2_subdev_pad_config *cfg, 1244 + struct v4l2_subdev_state *sd_state, 1246 1245 struct v4l2_subdev_frame_size_enum *fse) 1247 1246 { 1248 1247 struct ov7670_info *info = to_state(sd); ··· 1725 1724 static int ov7670_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1726 1725 { 1727 1726 struct v4l2_mbus_framefmt *format = 1728 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 1727 + v4l2_subdev_get_try_format(sd, fh->state, 0); 1729 1728 1730 1729 ov7670_get_default_format(sd, format); 1731 1730
+6 -6
drivers/media/i2c/ov772x.c
··· 1157 1157 } 1158 1158 1159 1159 static int ov772x_get_selection(struct v4l2_subdev *sd, 1160 - struct v4l2_subdev_pad_config *cfg, 1160 + struct v4l2_subdev_state *sd_state, 1161 1161 struct v4l2_subdev_selection *sel) 1162 1162 { 1163 1163 struct ov772x_priv *priv = to_ov772x(sd); ··· 1179 1179 } 1180 1180 1181 1181 static int ov772x_get_fmt(struct v4l2_subdev *sd, 1182 - struct v4l2_subdev_pad_config *cfg, 1182 + struct v4l2_subdev_state *sd_state, 1183 1183 struct v4l2_subdev_format *format) 1184 1184 { 1185 1185 struct v4l2_mbus_framefmt *mf = &format->format; ··· 1198 1198 } 1199 1199 1200 1200 static int ov772x_set_fmt(struct v4l2_subdev *sd, 1201 - struct v4l2_subdev_pad_config *cfg, 1201 + struct v4l2_subdev_state *sd_state, 1202 1202 struct v4l2_subdev_format *format) 1203 1203 { 1204 1204 struct ov772x_priv *priv = to_ov772x(sd); ··· 1222 1222 mf->xfer_func = V4L2_XFER_FUNC_DEFAULT; 1223 1223 1224 1224 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1225 - cfg->try_fmt = *mf; 1225 + sd_state->pads->try_fmt = *mf; 1226 1226 return 0; 1227 1227 } 1228 1228 ··· 1320 1320 }; 1321 1321 1322 1322 static int ov772x_enum_frame_interval(struct v4l2_subdev *sd, 1323 - struct v4l2_subdev_pad_config *cfg, 1323 + struct v4l2_subdev_state *sd_state, 1324 1324 struct v4l2_subdev_frame_interval_enum *fie) 1325 1325 { 1326 1326 if (fie->pad || fie->index >= ARRAY_SIZE(ov772x_frame_intervals)) ··· 1338 1338 } 1339 1339 1340 1340 static int ov772x_enum_mbus_code(struct v4l2_subdev *sd, 1341 - struct v4l2_subdev_pad_config *cfg, 1341 + struct v4l2_subdev_state *sd_state, 1342 1342 struct v4l2_subdev_mbus_code_enum *code) 1343 1343 { 1344 1344 if (code->pad || code->index >= ARRAY_SIZE(ov772x_cfmts))
+9 -8
drivers/media/i2c/ov7740.c
··· 707 707 #define N_OV7740_FMTS ARRAY_SIZE(ov7740_formats) 708 708 709 709 static int ov7740_enum_mbus_code(struct v4l2_subdev *sd, 710 - struct v4l2_subdev_pad_config *cfg, 710 + struct v4l2_subdev_state *sd_state, 711 711 struct v4l2_subdev_mbus_code_enum *code) 712 712 { 713 713 if (code->pad || code->index >= N_OV7740_FMTS) ··· 719 719 } 720 720 721 721 static int ov7740_enum_frame_interval(struct v4l2_subdev *sd, 722 - struct v4l2_subdev_pad_config *cfg, 722 + struct v4l2_subdev_state *sd_state, 723 723 struct v4l2_subdev_frame_interval_enum *fie) 724 724 { 725 725 if (fie->pad) ··· 738 738 } 739 739 740 740 static int ov7740_enum_frame_size(struct v4l2_subdev *sd, 741 - struct v4l2_subdev_pad_config *cfg, 741 + struct v4l2_subdev_state *sd_state, 742 742 struct v4l2_subdev_frame_size_enum *fse) 743 743 { 744 744 if (fse->pad) ··· 801 801 } 802 802 803 803 static int ov7740_set_fmt(struct v4l2_subdev *sd, 804 - struct v4l2_subdev_pad_config *cfg, 804 + struct v4l2_subdev_state *sd_state, 805 805 struct v4l2_subdev_format *format) 806 806 { 807 807 struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); ··· 823 823 if (ret) 824 824 goto error; 825 825 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 826 - mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 826 + mbus_fmt = v4l2_subdev_get_try_format(sd, sd_state, 827 + format->pad); 827 828 *mbus_fmt = format->format; 828 829 #endif 829 830 mutex_unlock(&ov7740->mutex); ··· 847 846 } 848 847 849 848 static int ov7740_get_fmt(struct v4l2_subdev *sd, 850 - struct v4l2_subdev_pad_config *cfg, 849 + struct v4l2_subdev_state *sd_state, 851 850 struct v4l2_subdev_format *format) 852 851 { 853 852 struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); ··· 859 858 mutex_lock(&ov7740->mutex); 860 859 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 861 860 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API 862 - mbus_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 861 + mbus_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 863 862 format->format = *mbus_fmt; 864 863 ret = 0; 865 864 #else ··· 904 903 { 905 904 struct ov7740 *ov7740 = container_of(sd, struct ov7740, subdev); 906 905 struct v4l2_mbus_framefmt *format = 907 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 906 + v4l2_subdev_get_try_format(sd, fh->state, 0); 908 907 909 908 mutex_lock(&ov7740->mutex); 910 909 ov7740_get_default_format(sd, format);
+8 -7
drivers/media/i2c/ov8856.c
··· 2083 2083 } 2084 2084 2085 2085 static int ov8856_set_format(struct v4l2_subdev *sd, 2086 - struct v4l2_subdev_pad_config *cfg, 2086 + struct v4l2_subdev_state *sd_state, 2087 2087 struct v4l2_subdev_format *fmt) 2088 2088 { 2089 2089 struct ov8856 *ov8856 = to_ov8856(sd); ··· 2098 2098 mutex_lock(&ov8856->mutex); 2099 2099 ov8856_update_pad_format(mode, &fmt->format); 2100 2100 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 2101 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 2101 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 2102 2102 } else { 2103 2103 ov8856->cur_mode = mode; 2104 2104 __v4l2_ctrl_s_ctrl(ov8856->link_freq, mode->link_freq_index); ··· 2129 2129 } 2130 2130 2131 2131 static int ov8856_get_format(struct v4l2_subdev *sd, 2132 - struct v4l2_subdev_pad_config *cfg, 2132 + struct v4l2_subdev_state *sd_state, 2133 2133 struct v4l2_subdev_format *fmt) 2134 2134 { 2135 2135 struct ov8856 *ov8856 = to_ov8856(sd); 2136 2136 2137 2137 mutex_lock(&ov8856->mutex); 2138 2138 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 2139 - fmt->format = *v4l2_subdev_get_try_format(&ov8856->sd, cfg, 2139 + fmt->format = *v4l2_subdev_get_try_format(&ov8856->sd, 2140 + sd_state, 2140 2141 fmt->pad); 2141 2142 else 2142 2143 ov8856_update_pad_format(ov8856->cur_mode, &fmt->format); ··· 2148 2147 } 2149 2148 2150 2149 static int ov8856_enum_mbus_code(struct v4l2_subdev *sd, 2151 - struct v4l2_subdev_pad_config *cfg, 2150 + struct v4l2_subdev_state *sd_state, 2152 2151 struct v4l2_subdev_mbus_code_enum *code) 2153 2152 { 2154 2153 /* Only one bayer order GRBG is supported */ ··· 2161 2160 } 2162 2161 2163 2162 static int ov8856_enum_frame_size(struct v4l2_subdev *sd, 2164 - struct v4l2_subdev_pad_config *cfg, 2163 + struct v4l2_subdev_state *sd_state, 2165 2164 struct v4l2_subdev_frame_size_enum *fse) 2166 2165 { 2167 2166 struct ov8856 *ov8856 = to_ov8856(sd); ··· 2186 2185 2187 2186 mutex_lock(&ov8856->mutex); 2188 2187 ov8856_update_pad_format(&ov8856->priv_lane->supported_modes[0], 2189 - v4l2_subdev_get_try_format(sd, fh->pad, 0)); 2188 + v4l2_subdev_get_try_format(sd, fh->state, 0)); 2190 2189 mutex_unlock(&ov8856->mutex); 2191 2190 2192 2191 return 0;
+7 -7
drivers/media/i2c/ov8865.c
··· 2542 2542 /* Subdev Pad Operations */ 2543 2543 2544 2544 static int ov8865_enum_mbus_code(struct v4l2_subdev *subdev, 2545 - struct v4l2_subdev_pad_config *config, 2545 + struct v4l2_subdev_state *sd_state, 2546 2546 struct v4l2_subdev_mbus_code_enum *code_enum) 2547 2547 { 2548 2548 if (code_enum->index >= ARRAY_SIZE(ov8865_mbus_codes)) ··· 2571 2571 } 2572 2572 2573 2573 static int ov8865_get_fmt(struct v4l2_subdev *subdev, 2574 - struct v4l2_subdev_pad_config *config, 2574 + struct v4l2_subdev_state *sd_state, 2575 2575 struct v4l2_subdev_format *format) 2576 2576 { 2577 2577 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); ··· 2580 2580 mutex_lock(&sensor->mutex); 2581 2581 2582 2582 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 2583 - *mbus_format = *v4l2_subdev_get_try_format(subdev, config, 2583 + *mbus_format = *v4l2_subdev_get_try_format(subdev, sd_state, 2584 2584 format->pad); 2585 2585 else 2586 2586 ov8865_mbus_format_fill(mbus_format, sensor->state.mbus_code, ··· 2592 2592 } 2593 2593 2594 2594 static int ov8865_set_fmt(struct v4l2_subdev *subdev, 2595 - struct v4l2_subdev_pad_config *config, 2595 + struct v4l2_subdev_state *sd_state, 2596 2596 struct v4l2_subdev_format *format) 2597 2597 { 2598 2598 struct ov8865_sensor *sensor = ov8865_subdev_sensor(subdev); ··· 2633 2633 ov8865_mbus_format_fill(mbus_format, mbus_code, mode); 2634 2634 2635 2635 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 2636 - *v4l2_subdev_get_try_format(subdev, config, format->pad) = 2636 + *v4l2_subdev_get_try_format(subdev, sd_state, format->pad) = 2637 2637 *mbus_format; 2638 2638 else if (sensor->state.mode != mode || 2639 2639 sensor->state.mbus_code != mbus_code) ··· 2646 2646 } 2647 2647 2648 2648 static int ov8865_enum_frame_size(struct v4l2_subdev *subdev, 2649 - struct v4l2_subdev_pad_config *config, 2649 + struct v4l2_subdev_state *sd_state, 2650 2650 struct v4l2_subdev_frame_size_enum *size_enum) 2651 2651 { 2652 2652 const struct ov8865_mode *mode; ··· 2663 2663 } 2664 2664 2665 2665 static int ov8865_enum_frame_interval(struct v4l2_subdev *subdev, 2666 - struct v4l2_subdev_pad_config *config, 2666 + struct v4l2_subdev_state *sd_state, 2667 2667 struct v4l2_subdev_frame_interval_enum *interval_enum) 2668 2668 { 2669 2669 const struct ov8865_mode *mode = NULL;
+4 -4
drivers/media/i2c/ov9640.c
··· 519 519 } 520 520 521 521 static int ov9640_set_fmt(struct v4l2_subdev *sd, 522 - struct v4l2_subdev_pad_config *cfg, 522 + struct v4l2_subdev_state *sd_state, 523 523 struct v4l2_subdev_format *format) 524 524 { 525 525 struct v4l2_mbus_framefmt *mf = &format->format; ··· 547 547 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) 548 548 return ov9640_s_fmt(sd, mf); 549 549 550 - cfg->try_fmt = *mf; 550 + sd_state->pads->try_fmt = *mf; 551 551 552 552 return 0; 553 553 } 554 554 555 555 static int ov9640_enum_mbus_code(struct v4l2_subdev *sd, 556 - struct v4l2_subdev_pad_config *cfg, 556 + struct v4l2_subdev_state *sd_state, 557 557 struct v4l2_subdev_mbus_code_enum *code) 558 558 { 559 559 if (code->pad || code->index >= ARRAY_SIZE(ov9640_codes)) ··· 565 565 } 566 566 567 567 static int ov9640_get_selection(struct v4l2_subdev *sd, 568 - struct v4l2_subdev_pad_config *cfg, 568 + struct v4l2_subdev_state *sd_state, 569 569 struct v4l2_subdev_selection *sel) 570 570 { 571 571 if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE)
+9 -8
drivers/media/i2c/ov9650.c
··· 1070 1070 } 1071 1071 1072 1072 static int ov965x_enum_mbus_code(struct v4l2_subdev *sd, 1073 - struct v4l2_subdev_pad_config *cfg, 1073 + struct v4l2_subdev_state *sd_state, 1074 1074 struct v4l2_subdev_mbus_code_enum *code) 1075 1075 { 1076 1076 if (code->index >= ARRAY_SIZE(ov965x_formats)) ··· 1081 1081 } 1082 1082 1083 1083 static int ov965x_enum_frame_sizes(struct v4l2_subdev *sd, 1084 - struct v4l2_subdev_pad_config *cfg, 1084 + struct v4l2_subdev_state *sd_state, 1085 1085 struct v4l2_subdev_frame_size_enum *fse) 1086 1086 { 1087 1087 int i = ARRAY_SIZE(ov965x_formats); ··· 1167 1167 } 1168 1168 1169 1169 static int ov965x_get_fmt(struct v4l2_subdev *sd, 1170 - struct v4l2_subdev_pad_config *cfg, 1170 + struct v4l2_subdev_state *sd_state, 1171 1171 struct v4l2_subdev_format *fmt) 1172 1172 { 1173 1173 struct ov965x *ov965x = to_ov965x(sd); 1174 1174 struct v4l2_mbus_framefmt *mf; 1175 1175 1176 1176 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1177 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 1177 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 1178 1178 fmt->format = *mf; 1179 1179 return 0; 1180 1180 } ··· 1212 1212 } 1213 1213 1214 1214 static int ov965x_set_fmt(struct v4l2_subdev *sd, 1215 - struct v4l2_subdev_pad_config *cfg, 1215 + struct v4l2_subdev_state *sd_state, 1216 1216 struct v4l2_subdev_format *fmt) 1217 1217 { 1218 1218 unsigned int index = ARRAY_SIZE(ov965x_formats); ··· 1234 1234 mutex_lock(&ov965x->lock); 1235 1235 1236 1236 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1237 - if (cfg) { 1238 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1237 + if (sd_state) { 1238 + mf = v4l2_subdev_get_try_format(sd, sd_state, 1239 + fmt->pad); 1239 1240 *mf = fmt->format; 1240 1241 } 1241 1242 } else { ··· 1365 1364 static int ov965x_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1366 1365 { 1367 1366 struct v4l2_mbus_framefmt *mf = 1368 - v4l2_subdev_get_try_format(sd, fh->pad, 0); 1367 + v4l2_subdev_get_try_format(sd, fh->state, 0); 1369 1368 1370 1369 ov965x_get_default_format(mf); 1371 1370 return 0;
+8 -7
drivers/media/i2c/ov9734.c
··· 705 705 } 706 706 707 707 static int ov9734_set_format(struct v4l2_subdev *sd, 708 - struct v4l2_subdev_pad_config *cfg, 708 + struct v4l2_subdev_state *sd_state, 709 709 struct v4l2_subdev_format *fmt) 710 710 { 711 711 struct ov9734 *ov9734 = to_ov9734(sd); ··· 720 720 mutex_lock(&ov9734->mutex); 721 721 ov9734_update_pad_format(mode, &fmt->format); 722 722 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 723 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = fmt->format; 723 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = fmt->format; 724 724 } else { 725 725 ov9734->cur_mode = mode; 726 726 __v4l2_ctrl_s_ctrl(ov9734->link_freq, mode->link_freq_index); ··· 746 746 } 747 747 748 748 static int ov9734_get_format(struct v4l2_subdev *sd, 749 - struct v4l2_subdev_pad_config *cfg, 749 + struct v4l2_subdev_state *sd_state, 750 750 struct v4l2_subdev_format *fmt) 751 751 { 752 752 struct ov9734 *ov9734 = to_ov9734(sd); 753 753 754 754 mutex_lock(&ov9734->mutex); 755 755 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 756 - fmt->format = *v4l2_subdev_get_try_format(&ov9734->sd, cfg, 756 + fmt->format = *v4l2_subdev_get_try_format(&ov9734->sd, 757 + sd_state, 757 758 fmt->pad); 758 759 else 759 760 ov9734_update_pad_format(ov9734->cur_mode, &fmt->format); ··· 765 764 } 766 765 767 766 static int ov9734_enum_mbus_code(struct v4l2_subdev *sd, 768 - struct v4l2_subdev_pad_config *cfg, 767 + struct v4l2_subdev_state *sd_state, 769 768 struct v4l2_subdev_mbus_code_enum *code) 770 769 { 771 770 if (code->index > 0) ··· 777 776 } 778 777 779 778 static int ov9734_enum_frame_size(struct v4l2_subdev *sd, 780 - struct v4l2_subdev_pad_config *cfg, 779 + struct v4l2_subdev_state *sd_state, 781 780 struct v4l2_subdev_frame_size_enum *fse) 782 781 { 783 782 if (fse->index >= ARRAY_SIZE(supported_modes)) ··· 800 799 801 800 mutex_lock(&ov9734->mutex); 802 801 ov9734_update_pad_format(&supported_modes[0], 803 - v4l2_subdev_get_try_format(sd, fh->pad, 0)); 802 + v4l2_subdev_get_try_format(sd, fh->state, 0)); 804 803 mutex_unlock(&ov9734->mutex); 805 804 806 805 return 0;
+2 -2
drivers/media/i2c/rdacm20.c
··· 403 403 } 404 404 405 405 static int rdacm20_enum_mbus_code(struct v4l2_subdev *sd, 406 - struct v4l2_subdev_pad_config *cfg, 406 + struct v4l2_subdev_state *sd_state, 407 407 struct v4l2_subdev_mbus_code_enum *code) 408 408 { 409 409 if (code->pad || code->index > 0) ··· 415 415 } 416 416 417 417 static int rdacm20_get_fmt(struct v4l2_subdev *sd, 418 - struct v4l2_subdev_pad_config *cfg, 418 + struct v4l2_subdev_state *sd_state, 419 419 struct v4l2_subdev_format *format) 420 420 { 421 421 struct v4l2_mbus_framefmt *mf = &format->format;
+2 -2
drivers/media/i2c/rdacm21.c
··· 281 281 } 282 282 283 283 static int rdacm21_enum_mbus_code(struct v4l2_subdev *sd, 284 - struct v4l2_subdev_pad_config *cfg, 284 + struct v4l2_subdev_state *sd_state, 285 285 struct v4l2_subdev_mbus_code_enum *code) 286 286 { 287 287 if (code->pad || code->index > 0) ··· 293 293 } 294 294 295 295 static int rdacm21_get_fmt(struct v4l2_subdev *sd, 296 - struct v4l2_subdev_pad_config *cfg, 296 + struct v4l2_subdev_state *sd_state, 297 297 struct v4l2_subdev_format *format) 298 298 { 299 299 struct v4l2_mbus_framefmt *mf = &format->format;
+6 -6
drivers/media/i2c/rj54n1cb0c.c
··· 488 488 } 489 489 490 490 static int rj54n1_enum_mbus_code(struct v4l2_subdev *sd, 491 - struct v4l2_subdev_pad_config *cfg, 491 + struct v4l2_subdev_state *sd_state, 492 492 struct v4l2_subdev_mbus_code_enum *code) 493 493 { 494 494 if (code->pad || code->index >= ARRAY_SIZE(rj54n1_colour_fmts)) ··· 541 541 s32 *out_w, s32 *out_h); 542 542 543 543 static int rj54n1_set_selection(struct v4l2_subdev *sd, 544 - struct v4l2_subdev_pad_config *cfg, 544 + struct v4l2_subdev_state *sd_state, 545 545 struct v4l2_subdev_selection *sel) 546 546 { 547 547 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 578 578 } 579 579 580 580 static int rj54n1_get_selection(struct v4l2_subdev *sd, 581 - struct v4l2_subdev_pad_config *cfg, 581 + struct v4l2_subdev_state *sd_state, 582 582 struct v4l2_subdev_selection *sel) 583 583 { 584 584 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 603 603 } 604 604 605 605 static int rj54n1_get_fmt(struct v4l2_subdev *sd, 606 - struct v4l2_subdev_pad_config *cfg, 606 + struct v4l2_subdev_state *sd_state, 607 607 struct v4l2_subdev_format *format) 608 608 { 609 609 struct v4l2_mbus_framefmt *mf = &format->format; ··· 973 973 } 974 974 975 975 static int rj54n1_set_fmt(struct v4l2_subdev *sd, 976 - struct v4l2_subdev_pad_config *cfg, 976 + struct v4l2_subdev_state *sd_state, 977 977 struct v4l2_subdev_format *format) 978 978 { 979 979 struct v4l2_mbus_framefmt *mf = &format->format; ··· 1009 1009 &mf->height, 84, RJ54N1_MAX_HEIGHT, align, 0); 1010 1010 1011 1011 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1012 - cfg->try_fmt = *mf; 1012 + sd_state->pads->try_fmt = *mf; 1013 1013 return 0; 1014 1014 } 1015 1015
+29 -26
drivers/media/i2c/s5c73m3/s5c73m3-core.c
··· 817 817 } 818 818 819 819 static void s5c73m3_oif_try_format(struct s5c73m3 *state, 820 - struct v4l2_subdev_pad_config *cfg, 820 + struct v4l2_subdev_state *sd_state, 821 821 struct v4l2_subdev_format *fmt, 822 822 const struct s5c73m3_frame_size **fs) 823 823 { ··· 844 844 *fs = state->oif_pix_size[RES_ISP]; 845 845 else 846 846 *fs = s5c73m3_find_frame_size( 847 - v4l2_subdev_get_try_format(sd, cfg, 848 - OIF_ISP_PAD), 847 + v4l2_subdev_get_try_format(sd, sd_state, 848 + OIF_ISP_PAD), 849 849 RES_ISP); 850 850 break; 851 851 } ··· 854 854 } 855 855 856 856 static void s5c73m3_try_format(struct s5c73m3 *state, 857 - struct v4l2_subdev_pad_config *cfg, 857 + struct v4l2_subdev_state *sd_state, 858 858 struct v4l2_subdev_format *fmt, 859 859 const struct s5c73m3_frame_size **fs) 860 860 { ··· 946 946 } 947 947 948 948 static int s5c73m3_oif_enum_frame_interval(struct v4l2_subdev *sd, 949 - struct v4l2_subdev_pad_config *cfg, 949 + struct v4l2_subdev_state *sd_state, 950 950 struct v4l2_subdev_frame_interval_enum *fie) 951 951 { 952 952 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); ··· 984 984 } 985 985 986 986 static int s5c73m3_get_fmt(struct v4l2_subdev *sd, 987 - struct v4l2_subdev_pad_config *cfg, 987 + struct v4l2_subdev_state *sd_state, 988 988 struct v4l2_subdev_format *fmt) 989 989 { 990 990 struct s5c73m3 *state = sensor_sd_to_s5c73m3(sd); ··· 992 992 u32 code; 993 993 994 994 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 995 - fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 995 + fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, 996 + fmt->pad); 996 997 return 0; 997 998 } 998 999 ··· 1019 1018 } 1020 1019 1021 1020 static int s5c73m3_oif_get_fmt(struct v4l2_subdev *sd, 1022 - struct v4l2_subdev_pad_config *cfg, 1021 + struct v4l2_subdev_state *sd_state, 1023 1022 struct v4l2_subdev_format *fmt) 1024 1023 { 1025 1024 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); ··· 1027 1026 u32 code; 1028 1027 1029 1028 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1030 - fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1029 + fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, 1030 + fmt->pad); 1031 1031 return 0; 1032 1032 } 1033 1033 ··· 1058 1056 } 1059 1057 1060 1058 static int s5c73m3_set_fmt(struct v4l2_subdev *sd, 1061 - struct v4l2_subdev_pad_config *cfg, 1059 + struct v4l2_subdev_state *sd_state, 1062 1060 struct v4l2_subdev_format *fmt) 1063 1061 { 1064 1062 const struct s5c73m3_frame_size *frame_size = NULL; ··· 1068 1066 1069 1067 mutex_lock(&state->lock); 1070 1068 1071 - s5c73m3_try_format(state, cfg, fmt, &frame_size); 1069 + s5c73m3_try_format(state, sd_state, fmt, &frame_size); 1072 1070 1073 1071 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1074 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1072 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1075 1073 *mf = fmt->format; 1076 1074 } else { 1077 1075 switch (fmt->pad) { ··· 1097 1095 } 1098 1096 1099 1097 static int s5c73m3_oif_set_fmt(struct v4l2_subdev *sd, 1100 - struct v4l2_subdev_pad_config *cfg, 1098 + struct v4l2_subdev_state *sd_state, 1101 1099 struct v4l2_subdev_format *fmt) 1102 1100 { 1103 1101 const struct s5c73m3_frame_size *frame_size = NULL; ··· 1107 1105 1108 1106 mutex_lock(&state->lock); 1109 1107 1110 - s5c73m3_oif_try_format(state, cfg, fmt, &frame_size); 1108 + s5c73m3_oif_try_format(state, sd_state, fmt, &frame_size); 1111 1109 1112 1110 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1113 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1111 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1114 1112 *mf = fmt->format; 1115 1113 if (fmt->pad == OIF_ISP_PAD) { 1116 - mf = v4l2_subdev_get_try_format(sd, cfg, OIF_SOURCE_PAD); 1114 + mf = v4l2_subdev_get_try_format(sd, sd_state, 1115 + OIF_SOURCE_PAD); 1117 1116 mf->width = fmt->format.width; 1118 1117 mf->height = fmt->format.height; 1119 1118 } ··· 1186 1183 } 1187 1184 1188 1185 static int s5c73m3_enum_mbus_code(struct v4l2_subdev *sd, 1189 - struct v4l2_subdev_pad_config *cfg, 1186 + struct v4l2_subdev_state *sd_state, 1190 1187 struct v4l2_subdev_mbus_code_enum *code) 1191 1188 { 1192 1189 static const int codes[] = { ··· 1202 1199 } 1203 1200 1204 1201 static int s5c73m3_oif_enum_mbus_code(struct v4l2_subdev *sd, 1205 - struct v4l2_subdev_pad_config *cfg, 1202 + struct v4l2_subdev_state *sd_state, 1206 1203 struct v4l2_subdev_mbus_code_enum *code) 1207 1204 { 1208 1205 int ret; ··· 1217 1214 } 1218 1215 1219 1216 static int s5c73m3_enum_frame_size(struct v4l2_subdev *sd, 1220 - struct v4l2_subdev_pad_config *cfg, 1217 + struct v4l2_subdev_state *sd_state, 1221 1218 struct v4l2_subdev_frame_size_enum *fse) 1222 1219 { 1223 1220 int idx; ··· 1244 1241 } 1245 1242 1246 1243 static int s5c73m3_oif_enum_frame_size(struct v4l2_subdev *sd, 1247 - struct v4l2_subdev_pad_config *cfg, 1244 + struct v4l2_subdev_state *sd_state, 1248 1245 struct v4l2_subdev_frame_size_enum *fse) 1249 1246 { 1250 1247 struct s5c73m3 *state = oif_sd_to_s5c73m3(sd); ··· 1262 1259 if (fse->which == V4L2_SUBDEV_FORMAT_TRY) { 1263 1260 struct v4l2_mbus_framefmt *mf; 1264 1261 1265 - mf = v4l2_subdev_get_try_format(sd, cfg, 1262 + mf = v4l2_subdev_get_try_format(sd, sd_state, 1266 1263 OIF_ISP_PAD); 1267 1264 1268 1265 w = mf->width; ··· 1318 1315 { 1319 1316 struct v4l2_mbus_framefmt *mf; 1320 1317 1321 - mf = v4l2_subdev_get_try_format(sd, fh->pad, S5C73M3_ISP_PAD); 1318 + mf = v4l2_subdev_get_try_format(sd, fh->state, S5C73M3_ISP_PAD); 1322 1319 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1], 1323 1320 S5C73M3_ISP_FMT); 1324 1321 1325 - mf = v4l2_subdev_get_try_format(sd, fh->pad, S5C73M3_JPEG_PAD); 1322 + mf = v4l2_subdev_get_try_format(sd, fh->state, S5C73M3_JPEG_PAD); 1326 1323 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_jpeg_resolutions[1], 1327 1324 S5C73M3_JPEG_FMT); 1328 1325 ··· 1333 1330 { 1334 1331 struct v4l2_mbus_framefmt *mf; 1335 1332 1336 - mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_ISP_PAD); 1333 + mf = v4l2_subdev_get_try_format(sd, fh->state, OIF_ISP_PAD); 1337 1334 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1], 1338 1335 S5C73M3_ISP_FMT); 1339 1336 1340 - mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_JPEG_PAD); 1337 + mf = v4l2_subdev_get_try_format(sd, fh->state, OIF_JPEG_PAD); 1341 1338 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_jpeg_resolutions[1], 1342 1339 S5C73M3_JPEG_FMT); 1343 1340 1344 - mf = v4l2_subdev_get_try_format(sd, fh->pad, OIF_SOURCE_PAD); 1341 + mf = v4l2_subdev_get_try_format(sd, fh->state, OIF_SOURCE_PAD); 1345 1342 s5c73m3_fill_mbus_fmt(mf, &s5c73m3_isp_resolutions[1], 1346 1343 S5C73M3_ISP_FMT); 1347 1344 return 0;
+13 -9
drivers/media/i2c/s5k4ecgx.c
··· 525 525 } 526 526 527 527 static int s5k4ecgx_enum_mbus_code(struct v4l2_subdev *sd, 528 - struct v4l2_subdev_pad_config *cfg, 528 + struct v4l2_subdev_state *sd_state, 529 529 struct v4l2_subdev_mbus_code_enum *code) 530 530 { 531 531 if (code->index >= ARRAY_SIZE(s5k4ecgx_formats)) ··· 535 535 return 0; 536 536 } 537 537 538 - static int s5k4ecgx_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 539 - struct v4l2_subdev_format *fmt) 538 + static int s5k4ecgx_get_fmt(struct v4l2_subdev *sd, 539 + struct v4l2_subdev_state *sd_state, 540 + struct v4l2_subdev_format *fmt) 540 541 { 541 542 struct s5k4ecgx *priv = to_s5k4ecgx(sd); 542 543 struct v4l2_mbus_framefmt *mf; 543 544 544 545 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 545 - if (cfg) { 546 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 546 + if (sd_state) { 547 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 547 548 fmt->format = *mf; 548 549 } 549 550 return 0; ··· 576 575 return &s5k4ecgx_formats[i]; 577 576 } 578 577 579 - static int s5k4ecgx_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 578 + static int s5k4ecgx_set_fmt(struct v4l2_subdev *sd, 579 + struct v4l2_subdev_state *sd_state, 580 580 struct v4l2_subdev_format *fmt) 581 581 { 582 582 struct s5k4ecgx *priv = to_s5k4ecgx(sd); ··· 592 590 fmt->format.field = V4L2_FIELD_NONE; 593 591 594 592 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 595 - if (cfg) { 596 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 593 + if (sd_state) { 594 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 597 595 *mf = fmt->format; 598 596 } 599 597 return 0; ··· 688 686 */ 689 687 static int s5k4ecgx_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 690 688 { 691 - struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, fh->pad, 0); 689 + struct v4l2_mbus_framefmt *mf = v4l2_subdev_get_try_format(sd, 690 + fh->state, 691 + 0); 692 692 693 693 mf->width = s5k4ecgx_prev_sizes[0].size.width; 694 694 mf->height = s5k4ecgx_prev_sizes[0].size.height;
+28 -21
drivers/media/i2c/s5k5baf.c
··· 1180 1180 * V4L2 subdev pad level and video operations 1181 1181 */ 1182 1182 static int s5k5baf_enum_frame_interval(struct v4l2_subdev *sd, 1183 - struct v4l2_subdev_pad_config *cfg, 1183 + struct v4l2_subdev_state *sd_state, 1184 1184 struct v4l2_subdev_frame_interval_enum *fie) 1185 1185 { 1186 1186 if (fie->index > S5K5BAF_MAX_FR_TIME - S5K5BAF_MIN_FR_TIME || ··· 1199 1199 } 1200 1200 1201 1201 static int s5k5baf_enum_mbus_code(struct v4l2_subdev *sd, 1202 - struct v4l2_subdev_pad_config *cfg, 1202 + struct v4l2_subdev_state *sd_state, 1203 1203 struct v4l2_subdev_mbus_code_enum *code) 1204 1204 { 1205 1205 if (code->pad == PAD_CIS) { ··· 1217 1217 } 1218 1218 1219 1219 static int s5k5baf_enum_frame_size(struct v4l2_subdev *sd, 1220 - struct v4l2_subdev_pad_config *cfg, 1220 + struct v4l2_subdev_state *sd_state, 1221 1221 struct v4l2_subdev_frame_size_enum *fse) 1222 1222 { 1223 1223 int i; ··· 1274 1274 return pixfmt; 1275 1275 } 1276 1276 1277 - static int s5k5baf_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 1278 - struct v4l2_subdev_format *fmt) 1277 + static int s5k5baf_get_fmt(struct v4l2_subdev *sd, 1278 + struct v4l2_subdev_state *sd_state, 1279 + struct v4l2_subdev_format *fmt) 1279 1280 { 1280 1281 struct s5k5baf *state = to_s5k5baf(sd); 1281 1282 const struct s5k5baf_pixfmt *pixfmt; 1282 1283 struct v4l2_mbus_framefmt *mf; 1283 1284 1284 1285 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1285 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1286 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1286 1287 fmt->format = *mf; 1287 1288 return 0; 1288 1289 } ··· 1305 1304 return 0; 1306 1305 } 1307 1306 1308 - static int s5k5baf_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 1309 - struct v4l2_subdev_format *fmt) 1307 + static int s5k5baf_set_fmt(struct v4l2_subdev *sd, 1308 + struct v4l2_subdev_state *sd_state, 1309 + struct v4l2_subdev_format *fmt) 1310 1310 { 1311 1311 struct v4l2_mbus_framefmt *mf = &fmt->format; 1312 1312 struct s5k5baf *state = to_s5k5baf(sd); ··· 1317 1315 mf->field = V4L2_FIELD_NONE; 1318 1316 1319 1317 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1320 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) = *mf; 1318 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) = *mf; 1321 1319 return 0; 1322 1320 } 1323 1321 ··· 1369 1367 } 1370 1368 1371 1369 static int s5k5baf_get_selection(struct v4l2_subdev *sd, 1372 - struct v4l2_subdev_pad_config *cfg, 1370 + struct v4l2_subdev_state *sd_state, 1373 1371 struct v4l2_subdev_selection *sel) 1374 1372 { 1375 1373 enum selection_rect rtype; ··· 1389 1387 1390 1388 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1391 1389 if (rtype == R_COMPOSE) 1392 - sel->r = *v4l2_subdev_get_try_compose(sd, cfg, sel->pad); 1390 + sel->r = *v4l2_subdev_get_try_compose(sd, sd_state, 1391 + sel->pad); 1393 1392 else 1394 - sel->r = *v4l2_subdev_get_try_crop(sd, cfg, sel->pad); 1393 + sel->r = *v4l2_subdev_get_try_crop(sd, sd_state, 1394 + sel->pad); 1395 1395 return 0; 1396 1396 } 1397 1397 ··· 1462 1458 } 1463 1459 1464 1460 static int s5k5baf_set_selection(struct v4l2_subdev *sd, 1465 - struct v4l2_subdev_pad_config *cfg, 1461 + struct v4l2_subdev_state *sd_state, 1466 1462 struct v4l2_subdev_selection *sel) 1467 1463 { 1468 1464 static enum selection_rect rtype; ··· 1483 1479 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1484 1480 rects = (struct v4l2_rect * []) { 1485 1481 &s5k5baf_cis_rect, 1486 - v4l2_subdev_get_try_crop(sd, cfg, PAD_CIS), 1487 - v4l2_subdev_get_try_compose(sd, cfg, PAD_CIS), 1488 - v4l2_subdev_get_try_crop(sd, cfg, PAD_OUT) 1482 + v4l2_subdev_get_try_crop(sd, sd_state, 1483 + PAD_CIS), 1484 + v4l2_subdev_get_try_compose(sd, sd_state, 1485 + PAD_CIS), 1486 + v4l2_subdev_get_try_crop(sd, sd_state, 1487 + PAD_OUT) 1489 1488 }; 1490 1489 s5k5baf_set_rect_and_adjust(rects, rtype, &sel->r); 1491 1490 return 0; ··· 1706 1699 { 1707 1700 struct v4l2_mbus_framefmt *mf; 1708 1701 1709 - mf = v4l2_subdev_get_try_format(sd, fh->pad, PAD_CIS); 1702 + mf = v4l2_subdev_get_try_format(sd, fh->state, PAD_CIS); 1710 1703 s5k5baf_try_cis_format(mf); 1711 1704 1712 1705 if (s5k5baf_is_cis_subdev(sd)) 1713 1706 return 0; 1714 1707 1715 - mf = v4l2_subdev_get_try_format(sd, fh->pad, PAD_OUT); 1708 + mf = v4l2_subdev_get_try_format(sd, fh->state, PAD_OUT); 1716 1709 mf->colorspace = s5k5baf_formats[0].colorspace; 1717 1710 mf->code = s5k5baf_formats[0].code; 1718 1711 mf->width = s5k5baf_cis_rect.width; 1719 1712 mf->height = s5k5baf_cis_rect.height; 1720 1713 mf->field = V4L2_FIELD_NONE; 1721 1714 1722 - *v4l2_subdev_get_try_crop(sd, fh->pad, PAD_CIS) = s5k5baf_cis_rect; 1723 - *v4l2_subdev_get_try_compose(sd, fh->pad, PAD_CIS) = s5k5baf_cis_rect; 1724 - *v4l2_subdev_get_try_crop(sd, fh->pad, PAD_OUT) = s5k5baf_cis_rect; 1715 + *v4l2_subdev_get_try_crop(sd, fh->state, PAD_CIS) = s5k5baf_cis_rect; 1716 + *v4l2_subdev_get_try_compose(sd, fh->state, PAD_CIS) = s5k5baf_cis_rect; 1717 + *v4l2_subdev_get_try_crop(sd, fh->state, PAD_OUT) = s5k5baf_cis_rect; 1725 1718 1726 1719 return 0; 1727 1720 }
+11 -8
drivers/media/i2c/s5k6a3.c
··· 99 99 } 100 100 101 101 static int s5k6a3_enum_mbus_code(struct v4l2_subdev *sd, 102 - struct v4l2_subdev_pad_config *cfg, 102 + struct v4l2_subdev_state *sd_state, 103 103 struct v4l2_subdev_mbus_code_enum *code) 104 104 { 105 105 if (code->index >= ARRAY_SIZE(s5k6a3_formats)) ··· 123 123 } 124 124 125 125 static struct v4l2_mbus_framefmt *__s5k6a3_get_format( 126 - struct s5k6a3 *sensor, struct v4l2_subdev_pad_config *cfg, 126 + struct s5k6a3 *sensor, struct v4l2_subdev_state *sd_state, 127 127 u32 pad, enum v4l2_subdev_format_whence which) 128 128 { 129 129 if (which == V4L2_SUBDEV_FORMAT_TRY) 130 - return cfg ? v4l2_subdev_get_try_format(&sensor->subdev, cfg, pad) : NULL; 130 + return sd_state ? v4l2_subdev_get_try_format(&sensor->subdev, 131 + sd_state, pad) : NULL; 131 132 132 133 return &sensor->format; 133 134 } 134 135 135 136 static int s5k6a3_set_fmt(struct v4l2_subdev *sd, 136 - struct v4l2_subdev_pad_config *cfg, 137 + struct v4l2_subdev_state *sd_state, 137 138 struct v4l2_subdev_format *fmt) 138 139 { 139 140 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); ··· 142 141 143 142 s5k6a3_try_format(&fmt->format); 144 143 145 - mf = __s5k6a3_get_format(sensor, cfg, fmt->pad, fmt->which); 144 + mf = __s5k6a3_get_format(sensor, sd_state, fmt->pad, fmt->which); 146 145 if (mf) { 147 146 mutex_lock(&sensor->lock); 148 147 *mf = fmt->format; ··· 152 151 } 153 152 154 153 static int s5k6a3_get_fmt(struct v4l2_subdev *sd, 155 - struct v4l2_subdev_pad_config *cfg, 154 + struct v4l2_subdev_state *sd_state, 156 155 struct v4l2_subdev_format *fmt) 157 156 { 158 157 struct s5k6a3 *sensor = sd_to_s5k6a3(sd); 159 158 struct v4l2_mbus_framefmt *mf; 160 159 161 - mf = __s5k6a3_get_format(sensor, cfg, fmt->pad, fmt->which); 160 + mf = __s5k6a3_get_format(sensor, sd_state, fmt->pad, fmt->which); 162 161 163 162 mutex_lock(&sensor->lock); 164 163 fmt->format = *mf; ··· 174 173 175 174 static int s5k6a3_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 176 175 { 177 - struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0); 176 + struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, 177 + fh->state, 178 + 0); 178 179 179 180 *format = s5k6a3_formats[0]; 180 181 format->width = S5K6A3_DEFAULT_WIDTH;
+22 -17
drivers/media/i2c/s5k6aa.c
··· 997 997 * V4L2 subdev pad level and video operations 998 998 */ 999 999 static int s5k6aa_enum_frame_interval(struct v4l2_subdev *sd, 1000 - struct v4l2_subdev_pad_config *cfg, 1000 + struct v4l2_subdev_state *sd_state, 1001 1001 struct v4l2_subdev_frame_interval_enum *fie) 1002 1002 { 1003 1003 struct s5k6aa *s5k6aa = to_s5k6aa(sd); ··· 1024 1024 } 1025 1025 1026 1026 static int s5k6aa_enum_mbus_code(struct v4l2_subdev *sd, 1027 - struct v4l2_subdev_pad_config *cfg, 1027 + struct v4l2_subdev_state *sd_state, 1028 1028 struct v4l2_subdev_mbus_code_enum *code) 1029 1029 { 1030 1030 if (code->index >= ARRAY_SIZE(s5k6aa_formats)) ··· 1035 1035 } 1036 1036 1037 1037 static int s5k6aa_enum_frame_size(struct v4l2_subdev *sd, 1038 - struct v4l2_subdev_pad_config *cfg, 1038 + struct v4l2_subdev_state *sd_state, 1039 1039 struct v4l2_subdev_frame_size_enum *fse) 1040 1040 { 1041 1041 int i = ARRAY_SIZE(s5k6aa_formats); ··· 1057 1057 } 1058 1058 1059 1059 static struct v4l2_rect * 1060 - __s5k6aa_get_crop_rect(struct s5k6aa *s5k6aa, struct v4l2_subdev_pad_config *cfg, 1060 + __s5k6aa_get_crop_rect(struct s5k6aa *s5k6aa, 1061 + struct v4l2_subdev_state *sd_state, 1061 1062 enum v4l2_subdev_format_whence which) 1062 1063 { 1063 1064 if (which == V4L2_SUBDEV_FORMAT_ACTIVE) 1064 1065 return &s5k6aa->ccd_rect; 1065 1066 1066 1067 WARN_ON(which != V4L2_SUBDEV_FORMAT_TRY); 1067 - return v4l2_subdev_get_try_crop(&s5k6aa->sd, cfg, 0); 1068 + return v4l2_subdev_get_try_crop(&s5k6aa->sd, sd_state, 0); 1068 1069 } 1069 1070 1070 1071 static void s5k6aa_try_format(struct s5k6aa *s5k6aa, ··· 1089 1088 mf->field = V4L2_FIELD_NONE; 1090 1089 } 1091 1090 1092 - static int s5k6aa_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 1091 + static int s5k6aa_get_fmt(struct v4l2_subdev *sd, 1092 + struct v4l2_subdev_state *sd_state, 1093 1093 struct v4l2_subdev_format *fmt) 1094 1094 { 1095 1095 struct s5k6aa *s5k6aa = to_s5k6aa(sd); ··· 1099 1097 memset(fmt->reserved, 0, sizeof(fmt->reserved)); 1100 1098 1101 1099 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1102 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 1100 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 1103 1101 fmt->format = *mf; 1104 1102 return 0; 1105 1103 } ··· 1111 1109 return 0; 1112 1110 } 1113 1111 1114 - static int s5k6aa_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 1112 + static int s5k6aa_set_fmt(struct v4l2_subdev *sd, 1113 + struct v4l2_subdev_state *sd_state, 1115 1114 struct v4l2_subdev_format *fmt) 1116 1115 { 1117 1116 struct s5k6aa *s5k6aa = to_s5k6aa(sd); ··· 1125 1122 s5k6aa_try_format(s5k6aa, &fmt->format); 1126 1123 1127 1124 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1128 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1129 - crop = v4l2_subdev_get_try_crop(sd, cfg, 0); 1125 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1126 + crop = v4l2_subdev_get_try_crop(sd, sd_state, 0); 1130 1127 } else { 1131 1128 if (s5k6aa->streaming) { 1132 1129 ret = -EBUSY; ··· 1166 1163 } 1167 1164 1168 1165 static int s5k6aa_get_selection(struct v4l2_subdev *sd, 1169 - struct v4l2_subdev_pad_config *cfg, 1166 + struct v4l2_subdev_state *sd_state, 1170 1167 struct v4l2_subdev_selection *sel) 1171 1168 { 1172 1169 struct s5k6aa *s5k6aa = to_s5k6aa(sd); ··· 1178 1175 memset(sel->reserved, 0, sizeof(sel->reserved)); 1179 1176 1180 1177 mutex_lock(&s5k6aa->lock); 1181 - rect = __s5k6aa_get_crop_rect(s5k6aa, cfg, sel->which); 1178 + rect = __s5k6aa_get_crop_rect(s5k6aa, sd_state, sel->which); 1182 1179 sel->r = *rect; 1183 1180 mutex_unlock(&s5k6aa->lock); 1184 1181 ··· 1189 1186 } 1190 1187 1191 1188 static int s5k6aa_set_selection(struct v4l2_subdev *sd, 1192 - struct v4l2_subdev_pad_config *cfg, 1189 + struct v4l2_subdev_state *sd_state, 1193 1190 struct v4l2_subdev_selection *sel) 1194 1191 { 1195 1192 struct s5k6aa *s5k6aa = to_s5k6aa(sd); ··· 1201 1198 return -EINVAL; 1202 1199 1203 1200 mutex_lock(&s5k6aa->lock); 1204 - crop_r = __s5k6aa_get_crop_rect(s5k6aa, cfg, sel->which); 1201 + crop_r = __s5k6aa_get_crop_rect(s5k6aa, sd_state, sel->which); 1205 1202 1206 1203 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 1207 1204 mf = &s5k6aa->preset->mbus_fmt; 1208 1205 s5k6aa->apply_crop = 1; 1209 1206 } else { 1210 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 1207 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 1211 1208 } 1212 1209 v4l_bound_align_image(&sel->r.width, mf->width, 1213 1210 S5K6AA_WIN_WIDTH_MAX, 1, ··· 1428 1425 */ 1429 1426 static int s5k6aa_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) 1430 1427 { 1431 - struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, fh->pad, 0); 1432 - struct v4l2_rect *crop = v4l2_subdev_get_try_crop(sd, fh->pad, 0); 1428 + struct v4l2_mbus_framefmt *format = v4l2_subdev_get_try_format(sd, 1429 + fh->state, 1430 + 0); 1431 + struct v4l2_rect *crop = v4l2_subdev_get_try_crop(sd, fh->state, 0); 1433 1432 1434 1433 format->colorspace = s5k6aa_formats[0].colorspace; 1435 1434 format->code = s5k6aa_formats[0].code;
+3 -3
drivers/media/i2c/saa6752hs.c
··· 543 543 } 544 544 545 545 static int saa6752hs_get_fmt(struct v4l2_subdev *sd, 546 - struct v4l2_subdev_pad_config *cfg, 546 + struct v4l2_subdev_state *sd_state, 547 547 struct v4l2_subdev_format *format) 548 548 { 549 549 struct v4l2_mbus_framefmt *f = &format->format; ··· 563 563 } 564 564 565 565 static int saa6752hs_set_fmt(struct v4l2_subdev *sd, 566 - struct v4l2_subdev_pad_config *cfg, 566 + struct v4l2_subdev_state *sd_state, 567 567 struct v4l2_subdev_format *format) 568 568 { 569 569 struct v4l2_mbus_framefmt *f = &format->format; ··· 595 595 f->colorspace = V4L2_COLORSPACE_SMPTE170M; 596 596 597 597 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 598 - cfg->try_fmt = *f; 598 + sd_state->pads->try_fmt = *f; 599 599 return 0; 600 600 } 601 601
+1 -1
drivers/media/i2c/saa7115.c
··· 1167 1167 } 1168 1168 1169 1169 static int saa711x_set_fmt(struct v4l2_subdev *sd, 1170 - struct v4l2_subdev_pad_config *cfg, 1170 + struct v4l2_subdev_state *sd_state, 1171 1171 struct v4l2_subdev_format *format) 1172 1172 { 1173 1173 struct v4l2_mbus_framefmt *fmt = &format->format;
+1 -1
drivers/media/i2c/saa717x.c
··· 980 980 #endif 981 981 982 982 static int saa717x_set_fmt(struct v4l2_subdev *sd, 983 - struct v4l2_subdev_pad_config *cfg, 983 + struct v4l2_subdev_state *sd_state, 984 984 struct v4l2_subdev_format *format) 985 985 { 986 986 struct v4l2_mbus_framefmt *fmt = &format->format;
+4 -4
drivers/media/i2c/sr030pc30.c
··· 468 468 } 469 469 470 470 static int sr030pc30_enum_mbus_code(struct v4l2_subdev *sd, 471 - struct v4l2_subdev_pad_config *cfg, 471 + struct v4l2_subdev_state *sd_state, 472 472 struct v4l2_subdev_mbus_code_enum *code) 473 473 { 474 474 if (!code || code->pad || ··· 480 480 } 481 481 482 482 static int sr030pc30_get_fmt(struct v4l2_subdev *sd, 483 - struct v4l2_subdev_pad_config *cfg, 483 + struct v4l2_subdev_state *sd_state, 484 484 struct v4l2_subdev_format *format) 485 485 { 486 486 struct v4l2_mbus_framefmt *mf; ··· 525 525 526 526 /* Return nearest media bus frame format. */ 527 527 static int sr030pc30_set_fmt(struct v4l2_subdev *sd, 528 - struct v4l2_subdev_pad_config *cfg, 528 + struct v4l2_subdev_state *sd_state, 529 529 struct v4l2_subdev_format *format) 530 530 { 531 531 struct sr030pc30_info *info = sd ? to_sr030pc30(sd) : NULL; ··· 541 541 542 542 fmt = try_fmt(sd, mf); 543 543 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 544 - cfg->try_fmt = *mf; 544 + sd_state->pads->try_fmt = *mf; 545 545 return 0; 546 546 } 547 547
+11 -10
drivers/media/i2c/st-mipid02.c
··· 643 643 } 644 644 645 645 static int mipid02_enum_mbus_code(struct v4l2_subdev *sd, 646 - struct v4l2_subdev_pad_config *cfg, 646 + struct v4l2_subdev_state *sd_state, 647 647 struct v4l2_subdev_mbus_code_enum *code) 648 648 { 649 649 struct mipid02_dev *bridge = to_mipid02_dev(sd); ··· 670 670 } 671 671 672 672 static int mipid02_get_fmt(struct v4l2_subdev *sd, 673 - struct v4l2_subdev_pad_config *cfg, 673 + struct v4l2_subdev_state *sd_state, 674 674 struct v4l2_subdev_format *format) 675 675 { 676 676 struct v4l2_mbus_framefmt *mbus_fmt = &format->format; ··· 687 687 return -EINVAL; 688 688 689 689 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 690 - fmt = v4l2_subdev_get_try_format(&bridge->sd, cfg, format->pad); 690 + fmt = v4l2_subdev_get_try_format(&bridge->sd, sd_state, 691 + format->pad); 691 692 else 692 693 fmt = &bridge->fmt; 693 694 ··· 705 704 } 706 705 707 706 static void mipid02_set_fmt_source(struct v4l2_subdev *sd, 708 - struct v4l2_subdev_pad_config *cfg, 707 + struct v4l2_subdev_state *sd_state, 709 708 struct v4l2_subdev_format *format) 710 709 { 711 710 struct mipid02_dev *bridge = to_mipid02_dev(sd); ··· 719 718 if (format->which != V4L2_SUBDEV_FORMAT_TRY) 720 719 return; 721 720 722 - *v4l2_subdev_get_try_format(sd, cfg, format->pad) = format->format; 721 + *v4l2_subdev_get_try_format(sd, sd_state, format->pad) = format->format; 723 722 } 724 723 725 724 static void mipid02_set_fmt_sink(struct v4l2_subdev *sd, 726 - struct v4l2_subdev_pad_config *cfg, 725 + struct v4l2_subdev_state *sd_state, 727 726 struct v4l2_subdev_format *format) 728 727 { 729 728 struct mipid02_dev *bridge = to_mipid02_dev(sd); ··· 732 731 format->format.code = get_fmt_code(format->format.code); 733 732 734 733 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 735 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 734 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 736 735 else 737 736 fmt = &bridge->fmt; 738 737 ··· 740 739 } 741 740 742 741 static int mipid02_set_fmt(struct v4l2_subdev *sd, 743 - struct v4l2_subdev_pad_config *cfg, 742 + struct v4l2_subdev_state *sd_state, 744 743 struct v4l2_subdev_format *format) 745 744 { 746 745 struct mipid02_dev *bridge = to_mipid02_dev(sd); ··· 763 762 } 764 763 765 764 if (format->pad == MIPID02_SOURCE) 766 - mipid02_set_fmt_source(sd, cfg, format); 765 + mipid02_set_fmt_source(sd, sd_state, format); 767 766 else 768 - mipid02_set_fmt_sink(sd, cfg, format); 767 + mipid02_set_fmt_sink(sd, sd_state, format); 769 768 770 769 error: 771 770 mutex_unlock(&bridge->lock);
+4 -4
drivers/media/i2c/tc358743.c
··· 1649 1649 /* --------------- PAD OPS --------------- */ 1650 1650 1651 1651 static int tc358743_enum_mbus_code(struct v4l2_subdev *sd, 1652 - struct v4l2_subdev_pad_config *cfg, 1652 + struct v4l2_subdev_state *sd_state, 1653 1653 struct v4l2_subdev_mbus_code_enum *code) 1654 1654 { 1655 1655 switch (code->index) { ··· 1666 1666 } 1667 1667 1668 1668 static int tc358743_get_fmt(struct v4l2_subdev *sd, 1669 - struct v4l2_subdev_pad_config *cfg, 1669 + struct v4l2_subdev_state *sd_state, 1670 1670 struct v4l2_subdev_format *format) 1671 1671 { 1672 1672 struct tc358743_state *state = to_state(sd); ··· 1702 1702 } 1703 1703 1704 1704 static int tc358743_set_fmt(struct v4l2_subdev *sd, 1705 - struct v4l2_subdev_pad_config *cfg, 1705 + struct v4l2_subdev_state *sd_state, 1706 1706 struct v4l2_subdev_format *format) 1707 1707 { 1708 1708 struct tc358743_state *state = to_state(sd); 1709 1709 1710 1710 u32 code = format->format.code; /* is overwritten by get_fmt */ 1711 - int ret = tc358743_get_fmt(sd, cfg, format); 1711 + int ret = tc358743_get_fmt(sd, sd_state, format); 1712 1712 1713 1713 format->format.code = code; 1714 1714
+7 -7
drivers/media/i2c/tda1997x.c
··· 1718 1718 */ 1719 1719 1720 1720 static int tda1997x_init_cfg(struct v4l2_subdev *sd, 1721 - struct v4l2_subdev_pad_config *cfg) 1721 + struct v4l2_subdev_state *sd_state) 1722 1722 { 1723 1723 struct tda1997x_state *state = to_state(sd); 1724 1724 struct v4l2_mbus_framefmt *mf; 1725 1725 1726 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 1726 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 1727 1727 mf->code = state->mbus_codes[0]; 1728 1728 1729 1729 return 0; 1730 1730 } 1731 1731 1732 1732 static int tda1997x_enum_mbus_code(struct v4l2_subdev *sd, 1733 - struct v4l2_subdev_pad_config *cfg, 1733 + struct v4l2_subdev_state *sd_state, 1734 1734 struct v4l2_subdev_mbus_code_enum *code) 1735 1735 { 1736 1736 struct tda1997x_state *state = to_state(sd); ··· 1762 1762 } 1763 1763 1764 1764 static int tda1997x_get_format(struct v4l2_subdev *sd, 1765 - struct v4l2_subdev_pad_config *cfg, 1765 + struct v4l2_subdev_state *sd_state, 1766 1766 struct v4l2_subdev_format *format) 1767 1767 { 1768 1768 struct tda1997x_state *state = to_state(sd); ··· 1775 1775 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1776 1776 struct v4l2_mbus_framefmt *fmt; 1777 1777 1778 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 1778 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 1779 1779 format->format.code = fmt->code; 1780 1780 } else 1781 1781 format->format.code = state->mbus_code; ··· 1784 1784 } 1785 1785 1786 1786 static int tda1997x_set_format(struct v4l2_subdev *sd, 1787 - struct v4l2_subdev_pad_config *cfg, 1787 + struct v4l2_subdev_state *sd_state, 1788 1788 struct v4l2_subdev_format *format) 1789 1789 { 1790 1790 struct tda1997x_state *state = to_state(sd); ··· 1809 1809 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1810 1810 struct v4l2_mbus_framefmt *fmt; 1811 1811 1812 - fmt = v4l2_subdev_get_try_format(sd, cfg, format->pad); 1812 + fmt = v4l2_subdev_get_try_format(sd, sd_state, format->pad); 1813 1813 *fmt = format->format; 1814 1814 } else { 1815 1815 int ret = tda1997x_setup_format(state, format->format.code);
+6 -6
drivers/media/i2c/tvp514x.c
··· 853 853 /** 854 854 * tvp514x_enum_mbus_code() - V4L2 decoder interface handler for enum_mbus_code 855 855 * @sd: pointer to standard V4L2 sub-device structure 856 - * @cfg: pad configuration 856 + * @sd_state: subdev state 857 857 * @code: pointer to v4l2_subdev_mbus_code_enum structure 858 858 * 859 859 * Enumertaes mbus codes supported 860 860 */ 861 861 static int tvp514x_enum_mbus_code(struct v4l2_subdev *sd, 862 - struct v4l2_subdev_pad_config *cfg, 862 + struct v4l2_subdev_state *sd_state, 863 863 struct v4l2_subdev_mbus_code_enum *code) 864 864 { 865 865 u32 pad = code->pad; ··· 880 880 /** 881 881 * tvp514x_get_pad_format() - V4L2 decoder interface handler for get pad format 882 882 * @sd: pointer to standard V4L2 sub-device structure 883 - * @cfg: pad configuration 883 + * @sd_state: subdev state 884 884 * @format: pointer to v4l2_subdev_format structure 885 885 * 886 886 * Retrieves pad format which is active or tried based on requirement 887 887 */ 888 888 static int tvp514x_get_pad_format(struct v4l2_subdev *sd, 889 - struct v4l2_subdev_pad_config *cfg, 889 + struct v4l2_subdev_state *sd_state, 890 890 struct v4l2_subdev_format *format) 891 891 { 892 892 struct tvp514x_decoder *decoder = to_decoder(sd); ··· 912 912 /** 913 913 * tvp514x_set_pad_format() - V4L2 decoder interface handler for set pad format 914 914 * @sd: pointer to standard V4L2 sub-device structure 915 - * @cfg: pad configuration 915 + * @sd_state: subdev state 916 916 * @fmt: pointer to v4l2_subdev_format structure 917 917 * 918 918 * Set pad format for the output pad 919 919 */ 920 920 static int tvp514x_set_pad_format(struct v4l2_subdev *sd, 921 - struct v4l2_subdev_pad_config *cfg, 921 + struct v4l2_subdev_state *sd_state, 922 922 struct v4l2_subdev_format *fmt) 923 923 { 924 924 struct tvp514x_decoder *decoder = to_decoder(sd);
+10 -10
drivers/media/i2c/tvp5150.c
··· 1027 1027 1028 1028 static struct v4l2_rect * 1029 1029 tvp5150_get_pad_crop(struct tvp5150 *decoder, 1030 - struct v4l2_subdev_pad_config *cfg, unsigned int pad, 1030 + struct v4l2_subdev_state *sd_state, unsigned int pad, 1031 1031 enum v4l2_subdev_format_whence which) 1032 1032 { 1033 1033 switch (which) { ··· 1035 1035 return &decoder->rect; 1036 1036 case V4L2_SUBDEV_FORMAT_TRY: 1037 1037 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 1038 - return v4l2_subdev_get_try_crop(&decoder->sd, cfg, pad); 1038 + return v4l2_subdev_get_try_crop(&decoder->sd, sd_state, pad); 1039 1039 #else 1040 1040 return ERR_PTR(-EINVAL); 1041 1041 #endif ··· 1045 1045 } 1046 1046 1047 1047 static int tvp5150_fill_fmt(struct v4l2_subdev *sd, 1048 - struct v4l2_subdev_pad_config *cfg, 1048 + struct v4l2_subdev_state *sd_state, 1049 1049 struct v4l2_subdev_format *format) 1050 1050 { 1051 1051 struct v4l2_mbus_framefmt *f; ··· 1104 1104 } 1105 1105 1106 1106 static int tvp5150_set_selection(struct v4l2_subdev *sd, 1107 - struct v4l2_subdev_pad_config *cfg, 1107 + struct v4l2_subdev_state *sd_state, 1108 1108 struct v4l2_subdev_selection *sel) 1109 1109 { 1110 1110 struct tvp5150 *decoder = to_tvp5150(sd); ··· 1138 1138 sel->which == V4L2_SUBDEV_FORMAT_TRY) 1139 1139 return 0; 1140 1140 1141 - crop = tvp5150_get_pad_crop(decoder, cfg, sel->pad, sel->which); 1141 + crop = tvp5150_get_pad_crop(decoder, sd_state, sel->pad, sel->which); 1142 1142 if (IS_ERR(crop)) 1143 1143 return PTR_ERR(crop); 1144 1144 ··· 1156 1156 } 1157 1157 1158 1158 static int tvp5150_get_selection(struct v4l2_subdev *sd, 1159 - struct v4l2_subdev_pad_config *cfg, 1159 + struct v4l2_subdev_state *sd_state, 1160 1160 struct v4l2_subdev_selection *sel) 1161 1161 { 1162 1162 struct tvp5150 *decoder = container_of(sd, struct tvp5150, sd); ··· 1180 1180 sel->r.height = TVP5150_V_MAX_OTHERS; 1181 1181 return 0; 1182 1182 case V4L2_SEL_TGT_CROP: 1183 - crop = tvp5150_get_pad_crop(decoder, cfg, sel->pad, 1183 + crop = tvp5150_get_pad_crop(decoder, sd_state, sel->pad, 1184 1184 sel->which); 1185 1185 if (IS_ERR(crop)) 1186 1186 return PTR_ERR(crop); ··· 1208 1208 V4L2 subdev pad ops 1209 1209 ****************************************************************************/ 1210 1210 static int tvp5150_init_cfg(struct v4l2_subdev *sd, 1211 - struct v4l2_subdev_pad_config *cfg) 1211 + struct v4l2_subdev_state *sd_state) 1212 1212 { 1213 1213 struct tvp5150 *decoder = to_tvp5150(sd); 1214 1214 v4l2_std_id std; ··· 1229 1229 } 1230 1230 1231 1231 static int tvp5150_enum_mbus_code(struct v4l2_subdev *sd, 1232 - struct v4l2_subdev_pad_config *cfg, 1232 + struct v4l2_subdev_state *sd_state, 1233 1233 struct v4l2_subdev_mbus_code_enum *code) 1234 1234 { 1235 1235 if (code->pad || code->index) ··· 1240 1240 } 1241 1241 1242 1242 static int tvp5150_enum_frame_size(struct v4l2_subdev *sd, 1243 - struct v4l2_subdev_pad_config *cfg, 1243 + struct v4l2_subdev_state *sd_state, 1244 1244 struct v4l2_subdev_frame_size_enum *fse) 1245 1245 { 1246 1246 struct tvp5150 *decoder = to_tvp5150(sd);
+7 -4
drivers/media/i2c/tvp7002.c
··· 797 797 * Enumerate supported digital video formats for pad. 798 798 */ 799 799 static int 800 - tvp7002_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 800 + tvp7002_enum_mbus_code(struct v4l2_subdev *sd, 801 + struct v4l2_subdev_state *sd_state, 801 802 struct v4l2_subdev_mbus_code_enum *code) 802 803 { 803 804 /* Check requested format index is within range */ ··· 819 818 * get video format for pad. 820 819 */ 821 820 static int 822 - tvp7002_get_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 821 + tvp7002_get_pad_format(struct v4l2_subdev *sd, 822 + struct v4l2_subdev_state *sd_state, 823 823 struct v4l2_subdev_format *fmt) 824 824 { 825 825 struct tvp7002 *tvp7002 = to_tvp7002(sd); ··· 843 841 * set video format for pad. 844 842 */ 845 843 static int 846 - tvp7002_set_pad_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 844 + tvp7002_set_pad_format(struct v4l2_subdev *sd, 845 + struct v4l2_subdev_state *sd_state, 847 846 struct v4l2_subdev_format *fmt) 848 847 { 849 - return tvp7002_get_pad_format(sd, cfg, fmt); 848 + return tvp7002_get_pad_format(sd, sd_state, fmt); 850 849 } 851 850 852 851 /* V4L2 core operation handlers */
+5 -5
drivers/media/i2c/tw9910.c
··· 720 720 } 721 721 722 722 static int tw9910_get_selection(struct v4l2_subdev *sd, 723 - struct v4l2_subdev_pad_config *cfg, 723 + struct v4l2_subdev_state *sd_state, 724 724 struct v4l2_subdev_selection *sel) 725 725 { 726 726 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 746 746 } 747 747 748 748 static int tw9910_get_fmt(struct v4l2_subdev *sd, 749 - struct v4l2_subdev_pad_config *cfg, 749 + struct v4l2_subdev_state *sd_state, 750 750 struct v4l2_subdev_format *format) 751 751 { 752 752 struct v4l2_mbus_framefmt *mf = &format->format; ··· 797 797 } 798 798 799 799 static int tw9910_set_fmt(struct v4l2_subdev *sd, 800 - struct v4l2_subdev_pad_config *cfg, 800 + struct v4l2_subdev_state *sd_state, 801 801 struct v4l2_subdev_format *format) 802 802 { 803 803 struct v4l2_mbus_framefmt *mf = &format->format; ··· 829 829 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) 830 830 return tw9910_s_fmt(sd, mf); 831 831 832 - cfg->try_fmt = *mf; 832 + sd_state->pads->try_fmt = *mf; 833 833 834 834 return 0; 835 835 } ··· 886 886 }; 887 887 888 888 static int tw9910_enum_mbus_code(struct v4l2_subdev *sd, 889 - struct v4l2_subdev_pad_config *cfg, 889 + struct v4l2_subdev_state *sd_state, 890 890 struct v4l2_subdev_mbus_code_enum *code) 891 891 { 892 892 if (code->pad || code->index)
+4 -4
drivers/media/i2c/vs6624.c
··· 546 546 } 547 547 548 548 static int vs6624_enum_mbus_code(struct v4l2_subdev *sd, 549 - struct v4l2_subdev_pad_config *cfg, 549 + struct v4l2_subdev_state *sd_state, 550 550 struct v4l2_subdev_mbus_code_enum *code) 551 551 { 552 552 if (code->pad || code->index >= ARRAY_SIZE(vs6624_formats)) ··· 557 557 } 558 558 559 559 static int vs6624_set_fmt(struct v4l2_subdev *sd, 560 - struct v4l2_subdev_pad_config *cfg, 560 + struct v4l2_subdev_state *sd_state, 561 561 struct v4l2_subdev_format *format) 562 562 { 563 563 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 587 587 fmt->colorspace = vs6624_formats[index].colorspace; 588 588 589 589 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 590 - cfg->try_fmt = *fmt; 590 + sd_state->pads->try_fmt = *fmt; 591 591 return 0; 592 592 } 593 593 ··· 637 637 } 638 638 639 639 static int vs6624_get_fmt(struct v4l2_subdev *sd, 640 - struct v4l2_subdev_pad_config *cfg, 640 + struct v4l2_subdev_state *sd_state, 641 641 struct v4l2_subdev_format *format) 642 642 { 643 643 struct vs6624 *sensor = to_vs6624(sd);
+1 -1
drivers/media/pci/cx18/cx18-av-core.c
··· 930 930 } 931 931 932 932 static int cx18_av_set_fmt(struct v4l2_subdev *sd, 933 - struct v4l2_subdev_pad_config *cfg, 933 + struct v4l2_subdev_state *sd_state, 934 934 struct v4l2_subdev_format *format) 935 935 { 936 936 struct v4l2_mbus_framefmt *fmt = &format->format;
+9 -8
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
··· 1199 1199 }; 1200 1200 1201 1201 /* Initialize try_fmt */ 1202 - format = v4l2_subdev_get_try_format(sd, fh->pad, CIO2_PAD_SINK); 1202 + format = v4l2_subdev_get_try_format(sd, fh->state, CIO2_PAD_SINK); 1203 1203 *format = fmt_default; 1204 1204 1205 1205 /* same as sink */ 1206 - format = v4l2_subdev_get_try_format(sd, fh->pad, CIO2_PAD_SOURCE); 1206 + format = v4l2_subdev_get_try_format(sd, fh->state, CIO2_PAD_SOURCE); 1207 1207 *format = fmt_default; 1208 1208 1209 1209 return 0; ··· 1217 1217 * return -EINVAL or zero on success 1218 1218 */ 1219 1219 static int cio2_subdev_get_fmt(struct v4l2_subdev *sd, 1220 - struct v4l2_subdev_pad_config *cfg, 1220 + struct v4l2_subdev_state *sd_state, 1221 1221 struct v4l2_subdev_format *fmt) 1222 1222 { 1223 1223 struct cio2_queue *q = container_of(sd, struct cio2_queue, subdev); ··· 1225 1225 mutex_lock(&q->subdev_lock); 1226 1226 1227 1227 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 1228 - fmt->format = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1228 + fmt->format = *v4l2_subdev_get_try_format(sd, sd_state, 1229 + fmt->pad); 1229 1230 else 1230 1231 fmt->format = q->subdev_fmt; 1231 1232 ··· 1243 1242 * return -EINVAL or zero on success 1244 1243 */ 1245 1244 static int cio2_subdev_set_fmt(struct v4l2_subdev *sd, 1246 - struct v4l2_subdev_pad_config *cfg, 1245 + struct v4l2_subdev_state *sd_state, 1247 1246 struct v4l2_subdev_format *fmt) 1248 1247 { 1249 1248 struct cio2_queue *q = container_of(sd, struct cio2_queue, subdev); ··· 1256 1255 * source always propagates from sink 1257 1256 */ 1258 1257 if (fmt->pad == CIO2_PAD_SOURCE) 1259 - return cio2_subdev_get_fmt(sd, cfg, fmt); 1258 + return cio2_subdev_get_fmt(sd, sd_state, fmt); 1260 1259 1261 1260 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 1262 - mbus = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1261 + mbus = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1263 1262 else 1264 1263 mbus = &q->subdev_fmt; 1265 1264 ··· 1284 1283 } 1285 1284 1286 1285 static int cio2_subdev_enum_mbus_code(struct v4l2_subdev *sd, 1287 - struct v4l2_subdev_pad_config *cfg, 1286 + struct v4l2_subdev_state *sd_state, 1288 1287 struct v4l2_subdev_mbus_code_enum *code) 1289 1288 { 1290 1289 if (code->index >= ARRAY_SIZE(formats))
+4 -1
drivers/media/pci/saa7134/saa7134-empress.c
··· 138 138 { 139 139 struct saa7134_dev *dev = video_drvdata(file); 140 140 struct v4l2_subdev_pad_config pad_cfg; 141 + struct v4l2_subdev_state pad_state = { 142 + .pads = &pad_cfg 143 + }; 141 144 struct v4l2_subdev_format format = { 142 145 .which = V4L2_SUBDEV_FORMAT_TRY, 143 146 }; 144 147 145 148 v4l2_fill_mbus_format(&format.format, &f->fmt.pix, MEDIA_BUS_FMT_FIXED); 146 - saa_call_all(dev, pad, set_fmt, &pad_cfg, &format); 149 + saa_call_all(dev, pad, set_fmt, &pad_state, &format); 147 150 v4l2_fill_pix_format(&f->fmt.pix, &format.format); 148 151 149 152 f->fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
+11 -8
drivers/media/platform/atmel/atmel-isc-base.c
··· 1095 1095 } 1096 1096 1097 1097 static void isc_try_fse(struct isc_device *isc, 1098 - struct v4l2_subdev_pad_config *pad_cfg) 1098 + struct v4l2_subdev_state *sd_state) 1099 1099 { 1100 1100 int ret; 1101 1101 struct v4l2_subdev_frame_size_enum fse = {}; ··· 1111 1111 fse.which = V4L2_SUBDEV_FORMAT_TRY; 1112 1112 1113 1113 ret = v4l2_subdev_call(isc->current_subdev->sd, pad, enum_frame_size, 1114 - pad_cfg, &fse); 1114 + sd_state, &fse); 1115 1115 /* 1116 1116 * Attempt to obtain format size from subdev. If not available, 1117 1117 * just use the maximum ISC can receive. 1118 1118 */ 1119 1119 if (ret) { 1120 - pad_cfg->try_crop.width = isc->max_width; 1121 - pad_cfg->try_crop.height = isc->max_height; 1120 + sd_state->pads->try_crop.width = isc->max_width; 1121 + sd_state->pads->try_crop.height = isc->max_height; 1122 1122 } else { 1123 - pad_cfg->try_crop.width = fse.max_width; 1124 - pad_cfg->try_crop.height = fse.max_height; 1123 + sd_state->pads->try_crop.width = fse.max_width; 1124 + sd_state->pads->try_crop.height = fse.max_height; 1125 1125 } 1126 1126 } 1127 1127 ··· 1132 1132 struct isc_format *sd_fmt = NULL, *direct_fmt = NULL; 1133 1133 struct v4l2_pix_format *pixfmt = &f->fmt.pix; 1134 1134 struct v4l2_subdev_pad_config pad_cfg = {}; 1135 + struct v4l2_subdev_state pad_state = { 1136 + .pads = &pad_cfg 1137 + }; 1135 1138 struct v4l2_subdev_format format = { 1136 1139 .which = V4L2_SUBDEV_FORMAT_TRY, 1137 1140 }; ··· 1232 1229 goto isc_try_fmt_err; 1233 1230 1234 1231 /* Obtain frame sizes if possible to have crop requirements ready */ 1235 - isc_try_fse(isc, &pad_cfg); 1232 + isc_try_fse(isc, &pad_state); 1236 1233 1237 1234 v4l2_fill_mbus_format(&format.format, pixfmt, mbus_code); 1238 1235 ret = v4l2_subdev_call(isc->current_subdev->sd, pad, set_fmt, 1239 - &pad_cfg, &format); 1236 + &pad_state, &format); 1240 1237 if (ret < 0) 1241 1238 goto isc_try_fmt_subdev_err; 1242 1239
+11 -8
drivers/media/platform/atmel/atmel-isi.c
··· 557 557 } 558 558 559 559 static void isi_try_fse(struct atmel_isi *isi, const struct isi_format *isi_fmt, 560 - struct v4l2_subdev_pad_config *pad_cfg) 560 + struct v4l2_subdev_state *sd_state) 561 561 { 562 562 int ret; 563 563 struct v4l2_subdev_frame_size_enum fse = { ··· 566 566 }; 567 567 568 568 ret = v4l2_subdev_call(isi->entity.subdev, pad, enum_frame_size, 569 - pad_cfg, &fse); 569 + sd_state, &fse); 570 570 /* 571 571 * Attempt to obtain format size from subdev. If not available, 572 572 * just use the maximum ISI can receive. 573 573 */ 574 574 if (ret) { 575 - pad_cfg->try_crop.width = MAX_SUPPORT_WIDTH; 576 - pad_cfg->try_crop.height = MAX_SUPPORT_HEIGHT; 575 + sd_state->pads->try_crop.width = MAX_SUPPORT_WIDTH; 576 + sd_state->pads->try_crop.height = MAX_SUPPORT_HEIGHT; 577 577 } else { 578 - pad_cfg->try_crop.width = fse.max_width; 579 - pad_cfg->try_crop.height = fse.max_height; 578 + sd_state->pads->try_crop.width = fse.max_width; 579 + sd_state->pads->try_crop.height = fse.max_height; 580 580 } 581 581 } 582 582 ··· 586 586 const struct isi_format *isi_fmt; 587 587 struct v4l2_pix_format *pixfmt = &f->fmt.pix; 588 588 struct v4l2_subdev_pad_config pad_cfg = {}; 589 + struct v4l2_subdev_state pad_state = { 590 + .pads = &pad_cfg 591 + }; 589 592 struct v4l2_subdev_format format = { 590 593 .which = V4L2_SUBDEV_FORMAT_TRY, 591 594 }; ··· 606 603 607 604 v4l2_fill_mbus_format(&format.format, pixfmt, isi_fmt->mbus_code); 608 605 609 - isi_try_fse(isi, isi_fmt, &pad_cfg); 606 + isi_try_fse(isi, isi_fmt, &pad_state); 610 607 611 608 ret = v4l2_subdev_call(isi->entity.subdev, pad, set_fmt, 612 - &pad_cfg, &format); 609 + &pad_state, &format); 613 610 if (ret < 0) 614 611 return ret; 615 612
+7 -7
drivers/media/platform/cadence/cdns-csi2tx.c
··· 156 156 } 157 157 158 158 static int csi2tx_enum_mbus_code(struct v4l2_subdev *subdev, 159 - struct v4l2_subdev_pad_config *cfg, 159 + struct v4l2_subdev_state *sd_state, 160 160 struct v4l2_subdev_mbus_code_enum *code) 161 161 { 162 162 if (code->pad || code->index >= ARRAY_SIZE(csi2tx_formats)) ··· 169 169 170 170 static struct v4l2_mbus_framefmt * 171 171 __csi2tx_get_pad_format(struct v4l2_subdev *subdev, 172 - struct v4l2_subdev_pad_config *cfg, 172 + struct v4l2_subdev_state *sd_state, 173 173 struct v4l2_subdev_format *fmt) 174 174 { 175 175 struct csi2tx_priv *csi2tx = v4l2_subdev_to_csi2tx(subdev); 176 176 177 177 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 178 - return v4l2_subdev_get_try_format(subdev, cfg, 178 + return v4l2_subdev_get_try_format(subdev, sd_state, 179 179 fmt->pad); 180 180 181 181 return &csi2tx->pad_fmts[fmt->pad]; 182 182 } 183 183 184 184 static int csi2tx_get_pad_format(struct v4l2_subdev *subdev, 185 - struct v4l2_subdev_pad_config *cfg, 185 + struct v4l2_subdev_state *sd_state, 186 186 struct v4l2_subdev_format *fmt) 187 187 { 188 188 const struct v4l2_mbus_framefmt *format; ··· 191 191 if (fmt->pad == CSI2TX_PAD_SOURCE) 192 192 return -EINVAL; 193 193 194 - format = __csi2tx_get_pad_format(subdev, cfg, fmt); 194 + format = __csi2tx_get_pad_format(subdev, sd_state, fmt); 195 195 if (!format) 196 196 return -EINVAL; 197 197 ··· 201 201 } 202 202 203 203 static int csi2tx_set_pad_format(struct v4l2_subdev *subdev, 204 - struct v4l2_subdev_pad_config *cfg, 204 + struct v4l2_subdev_state *sd_state, 205 205 struct v4l2_subdev_format *fmt) 206 206 { 207 207 const struct v4l2_mbus_framefmt *src_format = &fmt->format; ··· 214 214 if (!csi2tx_get_fmt_from_mbus(fmt->format.code)) 215 215 src_format = &fmt_default; 216 216 217 - dst_format = __csi2tx_get_pad_format(subdev, cfg, fmt); 217 + dst_format = __csi2tx_get_pad_format(subdev, sd_state, fmt); 218 218 if (!dst_format) 219 219 return -EINVAL; 220 220
+11 -11
drivers/media/platform/exynos4-is/fimc-capture.c
··· 1454 1454 } 1455 1455 1456 1456 static int fimc_subdev_enum_mbus_code(struct v4l2_subdev *sd, 1457 - struct v4l2_subdev_pad_config *cfg, 1457 + struct v4l2_subdev_state *sd_state, 1458 1458 struct v4l2_subdev_mbus_code_enum *code) 1459 1459 { 1460 1460 struct fimc_fmt *fmt; ··· 1467 1467 } 1468 1468 1469 1469 static int fimc_subdev_get_fmt(struct v4l2_subdev *sd, 1470 - struct v4l2_subdev_pad_config *cfg, 1470 + struct v4l2_subdev_state *sd_state, 1471 1471 struct v4l2_subdev_format *fmt) 1472 1472 { 1473 1473 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); ··· 1476 1476 struct v4l2_mbus_framefmt *mf; 1477 1477 1478 1478 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1479 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1479 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1480 1480 fmt->format = *mf; 1481 1481 return 0; 1482 1482 } ··· 1508 1508 } 1509 1509 1510 1510 static int fimc_subdev_set_fmt(struct v4l2_subdev *sd, 1511 - struct v4l2_subdev_pad_config *cfg, 1511 + struct v4l2_subdev_state *sd_state, 1512 1512 struct v4l2_subdev_format *fmt) 1513 1513 { 1514 1514 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); ··· 1531 1531 mf->colorspace = V4L2_COLORSPACE_JPEG; 1532 1532 1533 1533 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1534 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1534 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1535 1535 *mf = fmt->format; 1536 1536 return 0; 1537 1537 } ··· 1574 1574 } 1575 1575 1576 1576 static int fimc_subdev_get_selection(struct v4l2_subdev *sd, 1577 - struct v4l2_subdev_pad_config *cfg, 1577 + struct v4l2_subdev_state *sd_state, 1578 1578 struct v4l2_subdev_selection *sel) 1579 1579 { 1580 1580 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); ··· 1601 1601 return 0; 1602 1602 1603 1603 case V4L2_SEL_TGT_CROP: 1604 - try_sel = v4l2_subdev_get_try_crop(sd, cfg, sel->pad); 1604 + try_sel = v4l2_subdev_get_try_crop(sd, sd_state, sel->pad); 1605 1605 break; 1606 1606 case V4L2_SEL_TGT_COMPOSE: 1607 - try_sel = v4l2_subdev_get_try_compose(sd, cfg, sel->pad); 1607 + try_sel = v4l2_subdev_get_try_compose(sd, sd_state, sel->pad); 1608 1608 f = &ctx->d_frame; 1609 1609 break; 1610 1610 default: ··· 1630 1630 } 1631 1631 1632 1632 static int fimc_subdev_set_selection(struct v4l2_subdev *sd, 1633 - struct v4l2_subdev_pad_config *cfg, 1633 + struct v4l2_subdev_state *sd_state, 1634 1634 struct v4l2_subdev_selection *sel) 1635 1635 { 1636 1636 struct fimc_dev *fimc = v4l2_get_subdevdata(sd); ··· 1648 1648 1649 1649 switch (sel->target) { 1650 1650 case V4L2_SEL_TGT_CROP: 1651 - try_sel = v4l2_subdev_get_try_crop(sd, cfg, sel->pad); 1651 + try_sel = v4l2_subdev_get_try_crop(sd, sd_state, sel->pad); 1652 1652 break; 1653 1653 case V4L2_SEL_TGT_COMPOSE: 1654 - try_sel = v4l2_subdev_get_try_compose(sd, cfg, sel->pad); 1654 + try_sel = v4l2_subdev_get_try_compose(sd, sd_state, sel->pad); 1655 1655 f = &ctx->d_frame; 1656 1656 break; 1657 1657 default:
+22 -15
drivers/media/platform/exynos4-is/fimc-isp.c
··· 106 106 }; 107 107 108 108 static int fimc_is_subdev_enum_mbus_code(struct v4l2_subdev *sd, 109 - struct v4l2_subdev_pad_config *cfg, 109 + struct v4l2_subdev_state *sd_state, 110 110 struct v4l2_subdev_mbus_code_enum *code) 111 111 { 112 112 const struct fimc_fmt *fmt; ··· 119 119 } 120 120 121 121 static int fimc_isp_subdev_get_fmt(struct v4l2_subdev *sd, 122 - struct v4l2_subdev_pad_config *cfg, 122 + struct v4l2_subdev_state *sd_state, 123 123 struct v4l2_subdev_format *fmt) 124 124 { 125 125 struct fimc_isp *isp = v4l2_get_subdevdata(sd); 126 126 struct v4l2_mbus_framefmt *mf = &fmt->format; 127 127 128 128 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 129 - *mf = *v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 129 + *mf = *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 130 130 return 0; 131 131 } 132 132 ··· 156 156 } 157 157 158 158 static void __isp_subdev_try_format(struct fimc_isp *isp, 159 - struct v4l2_subdev_pad_config *cfg, 159 + struct v4l2_subdev_state *sd_state, 160 160 struct v4l2_subdev_format *fmt) 161 161 { 162 162 struct v4l2_mbus_framefmt *mf = &fmt->format; ··· 172 172 mf->code = MEDIA_BUS_FMT_SGRBG10_1X10; 173 173 } else { 174 174 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 175 - format = v4l2_subdev_get_try_format(&isp->subdev, cfg, 176 - FIMC_ISP_SD_PAD_SINK); 175 + format = v4l2_subdev_get_try_format(&isp->subdev, 176 + sd_state, 177 + FIMC_ISP_SD_PAD_SINK); 177 178 else 178 179 format = &isp->sink_fmt; 179 180 ··· 192 191 } 193 192 194 193 static int fimc_isp_subdev_set_fmt(struct v4l2_subdev *sd, 195 - struct v4l2_subdev_pad_config *cfg, 194 + struct v4l2_subdev_state *sd_state, 196 195 struct v4l2_subdev_format *fmt) 197 196 { 198 197 struct fimc_isp *isp = v4l2_get_subdevdata(sd); ··· 204 203 __func__, fmt->pad, mf->code, mf->width, mf->height); 205 204 206 205 mutex_lock(&isp->subdev_lock); 207 - __isp_subdev_try_format(isp, cfg, fmt); 206 + __isp_subdev_try_format(isp, sd_state, fmt); 208 207 209 208 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 210 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 209 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 211 210 *mf = fmt->format; 212 211 213 212 /* Propagate format to the source pads */ ··· 218 217 for (pad = FIMC_ISP_SD_PAD_SRC_FIFO; 219 218 pad < FIMC_ISP_SD_PADS_NUM; pad++) { 220 219 format.pad = pad; 221 - __isp_subdev_try_format(isp, cfg, &format); 222 - mf = v4l2_subdev_get_try_format(sd, cfg, pad); 220 + __isp_subdev_try_format(isp, sd_state, 221 + &format); 222 + mf = v4l2_subdev_get_try_format(sd, sd_state, 223 + pad); 223 224 *mf = format.format; 224 225 } 225 226 } ··· 233 230 isp->sink_fmt = *mf; 234 231 235 232 format.pad = FIMC_ISP_SD_PAD_SRC_DMA; 236 - __isp_subdev_try_format(isp, cfg, &format); 233 + __isp_subdev_try_format(isp, sd_state, 234 + &format); 237 235 238 236 isp->src_fmt = format.format; 239 237 __is_set_frame_size(is, &isp->src_fmt); ··· 374 370 .field = V4L2_FIELD_NONE, 375 371 }; 376 372 377 - format = v4l2_subdev_get_try_format(sd, fh->pad, FIMC_ISP_SD_PAD_SINK); 373 + format = v4l2_subdev_get_try_format(sd, fh->state, 374 + FIMC_ISP_SD_PAD_SINK); 378 375 *format = fmt; 379 376 380 - format = v4l2_subdev_get_try_format(sd, fh->pad, FIMC_ISP_SD_PAD_SRC_FIFO); 377 + format = v4l2_subdev_get_try_format(sd, fh->state, 378 + FIMC_ISP_SD_PAD_SRC_FIFO); 381 379 fmt.width = DEFAULT_PREVIEW_STILL_WIDTH; 382 380 fmt.height = DEFAULT_PREVIEW_STILL_HEIGHT; 383 381 *format = fmt; 384 382 385 - format = v4l2_subdev_get_try_format(sd, fh->pad, FIMC_ISP_SD_PAD_SRC_DMA); 383 + format = v4l2_subdev_get_try_format(sd, fh->state, 384 + FIMC_ISP_SD_PAD_SRC_DMA); 386 385 *format = fmt; 387 386 388 387 return 0;
+21 -18
drivers/media/platform/exynos4-is/fimc-lite.c
··· 550 550 */ 551 551 552 552 static const struct fimc_fmt *fimc_lite_subdev_try_fmt(struct fimc_lite *fimc, 553 - struct v4l2_subdev_pad_config *cfg, 553 + struct v4l2_subdev_state *sd_state, 554 554 struct v4l2_subdev_format *format) 555 555 { 556 556 struct flite_drvdata *dd = fimc->dd; ··· 574 574 struct v4l2_rect *rect; 575 575 576 576 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 577 - sink_fmt = v4l2_subdev_get_try_format(&fimc->subdev, cfg, 578 - FLITE_SD_PAD_SINK); 577 + sink_fmt = v4l2_subdev_get_try_format(&fimc->subdev, 578 + sd_state, 579 + FLITE_SD_PAD_SINK); 579 580 580 581 mf->code = sink_fmt->code; 581 582 mf->colorspace = sink_fmt->colorspace; 582 583 583 - rect = v4l2_subdev_get_try_crop(&fimc->subdev, cfg, 584 - FLITE_SD_PAD_SINK); 584 + rect = v4l2_subdev_get_try_crop(&fimc->subdev, 585 + sd_state, 586 + FLITE_SD_PAD_SINK); 585 587 } else { 586 588 mf->code = sink->fmt->mbus_code; 587 589 mf->colorspace = sink->fmt->colorspace; ··· 1004 1002 }; 1005 1003 1006 1004 static int fimc_lite_subdev_enum_mbus_code(struct v4l2_subdev *sd, 1007 - struct v4l2_subdev_pad_config *cfg, 1005 + struct v4l2_subdev_state *sd_state, 1008 1006 struct v4l2_subdev_mbus_code_enum *code) 1009 1007 { 1010 1008 const struct fimc_fmt *fmt; ··· 1018 1016 1019 1017 static struct v4l2_mbus_framefmt *__fimc_lite_subdev_get_try_fmt( 1020 1018 struct v4l2_subdev *sd, 1021 - struct v4l2_subdev_pad_config *cfg, unsigned int pad) 1019 + struct v4l2_subdev_state *sd_state, unsigned int pad) 1022 1020 { 1023 1021 if (pad != FLITE_SD_PAD_SINK) 1024 1022 pad = FLITE_SD_PAD_SOURCE_DMA; 1025 1023 1026 - return v4l2_subdev_get_try_format(sd, cfg, pad); 1024 + return v4l2_subdev_get_try_format(sd, sd_state, pad); 1027 1025 } 1028 1026 1029 1027 static int fimc_lite_subdev_get_fmt(struct v4l2_subdev *sd, 1030 - struct v4l2_subdev_pad_config *cfg, 1028 + struct v4l2_subdev_state *sd_state, 1031 1029 struct v4l2_subdev_format *fmt) 1032 1030 { 1033 1031 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); ··· 1035 1033 struct flite_frame *f = &fimc->inp_frame; 1036 1034 1037 1035 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1038 - mf = __fimc_lite_subdev_get_try_fmt(sd, cfg, fmt->pad); 1036 + mf = __fimc_lite_subdev_get_try_fmt(sd, sd_state, fmt->pad); 1039 1037 fmt->format = *mf; 1040 1038 return 0; 1041 1039 } ··· 1058 1056 } 1059 1057 1060 1058 static int fimc_lite_subdev_set_fmt(struct v4l2_subdev *sd, 1061 - struct v4l2_subdev_pad_config *cfg, 1059 + struct v4l2_subdev_state *sd_state, 1062 1060 struct v4l2_subdev_format *fmt) 1063 1061 { 1064 1062 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); ··· 1080 1078 return -EBUSY; 1081 1079 } 1082 1080 1083 - ffmt = fimc_lite_subdev_try_fmt(fimc, cfg, fmt); 1081 + ffmt = fimc_lite_subdev_try_fmt(fimc, sd_state, fmt); 1084 1082 1085 1083 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1086 1084 struct v4l2_mbus_framefmt *src_fmt; 1087 1085 1088 - mf = __fimc_lite_subdev_get_try_fmt(sd, cfg, fmt->pad); 1086 + mf = __fimc_lite_subdev_get_try_fmt(sd, sd_state, fmt->pad); 1089 1087 *mf = fmt->format; 1090 1088 1091 1089 if (fmt->pad == FLITE_SD_PAD_SINK) { 1092 1090 unsigned int pad = FLITE_SD_PAD_SOURCE_DMA; 1093 - src_fmt = __fimc_lite_subdev_get_try_fmt(sd, cfg, pad); 1091 + src_fmt = __fimc_lite_subdev_get_try_fmt(sd, sd_state, 1092 + pad); 1094 1093 *src_fmt = *mf; 1095 1094 } 1096 1095 ··· 1119 1116 } 1120 1117 1121 1118 static int fimc_lite_subdev_get_selection(struct v4l2_subdev *sd, 1122 - struct v4l2_subdev_pad_config *cfg, 1119 + struct v4l2_subdev_state *sd_state, 1123 1120 struct v4l2_subdev_selection *sel) 1124 1121 { 1125 1122 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); ··· 1131 1128 return -EINVAL; 1132 1129 1133 1130 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1134 - sel->r = *v4l2_subdev_get_try_crop(sd, cfg, sel->pad); 1131 + sel->r = *v4l2_subdev_get_try_crop(sd, sd_state, sel->pad); 1135 1132 return 0; 1136 1133 } 1137 1134 ··· 1154 1151 } 1155 1152 1156 1153 static int fimc_lite_subdev_set_selection(struct v4l2_subdev *sd, 1157 - struct v4l2_subdev_pad_config *cfg, 1154 + struct v4l2_subdev_state *sd_state, 1158 1155 struct v4l2_subdev_selection *sel) 1159 1156 { 1160 1157 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); ··· 1168 1165 fimc_lite_try_crop(fimc, &sel->r); 1169 1166 1170 1167 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1171 - *v4l2_subdev_get_try_crop(sd, cfg, sel->pad) = sel->r; 1168 + *v4l2_subdev_get_try_crop(sd, sd_state, sel->pad) = sel->r; 1172 1169 } else { 1173 1170 unsigned long flags; 1174 1171 spin_lock_irqsave(&fimc->slock, flags);
+10 -7
drivers/media/platform/exynos4-is/mipi-csis.c
··· 537 537 } 538 538 539 539 static int s5pcsis_enum_mbus_code(struct v4l2_subdev *sd, 540 - struct v4l2_subdev_pad_config *cfg, 540 + struct v4l2_subdev_state *sd_state, 541 541 struct v4l2_subdev_mbus_code_enum *code) 542 542 { 543 543 if (code->index >= ARRAY_SIZE(s5pcsis_formats)) ··· 565 565 } 566 566 567 567 static struct v4l2_mbus_framefmt *__s5pcsis_get_format( 568 - struct csis_state *state, struct v4l2_subdev_pad_config *cfg, 568 + struct csis_state *state, struct v4l2_subdev_state *sd_state, 569 569 enum v4l2_subdev_format_whence which) 570 570 { 571 571 if (which == V4L2_SUBDEV_FORMAT_TRY) 572 - return cfg ? v4l2_subdev_get_try_format(&state->sd, cfg, 0) : NULL; 572 + return sd_state ? v4l2_subdev_get_try_format(&state->sd, 573 + sd_state, 0) : NULL; 573 574 574 575 return &state->format; 575 576 } 576 577 577 - static int s5pcsis_set_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 578 + static int s5pcsis_set_fmt(struct v4l2_subdev *sd, 579 + struct v4l2_subdev_state *sd_state, 578 580 struct v4l2_subdev_format *fmt) 579 581 { 580 582 struct csis_state *state = sd_to_csis_state(sd); 581 583 struct csis_pix_format const *csis_fmt; 582 584 struct v4l2_mbus_framefmt *mf; 583 585 584 - mf = __s5pcsis_get_format(state, cfg, fmt->which); 586 + mf = __s5pcsis_get_format(state, sd_state, fmt->which); 585 587 586 588 if (fmt->pad == CSIS_PAD_SOURCE) { 587 589 if (mf) { ··· 604 602 return 0; 605 603 } 606 604 607 - static int s5pcsis_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 605 + static int s5pcsis_get_fmt(struct v4l2_subdev *sd, 606 + struct v4l2_subdev_state *sd_state, 608 607 struct v4l2_subdev_format *fmt) 609 608 { 610 609 struct csis_state *state = sd_to_csis_state(sd); 611 610 struct v4l2_mbus_framefmt *mf; 612 611 613 - mf = __s5pcsis_get_format(state, cfg, fmt->which); 612 + mf = __s5pcsis_get_format(state, sd_state, fmt->which); 614 613 if (!mf) 615 614 return -EINVAL; 616 615
+4 -1
drivers/media/platform/marvell-ccic/mcam-core.c
··· 1350 1350 struct mcam_format_struct *f; 1351 1351 struct v4l2_pix_format *pix = &fmt->fmt.pix; 1352 1352 struct v4l2_subdev_pad_config pad_cfg; 1353 + struct v4l2_subdev_state pad_state = { 1354 + .pads = &pad_cfg 1355 + }; 1353 1356 struct v4l2_subdev_format format = { 1354 1357 .which = V4L2_SUBDEV_FORMAT_TRY, 1355 1358 }; ··· 1361 1358 f = mcam_find_format(pix->pixelformat); 1362 1359 pix->pixelformat = f->pixelformat; 1363 1360 v4l2_fill_mbus_format(&format.format, pix, f->mbus_code); 1364 - ret = sensor_call(cam, pad, set_fmt, &pad_cfg, &format); 1361 + ret = sensor_call(cam, pad, set_fmt, &pad_state, &format); 1365 1362 v4l2_fill_pix_format(pix, &format.format); 1366 1363 pix->bytesperline = pix->width * f->bpp; 1367 1364 switch (f->pixelformat) {
+50 -35
drivers/media/platform/omap3isp/ispccdc.c
··· 29 29 #define CCDC_MIN_HEIGHT 32 30 30 31 31 static struct v4l2_mbus_framefmt * 32 - __ccdc_get_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_pad_config *cfg, 32 + __ccdc_get_format(struct isp_ccdc_device *ccdc, 33 + struct v4l2_subdev_state *sd_state, 33 34 unsigned int pad, enum v4l2_subdev_format_whence which); 34 35 35 36 static const unsigned int ccdc_fmts[] = { ··· 1937 1936 } 1938 1937 1939 1938 static struct v4l2_mbus_framefmt * 1940 - __ccdc_get_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_pad_config *cfg, 1939 + __ccdc_get_format(struct isp_ccdc_device *ccdc, 1940 + struct v4l2_subdev_state *sd_state, 1941 1941 unsigned int pad, enum v4l2_subdev_format_whence which) 1942 1942 { 1943 1943 if (which == V4L2_SUBDEV_FORMAT_TRY) 1944 - return v4l2_subdev_get_try_format(&ccdc->subdev, cfg, pad); 1944 + return v4l2_subdev_get_try_format(&ccdc->subdev, sd_state, 1945 + pad); 1945 1946 else 1946 1947 return &ccdc->formats[pad]; 1947 1948 } 1948 1949 1949 1950 static struct v4l2_rect * 1950 - __ccdc_get_crop(struct isp_ccdc_device *ccdc, struct v4l2_subdev_pad_config *cfg, 1951 + __ccdc_get_crop(struct isp_ccdc_device *ccdc, 1952 + struct v4l2_subdev_state *sd_state, 1951 1953 enum v4l2_subdev_format_whence which) 1952 1954 { 1953 1955 if (which == V4L2_SUBDEV_FORMAT_TRY) 1954 - return v4l2_subdev_get_try_crop(&ccdc->subdev, cfg, CCDC_PAD_SOURCE_OF); 1956 + return v4l2_subdev_get_try_crop(&ccdc->subdev, sd_state, 1957 + CCDC_PAD_SOURCE_OF); 1955 1958 else 1956 1959 return &ccdc->crop; 1957 1960 } ··· 1968 1963 * @fmt: Format 1969 1964 */ 1970 1965 static void 1971 - ccdc_try_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_pad_config *cfg, 1966 + ccdc_try_format(struct isp_ccdc_device *ccdc, 1967 + struct v4l2_subdev_state *sd_state, 1972 1968 unsigned int pad, struct v4l2_mbus_framefmt *fmt, 1973 1969 enum v4l2_subdev_format_whence which) 1974 1970 { ··· 2005 1999 case CCDC_PAD_SOURCE_OF: 2006 2000 pixelcode = fmt->code; 2007 2001 field = fmt->field; 2008 - *fmt = *__ccdc_get_format(ccdc, cfg, CCDC_PAD_SINK, which); 2002 + *fmt = *__ccdc_get_format(ccdc, sd_state, CCDC_PAD_SINK, 2003 + which); 2009 2004 2010 2005 /* In SYNC mode the bridge converts YUV formats from 2X8 to 2011 2006 * 1X16. In BT.656 no such conversion occurs. As we don't know ··· 2031 2024 } 2032 2025 2033 2026 /* Hardcode the output size to the crop rectangle size. */ 2034 - crop = __ccdc_get_crop(ccdc, cfg, which); 2027 + crop = __ccdc_get_crop(ccdc, sd_state, which); 2035 2028 fmt->width = crop->width; 2036 2029 fmt->height = crop->height; 2037 2030 ··· 2048 2041 break; 2049 2042 2050 2043 case CCDC_PAD_SOURCE_VP: 2051 - *fmt = *__ccdc_get_format(ccdc, cfg, CCDC_PAD_SINK, which); 2044 + *fmt = *__ccdc_get_format(ccdc, sd_state, CCDC_PAD_SINK, 2045 + which); 2052 2046 2053 2047 /* The video port interface truncates the data to 10 bits. */ 2054 2048 info = omap3isp_video_format_info(fmt->code); ··· 2126 2118 * return -EINVAL or zero on success 2127 2119 */ 2128 2120 static int ccdc_enum_mbus_code(struct v4l2_subdev *sd, 2129 - struct v4l2_subdev_pad_config *cfg, 2121 + struct v4l2_subdev_state *sd_state, 2130 2122 struct v4l2_subdev_mbus_code_enum *code) 2131 2123 { 2132 2124 struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd); ··· 2141 2133 break; 2142 2134 2143 2135 case CCDC_PAD_SOURCE_OF: 2144 - format = __ccdc_get_format(ccdc, cfg, code->pad, 2136 + format = __ccdc_get_format(ccdc, sd_state, code->pad, 2145 2137 code->which); 2146 2138 2147 2139 if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 || ··· 2172 2164 if (code->index != 0) 2173 2165 return -EINVAL; 2174 2166 2175 - format = __ccdc_get_format(ccdc, cfg, code->pad, 2167 + format = __ccdc_get_format(ccdc, sd_state, code->pad, 2176 2168 code->which); 2177 2169 2178 2170 /* A pixel code equal to 0 means that the video port doesn't ··· 2192 2184 } 2193 2185 2194 2186 static int ccdc_enum_frame_size(struct v4l2_subdev *sd, 2195 - struct v4l2_subdev_pad_config *cfg, 2187 + struct v4l2_subdev_state *sd_state, 2196 2188 struct v4l2_subdev_frame_size_enum *fse) 2197 2189 { 2198 2190 struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd); ··· 2204 2196 format.code = fse->code; 2205 2197 format.width = 1; 2206 2198 format.height = 1; 2207 - ccdc_try_format(ccdc, cfg, fse->pad, &format, fse->which); 2199 + ccdc_try_format(ccdc, sd_state, fse->pad, &format, fse->which); 2208 2200 fse->min_width = format.width; 2209 2201 fse->min_height = format.height; 2210 2202 ··· 2214 2206 format.code = fse->code; 2215 2207 format.width = -1; 2216 2208 format.height = -1; 2217 - ccdc_try_format(ccdc, cfg, fse->pad, &format, fse->which); 2209 + ccdc_try_format(ccdc, sd_state, fse->pad, &format, fse->which); 2218 2210 fse->max_width = format.width; 2219 2211 fse->max_height = format.height; 2220 2212 ··· 2232 2224 * 2233 2225 * Return 0 on success or a negative error code otherwise. 2234 2226 */ 2235 - static int ccdc_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 2227 + static int ccdc_get_selection(struct v4l2_subdev *sd, 2228 + struct v4l2_subdev_state *sd_state, 2236 2229 struct v4l2_subdev_selection *sel) 2237 2230 { 2238 2231 struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd); ··· 2249 2240 sel->r.width = INT_MAX; 2250 2241 sel->r.height = INT_MAX; 2251 2242 2252 - format = __ccdc_get_format(ccdc, cfg, CCDC_PAD_SINK, sel->which); 2243 + format = __ccdc_get_format(ccdc, sd_state, CCDC_PAD_SINK, 2244 + sel->which); 2253 2245 ccdc_try_crop(ccdc, format, &sel->r); 2254 2246 break; 2255 2247 2256 2248 case V4L2_SEL_TGT_CROP: 2257 - sel->r = *__ccdc_get_crop(ccdc, cfg, sel->which); 2249 + sel->r = *__ccdc_get_crop(ccdc, sd_state, sel->which); 2258 2250 break; 2259 2251 2260 2252 default: ··· 2276 2266 * 2277 2267 * Return 0 on success or a negative error code otherwise. 2278 2268 */ 2279 - static int ccdc_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 2269 + static int ccdc_set_selection(struct v4l2_subdev *sd, 2270 + struct v4l2_subdev_state *sd_state, 2280 2271 struct v4l2_subdev_selection *sel) 2281 2272 { 2282 2273 struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd); ··· 2296 2285 * rectangle. 2297 2286 */ 2298 2287 if (sel->flags & V4L2_SEL_FLAG_KEEP_CONFIG) { 2299 - sel->r = *__ccdc_get_crop(ccdc, cfg, sel->which); 2288 + sel->r = *__ccdc_get_crop(ccdc, sd_state, sel->which); 2300 2289 return 0; 2301 2290 } 2302 2291 2303 - format = __ccdc_get_format(ccdc, cfg, CCDC_PAD_SINK, sel->which); 2292 + format = __ccdc_get_format(ccdc, sd_state, CCDC_PAD_SINK, sel->which); 2304 2293 ccdc_try_crop(ccdc, format, &sel->r); 2305 - *__ccdc_get_crop(ccdc, cfg, sel->which) = sel->r; 2294 + *__ccdc_get_crop(ccdc, sd_state, sel->which) = sel->r; 2306 2295 2307 2296 /* Update the source format. */ 2308 - format = __ccdc_get_format(ccdc, cfg, CCDC_PAD_SOURCE_OF, sel->which); 2309 - ccdc_try_format(ccdc, cfg, CCDC_PAD_SOURCE_OF, format, sel->which); 2297 + format = __ccdc_get_format(ccdc, sd_state, CCDC_PAD_SOURCE_OF, 2298 + sel->which); 2299 + ccdc_try_format(ccdc, sd_state, CCDC_PAD_SOURCE_OF, format, 2300 + sel->which); 2310 2301 2311 2302 return 0; 2312 2303 } ··· 2322 2309 * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond 2323 2310 * to the format type. 2324 2311 */ 2325 - static int ccdc_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 2312 + static int ccdc_get_format(struct v4l2_subdev *sd, 2313 + struct v4l2_subdev_state *sd_state, 2326 2314 struct v4l2_subdev_format *fmt) 2327 2315 { 2328 2316 struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd); 2329 2317 struct v4l2_mbus_framefmt *format; 2330 2318 2331 - format = __ccdc_get_format(ccdc, cfg, fmt->pad, fmt->which); 2319 + format = __ccdc_get_format(ccdc, sd_state, fmt->pad, fmt->which); 2332 2320 if (format == NULL) 2333 2321 return -EINVAL; 2334 2322 ··· 2346 2332 * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond 2347 2333 * to the format type. 2348 2334 */ 2349 - static int ccdc_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 2335 + static int ccdc_set_format(struct v4l2_subdev *sd, 2336 + struct v4l2_subdev_state *sd_state, 2350 2337 struct v4l2_subdev_format *fmt) 2351 2338 { 2352 2339 struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd); 2353 2340 struct v4l2_mbus_framefmt *format; 2354 2341 struct v4l2_rect *crop; 2355 2342 2356 - format = __ccdc_get_format(ccdc, cfg, fmt->pad, fmt->which); 2343 + format = __ccdc_get_format(ccdc, sd_state, fmt->pad, fmt->which); 2357 2344 if (format == NULL) 2358 2345 return -EINVAL; 2359 2346 2360 - ccdc_try_format(ccdc, cfg, fmt->pad, &fmt->format, fmt->which); 2347 + ccdc_try_format(ccdc, sd_state, fmt->pad, &fmt->format, fmt->which); 2361 2348 *format = fmt->format; 2362 2349 2363 2350 /* Propagate the format from sink to source */ 2364 2351 if (fmt->pad == CCDC_PAD_SINK) { 2365 2352 /* Reset the crop rectangle. */ 2366 - crop = __ccdc_get_crop(ccdc, cfg, fmt->which); 2353 + crop = __ccdc_get_crop(ccdc, sd_state, fmt->which); 2367 2354 crop->left = 0; 2368 2355 crop->top = 0; 2369 2356 crop->width = fmt->format.width; ··· 2373 2358 ccdc_try_crop(ccdc, &fmt->format, crop); 2374 2359 2375 2360 /* Update the source formats. */ 2376 - format = __ccdc_get_format(ccdc, cfg, CCDC_PAD_SOURCE_OF, 2361 + format = __ccdc_get_format(ccdc, sd_state, CCDC_PAD_SOURCE_OF, 2377 2362 fmt->which); 2378 2363 *format = fmt->format; 2379 - ccdc_try_format(ccdc, cfg, CCDC_PAD_SOURCE_OF, format, 2364 + ccdc_try_format(ccdc, sd_state, CCDC_PAD_SOURCE_OF, format, 2380 2365 fmt->which); 2381 2366 2382 - format = __ccdc_get_format(ccdc, cfg, CCDC_PAD_SOURCE_VP, 2367 + format = __ccdc_get_format(ccdc, sd_state, CCDC_PAD_SOURCE_VP, 2383 2368 fmt->which); 2384 2369 *format = fmt->format; 2385 - ccdc_try_format(ccdc, cfg, CCDC_PAD_SOURCE_VP, format, 2370 + ccdc_try_format(ccdc, sd_state, CCDC_PAD_SOURCE_VP, format, 2386 2371 fmt->which); 2387 2372 } 2388 2373 ··· 2469 2454 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 2470 2455 format.format.width = 4096; 2471 2456 format.format.height = 4096; 2472 - ccdc_set_format(sd, fh ? fh->pad : NULL, &format); 2457 + ccdc_set_format(sd, fh ? fh->state : NULL, &format); 2473 2458 2474 2459 return 0; 2475 2460 }
+28 -21
drivers/media/platform/omap3isp/ispccp2.c
··· 618 618 * return format structure or NULL on error 619 619 */ 620 620 static struct v4l2_mbus_framefmt * 621 - __ccp2_get_format(struct isp_ccp2_device *ccp2, struct v4l2_subdev_pad_config *cfg, 622 - unsigned int pad, enum v4l2_subdev_format_whence which) 621 + __ccp2_get_format(struct isp_ccp2_device *ccp2, 622 + struct v4l2_subdev_state *sd_state, 623 + unsigned int pad, enum v4l2_subdev_format_whence which) 623 624 { 624 625 if (which == V4L2_SUBDEV_FORMAT_TRY) 625 - return v4l2_subdev_get_try_format(&ccp2->subdev, cfg, pad); 626 + return v4l2_subdev_get_try_format(&ccp2->subdev, sd_state, 627 + pad); 626 628 else 627 629 return &ccp2->formats[pad]; 628 630 } ··· 638 636 * @which : wanted subdev format 639 637 */ 640 638 static void ccp2_try_format(struct isp_ccp2_device *ccp2, 641 - struct v4l2_subdev_pad_config *cfg, unsigned int pad, 639 + struct v4l2_subdev_state *sd_state, 640 + unsigned int pad, 642 641 struct v4l2_mbus_framefmt *fmt, 643 642 enum v4l2_subdev_format_whence which) 644 643 { ··· 673 670 * When CCP2 write to memory feature will be added this 674 671 * should be changed properly. 675 672 */ 676 - format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, which); 673 + format = __ccp2_get_format(ccp2, sd_state, CCP2_PAD_SINK, 674 + which); 677 675 memcpy(fmt, format, sizeof(*fmt)); 678 676 fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10; 679 677 break; ··· 692 688 * return -EINVAL or zero on success 693 689 */ 694 690 static int ccp2_enum_mbus_code(struct v4l2_subdev *sd, 695 - struct v4l2_subdev_pad_config *cfg, 691 + struct v4l2_subdev_state *sd_state, 696 692 struct v4l2_subdev_mbus_code_enum *code) 697 693 { 698 694 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); ··· 707 703 if (code->index != 0) 708 704 return -EINVAL; 709 705 710 - format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, 711 - code->which); 706 + format = __ccp2_get_format(ccp2, sd_state, CCP2_PAD_SINK, 707 + code->which); 712 708 code->code = format->code; 713 709 } 714 710 ··· 716 712 } 717 713 718 714 static int ccp2_enum_frame_size(struct v4l2_subdev *sd, 719 - struct v4l2_subdev_pad_config *cfg, 715 + struct v4l2_subdev_state *sd_state, 720 716 struct v4l2_subdev_frame_size_enum *fse) 721 717 { 722 718 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); ··· 728 724 format.code = fse->code; 729 725 format.width = 1; 730 726 format.height = 1; 731 - ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); 727 + ccp2_try_format(ccp2, sd_state, fse->pad, &format, fse->which); 732 728 fse->min_width = format.width; 733 729 fse->min_height = format.height; 734 730 ··· 738 734 format.code = fse->code; 739 735 format.width = -1; 740 736 format.height = -1; 741 - ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); 737 + ccp2_try_format(ccp2, sd_state, fse->pad, &format, fse->which); 742 738 fse->max_width = format.width; 743 739 fse->max_height = format.height; 744 740 ··· 752 748 * @fmt : pointer to v4l2 subdev format structure 753 749 * return -EINVAL or zero on success 754 750 */ 755 - static int ccp2_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 756 - struct v4l2_subdev_format *fmt) 751 + static int ccp2_get_format(struct v4l2_subdev *sd, 752 + struct v4l2_subdev_state *sd_state, 753 + struct v4l2_subdev_format *fmt) 757 754 { 758 755 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); 759 756 struct v4l2_mbus_framefmt *format; 760 757 761 - format = __ccp2_get_format(ccp2, cfg, fmt->pad, fmt->which); 758 + format = __ccp2_get_format(ccp2, sd_state, fmt->pad, fmt->which); 762 759 if (format == NULL) 763 760 return -EINVAL; 764 761 ··· 774 769 * @fmt : pointer to v4l2 subdev format structure 775 770 * returns zero 776 771 */ 777 - static int ccp2_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 778 - struct v4l2_subdev_format *fmt) 772 + static int ccp2_set_format(struct v4l2_subdev *sd, 773 + struct v4l2_subdev_state *sd_state, 774 + struct v4l2_subdev_format *fmt) 779 775 { 780 776 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); 781 777 struct v4l2_mbus_framefmt *format; 782 778 783 - format = __ccp2_get_format(ccp2, cfg, fmt->pad, fmt->which); 779 + format = __ccp2_get_format(ccp2, sd_state, fmt->pad, fmt->which); 784 780 if (format == NULL) 785 781 return -EINVAL; 786 782 787 - ccp2_try_format(ccp2, cfg, fmt->pad, &fmt->format, fmt->which); 783 + ccp2_try_format(ccp2, sd_state, fmt->pad, &fmt->format, fmt->which); 788 784 *format = fmt->format; 789 785 790 786 /* Propagate the format from sink to source */ 791 787 if (fmt->pad == CCP2_PAD_SINK) { 792 - format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SOURCE, 788 + format = __ccp2_get_format(ccp2, sd_state, CCP2_PAD_SOURCE, 793 789 fmt->which); 794 790 *format = fmt->format; 795 - ccp2_try_format(ccp2, cfg, CCP2_PAD_SOURCE, format, fmt->which); 791 + ccp2_try_format(ccp2, sd_state, CCP2_PAD_SOURCE, format, 792 + fmt->which); 796 793 } 797 794 798 795 return 0; ··· 819 812 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 820 813 format.format.width = 4096; 821 814 format.format.height = 4096; 822 - ccp2_set_format(sd, fh ? fh->pad : NULL, &format); 815 + ccp2_set_format(sd, fh ? fh->state : NULL, &format); 823 816 824 817 return 0; 825 818 }
+24 -17
drivers/media/platform/omap3isp/ispcsi2.c
··· 827 827 */ 828 828 829 829 static struct v4l2_mbus_framefmt * 830 - __csi2_get_format(struct isp_csi2_device *csi2, struct v4l2_subdev_pad_config *cfg, 830 + __csi2_get_format(struct isp_csi2_device *csi2, 831 + struct v4l2_subdev_state *sd_state, 831 832 unsigned int pad, enum v4l2_subdev_format_whence which) 832 833 { 833 834 if (which == V4L2_SUBDEV_FORMAT_TRY) 834 - return v4l2_subdev_get_try_format(&csi2->subdev, cfg, pad); 835 + return v4l2_subdev_get_try_format(&csi2->subdev, sd_state, 836 + pad); 835 837 else 836 838 return &csi2->formats[pad]; 837 839 } 838 840 839 841 static void 840 - csi2_try_format(struct isp_csi2_device *csi2, struct v4l2_subdev_pad_config *cfg, 842 + csi2_try_format(struct isp_csi2_device *csi2, 843 + struct v4l2_subdev_state *sd_state, 841 844 unsigned int pad, struct v4l2_mbus_framefmt *fmt, 842 845 enum v4l2_subdev_format_whence which) 843 846 { ··· 870 867 * compression. 871 868 */ 872 869 pixelcode = fmt->code; 873 - format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK, which); 870 + format = __csi2_get_format(csi2, sd_state, CSI2_PAD_SINK, 871 + which); 874 872 memcpy(fmt, format, sizeof(*fmt)); 875 873 876 874 /* ··· 897 893 * return -EINVAL or zero on success 898 894 */ 899 895 static int csi2_enum_mbus_code(struct v4l2_subdev *sd, 900 - struct v4l2_subdev_pad_config *cfg, 896 + struct v4l2_subdev_state *sd_state, 901 897 struct v4l2_subdev_mbus_code_enum *code) 902 898 { 903 899 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); ··· 910 906 911 907 code->code = csi2_input_fmts[code->index]; 912 908 } else { 913 - format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK, 909 + format = __csi2_get_format(csi2, sd_state, CSI2_PAD_SINK, 914 910 code->which); 915 911 switch (code->index) { 916 912 case 0: ··· 934 930 } 935 931 936 932 static int csi2_enum_frame_size(struct v4l2_subdev *sd, 937 - struct v4l2_subdev_pad_config *cfg, 933 + struct v4l2_subdev_state *sd_state, 938 934 struct v4l2_subdev_frame_size_enum *fse) 939 935 { 940 936 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); ··· 946 942 format.code = fse->code; 947 943 format.width = 1; 948 944 format.height = 1; 949 - csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); 945 + csi2_try_format(csi2, sd_state, fse->pad, &format, fse->which); 950 946 fse->min_width = format.width; 951 947 fse->min_height = format.height; 952 948 ··· 956 952 format.code = fse->code; 957 953 format.width = -1; 958 954 format.height = -1; 959 - csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); 955 + csi2_try_format(csi2, sd_state, fse->pad, &format, fse->which); 960 956 fse->max_width = format.width; 961 957 fse->max_height = format.height; 962 958 ··· 970 966 * @fmt: pointer to v4l2 subdev format structure 971 967 * return -EINVAL or zero on success 972 968 */ 973 - static int csi2_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 969 + static int csi2_get_format(struct v4l2_subdev *sd, 970 + struct v4l2_subdev_state *sd_state, 974 971 struct v4l2_subdev_format *fmt) 975 972 { 976 973 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); 977 974 struct v4l2_mbus_framefmt *format; 978 975 979 - format = __csi2_get_format(csi2, cfg, fmt->pad, fmt->which); 976 + format = __csi2_get_format(csi2, sd_state, fmt->pad, fmt->which); 980 977 if (format == NULL) 981 978 return -EINVAL; 982 979 ··· 992 987 * @fmt: pointer to v4l2 subdev format structure 993 988 * return -EINVAL or zero on success 994 989 */ 995 - static int csi2_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 990 + static int csi2_set_format(struct v4l2_subdev *sd, 991 + struct v4l2_subdev_state *sd_state, 996 992 struct v4l2_subdev_format *fmt) 997 993 { 998 994 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); 999 995 struct v4l2_mbus_framefmt *format; 1000 996 1001 - format = __csi2_get_format(csi2, cfg, fmt->pad, fmt->which); 997 + format = __csi2_get_format(csi2, sd_state, fmt->pad, fmt->which); 1002 998 if (format == NULL) 1003 999 return -EINVAL; 1004 1000 1005 - csi2_try_format(csi2, cfg, fmt->pad, &fmt->format, fmt->which); 1001 + csi2_try_format(csi2, sd_state, fmt->pad, &fmt->format, fmt->which); 1006 1002 *format = fmt->format; 1007 1003 1008 1004 /* Propagate the format from sink to source */ 1009 1005 if (fmt->pad == CSI2_PAD_SINK) { 1010 - format = __csi2_get_format(csi2, cfg, CSI2_PAD_SOURCE, 1006 + format = __csi2_get_format(csi2, sd_state, CSI2_PAD_SOURCE, 1011 1007 fmt->which); 1012 1008 *format = fmt->format; 1013 - csi2_try_format(csi2, cfg, CSI2_PAD_SOURCE, format, fmt->which); 1009 + csi2_try_format(csi2, sd_state, CSI2_PAD_SOURCE, format, 1010 + fmt->which); 1014 1011 } 1015 1012 1016 1013 return 0; ··· 1037 1030 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 1038 1031 format.format.width = 4096; 1039 1032 format.format.height = 4096; 1040 - csi2_set_format(sd, fh ? fh->pad : NULL, &format); 1033 + csi2_set_format(sd, fh ? fh->state : NULL, &format); 1041 1034 1042 1035 return 0; 1043 1036 }
+40 -29
drivers/media/platform/omap3isp/isppreview.c
··· 1679 1679 } 1680 1680 1681 1681 static struct v4l2_mbus_framefmt * 1682 - __preview_get_format(struct isp_prev_device *prev, struct v4l2_subdev_pad_config *cfg, 1682 + __preview_get_format(struct isp_prev_device *prev, 1683 + struct v4l2_subdev_state *sd_state, 1683 1684 unsigned int pad, enum v4l2_subdev_format_whence which) 1684 1685 { 1685 1686 if (which == V4L2_SUBDEV_FORMAT_TRY) 1686 - return v4l2_subdev_get_try_format(&prev->subdev, cfg, pad); 1687 + return v4l2_subdev_get_try_format(&prev->subdev, sd_state, 1688 + pad); 1687 1689 else 1688 1690 return &prev->formats[pad]; 1689 1691 } 1690 1692 1691 1693 static struct v4l2_rect * 1692 - __preview_get_crop(struct isp_prev_device *prev, struct v4l2_subdev_pad_config *cfg, 1694 + __preview_get_crop(struct isp_prev_device *prev, 1695 + struct v4l2_subdev_state *sd_state, 1693 1696 enum v4l2_subdev_format_whence which) 1694 1697 { 1695 1698 if (which == V4L2_SUBDEV_FORMAT_TRY) 1696 - return v4l2_subdev_get_try_crop(&prev->subdev, cfg, PREV_PAD_SINK); 1699 + return v4l2_subdev_get_try_crop(&prev->subdev, sd_state, 1700 + PREV_PAD_SINK); 1697 1701 else 1698 1702 return &prev->crop; 1699 1703 } ··· 1733 1729 * engine limits and the format and crop rectangles on other pads. 1734 1730 */ 1735 1731 static void preview_try_format(struct isp_prev_device *prev, 1736 - struct v4l2_subdev_pad_config *cfg, unsigned int pad, 1732 + struct v4l2_subdev_state *sd_state, 1733 + unsigned int pad, 1737 1734 struct v4l2_mbus_framefmt *fmt, 1738 1735 enum v4l2_subdev_format_whence which) 1739 1736 { ··· 1775 1770 1776 1771 case PREV_PAD_SOURCE: 1777 1772 pixelcode = fmt->code; 1778 - *fmt = *__preview_get_format(prev, cfg, PREV_PAD_SINK, which); 1773 + *fmt = *__preview_get_format(prev, sd_state, PREV_PAD_SINK, 1774 + which); 1779 1775 1780 1776 switch (pixelcode) { 1781 1777 case MEDIA_BUS_FMT_YUYV8_1X16: ··· 1794 1788 * is not supported yet, hardcode the output size to the crop 1795 1789 * rectangle size. 1796 1790 */ 1797 - crop = __preview_get_crop(prev, cfg, which); 1791 + crop = __preview_get_crop(prev, sd_state, which); 1798 1792 fmt->width = crop->width; 1799 1793 fmt->height = crop->height; 1800 1794 ··· 1868 1862 * return -EINVAL or zero on success 1869 1863 */ 1870 1864 static int preview_enum_mbus_code(struct v4l2_subdev *sd, 1871 - struct v4l2_subdev_pad_config *cfg, 1865 + struct v4l2_subdev_state *sd_state, 1872 1866 struct v4l2_subdev_mbus_code_enum *code) 1873 1867 { 1874 1868 switch (code->pad) { ··· 1892 1886 } 1893 1887 1894 1888 static int preview_enum_frame_size(struct v4l2_subdev *sd, 1895 - struct v4l2_subdev_pad_config *cfg, 1889 + struct v4l2_subdev_state *sd_state, 1896 1890 struct v4l2_subdev_frame_size_enum *fse) 1897 1891 { 1898 1892 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); ··· 1904 1898 format.code = fse->code; 1905 1899 format.width = 1; 1906 1900 format.height = 1; 1907 - preview_try_format(prev, cfg, fse->pad, &format, fse->which); 1901 + preview_try_format(prev, sd_state, fse->pad, &format, fse->which); 1908 1902 fse->min_width = format.width; 1909 1903 fse->min_height = format.height; 1910 1904 ··· 1914 1908 format.code = fse->code; 1915 1909 format.width = -1; 1916 1910 format.height = -1; 1917 - preview_try_format(prev, cfg, fse->pad, &format, fse->which); 1911 + preview_try_format(prev, sd_state, fse->pad, &format, fse->which); 1918 1912 fse->max_width = format.width; 1919 1913 fse->max_height = format.height; 1920 1914 ··· 1932 1926 * Return 0 on success or a negative error code otherwise. 1933 1927 */ 1934 1928 static int preview_get_selection(struct v4l2_subdev *sd, 1935 - struct v4l2_subdev_pad_config *cfg, 1929 + struct v4l2_subdev_state *sd_state, 1936 1930 struct v4l2_subdev_selection *sel) 1937 1931 { 1938 1932 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); ··· 1948 1942 sel->r.width = INT_MAX; 1949 1943 sel->r.height = INT_MAX; 1950 1944 1951 - format = __preview_get_format(prev, cfg, PREV_PAD_SINK, 1945 + format = __preview_get_format(prev, sd_state, PREV_PAD_SINK, 1952 1946 sel->which); 1953 1947 preview_try_crop(prev, format, &sel->r); 1954 1948 break; 1955 1949 1956 1950 case V4L2_SEL_TGT_CROP: 1957 - sel->r = *__preview_get_crop(prev, cfg, sel->which); 1951 + sel->r = *__preview_get_crop(prev, sd_state, sel->which); 1958 1952 break; 1959 1953 1960 1954 default: ··· 1975 1969 * Return 0 on success or a negative error code otherwise. 1976 1970 */ 1977 1971 static int preview_set_selection(struct v4l2_subdev *sd, 1978 - struct v4l2_subdev_pad_config *cfg, 1972 + struct v4l2_subdev_state *sd_state, 1979 1973 struct v4l2_subdev_selection *sel) 1980 1974 { 1981 1975 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); ··· 1994 1988 * rectangle. 1995 1989 */ 1996 1990 if (sel->flags & V4L2_SEL_FLAG_KEEP_CONFIG) { 1997 - sel->r = *__preview_get_crop(prev, cfg, sel->which); 1991 + sel->r = *__preview_get_crop(prev, sd_state, sel->which); 1998 1992 return 0; 1999 1993 } 2000 1994 2001 - format = __preview_get_format(prev, cfg, PREV_PAD_SINK, sel->which); 1995 + format = __preview_get_format(prev, sd_state, PREV_PAD_SINK, 1996 + sel->which); 2002 1997 preview_try_crop(prev, format, &sel->r); 2003 - *__preview_get_crop(prev, cfg, sel->which) = sel->r; 1998 + *__preview_get_crop(prev, sd_state, sel->which) = sel->r; 2004 1999 2005 2000 /* Update the source format. */ 2006 - format = __preview_get_format(prev, cfg, PREV_PAD_SOURCE, sel->which); 2007 - preview_try_format(prev, cfg, PREV_PAD_SOURCE, format, sel->which); 2001 + format = __preview_get_format(prev, sd_state, PREV_PAD_SOURCE, 2002 + sel->which); 2003 + preview_try_format(prev, sd_state, PREV_PAD_SOURCE, format, 2004 + sel->which); 2008 2005 2009 2006 return 0; 2010 2007 } ··· 2019 2010 * @fmt: pointer to v4l2 subdev format structure 2020 2011 * return -EINVAL or zero on success 2021 2012 */ 2022 - static int preview_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 2013 + static int preview_get_format(struct v4l2_subdev *sd, 2014 + struct v4l2_subdev_state *sd_state, 2023 2015 struct v4l2_subdev_format *fmt) 2024 2016 { 2025 2017 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); 2026 2018 struct v4l2_mbus_framefmt *format; 2027 2019 2028 - format = __preview_get_format(prev, cfg, fmt->pad, fmt->which); 2020 + format = __preview_get_format(prev, sd_state, fmt->pad, fmt->which); 2029 2021 if (format == NULL) 2030 2022 return -EINVAL; 2031 2023 ··· 2041 2031 * @fmt: pointer to v4l2 subdev format structure 2042 2032 * return -EINVAL or zero on success 2043 2033 */ 2044 - static int preview_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 2034 + static int preview_set_format(struct v4l2_subdev *sd, 2035 + struct v4l2_subdev_state *sd_state, 2045 2036 struct v4l2_subdev_format *fmt) 2046 2037 { 2047 2038 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); 2048 2039 struct v4l2_mbus_framefmt *format; 2049 2040 struct v4l2_rect *crop; 2050 2041 2051 - format = __preview_get_format(prev, cfg, fmt->pad, fmt->which); 2042 + format = __preview_get_format(prev, sd_state, fmt->pad, fmt->which); 2052 2043 if (format == NULL) 2053 2044 return -EINVAL; 2054 2045 2055 - preview_try_format(prev, cfg, fmt->pad, &fmt->format, fmt->which); 2046 + preview_try_format(prev, sd_state, fmt->pad, &fmt->format, fmt->which); 2056 2047 *format = fmt->format; 2057 2048 2058 2049 /* Propagate the format from sink to source */ 2059 2050 if (fmt->pad == PREV_PAD_SINK) { 2060 2051 /* Reset the crop rectangle. */ 2061 - crop = __preview_get_crop(prev, cfg, fmt->which); 2052 + crop = __preview_get_crop(prev, sd_state, fmt->which); 2062 2053 crop->left = 0; 2063 2054 crop->top = 0; 2064 2055 crop->width = fmt->format.width; ··· 2068 2057 preview_try_crop(prev, &fmt->format, crop); 2069 2058 2070 2059 /* Update the source format. */ 2071 - format = __preview_get_format(prev, cfg, PREV_PAD_SOURCE, 2060 + format = __preview_get_format(prev, sd_state, PREV_PAD_SOURCE, 2072 2061 fmt->which); 2073 - preview_try_format(prev, cfg, PREV_PAD_SOURCE, format, 2062 + preview_try_format(prev, sd_state, PREV_PAD_SOURCE, format, 2074 2063 fmt->which); 2075 2064 } 2076 2065 ··· 2097 2086 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 2098 2087 format.format.width = 4096; 2099 2088 format.format.height = 4096; 2100 - preview_set_format(sd, fh ? fh->pad : NULL, &format); 2089 + preview_set_format(sd, fh ? fh->state : NULL, &format); 2101 2090 2102 2091 return 0; 2103 2092 }
+39 -31
drivers/media/platform/omap3isp/ispresizer.c
··· 114 114 * return zero 115 115 */ 116 116 static struct v4l2_mbus_framefmt * 117 - __resizer_get_format(struct isp_res_device *res, struct v4l2_subdev_pad_config *cfg, 117 + __resizer_get_format(struct isp_res_device *res, 118 + struct v4l2_subdev_state *sd_state, 118 119 unsigned int pad, enum v4l2_subdev_format_whence which) 119 120 { 120 121 if (which == V4L2_SUBDEV_FORMAT_TRY) 121 - return v4l2_subdev_get_try_format(&res->subdev, cfg, pad); 122 + return v4l2_subdev_get_try_format(&res->subdev, sd_state, pad); 122 123 else 123 124 return &res->formats[pad]; 124 125 } ··· 131 130 * @which : wanted subdev crop rectangle 132 131 */ 133 132 static struct v4l2_rect * 134 - __resizer_get_crop(struct isp_res_device *res, struct v4l2_subdev_pad_config *cfg, 133 + __resizer_get_crop(struct isp_res_device *res, 134 + struct v4l2_subdev_state *sd_state, 135 135 enum v4l2_subdev_format_whence which) 136 136 { 137 137 if (which == V4L2_SUBDEV_FORMAT_TRY) 138 - return v4l2_subdev_get_try_crop(&res->subdev, cfg, RESZ_PAD_SINK); 138 + return v4l2_subdev_get_try_crop(&res->subdev, sd_state, 139 + RESZ_PAD_SINK); 139 140 else 140 141 return &res->crop.request; 141 142 } ··· 1223 1220 * Return 0 on success or a negative error code otherwise. 1224 1221 */ 1225 1222 static int resizer_get_selection(struct v4l2_subdev *sd, 1226 - struct v4l2_subdev_pad_config *cfg, 1223 + struct v4l2_subdev_state *sd_state, 1227 1224 struct v4l2_subdev_selection *sel) 1228 1225 { 1229 1226 struct isp_res_device *res = v4l2_get_subdevdata(sd); ··· 1234 1231 if (sel->pad != RESZ_PAD_SINK) 1235 1232 return -EINVAL; 1236 1233 1237 - format_sink = __resizer_get_format(res, cfg, RESZ_PAD_SINK, 1234 + format_sink = __resizer_get_format(res, sd_state, RESZ_PAD_SINK, 1238 1235 sel->which); 1239 - format_source = __resizer_get_format(res, cfg, RESZ_PAD_SOURCE, 1236 + format_source = __resizer_get_format(res, sd_state, RESZ_PAD_SOURCE, 1240 1237 sel->which); 1241 1238 1242 1239 switch (sel->target) { ··· 1251 1248 break; 1252 1249 1253 1250 case V4L2_SEL_TGT_CROP: 1254 - sel->r = *__resizer_get_crop(res, cfg, sel->which); 1251 + sel->r = *__resizer_get_crop(res, sd_state, sel->which); 1255 1252 resizer_calc_ratios(res, &sel->r, format_source, &ratio); 1256 1253 break; 1257 1254 ··· 1276 1273 * Return 0 on success or a negative error code otherwise. 1277 1274 */ 1278 1275 static int resizer_set_selection(struct v4l2_subdev *sd, 1279 - struct v4l2_subdev_pad_config *cfg, 1276 + struct v4l2_subdev_state *sd_state, 1280 1277 struct v4l2_subdev_selection *sel) 1281 1278 { 1282 1279 struct isp_res_device *res = v4l2_get_subdevdata(sd); ··· 1290 1287 sel->pad != RESZ_PAD_SINK) 1291 1288 return -EINVAL; 1292 1289 1293 - format_sink = __resizer_get_format(res, cfg, RESZ_PAD_SINK, 1290 + format_sink = __resizer_get_format(res, sd_state, RESZ_PAD_SINK, 1294 1291 sel->which); 1295 - format_source = *__resizer_get_format(res, cfg, RESZ_PAD_SOURCE, 1292 + format_source = *__resizer_get_format(res, sd_state, RESZ_PAD_SOURCE, 1296 1293 sel->which); 1297 1294 1298 1295 dev_dbg(isp->dev, "%s(%s): req %ux%u -> (%d,%d)/%ux%u -> %ux%u\n", ··· 1310 1307 * stored the mangled rectangle. 1311 1308 */ 1312 1309 resizer_try_crop(format_sink, &format_source, &sel->r); 1313 - *__resizer_get_crop(res, cfg, sel->which) = sel->r; 1310 + *__resizer_get_crop(res, sd_state, sel->which) = sel->r; 1314 1311 resizer_calc_ratios(res, &sel->r, &format_source, &ratio); 1315 1312 1316 1313 dev_dbg(isp->dev, "%s(%s): got %ux%u -> (%d,%d)/%ux%u -> %ux%u\n", ··· 1320 1317 format_source.width, format_source.height); 1321 1318 1322 1319 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1323 - *__resizer_get_format(res, cfg, RESZ_PAD_SOURCE, sel->which) = 1320 + *__resizer_get_format(res, sd_state, RESZ_PAD_SOURCE, 1321 + sel->which) = 1324 1322 format_source; 1325 1323 return 0; 1326 1324 } ··· 1332 1328 */ 1333 1329 spin_lock_irqsave(&res->lock, flags); 1334 1330 1335 - *__resizer_get_format(res, cfg, RESZ_PAD_SOURCE, sel->which) = 1331 + *__resizer_get_format(res, sd_state, RESZ_PAD_SOURCE, sel->which) = 1336 1332 format_source; 1337 1333 1338 1334 res->ratio = ratio; ··· 1375 1371 * @which : wanted subdev format 1376 1372 */ 1377 1373 static void resizer_try_format(struct isp_res_device *res, 1378 - struct v4l2_subdev_pad_config *cfg, unsigned int pad, 1374 + struct v4l2_subdev_state *sd_state, 1375 + unsigned int pad, 1379 1376 struct v4l2_mbus_framefmt *fmt, 1380 1377 enum v4l2_subdev_format_whence which) 1381 1378 { ··· 1397 1392 break; 1398 1393 1399 1394 case RESZ_PAD_SOURCE: 1400 - format = __resizer_get_format(res, cfg, RESZ_PAD_SINK, which); 1395 + format = __resizer_get_format(res, sd_state, RESZ_PAD_SINK, 1396 + which); 1401 1397 fmt->code = format->code; 1402 1398 1403 - crop = *__resizer_get_crop(res, cfg, which); 1399 + crop = *__resizer_get_crop(res, sd_state, which); 1404 1400 resizer_calc_ratios(res, &crop, fmt, &ratio); 1405 1401 break; 1406 1402 } ··· 1418 1412 * return -EINVAL or zero on success 1419 1413 */ 1420 1414 static int resizer_enum_mbus_code(struct v4l2_subdev *sd, 1421 - struct v4l2_subdev_pad_config *cfg, 1415 + struct v4l2_subdev_state *sd_state, 1422 1416 struct v4l2_subdev_mbus_code_enum *code) 1423 1417 { 1424 1418 struct isp_res_device *res = v4l2_get_subdevdata(sd); ··· 1433 1427 if (code->index != 0) 1434 1428 return -EINVAL; 1435 1429 1436 - format = __resizer_get_format(res, cfg, RESZ_PAD_SINK, 1430 + format = __resizer_get_format(res, sd_state, RESZ_PAD_SINK, 1437 1431 code->which); 1438 1432 code->code = format->code; 1439 1433 } ··· 1442 1436 } 1443 1437 1444 1438 static int resizer_enum_frame_size(struct v4l2_subdev *sd, 1445 - struct v4l2_subdev_pad_config *cfg, 1439 + struct v4l2_subdev_state *sd_state, 1446 1440 struct v4l2_subdev_frame_size_enum *fse) 1447 1441 { 1448 1442 struct isp_res_device *res = v4l2_get_subdevdata(sd); ··· 1454 1448 format.code = fse->code; 1455 1449 format.width = 1; 1456 1450 format.height = 1; 1457 - resizer_try_format(res, cfg, fse->pad, &format, fse->which); 1451 + resizer_try_format(res, sd_state, fse->pad, &format, fse->which); 1458 1452 fse->min_width = format.width; 1459 1453 fse->min_height = format.height; 1460 1454 ··· 1464 1458 format.code = fse->code; 1465 1459 format.width = -1; 1466 1460 format.height = -1; 1467 - resizer_try_format(res, cfg, fse->pad, &format, fse->which); 1461 + resizer_try_format(res, sd_state, fse->pad, &format, fse->which); 1468 1462 fse->max_width = format.width; 1469 1463 fse->max_height = format.height; 1470 1464 ··· 1478 1472 * @fmt : pointer to v4l2 subdev format structure 1479 1473 * return -EINVAL or zero on success 1480 1474 */ 1481 - static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 1475 + static int resizer_get_format(struct v4l2_subdev *sd, 1476 + struct v4l2_subdev_state *sd_state, 1482 1477 struct v4l2_subdev_format *fmt) 1483 1478 { 1484 1479 struct isp_res_device *res = v4l2_get_subdevdata(sd); 1485 1480 struct v4l2_mbus_framefmt *format; 1486 1481 1487 - format = __resizer_get_format(res, cfg, fmt->pad, fmt->which); 1482 + format = __resizer_get_format(res, sd_state, fmt->pad, fmt->which); 1488 1483 if (format == NULL) 1489 1484 return -EINVAL; 1490 1485 ··· 1500 1493 * @fmt : pointer to v4l2 subdev format structure 1501 1494 * return -EINVAL or zero on success 1502 1495 */ 1503 - static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, 1496 + static int resizer_set_format(struct v4l2_subdev *sd, 1497 + struct v4l2_subdev_state *sd_state, 1504 1498 struct v4l2_subdev_format *fmt) 1505 1499 { 1506 1500 struct isp_res_device *res = v4l2_get_subdevdata(sd); 1507 1501 struct v4l2_mbus_framefmt *format; 1508 1502 struct v4l2_rect *crop; 1509 1503 1510 - format = __resizer_get_format(res, cfg, fmt->pad, fmt->which); 1504 + format = __resizer_get_format(res, sd_state, fmt->pad, fmt->which); 1511 1505 if (format == NULL) 1512 1506 return -EINVAL; 1513 1507 1514 - resizer_try_format(res, cfg, fmt->pad, &fmt->format, fmt->which); 1508 + resizer_try_format(res, sd_state, fmt->pad, &fmt->format, fmt->which); 1515 1509 *format = fmt->format; 1516 1510 1517 1511 if (fmt->pad == RESZ_PAD_SINK) { 1518 1512 /* reset crop rectangle */ 1519 - crop = __resizer_get_crop(res, cfg, fmt->which); 1513 + crop = __resizer_get_crop(res, sd_state, fmt->which); 1520 1514 crop->left = 0; 1521 1515 crop->top = 0; 1522 1516 crop->width = fmt->format.width; 1523 1517 crop->height = fmt->format.height; 1524 1518 1525 1519 /* Propagate the format from sink to source */ 1526 - format = __resizer_get_format(res, cfg, RESZ_PAD_SOURCE, 1520 + format = __resizer_get_format(res, sd_state, RESZ_PAD_SOURCE, 1527 1521 fmt->which); 1528 1522 *format = fmt->format; 1529 - resizer_try_format(res, cfg, RESZ_PAD_SOURCE, format, 1523 + resizer_try_format(res, sd_state, RESZ_PAD_SOURCE, format, 1530 1524 fmt->which); 1531 1525 } 1532 1526 ··· 1578 1570 format.format.code = MEDIA_BUS_FMT_YUYV8_1X16; 1579 1571 format.format.width = 4096; 1580 1572 format.format.height = 4096; 1581 - resizer_set_format(sd, fh ? fh->pad : NULL, &format); 1573 + resizer_set_format(sd, fh ? fh->state : NULL, &format); 1582 1574 1583 1575 return 0; 1584 1576 }
+4 -1
drivers/media/platform/pxa_camera.c
··· 1792 1792 const struct pxa_camera_format_xlate *xlate; 1793 1793 struct v4l2_pix_format *pix = &f->fmt.pix; 1794 1794 struct v4l2_subdev_pad_config pad_cfg; 1795 + struct v4l2_subdev_state pad_state = { 1796 + .pads = &pad_cfg 1797 + }; 1795 1798 struct v4l2_subdev_format format = { 1796 1799 .which = V4L2_SUBDEV_FORMAT_TRY, 1797 1800 }; ··· 1819 1816 pixfmt == V4L2_PIX_FMT_YUV422P ? 4 : 0); 1820 1817 1821 1818 v4l2_fill_mbus_format(mf, pix, xlate->code); 1822 - ret = sensor_call(pcdev, pad, set_fmt, &pad_cfg, &format); 1819 + ret = sensor_call(pcdev, pad, set_fmt, &pad_state, &format); 1823 1820 if (ret < 0) 1824 1821 return ret; 1825 1822
+18 -17
drivers/media/platform/qcom/camss/camss-csid.c
··· 245 245 */ 246 246 static struct v4l2_mbus_framefmt * 247 247 __csid_get_format(struct csid_device *csid, 248 - struct v4l2_subdev_pad_config *cfg, 248 + struct v4l2_subdev_state *sd_state, 249 249 unsigned int pad, 250 250 enum v4l2_subdev_format_whence which) 251 251 { 252 252 if (which == V4L2_SUBDEV_FORMAT_TRY) 253 - return v4l2_subdev_get_try_format(&csid->subdev, cfg, pad); 253 + return v4l2_subdev_get_try_format(&csid->subdev, sd_state, 254 + pad); 254 255 255 256 return &csid->fmt[pad]; 256 257 } ··· 265 264 * @which: wanted subdev format 266 265 */ 267 266 static void csid_try_format(struct csid_device *csid, 268 - struct v4l2_subdev_pad_config *cfg, 267 + struct v4l2_subdev_state *sd_state, 269 268 unsigned int pad, 270 269 struct v4l2_mbus_framefmt *fmt, 271 270 enum v4l2_subdev_format_whence which) ··· 298 297 /* keep pad formats in sync */ 299 298 u32 code = fmt->code; 300 299 301 - *fmt = *__csid_get_format(csid, cfg, 300 + *fmt = *__csid_get_format(csid, sd_state, 302 301 MSM_CSID_PAD_SINK, which); 303 302 fmt->code = csid->ops->src_pad_code(csid, fmt->code, 0, code); 304 303 } else { ··· 332 331 * return -EINVAL or zero on success 333 332 */ 334 333 static int csid_enum_mbus_code(struct v4l2_subdev *sd, 335 - struct v4l2_subdev_pad_config *cfg, 334 + struct v4l2_subdev_state *sd_state, 336 335 struct v4l2_subdev_mbus_code_enum *code) 337 336 { 338 337 struct csid_device *csid = v4l2_get_subdevdata(sd); ··· 346 345 if (csid->testgen_mode->cur.val == 0) { 347 346 struct v4l2_mbus_framefmt *sink_fmt; 348 347 349 - sink_fmt = __csid_get_format(csid, cfg, 348 + sink_fmt = __csid_get_format(csid, sd_state, 350 349 MSM_CSID_PAD_SINK, 351 350 code->which); 352 351 ··· 373 372 * return -EINVAL or zero on success 374 373 */ 375 374 static int csid_enum_frame_size(struct v4l2_subdev *sd, 376 - struct v4l2_subdev_pad_config *cfg, 375 + struct v4l2_subdev_state *sd_state, 377 376 struct v4l2_subdev_frame_size_enum *fse) 378 377 { 379 378 struct csid_device *csid = v4l2_get_subdevdata(sd); ··· 385 384 format.code = fse->code; 386 385 format.width = 1; 387 386 format.height = 1; 388 - csid_try_format(csid, cfg, fse->pad, &format, fse->which); 387 + csid_try_format(csid, sd_state, fse->pad, &format, fse->which); 389 388 fse->min_width = format.width; 390 389 fse->min_height = format.height; 391 390 ··· 395 394 format.code = fse->code; 396 395 format.width = -1; 397 396 format.height = -1; 398 - csid_try_format(csid, cfg, fse->pad, &format, fse->which); 397 + csid_try_format(csid, sd_state, fse->pad, &format, fse->which); 399 398 fse->max_width = format.width; 400 399 fse->max_height = format.height; 401 400 ··· 411 410 * Return -EINVAL or zero on success 412 411 */ 413 412 static int csid_get_format(struct v4l2_subdev *sd, 414 - struct v4l2_subdev_pad_config *cfg, 413 + struct v4l2_subdev_state *sd_state, 415 414 struct v4l2_subdev_format *fmt) 416 415 { 417 416 struct csid_device *csid = v4l2_get_subdevdata(sd); 418 417 struct v4l2_mbus_framefmt *format; 419 418 420 - format = __csid_get_format(csid, cfg, fmt->pad, fmt->which); 419 + format = __csid_get_format(csid, sd_state, fmt->pad, fmt->which); 421 420 if (format == NULL) 422 421 return -EINVAL; 423 422 ··· 435 434 * Return -EINVAL or zero on success 436 435 */ 437 436 static int csid_set_format(struct v4l2_subdev *sd, 438 - struct v4l2_subdev_pad_config *cfg, 437 + struct v4l2_subdev_state *sd_state, 439 438 struct v4l2_subdev_format *fmt) 440 439 { 441 440 struct csid_device *csid = v4l2_get_subdevdata(sd); 442 441 struct v4l2_mbus_framefmt *format; 443 442 444 - format = __csid_get_format(csid, cfg, fmt->pad, fmt->which); 443 + format = __csid_get_format(csid, sd_state, fmt->pad, fmt->which); 445 444 if (format == NULL) 446 445 return -EINVAL; 447 446 448 - csid_try_format(csid, cfg, fmt->pad, &fmt->format, fmt->which); 447 + csid_try_format(csid, sd_state, fmt->pad, &fmt->format, fmt->which); 449 448 *format = fmt->format; 450 449 451 450 /* Propagate the format from sink to source */ 452 451 if (fmt->pad == MSM_CSID_PAD_SINK) { 453 - format = __csid_get_format(csid, cfg, MSM_CSID_PAD_SRC, 452 + format = __csid_get_format(csid, sd_state, MSM_CSID_PAD_SRC, 454 453 fmt->which); 455 454 456 455 *format = fmt->format; 457 - csid_try_format(csid, cfg, MSM_CSID_PAD_SRC, format, 456 + csid_try_format(csid, sd_state, MSM_CSID_PAD_SRC, format, 458 457 fmt->which); 459 458 } 460 459 ··· 483 482 } 484 483 }; 485 484 486 - return csid_set_format(sd, fh ? fh->pad : NULL, &format); 485 + return csid_set_format(sd, fh ? fh->state : NULL, &format); 487 486 } 488 487 489 488 /*
+23 -17
drivers/media/platform/qcom/camss/camss-csiphy.c
··· 338 338 */ 339 339 static struct v4l2_mbus_framefmt * 340 340 __csiphy_get_format(struct csiphy_device *csiphy, 341 - struct v4l2_subdev_pad_config *cfg, 341 + struct v4l2_subdev_state *sd_state, 342 342 unsigned int pad, 343 343 enum v4l2_subdev_format_whence which) 344 344 { 345 345 if (which == V4L2_SUBDEV_FORMAT_TRY) 346 - return v4l2_subdev_get_try_format(&csiphy->subdev, cfg, pad); 346 + return v4l2_subdev_get_try_format(&csiphy->subdev, sd_state, 347 + pad); 347 348 348 349 return &csiphy->fmt[pad]; 349 350 } ··· 358 357 * @which: wanted subdev format 359 358 */ 360 359 static void csiphy_try_format(struct csiphy_device *csiphy, 361 - struct v4l2_subdev_pad_config *cfg, 360 + struct v4l2_subdev_state *sd_state, 362 361 unsigned int pad, 363 362 struct v4l2_mbus_framefmt *fmt, 364 363 enum v4l2_subdev_format_whence which) ··· 388 387 case MSM_CSIPHY_PAD_SRC: 389 388 /* Set and return a format same as sink pad */ 390 389 391 - *fmt = *__csiphy_get_format(csiphy, cfg, MSM_CSID_PAD_SINK, 390 + *fmt = *__csiphy_get_format(csiphy, sd_state, 391 + MSM_CSID_PAD_SINK, 392 392 which); 393 393 394 394 break; ··· 404 402 * return -EINVAL or zero on success 405 403 */ 406 404 static int csiphy_enum_mbus_code(struct v4l2_subdev *sd, 407 - struct v4l2_subdev_pad_config *cfg, 405 + struct v4l2_subdev_state *sd_state, 408 406 struct v4l2_subdev_mbus_code_enum *code) 409 407 { 410 408 struct csiphy_device *csiphy = v4l2_get_subdevdata(sd); ··· 419 417 if (code->index > 0) 420 418 return -EINVAL; 421 419 422 - format = __csiphy_get_format(csiphy, cfg, MSM_CSIPHY_PAD_SINK, 420 + format = __csiphy_get_format(csiphy, sd_state, 421 + MSM_CSIPHY_PAD_SINK, 423 422 code->which); 424 423 425 424 code->code = format->code; ··· 437 434 * return -EINVAL or zero on success 438 435 */ 439 436 static int csiphy_enum_frame_size(struct v4l2_subdev *sd, 440 - struct v4l2_subdev_pad_config *cfg, 437 + struct v4l2_subdev_state *sd_state, 441 438 struct v4l2_subdev_frame_size_enum *fse) 442 439 { 443 440 struct csiphy_device *csiphy = v4l2_get_subdevdata(sd); ··· 449 446 format.code = fse->code; 450 447 format.width = 1; 451 448 format.height = 1; 452 - csiphy_try_format(csiphy, cfg, fse->pad, &format, fse->which); 449 + csiphy_try_format(csiphy, sd_state, fse->pad, &format, fse->which); 453 450 fse->min_width = format.width; 454 451 fse->min_height = format.height; 455 452 ··· 459 456 format.code = fse->code; 460 457 format.width = -1; 461 458 format.height = -1; 462 - csiphy_try_format(csiphy, cfg, fse->pad, &format, fse->which); 459 + csiphy_try_format(csiphy, sd_state, fse->pad, &format, fse->which); 463 460 fse->max_width = format.width; 464 461 fse->max_height = format.height; 465 462 ··· 475 472 * Return -EINVAL or zero on success 476 473 */ 477 474 static int csiphy_get_format(struct v4l2_subdev *sd, 478 - struct v4l2_subdev_pad_config *cfg, 475 + struct v4l2_subdev_state *sd_state, 479 476 struct v4l2_subdev_format *fmt) 480 477 { 481 478 struct csiphy_device *csiphy = v4l2_get_subdevdata(sd); 482 479 struct v4l2_mbus_framefmt *format; 483 480 484 - format = __csiphy_get_format(csiphy, cfg, fmt->pad, fmt->which); 481 + format = __csiphy_get_format(csiphy, sd_state, fmt->pad, fmt->which); 485 482 if (format == NULL) 486 483 return -EINVAL; 487 484 ··· 499 496 * Return -EINVAL or zero on success 500 497 */ 501 498 static int csiphy_set_format(struct v4l2_subdev *sd, 502 - struct v4l2_subdev_pad_config *cfg, 499 + struct v4l2_subdev_state *sd_state, 503 500 struct v4l2_subdev_format *fmt) 504 501 { 505 502 struct csiphy_device *csiphy = v4l2_get_subdevdata(sd); 506 503 struct v4l2_mbus_framefmt *format; 507 504 508 - format = __csiphy_get_format(csiphy, cfg, fmt->pad, fmt->which); 505 + format = __csiphy_get_format(csiphy, sd_state, fmt->pad, fmt->which); 509 506 if (format == NULL) 510 507 return -EINVAL; 511 508 512 - csiphy_try_format(csiphy, cfg, fmt->pad, &fmt->format, fmt->which); 509 + csiphy_try_format(csiphy, sd_state, fmt->pad, &fmt->format, 510 + fmt->which); 513 511 *format = fmt->format; 514 512 515 513 /* Propagate the format from sink to source */ 516 514 if (fmt->pad == MSM_CSIPHY_PAD_SINK) { 517 - format = __csiphy_get_format(csiphy, cfg, MSM_CSIPHY_PAD_SRC, 515 + format = __csiphy_get_format(csiphy, sd_state, 516 + MSM_CSIPHY_PAD_SRC, 518 517 fmt->which); 519 518 520 519 *format = fmt->format; 521 - csiphy_try_format(csiphy, cfg, MSM_CSIPHY_PAD_SRC, format, 520 + csiphy_try_format(csiphy, sd_state, MSM_CSIPHY_PAD_SRC, 521 + format, 522 522 fmt->which); 523 523 } 524 524 ··· 551 545 } 552 546 }; 553 547 554 - return csiphy_set_format(sd, fh ? fh->pad : NULL, &format); 548 + return csiphy_set_format(sd, fh ? fh->state : NULL, &format); 555 549 } 556 550 557 551 /*
+19 -17
drivers/media/platform/qcom/camss/camss-ispif.c
··· 874 874 */ 875 875 static struct v4l2_mbus_framefmt * 876 876 __ispif_get_format(struct ispif_line *line, 877 - struct v4l2_subdev_pad_config *cfg, 877 + struct v4l2_subdev_state *sd_state, 878 878 unsigned int pad, 879 879 enum v4l2_subdev_format_whence which) 880 880 { 881 881 if (which == V4L2_SUBDEV_FORMAT_TRY) 882 - return v4l2_subdev_get_try_format(&line->subdev, cfg, pad); 882 + return v4l2_subdev_get_try_format(&line->subdev, sd_state, 883 + pad); 883 884 884 885 return &line->fmt[pad]; 885 886 } ··· 894 893 * @which: wanted subdev format 895 894 */ 896 895 static void ispif_try_format(struct ispif_line *line, 897 - struct v4l2_subdev_pad_config *cfg, 896 + struct v4l2_subdev_state *sd_state, 898 897 unsigned int pad, 899 898 struct v4l2_mbus_framefmt *fmt, 900 899 enum v4l2_subdev_format_whence which) ··· 924 923 case MSM_ISPIF_PAD_SRC: 925 924 /* Set and return a format same as sink pad */ 926 925 927 - *fmt = *__ispif_get_format(line, cfg, MSM_ISPIF_PAD_SINK, 926 + *fmt = *__ispif_get_format(line, sd_state, MSM_ISPIF_PAD_SINK, 928 927 which); 929 928 930 929 break; ··· 941 940 * return -EINVAL or zero on success 942 941 */ 943 942 static int ispif_enum_mbus_code(struct v4l2_subdev *sd, 944 - struct v4l2_subdev_pad_config *cfg, 943 + struct v4l2_subdev_state *sd_state, 945 944 struct v4l2_subdev_mbus_code_enum *code) 946 945 { 947 946 struct ispif_line *line = v4l2_get_subdevdata(sd); ··· 956 955 if (code->index > 0) 957 956 return -EINVAL; 958 957 959 - format = __ispif_get_format(line, cfg, MSM_ISPIF_PAD_SINK, 958 + format = __ispif_get_format(line, sd_state, 959 + MSM_ISPIF_PAD_SINK, 960 960 code->which); 961 961 962 962 code->code = format->code; ··· 974 972 * return -EINVAL or zero on success 975 973 */ 976 974 static int ispif_enum_frame_size(struct v4l2_subdev *sd, 977 - struct v4l2_subdev_pad_config *cfg, 975 + struct v4l2_subdev_state *sd_state, 978 976 struct v4l2_subdev_frame_size_enum *fse) 979 977 { 980 978 struct ispif_line *line = v4l2_get_subdevdata(sd); ··· 986 984 format.code = fse->code; 987 985 format.width = 1; 988 986 format.height = 1; 989 - ispif_try_format(line, cfg, fse->pad, &format, fse->which); 987 + ispif_try_format(line, sd_state, fse->pad, &format, fse->which); 990 988 fse->min_width = format.width; 991 989 fse->min_height = format.height; 992 990 ··· 996 994 format.code = fse->code; 997 995 format.width = -1; 998 996 format.height = -1; 999 - ispif_try_format(line, cfg, fse->pad, &format, fse->which); 997 + ispif_try_format(line, sd_state, fse->pad, &format, fse->which); 1000 998 fse->max_width = format.width; 1001 999 fse->max_height = format.height; 1002 1000 ··· 1012 1010 * Return -EINVAL or zero on success 1013 1011 */ 1014 1012 static int ispif_get_format(struct v4l2_subdev *sd, 1015 - struct v4l2_subdev_pad_config *cfg, 1013 + struct v4l2_subdev_state *sd_state, 1016 1014 struct v4l2_subdev_format *fmt) 1017 1015 { 1018 1016 struct ispif_line *line = v4l2_get_subdevdata(sd); 1019 1017 struct v4l2_mbus_framefmt *format; 1020 1018 1021 - format = __ispif_get_format(line, cfg, fmt->pad, fmt->which); 1019 + format = __ispif_get_format(line, sd_state, fmt->pad, fmt->which); 1022 1020 if (format == NULL) 1023 1021 return -EINVAL; 1024 1022 ··· 1036 1034 * Return -EINVAL or zero on success 1037 1035 */ 1038 1036 static int ispif_set_format(struct v4l2_subdev *sd, 1039 - struct v4l2_subdev_pad_config *cfg, 1037 + struct v4l2_subdev_state *sd_state, 1040 1038 struct v4l2_subdev_format *fmt) 1041 1039 { 1042 1040 struct ispif_line *line = v4l2_get_subdevdata(sd); 1043 1041 struct v4l2_mbus_framefmt *format; 1044 1042 1045 - format = __ispif_get_format(line, cfg, fmt->pad, fmt->which); 1043 + format = __ispif_get_format(line, sd_state, fmt->pad, fmt->which); 1046 1044 if (format == NULL) 1047 1045 return -EINVAL; 1048 1046 1049 - ispif_try_format(line, cfg, fmt->pad, &fmt->format, fmt->which); 1047 + ispif_try_format(line, sd_state, fmt->pad, &fmt->format, fmt->which); 1050 1048 *format = fmt->format; 1051 1049 1052 1050 /* Propagate the format from sink to source */ 1053 1051 if (fmt->pad == MSM_ISPIF_PAD_SINK) { 1054 - format = __ispif_get_format(line, cfg, MSM_ISPIF_PAD_SRC, 1052 + format = __ispif_get_format(line, sd_state, MSM_ISPIF_PAD_SRC, 1055 1053 fmt->which); 1056 1054 1057 1055 *format = fmt->format; 1058 - ispif_try_format(line, cfg, MSM_ISPIF_PAD_SRC, format, 1056 + ispif_try_format(line, sd_state, MSM_ISPIF_PAD_SRC, format, 1059 1057 fmt->which); 1060 1058 } 1061 1059 ··· 1084 1082 } 1085 1083 }; 1086 1084 1087 - return ispif_set_format(sd, fh ? fh->pad : NULL, &format); 1085 + return ispif_set_format(sd, fh ? fh->state : NULL, &format); 1088 1086 } 1089 1087 1090 1088 /*
+43 -41
drivers/media/platform/qcom/camss/camss-vfe.c
··· 763 763 */ 764 764 static struct v4l2_mbus_framefmt * 765 765 __vfe_get_format(struct vfe_line *line, 766 - struct v4l2_subdev_pad_config *cfg, 766 + struct v4l2_subdev_state *sd_state, 767 767 unsigned int pad, 768 768 enum v4l2_subdev_format_whence which) 769 769 { 770 770 if (which == V4L2_SUBDEV_FORMAT_TRY) 771 - return v4l2_subdev_get_try_format(&line->subdev, cfg, pad); 771 + return v4l2_subdev_get_try_format(&line->subdev, sd_state, 772 + pad); 772 773 773 774 return &line->fmt[pad]; 774 775 } ··· 784 783 */ 785 784 static struct v4l2_rect * 786 785 __vfe_get_compose(struct vfe_line *line, 787 - struct v4l2_subdev_pad_config *cfg, 786 + struct v4l2_subdev_state *sd_state, 788 787 enum v4l2_subdev_format_whence which) 789 788 { 790 789 if (which == V4L2_SUBDEV_FORMAT_TRY) 791 - return v4l2_subdev_get_try_compose(&line->subdev, cfg, 790 + return v4l2_subdev_get_try_compose(&line->subdev, sd_state, 792 791 MSM_VFE_PAD_SINK); 793 792 794 793 return &line->compose; ··· 804 803 */ 805 804 static struct v4l2_rect * 806 805 __vfe_get_crop(struct vfe_line *line, 807 - struct v4l2_subdev_pad_config *cfg, 806 + struct v4l2_subdev_state *sd_state, 808 807 enum v4l2_subdev_format_whence which) 809 808 { 810 809 if (which == V4L2_SUBDEV_FORMAT_TRY) 811 - return v4l2_subdev_get_try_crop(&line->subdev, cfg, 810 + return v4l2_subdev_get_try_crop(&line->subdev, sd_state, 812 811 MSM_VFE_PAD_SRC); 813 812 814 813 return &line->crop; ··· 823 822 * @which: wanted subdev format 824 823 */ 825 824 static void vfe_try_format(struct vfe_line *line, 826 - struct v4l2_subdev_pad_config *cfg, 825 + struct v4l2_subdev_state *sd_state, 827 826 unsigned int pad, 828 827 struct v4l2_mbus_framefmt *fmt, 829 828 enum v4l2_subdev_format_whence which) ··· 855 854 /* Set and return a format same as sink pad */ 856 855 code = fmt->code; 857 856 858 - *fmt = *__vfe_get_format(line, cfg, MSM_VFE_PAD_SINK, which); 857 + *fmt = *__vfe_get_format(line, sd_state, MSM_VFE_PAD_SINK, 858 + which); 859 859 860 860 fmt->code = vfe_src_pad_code(line, fmt->code, 0, code); 861 861 862 862 if (line->id == VFE_LINE_PIX) { 863 863 struct v4l2_rect *rect; 864 864 865 - rect = __vfe_get_crop(line, cfg, which); 865 + rect = __vfe_get_crop(line, sd_state, which); 866 866 867 867 fmt->width = rect->width; 868 868 fmt->height = rect->height; ··· 883 881 * @which: wanted subdev format 884 882 */ 885 883 static void vfe_try_compose(struct vfe_line *line, 886 - struct v4l2_subdev_pad_config *cfg, 884 + struct v4l2_subdev_state *sd_state, 887 885 struct v4l2_rect *rect, 888 886 enum v4l2_subdev_format_whence which) 889 887 { 890 888 struct v4l2_mbus_framefmt *fmt; 891 889 892 - fmt = __vfe_get_format(line, cfg, MSM_VFE_PAD_SINK, which); 890 + fmt = __vfe_get_format(line, sd_state, MSM_VFE_PAD_SINK, which); 893 891 894 892 if (rect->width > fmt->width) 895 893 rect->width = fmt->width; ··· 922 920 * @which: wanted subdev format 923 921 */ 924 922 static void vfe_try_crop(struct vfe_line *line, 925 - struct v4l2_subdev_pad_config *cfg, 923 + struct v4l2_subdev_state *sd_state, 926 924 struct v4l2_rect *rect, 927 925 enum v4l2_subdev_format_whence which) 928 926 { 929 927 struct v4l2_rect *compose; 930 928 931 - compose = __vfe_get_compose(line, cfg, which); 929 + compose = __vfe_get_compose(line, sd_state, which); 932 930 933 931 if (rect->width > compose->width) 934 932 rect->width = compose->width; ··· 966 964 * return -EINVAL or zero on success 967 965 */ 968 966 static int vfe_enum_mbus_code(struct v4l2_subdev *sd, 969 - struct v4l2_subdev_pad_config *cfg, 967 + struct v4l2_subdev_state *sd_state, 970 968 struct v4l2_subdev_mbus_code_enum *code) 971 969 { 972 970 struct vfe_line *line = v4l2_get_subdevdata(sd); ··· 979 977 } else { 980 978 struct v4l2_mbus_framefmt *sink_fmt; 981 979 982 - sink_fmt = __vfe_get_format(line, cfg, MSM_VFE_PAD_SINK, 980 + sink_fmt = __vfe_get_format(line, sd_state, MSM_VFE_PAD_SINK, 983 981 code->which); 984 982 985 983 code->code = vfe_src_pad_code(line, sink_fmt->code, ··· 1000 998 * Return -EINVAL or zero on success 1001 999 */ 1002 1000 static int vfe_enum_frame_size(struct v4l2_subdev *sd, 1003 - struct v4l2_subdev_pad_config *cfg, 1001 + struct v4l2_subdev_state *sd_state, 1004 1002 struct v4l2_subdev_frame_size_enum *fse) 1005 1003 { 1006 1004 struct vfe_line *line = v4l2_get_subdevdata(sd); ··· 1012 1010 format.code = fse->code; 1013 1011 format.width = 1; 1014 1012 format.height = 1; 1015 - vfe_try_format(line, cfg, fse->pad, &format, fse->which); 1013 + vfe_try_format(line, sd_state, fse->pad, &format, fse->which); 1016 1014 fse->min_width = format.width; 1017 1015 fse->min_height = format.height; 1018 1016 ··· 1022 1020 format.code = fse->code; 1023 1021 format.width = -1; 1024 1022 format.height = -1; 1025 - vfe_try_format(line, cfg, fse->pad, &format, fse->which); 1023 + vfe_try_format(line, sd_state, fse->pad, &format, fse->which); 1026 1024 fse->max_width = format.width; 1027 1025 fse->max_height = format.height; 1028 1026 ··· 1038 1036 * Return -EINVAL or zero on success 1039 1037 */ 1040 1038 static int vfe_get_format(struct v4l2_subdev *sd, 1041 - struct v4l2_subdev_pad_config *cfg, 1039 + struct v4l2_subdev_state *sd_state, 1042 1040 struct v4l2_subdev_format *fmt) 1043 1041 { 1044 1042 struct vfe_line *line = v4l2_get_subdevdata(sd); 1045 1043 struct v4l2_mbus_framefmt *format; 1046 1044 1047 - format = __vfe_get_format(line, cfg, fmt->pad, fmt->which); 1045 + format = __vfe_get_format(line, sd_state, fmt->pad, fmt->which); 1048 1046 if (format == NULL) 1049 1047 return -EINVAL; 1050 1048 ··· 1054 1052 } 1055 1053 1056 1054 static int vfe_set_selection(struct v4l2_subdev *sd, 1057 - struct v4l2_subdev_pad_config *cfg, 1055 + struct v4l2_subdev_state *sd_state, 1058 1056 struct v4l2_subdev_selection *sel); 1059 1057 1060 1058 /* ··· 1066 1064 * Return -EINVAL or zero on success 1067 1065 */ 1068 1066 static int vfe_set_format(struct v4l2_subdev *sd, 1069 - struct v4l2_subdev_pad_config *cfg, 1067 + struct v4l2_subdev_state *sd_state, 1070 1068 struct v4l2_subdev_format *fmt) 1071 1069 { 1072 1070 struct vfe_line *line = v4l2_get_subdevdata(sd); 1073 1071 struct v4l2_mbus_framefmt *format; 1074 1072 1075 - format = __vfe_get_format(line, cfg, fmt->pad, fmt->which); 1073 + format = __vfe_get_format(line, sd_state, fmt->pad, fmt->which); 1076 1074 if (format == NULL) 1077 1075 return -EINVAL; 1078 1076 1079 - vfe_try_format(line, cfg, fmt->pad, &fmt->format, fmt->which); 1077 + vfe_try_format(line, sd_state, fmt->pad, &fmt->format, fmt->which); 1080 1078 *format = fmt->format; 1081 1079 1082 1080 if (fmt->pad == MSM_VFE_PAD_SINK) { ··· 1084 1082 int ret; 1085 1083 1086 1084 /* Propagate the format from sink to source */ 1087 - format = __vfe_get_format(line, cfg, MSM_VFE_PAD_SRC, 1085 + format = __vfe_get_format(line, sd_state, MSM_VFE_PAD_SRC, 1088 1086 fmt->which); 1089 1087 1090 1088 *format = fmt->format; 1091 - vfe_try_format(line, cfg, MSM_VFE_PAD_SRC, format, 1089 + vfe_try_format(line, sd_state, MSM_VFE_PAD_SRC, format, 1092 1090 fmt->which); 1093 1091 1094 1092 if (line->id != VFE_LINE_PIX) ··· 1100 1098 sel.target = V4L2_SEL_TGT_COMPOSE; 1101 1099 sel.r.width = fmt->format.width; 1102 1100 sel.r.height = fmt->format.height; 1103 - ret = vfe_set_selection(sd, cfg, &sel); 1101 + ret = vfe_set_selection(sd, sd_state, &sel); 1104 1102 if (ret < 0) 1105 1103 return ret; 1106 1104 } ··· 1117 1115 * Return -EINVAL or zero on success 1118 1116 */ 1119 1117 static int vfe_get_selection(struct v4l2_subdev *sd, 1120 - struct v4l2_subdev_pad_config *cfg, 1118 + struct v4l2_subdev_state *sd_state, 1121 1119 struct v4l2_subdev_selection *sel) 1122 1120 { 1123 1121 struct vfe_line *line = v4l2_get_subdevdata(sd); ··· 1133 1131 case V4L2_SEL_TGT_COMPOSE_BOUNDS: 1134 1132 fmt.pad = sel->pad; 1135 1133 fmt.which = sel->which; 1136 - ret = vfe_get_format(sd, cfg, &fmt); 1134 + ret = vfe_get_format(sd, sd_state, &fmt); 1137 1135 if (ret < 0) 1138 1136 return ret; 1139 1137 ··· 1143 1141 sel->r.height = fmt.format.height; 1144 1142 break; 1145 1143 case V4L2_SEL_TGT_COMPOSE: 1146 - rect = __vfe_get_compose(line, cfg, sel->which); 1144 + rect = __vfe_get_compose(line, sd_state, sel->which); 1147 1145 if (rect == NULL) 1148 1146 return -EINVAL; 1149 1147 ··· 1155 1153 else if (sel->pad == MSM_VFE_PAD_SRC) 1156 1154 switch (sel->target) { 1157 1155 case V4L2_SEL_TGT_CROP_BOUNDS: 1158 - rect = __vfe_get_compose(line, cfg, sel->which); 1156 + rect = __vfe_get_compose(line, sd_state, sel->which); 1159 1157 if (rect == NULL) 1160 1158 return -EINVAL; 1161 1159 ··· 1165 1163 sel->r.height = rect->height; 1166 1164 break; 1167 1165 case V4L2_SEL_TGT_CROP: 1168 - rect = __vfe_get_crop(line, cfg, sel->which); 1166 + rect = __vfe_get_crop(line, sd_state, sel->which); 1169 1167 if (rect == NULL) 1170 1168 return -EINVAL; 1171 1169 ··· 1187 1185 * Return -EINVAL or zero on success 1188 1186 */ 1189 1187 static int vfe_set_selection(struct v4l2_subdev *sd, 1190 - struct v4l2_subdev_pad_config *cfg, 1188 + struct v4l2_subdev_state *sd_state, 1191 1189 struct v4l2_subdev_selection *sel) 1192 1190 { 1193 1191 struct vfe_line *line = v4l2_get_subdevdata(sd); ··· 1201 1199 sel->pad == MSM_VFE_PAD_SINK) { 1202 1200 struct v4l2_subdev_selection crop = { 0 }; 1203 1201 1204 - rect = __vfe_get_compose(line, cfg, sel->which); 1202 + rect = __vfe_get_compose(line, sd_state, sel->which); 1205 1203 if (rect == NULL) 1206 1204 return -EINVAL; 1207 1205 1208 - vfe_try_compose(line, cfg, &sel->r, sel->which); 1206 + vfe_try_compose(line, sd_state, &sel->r, sel->which); 1209 1207 *rect = sel->r; 1210 1208 1211 1209 /* Reset source crop selection */ ··· 1213 1211 crop.pad = MSM_VFE_PAD_SRC; 1214 1212 crop.target = V4L2_SEL_TGT_CROP; 1215 1213 crop.r = *rect; 1216 - ret = vfe_set_selection(sd, cfg, &crop); 1214 + ret = vfe_set_selection(sd, sd_state, &crop); 1217 1215 } else if (sel->target == V4L2_SEL_TGT_CROP && 1218 1216 sel->pad == MSM_VFE_PAD_SRC) { 1219 1217 struct v4l2_subdev_format fmt = { 0 }; 1220 1218 1221 - rect = __vfe_get_crop(line, cfg, sel->which); 1219 + rect = __vfe_get_crop(line, sd_state, sel->which); 1222 1220 if (rect == NULL) 1223 1221 return -EINVAL; 1224 1222 1225 - vfe_try_crop(line, cfg, &sel->r, sel->which); 1223 + vfe_try_crop(line, sd_state, &sel->r, sel->which); 1226 1224 *rect = sel->r; 1227 1225 1228 1226 /* Reset source pad format width and height */ 1229 1227 fmt.which = sel->which; 1230 1228 fmt.pad = MSM_VFE_PAD_SRC; 1231 - ret = vfe_get_format(sd, cfg, &fmt); 1229 + ret = vfe_get_format(sd, sd_state, &fmt); 1232 1230 if (ret < 0) 1233 1231 return ret; 1234 1232 1235 1233 fmt.format.width = rect->width; 1236 1234 fmt.format.height = rect->height; 1237 - ret = vfe_set_format(sd, cfg, &fmt); 1235 + ret = vfe_set_format(sd, sd_state, &fmt); 1238 1236 } else { 1239 1237 ret = -EINVAL; 1240 1238 } ··· 1264 1262 } 1265 1263 }; 1266 1264 1267 - return vfe_set_format(sd, fh ? fh->pad : NULL, &format); 1265 + return vfe_set_format(sd, fh ? fh->state : NULL, &format); 1268 1266 } 1269 1267 1270 1268 /*
+4 -4
drivers/media/platform/rcar-vin/rcar-csi2.c
··· 717 717 } 718 718 719 719 static int rcsi2_set_pad_format(struct v4l2_subdev *sd, 720 - struct v4l2_subdev_pad_config *cfg, 720 + struct v4l2_subdev_state *sd_state, 721 721 struct v4l2_subdev_format *format) 722 722 { 723 723 struct rcar_csi2 *priv = sd_to_csi2(sd); ··· 729 729 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 730 730 priv->mf = format->format; 731 731 } else { 732 - framefmt = v4l2_subdev_get_try_format(sd, cfg, 0); 732 + framefmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 733 733 *framefmt = format->format; 734 734 } 735 735 ··· 737 737 } 738 738 739 739 static int rcsi2_get_pad_format(struct v4l2_subdev *sd, 740 - struct v4l2_subdev_pad_config *cfg, 740 + struct v4l2_subdev_state *sd_state, 741 741 struct v4l2_subdev_format *format) 742 742 { 743 743 struct rcar_csi2 *priv = sd_to_csi2(sd); ··· 745 745 if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) 746 746 format->format = priv->mf; 747 747 else 748 - format->format = *v4l2_subdev_get_try_format(sd, cfg, 0); 748 + format->format = *v4l2_subdev_get_try_format(sd, sd_state, 0); 749 749 750 750 return 0; 751 751 }
+5 -5
drivers/media/platform/rcar-vin/rcar-v4l2.c
··· 243 243 struct v4l2_rect *src_rect) 244 244 { 245 245 struct v4l2_subdev *sd = vin_to_source(vin); 246 - struct v4l2_subdev_pad_config *pad_cfg; 246 + struct v4l2_subdev_state *sd_state; 247 247 struct v4l2_subdev_format format = { 248 248 .which = which, 249 249 .pad = vin->parallel.source_pad, ··· 252 252 u32 width, height; 253 253 int ret; 254 254 255 - pad_cfg = v4l2_subdev_alloc_pad_config(sd); 256 - if (pad_cfg == NULL) 255 + sd_state = v4l2_subdev_alloc_state(sd); 256 + if (sd_state == NULL) 257 257 return -ENOMEM; 258 258 259 259 if (!rvin_format_from_pixel(vin, pix->pixelformat)) ··· 266 266 width = pix->width; 267 267 height = pix->height; 268 268 269 - ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format); 269 + ret = v4l2_subdev_call(sd, pad, set_fmt, sd_state, &format); 270 270 if (ret < 0 && ret != -ENOIOCTLCMD) 271 271 goto done; 272 272 ret = 0; ··· 288 288 289 289 rvin_format_align(vin, pix); 290 290 done: 291 - v4l2_subdev_free_pad_config(pad_cfg); 291 + v4l2_subdev_free_state(sd_state); 292 292 293 293 return ret; 294 294 }
+5 -2
drivers/media/platform/renesas-ceu.c
··· 794 794 struct v4l2_pix_format_mplane *pix = &v4l2_fmt->fmt.pix_mp; 795 795 struct v4l2_subdev *v4l2_sd = ceu_sd->v4l2_sd; 796 796 struct v4l2_subdev_pad_config pad_cfg; 797 + struct v4l2_subdev_state pad_state = { 798 + .pads = &pad_cfg 799 + }; 797 800 const struct ceu_fmt *ceu_fmt; 798 801 u32 mbus_code_old; 799 802 u32 mbus_code; ··· 853 850 * time. 854 851 */ 855 852 sd_format.format.code = mbus_code; 856 - ret = v4l2_subdev_call(v4l2_sd, pad, set_fmt, &pad_cfg, &sd_format); 853 + ret = v4l2_subdev_call(v4l2_sd, pad, set_fmt, &pad_state, &sd_format); 857 854 if (ret) { 858 855 if (ret == -EINVAL) { 859 856 /* fallback */ 860 857 sd_format.format.code = mbus_code_old; 861 858 ret = v4l2_subdev_call(v4l2_sd, pad, set_fmt, 862 - &pad_cfg, &sd_format); 859 + &pad_state, &sd_format); 863 860 } 864 861 865 862 if (ret)
+64 -48
drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
··· 208 208 209 209 static struct v4l2_mbus_framefmt * 210 210 rkisp1_isp_get_pad_fmt(struct rkisp1_isp *isp, 211 - struct v4l2_subdev_pad_config *cfg, 211 + struct v4l2_subdev_state *sd_state, 212 212 unsigned int pad, u32 which) 213 213 { 214 + struct v4l2_subdev_state state = { 215 + .pads = isp->pad_cfg 216 + }; 214 217 if (which == V4L2_SUBDEV_FORMAT_TRY) 215 - return v4l2_subdev_get_try_format(&isp->sd, cfg, pad); 218 + return v4l2_subdev_get_try_format(&isp->sd, sd_state, pad); 216 219 else 217 - return v4l2_subdev_get_try_format(&isp->sd, isp->pad_cfg, pad); 220 + return v4l2_subdev_get_try_format(&isp->sd, &state, pad); 218 221 } 219 222 220 223 static struct v4l2_rect * 221 224 rkisp1_isp_get_pad_crop(struct rkisp1_isp *isp, 222 - struct v4l2_subdev_pad_config *cfg, 225 + struct v4l2_subdev_state *sd_state, 223 226 unsigned int pad, u32 which) 224 227 { 228 + struct v4l2_subdev_state state = { 229 + .pads = isp->pad_cfg 230 + }; 225 231 if (which == V4L2_SUBDEV_FORMAT_TRY) 226 - return v4l2_subdev_get_try_crop(&isp->sd, cfg, pad); 232 + return v4l2_subdev_get_try_crop(&isp->sd, sd_state, pad); 227 233 else 228 - return v4l2_subdev_get_try_crop(&isp->sd, isp->pad_cfg, pad); 234 + return v4l2_subdev_get_try_crop(&isp->sd, &state, pad); 229 235 } 230 236 231 237 /* ---------------------------------------------------------------------------- ··· 567 561 */ 568 562 569 563 static int rkisp1_isp_enum_mbus_code(struct v4l2_subdev *sd, 570 - struct v4l2_subdev_pad_config *cfg, 564 + struct v4l2_subdev_state *sd_state, 571 565 struct v4l2_subdev_mbus_code_enum *code) 572 566 { 573 567 unsigned int i, dir; ··· 607 601 } 608 602 609 603 static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd, 610 - struct v4l2_subdev_pad_config *cfg, 604 + struct v4l2_subdev_state *sd_state, 611 605 struct v4l2_subdev_frame_size_enum *fse) 612 606 { 613 607 const struct rkisp1_isp_mbus_info *mbus_info; ··· 640 634 } 641 635 642 636 static int rkisp1_isp_init_config(struct v4l2_subdev *sd, 643 - struct v4l2_subdev_pad_config *cfg) 637 + struct v4l2_subdev_state *sd_state) 644 638 { 645 639 struct v4l2_mbus_framefmt *sink_fmt, *src_fmt; 646 640 struct v4l2_rect *sink_crop, *src_crop; 647 641 648 - sink_fmt = v4l2_subdev_get_try_format(sd, cfg, 642 + sink_fmt = v4l2_subdev_get_try_format(sd, sd_state, 649 643 RKISP1_ISP_PAD_SINK_VIDEO); 650 644 sink_fmt->width = RKISP1_DEFAULT_WIDTH; 651 645 sink_fmt->height = RKISP1_DEFAULT_HEIGHT; 652 646 sink_fmt->field = V4L2_FIELD_NONE; 653 647 sink_fmt->code = RKISP1_DEF_SINK_PAD_FMT; 654 648 655 - sink_crop = v4l2_subdev_get_try_crop(sd, cfg, 649 + sink_crop = v4l2_subdev_get_try_crop(sd, sd_state, 656 650 RKISP1_ISP_PAD_SINK_VIDEO); 657 651 sink_crop->width = RKISP1_DEFAULT_WIDTH; 658 652 sink_crop->height = RKISP1_DEFAULT_HEIGHT; 659 653 sink_crop->left = 0; 660 654 sink_crop->top = 0; 661 655 662 - src_fmt = v4l2_subdev_get_try_format(sd, cfg, 656 + src_fmt = v4l2_subdev_get_try_format(sd, sd_state, 663 657 RKISP1_ISP_PAD_SOURCE_VIDEO); 664 658 *src_fmt = *sink_fmt; 665 659 src_fmt->code = RKISP1_DEF_SRC_PAD_FMT; 666 660 667 - src_crop = v4l2_subdev_get_try_crop(sd, cfg, 661 + src_crop = v4l2_subdev_get_try_crop(sd, sd_state, 668 662 RKISP1_ISP_PAD_SOURCE_VIDEO); 669 663 *src_crop = *sink_crop; 670 664 671 - sink_fmt = v4l2_subdev_get_try_format(sd, cfg, 665 + sink_fmt = v4l2_subdev_get_try_format(sd, sd_state, 672 666 RKISP1_ISP_PAD_SINK_PARAMS); 673 - src_fmt = v4l2_subdev_get_try_format(sd, cfg, 667 + src_fmt = v4l2_subdev_get_try_format(sd, sd_state, 674 668 RKISP1_ISP_PAD_SOURCE_STATS); 675 669 sink_fmt->width = 0; 676 670 sink_fmt->height = 0; ··· 682 676 } 683 677 684 678 static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp, 685 - struct v4l2_subdev_pad_config *cfg, 679 + struct v4l2_subdev_state *sd_state, 686 680 struct v4l2_mbus_framefmt *format, 687 681 unsigned int which) 688 682 { ··· 690 684 struct v4l2_mbus_framefmt *src_fmt; 691 685 const struct v4l2_rect *src_crop; 692 686 693 - src_fmt = rkisp1_isp_get_pad_fmt(isp, cfg, 687 + src_fmt = rkisp1_isp_get_pad_fmt(isp, sd_state, 694 688 RKISP1_ISP_PAD_SOURCE_VIDEO, which); 695 - src_crop = rkisp1_isp_get_pad_crop(isp, cfg, 689 + src_crop = rkisp1_isp_get_pad_crop(isp, sd_state, 696 690 RKISP1_ISP_PAD_SOURCE_VIDEO, which); 697 691 698 692 src_fmt->code = format->code; ··· 723 717 } 724 718 725 719 static void rkisp1_isp_set_src_crop(struct rkisp1_isp *isp, 726 - struct v4l2_subdev_pad_config *cfg, 720 + struct v4l2_subdev_state *sd_state, 727 721 struct v4l2_rect *r, unsigned int which) 728 722 { 729 723 struct v4l2_mbus_framefmt *src_fmt; 730 724 const struct v4l2_rect *sink_crop; 731 725 struct v4l2_rect *src_crop; 732 726 733 - src_crop = rkisp1_isp_get_pad_crop(isp, cfg, 727 + src_crop = rkisp1_isp_get_pad_crop(isp, sd_state, 734 728 RKISP1_ISP_PAD_SOURCE_VIDEO, 735 729 which); 736 - sink_crop = rkisp1_isp_get_pad_crop(isp, cfg, 730 + sink_crop = rkisp1_isp_get_pad_crop(isp, sd_state, 737 731 RKISP1_ISP_PAD_SINK_VIDEO, 738 732 which); 739 733 ··· 746 740 *r = *src_crop; 747 741 748 742 /* Propagate to out format */ 749 - src_fmt = rkisp1_isp_get_pad_fmt(isp, cfg, 743 + src_fmt = rkisp1_isp_get_pad_fmt(isp, sd_state, 750 744 RKISP1_ISP_PAD_SOURCE_VIDEO, which); 751 - rkisp1_isp_set_src_fmt(isp, cfg, src_fmt, which); 745 + rkisp1_isp_set_src_fmt(isp, sd_state, src_fmt, which); 752 746 } 753 747 754 748 static void rkisp1_isp_set_sink_crop(struct rkisp1_isp *isp, 755 - struct v4l2_subdev_pad_config *cfg, 749 + struct v4l2_subdev_state *sd_state, 756 750 struct v4l2_rect *r, unsigned int which) 757 751 { 758 752 struct v4l2_rect *sink_crop, *src_crop; 759 753 struct v4l2_mbus_framefmt *sink_fmt; 760 754 761 - sink_crop = rkisp1_isp_get_pad_crop(isp, cfg, RKISP1_ISP_PAD_SINK_VIDEO, 755 + sink_crop = rkisp1_isp_get_pad_crop(isp, sd_state, 756 + RKISP1_ISP_PAD_SINK_VIDEO, 762 757 which); 763 - sink_fmt = rkisp1_isp_get_pad_fmt(isp, cfg, RKISP1_ISP_PAD_SINK_VIDEO, 758 + sink_fmt = rkisp1_isp_get_pad_fmt(isp, sd_state, 759 + RKISP1_ISP_PAD_SINK_VIDEO, 764 760 which); 765 761 766 762 sink_crop->left = ALIGN(r->left, 2); ··· 774 766 *r = *sink_crop; 775 767 776 768 /* Propagate to out crop */ 777 - src_crop = rkisp1_isp_get_pad_crop(isp, cfg, 769 + src_crop = rkisp1_isp_get_pad_crop(isp, sd_state, 778 770 RKISP1_ISP_PAD_SOURCE_VIDEO, which); 779 - rkisp1_isp_set_src_crop(isp, cfg, src_crop, which); 771 + rkisp1_isp_set_src_crop(isp, sd_state, src_crop, which); 780 772 } 781 773 782 774 static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp, 783 - struct v4l2_subdev_pad_config *cfg, 775 + struct v4l2_subdev_state *sd_state, 784 776 struct v4l2_mbus_framefmt *format, 785 777 unsigned int which) 786 778 { ··· 788 780 struct v4l2_mbus_framefmt *sink_fmt; 789 781 struct v4l2_rect *sink_crop; 790 782 791 - sink_fmt = rkisp1_isp_get_pad_fmt(isp, cfg, RKISP1_ISP_PAD_SINK_VIDEO, 783 + sink_fmt = rkisp1_isp_get_pad_fmt(isp, sd_state, 784 + RKISP1_ISP_PAD_SINK_VIDEO, 792 785 which); 793 786 sink_fmt->code = format->code; 794 787 mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); ··· 810 801 *format = *sink_fmt; 811 802 812 803 /* Propagate to in crop */ 813 - sink_crop = rkisp1_isp_get_pad_crop(isp, cfg, RKISP1_ISP_PAD_SINK_VIDEO, 804 + sink_crop = rkisp1_isp_get_pad_crop(isp, sd_state, 805 + RKISP1_ISP_PAD_SINK_VIDEO, 814 806 which); 815 - rkisp1_isp_set_sink_crop(isp, cfg, sink_crop, which); 807 + rkisp1_isp_set_sink_crop(isp, sd_state, sink_crop, which); 816 808 } 817 809 818 810 static int rkisp1_isp_get_fmt(struct v4l2_subdev *sd, 819 - struct v4l2_subdev_pad_config *cfg, 811 + struct v4l2_subdev_state *sd_state, 820 812 struct v4l2_subdev_format *fmt) 821 813 { 822 814 struct rkisp1_isp *isp = container_of(sd, struct rkisp1_isp, sd); 823 815 824 816 mutex_lock(&isp->ops_lock); 825 - fmt->format = *rkisp1_isp_get_pad_fmt(isp, cfg, fmt->pad, fmt->which); 817 + fmt->format = *rkisp1_isp_get_pad_fmt(isp, sd_state, fmt->pad, 818 + fmt->which); 826 819 mutex_unlock(&isp->ops_lock); 827 820 return 0; 828 821 } 829 822 830 823 static int rkisp1_isp_set_fmt(struct v4l2_subdev *sd, 831 - struct v4l2_subdev_pad_config *cfg, 824 + struct v4l2_subdev_state *sd_state, 832 825 struct v4l2_subdev_format *fmt) 833 826 { 834 827 struct rkisp1_isp *isp = container_of(sd, struct rkisp1_isp, sd); 835 828 836 829 mutex_lock(&isp->ops_lock); 837 830 if (fmt->pad == RKISP1_ISP_PAD_SINK_VIDEO) 838 - rkisp1_isp_set_sink_fmt(isp, cfg, &fmt->format, fmt->which); 831 + rkisp1_isp_set_sink_fmt(isp, sd_state, &fmt->format, 832 + fmt->which); 839 833 else if (fmt->pad == RKISP1_ISP_PAD_SOURCE_VIDEO) 840 - rkisp1_isp_set_src_fmt(isp, cfg, &fmt->format, fmt->which); 834 + rkisp1_isp_set_src_fmt(isp, sd_state, &fmt->format, 835 + fmt->which); 841 836 else 842 - fmt->format = *rkisp1_isp_get_pad_fmt(isp, cfg, fmt->pad, 837 + fmt->format = *rkisp1_isp_get_pad_fmt(isp, sd_state, fmt->pad, 843 838 fmt->which); 844 839 845 840 mutex_unlock(&isp->ops_lock); ··· 851 838 } 852 839 853 840 static int rkisp1_isp_get_selection(struct v4l2_subdev *sd, 854 - struct v4l2_subdev_pad_config *cfg, 841 + struct v4l2_subdev_state *sd_state, 855 842 struct v4l2_subdev_selection *sel) 856 843 { 857 844 struct rkisp1_isp *isp = container_of(sd, struct rkisp1_isp, sd); ··· 867 854 if (sel->pad == RKISP1_ISP_PAD_SINK_VIDEO) { 868 855 struct v4l2_mbus_framefmt *fmt; 869 856 870 - fmt = rkisp1_isp_get_pad_fmt(isp, cfg, sel->pad, 857 + fmt = rkisp1_isp_get_pad_fmt(isp, sd_state, sel->pad, 871 858 sel->which); 872 859 sel->r.height = fmt->height; 873 860 sel->r.width = fmt->width; 874 861 sel->r.left = 0; 875 862 sel->r.top = 0; 876 863 } else { 877 - sel->r = *rkisp1_isp_get_pad_crop(isp, cfg, 878 - RKISP1_ISP_PAD_SINK_VIDEO, 879 - sel->which); 864 + sel->r = *rkisp1_isp_get_pad_crop(isp, sd_state, 865 + RKISP1_ISP_PAD_SINK_VIDEO, 866 + sel->which); 880 867 } 881 868 break; 882 869 case V4L2_SEL_TGT_CROP: 883 - sel->r = *rkisp1_isp_get_pad_crop(isp, cfg, sel->pad, 870 + sel->r = *rkisp1_isp_get_pad_crop(isp, sd_state, sel->pad, 884 871 sel->which); 885 872 break; 886 873 default: ··· 891 878 } 892 879 893 880 static int rkisp1_isp_set_selection(struct v4l2_subdev *sd, 894 - struct v4l2_subdev_pad_config *cfg, 881 + struct v4l2_subdev_state *sd_state, 895 882 struct v4l2_subdev_selection *sel) 896 883 { 897 884 struct rkisp1_device *rkisp1 = ··· 906 893 sel->pad, sel->r.left, sel->r.top, sel->r.width, sel->r.height); 907 894 mutex_lock(&isp->ops_lock); 908 895 if (sel->pad == RKISP1_ISP_PAD_SINK_VIDEO) 909 - rkisp1_isp_set_sink_crop(isp, cfg, &sel->r, sel->which); 896 + rkisp1_isp_set_sink_crop(isp, sd_state, &sel->r, sel->which); 910 897 else if (sel->pad == RKISP1_ISP_PAD_SOURCE_VIDEO) 911 - rkisp1_isp_set_src_crop(isp, cfg, &sel->r, sel->which); 898 + rkisp1_isp_set_src_crop(isp, sd_state, &sel->r, sel->which); 912 899 else 913 900 ret = -EINVAL; 914 901 ··· 1050 1037 1051 1038 int rkisp1_isp_register(struct rkisp1_device *rkisp1) 1052 1039 { 1040 + struct v4l2_subdev_state state = { 1041 + .pads = rkisp1->isp.pad_cfg 1042 + }; 1053 1043 struct rkisp1_isp *isp = &rkisp1->isp; 1054 1044 struct media_pad *pads = isp->pads; 1055 1045 struct v4l2_subdev *sd = &isp->sd; ··· 1085 1069 goto err_cleanup_media_entity; 1086 1070 } 1087 1071 1088 - rkisp1_isp_init_config(sd, rkisp1->isp.pad_cfg); 1072 + rkisp1_isp_init_config(sd, &state); 1089 1073 return 0; 1090 1074 1091 1075 err_cleanup_media_entity:
+61 -34
drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
··· 180 180 181 181 static struct v4l2_mbus_framefmt * 182 182 rkisp1_rsz_get_pad_fmt(struct rkisp1_resizer *rsz, 183 - struct v4l2_subdev_pad_config *cfg, 183 + struct v4l2_subdev_state *sd_state, 184 184 unsigned int pad, u32 which) 185 185 { 186 + struct v4l2_subdev_state state = { 187 + .pads = rsz->pad_cfg 188 + }; 186 189 if (which == V4L2_SUBDEV_FORMAT_TRY) 187 - return v4l2_subdev_get_try_format(&rsz->sd, cfg, pad); 190 + return v4l2_subdev_get_try_format(&rsz->sd, sd_state, pad); 188 191 else 189 - return v4l2_subdev_get_try_format(&rsz->sd, rsz->pad_cfg, pad); 192 + return v4l2_subdev_get_try_format(&rsz->sd, &state, pad); 190 193 } 191 194 192 195 static struct v4l2_rect * 193 196 rkisp1_rsz_get_pad_crop(struct rkisp1_resizer *rsz, 194 - struct v4l2_subdev_pad_config *cfg, 197 + struct v4l2_subdev_state *sd_state, 195 198 unsigned int pad, u32 which) 196 199 { 200 + struct v4l2_subdev_state state = { 201 + .pads = rsz->pad_cfg 202 + }; 197 203 if (which == V4L2_SUBDEV_FORMAT_TRY) 198 - return v4l2_subdev_get_try_crop(&rsz->sd, cfg, pad); 204 + return v4l2_subdev_get_try_crop(&rsz->sd, sd_state, pad); 199 205 else 200 - return v4l2_subdev_get_try_crop(&rsz->sd, rsz->pad_cfg, pad); 206 + return v4l2_subdev_get_try_crop(&rsz->sd, &state, pad); 201 207 } 202 208 203 209 /* ---------------------------------------------------------------------------- ··· 457 451 */ 458 452 459 453 static int rkisp1_rsz_enum_mbus_code(struct v4l2_subdev *sd, 460 - struct v4l2_subdev_pad_config *cfg, 454 + struct v4l2_subdev_state *sd_state, 461 455 struct v4l2_subdev_mbus_code_enum *code) 462 456 { 463 457 struct rkisp1_resizer *rsz = 464 458 container_of(sd, struct rkisp1_resizer, sd); 465 459 struct v4l2_subdev_pad_config dummy_cfg; 460 + struct v4l2_subdev_state pad_state = { 461 + .pads = &dummy_cfg 462 + }; 466 463 u32 pad = code->pad; 467 464 int ret; 468 465 ··· 490 481 /* supported mbus codes on the sink pad are the same as isp src pad */ 491 482 code->pad = RKISP1_ISP_PAD_SOURCE_VIDEO; 492 483 ret = v4l2_subdev_call(&rsz->rkisp1->isp.sd, pad, enum_mbus_code, 493 - &dummy_cfg, code); 484 + &pad_state, code); 494 485 495 486 /* restore pad */ 496 487 code->pad = pad; ··· 499 490 } 500 491 501 492 static int rkisp1_rsz_init_config(struct v4l2_subdev *sd, 502 - struct v4l2_subdev_pad_config *cfg) 493 + struct v4l2_subdev_state *sd_state) 503 494 { 504 495 struct v4l2_mbus_framefmt *sink_fmt, *src_fmt; 505 496 struct v4l2_rect *sink_crop; 506 497 507 - sink_fmt = v4l2_subdev_get_try_format(sd, cfg, RKISP1_RSZ_PAD_SRC); 498 + sink_fmt = v4l2_subdev_get_try_format(sd, sd_state, 499 + RKISP1_RSZ_PAD_SRC); 508 500 sink_fmt->width = RKISP1_DEFAULT_WIDTH; 509 501 sink_fmt->height = RKISP1_DEFAULT_HEIGHT; 510 502 sink_fmt->field = V4L2_FIELD_NONE; 511 503 sink_fmt->code = RKISP1_DEF_FMT; 512 504 513 - sink_crop = v4l2_subdev_get_try_crop(sd, cfg, RKISP1_RSZ_PAD_SINK); 505 + sink_crop = v4l2_subdev_get_try_crop(sd, sd_state, 506 + RKISP1_RSZ_PAD_SINK); 514 507 sink_crop->width = RKISP1_DEFAULT_WIDTH; 515 508 sink_crop->height = RKISP1_DEFAULT_HEIGHT; 516 509 sink_crop->left = 0; 517 510 sink_crop->top = 0; 518 511 519 - src_fmt = v4l2_subdev_get_try_format(sd, cfg, RKISP1_RSZ_PAD_SINK); 512 + src_fmt = v4l2_subdev_get_try_format(sd, sd_state, 513 + RKISP1_RSZ_PAD_SINK); 520 514 *src_fmt = *sink_fmt; 521 515 522 516 /* NOTE: there is no crop in the source pad, only in the sink */ ··· 528 516 } 529 517 530 518 static void rkisp1_rsz_set_src_fmt(struct rkisp1_resizer *rsz, 531 - struct v4l2_subdev_pad_config *cfg, 519 + struct v4l2_subdev_state *sd_state, 532 520 struct v4l2_mbus_framefmt *format, 533 521 unsigned int which) 534 522 { 535 523 const struct rkisp1_isp_mbus_info *sink_mbus_info; 536 524 struct v4l2_mbus_framefmt *src_fmt, *sink_fmt; 537 525 538 - sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SINK, which); 539 - src_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SRC, which); 526 + sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SINK, 527 + which); 528 + src_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SRC, 529 + which); 540 530 sink_mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); 541 531 542 532 /* for YUV formats, userspace can change the mbus code on the src pad if it is supported */ ··· 557 543 } 558 544 559 545 static void rkisp1_rsz_set_sink_crop(struct rkisp1_resizer *rsz, 560 - struct v4l2_subdev_pad_config *cfg, 546 + struct v4l2_subdev_state *sd_state, 561 547 struct v4l2_rect *r, 562 548 unsigned int which) 563 549 { ··· 565 551 struct v4l2_mbus_framefmt *sink_fmt; 566 552 struct v4l2_rect *sink_crop; 567 553 568 - sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SINK, which); 569 - sink_crop = rkisp1_rsz_get_pad_crop(rsz, cfg, RKISP1_RSZ_PAD_SINK, 554 + sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SINK, 555 + which); 556 + sink_crop = rkisp1_rsz_get_pad_crop(rsz, sd_state, 557 + RKISP1_RSZ_PAD_SINK, 570 558 which); 571 559 572 560 /* Not crop for MP bayer raw data */ ··· 595 579 } 596 580 597 581 static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz, 598 - struct v4l2_subdev_pad_config *cfg, 582 + struct v4l2_subdev_state *sd_state, 599 583 struct v4l2_mbus_framefmt *format, 600 584 unsigned int which) 601 585 { ··· 603 587 struct v4l2_mbus_framefmt *sink_fmt, *src_fmt; 604 588 struct v4l2_rect *sink_crop; 605 589 606 - sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SINK, which); 607 - src_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SRC, which); 608 - sink_crop = rkisp1_rsz_get_pad_crop(rsz, cfg, RKISP1_RSZ_PAD_SINK, 590 + sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SINK, 591 + which); 592 + src_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SRC, 593 + which); 594 + sink_crop = rkisp1_rsz_get_pad_crop(rsz, sd_state, 595 + RKISP1_RSZ_PAD_SINK, 609 596 which); 610 597 if (rsz->id == RKISP1_SELFPATH) 611 598 sink_fmt->code = MEDIA_BUS_FMT_YUYV8_2X8; ··· 636 617 *format = *sink_fmt; 637 618 638 619 /* Update sink crop */ 639 - rkisp1_rsz_set_sink_crop(rsz, cfg, sink_crop, which); 620 + rkisp1_rsz_set_sink_crop(rsz, sd_state, sink_crop, which); 640 621 } 641 622 642 623 static int rkisp1_rsz_get_fmt(struct v4l2_subdev *sd, 643 - struct v4l2_subdev_pad_config *cfg, 624 + struct v4l2_subdev_state *sd_state, 644 625 struct v4l2_subdev_format *fmt) 645 626 { 646 627 struct rkisp1_resizer *rsz = 647 628 container_of(sd, struct rkisp1_resizer, sd); 648 629 649 630 mutex_lock(&rsz->ops_lock); 650 - fmt->format = *rkisp1_rsz_get_pad_fmt(rsz, cfg, fmt->pad, fmt->which); 631 + fmt->format = *rkisp1_rsz_get_pad_fmt(rsz, sd_state, fmt->pad, 632 + fmt->which); 651 633 mutex_unlock(&rsz->ops_lock); 652 634 return 0; 653 635 } 654 636 655 637 static int rkisp1_rsz_set_fmt(struct v4l2_subdev *sd, 656 - struct v4l2_subdev_pad_config *cfg, 638 + struct v4l2_subdev_state *sd_state, 657 639 struct v4l2_subdev_format *fmt) 658 640 { 659 641 struct rkisp1_resizer *rsz = ··· 662 642 663 643 mutex_lock(&rsz->ops_lock); 664 644 if (fmt->pad == RKISP1_RSZ_PAD_SINK) 665 - rkisp1_rsz_set_sink_fmt(rsz, cfg, &fmt->format, fmt->which); 645 + rkisp1_rsz_set_sink_fmt(rsz, sd_state, &fmt->format, 646 + fmt->which); 666 647 else 667 - rkisp1_rsz_set_src_fmt(rsz, cfg, &fmt->format, fmt->which); 648 + rkisp1_rsz_set_src_fmt(rsz, sd_state, &fmt->format, 649 + fmt->which); 668 650 669 651 mutex_unlock(&rsz->ops_lock); 670 652 return 0; 671 653 } 672 654 673 655 static int rkisp1_rsz_get_selection(struct v4l2_subdev *sd, 674 - struct v4l2_subdev_pad_config *cfg, 656 + struct v4l2_subdev_state *sd_state, 675 657 struct v4l2_subdev_selection *sel) 676 658 { 677 659 struct rkisp1_resizer *rsz = ··· 687 665 mutex_lock(&rsz->ops_lock); 688 666 switch (sel->target) { 689 667 case V4L2_SEL_TGT_CROP_BOUNDS: 690 - mf_sink = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SINK, 668 + mf_sink = rkisp1_rsz_get_pad_fmt(rsz, sd_state, 669 + RKISP1_RSZ_PAD_SINK, 691 670 sel->which); 692 671 sel->r.height = mf_sink->height; 693 672 sel->r.width = mf_sink->width; ··· 696 673 sel->r.top = 0; 697 674 break; 698 675 case V4L2_SEL_TGT_CROP: 699 - sel->r = *rkisp1_rsz_get_pad_crop(rsz, cfg, RKISP1_RSZ_PAD_SINK, 676 + sel->r = *rkisp1_rsz_get_pad_crop(rsz, sd_state, 677 + RKISP1_RSZ_PAD_SINK, 700 678 sel->which); 701 679 break; 702 680 default: ··· 709 685 } 710 686 711 687 static int rkisp1_rsz_set_selection(struct v4l2_subdev *sd, 712 - struct v4l2_subdev_pad_config *cfg, 688 + struct v4l2_subdev_state *sd_state, 713 689 struct v4l2_subdev_selection *sel) 714 690 { 715 691 struct rkisp1_resizer *rsz = ··· 722 698 sel->pad, sel->r.left, sel->r.top, sel->r.width, sel->r.height); 723 699 724 700 mutex_lock(&rsz->ops_lock); 725 - rkisp1_rsz_set_sink_crop(rsz, cfg, &sel->r, sel->which); 701 + rkisp1_rsz_set_sink_crop(rsz, sd_state, &sel->r, sel->which); 726 702 mutex_unlock(&rsz->ops_lock); 727 703 728 704 return 0; ··· 788 764 789 765 static int rkisp1_rsz_register(struct rkisp1_resizer *rsz) 790 766 { 767 + struct v4l2_subdev_state state = { 768 + .pads = rsz->pad_cfg 769 + }; 791 770 static const char * const dev_names[] = { 792 771 RKISP1_RSZ_MP_DEV_NAME, 793 772 RKISP1_RSZ_SP_DEV_NAME ··· 829 802 goto err_cleanup_media_entity; 830 803 } 831 804 832 - rkisp1_rsz_init_config(sd, rsz->pad_cfg); 805 + rkisp1_rsz_init_config(sd, &state); 833 806 return 0; 834 807 835 808 err_cleanup_media_entity:
+9 -9
drivers/media/platform/s3c-camif/camif-capture.c
··· 1199 1199 */ 1200 1200 1201 1201 static int s3c_camif_subdev_enum_mbus_code(struct v4l2_subdev *sd, 1202 - struct v4l2_subdev_pad_config *cfg, 1202 + struct v4l2_subdev_state *sd_state, 1203 1203 struct v4l2_subdev_mbus_code_enum *code) 1204 1204 { 1205 1205 if (code->index >= ARRAY_SIZE(camif_mbus_formats)) ··· 1210 1210 } 1211 1211 1212 1212 static int s3c_camif_subdev_get_fmt(struct v4l2_subdev *sd, 1213 - struct v4l2_subdev_pad_config *cfg, 1213 + struct v4l2_subdev_state *sd_state, 1214 1214 struct v4l2_subdev_format *fmt) 1215 1215 { 1216 1216 struct camif_dev *camif = v4l2_get_subdevdata(sd); 1217 1217 struct v4l2_mbus_framefmt *mf = &fmt->format; 1218 1218 1219 1219 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1220 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1220 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1221 1221 fmt->format = *mf; 1222 1222 return 0; 1223 1223 } ··· 1278 1278 } 1279 1279 1280 1280 static int s3c_camif_subdev_set_fmt(struct v4l2_subdev *sd, 1281 - struct v4l2_subdev_pad_config *cfg, 1281 + struct v4l2_subdev_state *sd_state, 1282 1282 struct v4l2_subdev_format *fmt) 1283 1283 { 1284 1284 struct camif_dev *camif = v4l2_get_subdevdata(sd); ··· 1306 1306 __camif_subdev_try_format(camif, mf, fmt->pad); 1307 1307 1308 1308 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) { 1309 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 1309 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 1310 1310 *mf = fmt->format; 1311 1311 mutex_unlock(&camif->lock); 1312 1312 return 0; ··· 1345 1345 } 1346 1346 1347 1347 static int s3c_camif_subdev_get_selection(struct v4l2_subdev *sd, 1348 - struct v4l2_subdev_pad_config *cfg, 1348 + struct v4l2_subdev_state *sd_state, 1349 1349 struct v4l2_subdev_selection *sel) 1350 1350 { 1351 1351 struct camif_dev *camif = v4l2_get_subdevdata(sd); ··· 1358 1358 return -EINVAL; 1359 1359 1360 1360 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1361 - sel->r = *v4l2_subdev_get_try_crop(sd, cfg, sel->pad); 1361 + sel->r = *v4l2_subdev_get_try_crop(sd, sd_state, sel->pad); 1362 1362 return 0; 1363 1363 } 1364 1364 ··· 1432 1432 } 1433 1433 1434 1434 static int s3c_camif_subdev_set_selection(struct v4l2_subdev *sd, 1435 - struct v4l2_subdev_pad_config *cfg, 1435 + struct v4l2_subdev_state *sd_state, 1436 1436 struct v4l2_subdev_selection *sel) 1437 1437 { 1438 1438 struct camif_dev *camif = v4l2_get_subdevdata(sd); ··· 1446 1446 __camif_try_crop(camif, &sel->r); 1447 1447 1448 1448 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1449 - *v4l2_subdev_get_try_crop(sd, cfg, sel->pad) = sel->r; 1449 + *v4l2_subdev_get_try_crop(sd, sd_state, sel->pad) = sel->r; 1450 1450 } else { 1451 1451 unsigned long flags; 1452 1452 unsigned int i;
+10 -4
drivers/media/platform/stm32/stm32-dcmi.c
··· 600 600 } 601 601 602 602 static int dcmi_pipeline_s_fmt(struct stm32_dcmi *dcmi, 603 - struct v4l2_subdev_pad_config *pad_cfg, 603 + struct v4l2_subdev_state *sd_state, 604 604 struct v4l2_subdev_format *format) 605 605 { 606 606 struct media_entity *entity = &dcmi->source->entity; ··· 642 642 format->format.width, format->format.height); 643 643 644 644 fmt.pad = pad->index; 645 - ret = v4l2_subdev_call(subdev, pad, set_fmt, pad_cfg, &fmt); 645 + ret = v4l2_subdev_call(subdev, pad, set_fmt, sd_state, &fmt); 646 646 if (ret < 0) { 647 647 dev_err(dcmi->dev, "%s: Failed to set format 0x%x %ux%u on \"%s\":%d pad (%d)\n", 648 648 __func__, format->format.code, ··· 978 978 struct dcmi_framesize sd_fsize; 979 979 struct v4l2_pix_format *pix = &f->fmt.pix; 980 980 struct v4l2_subdev_pad_config pad_cfg; 981 + struct v4l2_subdev_state pad_state = { 982 + .pads = &pad_cfg 983 + }; 981 984 struct v4l2_subdev_format format = { 982 985 .which = V4L2_SUBDEV_FORMAT_TRY, 983 986 }; ··· 1016 1013 1017 1014 v4l2_fill_mbus_format(&format.format, pix, sd_fmt->mbus_code); 1018 1015 ret = v4l2_subdev_call(dcmi->source, pad, set_fmt, 1019 - &pad_cfg, &format); 1016 + &pad_state, &format); 1020 1017 if (ret < 0) 1021 1018 return ret; 1022 1019 ··· 1166 1163 .which = V4L2_SUBDEV_FORMAT_TRY, 1167 1164 }; 1168 1165 struct v4l2_subdev_pad_config pad_cfg; 1166 + struct v4l2_subdev_state pad_state = { 1167 + .pads = &pad_cfg 1168 + }; 1169 1169 int ret; 1170 1170 1171 1171 sd_fmt = find_format_by_fourcc(dcmi, pix->pixelformat); ··· 1182 1176 1183 1177 v4l2_fill_mbus_format(&format.format, pix, sd_fmt->mbus_code); 1184 1178 ret = v4l2_subdev_call(dcmi->source, pad, set_fmt, 1185 - &pad_cfg, &format); 1179 + &pad_state, &format); 1186 1180 if (ret < 0) 1187 1181 return ret; 1188 1182
+9 -7
drivers/media/platform/sunxi/sun4i-csi/sun4i_v4l2.c
··· 271 271 }; 272 272 273 273 static int sun4i_csi_subdev_init_cfg(struct v4l2_subdev *subdev, 274 - struct v4l2_subdev_pad_config *cfg) 274 + struct v4l2_subdev_state *sd_state) 275 275 { 276 276 struct v4l2_mbus_framefmt *fmt; 277 277 278 - fmt = v4l2_subdev_get_try_format(subdev, cfg, CSI_SUBDEV_SINK); 278 + fmt = v4l2_subdev_get_try_format(subdev, sd_state, CSI_SUBDEV_SINK); 279 279 *fmt = sun4i_csi_pad_fmt_default; 280 280 281 281 return 0; 282 282 } 283 283 284 284 static int sun4i_csi_subdev_get_fmt(struct v4l2_subdev *subdev, 285 - struct v4l2_subdev_pad_config *cfg, 285 + struct v4l2_subdev_state *sd_state, 286 286 struct v4l2_subdev_format *fmt) 287 287 { 288 288 struct sun4i_csi *csi = container_of(subdev, struct sun4i_csi, subdev); 289 289 struct v4l2_mbus_framefmt *subdev_fmt; 290 290 291 291 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 292 - subdev_fmt = v4l2_subdev_get_try_format(subdev, cfg, fmt->pad); 292 + subdev_fmt = v4l2_subdev_get_try_format(subdev, sd_state, 293 + fmt->pad); 293 294 else 294 295 subdev_fmt = &csi->subdev_fmt; 295 296 ··· 300 299 } 301 300 302 301 static int sun4i_csi_subdev_set_fmt(struct v4l2_subdev *subdev, 303 - struct v4l2_subdev_pad_config *cfg, 302 + struct v4l2_subdev_state *sd_state, 304 303 struct v4l2_subdev_format *fmt) 305 304 { 306 305 struct sun4i_csi *csi = container_of(subdev, struct sun4i_csi, subdev); 307 306 struct v4l2_mbus_framefmt *subdev_fmt; 308 307 309 308 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 310 - subdev_fmt = v4l2_subdev_get_try_format(subdev, cfg, fmt->pad); 309 + subdev_fmt = v4l2_subdev_get_try_format(subdev, sd_state, 310 + fmt->pad); 311 311 else 312 312 subdev_fmt = &csi->subdev_fmt; 313 313 ··· 327 325 328 326 static int 329 327 sun4i_csi_subdev_enum_mbus_code(struct v4l2_subdev *subdev, 330 - struct v4l2_subdev_pad_config *cfg, 328 + struct v4l2_subdev_state *sd_state, 331 329 struct v4l2_subdev_mbus_code_enum *mbus) 332 330 { 333 331 if (mbus->index >= ARRAY_SIZE(sun4i_csi_formats))
+19 -16
drivers/media/platform/ti-vpe/cal-camerarx.c
··· 586 586 587 587 static struct v4l2_mbus_framefmt * 588 588 cal_camerarx_get_pad_format(struct cal_camerarx *phy, 589 - struct v4l2_subdev_pad_config *cfg, 589 + struct v4l2_subdev_state *sd_state, 590 590 unsigned int pad, u32 which) 591 591 { 592 592 switch (which) { 593 593 case V4L2_SUBDEV_FORMAT_TRY: 594 - return v4l2_subdev_get_try_format(&phy->subdev, cfg, pad); 594 + return v4l2_subdev_get_try_format(&phy->subdev, sd_state, pad); 595 595 case V4L2_SUBDEV_FORMAT_ACTIVE: 596 596 return &phy->formats[pad]; 597 597 default: ··· 611 611 } 612 612 613 613 static int cal_camerarx_sd_enum_mbus_code(struct v4l2_subdev *sd, 614 - struct v4l2_subdev_pad_config *cfg, 614 + struct v4l2_subdev_state *sd_state, 615 615 struct v4l2_subdev_mbus_code_enum *code) 616 616 { 617 617 struct cal_camerarx *phy = to_cal_camerarx(sd); ··· 623 623 if (code->index > 0) 624 624 return -EINVAL; 625 625 626 - fmt = cal_camerarx_get_pad_format(phy, cfg, 626 + fmt = cal_camerarx_get_pad_format(phy, sd_state, 627 627 CAL_CAMERARX_PAD_SINK, 628 628 code->which); 629 629 code->code = fmt->code; ··· 639 639 } 640 640 641 641 static int cal_camerarx_sd_enum_frame_size(struct v4l2_subdev *sd, 642 - struct v4l2_subdev_pad_config *cfg, 642 + struct v4l2_subdev_state *sd_state, 643 643 struct v4l2_subdev_frame_size_enum *fse) 644 644 { 645 645 struct cal_camerarx *phy = to_cal_camerarx(sd); ··· 652 652 if (fse->pad == CAL_CAMERARX_PAD_SOURCE) { 653 653 struct v4l2_mbus_framefmt *fmt; 654 654 655 - fmt = cal_camerarx_get_pad_format(phy, cfg, 655 + fmt = cal_camerarx_get_pad_format(phy, sd_state, 656 656 CAL_CAMERARX_PAD_SINK, 657 657 fse->which); 658 658 if (fse->code != fmt->code) ··· 679 679 } 680 680 681 681 static int cal_camerarx_sd_get_fmt(struct v4l2_subdev *sd, 682 - struct v4l2_subdev_pad_config *cfg, 682 + struct v4l2_subdev_state *sd_state, 683 683 struct v4l2_subdev_format *format) 684 684 { 685 685 struct cal_camerarx *phy = to_cal_camerarx(sd); 686 686 struct v4l2_mbus_framefmt *fmt; 687 687 688 - fmt = cal_camerarx_get_pad_format(phy, cfg, format->pad, format->which); 688 + fmt = cal_camerarx_get_pad_format(phy, sd_state, format->pad, 689 + format->which); 689 690 format->format = *fmt; 690 691 691 692 return 0; 692 693 } 693 694 694 695 static int cal_camerarx_sd_set_fmt(struct v4l2_subdev *sd, 695 - struct v4l2_subdev_pad_config *cfg, 696 + struct v4l2_subdev_state *sd_state, 696 697 struct v4l2_subdev_format *format) 697 698 { 698 699 struct cal_camerarx *phy = to_cal_camerarx(sd); ··· 703 702 704 703 /* No transcoding, source and sink formats must match. */ 705 704 if (format->pad == CAL_CAMERARX_PAD_SOURCE) 706 - return cal_camerarx_sd_get_fmt(sd, cfg, format); 705 + return cal_camerarx_sd_get_fmt(sd, sd_state, format); 707 706 708 707 /* 709 708 * Default to the first format is the requested media bus code isn't ··· 728 727 format->format.code = fmtinfo->code; 729 728 730 729 /* Store the format and propagate it to the source pad. */ 731 - fmt = cal_camerarx_get_pad_format(phy, cfg, CAL_CAMERARX_PAD_SINK, 730 + fmt = cal_camerarx_get_pad_format(phy, sd_state, 731 + CAL_CAMERARX_PAD_SINK, 732 732 format->which); 733 733 *fmt = format->format; 734 734 735 - fmt = cal_camerarx_get_pad_format(phy, cfg, CAL_CAMERARX_PAD_SOURCE, 735 + fmt = cal_camerarx_get_pad_format(phy, sd_state, 736 + CAL_CAMERARX_PAD_SOURCE, 736 737 format->which); 737 738 *fmt = format->format; 738 739 ··· 745 742 } 746 743 747 744 static int cal_camerarx_sd_init_cfg(struct v4l2_subdev *sd, 748 - struct v4l2_subdev_pad_config *cfg) 745 + struct v4l2_subdev_state *sd_state) 749 746 { 750 747 struct v4l2_subdev_format format = { 751 - .which = cfg ? V4L2_SUBDEV_FORMAT_TRY 752 - : V4L2_SUBDEV_FORMAT_ACTIVE, 748 + .which = sd_state ? V4L2_SUBDEV_FORMAT_TRY 749 + : V4L2_SUBDEV_FORMAT_ACTIVE, 753 750 .pad = CAL_CAMERARX_PAD_SINK, 754 751 .format = { 755 752 .width = 640, ··· 763 760 }, 764 761 }; 765 762 766 - return cal_camerarx_sd_set_fmt(sd, cfg, &format); 763 + return cal_camerarx_sd_set_fmt(sd, sd_state, &format); 767 764 } 768 765 769 766 static const struct v4l2_subdev_video_ops cal_camerarx_video_ops = {
+4 -1
drivers/media/platform/via-camera.c
··· 844 844 { 845 845 int ret; 846 846 struct v4l2_subdev_pad_config pad_cfg; 847 + struct v4l2_subdev_state pad_state = { 848 + .pads = &pad_cfg 849 + }; 847 850 struct v4l2_subdev_format format = { 848 851 .which = V4L2_SUBDEV_FORMAT_TRY, 849 852 }; ··· 855 852 upix->pixelformat = f->pixelformat; 856 853 viacam_fmt_pre(upix, spix); 857 854 v4l2_fill_mbus_format(&format.format, spix, f->mbus_code); 858 - ret = sensor_call(cam, pad, set_fmt, &pad_cfg, &format); 855 + ret = sensor_call(cam, pad, set_fmt, &pad_state, &format); 859 856 v4l2_fill_pix_format(spix, &format.format); 860 857 viacam_fmt_post(upix, spix); 861 858 return ret;
+12 -10
drivers/media/platform/video-mux.c
··· 140 140 141 141 static struct v4l2_mbus_framefmt * 142 142 __video_mux_get_pad_format(struct v4l2_subdev *sd, 143 - struct v4l2_subdev_pad_config *cfg, 143 + struct v4l2_subdev_state *sd_state, 144 144 unsigned int pad, u32 which) 145 145 { 146 146 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); 147 147 148 148 switch (which) { 149 149 case V4L2_SUBDEV_FORMAT_TRY: 150 - return v4l2_subdev_get_try_format(sd, cfg, pad); 150 + return v4l2_subdev_get_try_format(sd, sd_state, pad); 151 151 case V4L2_SUBDEV_FORMAT_ACTIVE: 152 152 return &vmux->format_mbus[pad]; 153 153 default: ··· 156 156 } 157 157 158 158 static int video_mux_get_format(struct v4l2_subdev *sd, 159 - struct v4l2_subdev_pad_config *cfg, 159 + struct v4l2_subdev_state *sd_state, 160 160 struct v4l2_subdev_format *sdformat) 161 161 { 162 162 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); 163 163 164 164 mutex_lock(&vmux->lock); 165 165 166 - sdformat->format = *__video_mux_get_pad_format(sd, cfg, sdformat->pad, 166 + sdformat->format = *__video_mux_get_pad_format(sd, sd_state, 167 + sdformat->pad, 167 168 sdformat->which); 168 169 169 170 mutex_unlock(&vmux->lock); ··· 173 172 } 174 173 175 174 static int video_mux_set_format(struct v4l2_subdev *sd, 176 - struct v4l2_subdev_pad_config *cfg, 175 + struct v4l2_subdev_state *sd_state, 177 176 struct v4l2_subdev_format *sdformat) 178 177 { 179 178 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); ··· 181 180 struct media_pad *pad = &vmux->pads[sdformat->pad]; 182 181 u16 source_pad = sd->entity.num_pads - 1; 183 182 184 - mbusformat = __video_mux_get_pad_format(sd, cfg, sdformat->pad, 185 - sdformat->which); 183 + mbusformat = __video_mux_get_pad_format(sd, sd_state, sdformat->pad, 184 + sdformat->which); 186 185 if (!mbusformat) 187 186 return -EINVAL; 188 187 189 - source_mbusformat = __video_mux_get_pad_format(sd, cfg, source_pad, 188 + source_mbusformat = __video_mux_get_pad_format(sd, sd_state, 189 + source_pad, 190 190 sdformat->which); 191 191 if (!source_mbusformat) 192 192 return -EINVAL; ··· 312 310 } 313 311 314 312 static int video_mux_init_cfg(struct v4l2_subdev *sd, 315 - struct v4l2_subdev_pad_config *cfg) 313 + struct v4l2_subdev_state *sd_state) 316 314 { 317 315 struct video_mux *vmux = v4l2_subdev_to_video_mux(sd); 318 316 struct v4l2_mbus_framefmt *mbusformat; ··· 321 319 mutex_lock(&vmux->lock); 322 320 323 321 for (i = 0; i < sd->entity.num_pads; i++) { 324 - mbusformat = v4l2_subdev_get_try_format(sd, cfg, i); 322 + mbusformat = v4l2_subdev_get_try_format(sd, sd_state, i); 325 323 *mbusformat = video_mux_format_mbus_default; 326 324 } 327 325
+18 -16
drivers/media/platform/vsp1/vsp1_brx.c
··· 65 65 */ 66 66 67 67 static int brx_enum_mbus_code(struct v4l2_subdev *subdev, 68 - struct v4l2_subdev_pad_config *cfg, 68 + struct v4l2_subdev_state *sd_state, 69 69 struct v4l2_subdev_mbus_code_enum *code) 70 70 { 71 71 static const unsigned int codes[] = { ··· 73 73 MEDIA_BUS_FMT_AYUV8_1X32, 74 74 }; 75 75 76 - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes, 76 + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, codes, 77 77 ARRAY_SIZE(codes)); 78 78 } 79 79 80 80 static int brx_enum_frame_size(struct v4l2_subdev *subdev, 81 - struct v4l2_subdev_pad_config *cfg, 81 + struct v4l2_subdev_state *sd_state, 82 82 struct v4l2_subdev_frame_size_enum *fse) 83 83 { 84 84 if (fse->index) ··· 97 97 } 98 98 99 99 static struct v4l2_rect *brx_get_compose(struct vsp1_brx *brx, 100 - struct v4l2_subdev_pad_config *cfg, 100 + struct v4l2_subdev_state *sd_state, 101 101 unsigned int pad) 102 102 { 103 - return v4l2_subdev_get_try_compose(&brx->entity.subdev, cfg, pad); 103 + return v4l2_subdev_get_try_compose(&brx->entity.subdev, sd_state, pad); 104 104 } 105 105 106 106 static void brx_try_format(struct vsp1_brx *brx, 107 - struct v4l2_subdev_pad_config *config, 107 + struct v4l2_subdev_state *sd_state, 108 108 unsigned int pad, struct v4l2_mbus_framefmt *fmt) 109 109 { 110 110 struct v4l2_mbus_framefmt *format; ··· 119 119 120 120 default: 121 121 /* The BRx can't perform format conversion. */ 122 - format = vsp1_entity_get_pad_format(&brx->entity, config, 122 + format = vsp1_entity_get_pad_format(&brx->entity, sd_state, 123 123 BRX_PAD_SINK(0)); 124 124 fmt->code = format->code; 125 125 break; ··· 132 132 } 133 133 134 134 static int brx_set_format(struct v4l2_subdev *subdev, 135 - struct v4l2_subdev_pad_config *cfg, 135 + struct v4l2_subdev_state *sd_state, 136 136 struct v4l2_subdev_format *fmt) 137 137 { 138 138 struct vsp1_brx *brx = to_brx(subdev); 139 - struct v4l2_subdev_pad_config *config; 139 + struct v4l2_subdev_state *config; 140 140 struct v4l2_mbus_framefmt *format; 141 141 int ret = 0; 142 142 143 143 mutex_lock(&brx->entity.lock); 144 144 145 - config = vsp1_entity_get_pad_config(&brx->entity, cfg, fmt->which); 145 + config = vsp1_entity_get_pad_config(&brx->entity, sd_state, 146 + fmt->which); 146 147 if (!config) { 147 148 ret = -EINVAL; 148 149 goto done; ··· 182 181 } 183 182 184 183 static int brx_get_selection(struct v4l2_subdev *subdev, 185 - struct v4l2_subdev_pad_config *cfg, 184 + struct v4l2_subdev_state *sd_state, 186 185 struct v4l2_subdev_selection *sel) 187 186 { 188 187 struct vsp1_brx *brx = to_brx(subdev); 189 - struct v4l2_subdev_pad_config *config; 188 + struct v4l2_subdev_state *config; 190 189 191 190 if (sel->pad == brx->entity.source_pad) 192 191 return -EINVAL; ··· 200 199 return 0; 201 200 202 201 case V4L2_SEL_TGT_COMPOSE: 203 - config = vsp1_entity_get_pad_config(&brx->entity, cfg, 202 + config = vsp1_entity_get_pad_config(&brx->entity, sd_state, 204 203 sel->which); 205 204 if (!config) 206 205 return -EINVAL; ··· 216 215 } 217 216 218 217 static int brx_set_selection(struct v4l2_subdev *subdev, 219 - struct v4l2_subdev_pad_config *cfg, 218 + struct v4l2_subdev_state *sd_state, 220 219 struct v4l2_subdev_selection *sel) 221 220 { 222 221 struct vsp1_brx *brx = to_brx(subdev); 223 - struct v4l2_subdev_pad_config *config; 222 + struct v4l2_subdev_state *config; 224 223 struct v4l2_mbus_framefmt *format; 225 224 struct v4l2_rect *compose; 226 225 int ret = 0; ··· 233 232 234 233 mutex_lock(&brx->entity.lock); 235 234 236 - config = vsp1_entity_get_pad_config(&brx->entity, cfg, sel->which); 235 + config = vsp1_entity_get_pad_config(&brx->entity, sd_state, 236 + sel->which); 237 237 if (!config) { 238 238 ret = -EINVAL; 239 239 goto done;
+7 -6
drivers/media/platform/vsp1/vsp1_clu.c
··· 123 123 }; 124 124 125 125 static int clu_enum_mbus_code(struct v4l2_subdev *subdev, 126 - struct v4l2_subdev_pad_config *cfg, 126 + struct v4l2_subdev_state *sd_state, 127 127 struct v4l2_subdev_mbus_code_enum *code) 128 128 { 129 - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, clu_codes, 129 + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, clu_codes, 130 130 ARRAY_SIZE(clu_codes)); 131 131 } 132 132 133 133 static int clu_enum_frame_size(struct v4l2_subdev *subdev, 134 - struct v4l2_subdev_pad_config *cfg, 134 + struct v4l2_subdev_state *sd_state, 135 135 struct v4l2_subdev_frame_size_enum *fse) 136 136 { 137 - return vsp1_subdev_enum_frame_size(subdev, cfg, fse, CLU_MIN_SIZE, 137 + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, 138 + CLU_MIN_SIZE, 138 139 CLU_MIN_SIZE, CLU_MAX_SIZE, 139 140 CLU_MAX_SIZE); 140 141 } 141 142 142 143 static int clu_set_format(struct v4l2_subdev *subdev, 143 - struct v4l2_subdev_pad_config *cfg, 144 + struct v4l2_subdev_state *sd_state, 144 145 struct v4l2_subdev_format *fmt) 145 146 { 146 - return vsp1_subdev_set_pad_format(subdev, cfg, fmt, clu_codes, 147 + return vsp1_subdev_set_pad_format(subdev, sd_state, fmt, clu_codes, 147 148 ARRAY_SIZE(clu_codes), 148 149 CLU_MIN_SIZE, CLU_MIN_SIZE, 149 150 CLU_MAX_SIZE, CLU_MAX_SIZE);
+31 -28
drivers/media/platform/vsp1/vsp1_entity.c
··· 103 103 /** 104 104 * vsp1_entity_get_pad_config - Get the pad configuration for an entity 105 105 * @entity: the entity 106 - * @cfg: the TRY pad configuration 106 + * @sd_state: the TRY state 107 107 * @which: configuration selector (ACTIVE or TRY) 108 108 * 109 109 * When called with which set to V4L2_SUBDEV_FORMAT_ACTIVE the caller must hold ··· 114 114 * and simply returned when requested. The ACTIVE configuration comes from the 115 115 * entity structure. 116 116 */ 117 - struct v4l2_subdev_pad_config * 117 + struct v4l2_subdev_state * 118 118 vsp1_entity_get_pad_config(struct vsp1_entity *entity, 119 - struct v4l2_subdev_pad_config *cfg, 119 + struct v4l2_subdev_state *sd_state, 120 120 enum v4l2_subdev_format_whence which) 121 121 { 122 122 switch (which) { ··· 124 124 return entity->config; 125 125 case V4L2_SUBDEV_FORMAT_TRY: 126 126 default: 127 - return cfg; 127 + return sd_state; 128 128 } 129 129 } 130 130 131 131 /** 132 132 * vsp1_entity_get_pad_format - Get a pad format from storage for an entity 133 133 * @entity: the entity 134 - * @cfg: the configuration storage 134 + * @sd_state: the state storage 135 135 * @pad: the pad number 136 136 * 137 137 * Return the format stored in the given configuration for an entity's pad. The ··· 139 139 */ 140 140 struct v4l2_mbus_framefmt * 141 141 vsp1_entity_get_pad_format(struct vsp1_entity *entity, 142 - struct v4l2_subdev_pad_config *cfg, 142 + struct v4l2_subdev_state *sd_state, 143 143 unsigned int pad) 144 144 { 145 - return v4l2_subdev_get_try_format(&entity->subdev, cfg, pad); 145 + return v4l2_subdev_get_try_format(&entity->subdev, sd_state, pad); 146 146 } 147 147 148 148 /** 149 149 * vsp1_entity_get_pad_selection - Get a pad selection from storage for entity 150 150 * @entity: the entity 151 - * @cfg: the configuration storage 151 + * @sd_state: the state storage 152 152 * @pad: the pad number 153 153 * @target: the selection target 154 154 * ··· 158 158 */ 159 159 struct v4l2_rect * 160 160 vsp1_entity_get_pad_selection(struct vsp1_entity *entity, 161 - struct v4l2_subdev_pad_config *cfg, 161 + struct v4l2_subdev_state *sd_state, 162 162 unsigned int pad, unsigned int target) 163 163 { 164 164 switch (target) { 165 165 case V4L2_SEL_TGT_COMPOSE: 166 - return v4l2_subdev_get_try_compose(&entity->subdev, cfg, pad); 166 + return v4l2_subdev_get_try_compose(&entity->subdev, sd_state, 167 + pad); 167 168 case V4L2_SEL_TGT_CROP: 168 - return v4l2_subdev_get_try_crop(&entity->subdev, cfg, pad); 169 + return v4l2_subdev_get_try_crop(&entity->subdev, sd_state, 170 + pad); 169 171 default: 170 172 return NULL; 171 173 } ··· 182 180 * function can be used as a handler for the subdev pad::init_cfg operation. 183 181 */ 184 182 int vsp1_entity_init_cfg(struct v4l2_subdev *subdev, 185 - struct v4l2_subdev_pad_config *cfg) 183 + struct v4l2_subdev_state *sd_state) 186 184 { 187 185 struct v4l2_subdev_format format; 188 186 unsigned int pad; ··· 191 189 memset(&format, 0, sizeof(format)); 192 190 193 191 format.pad = pad; 194 - format.which = cfg ? V4L2_SUBDEV_FORMAT_TRY 192 + format.which = sd_state ? V4L2_SUBDEV_FORMAT_TRY 195 193 : V4L2_SUBDEV_FORMAT_ACTIVE; 196 194 197 - v4l2_subdev_call(subdev, pad, set_fmt, cfg, &format); 195 + v4l2_subdev_call(subdev, pad, set_fmt, sd_state, &format); 198 196 } 199 197 200 198 return 0; ··· 210 208 * a direct drop-in for the operation handler. 211 209 */ 212 210 int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev, 213 - struct v4l2_subdev_pad_config *cfg, 211 + struct v4l2_subdev_state *sd_state, 214 212 struct v4l2_subdev_format *fmt) 215 213 { 216 214 struct vsp1_entity *entity = to_vsp1_entity(subdev); 217 - struct v4l2_subdev_pad_config *config; 215 + struct v4l2_subdev_state *config; 218 216 219 - config = vsp1_entity_get_pad_config(entity, cfg, fmt->which); 217 + config = vsp1_entity_get_pad_config(entity, sd_state, fmt->which); 220 218 if (!config) 221 219 return -EINVAL; 222 220 ··· 241 239 * the sink pad. 242 240 */ 243 241 int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev, 244 - struct v4l2_subdev_pad_config *cfg, 242 + struct v4l2_subdev_state *sd_state, 245 243 struct v4l2_subdev_mbus_code_enum *code, 246 244 const unsigned int *codes, unsigned int ncodes) 247 245 { ··· 253 251 254 252 code->code = codes[code->index]; 255 253 } else { 256 - struct v4l2_subdev_pad_config *config; 254 + struct v4l2_subdev_state *config; 257 255 struct v4l2_mbus_framefmt *format; 258 256 259 257 /* ··· 263 261 if (code->index) 264 262 return -EINVAL; 265 263 266 - config = vsp1_entity_get_pad_config(entity, cfg, code->which); 264 + config = vsp1_entity_get_pad_config(entity, sd_state, 265 + code->which); 267 266 if (!config) 268 267 return -EINVAL; 269 268 ··· 293 290 * source pad size identical to the sink pad. 294 291 */ 295 292 int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, 296 - struct v4l2_subdev_pad_config *cfg, 293 + struct v4l2_subdev_state *sd_state, 297 294 struct v4l2_subdev_frame_size_enum *fse, 298 295 unsigned int min_width, unsigned int min_height, 299 296 unsigned int max_width, unsigned int max_height) 300 297 { 301 298 struct vsp1_entity *entity = to_vsp1_entity(subdev); 302 - struct v4l2_subdev_pad_config *config; 299 + struct v4l2_subdev_state *config; 303 300 struct v4l2_mbus_framefmt *format; 304 301 int ret = 0; 305 302 306 - config = vsp1_entity_get_pad_config(entity, cfg, fse->which); 303 + config = vsp1_entity_get_pad_config(entity, sd_state, fse->which); 307 304 if (!config) 308 305 return -EINVAL; 309 306 ··· 356 353 * source pad. 357 354 */ 358 355 int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, 359 - struct v4l2_subdev_pad_config *cfg, 356 + struct v4l2_subdev_state *sd_state, 360 357 struct v4l2_subdev_format *fmt, 361 358 const unsigned int *codes, unsigned int ncodes, 362 359 unsigned int min_width, unsigned int min_height, 363 360 unsigned int max_width, unsigned int max_height) 364 361 { 365 362 struct vsp1_entity *entity = to_vsp1_entity(subdev); 366 - struct v4l2_subdev_pad_config *config; 363 + struct v4l2_subdev_state *config; 367 364 struct v4l2_mbus_framefmt *format; 368 365 struct v4l2_rect *selection; 369 366 unsigned int i; ··· 371 368 372 369 mutex_lock(&entity->lock); 373 370 374 - config = vsp1_entity_get_pad_config(entity, cfg, fmt->which); 371 + config = vsp1_entity_get_pad_config(entity, sd_state, fmt->which); 375 372 if (!config) { 376 373 ret = -EINVAL; 377 374 goto done; ··· 675 672 * Allocate the pad configuration to store formats and selection 676 673 * rectangles. 677 674 */ 678 - entity->config = v4l2_subdev_alloc_pad_config(&entity->subdev); 675 + entity->config = v4l2_subdev_alloc_state(&entity->subdev); 679 676 if (entity->config == NULL) { 680 677 media_entity_cleanup(&entity->subdev.entity); 681 678 return -ENOMEM; ··· 690 687 entity->ops->destroy(entity); 691 688 if (entity->subdev.ctrl_handler) 692 689 v4l2_ctrl_handler_free(entity->subdev.ctrl_handler); 693 - v4l2_subdev_free_pad_config(entity->config); 690 + v4l2_subdev_free_state(entity->config); 694 691 media_entity_cleanup(&entity->subdev.entity); 695 692 }
+10 -10
drivers/media/platform/vsp1/vsp1_entity.h
··· 115 115 unsigned int sink_pad; 116 116 117 117 struct v4l2_subdev subdev; 118 - struct v4l2_subdev_pad_config *config; 118 + struct v4l2_subdev_state *config; 119 119 120 120 struct mutex lock; /* Protects the pad config */ 121 121 }; ··· 136 136 const struct media_pad *local, 137 137 const struct media_pad *remote, u32 flags); 138 138 139 - struct v4l2_subdev_pad_config * 139 + struct v4l2_subdev_state * 140 140 vsp1_entity_get_pad_config(struct vsp1_entity *entity, 141 - struct v4l2_subdev_pad_config *cfg, 141 + struct v4l2_subdev_state *sd_state, 142 142 enum v4l2_subdev_format_whence which); 143 143 struct v4l2_mbus_framefmt * 144 144 vsp1_entity_get_pad_format(struct vsp1_entity *entity, 145 - struct v4l2_subdev_pad_config *cfg, 145 + struct v4l2_subdev_state *sd_state, 146 146 unsigned int pad); 147 147 struct v4l2_rect * 148 148 vsp1_entity_get_pad_selection(struct vsp1_entity *entity, 149 - struct v4l2_subdev_pad_config *cfg, 149 + struct v4l2_subdev_state *sd_state, 150 150 unsigned int pad, unsigned int target); 151 151 int vsp1_entity_init_cfg(struct v4l2_subdev *subdev, 152 - struct v4l2_subdev_pad_config *cfg); 152 + struct v4l2_subdev_state *sd_state); 153 153 154 154 void vsp1_entity_route_setup(struct vsp1_entity *entity, 155 155 struct vsp1_pipeline *pipe, ··· 173 173 struct media_pad *vsp1_entity_remote_pad(struct media_pad *pad); 174 174 175 175 int vsp1_subdev_get_pad_format(struct v4l2_subdev *subdev, 176 - struct v4l2_subdev_pad_config *cfg, 176 + struct v4l2_subdev_state *sd_state, 177 177 struct v4l2_subdev_format *fmt); 178 178 int vsp1_subdev_set_pad_format(struct v4l2_subdev *subdev, 179 - struct v4l2_subdev_pad_config *cfg, 179 + struct v4l2_subdev_state *sd_state, 180 180 struct v4l2_subdev_format *fmt, 181 181 const unsigned int *codes, unsigned int ncodes, 182 182 unsigned int min_width, unsigned int min_height, 183 183 unsigned int max_width, unsigned int max_height); 184 184 int vsp1_subdev_enum_mbus_code(struct v4l2_subdev *subdev, 185 - struct v4l2_subdev_pad_config *cfg, 185 + struct v4l2_subdev_state *sd_state, 186 186 struct v4l2_subdev_mbus_code_enum *code, 187 187 const unsigned int *codes, unsigned int ncodes); 188 188 int vsp1_subdev_enum_frame_size(struct v4l2_subdev *subdev, 189 - struct v4l2_subdev_pad_config *cfg, 189 + struct v4l2_subdev_state *sd_state, 190 190 struct v4l2_subdev_frame_size_enum *fse, 191 191 unsigned int min_w, unsigned int min_h, 192 192 unsigned int max_w, unsigned int max_h);
+28 -23
drivers/media/platform/vsp1/vsp1_histo.c
··· 170 170 */ 171 171 172 172 static int histo_enum_mbus_code(struct v4l2_subdev *subdev, 173 - struct v4l2_subdev_pad_config *cfg, 173 + struct v4l2_subdev_state *sd_state, 174 174 struct v4l2_subdev_mbus_code_enum *code) 175 175 { 176 176 struct vsp1_histogram *histo = subdev_to_histo(subdev); ··· 180 180 return 0; 181 181 } 182 182 183 - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, histo->formats, 183 + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, 184 + histo->formats, 184 185 histo->num_formats); 185 186 } 186 187 187 188 static int histo_enum_frame_size(struct v4l2_subdev *subdev, 188 - struct v4l2_subdev_pad_config *cfg, 189 + struct v4l2_subdev_state *sd_state, 189 190 struct v4l2_subdev_frame_size_enum *fse) 190 191 { 191 192 if (fse->pad != HISTO_PAD_SINK) 192 193 return -EINVAL; 193 194 194 - return vsp1_subdev_enum_frame_size(subdev, cfg, fse, HISTO_MIN_SIZE, 195 + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, 196 + HISTO_MIN_SIZE, 195 197 HISTO_MIN_SIZE, HISTO_MAX_SIZE, 196 198 HISTO_MAX_SIZE); 197 199 } 198 200 199 201 static int histo_get_selection(struct v4l2_subdev *subdev, 200 - struct v4l2_subdev_pad_config *cfg, 202 + struct v4l2_subdev_state *sd_state, 201 203 struct v4l2_subdev_selection *sel) 202 204 { 203 205 struct vsp1_histogram *histo = subdev_to_histo(subdev); 204 - struct v4l2_subdev_pad_config *config; 206 + struct v4l2_subdev_state *config; 205 207 struct v4l2_mbus_framefmt *format; 206 208 struct v4l2_rect *crop; 207 209 int ret = 0; ··· 213 211 214 212 mutex_lock(&histo->entity.lock); 215 213 216 - config = vsp1_entity_get_pad_config(&histo->entity, cfg, sel->which); 214 + config = vsp1_entity_get_pad_config(&histo->entity, sd_state, 215 + sel->which); 217 216 if (!config) { 218 217 ret = -EINVAL; 219 218 goto done; ··· 259 256 } 260 257 261 258 static int histo_set_crop(struct v4l2_subdev *subdev, 262 - struct v4l2_subdev_pad_config *config, 263 - struct v4l2_subdev_selection *sel) 259 + struct v4l2_subdev_state *sd_state, 260 + struct v4l2_subdev_selection *sel) 264 261 { 265 262 struct vsp1_histogram *histo = subdev_to_histo(subdev); 266 263 struct v4l2_mbus_framefmt *format; 267 264 struct v4l2_rect *selection; 268 265 269 266 /* The crop rectangle must be inside the input frame. */ 270 - format = vsp1_entity_get_pad_format(&histo->entity, config, 267 + format = vsp1_entity_get_pad_format(&histo->entity, sd_state, 271 268 HISTO_PAD_SINK); 272 269 sel->r.left = clamp_t(unsigned int, sel->r.left, 0, format->width - 1); 273 270 sel->r.top = clamp_t(unsigned int, sel->r.top, 0, format->height - 1); ··· 277 274 format->height - sel->r.top); 278 275 279 276 /* Set the crop rectangle and reset the compose rectangle. */ 280 - selection = vsp1_entity_get_pad_selection(&histo->entity, config, 277 + selection = vsp1_entity_get_pad_selection(&histo->entity, sd_state, 281 278 sel->pad, V4L2_SEL_TGT_CROP); 282 279 *selection = sel->r; 283 280 284 - selection = vsp1_entity_get_pad_selection(&histo->entity, config, 281 + selection = vsp1_entity_get_pad_selection(&histo->entity, sd_state, 285 282 sel->pad, 286 283 V4L2_SEL_TGT_COMPOSE); 287 284 *selection = sel->r; ··· 290 287 } 291 288 292 289 static int histo_set_compose(struct v4l2_subdev *subdev, 293 - struct v4l2_subdev_pad_config *config, 290 + struct v4l2_subdev_state *sd_state, 294 291 struct v4l2_subdev_selection *sel) 295 292 { 296 293 struct vsp1_histogram *histo = subdev_to_histo(subdev); ··· 306 303 sel->r.left = 0; 307 304 sel->r.top = 0; 308 305 309 - crop = vsp1_entity_get_pad_selection(&histo->entity, config, sel->pad, 306 + crop = vsp1_entity_get_pad_selection(&histo->entity, sd_state, 307 + sel->pad, 310 308 V4L2_SEL_TGT_CROP); 311 309 312 310 /* ··· 333 329 ratio = 1 << (crop->height * 2 / sel->r.height / 3); 334 330 sel->r.height = crop->height / ratio; 335 331 336 - compose = vsp1_entity_get_pad_selection(&histo->entity, config, 332 + compose = vsp1_entity_get_pad_selection(&histo->entity, sd_state, 337 333 sel->pad, 338 334 V4L2_SEL_TGT_COMPOSE); 339 335 *compose = sel->r; ··· 342 338 } 343 339 344 340 static int histo_set_selection(struct v4l2_subdev *subdev, 345 - struct v4l2_subdev_pad_config *cfg, 341 + struct v4l2_subdev_state *sd_state, 346 342 struct v4l2_subdev_selection *sel) 347 343 { 348 344 struct vsp1_histogram *histo = subdev_to_histo(subdev); 349 - struct v4l2_subdev_pad_config *config; 345 + struct v4l2_subdev_state *config; 350 346 int ret; 351 347 352 348 if (sel->pad != HISTO_PAD_SINK) ··· 354 350 355 351 mutex_lock(&histo->entity.lock); 356 352 357 - config = vsp1_entity_get_pad_config(&histo->entity, cfg, sel->which); 353 + config = vsp1_entity_get_pad_config(&histo->entity, sd_state, 354 + sel->which); 358 355 if (!config) { 359 356 ret = -EINVAL; 360 357 goto done; ··· 374 369 } 375 370 376 371 static int histo_get_format(struct v4l2_subdev *subdev, 377 - struct v4l2_subdev_pad_config *cfg, 372 + struct v4l2_subdev_state *sd_state, 378 373 struct v4l2_subdev_format *fmt) 379 374 { 380 375 if (fmt->pad == HISTO_PAD_SOURCE) { ··· 386 381 return 0; 387 382 } 388 383 389 - return vsp1_subdev_get_pad_format(subdev, cfg, fmt); 384 + return vsp1_subdev_get_pad_format(subdev, sd_state, fmt); 390 385 } 391 386 392 387 static int histo_set_format(struct v4l2_subdev *subdev, 393 - struct v4l2_subdev_pad_config *cfg, 388 + struct v4l2_subdev_state *sd_state, 394 389 struct v4l2_subdev_format *fmt) 395 390 { 396 391 struct vsp1_histogram *histo = subdev_to_histo(subdev); 397 392 398 393 if (fmt->pad != HISTO_PAD_SINK) 399 - return histo_get_format(subdev, cfg, fmt); 394 + return histo_get_format(subdev, sd_state, fmt); 400 395 401 - return vsp1_subdev_set_pad_format(subdev, cfg, fmt, 396 + return vsp1_subdev_set_pad_format(subdev, sd_state, fmt, 402 397 histo->formats, histo->num_formats, 403 398 HISTO_MIN_SIZE, HISTO_MIN_SIZE, 404 399 HISTO_MAX_SIZE, HISTO_MAX_SIZE);
+8 -6
drivers/media/platform/vsp1/vsp1_hsit.c
··· 34 34 */ 35 35 36 36 static int hsit_enum_mbus_code(struct v4l2_subdev *subdev, 37 - struct v4l2_subdev_pad_config *cfg, 37 + struct v4l2_subdev_state *sd_state, 38 38 struct v4l2_subdev_mbus_code_enum *code) 39 39 { 40 40 struct vsp1_hsit *hsit = to_hsit(subdev); ··· 52 52 } 53 53 54 54 static int hsit_enum_frame_size(struct v4l2_subdev *subdev, 55 - struct v4l2_subdev_pad_config *cfg, 55 + struct v4l2_subdev_state *sd_state, 56 56 struct v4l2_subdev_frame_size_enum *fse) 57 57 { 58 - return vsp1_subdev_enum_frame_size(subdev, cfg, fse, HSIT_MIN_SIZE, 58 + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, 59 + HSIT_MIN_SIZE, 59 60 HSIT_MIN_SIZE, HSIT_MAX_SIZE, 60 61 HSIT_MAX_SIZE); 61 62 } 62 63 63 64 static int hsit_set_format(struct v4l2_subdev *subdev, 64 - struct v4l2_subdev_pad_config *cfg, 65 + struct v4l2_subdev_state *sd_state, 65 66 struct v4l2_subdev_format *fmt) 66 67 { 67 68 struct vsp1_hsit *hsit = to_hsit(subdev); 68 - struct v4l2_subdev_pad_config *config; 69 + struct v4l2_subdev_state *config; 69 70 struct v4l2_mbus_framefmt *format; 70 71 int ret = 0; 71 72 72 73 mutex_lock(&hsit->entity.lock); 73 74 74 - config = vsp1_entity_get_pad_config(&hsit->entity, cfg, fmt->which); 75 + config = vsp1_entity_get_pad_config(&hsit->entity, sd_state, 76 + fmt->which); 75 77 if (!config) { 76 78 ret = -EINVAL; 77 79 goto done;
+7 -6
drivers/media/platform/vsp1/vsp1_lif.c
··· 40 40 }; 41 41 42 42 static int lif_enum_mbus_code(struct v4l2_subdev *subdev, 43 - struct v4l2_subdev_pad_config *cfg, 43 + struct v4l2_subdev_state *sd_state, 44 44 struct v4l2_subdev_mbus_code_enum *code) 45 45 { 46 - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, lif_codes, 46 + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, lif_codes, 47 47 ARRAY_SIZE(lif_codes)); 48 48 } 49 49 50 50 static int lif_enum_frame_size(struct v4l2_subdev *subdev, 51 - struct v4l2_subdev_pad_config *cfg, 51 + struct v4l2_subdev_state *sd_state, 52 52 struct v4l2_subdev_frame_size_enum *fse) 53 53 { 54 - return vsp1_subdev_enum_frame_size(subdev, cfg, fse, LIF_MIN_SIZE, 54 + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, 55 + LIF_MIN_SIZE, 55 56 LIF_MIN_SIZE, LIF_MAX_SIZE, 56 57 LIF_MAX_SIZE); 57 58 } 58 59 59 60 static int lif_set_format(struct v4l2_subdev *subdev, 60 - struct v4l2_subdev_pad_config *cfg, 61 + struct v4l2_subdev_state *sd_state, 61 62 struct v4l2_subdev_format *fmt) 62 63 { 63 - return vsp1_subdev_set_pad_format(subdev, cfg, fmt, lif_codes, 64 + return vsp1_subdev_set_pad_format(subdev, sd_state, fmt, lif_codes, 64 65 ARRAY_SIZE(lif_codes), 65 66 LIF_MIN_SIZE, LIF_MIN_SIZE, 66 67 LIF_MAX_SIZE, LIF_MAX_SIZE);
+7 -6
drivers/media/platform/vsp1/vsp1_lut.c
··· 99 99 }; 100 100 101 101 static int lut_enum_mbus_code(struct v4l2_subdev *subdev, 102 - struct v4l2_subdev_pad_config *cfg, 102 + struct v4l2_subdev_state *sd_state, 103 103 struct v4l2_subdev_mbus_code_enum *code) 104 104 { 105 - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, lut_codes, 105 + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, lut_codes, 106 106 ARRAY_SIZE(lut_codes)); 107 107 } 108 108 109 109 static int lut_enum_frame_size(struct v4l2_subdev *subdev, 110 - struct v4l2_subdev_pad_config *cfg, 110 + struct v4l2_subdev_state *sd_state, 111 111 struct v4l2_subdev_frame_size_enum *fse) 112 112 { 113 - return vsp1_subdev_enum_frame_size(subdev, cfg, fse, LUT_MIN_SIZE, 113 + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, 114 + LUT_MIN_SIZE, 114 115 LUT_MIN_SIZE, LUT_MAX_SIZE, 115 116 LUT_MAX_SIZE); 116 117 } 117 118 118 119 static int lut_set_format(struct v4l2_subdev *subdev, 119 - struct v4l2_subdev_pad_config *cfg, 120 + struct v4l2_subdev_state *sd_state, 120 121 struct v4l2_subdev_format *fmt) 121 122 { 122 - return vsp1_subdev_set_pad_format(subdev, cfg, fmt, lut_codes, 123 + return vsp1_subdev_set_pad_format(subdev, sd_state, fmt, lut_codes, 123 124 ARRAY_SIZE(lut_codes), 124 125 LUT_MIN_SIZE, LUT_MIN_SIZE, 125 126 LUT_MAX_SIZE, LUT_MAX_SIZE);
+18 -14
drivers/media/platform/vsp1/vsp1_rwpf.c
··· 17 17 #define RWPF_MIN_HEIGHT 1 18 18 19 19 struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf, 20 - struct v4l2_subdev_pad_config *config) 20 + struct v4l2_subdev_state *sd_state) 21 21 { 22 - return v4l2_subdev_get_try_crop(&rwpf->entity.subdev, config, 22 + return v4l2_subdev_get_try_crop(&rwpf->entity.subdev, sd_state, 23 23 RWPF_PAD_SINK); 24 24 } 25 25 ··· 28 28 */ 29 29 30 30 static int vsp1_rwpf_enum_mbus_code(struct v4l2_subdev *subdev, 31 - struct v4l2_subdev_pad_config *cfg, 31 + struct v4l2_subdev_state *sd_state, 32 32 struct v4l2_subdev_mbus_code_enum *code) 33 33 { 34 34 static const unsigned int codes[] = { ··· 46 46 } 47 47 48 48 static int vsp1_rwpf_enum_frame_size(struct v4l2_subdev *subdev, 49 - struct v4l2_subdev_pad_config *cfg, 49 + struct v4l2_subdev_state *sd_state, 50 50 struct v4l2_subdev_frame_size_enum *fse) 51 51 { 52 52 struct vsp1_rwpf *rwpf = to_rwpf(subdev); 53 53 54 - return vsp1_subdev_enum_frame_size(subdev, cfg, fse, RWPF_MIN_WIDTH, 54 + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, 55 + RWPF_MIN_WIDTH, 55 56 RWPF_MIN_HEIGHT, rwpf->max_width, 56 57 rwpf->max_height); 57 58 } 58 59 59 60 static int vsp1_rwpf_set_format(struct v4l2_subdev *subdev, 60 - struct v4l2_subdev_pad_config *cfg, 61 + struct v4l2_subdev_state *sd_state, 61 62 struct v4l2_subdev_format *fmt) 62 63 { 63 64 struct vsp1_rwpf *rwpf = to_rwpf(subdev); 64 - struct v4l2_subdev_pad_config *config; 65 + struct v4l2_subdev_state *config; 65 66 struct v4l2_mbus_framefmt *format; 66 67 int ret = 0; 67 68 68 69 mutex_lock(&rwpf->entity.lock); 69 70 70 - config = vsp1_entity_get_pad_config(&rwpf->entity, cfg, fmt->which); 71 + config = vsp1_entity_get_pad_config(&rwpf->entity, sd_state, 72 + fmt->which); 71 73 if (!config) { 72 74 ret = -EINVAL; 73 75 goto done; ··· 130 128 } 131 129 132 130 static int vsp1_rwpf_get_selection(struct v4l2_subdev *subdev, 133 - struct v4l2_subdev_pad_config *cfg, 131 + struct v4l2_subdev_state *sd_state, 134 132 struct v4l2_subdev_selection *sel) 135 133 { 136 134 struct vsp1_rwpf *rwpf = to_rwpf(subdev); 137 - struct v4l2_subdev_pad_config *config; 135 + struct v4l2_subdev_state *config; 138 136 struct v4l2_mbus_framefmt *format; 139 137 int ret = 0; 140 138 ··· 147 145 148 146 mutex_lock(&rwpf->entity.lock); 149 147 150 - config = vsp1_entity_get_pad_config(&rwpf->entity, cfg, sel->which); 148 + config = vsp1_entity_get_pad_config(&rwpf->entity, sd_state, 149 + sel->which); 151 150 if (!config) { 152 151 ret = -EINVAL; 153 152 goto done; ··· 179 176 } 180 177 181 178 static int vsp1_rwpf_set_selection(struct v4l2_subdev *subdev, 182 - struct v4l2_subdev_pad_config *cfg, 179 + struct v4l2_subdev_state *sd_state, 183 180 struct v4l2_subdev_selection *sel) 184 181 { 185 182 struct vsp1_rwpf *rwpf = to_rwpf(subdev); 186 - struct v4l2_subdev_pad_config *config; 183 + struct v4l2_subdev_state *config; 187 184 struct v4l2_mbus_framefmt *format; 188 185 struct v4l2_rect *crop; 189 186 int ret = 0; ··· 200 197 201 198 mutex_lock(&rwpf->entity.lock); 202 199 203 - config = vsp1_entity_get_pad_config(&rwpf->entity, cfg, sel->which); 200 + config = vsp1_entity_get_pad_config(&rwpf->entity, sd_state, 201 + sel->which); 204 202 if (!config) { 205 203 ret = -EINVAL; 206 204 goto done;
+1 -1
drivers/media/platform/vsp1/vsp1_rwpf.h
··· 84 84 extern const struct v4l2_subdev_pad_ops vsp1_rwpf_pad_ops; 85 85 86 86 struct v4l2_rect *vsp1_rwpf_get_crop(struct vsp1_rwpf *rwpf, 87 - struct v4l2_subdev_pad_config *config); 87 + struct v4l2_subdev_state *sd_state); 88 88 89 89 #endif /* __VSP1_RWPF_H__ */
+12 -10
drivers/media/platform/vsp1/vsp1_sru.c
··· 106 106 */ 107 107 108 108 static int sru_enum_mbus_code(struct v4l2_subdev *subdev, 109 - struct v4l2_subdev_pad_config *cfg, 109 + struct v4l2_subdev_state *sd_state, 110 110 struct v4l2_subdev_mbus_code_enum *code) 111 111 { 112 112 static const unsigned int codes[] = { ··· 114 114 MEDIA_BUS_FMT_AYUV8_1X32, 115 115 }; 116 116 117 - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes, 117 + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, codes, 118 118 ARRAY_SIZE(codes)); 119 119 } 120 120 121 121 static int sru_enum_frame_size(struct v4l2_subdev *subdev, 122 - struct v4l2_subdev_pad_config *cfg, 122 + struct v4l2_subdev_state *sd_state, 123 123 struct v4l2_subdev_frame_size_enum *fse) 124 124 { 125 125 struct vsp1_sru *sru = to_sru(subdev); 126 - struct v4l2_subdev_pad_config *config; 126 + struct v4l2_subdev_state *config; 127 127 struct v4l2_mbus_framefmt *format; 128 128 int ret = 0; 129 129 130 - config = vsp1_entity_get_pad_config(&sru->entity, cfg, fse->which); 130 + config = vsp1_entity_get_pad_config(&sru->entity, sd_state, 131 + fse->which); 131 132 if (!config) 132 133 return -EINVAL; 133 134 ··· 165 164 } 166 165 167 166 static void sru_try_format(struct vsp1_sru *sru, 168 - struct v4l2_subdev_pad_config *config, 167 + struct v4l2_subdev_state *sd_state, 169 168 unsigned int pad, struct v4l2_mbus_framefmt *fmt) 170 169 { 171 170 struct v4l2_mbus_framefmt *format; ··· 185 184 186 185 case SRU_PAD_SOURCE: 187 186 /* The SRU can't perform format conversion. */ 188 - format = vsp1_entity_get_pad_format(&sru->entity, config, 187 + format = vsp1_entity_get_pad_format(&sru->entity, sd_state, 189 188 SRU_PAD_SINK); 190 189 fmt->code = format->code; 191 190 ··· 217 216 } 218 217 219 218 static int sru_set_format(struct v4l2_subdev *subdev, 220 - struct v4l2_subdev_pad_config *cfg, 219 + struct v4l2_subdev_state *sd_state, 221 220 struct v4l2_subdev_format *fmt) 222 221 { 223 222 struct vsp1_sru *sru = to_sru(subdev); 224 - struct v4l2_subdev_pad_config *config; 223 + struct v4l2_subdev_state *config; 225 224 struct v4l2_mbus_framefmt *format; 226 225 int ret = 0; 227 226 228 227 mutex_lock(&sru->entity.lock); 229 228 230 - config = vsp1_entity_get_pad_config(&sru->entity, cfg, fmt->which); 229 + config = vsp1_entity_get_pad_config(&sru->entity, sd_state, 230 + fmt->which); 231 231 if (!config) { 232 232 ret = -EINVAL; 233 233 goto done;
+12 -10
drivers/media/platform/vsp1/vsp1_uds.c
··· 111 111 */ 112 112 113 113 static int uds_enum_mbus_code(struct v4l2_subdev *subdev, 114 - struct v4l2_subdev_pad_config *cfg, 114 + struct v4l2_subdev_state *sd_state, 115 115 struct v4l2_subdev_mbus_code_enum *code) 116 116 { 117 117 static const unsigned int codes[] = { ··· 119 119 MEDIA_BUS_FMT_AYUV8_1X32, 120 120 }; 121 121 122 - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, codes, 122 + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, codes, 123 123 ARRAY_SIZE(codes)); 124 124 } 125 125 126 126 static int uds_enum_frame_size(struct v4l2_subdev *subdev, 127 - struct v4l2_subdev_pad_config *cfg, 127 + struct v4l2_subdev_state *sd_state, 128 128 struct v4l2_subdev_frame_size_enum *fse) 129 129 { 130 130 struct vsp1_uds *uds = to_uds(subdev); 131 - struct v4l2_subdev_pad_config *config; 131 + struct v4l2_subdev_state *config; 132 132 struct v4l2_mbus_framefmt *format; 133 133 int ret = 0; 134 134 135 - config = vsp1_entity_get_pad_config(&uds->entity, cfg, fse->which); 135 + config = vsp1_entity_get_pad_config(&uds->entity, sd_state, 136 + fse->which); 136 137 if (!config) 137 138 return -EINVAL; 138 139 ··· 165 164 } 166 165 167 166 static void uds_try_format(struct vsp1_uds *uds, 168 - struct v4l2_subdev_pad_config *config, 167 + struct v4l2_subdev_state *sd_state, 169 168 unsigned int pad, struct v4l2_mbus_framefmt *fmt) 170 169 { 171 170 struct v4l2_mbus_framefmt *format; ··· 185 184 186 185 case UDS_PAD_SOURCE: 187 186 /* The UDS scales but can't perform format conversion. */ 188 - format = vsp1_entity_get_pad_format(&uds->entity, config, 187 + format = vsp1_entity_get_pad_format(&uds->entity, sd_state, 189 188 UDS_PAD_SINK); 190 189 fmt->code = format->code; 191 190 ··· 201 200 } 202 201 203 202 static int uds_set_format(struct v4l2_subdev *subdev, 204 - struct v4l2_subdev_pad_config *cfg, 203 + struct v4l2_subdev_state *sd_state, 205 204 struct v4l2_subdev_format *fmt) 206 205 { 207 206 struct vsp1_uds *uds = to_uds(subdev); 208 - struct v4l2_subdev_pad_config *config; 207 + struct v4l2_subdev_state *config; 209 208 struct v4l2_mbus_framefmt *format; 210 209 int ret = 0; 211 210 212 211 mutex_lock(&uds->entity.lock); 213 212 214 - config = vsp1_entity_get_pad_config(&uds->entity, cfg, fmt->which); 213 + config = vsp1_entity_get_pad_config(&uds->entity, sd_state, 214 + fmt->which); 215 215 if (!config) { 216 216 ret = -EINVAL; 217 217 goto done;
+15 -12
drivers/media/platform/vsp1/vsp1_uif.c
··· 54 54 }; 55 55 56 56 static int uif_enum_mbus_code(struct v4l2_subdev *subdev, 57 - struct v4l2_subdev_pad_config *cfg, 57 + struct v4l2_subdev_state *sd_state, 58 58 struct v4l2_subdev_mbus_code_enum *code) 59 59 { 60 - return vsp1_subdev_enum_mbus_code(subdev, cfg, code, uif_codes, 60 + return vsp1_subdev_enum_mbus_code(subdev, sd_state, code, uif_codes, 61 61 ARRAY_SIZE(uif_codes)); 62 62 } 63 63 64 64 static int uif_enum_frame_size(struct v4l2_subdev *subdev, 65 - struct v4l2_subdev_pad_config *cfg, 65 + struct v4l2_subdev_state *sd_state, 66 66 struct v4l2_subdev_frame_size_enum *fse) 67 67 { 68 - return vsp1_subdev_enum_frame_size(subdev, cfg, fse, UIF_MIN_SIZE, 68 + return vsp1_subdev_enum_frame_size(subdev, sd_state, fse, 69 + UIF_MIN_SIZE, 69 70 UIF_MIN_SIZE, UIF_MAX_SIZE, 70 71 UIF_MAX_SIZE); 71 72 } 72 73 73 74 static int uif_set_format(struct v4l2_subdev *subdev, 74 - struct v4l2_subdev_pad_config *cfg, 75 + struct v4l2_subdev_state *sd_state, 75 76 struct v4l2_subdev_format *fmt) 76 77 { 77 - return vsp1_subdev_set_pad_format(subdev, cfg, fmt, uif_codes, 78 + return vsp1_subdev_set_pad_format(subdev, sd_state, fmt, uif_codes, 78 79 ARRAY_SIZE(uif_codes), 79 80 UIF_MIN_SIZE, UIF_MIN_SIZE, 80 81 UIF_MAX_SIZE, UIF_MAX_SIZE); 81 82 } 82 83 83 84 static int uif_get_selection(struct v4l2_subdev *subdev, 84 - struct v4l2_subdev_pad_config *cfg, 85 + struct v4l2_subdev_state *sd_state, 85 86 struct v4l2_subdev_selection *sel) 86 87 { 87 88 struct vsp1_uif *uif = to_uif(subdev); 88 - struct v4l2_subdev_pad_config *config; 89 + struct v4l2_subdev_state *config; 89 90 struct v4l2_mbus_framefmt *format; 90 91 int ret = 0; 91 92 ··· 95 94 96 95 mutex_lock(&uif->entity.lock); 97 96 98 - config = vsp1_entity_get_pad_config(&uif->entity, cfg, sel->which); 97 + config = vsp1_entity_get_pad_config(&uif->entity, sd_state, 98 + sel->which); 99 99 if (!config) { 100 100 ret = -EINVAL; 101 101 goto done; ··· 129 127 } 130 128 131 129 static int uif_set_selection(struct v4l2_subdev *subdev, 132 - struct v4l2_subdev_pad_config *cfg, 130 + struct v4l2_subdev_state *sd_state, 133 131 struct v4l2_subdev_selection *sel) 134 132 { 135 133 struct vsp1_uif *uif = to_uif(subdev); 136 - struct v4l2_subdev_pad_config *config; 134 + struct v4l2_subdev_state *config; 137 135 struct v4l2_mbus_framefmt *format; 138 136 struct v4l2_rect *selection; 139 137 int ret = 0; ··· 144 142 145 143 mutex_lock(&uif->entity.lock); 146 144 147 - config = vsp1_entity_get_pad_config(&uif->entity, cfg, sel->which); 145 + config = vsp1_entity_get_pad_config(&uif->entity, sd_state, 146 + sel->which); 148 147 if (!config) { 149 148 ret = -EINVAL; 150 149 goto done;
+14 -12
drivers/media/platform/xilinx/xilinx-csi2rxss.c
··· 681 681 682 682 static struct v4l2_mbus_framefmt * 683 683 __xcsi2rxss_get_pad_format(struct xcsi2rxss_state *xcsi2rxss, 684 - struct v4l2_subdev_pad_config *cfg, 684 + struct v4l2_subdev_state *sd_state, 685 685 unsigned int pad, u32 which) 686 686 { 687 687 switch (which) { 688 688 case V4L2_SUBDEV_FORMAT_TRY: 689 - return v4l2_subdev_get_try_format(&xcsi2rxss->subdev, cfg, pad); 689 + return v4l2_subdev_get_try_format(&xcsi2rxss->subdev, 690 + sd_state, pad); 690 691 case V4L2_SUBDEV_FORMAT_ACTIVE: 691 692 return &xcsi2rxss->format; 692 693 default: ··· 698 697 /** 699 698 * xcsi2rxss_init_cfg - Initialise the pad format config to default 700 699 * @sd: Pointer to V4L2 Sub device structure 701 - * @cfg: Pointer to sub device pad information structure 700 + * @sd_state: Pointer to sub device state structure 702 701 * 703 702 * This function is used to initialize the pad format with the default 704 703 * values. ··· 706 705 * Return: 0 on success 707 706 */ 708 707 static int xcsi2rxss_init_cfg(struct v4l2_subdev *sd, 709 - struct v4l2_subdev_pad_config *cfg) 708 + struct v4l2_subdev_state *sd_state) 710 709 { 711 710 struct xcsi2rxss_state *xcsi2rxss = to_xcsi2rxssstate(sd); 712 711 struct v4l2_mbus_framefmt *format; ··· 714 713 715 714 mutex_lock(&xcsi2rxss->lock); 716 715 for (i = 0; i < XCSI_MEDIA_PADS; i++) { 717 - format = v4l2_subdev_get_try_format(sd, cfg, i); 716 + format = v4l2_subdev_get_try_format(sd, sd_state, i); 718 717 *format = xcsi2rxss->default_format; 719 718 } 720 719 mutex_unlock(&xcsi2rxss->lock); ··· 725 724 /** 726 725 * xcsi2rxss_get_format - Get the pad format 727 726 * @sd: Pointer to V4L2 Sub device structure 728 - * @cfg: Pointer to sub device pad information structure 727 + * @sd_state: Pointer to sub device state structure 729 728 * @fmt: Pointer to pad level media bus format 730 729 * 731 730 * This function is used to get the pad format information. ··· 733 732 * Return: 0 on success 734 733 */ 735 734 static int xcsi2rxss_get_format(struct v4l2_subdev *sd, 736 - struct v4l2_subdev_pad_config *cfg, 735 + struct v4l2_subdev_state *sd_state, 737 736 struct v4l2_subdev_format *fmt) 738 737 { 739 738 struct xcsi2rxss_state *xcsi2rxss = to_xcsi2rxssstate(sd); 740 739 741 740 mutex_lock(&xcsi2rxss->lock); 742 - fmt->format = *__xcsi2rxss_get_pad_format(xcsi2rxss, cfg, fmt->pad, 741 + fmt->format = *__xcsi2rxss_get_pad_format(xcsi2rxss, sd_state, 742 + fmt->pad, 743 743 fmt->which); 744 744 mutex_unlock(&xcsi2rxss->lock); 745 745 ··· 750 748 /** 751 749 * xcsi2rxss_set_format - This is used to set the pad format 752 750 * @sd: Pointer to V4L2 Sub device structure 753 - * @cfg: Pointer to sub device pad information structure 751 + * @sd_state: Pointer to sub device state structure 754 752 * @fmt: Pointer to pad level media bus format 755 753 * 756 754 * This function is used to set the pad format. Since the pad format is fixed ··· 761 759 * Return: 0 on success 762 760 */ 763 761 static int xcsi2rxss_set_format(struct v4l2_subdev *sd, 764 - struct v4l2_subdev_pad_config *cfg, 762 + struct v4l2_subdev_state *sd_state, 765 763 struct v4l2_subdev_format *fmt) 766 764 { 767 765 struct xcsi2rxss_state *xcsi2rxss = to_xcsi2rxssstate(sd); ··· 775 773 * CSI format cannot be changed at runtime. 776 774 * Ensure that format to set is copied to over to CSI pad format 777 775 */ 778 - __format = __xcsi2rxss_get_pad_format(xcsi2rxss, cfg, 776 + __format = __xcsi2rxss_get_pad_format(xcsi2rxss, sd_state, 779 777 fmt->pad, fmt->which); 780 778 781 779 /* only sink pad format can be updated */ ··· 813 811 * Return: -EINVAL or zero on success 814 812 */ 815 813 static int xcsi2rxss_enum_mbus_code(struct v4l2_subdev *sd, 816 - struct v4l2_subdev_pad_config *cfg, 814 + struct v4l2_subdev_state *sd_state, 817 815 struct v4l2_subdev_mbus_code_enum *code) 818 816 { 819 817 struct xcsi2rxss_state *state = to_xcsi2rxssstate(sd);
+14 -11
drivers/media/platform/xilinx/xilinx-tpg.c
··· 251 251 252 252 static struct v4l2_mbus_framefmt * 253 253 __xtpg_get_pad_format(struct xtpg_device *xtpg, 254 - struct v4l2_subdev_pad_config *cfg, 254 + struct v4l2_subdev_state *sd_state, 255 255 unsigned int pad, u32 which) 256 256 { 257 257 switch (which) { 258 258 case V4L2_SUBDEV_FORMAT_TRY: 259 - return v4l2_subdev_get_try_format(&xtpg->xvip.subdev, cfg, pad); 259 + return v4l2_subdev_get_try_format(&xtpg->xvip.subdev, 260 + sd_state, pad); 260 261 case V4L2_SUBDEV_FORMAT_ACTIVE: 261 262 return &xtpg->formats[pad]; 262 263 default: ··· 266 265 } 267 266 268 267 static int xtpg_get_format(struct v4l2_subdev *subdev, 269 - struct v4l2_subdev_pad_config *cfg, 268 + struct v4l2_subdev_state *sd_state, 270 269 struct v4l2_subdev_format *fmt) 271 270 { 272 271 struct xtpg_device *xtpg = to_tpg(subdev); 273 272 274 - fmt->format = *__xtpg_get_pad_format(xtpg, cfg, fmt->pad, fmt->which); 273 + fmt->format = *__xtpg_get_pad_format(xtpg, sd_state, fmt->pad, 274 + fmt->which); 275 275 276 276 return 0; 277 277 } 278 278 279 279 static int xtpg_set_format(struct v4l2_subdev *subdev, 280 - struct v4l2_subdev_pad_config *cfg, 280 + struct v4l2_subdev_state *sd_state, 281 281 struct v4l2_subdev_format *fmt) 282 282 { 283 283 struct xtpg_device *xtpg = to_tpg(subdev); 284 284 struct v4l2_mbus_framefmt *__format; 285 285 u32 bayer_phase; 286 286 287 - __format = __xtpg_get_pad_format(xtpg, cfg, fmt->pad, fmt->which); 287 + __format = __xtpg_get_pad_format(xtpg, sd_state, fmt->pad, fmt->which); 288 288 289 289 /* In two pads mode the source pad format is always identical to the 290 290 * sink pad format. ··· 308 306 309 307 /* Propagate the format to the source pad. */ 310 308 if (xtpg->npads == 2) { 311 - __format = __xtpg_get_pad_format(xtpg, cfg, 1, fmt->which); 309 + __format = __xtpg_get_pad_format(xtpg, sd_state, 1, 310 + fmt->which); 312 311 *__format = fmt->format; 313 312 } 314 313 ··· 321 318 */ 322 319 323 320 static int xtpg_enum_frame_size(struct v4l2_subdev *subdev, 324 - struct v4l2_subdev_pad_config *cfg, 321 + struct v4l2_subdev_state *sd_state, 325 322 struct v4l2_subdev_frame_size_enum *fse) 326 323 { 327 324 struct v4l2_mbus_framefmt *format; 328 325 329 - format = v4l2_subdev_get_try_format(subdev, cfg, fse->pad); 326 + format = v4l2_subdev_get_try_format(subdev, sd_state, fse->pad); 330 327 331 328 if (fse->index || fse->code != format->code) 332 329 return -EINVAL; ··· 354 351 struct xtpg_device *xtpg = to_tpg(subdev); 355 352 struct v4l2_mbus_framefmt *format; 356 353 357 - format = v4l2_subdev_get_try_format(subdev, fh->pad, 0); 354 + format = v4l2_subdev_get_try_format(subdev, fh->state, 0); 358 355 *format = xtpg->default_format; 359 356 360 357 if (xtpg->npads == 2) { 361 - format = v4l2_subdev_get_try_format(subdev, fh->pad, 1); 358 + format = v4l2_subdev_get_try_format(subdev, fh->state, 1); 362 359 *format = xtpg->default_format; 363 360 } 364 361
+6 -6
drivers/media/platform/xilinx/xilinx-vip.c
··· 234 234 /** 235 235 * xvip_enum_mbus_code - Enumerate the media format code 236 236 * @subdev: V4L2 subdevice 237 - * @cfg: V4L2 subdev pad configuration 237 + * @sd_state: V4L2 subdev state 238 238 * @code: returning media bus code 239 239 * 240 240 * Enumerate the media bus code of the subdevice. Return the corresponding ··· 246 246 * is not valid. 247 247 */ 248 248 int xvip_enum_mbus_code(struct v4l2_subdev *subdev, 249 - struct v4l2_subdev_pad_config *cfg, 249 + struct v4l2_subdev_state *sd_state, 250 250 struct v4l2_subdev_mbus_code_enum *code) 251 251 { 252 252 struct v4l2_mbus_framefmt *format; ··· 260 260 if (code->index) 261 261 return -EINVAL; 262 262 263 - format = v4l2_subdev_get_try_format(subdev, cfg, code->pad); 263 + format = v4l2_subdev_get_try_format(subdev, sd_state, code->pad); 264 264 265 265 code->code = format->code; 266 266 ··· 271 271 /** 272 272 * xvip_enum_frame_size - Enumerate the media bus frame size 273 273 * @subdev: V4L2 subdevice 274 - * @cfg: V4L2 subdev pad configuration 274 + * @sd_state: V4L2 subdev state 275 275 * @fse: returning media bus frame size 276 276 * 277 277 * This function is a drop-in implementation of the subdev enum_frame_size pad ··· 284 284 * if the index or the code is not valid. 285 285 */ 286 286 int xvip_enum_frame_size(struct v4l2_subdev *subdev, 287 - struct v4l2_subdev_pad_config *cfg, 287 + struct v4l2_subdev_state *sd_state, 288 288 struct v4l2_subdev_frame_size_enum *fse) 289 289 { 290 290 struct v4l2_mbus_framefmt *format; ··· 295 295 if (fse->which == V4L2_SUBDEV_FORMAT_ACTIVE) 296 296 return -EINVAL; 297 297 298 - format = v4l2_subdev_get_try_format(subdev, cfg, fse->pad); 298 + format = v4l2_subdev_get_try_format(subdev, sd_state, fse->pad); 299 299 300 300 if (fse->index || fse->code != format->code) 301 301 return -EINVAL;
+2 -2
drivers/media/platform/xilinx/xilinx-vip.h
··· 125 125 void xvip_set_format_size(struct v4l2_mbus_framefmt *format, 126 126 const struct v4l2_subdev_format *fmt); 127 127 int xvip_enum_mbus_code(struct v4l2_subdev *subdev, 128 - struct v4l2_subdev_pad_config *cfg, 128 + struct v4l2_subdev_state *sd_state, 129 129 struct v4l2_subdev_mbus_code_enum *code); 130 130 int xvip_enum_frame_size(struct v4l2_subdev *subdev, 131 - struct v4l2_subdev_pad_config *cfg, 131 + struct v4l2_subdev_state *sd_state, 132 132 struct v4l2_subdev_frame_size_enum *fse); 133 133 134 134 static inline u32 xvip_read(struct xvip_device *xvip, u32 addr)
+10 -10
drivers/media/test-drivers/vimc/vimc-debayer.c
··· 150 150 } 151 151 152 152 static int vimc_deb_init_cfg(struct v4l2_subdev *sd, 153 - struct v4l2_subdev_pad_config *cfg) 153 + struct v4l2_subdev_state *sd_state) 154 154 { 155 155 struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd); 156 156 struct v4l2_mbus_framefmt *mf; 157 157 unsigned int i; 158 158 159 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 159 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 160 160 *mf = sink_fmt_default; 161 161 162 162 for (i = 1; i < sd->entity.num_pads; i++) { 163 - mf = v4l2_subdev_get_try_format(sd, cfg, i); 163 + mf = v4l2_subdev_get_try_format(sd, sd_state, i); 164 164 *mf = sink_fmt_default; 165 165 mf->code = vdeb->src_code; 166 166 } ··· 169 169 } 170 170 171 171 static int vimc_deb_enum_mbus_code(struct v4l2_subdev *sd, 172 - struct v4l2_subdev_pad_config *cfg, 172 + struct v4l2_subdev_state *sd_state, 173 173 struct v4l2_subdev_mbus_code_enum *code) 174 174 { 175 175 if (VIMC_IS_SRC(code->pad)) { ··· 188 188 } 189 189 190 190 static int vimc_deb_enum_frame_size(struct v4l2_subdev *sd, 191 - struct v4l2_subdev_pad_config *cfg, 191 + struct v4l2_subdev_state *sd_state, 192 192 struct v4l2_subdev_frame_size_enum *fse) 193 193 { 194 194 if (fse->index) ··· 213 213 } 214 214 215 215 static int vimc_deb_get_fmt(struct v4l2_subdev *sd, 216 - struct v4l2_subdev_pad_config *cfg, 216 + struct v4l2_subdev_state *sd_state, 217 217 struct v4l2_subdev_format *fmt) 218 218 { 219 219 struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd); 220 220 221 221 /* Get the current sink format */ 222 222 fmt->format = fmt->which == V4L2_SUBDEV_FORMAT_TRY ? 223 - *v4l2_subdev_get_try_format(sd, cfg, 0) : 223 + *v4l2_subdev_get_try_format(sd, sd_state, 0) : 224 224 vdeb->sink_fmt; 225 225 226 226 /* Set the right code for the source pad */ ··· 251 251 } 252 252 253 253 static int vimc_deb_set_fmt(struct v4l2_subdev *sd, 254 - struct v4l2_subdev_pad_config *cfg, 254 + struct v4l2_subdev_state *sd_state, 255 255 struct v4l2_subdev_format *fmt) 256 256 { 257 257 struct vimc_deb_device *vdeb = v4l2_get_subdevdata(sd); ··· 266 266 sink_fmt = &vdeb->sink_fmt; 267 267 src_code = &vdeb->src_code; 268 268 } else { 269 - sink_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 270 - src_code = &v4l2_subdev_get_try_format(sd, cfg, 1)->code; 269 + sink_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 270 + src_code = &v4l2_subdev_get_try_format(sd, sd_state, 1)->code; 271 271 } 272 272 273 273 /*
+18 -18
drivers/media/test-drivers/vimc/vimc-scaler.c
··· 84 84 } 85 85 86 86 static int vimc_sca_init_cfg(struct v4l2_subdev *sd, 87 - struct v4l2_subdev_pad_config *cfg) 87 + struct v4l2_subdev_state *sd_state) 88 88 { 89 89 struct v4l2_mbus_framefmt *mf; 90 90 struct v4l2_rect *r; 91 91 unsigned int i; 92 92 93 - mf = v4l2_subdev_get_try_format(sd, cfg, 0); 93 + mf = v4l2_subdev_get_try_format(sd, sd_state, 0); 94 94 *mf = sink_fmt_default; 95 95 96 - r = v4l2_subdev_get_try_crop(sd, cfg, 0); 96 + r = v4l2_subdev_get_try_crop(sd, sd_state, 0); 97 97 *r = crop_rect_default; 98 98 99 99 for (i = 1; i < sd->entity.num_pads; i++) { 100 - mf = v4l2_subdev_get_try_format(sd, cfg, i); 100 + mf = v4l2_subdev_get_try_format(sd, sd_state, i); 101 101 *mf = sink_fmt_default; 102 102 mf->width = mf->width * sca_mult; 103 103 mf->height = mf->height * sca_mult; ··· 107 107 } 108 108 109 109 static int vimc_sca_enum_mbus_code(struct v4l2_subdev *sd, 110 - struct v4l2_subdev_pad_config *cfg, 110 + struct v4l2_subdev_state *sd_state, 111 111 struct v4l2_subdev_mbus_code_enum *code) 112 112 { 113 113 u32 mbus_code = vimc_mbus_code_by_index(code->index); ··· 128 128 } 129 129 130 130 static int vimc_sca_enum_frame_size(struct v4l2_subdev *sd, 131 - struct v4l2_subdev_pad_config *cfg, 131 + struct v4l2_subdev_state *sd_state, 132 132 struct v4l2_subdev_frame_size_enum *fse) 133 133 { 134 134 const struct vimc_pix_map *vpix; ··· 156 156 } 157 157 158 158 static int vimc_sca_get_fmt(struct v4l2_subdev *sd, 159 - struct v4l2_subdev_pad_config *cfg, 159 + struct v4l2_subdev_state *sd_state, 160 160 struct v4l2_subdev_format *format) 161 161 { 162 162 struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); ··· 164 164 165 165 /* Get the current sink format */ 166 166 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 167 - format->format = *v4l2_subdev_get_try_format(sd, cfg, 0); 168 - crop_rect = v4l2_subdev_get_try_crop(sd, cfg, 0); 167 + format->format = *v4l2_subdev_get_try_format(sd, sd_state, 0); 168 + crop_rect = v4l2_subdev_get_try_crop(sd, sd_state, 0); 169 169 } else { 170 170 format->format = vsca->sink_fmt; 171 171 crop_rect = &vsca->crop_rect; ··· 201 201 } 202 202 203 203 static int vimc_sca_set_fmt(struct v4l2_subdev *sd, 204 - struct v4l2_subdev_pad_config *cfg, 204 + struct v4l2_subdev_state *sd_state, 205 205 struct v4l2_subdev_format *fmt) 206 206 { 207 207 struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); ··· 216 216 sink_fmt = &vsca->sink_fmt; 217 217 crop_rect = &vsca->crop_rect; 218 218 } else { 219 - sink_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 220 - crop_rect = v4l2_subdev_get_try_crop(sd, cfg, 0); 219 + sink_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 220 + crop_rect = v4l2_subdev_get_try_crop(sd, sd_state, 0); 221 221 } 222 222 223 223 /* ··· 254 254 } 255 255 256 256 static int vimc_sca_get_selection(struct v4l2_subdev *sd, 257 - struct v4l2_subdev_pad_config *cfg, 257 + struct v4l2_subdev_state *sd_state, 258 258 struct v4l2_subdev_selection *sel) 259 259 { 260 260 struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); ··· 268 268 sink_fmt = &vsca->sink_fmt; 269 269 crop_rect = &vsca->crop_rect; 270 270 } else { 271 - sink_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 272 - crop_rect = v4l2_subdev_get_try_crop(sd, cfg, 0); 271 + sink_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 272 + crop_rect = v4l2_subdev_get_try_crop(sd, sd_state, 0); 273 273 } 274 274 275 275 switch (sel->target) { ··· 287 287 } 288 288 289 289 static int vimc_sca_set_selection(struct v4l2_subdev *sd, 290 - struct v4l2_subdev_pad_config *cfg, 290 + struct v4l2_subdev_state *sd_state, 291 291 struct v4l2_subdev_selection *sel) 292 292 { 293 293 struct vimc_sca_device *vsca = v4l2_get_subdevdata(sd); ··· 305 305 crop_rect = &vsca->crop_rect; 306 306 sink_fmt = &vsca->sink_fmt; 307 307 } else { 308 - crop_rect = v4l2_subdev_get_try_crop(sd, cfg, 0); 309 - sink_fmt = v4l2_subdev_get_try_format(sd, cfg, 0); 308 + crop_rect = v4l2_subdev_get_try_crop(sd, sd_state, 0); 309 + sink_fmt = v4l2_subdev_get_try_format(sd, sd_state, 0); 310 310 } 311 311 312 312 switch (sel->target) {
+8 -8
drivers/media/test-drivers/vimc/vimc-sensor.c
··· 42 42 }; 43 43 44 44 static int vimc_sen_init_cfg(struct v4l2_subdev *sd, 45 - struct v4l2_subdev_pad_config *cfg) 45 + struct v4l2_subdev_state *sd_state) 46 46 { 47 47 unsigned int i; 48 48 49 49 for (i = 0; i < sd->entity.num_pads; i++) { 50 50 struct v4l2_mbus_framefmt *mf; 51 51 52 - mf = v4l2_subdev_get_try_format(sd, cfg, i); 52 + mf = v4l2_subdev_get_try_format(sd, sd_state, i); 53 53 *mf = fmt_default; 54 54 } 55 55 ··· 57 57 } 58 58 59 59 static int vimc_sen_enum_mbus_code(struct v4l2_subdev *sd, 60 - struct v4l2_subdev_pad_config *cfg, 60 + struct v4l2_subdev_state *sd_state, 61 61 struct v4l2_subdev_mbus_code_enum *code) 62 62 { 63 63 u32 mbus_code = vimc_mbus_code_by_index(code->index); ··· 71 71 } 72 72 73 73 static int vimc_sen_enum_frame_size(struct v4l2_subdev *sd, 74 - struct v4l2_subdev_pad_config *cfg, 74 + struct v4l2_subdev_state *sd_state, 75 75 struct v4l2_subdev_frame_size_enum *fse) 76 76 { 77 77 const struct vimc_pix_map *vpix; ··· 93 93 } 94 94 95 95 static int vimc_sen_get_fmt(struct v4l2_subdev *sd, 96 - struct v4l2_subdev_pad_config *cfg, 96 + struct v4l2_subdev_state *sd_state, 97 97 struct v4l2_subdev_format *fmt) 98 98 { 99 99 struct vimc_sen_device *vsen = 100 100 container_of(sd, struct vimc_sen_device, sd); 101 101 102 102 fmt->format = fmt->which == V4L2_SUBDEV_FORMAT_TRY ? 103 - *v4l2_subdev_get_try_format(sd, cfg, fmt->pad) : 103 + *v4l2_subdev_get_try_format(sd, sd_state, fmt->pad) : 104 104 vsen->mbus_format; 105 105 106 106 return 0; ··· 146 146 } 147 147 148 148 static int vimc_sen_set_fmt(struct v4l2_subdev *sd, 149 - struct v4l2_subdev_pad_config *cfg, 149 + struct v4l2_subdev_state *sd_state, 150 150 struct v4l2_subdev_format *fmt) 151 151 { 152 152 struct vimc_sen_device *vsen = v4l2_get_subdevdata(sd); ··· 159 159 160 160 mf = &vsen->mbus_format; 161 161 } else { 162 - mf = v4l2_subdev_get_try_format(sd, cfg, fmt->pad); 162 + mf = v4l2_subdev_get_try_format(sd, sd_state, fmt->pad); 163 163 } 164 164 165 165 /* Set the new format */
+1 -1
drivers/media/usb/go7007/s2250-board.c
··· 398 398 } 399 399 400 400 static int s2250_set_fmt(struct v4l2_subdev *sd, 401 - struct v4l2_subdev_pad_config *cfg, 401 + struct v4l2_subdev_state *sd_state, 402 402 struct v4l2_subdev_format *format) 403 403 { 404 404 struct v4l2_mbus_framefmt *fmt = &format->format;
+82 -64
drivers/media/v4l2-core/v4l2-subdev.c
··· 26 26 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 27 27 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd) 28 28 { 29 - if (sd->entity.num_pads) { 30 - fh->pad = v4l2_subdev_alloc_pad_config(sd); 31 - if (fh->pad == NULL) 32 - return -ENOMEM; 33 - } 29 + struct v4l2_subdev_state *state; 30 + 31 + state = v4l2_subdev_alloc_state(sd); 32 + if (IS_ERR(state)) 33 + return PTR_ERR(state); 34 + 35 + fh->state = state; 34 36 35 37 return 0; 36 38 } 37 39 38 40 static void subdev_fh_free(struct v4l2_subdev_fh *fh) 39 41 { 40 - v4l2_subdev_free_pad_config(fh->pad); 41 - fh->pad = NULL; 42 + v4l2_subdev_free_state(fh->state); 43 + fh->state = NULL; 42 44 } 43 45 44 46 static int subdev_open(struct file *file) ··· 148 146 return 0; 149 147 } 150 148 151 - static int check_cfg(u32 which, struct v4l2_subdev_pad_config *cfg) 149 + static int check_state_pads(u32 which, struct v4l2_subdev_state *state) 152 150 { 153 - if (which == V4L2_SUBDEV_FORMAT_TRY && !cfg) 151 + if (which == V4L2_SUBDEV_FORMAT_TRY && (!state || !state->pads)) 154 152 return -EINVAL; 155 153 156 154 return 0; 157 155 } 158 156 159 157 static inline int check_format(struct v4l2_subdev *sd, 160 - struct v4l2_subdev_pad_config *cfg, 158 + struct v4l2_subdev_state *state, 161 159 struct v4l2_subdev_format *format) 162 160 { 163 161 if (!format) 164 162 return -EINVAL; 165 163 166 164 return check_which(format->which) ? : check_pad(sd, format->pad) ? : 167 - check_cfg(format->which, cfg); 165 + check_state_pads(format->which, state); 168 166 } 169 167 170 168 static int call_get_fmt(struct v4l2_subdev *sd, 171 - struct v4l2_subdev_pad_config *cfg, 169 + struct v4l2_subdev_state *state, 172 170 struct v4l2_subdev_format *format) 173 171 { 174 - return check_format(sd, cfg, format) ? : 175 - sd->ops->pad->get_fmt(sd, cfg, format); 172 + return check_format(sd, state, format) ? : 173 + sd->ops->pad->get_fmt(sd, state, format); 176 174 } 177 175 178 176 static int call_set_fmt(struct v4l2_subdev *sd, 179 - struct v4l2_subdev_pad_config *cfg, 177 + struct v4l2_subdev_state *state, 180 178 struct v4l2_subdev_format *format) 181 179 { 182 - return check_format(sd, cfg, format) ? : 183 - sd->ops->pad->set_fmt(sd, cfg, format); 180 + return check_format(sd, state, format) ? : 181 + sd->ops->pad->set_fmt(sd, state, format); 184 182 } 185 183 186 184 static int call_enum_mbus_code(struct v4l2_subdev *sd, 187 - struct v4l2_subdev_pad_config *cfg, 185 + struct v4l2_subdev_state *state, 188 186 struct v4l2_subdev_mbus_code_enum *code) 189 187 { 190 188 if (!code) 191 189 return -EINVAL; 192 190 193 191 return check_which(code->which) ? : check_pad(sd, code->pad) ? : 194 - check_cfg(code->which, cfg) ? : 195 - sd->ops->pad->enum_mbus_code(sd, cfg, code); 192 + check_state_pads(code->which, state) ? : 193 + sd->ops->pad->enum_mbus_code(sd, state, code); 196 194 } 197 195 198 196 static int call_enum_frame_size(struct v4l2_subdev *sd, 199 - struct v4l2_subdev_pad_config *cfg, 197 + struct v4l2_subdev_state *state, 200 198 struct v4l2_subdev_frame_size_enum *fse) 201 199 { 202 200 if (!fse) 203 201 return -EINVAL; 204 202 205 203 return check_which(fse->which) ? : check_pad(sd, fse->pad) ? : 206 - check_cfg(fse->which, cfg) ? : 207 - sd->ops->pad->enum_frame_size(sd, cfg, fse); 204 + check_state_pads(fse->which, state) ? : 205 + sd->ops->pad->enum_frame_size(sd, state, fse); 208 206 } 209 207 210 208 static inline int check_frame_interval(struct v4l2_subdev *sd, ··· 231 229 } 232 230 233 231 static int call_enum_frame_interval(struct v4l2_subdev *sd, 234 - struct v4l2_subdev_pad_config *cfg, 232 + struct v4l2_subdev_state *state, 235 233 struct v4l2_subdev_frame_interval_enum *fie) 236 234 { 237 235 if (!fie) 238 236 return -EINVAL; 239 237 240 238 return check_which(fie->which) ? : check_pad(sd, fie->pad) ? : 241 - check_cfg(fie->which, cfg) ? : 242 - sd->ops->pad->enum_frame_interval(sd, cfg, fie); 239 + check_state_pads(fie->which, state) ? : 240 + sd->ops->pad->enum_frame_interval(sd, state, fie); 243 241 } 244 242 245 243 static inline int check_selection(struct v4l2_subdev *sd, 246 - struct v4l2_subdev_pad_config *cfg, 244 + struct v4l2_subdev_state *state, 247 245 struct v4l2_subdev_selection *sel) 248 246 { 249 247 if (!sel) 250 248 return -EINVAL; 251 249 252 250 return check_which(sel->which) ? : check_pad(sd, sel->pad) ? : 253 - check_cfg(sel->which, cfg); 251 + check_state_pads(sel->which, state); 254 252 } 255 253 256 254 static int call_get_selection(struct v4l2_subdev *sd, 257 - struct v4l2_subdev_pad_config *cfg, 255 + struct v4l2_subdev_state *state, 258 256 struct v4l2_subdev_selection *sel) 259 257 { 260 - return check_selection(sd, cfg, sel) ? : 261 - sd->ops->pad->get_selection(sd, cfg, sel); 258 + return check_selection(sd, state, sel) ? : 259 + sd->ops->pad->get_selection(sd, state, sel); 262 260 } 263 261 264 262 static int call_set_selection(struct v4l2_subdev *sd, 265 - struct v4l2_subdev_pad_config *cfg, 263 + struct v4l2_subdev_state *state, 266 264 struct v4l2_subdev_selection *sel) 267 265 { 268 - return check_selection(sd, cfg, sel) ? : 269 - sd->ops->pad->set_selection(sd, cfg, sel); 266 + return check_selection(sd, state, sel) ? : 267 + sd->ops->pad->set_selection(sd, state, sel); 270 268 } 271 269 272 270 static inline int check_edid(struct v4l2_subdev *sd, ··· 508 506 509 507 memset(format->reserved, 0, sizeof(format->reserved)); 510 508 memset(format->format.reserved, 0, sizeof(format->format.reserved)); 511 - return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format); 509 + return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->state, format); 512 510 } 513 511 514 512 case VIDIOC_SUBDEV_S_FMT: { ··· 519 517 520 518 memset(format->reserved, 0, sizeof(format->reserved)); 521 519 memset(format->format.reserved, 0, sizeof(format->format.reserved)); 522 - return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format); 520 + return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->state, format); 523 521 } 524 522 525 523 case VIDIOC_SUBDEV_G_CROP: { ··· 533 531 sel.target = V4L2_SEL_TGT_CROP; 534 532 535 533 rval = v4l2_subdev_call( 536 - sd, pad, get_selection, subdev_fh->pad, &sel); 534 + sd, pad, get_selection, subdev_fh->state, &sel); 537 535 538 536 crop->rect = sel.r; 539 537 ··· 555 553 sel.r = crop->rect; 556 554 557 555 rval = v4l2_subdev_call( 558 - sd, pad, set_selection, subdev_fh->pad, &sel); 556 + sd, pad, set_selection, subdev_fh->state, &sel); 559 557 560 558 crop->rect = sel.r; 561 559 ··· 566 564 struct v4l2_subdev_mbus_code_enum *code = arg; 567 565 568 566 memset(code->reserved, 0, sizeof(code->reserved)); 569 - return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad, 567 + return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->state, 570 568 code); 571 569 } 572 570 ··· 574 572 struct v4l2_subdev_frame_size_enum *fse = arg; 575 573 576 574 memset(fse->reserved, 0, sizeof(fse->reserved)); 577 - return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad, 575 + return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->state, 578 576 fse); 579 577 } 580 578 ··· 599 597 struct v4l2_subdev_frame_interval_enum *fie = arg; 600 598 601 599 memset(fie->reserved, 0, sizeof(fie->reserved)); 602 - return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad, 600 + return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->state, 603 601 fie); 604 602 } 605 603 ··· 608 606 609 607 memset(sel->reserved, 0, sizeof(sel->reserved)); 610 608 return v4l2_subdev_call( 611 - sd, pad, get_selection, subdev_fh->pad, sel); 609 + sd, pad, get_selection, subdev_fh->state, sel); 612 610 } 613 611 614 612 case VIDIOC_SUBDEV_S_SELECTION: { ··· 619 617 620 618 memset(sel->reserved, 0, sizeof(sel->reserved)); 621 619 return v4l2_subdev_call( 622 - sd, pad, set_selection, subdev_fh->pad, sel); 620 + sd, pad, set_selection, subdev_fh->state, sel); 623 621 } 624 622 625 623 case VIDIOC_G_EDID: { ··· 894 892 } 895 893 EXPORT_SYMBOL_GPL(v4l2_subdev_link_validate); 896 894 897 - struct v4l2_subdev_pad_config * 898 - v4l2_subdev_alloc_pad_config(struct v4l2_subdev *sd) 895 + struct v4l2_subdev_state *v4l2_subdev_alloc_state(struct v4l2_subdev *sd) 899 896 { 900 - struct v4l2_subdev_pad_config *cfg; 897 + struct v4l2_subdev_state *state; 901 898 int ret; 902 899 903 - if (!sd->entity.num_pads) 904 - return NULL; 900 + state = kzalloc(sizeof(*state), GFP_KERNEL); 901 + if (!state) 902 + return ERR_PTR(-ENOMEM); 905 903 906 - cfg = kvmalloc_array(sd->entity.num_pads, sizeof(*cfg), 907 - GFP_KERNEL | __GFP_ZERO); 908 - if (!cfg) 909 - return NULL; 910 - 911 - ret = v4l2_subdev_call(sd, pad, init_cfg, cfg); 912 - if (ret < 0 && ret != -ENOIOCTLCMD) { 913 - kvfree(cfg); 914 - return NULL; 904 + if (sd->entity.num_pads) { 905 + state->pads = kvmalloc_array(sd->entity.num_pads, 906 + sizeof(*state->pads), 907 + GFP_KERNEL | __GFP_ZERO); 908 + if (!state->pads) { 909 + ret = -ENOMEM; 910 + goto err; 911 + } 915 912 } 916 913 917 - return cfg; 918 - } 919 - EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_pad_config); 914 + ret = v4l2_subdev_call(sd, pad, init_cfg, state); 915 + if (ret < 0 && ret != -ENOIOCTLCMD) 916 + goto err; 920 917 921 - void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg) 922 - { 923 - kvfree(cfg); 918 + return state; 919 + 920 + err: 921 + if (state && state->pads) 922 + kvfree(state->pads); 923 + 924 + kfree(state); 925 + 926 + return ERR_PTR(ret); 924 927 } 925 - EXPORT_SYMBOL_GPL(v4l2_subdev_free_pad_config); 928 + EXPORT_SYMBOL_GPL(v4l2_subdev_alloc_state); 929 + 930 + void v4l2_subdev_free_state(struct v4l2_subdev_state *state) 931 + { 932 + if (!state) 933 + return; 934 + 935 + kvfree(state->pads); 936 + kfree(state); 937 + } 938 + EXPORT_SYMBOL_GPL(v4l2_subdev_free_state); 939 + 926 940 #endif /* CONFIG_MEDIA_CONTROLLER */ 927 941 928 942 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
+5 -5
drivers/staging/media/atomisp/i2c/atomisp-gc0310.c
··· 965 965 } 966 966 967 967 static int gc0310_set_fmt(struct v4l2_subdev *sd, 968 - struct v4l2_subdev_pad_config *cfg, 968 + struct v4l2_subdev_state *sd_state, 969 969 struct v4l2_subdev_format *format) 970 970 { 971 971 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 999 999 fmt->code = MEDIA_BUS_FMT_SGRBG8_1X8; 1000 1000 1001 1001 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1002 - cfg->try_fmt = *fmt; 1002 + sd_state->pads->try_fmt = *fmt; 1003 1003 mutex_unlock(&dev->input_lock); 1004 1004 return 0; 1005 1005 } ··· 1032 1032 } 1033 1033 1034 1034 static int gc0310_get_fmt(struct v4l2_subdev *sd, 1035 - struct v4l2_subdev_pad_config *cfg, 1035 + struct v4l2_subdev_state *sd_state, 1036 1036 struct v4l2_subdev_format *format) 1037 1037 { 1038 1038 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 1205 1205 } 1206 1206 1207 1207 static int gc0310_enum_mbus_code(struct v4l2_subdev *sd, 1208 - struct v4l2_subdev_pad_config *cfg, 1208 + struct v4l2_subdev_state *sd_state, 1209 1209 struct v4l2_subdev_mbus_code_enum *code) 1210 1210 { 1211 1211 if (code->index >= MAX_FMTS) ··· 1216 1216 } 1217 1217 1218 1218 static int gc0310_enum_frame_size(struct v4l2_subdev *sd, 1219 - struct v4l2_subdev_pad_config *cfg, 1219 + struct v4l2_subdev_state *sd_state, 1220 1220 struct v4l2_subdev_frame_size_enum *fse) 1221 1221 { 1222 1222 int index = fse->index;
+5 -5
drivers/staging/media/atomisp/i2c/atomisp-gc2235.c
··· 769 769 } 770 770 771 771 static int gc2235_set_fmt(struct v4l2_subdev *sd, 772 - struct v4l2_subdev_pad_config *cfg, 772 + struct v4l2_subdev_state *sd_state, 773 773 struct v4l2_subdev_format *format) 774 774 { 775 775 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 798 798 } 799 799 fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10; 800 800 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 801 - cfg->try_fmt = *fmt; 801 + sd_state->pads->try_fmt = *fmt; 802 802 mutex_unlock(&dev->input_lock); 803 803 return 0; 804 804 } ··· 827 827 } 828 828 829 829 static int gc2235_get_fmt(struct v4l2_subdev *sd, 830 - struct v4l2_subdev_pad_config *cfg, 830 + struct v4l2_subdev_state *sd_state, 831 831 struct v4l2_subdev_format *format) 832 832 { 833 833 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 966 966 } 967 967 968 968 static int gc2235_enum_mbus_code(struct v4l2_subdev *sd, 969 - struct v4l2_subdev_pad_config *cfg, 969 + struct v4l2_subdev_state *sd_state, 970 970 struct v4l2_subdev_mbus_code_enum *code) 971 971 { 972 972 if (code->index >= MAX_FMTS) ··· 977 977 } 978 978 979 979 static int gc2235_enum_frame_size(struct v4l2_subdev *sd, 980 - struct v4l2_subdev_pad_config *cfg, 980 + struct v4l2_subdev_state *sd_state, 981 981 struct v4l2_subdev_frame_size_enum *fse) 982 982 { 983 983 int index = fse->index;
+6 -6
drivers/staging/media/atomisp/i2c/atomisp-mt9m114.c
··· 803 803 } 804 804 805 805 static int mt9m114_get_fmt(struct v4l2_subdev *sd, 806 - struct v4l2_subdev_pad_config *cfg, 806 + struct v4l2_subdev_state *sd_state, 807 807 struct v4l2_subdev_format *format) 808 808 { 809 809 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 824 824 } 825 825 826 826 static int mt9m114_set_fmt(struct v4l2_subdev *sd, 827 - struct v4l2_subdev_pad_config *cfg, 827 + struct v4l2_subdev_state *sd_state, 828 828 struct v4l2_subdev_format *format) 829 829 { 830 830 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 848 848 849 849 mt9m114_try_res(&width, &height); 850 850 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 851 - cfg->try_fmt = *fmt; 851 + sd_state->pads->try_fmt = *fmt; 852 852 return 0; 853 853 } 854 854 res_index = mt9m114_to_res(width, height); ··· 1168 1168 * This function is for touch exposure feature. 1169 1169 */ 1170 1170 static int mt9m114_s_exposure_selection(struct v4l2_subdev *sd, 1171 - struct v4l2_subdev_pad_config *cfg, 1171 + struct v4l2_subdev_state *sd_state, 1172 1172 struct v4l2_subdev_selection *sel) 1173 1173 { 1174 1174 struct i2c_client *client = v4l2_get_subdevdata(sd); ··· 1731 1731 } 1732 1732 1733 1733 static int mt9m114_enum_mbus_code(struct v4l2_subdev *sd, 1734 - struct v4l2_subdev_pad_config *cfg, 1734 + struct v4l2_subdev_state *sd_state, 1735 1735 struct v4l2_subdev_mbus_code_enum *code) 1736 1736 { 1737 1737 if (code->index) ··· 1742 1742 } 1743 1743 1744 1744 static int mt9m114_enum_frame_size(struct v4l2_subdev *sd, 1745 - struct v4l2_subdev_pad_config *cfg, 1745 + struct v4l2_subdev_state *sd_state, 1746 1746 struct v4l2_subdev_frame_size_enum *fse) 1747 1747 { 1748 1748 unsigned int index = fse->index;
+5 -5
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
··· 914 914 } 915 915 916 916 static int ov2680_set_fmt(struct v4l2_subdev *sd, 917 - struct v4l2_subdev_pad_config *cfg, 917 + struct v4l2_subdev_state *sd_state, 918 918 struct v4l2_subdev_format *format) 919 919 { 920 920 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 951 951 } 952 952 fmt->code = MEDIA_BUS_FMT_SBGGR10_1X10; 953 953 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 954 - cfg->try_fmt = *fmt; 954 + sd_state->pads->try_fmt = *fmt; 955 955 mutex_unlock(&dev->input_lock); 956 956 return 0; 957 957 } ··· 1002 1002 } 1003 1003 1004 1004 static int ov2680_get_fmt(struct v4l2_subdev *sd, 1005 - struct v4l2_subdev_pad_config *cfg, 1005 + struct v4l2_subdev_state *sd_state, 1006 1006 struct v4l2_subdev_format *format) 1007 1007 { 1008 1008 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 1161 1161 } 1162 1162 1163 1163 static int ov2680_enum_mbus_code(struct v4l2_subdev *sd, 1164 - struct v4l2_subdev_pad_config *cfg, 1164 + struct v4l2_subdev_state *sd_state, 1165 1165 struct v4l2_subdev_mbus_code_enum *code) 1166 1166 { 1167 1167 if (code->index >= MAX_FMTS) ··· 1172 1172 } 1173 1173 1174 1174 static int ov2680_enum_frame_size(struct v4l2_subdev *sd, 1175 - struct v4l2_subdev_pad_config *cfg, 1175 + struct v4l2_subdev_state *sd_state, 1176 1176 struct v4l2_subdev_frame_size_enum *fse) 1177 1177 { 1178 1178 int index = fse->index;
+5 -5
drivers/staging/media/atomisp/i2c/atomisp-ov2722.c
··· 876 876 } 877 877 878 878 static int ov2722_set_fmt(struct v4l2_subdev *sd, 879 - struct v4l2_subdev_pad_config *cfg, 879 + struct v4l2_subdev_state *sd_state, 880 880 struct v4l2_subdev_format *format) 881 881 { 882 882 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 906 906 } 907 907 fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10; 908 908 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 909 - cfg->try_fmt = *fmt; 909 + sd_state->pads->try_fmt = *fmt; 910 910 mutex_unlock(&dev->input_lock); 911 911 return 0; 912 912 } ··· 961 961 } 962 962 963 963 static int ov2722_get_fmt(struct v4l2_subdev *sd, 964 - struct v4l2_subdev_pad_config *cfg, 964 + struct v4l2_subdev_state *sd_state, 965 965 struct v4l2_subdev_format *format) 966 966 { 967 967 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 1104 1104 } 1105 1105 1106 1106 static int ov2722_enum_mbus_code(struct v4l2_subdev *sd, 1107 - struct v4l2_subdev_pad_config *cfg, 1107 + struct v4l2_subdev_state *sd_state, 1108 1108 struct v4l2_subdev_mbus_code_enum *code) 1109 1109 { 1110 1110 if (code->index >= MAX_FMTS) ··· 1115 1115 } 1116 1116 1117 1117 static int ov2722_enum_frame_size(struct v4l2_subdev *sd, 1118 - struct v4l2_subdev_pad_config *cfg, 1118 + struct v4l2_subdev_state *sd_state, 1119 1119 struct v4l2_subdev_frame_size_enum *fse) 1120 1120 { 1121 1121 int index = fse->index;
+5 -5
drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c
··· 1577 1577 } 1578 1578 1579 1579 static int ov5693_set_fmt(struct v4l2_subdev *sd, 1580 - struct v4l2_subdev_pad_config *cfg, 1580 + struct v4l2_subdev_state *sd_state, 1581 1581 struct v4l2_subdev_format *format) 1582 1582 { 1583 1583 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 1608 1608 1609 1609 fmt->code = MEDIA_BUS_FMT_SBGGR10_1X10; 1610 1610 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 1611 - cfg->try_fmt = *fmt; 1611 + sd_state->pads->try_fmt = *fmt; 1612 1612 mutex_unlock(&dev->input_lock); 1613 1613 return 0; 1614 1614 } ··· 1676 1676 } 1677 1677 1678 1678 static int ov5693_get_fmt(struct v4l2_subdev *sd, 1679 - struct v4l2_subdev_pad_config *cfg, 1679 + struct v4l2_subdev_state *sd_state, 1680 1680 struct v4l2_subdev_format *format) 1681 1681 { 1682 1682 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 1825 1825 } 1826 1826 1827 1827 static int ov5693_enum_mbus_code(struct v4l2_subdev *sd, 1828 - struct v4l2_subdev_pad_config *cfg, 1828 + struct v4l2_subdev_state *sd_state, 1829 1829 struct v4l2_subdev_mbus_code_enum *code) 1830 1830 { 1831 1831 if (code->index >= MAX_FMTS) ··· 1836 1836 } 1837 1837 1838 1838 static int ov5693_enum_frame_size(struct v4l2_subdev *sd, 1839 - struct v4l2_subdev_pad_config *cfg, 1839 + struct v4l2_subdev_state *sd_state, 1840 1840 struct v4l2_subdev_frame_size_enum *fse) 1841 1841 { 1842 1842 int index = fse->index;
+20 -13
drivers/staging/media/atomisp/pci/atomisp_cmd.c
··· 4842 4842 struct atomisp_device *isp = video_get_drvdata(vdev); 4843 4843 struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; 4844 4844 struct v4l2_subdev_pad_config pad_cfg; 4845 + struct v4l2_subdev_state pad_state = { 4846 + .pads = &pad_cfg 4847 + }; 4845 4848 struct v4l2_subdev_format format = { 4846 4849 .which = V4L2_SUBDEV_FORMAT_TRY, 4847 4850 }; ··· 4880 4877 snr_mbus_fmt->width, snr_mbus_fmt->height); 4881 4878 4882 4879 ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, 4883 - pad, set_fmt, &pad_cfg, &format); 4880 + pad, set_fmt, &pad_state, &format); 4884 4881 if (ret) 4885 4882 return ret; 4886 4883 ··· 5255 5252 atomisp_output_fmts[] in atomisp_v4l2.c */ 5256 5253 vf_ffmt.code = V4L2_MBUS_FMT_CUSTOM_YUV420; 5257 5254 5258 - atomisp_subdev_set_selection(&asd->subdev, fh.pad, 5255 + atomisp_subdev_set_selection(&asd->subdev, fh.state, 5259 5256 V4L2_SUBDEV_FORMAT_ACTIVE, 5260 5257 ATOMISP_SUBDEV_PAD_SOURCE_VF, 5261 5258 V4L2_SEL_TGT_COMPOSE, 0, &vf_size); 5262 - atomisp_subdev_set_ffmt(&asd->subdev, fh.pad, 5259 + atomisp_subdev_set_ffmt(&asd->subdev, fh.state, 5263 5260 V4L2_SUBDEV_FORMAT_ACTIVE, 5264 5261 ATOMISP_SUBDEV_PAD_SOURCE_VF, &vf_ffmt); 5265 5262 asd->video_out_vf.sh_fmt = IA_CSS_FRAME_FORMAT_NV12; ··· 5496 5493 struct atomisp_sub_device *asd = atomisp_to_video_pipe(vdev)->asd; 5497 5494 const struct atomisp_format_bridge *format; 5498 5495 struct v4l2_subdev_pad_config pad_cfg; 5496 + struct v4l2_subdev_state pad_state = { 5497 + .pads = &pad_cfg 5498 + }; 5499 5499 struct v4l2_subdev_format vformat = { 5500 5500 .which = V4L2_SUBDEV_FORMAT_TRY, 5501 5501 }; ··· 5537 5531 source_pad == ATOMISP_SUBDEV_PAD_SOURCE_VIDEO) { 5538 5532 vformat.which = V4L2_SUBDEV_FORMAT_TRY; 5539 5533 ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, 5540 - pad, set_fmt, &pad_cfg, &vformat); 5534 + pad, set_fmt, &pad_state, &vformat); 5541 5535 if (ret) 5542 5536 return ret; 5543 5537 if (ffmt->width < req_ffmt->width || ··· 5575 5569 asd->params.video_dis_en = false; 5576 5570 } 5577 5571 5578 - atomisp_subdev_set_ffmt(&asd->subdev, fh.pad, 5572 + atomisp_subdev_set_ffmt(&asd->subdev, fh.state, 5579 5573 V4L2_SUBDEV_FORMAT_ACTIVE, 5580 5574 ATOMISP_SUBDEV_PAD_SINK, ffmt); 5581 5575 ··· 5654 5648 } 5655 5649 5656 5650 atomisp_subdev_set_selection( 5657 - &asd->subdev, fh.pad, 5651 + &asd->subdev, fh.state, 5658 5652 V4L2_SUBDEV_FORMAT_ACTIVE, source_pad, 5659 5653 V4L2_SEL_TGT_COMPOSE, 0, &r); 5660 5654 ··· 5784 5778 ATOMISP_SUBDEV_PAD_SINK); 5785 5779 5786 5780 isp_source_fmt.code = format_bridge->mbus_code; 5787 - atomisp_subdev_set_ffmt(&asd->subdev, fh.pad, 5781 + atomisp_subdev_set_ffmt(&asd->subdev, fh.state, 5788 5782 V4L2_SUBDEV_FORMAT_ACTIVE, 5789 5783 source_pad, &isp_source_fmt); 5790 5784 ··· 5903 5897 isp_sink_crop.height = f->fmt.pix.height; 5904 5898 } 5905 5899 5906 - atomisp_subdev_set_selection(&asd->subdev, fh.pad, 5900 + atomisp_subdev_set_selection(&asd->subdev, fh.state, 5907 5901 V4L2_SUBDEV_FORMAT_ACTIVE, 5908 5902 ATOMISP_SUBDEV_PAD_SINK, 5909 5903 V4L2_SEL_TGT_CROP, 5910 5904 V4L2_SEL_FLAG_KEEP_CONFIG, 5911 5905 &isp_sink_crop); 5912 - atomisp_subdev_set_selection(&asd->subdev, fh.pad, 5906 + atomisp_subdev_set_selection(&asd->subdev, fh.state, 5913 5907 V4L2_SUBDEV_FORMAT_ACTIVE, 5914 5908 source_pad, V4L2_SEL_TGT_COMPOSE, 5915 5909 0, &isp_sink_crop); ··· 5928 5922 f->fmt.pix.height); 5929 5923 } 5930 5924 5931 - atomisp_subdev_set_selection(&asd->subdev, fh.pad, 5925 + atomisp_subdev_set_selection(&asd->subdev, fh.state, 5932 5926 V4L2_SUBDEV_FORMAT_ACTIVE, 5933 5927 source_pad, 5934 5928 V4L2_SEL_TGT_COMPOSE, 0, ··· 5962 5956 f->fmt.pix.width, 5963 5957 ATOM_ISP_STEP_HEIGHT); 5964 5958 } 5965 - atomisp_subdev_set_selection(&asd->subdev, fh.pad, 5959 + atomisp_subdev_set_selection(&asd->subdev, fh.state, 5966 5960 V4L2_SUBDEV_FORMAT_ACTIVE, 5967 5961 ATOMISP_SUBDEV_PAD_SINK, 5968 5962 V4L2_SEL_TGT_CROP, 5969 5963 V4L2_SEL_FLAG_KEEP_CONFIG, 5970 5964 &sink_crop); 5971 5965 } 5972 - atomisp_subdev_set_selection(&asd->subdev, fh.pad, 5966 + atomisp_subdev_set_selection(&asd->subdev, fh.state, 5973 5967 V4L2_SUBDEV_FORMAT_ACTIVE, 5974 5968 source_pad, 5975 5969 V4L2_SEL_TGT_COMPOSE, 0, ··· 6060 6054 ffmt.height = f->fmt.pix.height; 6061 6055 ffmt.code = format_bridge->mbus_code; 6062 6056 6063 - atomisp_subdev_set_ffmt(&asd->subdev, fh.pad, V4L2_SUBDEV_FORMAT_ACTIVE, 6057 + atomisp_subdev_set_ffmt(&asd->subdev, fh.state, 6058 + V4L2_SUBDEV_FORMAT_ACTIVE, 6064 6059 ATOMISP_SUBDEV_PAD_SINK, &ffmt); 6065 6060 6066 6061 return 0;
+16 -12
drivers/staging/media/atomisp/pci/atomisp_csi2.c
··· 25 25 static struct v4l2_mbus_framefmt *__csi2_get_format(struct 26 26 atomisp_mipi_csi2_device 27 27 * csi2, 28 - struct 29 - v4l2_subdev_pad_config *cfg, 28 + struct v4l2_subdev_state *sd_state, 30 29 enum 31 30 v4l2_subdev_format_whence 32 31 which, unsigned int pad) { 33 32 if (which == V4L2_SUBDEV_FORMAT_TRY) 34 - return v4l2_subdev_get_try_format(&csi2->subdev, cfg, pad); 33 + return v4l2_subdev_get_try_format(&csi2->subdev, sd_state, 34 + pad); 35 35 else 36 36 return &csi2->formats[pad]; 37 37 } ··· 44 44 * return -EINVAL or zero on success 45 45 */ 46 46 static int csi2_enum_mbus_code(struct v4l2_subdev *sd, 47 - struct v4l2_subdev_pad_config *cfg, 47 + struct v4l2_subdev_state *sd_state, 48 48 struct v4l2_subdev_mbus_code_enum *code) 49 49 { 50 50 const struct atomisp_in_fmt_conv *ic = atomisp_in_fmt_conv; ··· 70 70 * return -EINVAL or zero on success 71 71 */ 72 72 static int csi2_get_format(struct v4l2_subdev *sd, 73 - struct v4l2_subdev_pad_config *cfg, 73 + struct v4l2_subdev_state *sd_state, 74 74 struct v4l2_subdev_format *fmt) 75 75 { 76 76 struct atomisp_mipi_csi2_device *csi2 = v4l2_get_subdevdata(sd); 77 77 struct v4l2_mbus_framefmt *format; 78 78 79 - format = __csi2_get_format(csi2, cfg, fmt->which, fmt->pad); 79 + format = __csi2_get_format(csi2, sd_state, fmt->which, fmt->pad); 80 80 81 81 fmt->format = *format; 82 82 ··· 84 84 } 85 85 86 86 int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, 87 - struct v4l2_subdev_pad_config *cfg, 87 + struct v4l2_subdev_state *sd_state, 88 88 unsigned int which, uint16_t pad, 89 89 struct v4l2_mbus_framefmt *ffmt) 90 90 { 91 91 struct atomisp_mipi_csi2_device *csi2 = v4l2_get_subdevdata(sd); 92 - struct v4l2_mbus_framefmt *actual_ffmt = __csi2_get_format(csi2, cfg, which, pad); 92 + struct v4l2_mbus_framefmt *actual_ffmt = __csi2_get_format(csi2, 93 + sd_state, 94 + which, pad); 93 95 94 96 if (pad == CSI2_PAD_SINK) { 95 97 const struct atomisp_in_fmt_conv *ic; ··· 112 110 113 111 tmp_ffmt = *ffmt = *actual_ffmt; 114 112 115 - return atomisp_csi2_set_ffmt(sd, cfg, which, CSI2_PAD_SOURCE, 113 + return atomisp_csi2_set_ffmt(sd, sd_state, which, 114 + CSI2_PAD_SOURCE, 116 115 &tmp_ffmt); 117 116 } 118 117 119 118 /* FIXME: DPCM decompression */ 120 - *actual_ffmt = *ffmt = *__csi2_get_format(csi2, cfg, which, CSI2_PAD_SINK); 119 + *actual_ffmt = *ffmt = *__csi2_get_format(csi2, sd_state, which, 120 + CSI2_PAD_SINK); 121 121 122 122 return 0; 123 123 } ··· 133 129 * return -EINVAL or zero on success 134 130 */ 135 131 static int csi2_set_format(struct v4l2_subdev *sd, 136 - struct v4l2_subdev_pad_config *cfg, 132 + struct v4l2_subdev_state *sd_state, 137 133 struct v4l2_subdev_format *fmt) 138 134 { 139 - return atomisp_csi2_set_ffmt(sd, cfg, fmt->which, fmt->pad, 135 + return atomisp_csi2_set_ffmt(sd, sd_state, fmt->which, fmt->pad, 140 136 &fmt->format); 141 137 } 142 138
+1 -1
drivers/staging/media/atomisp/pci/atomisp_csi2.h
··· 44 44 }; 45 45 46 46 int atomisp_csi2_set_ffmt(struct v4l2_subdev *sd, 47 - struct v4l2_subdev_pad_config *cfg, 47 + struct v4l2_subdev_state *sd_state, 48 48 unsigned int which, uint16_t pad, 49 49 struct v4l2_mbus_framefmt *ffmt); 50 50 int atomisp_mipi_csi2_init(struct atomisp_device *isp);
+7 -7
drivers/staging/media/atomisp/pci/atomisp_file.c
··· 80 80 } 81 81 82 82 static int file_input_get_fmt(struct v4l2_subdev *sd, 83 - struct v4l2_subdev_pad_config *cfg, 83 + struct v4l2_subdev_state *sd_state, 84 84 struct v4l2_subdev_format *format) 85 85 { 86 86 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 104 104 } 105 105 106 106 static int file_input_set_fmt(struct v4l2_subdev *sd, 107 - struct v4l2_subdev_pad_config *cfg, 107 + struct v4l2_subdev_state *sd_state, 108 108 struct v4l2_subdev_format *format) 109 109 { 110 110 struct v4l2_mbus_framefmt *fmt = &format->format; 111 111 112 112 if (format->pad) 113 113 return -EINVAL; 114 - file_input_get_fmt(sd, cfg, format); 114 + file_input_get_fmt(sd, sd_state, format); 115 115 if (format->which == V4L2_SUBDEV_FORMAT_TRY) 116 - cfg->try_fmt = *fmt; 116 + sd_state->pads->try_fmt = *fmt; 117 117 return 0; 118 118 } 119 119 ··· 130 130 } 131 131 132 132 static int file_input_enum_mbus_code(struct v4l2_subdev *sd, 133 - struct v4l2_subdev_pad_config *cfg, 133 + struct v4l2_subdev_state *sd_state, 134 134 struct v4l2_subdev_mbus_code_enum *code) 135 135 { 136 136 /*to fake*/ ··· 138 138 } 139 139 140 140 static int file_input_enum_frame_size(struct v4l2_subdev *sd, 141 - struct v4l2_subdev_pad_config *cfg, 141 + struct v4l2_subdev_state *sd_state, 142 142 struct v4l2_subdev_frame_size_enum *fse) 143 143 { 144 144 /*to fake*/ ··· 146 146 } 147 147 148 148 static int file_input_enum_frame_ival(struct v4l2_subdev *sd, 149 - struct v4l2_subdev_pad_config *cfg, 149 + struct v4l2_subdev_state *sd_state, 150 150 struct v4l2_subdev_frame_interval_enum 151 151 *fie) 152 152 {
+3 -3
drivers/staging/media/atomisp/pci/atomisp_fops.c
··· 963 963 if (!isp->sw_contex.file_input && asd->fmt_auto->val) { 964 964 struct v4l2_mbus_framefmt isp_sink_fmt = { 0 }; 965 965 966 - atomisp_subdev_set_ffmt(&asd->subdev, fh.pad, 966 + atomisp_subdev_set_ffmt(&asd->subdev, fh.state, 967 967 V4L2_SUBDEV_FORMAT_ACTIVE, 968 968 ATOMISP_SUBDEV_PAD_SINK, &isp_sink_fmt); 969 969 } ··· 975 975 if (isp->sw_contex.file_input && asd->fmt_auto->val) { 976 976 struct v4l2_mbus_framefmt isp_sink_fmt = { 0 }; 977 977 978 - atomisp_subdev_set_ffmt(&asd->subdev, fh.pad, 978 + atomisp_subdev_set_ffmt(&asd->subdev, fh.state, 979 979 V4L2_SUBDEV_FORMAT_ACTIVE, 980 980 ATOMISP_SUBDEV_PAD_SINK, &isp_sink_fmt); 981 981 } ··· 1016 1016 1017 1017 done: 1018 1018 if (!acc_node) { 1019 - atomisp_subdev_set_selection(&asd->subdev, fh.pad, 1019 + atomisp_subdev_set_selection(&asd->subdev, fh.state, 1020 1020 V4L2_SUBDEV_FORMAT_ACTIVE, 1021 1021 atomisp_subdev_source_pad(vdev), 1022 1022 V4L2_SEL_TGT_COMPOSE, 0,
+35 -29
drivers/staging/media/atomisp/pci/atomisp_subdev.c
··· 213 213 * return -EINVAL or zero on success 214 214 */ 215 215 static int isp_subdev_enum_mbus_code(struct v4l2_subdev *sd, 216 - struct v4l2_subdev_pad_config *cfg, 216 + struct v4l2_subdev_state *sd_state, 217 217 struct v4l2_subdev_mbus_code_enum *code) 218 218 { 219 219 if (code->index >= ARRAY_SIZE(atomisp_in_fmt_conv) - 1) ··· 246 246 } 247 247 248 248 struct v4l2_rect *atomisp_subdev_get_rect(struct v4l2_subdev *sd, 249 - struct v4l2_subdev_pad_config *cfg, 249 + struct v4l2_subdev_state *sd_state, 250 250 u32 which, uint32_t pad, 251 251 uint32_t target) 252 252 { ··· 255 255 if (which == V4L2_SUBDEV_FORMAT_TRY) { 256 256 switch (target) { 257 257 case V4L2_SEL_TGT_CROP: 258 - return v4l2_subdev_get_try_crop(sd, cfg, pad); 258 + return v4l2_subdev_get_try_crop(sd, sd_state, pad); 259 259 case V4L2_SEL_TGT_COMPOSE: 260 - return v4l2_subdev_get_try_compose(sd, cfg, pad); 260 + return v4l2_subdev_get_try_compose(sd, sd_state, pad); 261 261 } 262 262 } 263 263 ··· 273 273 274 274 struct v4l2_mbus_framefmt 275 275 *atomisp_subdev_get_ffmt(struct v4l2_subdev *sd, 276 - struct v4l2_subdev_pad_config *cfg, uint32_t which, 276 + struct v4l2_subdev_state *sd_state, uint32_t which, 277 277 uint32_t pad) 278 278 { 279 279 struct atomisp_sub_device *isp_sd = v4l2_get_subdevdata(sd); 280 280 281 281 if (which == V4L2_SUBDEV_FORMAT_TRY) 282 - return v4l2_subdev_get_try_format(sd, cfg, pad); 282 + return v4l2_subdev_get_try_format(sd, sd_state, pad); 283 283 284 284 return &isp_sd->fmt[pad].fmt; 285 285 } 286 286 287 287 static void isp_get_fmt_rect(struct v4l2_subdev *sd, 288 - struct v4l2_subdev_pad_config *cfg, uint32_t which, 288 + struct v4l2_subdev_state *sd_state, 289 + uint32_t which, 289 290 struct v4l2_mbus_framefmt **ffmt, 290 291 struct v4l2_rect *crop[ATOMISP_SUBDEV_PADS_NUM], 291 292 struct v4l2_rect *comp[ATOMISP_SUBDEV_PADS_NUM]) ··· 294 293 unsigned int i; 295 294 296 295 for (i = 0; i < ATOMISP_SUBDEV_PADS_NUM; i++) { 297 - ffmt[i] = atomisp_subdev_get_ffmt(sd, cfg, which, i); 298 - crop[i] = atomisp_subdev_get_rect(sd, cfg, which, i, 296 + ffmt[i] = atomisp_subdev_get_ffmt(sd, sd_state, which, i); 297 + crop[i] = atomisp_subdev_get_rect(sd, sd_state, which, i, 299 298 V4L2_SEL_TGT_CROP); 300 - comp[i] = atomisp_subdev_get_rect(sd, cfg, which, i, 299 + comp[i] = atomisp_subdev_get_rect(sd, sd_state, which, i, 301 300 V4L2_SEL_TGT_COMPOSE); 302 301 } 303 302 } 304 303 305 304 static void isp_subdev_propagate(struct v4l2_subdev *sd, 306 - struct v4l2_subdev_pad_config *cfg, 305 + struct v4l2_subdev_state *sd_state, 307 306 u32 which, uint32_t pad, uint32_t target, 308 307 uint32_t flags) 309 308 { ··· 314 313 if (flags & V4L2_SEL_FLAG_KEEP_CONFIG) 315 314 return; 316 315 317 - isp_get_fmt_rect(sd, cfg, which, ffmt, crop, comp); 316 + isp_get_fmt_rect(sd, sd_state, which, ffmt, crop, comp); 318 317 319 318 switch (pad) { 320 319 case ATOMISP_SUBDEV_PAD_SINK: { ··· 324 323 r.width = ffmt[pad]->width; 325 324 r.height = ffmt[pad]->height; 326 325 327 - atomisp_subdev_set_selection(sd, cfg, which, pad, 326 + atomisp_subdev_set_selection(sd, sd_state, which, pad, 328 327 target, flags, &r); 329 328 break; 330 329 } ··· 332 331 } 333 332 334 333 static int isp_subdev_get_selection(struct v4l2_subdev *sd, 335 - struct v4l2_subdev_pad_config *cfg, 334 + struct v4l2_subdev_state *sd_state, 336 335 struct v4l2_subdev_selection *sel) 337 336 { 338 337 struct v4l2_rect *rec; ··· 341 340 if (rval) 342 341 return rval; 343 342 344 - rec = atomisp_subdev_get_rect(sd, cfg, sel->which, sel->pad, 343 + rec = atomisp_subdev_get_rect(sd, sd_state, sel->which, sel->pad, 345 344 sel->target); 346 345 if (!rec) 347 346 return -EINVAL; ··· 366 365 } 367 366 368 367 int atomisp_subdev_set_selection(struct v4l2_subdev *sd, 369 - struct v4l2_subdev_pad_config *cfg, 368 + struct v4l2_subdev_state *sd_state, 370 369 u32 which, uint32_t pad, uint32_t target, 371 370 u32 flags, struct v4l2_rect *r) 372 371 { ··· 383 382 384 383 stream_id = atomisp_source_pad_to_stream_id(isp_sd, vdev_pad); 385 384 386 - isp_get_fmt_rect(sd, cfg, which, ffmt, crop, comp); 385 + isp_get_fmt_rect(sd, sd_state, which, ffmt, crop, comp); 387 386 388 387 dev_dbg(isp->dev, 389 388 "sel: pad %s tgt %s l %d t %d w %d h %d which %s f 0x%8.8x\n", ··· 451 450 struct v4l2_rect tmp = *crop[pad]; 452 451 453 452 atomisp_subdev_set_selection( 454 - sd, cfg, which, i, V4L2_SEL_TGT_COMPOSE, 453 + sd, sd_state, which, i, 454 + V4L2_SEL_TGT_COMPOSE, 455 455 flags, &tmp); 456 456 } 457 457 } ··· 553 551 ffmt[pad]->height = comp[pad]->height; 554 552 } 555 553 556 - if (!atomisp_subdev_get_rect(sd, cfg, which, pad, target)) 554 + if (!atomisp_subdev_get_rect(sd, sd_state, which, pad, target)) 557 555 return -EINVAL; 558 - *r = *atomisp_subdev_get_rect(sd, cfg, which, pad, target); 556 + *r = *atomisp_subdev_get_rect(sd, sd_state, which, pad, target); 559 557 560 558 dev_dbg(isp->dev, "sel actual: l %d t %d w %d h %d\n", 561 559 r->left, r->top, r->width, r->height); ··· 564 562 } 565 563 566 564 static int isp_subdev_set_selection(struct v4l2_subdev *sd, 567 - struct v4l2_subdev_pad_config *cfg, 565 + struct v4l2_subdev_state *sd_state, 568 566 struct v4l2_subdev_selection *sel) 569 567 { 570 568 int rval = isp_subdev_validate_rect(sd, sel->pad, sel->target); ··· 572 570 if (rval) 573 571 return rval; 574 572 575 - return atomisp_subdev_set_selection(sd, cfg, sel->which, sel->pad, 573 + return atomisp_subdev_set_selection(sd, sd_state, sel->which, 574 + sel->pad, 576 575 sel->target, sel->flags, &sel->r); 577 576 } 578 577 ··· 612 609 } 613 610 614 611 void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, 615 - struct v4l2_subdev_pad_config *cfg, uint32_t which, 612 + struct v4l2_subdev_state *sd_state, 613 + uint32_t which, 616 614 u32 pad, struct v4l2_mbus_framefmt *ffmt) 617 615 { 618 616 struct atomisp_sub_device *isp_sd = v4l2_get_subdevdata(sd); 619 617 struct atomisp_device *isp = isp_sd->isp; 620 618 struct v4l2_mbus_framefmt *__ffmt = 621 - atomisp_subdev_get_ffmt(sd, cfg, which, pad); 619 + atomisp_subdev_get_ffmt(sd, sd_state, which, pad); 622 620 u16 vdev_pad = atomisp_subdev_source_pad(sd->devnode); 623 621 enum atomisp_input_stream_id stream_id; 624 622 ··· 644 640 645 641 *__ffmt = *ffmt; 646 642 647 - isp_subdev_propagate(sd, cfg, which, pad, 643 + isp_subdev_propagate(sd, sd_state, which, pad, 648 644 V4L2_SEL_TGT_CROP, 0); 649 645 650 646 if (which == V4L2_SUBDEV_FORMAT_ACTIVE) { ··· 683 679 * to the format type. 684 680 */ 685 681 static int isp_subdev_get_format(struct v4l2_subdev *sd, 686 - struct v4l2_subdev_pad_config *cfg, 682 + struct v4l2_subdev_state *sd_state, 687 683 struct v4l2_subdev_format *fmt) 688 684 { 689 - fmt->format = *atomisp_subdev_get_ffmt(sd, cfg, fmt->which, fmt->pad); 685 + fmt->format = *atomisp_subdev_get_ffmt(sd, sd_state, fmt->which, 686 + fmt->pad); 690 687 691 688 return 0; 692 689 } ··· 703 698 * to the format type. 704 699 */ 705 700 static int isp_subdev_set_format(struct v4l2_subdev *sd, 706 - struct v4l2_subdev_pad_config *cfg, 701 + struct v4l2_subdev_state *sd_state, 707 702 struct v4l2_subdev_format *fmt) 708 703 { 709 - atomisp_subdev_set_ffmt(sd, cfg, fmt->which, fmt->pad, &fmt->format); 704 + atomisp_subdev_set_ffmt(sd, sd_state, fmt->which, fmt->pad, 705 + &fmt->format); 710 706 711 707 return 0; 712 708 }
+5 -4
drivers/staging/media/atomisp/pci/atomisp_subdev.h
··· 437 437 /* Get pointer to appropriate format */ 438 438 struct v4l2_mbus_framefmt 439 439 *atomisp_subdev_get_ffmt(struct v4l2_subdev *sd, 440 - struct v4l2_subdev_pad_config *cfg, uint32_t which, 440 + struct v4l2_subdev_state *sd_state, uint32_t which, 441 441 uint32_t pad); 442 442 struct v4l2_rect *atomisp_subdev_get_rect(struct v4l2_subdev *sd, 443 - struct v4l2_subdev_pad_config *cfg, 443 + struct v4l2_subdev_state *sd_state, 444 444 u32 which, uint32_t pad, 445 445 uint32_t target); 446 446 int atomisp_subdev_set_selection(struct v4l2_subdev *sd, 447 - struct v4l2_subdev_pad_config *cfg, 447 + struct v4l2_subdev_state *sd_state, 448 448 u32 which, uint32_t pad, uint32_t target, 449 449 u32 flags, struct v4l2_rect *r); 450 450 /* Actually set the format */ 451 451 void atomisp_subdev_set_ffmt(struct v4l2_subdev *sd, 452 - struct v4l2_subdev_pad_config *cfg, uint32_t which, 452 + struct v4l2_subdev_state *sd_state, 453 + uint32_t which, 453 454 u32 pad, struct v4l2_mbus_framefmt *ffmt); 454 455 455 456 int atomisp_update_run_mode(struct atomisp_sub_device *asd);
+6 -6
drivers/staging/media/atomisp/pci/atomisp_tpg.c
··· 29 29 } 30 30 31 31 static int tpg_get_fmt(struct v4l2_subdev *sd, 32 - struct v4l2_subdev_pad_config *cfg, 32 + struct v4l2_subdev_state *sd_state, 33 33 struct v4l2_subdev_format *format) 34 34 { 35 35 /*to fake*/ ··· 37 37 } 38 38 39 39 static int tpg_set_fmt(struct v4l2_subdev *sd, 40 - struct v4l2_subdev_pad_config *cfg, 40 + struct v4l2_subdev_state *sd_state, 41 41 struct v4l2_subdev_format *format) 42 42 { 43 43 struct v4l2_mbus_framefmt *fmt = &format->format; ··· 47 47 /* only raw8 grbg is supported by TPG */ 48 48 fmt->code = MEDIA_BUS_FMT_SGRBG8_1X8; 49 49 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { 50 - cfg->try_fmt = *fmt; 50 + sd_state->pads->try_fmt = *fmt; 51 51 return 0; 52 52 } 53 53 return 0; ··· 65 65 } 66 66 67 67 static int tpg_enum_mbus_code(struct v4l2_subdev *sd, 68 - struct v4l2_subdev_pad_config *cfg, 68 + struct v4l2_subdev_state *sd_state, 69 69 struct v4l2_subdev_mbus_code_enum *code) 70 70 { 71 71 /*to fake*/ ··· 73 73 } 74 74 75 75 static int tpg_enum_frame_size(struct v4l2_subdev *sd, 76 - struct v4l2_subdev_pad_config *cfg, 76 + struct v4l2_subdev_state *sd_state, 77 77 struct v4l2_subdev_frame_size_enum *fse) 78 78 { 79 79 /*to fake*/ ··· 81 81 } 82 82 83 83 static int tpg_enum_frame_ival(struct v4l2_subdev *sd, 84 - struct v4l2_subdev_pad_config *cfg, 84 + struct v4l2_subdev_state *sd_state, 85 85 struct v4l2_subdev_frame_interval_enum *fie) 86 86 { 87 87 /*to fake*/
+10 -9
drivers/staging/media/imx/imx-ic-prp.c
··· 79 79 } 80 80 81 81 static struct v4l2_mbus_framefmt * 82 - __prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_pad_config *cfg, 82 + __prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_state *sd_state, 83 83 unsigned int pad, enum v4l2_subdev_format_whence which) 84 84 { 85 85 struct imx_ic_priv *ic_priv = priv->ic_priv; 86 86 87 87 if (which == V4L2_SUBDEV_FORMAT_TRY) 88 - return v4l2_subdev_get_try_format(&ic_priv->sd, cfg, pad); 88 + return v4l2_subdev_get_try_format(&ic_priv->sd, sd_state, pad); 89 89 else 90 90 return &priv->format_mbus; 91 91 } ··· 95 95 */ 96 96 97 97 static int prp_enum_mbus_code(struct v4l2_subdev *sd, 98 - struct v4l2_subdev_pad_config *cfg, 98 + struct v4l2_subdev_state *sd_state, 99 99 struct v4l2_subdev_mbus_code_enum *code) 100 100 { 101 101 struct prp_priv *priv = sd_to_priv(sd); ··· 115 115 ret = -EINVAL; 116 116 goto out; 117 117 } 118 - infmt = __prp_get_fmt(priv, cfg, PRP_SINK_PAD, code->which); 118 + infmt = __prp_get_fmt(priv, sd_state, PRP_SINK_PAD, 119 + code->which); 119 120 code->code = infmt->code; 120 121 break; 121 122 default: ··· 128 127 } 129 128 130 129 static int prp_get_fmt(struct v4l2_subdev *sd, 131 - struct v4l2_subdev_pad_config *cfg, 130 + struct v4l2_subdev_state *sd_state, 132 131 struct v4l2_subdev_format *sdformat) 133 132 { 134 133 struct prp_priv *priv = sd_to_priv(sd); ··· 140 139 141 140 mutex_lock(&priv->lock); 142 141 143 - fmt = __prp_get_fmt(priv, cfg, sdformat->pad, sdformat->which); 142 + fmt = __prp_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 144 143 if (!fmt) { 145 144 ret = -EINVAL; 146 145 goto out; ··· 153 152 } 154 153 155 154 static int prp_set_fmt(struct v4l2_subdev *sd, 156 - struct v4l2_subdev_pad_config *cfg, 155 + struct v4l2_subdev_state *sd_state, 157 156 struct v4l2_subdev_format *sdformat) 158 157 { 159 158 struct prp_priv *priv = sd_to_priv(sd); ··· 172 171 goto out; 173 172 } 174 173 175 - infmt = __prp_get_fmt(priv, cfg, PRP_SINK_PAD, sdformat->which); 174 + infmt = __prp_get_fmt(priv, sd_state, PRP_SINK_PAD, sdformat->which); 176 175 177 176 switch (sdformat->pad) { 178 177 case PRP_SINK_PAD: ··· 202 201 203 202 imx_media_try_colorimetry(&sdformat->format, true); 204 203 205 - fmt = __prp_get_fmt(priv, cfg, sdformat->pad, sdformat->which); 204 + fmt = __prp_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 206 205 *fmt = sdformat->format; 207 206 out: 208 207 mutex_unlock(&priv->lock);
+16 -15
drivers/staging/media/imx/imx-ic-prpencvf.c
··· 787 787 } 788 788 789 789 static struct v4l2_mbus_framefmt * 790 - __prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_pad_config *cfg, 790 + __prp_get_fmt(struct prp_priv *priv, struct v4l2_subdev_state *sd_state, 791 791 unsigned int pad, enum v4l2_subdev_format_whence which) 792 792 { 793 793 struct imx_ic_priv *ic_priv = priv->ic_priv; 794 794 795 795 if (which == V4L2_SUBDEV_FORMAT_TRY) 796 - return v4l2_subdev_get_try_format(&ic_priv->sd, cfg, pad); 796 + return v4l2_subdev_get_try_format(&ic_priv->sd, sd_state, pad); 797 797 else 798 798 return &priv->format_mbus[pad]; 799 799 } ··· 841 841 */ 842 842 843 843 static int prp_enum_mbus_code(struct v4l2_subdev *sd, 844 - struct v4l2_subdev_pad_config *cfg, 844 + struct v4l2_subdev_state *sd_state, 845 845 struct v4l2_subdev_mbus_code_enum *code) 846 846 { 847 847 if (code->pad >= PRPENCVF_NUM_PADS) ··· 852 852 } 853 853 854 854 static int prp_get_fmt(struct v4l2_subdev *sd, 855 - struct v4l2_subdev_pad_config *cfg, 855 + struct v4l2_subdev_state *sd_state, 856 856 struct v4l2_subdev_format *sdformat) 857 857 { 858 858 struct prp_priv *priv = sd_to_priv(sd); ··· 864 864 865 865 mutex_lock(&priv->lock); 866 866 867 - fmt = __prp_get_fmt(priv, cfg, sdformat->pad, sdformat->which); 867 + fmt = __prp_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 868 868 if (!fmt) { 869 869 ret = -EINVAL; 870 870 goto out; ··· 877 877 } 878 878 879 879 static void prp_try_fmt(struct prp_priv *priv, 880 - struct v4l2_subdev_pad_config *cfg, 880 + struct v4l2_subdev_state *sd_state, 881 881 struct v4l2_subdev_format *sdformat, 882 882 const struct imx_media_pixfmt **cc) 883 883 { ··· 894 894 sdformat->format.code = (*cc)->codes[0]; 895 895 } 896 896 897 - infmt = __prp_get_fmt(priv, cfg, PRPENCVF_SINK_PAD, sdformat->which); 897 + infmt = __prp_get_fmt(priv, sd_state, PRPENCVF_SINK_PAD, 898 + sdformat->which); 898 899 899 900 if (sdformat->pad == PRPENCVF_SRC_PAD) { 900 901 sdformat->format.field = infmt->field; ··· 921 920 } 922 921 923 922 static int prp_set_fmt(struct v4l2_subdev *sd, 924 - struct v4l2_subdev_pad_config *cfg, 923 + struct v4l2_subdev_state *sd_state, 925 924 struct v4l2_subdev_format *sdformat) 926 925 { 927 926 struct prp_priv *priv = sd_to_priv(sd); ··· 939 938 goto out; 940 939 } 941 940 942 - prp_try_fmt(priv, cfg, sdformat, &cc); 941 + prp_try_fmt(priv, sd_state, sdformat, &cc); 943 942 944 - fmt = __prp_get_fmt(priv, cfg, sdformat->pad, sdformat->which); 943 + fmt = __prp_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 945 944 *fmt = sdformat->format; 946 945 947 946 /* propagate a default format to source pad */ ··· 953 952 format.pad = PRPENCVF_SRC_PAD; 954 953 format.which = sdformat->which; 955 954 format.format = sdformat->format; 956 - prp_try_fmt(priv, cfg, &format, &outcc); 955 + prp_try_fmt(priv, sd_state, &format, &outcc); 957 956 958 - outfmt = __prp_get_fmt(priv, cfg, PRPENCVF_SRC_PAD, 957 + outfmt = __prp_get_fmt(priv, sd_state, PRPENCVF_SRC_PAD, 959 958 sdformat->which); 960 959 *outfmt = format.format; 961 960 if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE) ··· 971 970 } 972 971 973 972 static int prp_enum_frame_size(struct v4l2_subdev *sd, 974 - struct v4l2_subdev_pad_config *cfg, 973 + struct v4l2_subdev_state *sd_state, 975 974 struct v4l2_subdev_frame_size_enum *fse) 976 975 { 977 976 struct prp_priv *priv = sd_to_priv(sd); ··· 989 988 format.format.code = fse->code; 990 989 format.format.width = 1; 991 990 format.format.height = 1; 992 - prp_try_fmt(priv, cfg, &format, &cc); 991 + prp_try_fmt(priv, sd_state, &format, &cc); 993 992 fse->min_width = format.format.width; 994 993 fse->min_height = format.format.height; 995 994 ··· 1001 1000 format.format.code = fse->code; 1002 1001 format.format.width = -1; 1003 1002 format.format.height = -1; 1004 - prp_try_fmt(priv, cfg, &format, &cc); 1003 + prp_try_fmt(priv, sd_state, &format, &cc); 1005 1004 fse->max_width = format.format.width; 1006 1005 fse->max_height = format.format.height; 1007 1006 out:
+43 -39
drivers/staging/media/imx/imx-media-csi.c
··· 1139 1139 } 1140 1140 1141 1141 static struct v4l2_mbus_framefmt * 1142 - __csi_get_fmt(struct csi_priv *priv, struct v4l2_subdev_pad_config *cfg, 1142 + __csi_get_fmt(struct csi_priv *priv, struct v4l2_subdev_state *sd_state, 1143 1143 unsigned int pad, enum v4l2_subdev_format_whence which) 1144 1144 { 1145 1145 if (which == V4L2_SUBDEV_FORMAT_TRY) 1146 - return v4l2_subdev_get_try_format(&priv->sd, cfg, pad); 1146 + return v4l2_subdev_get_try_format(&priv->sd, sd_state, pad); 1147 1147 else 1148 1148 return &priv->format_mbus[pad]; 1149 1149 } 1150 1150 1151 1151 static struct v4l2_rect * 1152 - __csi_get_crop(struct csi_priv *priv, struct v4l2_subdev_pad_config *cfg, 1152 + __csi_get_crop(struct csi_priv *priv, struct v4l2_subdev_state *sd_state, 1153 1153 enum v4l2_subdev_format_whence which) 1154 1154 { 1155 1155 if (which == V4L2_SUBDEV_FORMAT_TRY) 1156 - return v4l2_subdev_get_try_crop(&priv->sd, cfg, CSI_SINK_PAD); 1156 + return v4l2_subdev_get_try_crop(&priv->sd, sd_state, 1157 + CSI_SINK_PAD); 1157 1158 else 1158 1159 return &priv->crop; 1159 1160 } 1160 1161 1161 1162 static struct v4l2_rect * 1162 - __csi_get_compose(struct csi_priv *priv, struct v4l2_subdev_pad_config *cfg, 1163 + __csi_get_compose(struct csi_priv *priv, struct v4l2_subdev_state *sd_state, 1163 1164 enum v4l2_subdev_format_whence which) 1164 1165 { 1165 1166 if (which == V4L2_SUBDEV_FORMAT_TRY) 1166 - return v4l2_subdev_get_try_compose(&priv->sd, cfg, 1167 + return v4l2_subdev_get_try_compose(&priv->sd, sd_state, 1167 1168 CSI_SINK_PAD); 1168 1169 else 1169 1170 return &priv->compose; ··· 1172 1171 1173 1172 static void csi_try_crop(struct csi_priv *priv, 1174 1173 struct v4l2_rect *crop, 1175 - struct v4l2_subdev_pad_config *cfg, 1174 + struct v4l2_subdev_state *sd_state, 1176 1175 struct v4l2_mbus_framefmt *infmt, 1177 1176 struct v4l2_fwnode_endpoint *upstream_ep) 1178 1177 { ··· 1211 1210 } 1212 1211 1213 1212 static int csi_enum_mbus_code(struct v4l2_subdev *sd, 1214 - struct v4l2_subdev_pad_config *cfg, 1213 + struct v4l2_subdev_state *sd_state, 1215 1214 struct v4l2_subdev_mbus_code_enum *code) 1216 1215 { 1217 1216 struct csi_priv *priv = v4l2_get_subdevdata(sd); ··· 1222 1221 1223 1222 mutex_lock(&priv->lock); 1224 1223 1225 - infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD, code->which); 1224 + infmt = __csi_get_fmt(priv, sd_state, CSI_SINK_PAD, code->which); 1226 1225 incc = imx_media_find_mbus_format(infmt->code, PIXFMT_SEL_ANY); 1227 1226 1228 1227 switch (code->pad) { ··· 1264 1263 } 1265 1264 1266 1265 static int csi_enum_frame_size(struct v4l2_subdev *sd, 1267 - struct v4l2_subdev_pad_config *cfg, 1266 + struct v4l2_subdev_state *sd_state, 1268 1267 struct v4l2_subdev_frame_size_enum *fse) 1269 1268 { 1270 1269 struct csi_priv *priv = v4l2_get_subdevdata(sd); ··· 1283 1282 fse->min_height = MIN_H; 1284 1283 fse->max_height = MAX_H; 1285 1284 } else { 1286 - crop = __csi_get_crop(priv, cfg, fse->which); 1285 + crop = __csi_get_crop(priv, sd_state, fse->which); 1287 1286 1288 1287 fse->min_width = fse->index & 1 ? 1289 1288 crop->width / 2 : crop->width; ··· 1298 1297 } 1299 1298 1300 1299 static int csi_enum_frame_interval(struct v4l2_subdev *sd, 1301 - struct v4l2_subdev_pad_config *cfg, 1300 + struct v4l2_subdev_state *sd_state, 1302 1301 struct v4l2_subdev_frame_interval_enum *fie) 1303 1302 { 1304 1303 struct csi_priv *priv = v4l2_get_subdevdata(sd); ··· 1314 1313 mutex_lock(&priv->lock); 1315 1314 1316 1315 input_fi = &priv->frame_interval[CSI_SINK_PAD]; 1317 - crop = __csi_get_crop(priv, cfg, fie->which); 1316 + crop = __csi_get_crop(priv, sd_state, fie->which); 1318 1317 1319 1318 if ((fie->width != crop->width && fie->width != crop->width / 2) || 1320 1319 (fie->height != crop->height && fie->height != crop->height / 2)) { ··· 1334 1333 } 1335 1334 1336 1335 static int csi_get_fmt(struct v4l2_subdev *sd, 1337 - struct v4l2_subdev_pad_config *cfg, 1336 + struct v4l2_subdev_state *sd_state, 1338 1337 struct v4l2_subdev_format *sdformat) 1339 1338 { 1340 1339 struct csi_priv *priv = v4l2_get_subdevdata(sd); ··· 1346 1345 1347 1346 mutex_lock(&priv->lock); 1348 1347 1349 - fmt = __csi_get_fmt(priv, cfg, sdformat->pad, sdformat->which); 1348 + fmt = __csi_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 1350 1349 if (!fmt) { 1351 1350 ret = -EINVAL; 1352 1351 goto out; ··· 1359 1358 } 1360 1359 1361 1360 static void csi_try_field(struct csi_priv *priv, 1362 - struct v4l2_subdev_pad_config *cfg, 1361 + struct v4l2_subdev_state *sd_state, 1363 1362 struct v4l2_subdev_format *sdformat) 1364 1363 { 1365 1364 struct v4l2_mbus_framefmt *infmt = 1366 - __csi_get_fmt(priv, cfg, CSI_SINK_PAD, sdformat->which); 1365 + __csi_get_fmt(priv, sd_state, CSI_SINK_PAD, sdformat->which); 1367 1366 1368 1367 /* 1369 1368 * no restrictions on sink pad field type except must ··· 1409 1408 1410 1409 static void csi_try_fmt(struct csi_priv *priv, 1411 1410 struct v4l2_fwnode_endpoint *upstream_ep, 1412 - struct v4l2_subdev_pad_config *cfg, 1411 + struct v4l2_subdev_state *sd_state, 1413 1412 struct v4l2_subdev_format *sdformat, 1414 1413 struct v4l2_rect *crop, 1415 1414 struct v4l2_rect *compose, ··· 1419 1418 struct v4l2_mbus_framefmt *infmt; 1420 1419 u32 code; 1421 1420 1422 - infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD, sdformat->which); 1421 + infmt = __csi_get_fmt(priv, sd_state, CSI_SINK_PAD, sdformat->which); 1423 1422 1424 1423 switch (sdformat->pad) { 1425 1424 case CSI_SRC_PAD_DIRECT: ··· 1446 1445 } 1447 1446 } 1448 1447 1449 - csi_try_field(priv, cfg, sdformat); 1448 + csi_try_field(priv, sd_state, sdformat); 1450 1449 1451 1450 /* propagate colorimetry from sink */ 1452 1451 sdformat->format.colorspace = infmt->colorspace; ··· 1470 1469 sdformat->format.code = (*cc)->codes[0]; 1471 1470 } 1472 1471 1473 - csi_try_field(priv, cfg, sdformat); 1472 + csi_try_field(priv, sd_state, sdformat); 1474 1473 1475 1474 /* Reset crop and compose rectangles */ 1476 1475 crop->left = 0; ··· 1479 1478 crop->height = sdformat->format.height; 1480 1479 if (sdformat->format.field == V4L2_FIELD_ALTERNATE) 1481 1480 crop->height *= 2; 1482 - csi_try_crop(priv, crop, cfg, &sdformat->format, upstream_ep); 1481 + csi_try_crop(priv, crop, sd_state, &sdformat->format, 1482 + upstream_ep); 1483 1483 compose->left = 0; 1484 1484 compose->top = 0; 1485 1485 compose->width = crop->width; ··· 1494 1492 } 1495 1493 1496 1494 static int csi_set_fmt(struct v4l2_subdev *sd, 1497 - struct v4l2_subdev_pad_config *cfg, 1495 + struct v4l2_subdev_state *sd_state, 1498 1496 struct v4l2_subdev_format *sdformat) 1499 1497 { 1500 1498 struct csi_priv *priv = v4l2_get_subdevdata(sd); ··· 1520 1518 goto out; 1521 1519 } 1522 1520 1523 - crop = __csi_get_crop(priv, cfg, sdformat->which); 1524 - compose = __csi_get_compose(priv, cfg, sdformat->which); 1521 + crop = __csi_get_crop(priv, sd_state, sdformat->which); 1522 + compose = __csi_get_compose(priv, sd_state, sdformat->which); 1525 1523 1526 - csi_try_fmt(priv, &upstream_ep, cfg, sdformat, crop, compose, &cc); 1524 + csi_try_fmt(priv, &upstream_ep, sd_state, sdformat, crop, compose, 1525 + &cc); 1527 1526 1528 - fmt = __csi_get_fmt(priv, cfg, sdformat->pad, sdformat->which); 1527 + fmt = __csi_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 1529 1528 *fmt = sdformat->format; 1530 1529 1531 1530 if (sdformat->pad == CSI_SINK_PAD) { ··· 1541 1538 format.pad = pad; 1542 1539 format.which = sdformat->which; 1543 1540 format.format = sdformat->format; 1544 - csi_try_fmt(priv, &upstream_ep, cfg, &format, 1541 + csi_try_fmt(priv, &upstream_ep, sd_state, &format, 1545 1542 NULL, compose, &outcc); 1546 1543 1547 - outfmt = __csi_get_fmt(priv, cfg, pad, sdformat->which); 1544 + outfmt = __csi_get_fmt(priv, sd_state, pad, 1545 + sdformat->which); 1548 1546 *outfmt = format.format; 1549 1547 1550 1548 if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE) ··· 1562 1558 } 1563 1559 1564 1560 static int csi_get_selection(struct v4l2_subdev *sd, 1565 - struct v4l2_subdev_pad_config *cfg, 1561 + struct v4l2_subdev_state *sd_state, 1566 1562 struct v4l2_subdev_selection *sel) 1567 1563 { 1568 1564 struct csi_priv *priv = v4l2_get_subdevdata(sd); ··· 1575 1571 1576 1572 mutex_lock(&priv->lock); 1577 1573 1578 - infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD, sel->which); 1579 - crop = __csi_get_crop(priv, cfg, sel->which); 1580 - compose = __csi_get_compose(priv, cfg, sel->which); 1574 + infmt = __csi_get_fmt(priv, sd_state, CSI_SINK_PAD, sel->which); 1575 + crop = __csi_get_crop(priv, sd_state, sel->which); 1576 + compose = __csi_get_compose(priv, sd_state, sel->which); 1581 1577 1582 1578 switch (sel->target) { 1583 1579 case V4L2_SEL_TGT_CROP_BOUNDS: ··· 1626 1622 } 1627 1623 1628 1624 static int csi_set_selection(struct v4l2_subdev *sd, 1629 - struct v4l2_subdev_pad_config *cfg, 1625 + struct v4l2_subdev_state *sd_state, 1630 1626 struct v4l2_subdev_selection *sel) 1631 1627 { 1632 1628 struct csi_priv *priv = v4l2_get_subdevdata(sd); ··· 1651 1647 goto out; 1652 1648 } 1653 1649 1654 - infmt = __csi_get_fmt(priv, cfg, CSI_SINK_PAD, sel->which); 1655 - crop = __csi_get_crop(priv, cfg, sel->which); 1656 - compose = __csi_get_compose(priv, cfg, sel->which); 1650 + infmt = __csi_get_fmt(priv, sd_state, CSI_SINK_PAD, sel->which); 1651 + crop = __csi_get_crop(priv, sd_state, sel->which); 1652 + compose = __csi_get_compose(priv, sd_state, sel->which); 1657 1653 1658 1654 switch (sel->target) { 1659 1655 case V4L2_SEL_TGT_CROP: ··· 1669 1665 goto out; 1670 1666 } 1671 1667 1672 - csi_try_crop(priv, &sel->r, cfg, infmt, &upstream_ep); 1668 + csi_try_crop(priv, &sel->r, sd_state, infmt, &upstream_ep); 1673 1669 1674 1670 *crop = sel->r; 1675 1671 ··· 1710 1706 for (pad = CSI_SINK_PAD + 1; pad < CSI_NUM_PADS; pad++) { 1711 1707 struct v4l2_mbus_framefmt *outfmt; 1712 1708 1713 - outfmt = __csi_get_fmt(priv, cfg, pad, sel->which); 1709 + outfmt = __csi_get_fmt(priv, sd_state, pad, sel->which); 1714 1710 outfmt->width = compose->width; 1715 1711 outfmt->height = compose->height; 1716 1712 }
+2 -2
drivers/staging/media/imx/imx-media-utils.c
··· 429 429 * of a subdev. Can be used as the .init_cfg pad operation. 430 430 */ 431 431 int imx_media_init_cfg(struct v4l2_subdev *sd, 432 - struct v4l2_subdev_pad_config *cfg) 432 + struct v4l2_subdev_state *sd_state) 433 433 { 434 434 struct v4l2_mbus_framefmt *mf_try; 435 435 struct v4l2_subdev_format format; ··· 445 445 if (ret) 446 446 continue; 447 447 448 - mf_try = v4l2_subdev_get_try_format(sd, cfg, pad); 448 + mf_try = v4l2_subdev_get_try_format(sd, sd_state, pad); 449 449 *mf_try = format.format; 450 450 } 451 451
+12 -12
drivers/staging/media/imx/imx-media-vdic.c
··· 532 532 } 533 533 534 534 static struct v4l2_mbus_framefmt * 535 - __vdic_get_fmt(struct vdic_priv *priv, struct v4l2_subdev_pad_config *cfg, 535 + __vdic_get_fmt(struct vdic_priv *priv, struct v4l2_subdev_state *sd_state, 536 536 unsigned int pad, enum v4l2_subdev_format_whence which) 537 537 { 538 538 if (which == V4L2_SUBDEV_FORMAT_TRY) 539 - return v4l2_subdev_get_try_format(&priv->sd, cfg, pad); 539 + return v4l2_subdev_get_try_format(&priv->sd, sd_state, pad); 540 540 else 541 541 return &priv->format_mbus[pad]; 542 542 } 543 543 544 544 static int vdic_enum_mbus_code(struct v4l2_subdev *sd, 545 - struct v4l2_subdev_pad_config *cfg, 545 + struct v4l2_subdev_state *sd_state, 546 546 struct v4l2_subdev_mbus_code_enum *code) 547 547 { 548 548 if (code->pad >= VDIC_NUM_PADS) ··· 553 553 } 554 554 555 555 static int vdic_get_fmt(struct v4l2_subdev *sd, 556 - struct v4l2_subdev_pad_config *cfg, 556 + struct v4l2_subdev_state *sd_state, 557 557 struct v4l2_subdev_format *sdformat) 558 558 { 559 559 struct vdic_priv *priv = v4l2_get_subdevdata(sd); ··· 565 565 566 566 mutex_lock(&priv->lock); 567 567 568 - fmt = __vdic_get_fmt(priv, cfg, sdformat->pad, sdformat->which); 568 + fmt = __vdic_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 569 569 if (!fmt) { 570 570 ret = -EINVAL; 571 571 goto out; ··· 578 578 } 579 579 580 580 static void vdic_try_fmt(struct vdic_priv *priv, 581 - struct v4l2_subdev_pad_config *cfg, 581 + struct v4l2_subdev_state *sd_state, 582 582 struct v4l2_subdev_format *sdformat, 583 583 const struct imx_media_pixfmt **cc) 584 584 { ··· 594 594 sdformat->format.code = (*cc)->codes[0]; 595 595 } 596 596 597 - infmt = __vdic_get_fmt(priv, cfg, priv->active_input_pad, 597 + infmt = __vdic_get_fmt(priv, sd_state, priv->active_input_pad, 598 598 sdformat->which); 599 599 600 600 switch (sdformat->pad) { ··· 620 620 } 621 621 622 622 static int vdic_set_fmt(struct v4l2_subdev *sd, 623 - struct v4l2_subdev_pad_config *cfg, 623 + struct v4l2_subdev_state *sd_state, 624 624 struct v4l2_subdev_format *sdformat) 625 625 { 626 626 struct vdic_priv *priv = v4l2_get_subdevdata(sd); ··· 638 638 goto out; 639 639 } 640 640 641 - vdic_try_fmt(priv, cfg, sdformat, &cc); 641 + vdic_try_fmt(priv, sd_state, sdformat, &cc); 642 642 643 - fmt = __vdic_get_fmt(priv, cfg, sdformat->pad, sdformat->which); 643 + fmt = __vdic_get_fmt(priv, sd_state, sdformat->pad, sdformat->which); 644 644 *fmt = sdformat->format; 645 645 646 646 /* propagate format to source pad */ ··· 653 653 format.pad = VDIC_SRC_PAD_DIRECT; 654 654 format.which = sdformat->which; 655 655 format.format = sdformat->format; 656 - vdic_try_fmt(priv, cfg, &format, &outcc); 656 + vdic_try_fmt(priv, sd_state, &format, &outcc); 657 657 658 - outfmt = __vdic_get_fmt(priv, cfg, VDIC_SRC_PAD_DIRECT, 658 + outfmt = __vdic_get_fmt(priv, sd_state, VDIC_SRC_PAD_DIRECT, 659 659 sdformat->which); 660 660 *outfmt = format.format; 661 661 if (sdformat->which == V4L2_SUBDEV_FORMAT_ACTIVE)
+1 -1
drivers/staging/media/imx/imx-media.h
··· 193 193 u32 width, u32 height, u32 code, u32 field, 194 194 const struct imx_media_pixfmt **cc); 195 195 int imx_media_init_cfg(struct v4l2_subdev *sd, 196 - struct v4l2_subdev_pad_config *cfg); 196 + struct v4l2_subdev_state *sd_state); 197 197 void imx_media_try_colorimetry(struct v4l2_mbus_framefmt *tryfmt, 198 198 bool ic_route); 199 199 int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
+6 -6
drivers/staging/media/imx/imx6-mipi-csi2.c
··· 508 508 } 509 509 510 510 static struct v4l2_mbus_framefmt * 511 - __csi2_get_fmt(struct csi2_dev *csi2, struct v4l2_subdev_pad_config *cfg, 511 + __csi2_get_fmt(struct csi2_dev *csi2, struct v4l2_subdev_state *sd_state, 512 512 unsigned int pad, enum v4l2_subdev_format_whence which) 513 513 { 514 514 if (which == V4L2_SUBDEV_FORMAT_TRY) 515 - return v4l2_subdev_get_try_format(&csi2->sd, cfg, pad); 515 + return v4l2_subdev_get_try_format(&csi2->sd, sd_state, pad); 516 516 else 517 517 return &csi2->format_mbus; 518 518 } 519 519 520 520 static int csi2_get_fmt(struct v4l2_subdev *sd, 521 - struct v4l2_subdev_pad_config *cfg, 521 + struct v4l2_subdev_state *sd_state, 522 522 struct v4l2_subdev_format *sdformat) 523 523 { 524 524 struct csi2_dev *csi2 = sd_to_dev(sd); ··· 526 526 527 527 mutex_lock(&csi2->lock); 528 528 529 - fmt = __csi2_get_fmt(csi2, cfg, sdformat->pad, sdformat->which); 529 + fmt = __csi2_get_fmt(csi2, sd_state, sdformat->pad, sdformat->which); 530 530 531 531 sdformat->format = *fmt; 532 532 ··· 536 536 } 537 537 538 538 static int csi2_set_fmt(struct v4l2_subdev *sd, 539 - struct v4l2_subdev_pad_config *cfg, 539 + struct v4l2_subdev_state *sd_state, 540 540 struct v4l2_subdev_format *sdformat) 541 541 { 542 542 struct csi2_dev *csi2 = sd_to_dev(sd); ··· 557 557 if (sdformat->pad != CSI2_SINK_PAD) 558 558 sdformat->format = csi2->format_mbus; 559 559 560 - fmt = __csi2_get_fmt(csi2, cfg, sdformat->pad, sdformat->which); 560 + fmt = __csi2_get_fmt(csi2, sd_state, sdformat->pad, sdformat->which); 561 561 562 562 *fmt = sdformat->format; 563 563 out:
+18 -15
drivers/staging/media/imx/imx7-media-csi.c
··· 724 724 } 725 725 726 726 static int imx7_csi_init_cfg(struct v4l2_subdev *sd, 727 - struct v4l2_subdev_pad_config *cfg) 727 + struct v4l2_subdev_state *sd_state) 728 728 { 729 729 struct imx7_csi *csi = v4l2_get_subdevdata(sd); 730 730 struct v4l2_mbus_framefmt *mf; ··· 732 732 int i; 733 733 734 734 for (i = 0; i < IMX7_CSI_PADS_NUM; i++) { 735 - mf = v4l2_subdev_get_try_format(sd, cfg, i); 735 + mf = v4l2_subdev_get_try_format(sd, sd_state, i); 736 736 737 737 ret = imx_media_init_mbus_fmt(mf, 800, 600, 0, V4L2_FIELD_NONE, 738 738 &csi->cc[i]); ··· 745 745 746 746 static struct v4l2_mbus_framefmt * 747 747 imx7_csi_get_format(struct imx7_csi *csi, 748 - struct v4l2_subdev_pad_config *cfg, 748 + struct v4l2_subdev_state *sd_state, 749 749 unsigned int pad, 750 750 enum v4l2_subdev_format_whence which) 751 751 { 752 752 if (which == V4L2_SUBDEV_FORMAT_TRY) 753 - return v4l2_subdev_get_try_format(&csi->sd, cfg, pad); 753 + return v4l2_subdev_get_try_format(&csi->sd, sd_state, pad); 754 754 755 755 return &csi->format_mbus[pad]; 756 756 } 757 757 758 758 static int imx7_csi_enum_mbus_code(struct v4l2_subdev *sd, 759 - struct v4l2_subdev_pad_config *cfg, 759 + struct v4l2_subdev_state *sd_state, 760 760 struct v4l2_subdev_mbus_code_enum *code) 761 761 { 762 762 struct imx7_csi *csi = v4l2_get_subdevdata(sd); ··· 765 765 766 766 mutex_lock(&csi->lock); 767 767 768 - in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK, code->which); 768 + in_fmt = imx7_csi_get_format(csi, sd_state, IMX7_CSI_PAD_SINK, 769 + code->which); 769 770 770 771 switch (code->pad) { 771 772 case IMX7_CSI_PAD_SINK: ··· 792 791 } 793 792 794 793 static int imx7_csi_get_fmt(struct v4l2_subdev *sd, 795 - struct v4l2_subdev_pad_config *cfg, 794 + struct v4l2_subdev_state *sd_state, 796 795 struct v4l2_subdev_format *sdformat) 797 796 { 798 797 struct imx7_csi *csi = v4l2_get_subdevdata(sd); ··· 801 800 802 801 mutex_lock(&csi->lock); 803 802 804 - fmt = imx7_csi_get_format(csi, cfg, sdformat->pad, sdformat->which); 803 + fmt = imx7_csi_get_format(csi, sd_state, sdformat->pad, 804 + sdformat->which); 805 805 if (!fmt) { 806 806 ret = -EINVAL; 807 807 goto out_unlock; ··· 817 815 } 818 816 819 817 static int imx7_csi_try_fmt(struct imx7_csi *csi, 820 - struct v4l2_subdev_pad_config *cfg, 818 + struct v4l2_subdev_state *sd_state, 821 819 struct v4l2_subdev_format *sdformat, 822 820 const struct imx_media_pixfmt **cc) 823 821 { ··· 825 823 struct v4l2_mbus_framefmt *in_fmt; 826 824 u32 code; 827 825 828 - in_fmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SINK, 826 + in_fmt = imx7_csi_get_format(csi, sd_state, IMX7_CSI_PAD_SINK, 829 827 sdformat->which); 830 828 if (!in_fmt) 831 829 return -EINVAL; ··· 870 868 } 871 869 872 870 static int imx7_csi_set_fmt(struct v4l2_subdev *sd, 873 - struct v4l2_subdev_pad_config *cfg, 871 + struct v4l2_subdev_state *sd_state, 874 872 struct v4l2_subdev_format *sdformat) 875 873 { 876 874 struct imx7_csi *csi = v4l2_get_subdevdata(sd); ··· 891 889 goto out_unlock; 892 890 } 893 891 894 - ret = imx7_csi_try_fmt(csi, cfg, sdformat, &cc); 892 + ret = imx7_csi_try_fmt(csi, sd_state, sdformat, &cc); 895 893 if (ret < 0) 896 894 goto out_unlock; 897 895 898 - fmt = imx7_csi_get_format(csi, cfg, sdformat->pad, sdformat->which); 896 + fmt = imx7_csi_get_format(csi, sd_state, sdformat->pad, 897 + sdformat->which); 899 898 if (!fmt) { 900 899 ret = -EINVAL; 901 900 goto out_unlock; ··· 909 906 format.pad = IMX7_CSI_PAD_SRC; 910 907 format.which = sdformat->which; 911 908 format.format = sdformat->format; 912 - if (imx7_csi_try_fmt(csi, cfg, &format, &outcc)) { 909 + if (imx7_csi_try_fmt(csi, sd_state, &format, &outcc)) { 913 910 ret = -EINVAL; 914 911 goto out_unlock; 915 912 } 916 - outfmt = imx7_csi_get_format(csi, cfg, IMX7_CSI_PAD_SRC, 913 + outfmt = imx7_csi_get_format(csi, sd_state, IMX7_CSI_PAD_SRC, 917 914 sdformat->which); 918 915 *outfmt = format.format; 919 916
+19 -15
drivers/staging/media/imx/imx7-mipi-csis.c
··· 880 880 881 881 static struct v4l2_mbus_framefmt * 882 882 mipi_csis_get_format(struct csi_state *state, 883 - struct v4l2_subdev_pad_config *cfg, 883 + struct v4l2_subdev_state *sd_state, 884 884 enum v4l2_subdev_format_whence which, 885 885 unsigned int pad) 886 886 { 887 887 if (which == V4L2_SUBDEV_FORMAT_TRY) 888 - return v4l2_subdev_get_try_format(&state->sd, cfg, pad); 888 + return v4l2_subdev_get_try_format(&state->sd, sd_state, pad); 889 889 890 890 return &state->format_mbus; 891 891 } 892 892 893 893 static int mipi_csis_init_cfg(struct v4l2_subdev *sd, 894 - struct v4l2_subdev_pad_config *cfg) 894 + struct v4l2_subdev_state *sd_state) 895 895 { 896 896 struct csi_state *state = mipi_sd_to_csis_state(sd); 897 897 struct v4l2_mbus_framefmt *fmt_sink; 898 898 struct v4l2_mbus_framefmt *fmt_source; 899 899 enum v4l2_subdev_format_whence which; 900 900 901 - which = cfg ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 902 - fmt_sink = mipi_csis_get_format(state, cfg, which, CSIS_PAD_SINK); 901 + which = sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 902 + fmt_sink = mipi_csis_get_format(state, sd_state, which, CSIS_PAD_SINK); 903 903 904 904 fmt_sink->code = MEDIA_BUS_FMT_UYVY8_1X16; 905 905 fmt_sink->width = MIPI_CSIS_DEF_PIX_WIDTH; ··· 918 918 * configuration, cfg is NULL, which indicates there's no source pad 919 919 * configuration to set. 920 920 */ 921 - if (!cfg) 921 + if (!sd_state) 922 922 return 0; 923 923 924 - fmt_source = mipi_csis_get_format(state, cfg, which, CSIS_PAD_SOURCE); 924 + fmt_source = mipi_csis_get_format(state, sd_state, which, 925 + CSIS_PAD_SOURCE); 925 926 *fmt_source = *fmt_sink; 926 927 927 928 return 0; 928 929 } 929 930 930 931 static int mipi_csis_get_fmt(struct v4l2_subdev *sd, 931 - struct v4l2_subdev_pad_config *cfg, 932 + struct v4l2_subdev_state *sd_state, 932 933 struct v4l2_subdev_format *sdformat) 933 934 { 934 935 struct csi_state *state = mipi_sd_to_csis_state(sd); 935 936 struct v4l2_mbus_framefmt *fmt; 936 937 937 - fmt = mipi_csis_get_format(state, cfg, sdformat->which, sdformat->pad); 938 + fmt = mipi_csis_get_format(state, sd_state, sdformat->which, 939 + sdformat->pad); 938 940 939 941 mutex_lock(&state->lock); 940 942 sdformat->format = *fmt; ··· 946 944 } 947 945 948 946 static int mipi_csis_enum_mbus_code(struct v4l2_subdev *sd, 949 - struct v4l2_subdev_pad_config *cfg, 947 + struct v4l2_subdev_state *sd_state, 950 948 struct v4l2_subdev_mbus_code_enum *code) 951 949 { 952 950 struct csi_state *state = mipi_sd_to_csis_state(sd); ··· 961 959 if (code->index > 0) 962 960 return -EINVAL; 963 961 964 - fmt = mipi_csis_get_format(state, cfg, code->which, code->pad); 962 + fmt = mipi_csis_get_format(state, sd_state, code->which, 963 + code->pad); 965 964 code->code = fmt->code; 966 965 return 0; 967 966 } ··· 979 976 } 980 977 981 978 static int mipi_csis_set_fmt(struct v4l2_subdev *sd, 982 - struct v4l2_subdev_pad_config *cfg, 979 + struct v4l2_subdev_state *sd_state, 983 980 struct v4l2_subdev_format *sdformat) 984 981 { 985 982 struct csi_state *state = mipi_sd_to_csis_state(sd); ··· 992 989 * modified. 993 990 */ 994 991 if (sdformat->pad == CSIS_PAD_SOURCE) 995 - return mipi_csis_get_fmt(sd, cfg, sdformat); 992 + return mipi_csis_get_fmt(sd, sd_state, sdformat); 996 993 997 994 if (sdformat->pad != CSIS_PAD_SINK) 998 995 return -EINVAL; ··· 1032 1029 &sdformat->format.height, 1, 1033 1030 CSIS_MAX_PIX_HEIGHT, 0, 0); 1034 1031 1035 - fmt = mipi_csis_get_format(state, cfg, sdformat->which, sdformat->pad); 1032 + fmt = mipi_csis_get_format(state, sd_state, sdformat->which, 1033 + sdformat->pad); 1036 1034 1037 1035 mutex_lock(&state->lock); 1038 1036 ··· 1044 1040 sdformat->format = *fmt; 1045 1041 1046 1042 /* Propagate the format from sink to source. */ 1047 - fmt = mipi_csis_get_format(state, cfg, sdformat->which, 1043 + fmt = mipi_csis_get_format(state, sd_state, sdformat->which, 1048 1044 CSIS_PAD_SOURCE); 1049 1045 *fmt = sdformat->format; 1050 1046
+13 -13
drivers/staging/media/ipu3/ipu3-v4l2.c
··· 36 36 /* Initialize try_fmt */ 37 37 for (i = 0; i < IMGU_NODE_NUM; i++) { 38 38 struct v4l2_mbus_framefmt *try_fmt = 39 - v4l2_subdev_get_try_format(sd, fh->pad, i); 39 + v4l2_subdev_get_try_format(sd, fh->state, i); 40 40 41 41 try_fmt->width = try_crop.width; 42 42 try_fmt->height = try_crop.height; ··· 44 44 try_fmt->field = V4L2_FIELD_NONE; 45 45 } 46 46 47 - *v4l2_subdev_get_try_crop(sd, fh->pad, IMGU_NODE_IN) = try_crop; 48 - *v4l2_subdev_get_try_compose(sd, fh->pad, IMGU_NODE_IN) = try_crop; 47 + *v4l2_subdev_get_try_crop(sd, fh->state, IMGU_NODE_IN) = try_crop; 48 + *v4l2_subdev_get_try_compose(sd, fh->state, IMGU_NODE_IN) = try_crop; 49 49 50 50 return 0; 51 51 } ··· 120 120 } 121 121 122 122 static int imgu_subdev_get_fmt(struct v4l2_subdev *sd, 123 - struct v4l2_subdev_pad_config *cfg, 123 + struct v4l2_subdev_state *sd_state, 124 124 struct v4l2_subdev_format *fmt) 125 125 { 126 126 struct imgu_device *imgu = v4l2_get_subdevdata(sd); ··· 136 136 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) { 137 137 fmt->format = imgu_pipe->nodes[pad].pad_fmt; 138 138 } else { 139 - mf = v4l2_subdev_get_try_format(sd, cfg, pad); 139 + mf = v4l2_subdev_get_try_format(sd, sd_state, pad); 140 140 fmt->format = *mf; 141 141 } 142 142 ··· 144 144 } 145 145 146 146 static int imgu_subdev_set_fmt(struct v4l2_subdev *sd, 147 - struct v4l2_subdev_pad_config *cfg, 147 + struct v4l2_subdev_state *sd_state, 148 148 struct v4l2_subdev_format *fmt) 149 149 { 150 150 struct imgu_media_pipe *imgu_pipe; ··· 161 161 162 162 imgu_pipe = &imgu->imgu_pipe[pipe]; 163 163 if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) 164 - mf = v4l2_subdev_get_try_format(sd, cfg, pad); 164 + mf = v4l2_subdev_get_try_format(sd, sd_state, pad); 165 165 else 166 166 mf = &imgu_pipe->nodes[pad].pad_fmt; 167 167 ··· 189 189 } 190 190 191 191 static int imgu_subdev_get_selection(struct v4l2_subdev *sd, 192 - struct v4l2_subdev_pad_config *cfg, 192 + struct v4l2_subdev_state *sd_state, 193 193 struct v4l2_subdev_selection *sel) 194 194 { 195 195 struct v4l2_rect *try_sel, *r; ··· 202 202 203 203 switch (sel->target) { 204 204 case V4L2_SEL_TGT_CROP: 205 - try_sel = v4l2_subdev_get_try_crop(sd, cfg, sel->pad); 205 + try_sel = v4l2_subdev_get_try_crop(sd, sd_state, sel->pad); 206 206 r = &imgu_sd->rect.eff; 207 207 break; 208 208 case V4L2_SEL_TGT_COMPOSE: 209 - try_sel = v4l2_subdev_get_try_compose(sd, cfg, sel->pad); 209 + try_sel = v4l2_subdev_get_try_compose(sd, sd_state, sel->pad); 210 210 r = &imgu_sd->rect.bds; 211 211 break; 212 212 default: ··· 222 222 } 223 223 224 224 static int imgu_subdev_set_selection(struct v4l2_subdev *sd, 225 - struct v4l2_subdev_pad_config *cfg, 225 + struct v4l2_subdev_state *sd_state, 226 226 struct v4l2_subdev_selection *sel) 227 227 { 228 228 struct imgu_device *imgu = v4l2_get_subdevdata(sd); ··· 241 241 242 242 switch (sel->target) { 243 243 case V4L2_SEL_TGT_CROP: 244 - try_sel = v4l2_subdev_get_try_crop(sd, cfg, sel->pad); 244 + try_sel = v4l2_subdev_get_try_crop(sd, sd_state, sel->pad); 245 245 rect = &imgu_sd->rect.eff; 246 246 break; 247 247 case V4L2_SEL_TGT_COMPOSE: 248 - try_sel = v4l2_subdev_get_try_compose(sd, cfg, sel->pad); 248 + try_sel = v4l2_subdev_get_try_compose(sd, sd_state, sel->pad); 249 249 rect = &imgu_sd->rect.bds; 250 250 break; 251 251 default:
+20 -17
drivers/staging/media/omap4iss/iss_csi2.c
··· 825 825 826 826 static struct v4l2_mbus_framefmt * 827 827 __csi2_get_format(struct iss_csi2_device *csi2, 828 - struct v4l2_subdev_pad_config *cfg, 828 + struct v4l2_subdev_state *sd_state, 829 829 unsigned int pad, 830 830 enum v4l2_subdev_format_whence which) 831 831 { 832 832 if (which == V4L2_SUBDEV_FORMAT_TRY) 833 - return v4l2_subdev_get_try_format(&csi2->subdev, cfg, pad); 833 + return v4l2_subdev_get_try_format(&csi2->subdev, sd_state, 834 + pad); 834 835 835 836 return &csi2->formats[pad]; 836 837 } 837 838 838 839 static void 839 840 csi2_try_format(struct iss_csi2_device *csi2, 840 - struct v4l2_subdev_pad_config *cfg, 841 + struct v4l2_subdev_state *sd_state, 841 842 unsigned int pad, 842 843 struct v4l2_mbus_framefmt *fmt, 843 844 enum v4l2_subdev_format_whence which) ··· 869 868 * compression. 870 869 */ 871 870 pixelcode = fmt->code; 872 - format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK, which); 871 + format = __csi2_get_format(csi2, sd_state, CSI2_PAD_SINK, 872 + which); 873 873 memcpy(fmt, format, sizeof(*fmt)); 874 874 875 875 /* ··· 896 894 * return -EINVAL or zero on success 897 895 */ 898 896 static int csi2_enum_mbus_code(struct v4l2_subdev *sd, 899 - struct v4l2_subdev_pad_config *cfg, 897 + struct v4l2_subdev_state *sd_state, 900 898 struct v4l2_subdev_mbus_code_enum *code) 901 899 { 902 900 struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd); ··· 909 907 910 908 code->code = csi2_input_fmts[code->index]; 911 909 } else { 912 - format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK, 910 + format = __csi2_get_format(csi2, sd_state, CSI2_PAD_SINK, 913 911 code->which); 914 912 switch (code->index) { 915 913 case 0: ··· 933 931 } 934 932 935 933 static int csi2_enum_frame_size(struct v4l2_subdev *sd, 936 - struct v4l2_subdev_pad_config *cfg, 934 + struct v4l2_subdev_state *sd_state, 937 935 struct v4l2_subdev_frame_size_enum *fse) 938 936 { 939 937 struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd); ··· 945 943 format.code = fse->code; 946 944 format.width = 1; 947 945 format.height = 1; 948 - csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); 946 + csi2_try_format(csi2, sd_state, fse->pad, &format, fse->which); 949 947 fse->min_width = format.width; 950 948 fse->min_height = format.height; 951 949 ··· 955 953 format.code = fse->code; 956 954 format.width = -1; 957 955 format.height = -1; 958 - csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); 956 + csi2_try_format(csi2, sd_state, fse->pad, &format, fse->which); 959 957 fse->max_width = format.width; 960 958 fse->max_height = format.height; 961 959 ··· 970 968 * return -EINVAL or zero on success 971 969 */ 972 970 static int csi2_get_format(struct v4l2_subdev *sd, 973 - struct v4l2_subdev_pad_config *cfg, 971 + struct v4l2_subdev_state *sd_state, 974 972 struct v4l2_subdev_format *fmt) 975 973 { 976 974 struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd); 977 975 struct v4l2_mbus_framefmt *format; 978 976 979 - format = __csi2_get_format(csi2, cfg, fmt->pad, fmt->which); 977 + format = __csi2_get_format(csi2, sd_state, fmt->pad, fmt->which); 980 978 if (!format) 981 979 return -EINVAL; 982 980 ··· 992 990 * return -EINVAL or zero on success 993 991 */ 994 992 static int csi2_set_format(struct v4l2_subdev *sd, 995 - struct v4l2_subdev_pad_config *cfg, 993 + struct v4l2_subdev_state *sd_state, 996 994 struct v4l2_subdev_format *fmt) 997 995 { 998 996 struct iss_csi2_device *csi2 = v4l2_get_subdevdata(sd); 999 997 struct v4l2_mbus_framefmt *format; 1000 998 1001 - format = __csi2_get_format(csi2, cfg, fmt->pad, fmt->which); 999 + format = __csi2_get_format(csi2, sd_state, fmt->pad, fmt->which); 1002 1000 if (!format) 1003 1001 return -EINVAL; 1004 1002 1005 - csi2_try_format(csi2, cfg, fmt->pad, &fmt->format, fmt->which); 1003 + csi2_try_format(csi2, sd_state, fmt->pad, &fmt->format, fmt->which); 1006 1004 *format = fmt->format; 1007 1005 1008 1006 /* Propagate the format from sink to source */ 1009 1007 if (fmt->pad == CSI2_PAD_SINK) { 1010 - format = __csi2_get_format(csi2, cfg, CSI2_PAD_SOURCE, 1008 + format = __csi2_get_format(csi2, sd_state, CSI2_PAD_SOURCE, 1011 1009 fmt->which); 1012 1010 *format = fmt->format; 1013 - csi2_try_format(csi2, cfg, CSI2_PAD_SOURCE, format, fmt->which); 1011 + csi2_try_format(csi2, sd_state, CSI2_PAD_SOURCE, format, 1012 + fmt->which); 1014 1013 } 1015 1014 1016 1015 return 0; ··· 1053 1050 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 1054 1051 format.format.width = 4096; 1055 1052 format.format.height = 4096; 1056 - csi2_set_format(sd, fh ? fh->pad : NULL, &format); 1053 + csi2_set_format(sd, fh ? fh->state : NULL, &format); 1057 1054 1058 1055 return 0; 1059 1056 }
+20 -17
drivers/staging/media/omap4iss/iss_ipipe.c
··· 21 21 22 22 static struct v4l2_mbus_framefmt * 23 23 __ipipe_get_format(struct iss_ipipe_device *ipipe, 24 - struct v4l2_subdev_pad_config *cfg, 24 + struct v4l2_subdev_state *sd_state, 25 25 unsigned int pad, 26 26 enum v4l2_subdev_format_whence which); 27 27 ··· 175 175 176 176 static struct v4l2_mbus_framefmt * 177 177 __ipipe_get_format(struct iss_ipipe_device *ipipe, 178 - struct v4l2_subdev_pad_config *cfg, 178 + struct v4l2_subdev_state *sd_state, 179 179 unsigned int pad, 180 180 enum v4l2_subdev_format_whence which) 181 181 { 182 182 if (which == V4L2_SUBDEV_FORMAT_TRY) 183 - return v4l2_subdev_get_try_format(&ipipe->subdev, cfg, pad); 183 + return v4l2_subdev_get_try_format(&ipipe->subdev, sd_state, 184 + pad); 184 185 185 186 return &ipipe->formats[pad]; 186 187 } ··· 195 194 */ 196 195 static void 197 196 ipipe_try_format(struct iss_ipipe_device *ipipe, 198 - struct v4l2_subdev_pad_config *cfg, 197 + struct v4l2_subdev_state *sd_state, 199 198 unsigned int pad, 200 199 struct v4l2_mbus_framefmt *fmt, 201 200 enum v4l2_subdev_format_whence which) ··· 223 222 break; 224 223 225 224 case IPIPE_PAD_SOURCE_VP: 226 - format = __ipipe_get_format(ipipe, cfg, IPIPE_PAD_SINK, which); 225 + format = __ipipe_get_format(ipipe, sd_state, IPIPE_PAD_SINK, 226 + which); 227 227 memcpy(fmt, format, sizeof(*fmt)); 228 228 229 229 fmt->code = MEDIA_BUS_FMT_UYVY8_1X16; ··· 245 243 * return -EINVAL or zero on success 246 244 */ 247 245 static int ipipe_enum_mbus_code(struct v4l2_subdev *sd, 248 - struct v4l2_subdev_pad_config *cfg, 246 + struct v4l2_subdev_state *sd_state, 249 247 struct v4l2_subdev_mbus_code_enum *code) 250 248 { 251 249 switch (code->pad) { ··· 272 270 } 273 271 274 272 static int ipipe_enum_frame_size(struct v4l2_subdev *sd, 275 - struct v4l2_subdev_pad_config *cfg, 273 + struct v4l2_subdev_state *sd_state, 276 274 struct v4l2_subdev_frame_size_enum *fse) 277 275 { 278 276 struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); ··· 284 282 format.code = fse->code; 285 283 format.width = 1; 286 284 format.height = 1; 287 - ipipe_try_format(ipipe, cfg, fse->pad, &format, fse->which); 285 + ipipe_try_format(ipipe, sd_state, fse->pad, &format, fse->which); 288 286 fse->min_width = format.width; 289 287 fse->min_height = format.height; 290 288 ··· 294 292 format.code = fse->code; 295 293 format.width = -1; 296 294 format.height = -1; 297 - ipipe_try_format(ipipe, cfg, fse->pad, &format, fse->which); 295 + ipipe_try_format(ipipe, sd_state, fse->pad, &format, fse->which); 298 296 fse->max_width = format.width; 299 297 fse->max_height = format.height; 300 298 ··· 311 309 * to the format type. 312 310 */ 313 311 static int ipipe_get_format(struct v4l2_subdev *sd, 314 - struct v4l2_subdev_pad_config *cfg, 312 + struct v4l2_subdev_state *sd_state, 315 313 struct v4l2_subdev_format *fmt) 316 314 { 317 315 struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); 318 316 struct v4l2_mbus_framefmt *format; 319 317 320 - format = __ipipe_get_format(ipipe, cfg, fmt->pad, fmt->which); 318 + format = __ipipe_get_format(ipipe, sd_state, fmt->pad, fmt->which); 321 319 if (!format) 322 320 return -EINVAL; 323 321 ··· 335 333 * to the format type. 336 334 */ 337 335 static int ipipe_set_format(struct v4l2_subdev *sd, 338 - struct v4l2_subdev_pad_config *cfg, 336 + struct v4l2_subdev_state *sd_state, 339 337 struct v4l2_subdev_format *fmt) 340 338 { 341 339 struct iss_ipipe_device *ipipe = v4l2_get_subdevdata(sd); 342 340 struct v4l2_mbus_framefmt *format; 343 341 344 - format = __ipipe_get_format(ipipe, cfg, fmt->pad, fmt->which); 342 + format = __ipipe_get_format(ipipe, sd_state, fmt->pad, fmt->which); 345 343 if (!format) 346 344 return -EINVAL; 347 345 348 - ipipe_try_format(ipipe, cfg, fmt->pad, &fmt->format, fmt->which); 346 + ipipe_try_format(ipipe, sd_state, fmt->pad, &fmt->format, fmt->which); 349 347 *format = fmt->format; 350 348 351 349 /* Propagate the format from sink to source */ 352 350 if (fmt->pad == IPIPE_PAD_SINK) { 353 - format = __ipipe_get_format(ipipe, cfg, IPIPE_PAD_SOURCE_VP, 351 + format = __ipipe_get_format(ipipe, sd_state, 352 + IPIPE_PAD_SOURCE_VP, 354 353 fmt->which); 355 354 *format = fmt->format; 356 - ipipe_try_format(ipipe, cfg, IPIPE_PAD_SOURCE_VP, format, 355 + ipipe_try_format(ipipe, sd_state, IPIPE_PAD_SOURCE_VP, format, 357 356 fmt->which); 358 357 } 359 358 ··· 395 392 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 396 393 format.format.width = 4096; 397 394 format.format.height = 4096; 398 - ipipe_set_format(sd, fh ? fh->pad : NULL, &format); 395 + ipipe_set_format(sd, fh ? fh->state : NULL, &format); 399 396 400 397 return 0; 401 398 }
+27 -20
drivers/staging/media/omap4iss/iss_ipipeif.c
··· 357 357 358 358 static struct v4l2_mbus_framefmt * 359 359 __ipipeif_get_format(struct iss_ipipeif_device *ipipeif, 360 - struct v4l2_subdev_pad_config *cfg, unsigned int pad, 360 + struct v4l2_subdev_state *sd_state, unsigned int pad, 361 361 enum v4l2_subdev_format_whence which) 362 362 { 363 363 if (which == V4L2_SUBDEV_FORMAT_TRY) 364 - return v4l2_subdev_get_try_format(&ipipeif->subdev, cfg, pad); 364 + return v4l2_subdev_get_try_format(&ipipeif->subdev, sd_state, 365 + pad); 365 366 return &ipipeif->formats[pad]; 366 367 } 367 368 ··· 375 374 */ 376 375 static void 377 376 ipipeif_try_format(struct iss_ipipeif_device *ipipeif, 378 - struct v4l2_subdev_pad_config *cfg, unsigned int pad, 377 + struct v4l2_subdev_state *sd_state, unsigned int pad, 379 378 struct v4l2_mbus_framefmt *fmt, 380 379 enum v4l2_subdev_format_whence which) 381 380 { ··· 404 403 break; 405 404 406 405 case IPIPEIF_PAD_SOURCE_ISIF_SF: 407 - format = __ipipeif_get_format(ipipeif, cfg, IPIPEIF_PAD_SINK, 406 + format = __ipipeif_get_format(ipipeif, sd_state, 407 + IPIPEIF_PAD_SINK, 408 408 which); 409 409 memcpy(fmt, format, sizeof(*fmt)); 410 410 ··· 420 418 break; 421 419 422 420 case IPIPEIF_PAD_SOURCE_VP: 423 - format = __ipipeif_get_format(ipipeif, cfg, IPIPEIF_PAD_SINK, 421 + format = __ipipeif_get_format(ipipeif, sd_state, 422 + IPIPEIF_PAD_SINK, 424 423 which); 425 424 memcpy(fmt, format, sizeof(*fmt)); 426 425 ··· 445 442 * return -EINVAL or zero on success 446 443 */ 447 444 static int ipipeif_enum_mbus_code(struct v4l2_subdev *sd, 448 - struct v4l2_subdev_pad_config *cfg, 445 + struct v4l2_subdev_state *sd_state, 449 446 struct v4l2_subdev_mbus_code_enum *code) 450 447 { 451 448 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ··· 465 462 if (code->index != 0) 466 463 return -EINVAL; 467 464 468 - format = __ipipeif_get_format(ipipeif, cfg, IPIPEIF_PAD_SINK, 465 + format = __ipipeif_get_format(ipipeif, sd_state, 466 + IPIPEIF_PAD_SINK, 469 467 code->which); 470 468 471 469 code->code = format->code; ··· 480 476 } 481 477 482 478 static int ipipeif_enum_frame_size(struct v4l2_subdev *sd, 483 - struct v4l2_subdev_pad_config *cfg, 479 + struct v4l2_subdev_state *sd_state, 484 480 struct v4l2_subdev_frame_size_enum *fse) 485 481 { 486 482 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); ··· 492 488 format.code = fse->code; 493 489 format.width = 1; 494 490 format.height = 1; 495 - ipipeif_try_format(ipipeif, cfg, fse->pad, &format, fse->which); 491 + ipipeif_try_format(ipipeif, sd_state, fse->pad, &format, fse->which); 496 492 fse->min_width = format.width; 497 493 fse->min_height = format.height; 498 494 ··· 502 498 format.code = fse->code; 503 499 format.width = -1; 504 500 format.height = -1; 505 - ipipeif_try_format(ipipeif, cfg, fse->pad, &format, fse->which); 501 + ipipeif_try_format(ipipeif, sd_state, fse->pad, &format, fse->which); 506 502 fse->max_width = format.width; 507 503 fse->max_height = format.height; 508 504 ··· 519 515 * to the format type. 520 516 */ 521 517 static int ipipeif_get_format(struct v4l2_subdev *sd, 522 - struct v4l2_subdev_pad_config *cfg, 518 + struct v4l2_subdev_state *sd_state, 523 519 struct v4l2_subdev_format *fmt) 524 520 { 525 521 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); 526 522 struct v4l2_mbus_framefmt *format; 527 523 528 - format = __ipipeif_get_format(ipipeif, cfg, fmt->pad, fmt->which); 524 + format = __ipipeif_get_format(ipipeif, sd_state, fmt->pad, fmt->which); 529 525 if (!format) 530 526 return -EINVAL; 531 527 ··· 543 539 * to the format type. 544 540 */ 545 541 static int ipipeif_set_format(struct v4l2_subdev *sd, 546 - struct v4l2_subdev_pad_config *cfg, 542 + struct v4l2_subdev_state *sd_state, 547 543 struct v4l2_subdev_format *fmt) 548 544 { 549 545 struct iss_ipipeif_device *ipipeif = v4l2_get_subdevdata(sd); 550 546 struct v4l2_mbus_framefmt *format; 551 547 552 - format = __ipipeif_get_format(ipipeif, cfg, fmt->pad, fmt->which); 548 + format = __ipipeif_get_format(ipipeif, sd_state, fmt->pad, fmt->which); 553 549 if (!format) 554 550 return -EINVAL; 555 551 556 - ipipeif_try_format(ipipeif, cfg, fmt->pad, &fmt->format, fmt->which); 552 + ipipeif_try_format(ipipeif, sd_state, fmt->pad, &fmt->format, 553 + fmt->which); 557 554 *format = fmt->format; 558 555 559 556 /* Propagate the format from sink to source */ 560 557 if (fmt->pad == IPIPEIF_PAD_SINK) { 561 - format = __ipipeif_get_format(ipipeif, cfg, 558 + format = __ipipeif_get_format(ipipeif, sd_state, 562 559 IPIPEIF_PAD_SOURCE_ISIF_SF, 563 560 fmt->which); 564 561 *format = fmt->format; 565 - ipipeif_try_format(ipipeif, cfg, IPIPEIF_PAD_SOURCE_ISIF_SF, 562 + ipipeif_try_format(ipipeif, sd_state, 563 + IPIPEIF_PAD_SOURCE_ISIF_SF, 566 564 format, fmt->which); 567 565 568 - format = __ipipeif_get_format(ipipeif, cfg, 566 + format = __ipipeif_get_format(ipipeif, sd_state, 569 567 IPIPEIF_PAD_SOURCE_VP, 570 568 fmt->which); 571 569 *format = fmt->format; 572 - ipipeif_try_format(ipipeif, cfg, IPIPEIF_PAD_SOURCE_VP, format, 570 + ipipeif_try_format(ipipeif, sd_state, IPIPEIF_PAD_SOURCE_VP, 571 + format, 573 572 fmt->which); 574 573 } 575 574 ··· 615 608 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 616 609 format.format.width = 4096; 617 610 format.format.height = 4096; 618 - ipipeif_set_format(sd, fh ? fh->pad : NULL, &format); 611 + ipipeif_set_format(sd, fh ? fh->state : NULL, &format); 619 612 620 613 return 0; 621 614 }
+22 -17
drivers/staging/media/omap4iss/iss_resizer.c
··· 416 416 417 417 static struct v4l2_mbus_framefmt * 418 418 __resizer_get_format(struct iss_resizer_device *resizer, 419 - struct v4l2_subdev_pad_config *cfg, unsigned int pad, 419 + struct v4l2_subdev_state *sd_state, unsigned int pad, 420 420 enum v4l2_subdev_format_whence which) 421 421 { 422 422 if (which == V4L2_SUBDEV_FORMAT_TRY) 423 - return v4l2_subdev_get_try_format(&resizer->subdev, cfg, pad); 423 + return v4l2_subdev_get_try_format(&resizer->subdev, sd_state, 424 + pad); 424 425 return &resizer->formats[pad]; 425 426 } 426 427 ··· 434 433 */ 435 434 static void 436 435 resizer_try_format(struct iss_resizer_device *resizer, 437 - struct v4l2_subdev_pad_config *cfg, unsigned int pad, 436 + struct v4l2_subdev_state *sd_state, unsigned int pad, 438 437 struct v4l2_mbus_framefmt *fmt, 439 438 enum v4l2_subdev_format_whence which) 440 439 { ··· 462 461 463 462 case RESIZER_PAD_SOURCE_MEM: 464 463 pixelcode = fmt->code; 465 - format = __resizer_get_format(resizer, cfg, RESIZER_PAD_SINK, 464 + format = __resizer_get_format(resizer, sd_state, 465 + RESIZER_PAD_SINK, 466 466 which); 467 467 memcpy(fmt, format, sizeof(*fmt)); 468 468 ··· 494 492 * return -EINVAL or zero on success 495 493 */ 496 494 static int resizer_enum_mbus_code(struct v4l2_subdev *sd, 497 - struct v4l2_subdev_pad_config *cfg, 495 + struct v4l2_subdev_state *sd_state, 498 496 struct v4l2_subdev_mbus_code_enum *code) 499 497 { 500 498 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); ··· 509 507 break; 510 508 511 509 case RESIZER_PAD_SOURCE_MEM: 512 - format = __resizer_get_format(resizer, cfg, RESIZER_PAD_SINK, 510 + format = __resizer_get_format(resizer, sd_state, 511 + RESIZER_PAD_SINK, 513 512 code->which); 514 513 515 514 if (code->index == 0) { ··· 540 537 } 541 538 542 539 static int resizer_enum_frame_size(struct v4l2_subdev *sd, 543 - struct v4l2_subdev_pad_config *cfg, 540 + struct v4l2_subdev_state *sd_state, 544 541 struct v4l2_subdev_frame_size_enum *fse) 545 542 { 546 543 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); ··· 552 549 format.code = fse->code; 553 550 format.width = 1; 554 551 format.height = 1; 555 - resizer_try_format(resizer, cfg, fse->pad, &format, fse->which); 552 + resizer_try_format(resizer, sd_state, fse->pad, &format, fse->which); 556 553 fse->min_width = format.width; 557 554 fse->min_height = format.height; 558 555 ··· 562 559 format.code = fse->code; 563 560 format.width = -1; 564 561 format.height = -1; 565 - resizer_try_format(resizer, cfg, fse->pad, &format, fse->which); 562 + resizer_try_format(resizer, sd_state, fse->pad, &format, fse->which); 566 563 fse->max_width = format.width; 567 564 fse->max_height = format.height; 568 565 ··· 579 576 * to the format type. 580 577 */ 581 578 static int resizer_get_format(struct v4l2_subdev *sd, 582 - struct v4l2_subdev_pad_config *cfg, 579 + struct v4l2_subdev_state *sd_state, 583 580 struct v4l2_subdev_format *fmt) 584 581 { 585 582 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); 586 583 struct v4l2_mbus_framefmt *format; 587 584 588 - format = __resizer_get_format(resizer, cfg, fmt->pad, fmt->which); 585 + format = __resizer_get_format(resizer, sd_state, fmt->pad, fmt->which); 589 586 if (!format) 590 587 return -EINVAL; 591 588 ··· 603 600 * to the format type. 604 601 */ 605 602 static int resizer_set_format(struct v4l2_subdev *sd, 606 - struct v4l2_subdev_pad_config *cfg, 603 + struct v4l2_subdev_state *sd_state, 607 604 struct v4l2_subdev_format *fmt) 608 605 { 609 606 struct iss_resizer_device *resizer = v4l2_get_subdevdata(sd); 610 607 struct v4l2_mbus_framefmt *format; 611 608 612 - format = __resizer_get_format(resizer, cfg, fmt->pad, fmt->which); 609 + format = __resizer_get_format(resizer, sd_state, fmt->pad, fmt->which); 613 610 if (!format) 614 611 return -EINVAL; 615 612 616 - resizer_try_format(resizer, cfg, fmt->pad, &fmt->format, fmt->which); 613 + resizer_try_format(resizer, sd_state, fmt->pad, &fmt->format, 614 + fmt->which); 617 615 *format = fmt->format; 618 616 619 617 /* Propagate the format from sink to source */ 620 618 if (fmt->pad == RESIZER_PAD_SINK) { 621 - format = __resizer_get_format(resizer, cfg, 619 + format = __resizer_get_format(resizer, sd_state, 622 620 RESIZER_PAD_SOURCE_MEM, 623 621 fmt->which); 624 622 *format = fmt->format; 625 - resizer_try_format(resizer, cfg, RESIZER_PAD_SOURCE_MEM, format, 623 + resizer_try_format(resizer, sd_state, RESIZER_PAD_SOURCE_MEM, 624 + format, 626 625 fmt->which); 627 626 } 628 627 ··· 667 662 format.format.code = MEDIA_BUS_FMT_UYVY8_1X16; 668 663 format.format.width = 4096; 669 664 format.format.height = 4096; 670 - resizer_set_format(sd, fh ? fh->pad : NULL, &format); 665 + resizer_set_format(sd, fh ? fh->state : NULL, &format); 671 666 672 667 return 0; 673 668 }
+5 -5
drivers/staging/media/tegra-video/csi.c
··· 64 64 * V4L2 Subdevice Pad Operations 65 65 */ 66 66 static int csi_enum_bus_code(struct v4l2_subdev *subdev, 67 - struct v4l2_subdev_pad_config *cfg, 67 + struct v4l2_subdev_state *sd_state, 68 68 struct v4l2_subdev_mbus_code_enum *code) 69 69 { 70 70 if (!IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG)) ··· 79 79 } 80 80 81 81 static int csi_get_format(struct v4l2_subdev *subdev, 82 - struct v4l2_subdev_pad_config *cfg, 82 + struct v4l2_subdev_state *sd_state, 83 83 struct v4l2_subdev_format *fmt) 84 84 { 85 85 struct tegra_csi_channel *csi_chan = to_csi_chan(subdev); ··· 127 127 } 128 128 129 129 static int csi_enum_framesizes(struct v4l2_subdev *subdev, 130 - struct v4l2_subdev_pad_config *cfg, 130 + struct v4l2_subdev_state *sd_state, 131 131 struct v4l2_subdev_frame_size_enum *fse) 132 132 { 133 133 unsigned int i; ··· 154 154 } 155 155 156 156 static int csi_enum_frameintervals(struct v4l2_subdev *subdev, 157 - struct v4l2_subdev_pad_config *cfg, 157 + struct v4l2_subdev_state *sd_state, 158 158 struct v4l2_subdev_frame_interval_enum *fie) 159 159 { 160 160 struct tegra_csi_channel *csi_chan = to_csi_chan(subdev); ··· 181 181 } 182 182 183 183 static int csi_set_format(struct v4l2_subdev *subdev, 184 - struct v4l2_subdev_pad_config *cfg, 184 + struct v4l2_subdev_state *sd_state, 185 185 struct v4l2_subdev_format *fmt) 186 186 { 187 187 struct tegra_csi_channel *csi_chan = to_csi_chan(subdev);
+12 -12
drivers/staging/media/tegra-video/vi.c
··· 493 493 const struct tegra_video_format *fmtinfo; 494 494 struct v4l2_subdev *subdev; 495 495 struct v4l2_subdev_format fmt; 496 - struct v4l2_subdev_pad_config *pad_cfg; 496 + struct v4l2_subdev_state *sd_state; 497 497 struct v4l2_subdev_frame_size_enum fse = { 498 498 .which = V4L2_SUBDEV_FORMAT_TRY, 499 499 }; ··· 507 507 if (!subdev) 508 508 return -ENODEV; 509 509 510 - pad_cfg = v4l2_subdev_alloc_pad_config(subdev); 511 - if (!pad_cfg) 510 + sd_state = v4l2_subdev_alloc_state(subdev); 511 + if (!sd_state) 512 512 return -ENOMEM; 513 513 /* 514 514 * Retrieve the format information and if requested format isn't ··· 532 532 * If not available, try to get crop boundary from subdev. 533 533 */ 534 534 fse.code = fmtinfo->code; 535 - ret = v4l2_subdev_call(subdev, pad, enum_frame_size, pad_cfg, &fse); 535 + ret = v4l2_subdev_call(subdev, pad, enum_frame_size, sd_state, &fse); 536 536 if (ret) { 537 537 if (!v4l2_subdev_has_op(subdev, pad, get_selection)) { 538 - pad_cfg->try_crop.width = 0; 539 - pad_cfg->try_crop.height = 0; 538 + sd_state->pads->try_crop.width = 0; 539 + sd_state->pads->try_crop.height = 0; 540 540 } else { 541 541 ret = v4l2_subdev_call(subdev, pad, get_selection, 542 542 NULL, &sdsel); 543 543 if (ret) 544 544 return -EINVAL; 545 545 546 - pad_cfg->try_crop.width = sdsel.r.width; 547 - pad_cfg->try_crop.height = sdsel.r.height; 546 + sd_state->pads->try_crop.width = sdsel.r.width; 547 + sd_state->pads->try_crop.height = sdsel.r.height; 548 548 } 549 549 } else { 550 - pad_cfg->try_crop.width = fse.max_width; 551 - pad_cfg->try_crop.height = fse.max_height; 550 + sd_state->pads->try_crop.width = fse.max_width; 551 + sd_state->pads->try_crop.height = fse.max_height; 552 552 } 553 553 554 - ret = v4l2_subdev_call(subdev, pad, set_fmt, pad_cfg, &fmt); 554 + ret = v4l2_subdev_call(subdev, pad, set_fmt, sd_state, &fmt); 555 555 if (ret < 0) 556 556 return ret; 557 557 558 558 v4l2_fill_pix_format(pix, &fmt.format); 559 559 tegra_channel_fmt_align(chan, pix, fmtinfo->bpp); 560 560 561 - v4l2_subdev_free_pad_config(pad_cfg); 561 + v4l2_subdev_free_state(sd_state); 562 562 563 563 return 0; 564 564 }
+44 -30
include/media/v4l2-subdev.h
··· 624 624 }; 625 625 626 626 /** 627 + * struct v4l2_subdev_state - Used for storing subdev state information. 628 + * 629 + * @pads: &struct v4l2_subdev_pad_config array 630 + * 631 + * This structure only needs to be passed to the pad op if the 'which' field 632 + * of the main argument is set to %V4L2_SUBDEV_FORMAT_TRY. For 633 + * %V4L2_SUBDEV_FORMAT_ACTIVE it is safe to pass %NULL. 634 + */ 635 + struct v4l2_subdev_state { 636 + struct v4l2_subdev_pad_config *pads; 637 + }; 638 + 639 + /** 627 640 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations 628 641 * 629 642 * @init_cfg: initialize the pad config to default values ··· 700 687 */ 701 688 struct v4l2_subdev_pad_ops { 702 689 int (*init_cfg)(struct v4l2_subdev *sd, 703 - struct v4l2_subdev_pad_config *cfg); 690 + struct v4l2_subdev_state *state); 704 691 int (*enum_mbus_code)(struct v4l2_subdev *sd, 705 - struct v4l2_subdev_pad_config *cfg, 692 + struct v4l2_subdev_state *state, 706 693 struct v4l2_subdev_mbus_code_enum *code); 707 694 int (*enum_frame_size)(struct v4l2_subdev *sd, 708 - struct v4l2_subdev_pad_config *cfg, 695 + struct v4l2_subdev_state *state, 709 696 struct v4l2_subdev_frame_size_enum *fse); 710 697 int (*enum_frame_interval)(struct v4l2_subdev *sd, 711 - struct v4l2_subdev_pad_config *cfg, 698 + struct v4l2_subdev_state *state, 712 699 struct v4l2_subdev_frame_interval_enum *fie); 713 700 int (*get_fmt)(struct v4l2_subdev *sd, 714 - struct v4l2_subdev_pad_config *cfg, 701 + struct v4l2_subdev_state *state, 715 702 struct v4l2_subdev_format *format); 716 703 int (*set_fmt)(struct v4l2_subdev *sd, 717 - struct v4l2_subdev_pad_config *cfg, 704 + struct v4l2_subdev_state *state, 718 705 struct v4l2_subdev_format *format); 719 706 int (*get_selection)(struct v4l2_subdev *sd, 720 - struct v4l2_subdev_pad_config *cfg, 707 + struct v4l2_subdev_state *state, 721 708 struct v4l2_subdev_selection *sel); 722 709 int (*set_selection)(struct v4l2_subdev *sd, 723 - struct v4l2_subdev_pad_config *cfg, 710 + struct v4l2_subdev_state *state, 724 711 struct v4l2_subdev_selection *sel); 725 712 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); 726 713 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); ··· 931 918 * struct v4l2_subdev_fh - Used for storing subdev information per file handle 932 919 * 933 920 * @vfh: pointer to &struct v4l2_fh 934 - * @pad: pointer to &struct v4l2_subdev_pad_config 921 + * @state: pointer to &struct v4l2_subdev_state 935 922 * @owner: module pointer to the owner of this file handle 936 923 */ 937 924 struct v4l2_subdev_fh { 938 925 struct v4l2_fh vfh; 939 926 struct module *owner; 940 927 #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 941 - struct v4l2_subdev_pad_config *pad; 928 + struct v4l2_subdev_state *state; 942 929 #endif 943 930 }; 944 931 ··· 958 945 * &struct v4l2_subdev_pad_config->try_fmt 959 946 * 960 947 * @sd: pointer to &struct v4l2_subdev 961 - * @cfg: pointer to &struct v4l2_subdev_pad_config array. 962 - * @pad: index of the pad in the @cfg array. 948 + * @state: pointer to &struct v4l2_subdev_state 949 + * @pad: index of the pad in the &struct v4l2_subdev_state->pads array 963 950 */ 964 951 static inline struct v4l2_mbus_framefmt * 965 952 v4l2_subdev_get_try_format(struct v4l2_subdev *sd, 966 - struct v4l2_subdev_pad_config *cfg, 953 + struct v4l2_subdev_state *state, 967 954 unsigned int pad) 968 955 { 969 956 if (WARN_ON(pad >= sd->entity.num_pads)) 970 957 pad = 0; 971 - return &cfg[pad].try_fmt; 958 + return &state->pads[pad].try_fmt; 972 959 } 973 960 974 961 /** ··· 976 963 * &struct v4l2_subdev_pad_config->try_crop 977 964 * 978 965 * @sd: pointer to &struct v4l2_subdev 979 - * @cfg: pointer to &struct v4l2_subdev_pad_config array. 980 - * @pad: index of the pad in the @cfg array. 966 + * @state: pointer to &struct v4l2_subdev_state. 967 + * @pad: index of the pad in the &struct v4l2_subdev_state->pads array. 981 968 */ 982 969 static inline struct v4l2_rect * 983 970 v4l2_subdev_get_try_crop(struct v4l2_subdev *sd, 984 - struct v4l2_subdev_pad_config *cfg, 971 + struct v4l2_subdev_state *state, 985 972 unsigned int pad) 986 973 { 987 974 if (WARN_ON(pad >= sd->entity.num_pads)) 988 975 pad = 0; 989 - return &cfg[pad].try_crop; 976 + return &state->pads[pad].try_crop; 990 977 } 991 978 992 979 /** ··· 994 981 * &struct v4l2_subdev_pad_config->try_compose 995 982 * 996 983 * @sd: pointer to &struct v4l2_subdev 997 - * @cfg: pointer to &struct v4l2_subdev_pad_config array. 998 - * @pad: index of the pad in the @cfg array. 984 + * @state: pointer to &struct v4l2_subdev_state. 985 + * @pad: index of the pad in the &struct v4l2_subdev_state->pads array. 999 986 */ 1000 987 static inline struct v4l2_rect * 1001 988 v4l2_subdev_get_try_compose(struct v4l2_subdev *sd, 1002 - struct v4l2_subdev_pad_config *cfg, 989 + struct v4l2_subdev_state *state, 1003 990 unsigned int pad) 1004 991 { 1005 992 if (WARN_ON(pad >= sd->entity.num_pads)) 1006 993 pad = 0; 1007 - return &cfg[pad].try_compose; 994 + return &state->pads[pad].try_compose; 1008 995 } 1009 996 1010 997 #endif ··· 1106 1093 int v4l2_subdev_link_validate(struct media_link *link); 1107 1094 1108 1095 /** 1109 - * v4l2_subdev_alloc_pad_config - Allocates memory for pad config 1096 + * v4l2_subdev_alloc_state - allocate v4l2_subdev_state 1110 1097 * 1111 - * @sd: pointer to struct v4l2_subdev 1098 + * @sd: pointer to &struct v4l2_subdev for which the state is being allocated. 1099 + * 1100 + * Must call v4l2_subdev_free_state() when state is no longer needed. 1112 1101 */ 1113 - struct 1114 - v4l2_subdev_pad_config *v4l2_subdev_alloc_pad_config(struct v4l2_subdev *sd); 1102 + struct v4l2_subdev_state *v4l2_subdev_alloc_state(struct v4l2_subdev *sd); 1115 1103 1116 1104 /** 1117 - * v4l2_subdev_free_pad_config - Frees memory allocated by 1118 - * v4l2_subdev_alloc_pad_config(). 1105 + * v4l2_subdev_free_state - free a v4l2_subdev_state 1119 1106 * 1120 - * @cfg: pointer to &struct v4l2_subdev_pad_config 1107 + * @state: v4l2_subdev_state to be freed. 1121 1108 */ 1122 - void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg); 1109 + void v4l2_subdev_free_state(struct v4l2_subdev_state *state); 1110 + 1123 1111 #endif /* CONFIG_MEDIA_CONTROLLER */ 1124 1112 1125 1113 /**