static struct v4l2_mbus_framefmt *
__dvp_get_format(struct stf_dvp_dev *dvp_dev,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
unsigned int pad,
enum v4l2_subdev_format_whence which)
{
- struct v4l2_subdev_state *state;
- state = kzalloc(sizeof(*state), GFP_KERNEL);
- if (!state)
- return ERR_PTR(-ENOMEM);
-
+
if (which == V4L2_SUBDEV_FORMAT_TRY)
return v4l2_subdev_get_try_format(
&dvp_dev->subdev, state, pad);
}
static void dvp_try_format(struct stf_dvp_dev *dvp_dev,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
unsigned int pad,
struct v4l2_mbus_framefmt *fmt,
enum v4l2_subdev_format_whence which)
case STF_DVP_PAD_SRC:
- *fmt = *__dvp_get_format(dvp_dev, cfg, STF_DVP_PAD_SINK, which);
+ *fmt = *__dvp_get_format(dvp_dev, state, STF_DVP_PAD_SINK, which);
break;
}
} else {
struct v4l2_mbus_framefmt *sink_fmt;
- sink_fmt = __dvp_get_format(dvp_dev, state->pads, STF_DVP_PAD_SINK,
+ sink_fmt = __dvp_get_format(dvp_dev, state, STF_DVP_PAD_SINK,
code->which);
code->code = sink_fmt->code;
format.code = fse->code;
format.width = 1;
format.height = 1;
- dvp_try_format(dvp_dev, state->pads, fse->pad, &format, fse->which);
+ dvp_try_format(dvp_dev, state, fse->pad, &format, fse->which);
fse->min_width = format.width;
fse->min_height = format.height;
format.code = fse->code;
format.width = -1;
format.height = -1;
- dvp_try_format(dvp_dev, state->pads, fse->pad, &format, fse->which);
+ dvp_try_format(dvp_dev, state, fse->pad, &format, fse->which);
fse->max_width = format.width;
fse->max_height = format.height;
struct stf_dvp_dev *dvp_dev = v4l2_get_subdevdata(sd);
struct v4l2_mbus_framefmt *format;
- format = __dvp_get_format(dvp_dev, state->pads, fmt->pad, fmt->which);
+ format = __dvp_get_format(dvp_dev, state, fmt->pad, fmt->which);
if (format == NULL)
return -EINVAL;
struct v4l2_mbus_framefmt *format;
int ret;
- format = __dvp_get_format(dvp_dev, state->pads, fmt->pad, fmt->which);
+ format = __dvp_get_format(dvp_dev, state, fmt->pad, fmt->which);
if (format == NULL)
return -EINVAL;
- dvp_try_format(dvp_dev, state->pads, fmt->pad, &fmt->format, fmt->which);
+ dvp_try_format(dvp_dev, state, fmt->pad, &fmt->format, fmt->which);
*format = fmt->format;
/* Propagate the format from sink to source */
if (fmt->pad == STF_DVP_PAD_SINK) {
- format = __dvp_get_format(dvp_dev, state->pads, STF_DVP_PAD_SRC,
+ format = __dvp_get_format(dvp_dev, state, STF_DVP_PAD_SRC,
fmt->which);
*format = fmt->format;
- dvp_try_format(dvp_dev, state->pads, STF_DVP_PAD_SRC, format,
+ dvp_try_format(dvp_dev, state, STF_DVP_PAD_SRC, format,
fmt->which);
}
static struct v4l2_mbus_framefmt *
__isp_get_format(struct stf_isp_dev *isp_dev,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
unsigned int pad,
enum v4l2_subdev_format_whence which)
{
- struct v4l2_subdev_state *state;
- state = kzalloc(sizeof(*state), GFP_KERNEL);
if (which == V4L2_SUBDEV_FORMAT_TRY)
return v4l2_subdev_get_try_format(&isp_dev->subdev, state, pad);
}
static void isp_try_format(struct stf_isp_dev *isp_dev,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
unsigned int pad,
struct v4l2_mbus_framefmt *fmt,
enum v4l2_subdev_format_whence which)
case STF_ISP_PAD_SRC:
- *fmt = *__isp_get_format(isp_dev, cfg, STF_ISP_PAD_SINK, which);
+ *fmt = *__isp_get_format(isp_dev, state, STF_ISP_PAD_SINK, which);
break;
}
} else {
struct v4l2_mbus_framefmt *sink_fmt;
- sink_fmt = __isp_get_format(isp_dev, state->pads, STF_ISP_PAD_SINK,
+ sink_fmt = __isp_get_format(isp_dev, state, STF_ISP_PAD_SINK,
code->which);
code->code = sink_fmt->code;
format.code = fse->code;
format.width = 1;
format.height = 1;
- isp_try_format(isp_dev, state->pads, fse->pad, &format, fse->which);
+ isp_try_format(isp_dev, state, fse->pad, &format, fse->which);
fse->min_width = format.width;
fse->min_height = format.height;
format.code = fse->code;
format.width = -1;
format.height = -1;
- isp_try_format(isp_dev, state->pads, fse->pad, &format, fse->which);
+ isp_try_format(isp_dev, state, fse->pad, &format, fse->which);
fse->max_width = format.width;
fse->max_height = format.height;
struct stf_isp_dev *isp_dev = v4l2_get_subdevdata(sd);
struct v4l2_mbus_framefmt *format;
- format = __isp_get_format(isp_dev, state->pads, fmt->pad, fmt->which);
+ format = __isp_get_format(isp_dev, state, fmt->pad, fmt->which);
if (format == NULL)
return -EINVAL;
struct stf_isp_dev *isp_dev = v4l2_get_subdevdata(sd);
struct v4l2_mbus_framefmt *format;
- format = __isp_get_format(isp_dev, state->pads, fmt->pad, fmt->which);
+ format = __isp_get_format(isp_dev, state, fmt->pad, fmt->which);
if (format == NULL)
return -EINVAL;
- isp_try_format(isp_dev, state->pads, fmt->pad, &fmt->format, fmt->which);
+ isp_try_format(isp_dev, state, fmt->pad, &fmt->format, fmt->which);
*format = fmt->format;
/* Propagate the format from sink to source */
struct v4l2_subdev_selection sel = { 0 };
int ret;
- format = __isp_get_format(isp_dev, state->pads, STF_ISP_PAD_SRC,
+ format = __isp_get_format(isp_dev, state, STF_ISP_PAD_SRC,
fmt->which);
*format = fmt->format;
- isp_try_format(isp_dev, state->pads, STF_ISP_PAD_SRC, format,
+ isp_try_format(isp_dev, state, STF_ISP_PAD_SRC, format,
fmt->which);
/* Reset sink pad compose selection */
}
static void isp_try_compose(struct stf_isp_dev *isp_dev,
- struct v4l2_subdev_pad_config *cfg,
+ struct v4l2_subdev_state *state,
struct v4l2_rect *rect,
enum v4l2_subdev_format_whence which)
{
struct v4l2_mbus_framefmt *fmt;
- fmt = __isp_get_format(isp_dev, cfg, STF_ISP_PAD_SINK, which);
+ fmt = __isp_get_format(isp_dev, state, STF_ISP_PAD_SINK, which);
if (rect->width > fmt->width)
rect->width = fmt->width;
if (rect == NULL)
return -EINVAL;
- isp_try_compose(isp_dev, state->pads, &sel->r, sel->which);
+ isp_try_compose(isp_dev, state, &sel->r, sel->which);
*rect = sel->r;
/* Reset source crop selection */