Skip to content
Permalink
Browse files
media: subdev: rename v4l2_subdev_pad_config.try_* fields
struct v4l2_subdev_pad_config used to be relevant only for
V4L2_SUBDEV_FORMAT_TRY configuration, and thus the fields of the struct
were named, e.g. try_fmt.

This struct is now used in struct v4l2_subdev_state, and thus can be
used in both try and active cases. Thus rename the fields and drop the
"try_" prefix.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
  • Loading branch information
tomba authored and intel-lab-lkp committed Feb 7, 2022
1 parent 5de6edb commit 8283dea08111c6a813e9340d735c158df3fcbe5f
Show file tree
Hide file tree
Showing 19 changed files with 50 additions and 52 deletions.
@@ -443,7 +443,7 @@ static int adv7183_set_fmt(struct v4l2_subdev *sd,
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
decoder->fmt = *fmt;
else
sd_state->pads->try_fmt = *fmt;
sd_state->pads->fmt = *fmt;
return 0;
}

@@ -1020,8 +1020,8 @@ static int __imx274_change_compose(struct stimx274 *imx274,
int best_goodness = INT_MIN;

if (which == V4L2_SUBDEV_FORMAT_TRY) {
cur_crop = &sd_state->pads->try_crop;
tgt_fmt = &sd_state->pads->try_fmt;
cur_crop = &sd_state->pads->crop;
tgt_fmt = &sd_state->pads->fmt;
} else {
cur_crop = &imx274->crop;
tgt_fmt = &imx274->format;
@@ -1114,7 +1114,7 @@ static int imx274_set_fmt(struct v4l2_subdev *sd,
*/
fmt->field = V4L2_FIELD_NONE;
if (format->which == V4L2_SUBDEV_FORMAT_TRY)
sd_state->pads->try_fmt = *fmt;
sd_state->pads->fmt = *fmt;
else
imx274->format = *fmt;

@@ -1145,8 +1145,8 @@ static int imx274_get_selection(struct v4l2_subdev *sd,
}

if (sel->which == V4L2_SUBDEV_FORMAT_TRY) {
src_crop = &sd_state->pads->try_crop;
src_fmt = &sd_state->pads->try_fmt;
src_crop = &sd_state->pads->crop;
src_fmt = &sd_state->pads->fmt;
} else {
src_crop = &imx274->crop;
src_fmt = &imx274->format;
@@ -1217,7 +1217,7 @@ static int imx274_set_selection_crop(struct stimx274 *imx274,
sel->r = new_crop;

if (sel->which == V4L2_SUBDEV_FORMAT_TRY)
tgt_crop = &sd_state->pads->try_crop;
tgt_crop = &sd_state->pads->crop;
else
tgt_crop = &imx274->crop;

@@ -411,7 +411,7 @@ static int mt9m001_set_fmt(struct v4l2_subdev *sd,

if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return mt9m001_s_fmt(sd, fmt, mf);
sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;
return 0;
}

@@ -678,7 +678,7 @@ static int mt9m111_set_fmt(struct v4l2_subdev *sd,
mf->xfer_func = V4L2_XFER_FUNC_DEFAULT;

if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;
return 0;
}

@@ -982,7 +982,7 @@ static int mt9t112_set_fmt(struct v4l2_subdev *sd,

if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return mt9t112_s_fmt(sd, mf);
sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;

return 0;
}
@@ -358,7 +358,7 @@ static int mt9v011_set_fmt(struct v4l2_subdev *sd,

set_res(sd);
} else {
sd_state->pads->try_fmt = *fmt;
sd_state->pads->fmt = *fmt;
}

return 0;
@@ -800,7 +800,7 @@ static struct v4l2_mbus_framefmt *__mt9v111_get_pad_format(
#if IS_ENABLED(CONFIG_VIDEO_V4L2_SUBDEV_API)
return v4l2_subdev_get_try_format(&mt9v111->sd, sd_state, pad);
#else
return &sd_state->pads->try_fmt;
return &sd_state->pads->fmt;
#endif
case V4L2_SUBDEV_FORMAT_ACTIVE:
return &mt9v111->fmt;
@@ -957,7 +957,7 @@ static int mt9v111_set_format(struct v4l2_subdev *subdev,
static int mt9v111_init_cfg(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state)
{
sd_state->pads->try_fmt = mt9v111_def_fmt;
sd_state->pads->fmt = mt9v111_def_fmt;

return 0;
}
@@ -996,7 +996,7 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
/* select format */
priv->cfmt_code = mf->code;
} else {
sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;
}
out:
mutex_unlock(&priv->lock);
@@ -550,9 +550,9 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd,

/* update media bus format code and frame size */
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
mf->width = sd_state->pads->try_fmt.width;
mf->height = sd_state->pads->try_fmt.height;
mf->code = sd_state->pads->try_fmt.code;
mf->width = sd_state->pads->fmt.width;
mf->height = sd_state->pads->fmt.height;
mf->code = sd_state->pads->fmt.code;

} else {
mf->width = priv->rect.width >> priv->half_scale;
@@ -701,15 +701,15 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd,

if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
/* store media bus format code and frame size in pad config */
sd_state->pads->try_fmt.width = mf->width;
sd_state->pads->try_fmt.height = mf->height;
sd_state->pads->try_fmt.code = mf->code;
sd_state->pads->fmt.width = mf->width;
sd_state->pads->fmt.height = mf->height;
sd_state->pads->fmt.code = mf->code;

/* return default mbus frame format updated with pad config */
*mf = ov6650_def_fmt;
mf->width = sd_state->pads->try_fmt.width;
mf->height = sd_state->pads->try_fmt.height;
mf->code = sd_state->pads->try_fmt.code;
mf->width = sd_state->pads->fmt.width;
mf->height = sd_state->pads->fmt.height;
mf->code = sd_state->pads->fmt.code;

} else {
/* apply new media bus format code and frame size */
@@ -1222,7 +1222,7 @@ static int ov772x_set_fmt(struct v4l2_subdev *sd,
mf->xfer_func = V4L2_XFER_FUNC_DEFAULT;

if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;
return 0;
}

@@ -547,7 +547,7 @@ static int ov9640_set_fmt(struct v4l2_subdev *sd,
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return ov9640_s_fmt(sd, mf);

sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;

return 0;
}
@@ -1009,7 +1009,7 @@ static int rj54n1_set_fmt(struct v4l2_subdev *sd,
&mf->height, 84, RJ54N1_MAX_HEIGHT, align, 0);

if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;
return 0;
}

@@ -595,7 +595,7 @@ static int saa6752hs_set_fmt(struct v4l2_subdev *sd,
f->colorspace = V4L2_COLORSPACE_SMPTE170M;

if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
sd_state->pads->try_fmt = *f;
sd_state->pads->fmt = *f;
return 0;
}

@@ -541,7 +541,7 @@ static int sr030pc30_set_fmt(struct v4l2_subdev *sd,

fmt = try_fmt(sd, mf);
if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;
return 0;
}

@@ -829,7 +829,7 @@ static int tw9910_set_fmt(struct v4l2_subdev *sd,
if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE)
return tw9910_s_fmt(sd, mf);

sd_state->pads->try_fmt = *mf;
sd_state->pads->fmt = *mf;

return 0;
}
@@ -587,7 +587,7 @@ static int vs6624_set_fmt(struct v4l2_subdev *sd,
fmt->colorspace = vs6624_formats[index].colorspace;

if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
sd_state->pads->try_fmt = *fmt;
sd_state->pads->fmt = *fmt;
return 0;
}

@@ -835,11 +835,11 @@ static void isc_try_fse(struct isc_device *isc,
* just use the maximum ISC can receive.
*/
if (ret) {
sd_state->pads->try_crop.width = isc->max_width;
sd_state->pads->try_crop.height = isc->max_height;
sd_state->pads->crop.width = isc->max_width;
sd_state->pads->crop.height = isc->max_height;
} else {
sd_state->pads->try_crop.width = fse.max_width;
sd_state->pads->try_crop.height = fse.max_height;
sd_state->pads->crop.width = fse.max_width;
sd_state->pads->crop.height = fse.max_height;
}
}

@@ -572,11 +572,11 @@ static void isi_try_fse(struct atmel_isi *isi, const struct isi_format *isi_fmt,
* just use the maximum ISI can receive.
*/
if (ret) {
sd_state->pads->try_crop.width = MAX_SUPPORT_WIDTH;
sd_state->pads->try_crop.height = MAX_SUPPORT_HEIGHT;
sd_state->pads->crop.width = MAX_SUPPORT_WIDTH;
sd_state->pads->crop.height = MAX_SUPPORT_HEIGHT;
} else {
sd_state->pads->try_crop.width = fse.max_width;
sd_state->pads->try_crop.height = fse.max_height;
sd_state->pads->crop.width = fse.max_width;
sd_state->pads->crop.height = fse.max_height;
}
}

@@ -638,21 +638,19 @@ struct v4l2_subdev_ir_ops {
/**
* struct v4l2_subdev_pad_config - Used for storing subdev pad information.
*
* @try_fmt: &struct v4l2_mbus_framefmt
* @try_crop: &struct v4l2_rect to be used for crop
* @try_compose: &struct v4l2_rect to be used for compose
* @fmt: &struct v4l2_mbus_framefmt
* @crop: &struct v4l2_rect to be used for crop
* @compose: &struct v4l2_rect to be used for compose
*
* This structure only needs to be passed to the pad op if the 'which' field
* of the main argument is set to %V4L2_SUBDEV_FORMAT_TRY. For
* %V4L2_SUBDEV_FORMAT_ACTIVE it is safe to pass %NULL.
*
* Note: This struct is also used in active state, and the try_ prefix is
* historical and to be removed.
*/
struct v4l2_subdev_pad_config {
struct v4l2_mbus_framefmt try_fmt;
struct v4l2_rect try_crop;
struct v4l2_rect try_compose;
struct v4l2_mbus_framefmt fmt;
struct v4l2_rect crop;
struct v4l2_rect compose;
};

/**
@@ -1008,7 +1006,7 @@ struct v4l2_subdev_fh {

/**
* v4l2_subdev_get_try_format - ancillary routine to call
* &struct v4l2_subdev_pad_config->try_fmt
* &struct v4l2_subdev_pad_config->fmt
*
* @sd: pointer to &struct v4l2_subdev
* @state: pointer to &struct v4l2_subdev_state
@@ -1021,12 +1019,12 @@ v4l2_subdev_get_try_format(struct v4l2_subdev *sd,
{
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
return &state->pads[pad].try_fmt;
return &state->pads[pad].fmt;
}

/**
* v4l2_subdev_get_try_crop - ancillary routine to call
* &struct v4l2_subdev_pad_config->try_crop
* &struct v4l2_subdev_pad_config->crop
*
* @sd: pointer to &struct v4l2_subdev
* @state: pointer to &struct v4l2_subdev_state.
@@ -1039,12 +1037,12 @@ v4l2_subdev_get_try_crop(struct v4l2_subdev *sd,
{
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
return &state->pads[pad].try_crop;
return &state->pads[pad].crop;
}

/**
* v4l2_subdev_get_try_compose - ancillary routine to call
* &struct v4l2_subdev_pad_config->try_compose
* &struct v4l2_subdev_pad_config->compose
*
* @sd: pointer to &struct v4l2_subdev
* @state: pointer to &struct v4l2_subdev_state.
@@ -1057,7 +1055,7 @@ v4l2_subdev_get_try_compose(struct v4l2_subdev *sd,
{
if (WARN_ON(pad >= sd->entity.num_pads))
pad = 0;
return &state->pads[pad].try_compose;
return &state->pads[pad].compose;
}

#endif

0 comments on commit 8283dea

Please sign in to comment.