|
@@ -112,16 +112,16 @@ static const struct isprsz_coef filter_coefs = {
|
|
* __resizer_get_format - helper function for getting resizer format
|
|
* __resizer_get_format - helper function for getting resizer format
|
|
* @res : pointer to resizer private structure
|
|
* @res : pointer to resizer private structure
|
|
* @pad : pad number
|
|
* @pad : pad number
|
|
- * @fh : V4L2 subdev file handle
|
|
|
|
|
|
+ * @cfg: V4L2 subdev pad configuration
|
|
* @which : wanted subdev format
|
|
* @which : wanted subdev format
|
|
* return zero
|
|
* return zero
|
|
*/
|
|
*/
|
|
static struct v4l2_mbus_framefmt *
|
|
static struct v4l2_mbus_framefmt *
|
|
-__resizer_get_format(struct isp_res_device *res, struct v4l2_subdev_fh *fh,
|
|
|
|
|
|
+__resizer_get_format(struct isp_res_device *res, struct v4l2_subdev_pad_config *cfg,
|
|
unsigned int pad, enum v4l2_subdev_format_whence which)
|
|
unsigned int pad, enum v4l2_subdev_format_whence which)
|
|
{
|
|
{
|
|
if (which == V4L2_SUBDEV_FORMAT_TRY)
|
|
if (which == V4L2_SUBDEV_FORMAT_TRY)
|
|
- return v4l2_subdev_get_try_format(fh, pad);
|
|
|
|
|
|
+ return v4l2_subdev_get_try_format(&res->subdev, cfg, pad);
|
|
else
|
|
else
|
|
return &res->formats[pad];
|
|
return &res->formats[pad];
|
|
}
|
|
}
|
|
@@ -129,15 +129,15 @@ __resizer_get_format(struct isp_res_device *res, struct v4l2_subdev_fh *fh,
|
|
/*
|
|
/*
|
|
* __resizer_get_crop - helper function for getting resizer crop rectangle
|
|
* __resizer_get_crop - helper function for getting resizer crop rectangle
|
|
* @res : pointer to resizer private structure
|
|
* @res : pointer to resizer private structure
|
|
- * @fh : V4L2 subdev file handle
|
|
|
|
|
|
+ * @cfg: V4L2 subdev pad configuration
|
|
* @which : wanted subdev crop rectangle
|
|
* @which : wanted subdev crop rectangle
|
|
*/
|
|
*/
|
|
static struct v4l2_rect *
|
|
static struct v4l2_rect *
|
|
-__resizer_get_crop(struct isp_res_device *res, struct v4l2_subdev_fh *fh,
|
|
|
|
|
|
+__resizer_get_crop(struct isp_res_device *res, struct v4l2_subdev_pad_config *cfg,
|
|
enum v4l2_subdev_format_whence which)
|
|
enum v4l2_subdev_format_whence which)
|
|
{
|
|
{
|
|
if (which == V4L2_SUBDEV_FORMAT_TRY)
|
|
if (which == V4L2_SUBDEV_FORMAT_TRY)
|
|
- return v4l2_subdev_get_try_crop(fh, RESZ_PAD_SINK);
|
|
|
|
|
|
+ return v4l2_subdev_get_try_crop(&res->subdev, cfg, RESZ_PAD_SINK);
|
|
else
|
|
else
|
|
return &res->crop.request;
|
|
return &res->crop.request;
|
|
}
|
|
}
|
|
@@ -1215,7 +1215,7 @@ static void resizer_try_crop(const struct v4l2_mbus_framefmt *sink,
|
|
/*
|
|
/*
|
|
* resizer_get_selection - Retrieve a selection rectangle on a pad
|
|
* resizer_get_selection - Retrieve a selection rectangle on a pad
|
|
* @sd: ISP resizer V4L2 subdevice
|
|
* @sd: ISP resizer V4L2 subdevice
|
|
- * @fh: V4L2 subdev file handle
|
|
|
|
|
|
+ * @cfg: V4L2 subdev pad configuration
|
|
* @sel: Selection rectangle
|
|
* @sel: Selection rectangle
|
|
*
|
|
*
|
|
* The only supported rectangles are the crop rectangles on the sink pad.
|
|
* The only supported rectangles are the crop rectangles on the sink pad.
|
|
@@ -1223,7 +1223,7 @@ static void resizer_try_crop(const struct v4l2_mbus_framefmt *sink,
|
|
* Return 0 on success or a negative error code otherwise.
|
|
* Return 0 on success or a negative error code otherwise.
|
|
*/
|
|
*/
|
|
static int resizer_get_selection(struct v4l2_subdev *sd,
|
|
static int resizer_get_selection(struct v4l2_subdev *sd,
|
|
- struct v4l2_subdev_fh *fh,
|
|
|
|
|
|
+ struct v4l2_subdev_pad_config *cfg,
|
|
struct v4l2_subdev_selection *sel)
|
|
struct v4l2_subdev_selection *sel)
|
|
{
|
|
{
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
@@ -1234,9 +1234,9 @@ static int resizer_get_selection(struct v4l2_subdev *sd,
|
|
if (sel->pad != RESZ_PAD_SINK)
|
|
if (sel->pad != RESZ_PAD_SINK)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
- format_sink = __resizer_get_format(res, fh, RESZ_PAD_SINK,
|
|
|
|
|
|
+ format_sink = __resizer_get_format(res, cfg, RESZ_PAD_SINK,
|
|
sel->which);
|
|
sel->which);
|
|
- format_source = __resizer_get_format(res, fh, RESZ_PAD_SOURCE,
|
|
|
|
|
|
+ format_source = __resizer_get_format(res, cfg, RESZ_PAD_SOURCE,
|
|
sel->which);
|
|
sel->which);
|
|
|
|
|
|
switch (sel->target) {
|
|
switch (sel->target) {
|
|
@@ -1251,7 +1251,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,
|
|
break;
|
|
break;
|
|
|
|
|
|
case V4L2_SEL_TGT_CROP:
|
|
case V4L2_SEL_TGT_CROP:
|
|
- sel->r = *__resizer_get_crop(res, fh, sel->which);
|
|
|
|
|
|
+ sel->r = *__resizer_get_crop(res, cfg, sel->which);
|
|
resizer_calc_ratios(res, &sel->r, format_source, &ratio);
|
|
resizer_calc_ratios(res, &sel->r, format_source, &ratio);
|
|
break;
|
|
break;
|
|
|
|
|
|
@@ -1265,7 +1265,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,
|
|
/*
|
|
/*
|
|
* resizer_set_selection - Set a selection rectangle on a pad
|
|
* resizer_set_selection - Set a selection rectangle on a pad
|
|
* @sd: ISP resizer V4L2 subdevice
|
|
* @sd: ISP resizer V4L2 subdevice
|
|
- * @fh: V4L2 subdev file handle
|
|
|
|
|
|
+ * @cfg: V4L2 subdev pad configuration
|
|
* @sel: Selection rectangle
|
|
* @sel: Selection rectangle
|
|
*
|
|
*
|
|
* The only supported rectangle is the actual crop rectangle on the sink pad.
|
|
* The only supported rectangle is the actual crop rectangle on the sink pad.
|
|
@@ -1276,7 +1276,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,
|
|
* Return 0 on success or a negative error code otherwise.
|
|
* Return 0 on success or a negative error code otherwise.
|
|
*/
|
|
*/
|
|
static int resizer_set_selection(struct v4l2_subdev *sd,
|
|
static int resizer_set_selection(struct v4l2_subdev *sd,
|
|
- struct v4l2_subdev_fh *fh,
|
|
|
|
|
|
+ struct v4l2_subdev_pad_config *cfg,
|
|
struct v4l2_subdev_selection *sel)
|
|
struct v4l2_subdev_selection *sel)
|
|
{
|
|
{
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
@@ -1290,9 +1290,9 @@ static int resizer_set_selection(struct v4l2_subdev *sd,
|
|
sel->pad != RESZ_PAD_SINK)
|
|
sel->pad != RESZ_PAD_SINK)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
- format_sink = __resizer_get_format(res, fh, RESZ_PAD_SINK,
|
|
|
|
|
|
+ format_sink = __resizer_get_format(res, cfg, RESZ_PAD_SINK,
|
|
sel->which);
|
|
sel->which);
|
|
- format_source = *__resizer_get_format(res, fh, RESZ_PAD_SOURCE,
|
|
|
|
|
|
+ format_source = *__resizer_get_format(res, cfg, RESZ_PAD_SOURCE,
|
|
sel->which);
|
|
sel->which);
|
|
|
|
|
|
dev_dbg(isp->dev, "%s(%s): req %ux%u -> (%d,%d)/%ux%u -> %ux%u\n",
|
|
dev_dbg(isp->dev, "%s(%s): req %ux%u -> (%d,%d)/%ux%u -> %ux%u\n",
|
|
@@ -1310,7 +1310,7 @@ static int resizer_set_selection(struct v4l2_subdev *sd,
|
|
* stored the mangled rectangle.
|
|
* stored the mangled rectangle.
|
|
*/
|
|
*/
|
|
resizer_try_crop(format_sink, &format_source, &sel->r);
|
|
resizer_try_crop(format_sink, &format_source, &sel->r);
|
|
- *__resizer_get_crop(res, fh, sel->which) = sel->r;
|
|
|
|
|
|
+ *__resizer_get_crop(res, cfg, sel->which) = sel->r;
|
|
resizer_calc_ratios(res, &sel->r, &format_source, &ratio);
|
|
resizer_calc_ratios(res, &sel->r, &format_source, &ratio);
|
|
|
|
|
|
dev_dbg(isp->dev, "%s(%s): got %ux%u -> (%d,%d)/%ux%u -> %ux%u\n",
|
|
dev_dbg(isp->dev, "%s(%s): got %ux%u -> (%d,%d)/%ux%u -> %ux%u\n",
|
|
@@ -1320,7 +1320,7 @@ static int resizer_set_selection(struct v4l2_subdev *sd,
|
|
format_source.width, format_source.height);
|
|
format_source.width, format_source.height);
|
|
|
|
|
|
if (sel->which == V4L2_SUBDEV_FORMAT_TRY) {
|
|
if (sel->which == V4L2_SUBDEV_FORMAT_TRY) {
|
|
- *__resizer_get_format(res, fh, RESZ_PAD_SOURCE, sel->which) =
|
|
|
|
|
|
+ *__resizer_get_format(res, cfg, RESZ_PAD_SOURCE, sel->which) =
|
|
format_source;
|
|
format_source;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
@@ -1331,7 +1331,7 @@ static int resizer_set_selection(struct v4l2_subdev *sd,
|
|
*/
|
|
*/
|
|
spin_lock_irqsave(&res->lock, flags);
|
|
spin_lock_irqsave(&res->lock, flags);
|
|
|
|
|
|
- *__resizer_get_format(res, fh, RESZ_PAD_SOURCE, sel->which) =
|
|
|
|
|
|
+ *__resizer_get_format(res, cfg, RESZ_PAD_SOURCE, sel->which) =
|
|
format_source;
|
|
format_source;
|
|
|
|
|
|
res->ratio = ratio;
|
|
res->ratio = ratio;
|
|
@@ -1368,13 +1368,13 @@ static unsigned int resizer_max_in_width(struct isp_res_device *res)
|
|
/*
|
|
/*
|
|
* resizer_try_format - Handle try format by pad subdev method
|
|
* resizer_try_format - Handle try format by pad subdev method
|
|
* @res : ISP resizer device
|
|
* @res : ISP resizer device
|
|
- * @fh : V4L2 subdev file handle
|
|
|
|
|
|
+ * @cfg: V4L2 subdev pad configuration
|
|
* @pad : pad num
|
|
* @pad : pad num
|
|
* @fmt : pointer to v4l2 format structure
|
|
* @fmt : pointer to v4l2 format structure
|
|
* @which : wanted subdev format
|
|
* @which : wanted subdev format
|
|
*/
|
|
*/
|
|
static void resizer_try_format(struct isp_res_device *res,
|
|
static void resizer_try_format(struct isp_res_device *res,
|
|
- struct v4l2_subdev_fh *fh, unsigned int pad,
|
|
|
|
|
|
+ struct v4l2_subdev_pad_config *cfg, unsigned int pad,
|
|
struct v4l2_mbus_framefmt *fmt,
|
|
struct v4l2_mbus_framefmt *fmt,
|
|
enum v4l2_subdev_format_whence which)
|
|
enum v4l2_subdev_format_whence which)
|
|
{
|
|
{
|
|
@@ -1395,10 +1395,10 @@ static void resizer_try_format(struct isp_res_device *res,
|
|
break;
|
|
break;
|
|
|
|
|
|
case RESZ_PAD_SOURCE:
|
|
case RESZ_PAD_SOURCE:
|
|
- format = __resizer_get_format(res, fh, RESZ_PAD_SINK, which);
|
|
|
|
|
|
+ format = __resizer_get_format(res, cfg, RESZ_PAD_SINK, which);
|
|
fmt->code = format->code;
|
|
fmt->code = format->code;
|
|
|
|
|
|
- crop = *__resizer_get_crop(res, fh, which);
|
|
|
|
|
|
+ crop = *__resizer_get_crop(res, cfg, which);
|
|
resizer_calc_ratios(res, &crop, fmt, &ratio);
|
|
resizer_calc_ratios(res, &crop, fmt, &ratio);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1410,12 +1410,12 @@ static void resizer_try_format(struct isp_res_device *res,
|
|
/*
|
|
/*
|
|
* resizer_enum_mbus_code - Handle pixel format enumeration
|
|
* resizer_enum_mbus_code - Handle pixel format enumeration
|
|
* @sd : pointer to v4l2 subdev structure
|
|
* @sd : pointer to v4l2 subdev structure
|
|
- * @fh : V4L2 subdev file handle
|
|
|
|
|
|
+ * @cfg: V4L2 subdev pad configuration
|
|
* @code : pointer to v4l2_subdev_mbus_code_enum structure
|
|
* @code : pointer to v4l2_subdev_mbus_code_enum structure
|
|
* return -EINVAL or zero on success
|
|
* return -EINVAL or zero on success
|
|
*/
|
|
*/
|
|
static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
|
|
static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
|
|
- struct v4l2_subdev_fh *fh,
|
|
|
|
|
|
+ struct v4l2_subdev_pad_config *cfg,
|
|
struct v4l2_subdev_mbus_code_enum *code)
|
|
struct v4l2_subdev_mbus_code_enum *code)
|
|
{
|
|
{
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
@@ -1430,7 +1430,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
|
|
if (code->index != 0)
|
|
if (code->index != 0)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
- format = __resizer_get_format(res, fh, RESZ_PAD_SINK,
|
|
|
|
|
|
+ format = __resizer_get_format(res, cfg, RESZ_PAD_SINK,
|
|
V4L2_SUBDEV_FORMAT_TRY);
|
|
V4L2_SUBDEV_FORMAT_TRY);
|
|
code->code = format->code;
|
|
code->code = format->code;
|
|
}
|
|
}
|
|
@@ -1439,7 +1439,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
|
|
}
|
|
}
|
|
|
|
|
|
static int resizer_enum_frame_size(struct v4l2_subdev *sd,
|
|
static int resizer_enum_frame_size(struct v4l2_subdev *sd,
|
|
- struct v4l2_subdev_fh *fh,
|
|
|
|
|
|
+ struct v4l2_subdev_pad_config *cfg,
|
|
struct v4l2_subdev_frame_size_enum *fse)
|
|
struct v4l2_subdev_frame_size_enum *fse)
|
|
{
|
|
{
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
@@ -1451,7 +1451,7 @@ static int resizer_enum_frame_size(struct v4l2_subdev *sd,
|
|
format.code = fse->code;
|
|
format.code = fse->code;
|
|
format.width = 1;
|
|
format.width = 1;
|
|
format.height = 1;
|
|
format.height = 1;
|
|
- resizer_try_format(res, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
|
|
|
|
|
|
+ resizer_try_format(res, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
|
|
fse->min_width = format.width;
|
|
fse->min_width = format.width;
|
|
fse->min_height = format.height;
|
|
fse->min_height = format.height;
|
|
|
|
|
|
@@ -1461,7 +1461,7 @@ static int resizer_enum_frame_size(struct v4l2_subdev *sd,
|
|
format.code = fse->code;
|
|
format.code = fse->code;
|
|
format.width = -1;
|
|
format.width = -1;
|
|
format.height = -1;
|
|
format.height = -1;
|
|
- resizer_try_format(res, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
|
|
|
|
|
|
+ resizer_try_format(res, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
|
|
fse->max_width = format.width;
|
|
fse->max_width = format.width;
|
|
fse->max_height = format.height;
|
|
fse->max_height = format.height;
|
|
|
|
|
|
@@ -1471,17 +1471,17 @@ static int resizer_enum_frame_size(struct v4l2_subdev *sd,
|
|
/*
|
|
/*
|
|
* resizer_get_format - Handle get format by pads subdev method
|
|
* resizer_get_format - Handle get format by pads subdev method
|
|
* @sd : pointer to v4l2 subdev structure
|
|
* @sd : pointer to v4l2 subdev structure
|
|
- * @fh : V4L2 subdev file handle
|
|
|
|
|
|
+ * @cfg: V4L2 subdev pad configuration
|
|
* @fmt : pointer to v4l2 subdev format structure
|
|
* @fmt : pointer to v4l2 subdev format structure
|
|
* return -EINVAL or zero on success
|
|
* return -EINVAL or zero on success
|
|
*/
|
|
*/
|
|
-static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
|
|
|
|
|
|
+static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
|
|
struct v4l2_subdev_format *fmt)
|
|
struct v4l2_subdev_format *fmt)
|
|
{
|
|
{
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
struct v4l2_mbus_framefmt *format;
|
|
struct v4l2_mbus_framefmt *format;
|
|
|
|
|
|
- format = __resizer_get_format(res, fh, fmt->pad, fmt->which);
|
|
|
|
|
|
+ format = __resizer_get_format(res, cfg, fmt->pad, fmt->which);
|
|
if (format == NULL)
|
|
if (format == NULL)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
@@ -1492,37 +1492,37 @@ static int resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
|
|
/*
|
|
/*
|
|
* resizer_set_format - Handle set format by pads subdev method
|
|
* resizer_set_format - Handle set format by pads subdev method
|
|
* @sd : pointer to v4l2 subdev structure
|
|
* @sd : pointer to v4l2 subdev structure
|
|
- * @fh : V4L2 subdev file handle
|
|
|
|
|
|
+ * @cfg: V4L2 subdev pad configuration
|
|
* @fmt : pointer to v4l2 subdev format structure
|
|
* @fmt : pointer to v4l2 subdev format structure
|
|
* return -EINVAL or zero on success
|
|
* return -EINVAL or zero on success
|
|
*/
|
|
*/
|
|
-static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
|
|
|
|
|
|
+static int resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
|
|
struct v4l2_subdev_format *fmt)
|
|
struct v4l2_subdev_format *fmt)
|
|
{
|
|
{
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
struct isp_res_device *res = v4l2_get_subdevdata(sd);
|
|
struct v4l2_mbus_framefmt *format;
|
|
struct v4l2_mbus_framefmt *format;
|
|
struct v4l2_rect *crop;
|
|
struct v4l2_rect *crop;
|
|
|
|
|
|
- format = __resizer_get_format(res, fh, fmt->pad, fmt->which);
|
|
|
|
|
|
+ format = __resizer_get_format(res, cfg, fmt->pad, fmt->which);
|
|
if (format == NULL)
|
|
if (format == NULL)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
- resizer_try_format(res, fh, fmt->pad, &fmt->format, fmt->which);
|
|
|
|
|
|
+ resizer_try_format(res, cfg, fmt->pad, &fmt->format, fmt->which);
|
|
*format = fmt->format;
|
|
*format = fmt->format;
|
|
|
|
|
|
if (fmt->pad == RESZ_PAD_SINK) {
|
|
if (fmt->pad == RESZ_PAD_SINK) {
|
|
/* reset crop rectangle */
|
|
/* reset crop rectangle */
|
|
- crop = __resizer_get_crop(res, fh, fmt->which);
|
|
|
|
|
|
+ crop = __resizer_get_crop(res, cfg, fmt->which);
|
|
crop->left = 0;
|
|
crop->left = 0;
|
|
crop->top = 0;
|
|
crop->top = 0;
|
|
crop->width = fmt->format.width;
|
|
crop->width = fmt->format.width;
|
|
crop->height = fmt->format.height;
|
|
crop->height = fmt->format.height;
|
|
|
|
|
|
/* Propagate the format from sink to source */
|
|
/* Propagate the format from sink to source */
|
|
- format = __resizer_get_format(res, fh, RESZ_PAD_SOURCE,
|
|
|
|
|
|
+ format = __resizer_get_format(res, cfg, RESZ_PAD_SOURCE,
|
|
fmt->which);
|
|
fmt->which);
|
|
*format = fmt->format;
|
|
*format = fmt->format;
|
|
- resizer_try_format(res, fh, RESZ_PAD_SOURCE, format,
|
|
|
|
|
|
+ resizer_try_format(res, cfg, RESZ_PAD_SOURCE, format,
|
|
fmt->which);
|
|
fmt->which);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1573,7 +1573,7 @@ static int resizer_init_formats(struct v4l2_subdev *sd,
|
|
format.format.code = MEDIA_BUS_FMT_YUYV8_1X16;
|
|
format.format.code = MEDIA_BUS_FMT_YUYV8_1X16;
|
|
format.format.width = 4096;
|
|
format.format.width = 4096;
|
|
format.format.height = 4096;
|
|
format.format.height = 4096;
|
|
- resizer_set_format(sd, fh, &format);
|
|
|
|
|
|
+ resizer_set_format(sd, fh ? fh->pad : NULL, &format);
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|