Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5689b288 authored by Sakari Ailus's avatar Sakari Ailus Committed by Mauro Carvalho Chehab
Browse files

[media] v4l: Unify selection targets across V4L2 and V4L2 subdev interfaces



Change the users of V4L2_SUBDEV_SEL_TGT_* targets to use V4L2_SEL_TGT_*
instead. The common definitions are moved to a new header file,
include/linux/v4l2-common.h.

Signed-off-by: default avatarSakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 1ec0ed08
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -2014,7 +2014,7 @@ static int ccdc_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
		return -EINVAL;

	switch (sel->target) {
	case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS:
	case V4L2_SEL_TGT_CROP_BOUNDS:
		sel->r.left = 0;
		sel->r.top = 0;
		sel->r.width = INT_MAX;
@@ -2024,7 +2024,7 @@ static int ccdc_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
		ccdc_try_crop(ccdc, format, &sel->r);
		break;

	case V4L2_SUBDEV_SEL_TGT_CROP:
	case V4L2_SEL_TGT_CROP:
		sel->r = *__ccdc_get_crop(ccdc, fh, sel->which);
		break;

@@ -2052,7 +2052,7 @@ static int ccdc_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
	struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd);
	struct v4l2_mbus_framefmt *format;

	if (sel->target != V4L2_SUBDEV_SEL_TGT_CROP ||
	if (sel->target != V4L2_SEL_TGT_CROP ||
	    sel->pad != CCDC_PAD_SOURCE_OF)
		return -EINVAL;

+3 −3
Original line number Diff line number Diff line
@@ -1949,7 +1949,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,
		return -EINVAL;

	switch (sel->target) {
	case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS:
	case V4L2_SEL_TGT_CROP_BOUNDS:
		sel->r.left = 0;
		sel->r.top = 0;
		sel->r.width = INT_MAX;
@@ -1960,7 +1960,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,
		preview_try_crop(prev, format, &sel->r);
		break;

	case V4L2_SUBDEV_SEL_TGT_CROP:
	case V4L2_SEL_TGT_CROP:
		sel->r = *__preview_get_crop(prev, fh, sel->which);
		break;

@@ -1988,7 +1988,7 @@ static int preview_set_selection(struct v4l2_subdev *sd,
	struct isp_prev_device *prev = v4l2_get_subdevdata(sd);
	struct v4l2_mbus_framefmt *format;

	if (sel->target != V4L2_SUBDEV_SEL_TGT_CROP ||
	if (sel->target != V4L2_SEL_TGT_CROP ||
	    sel->pad != PREV_PAD_SINK)
		return -EINVAL;

+3 −3
Original line number Diff line number Diff line
@@ -1249,7 +1249,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,
					     sel->which);

	switch (sel->target) {
	case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS:
	case V4L2_SEL_TGT_CROP_BOUNDS:
		sel->r.left = 0;
		sel->r.top = 0;
		sel->r.width = INT_MAX;
@@ -1259,7 +1259,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,
		resizer_calc_ratios(res, &sel->r, format_source, &ratio);
		break;

	case V4L2_SUBDEV_SEL_TGT_CROP:
	case V4L2_SEL_TGT_CROP:
		sel->r = *__resizer_get_crop(res, fh, sel->which);
		resizer_calc_ratios(res, &sel->r, format_source, &ratio);
		break;
@@ -1293,7 +1293,7 @@ static int resizer_set_selection(struct v4l2_subdev *sd,
	struct v4l2_mbus_framefmt *format_sink, *format_source;
	struct resizer_ratio ratio;

	if (sel->target != V4L2_SUBDEV_SEL_TGT_CROP ||
	if (sel->target != V4L2_SEL_TGT_CROP ||
	    sel->pad != RESZ_PAD_SINK)
		return -EINVAL;

+9 −9
Original line number Diff line number Diff line
@@ -1429,9 +1429,9 @@ static int fimc_subdev_get_selection(struct v4l2_subdev *sd,
	mutex_lock(&fimc->lock);

	switch (sel->target) {
	case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS:
	case V4L2_SEL_TGT_COMPOSE_BOUNDS:
		f = &ctx->d_frame;
	case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS:
	case V4L2_SEL_TGT_CROP_BOUNDS:
		r->width = f->o_width;
		r->height = f->o_height;
		r->left = 0;
@@ -1439,10 +1439,10 @@ static int fimc_subdev_get_selection(struct v4l2_subdev *sd,
		mutex_unlock(&fimc->lock);
		return 0;

	case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL:
	case V4L2_SEL_TGT_CROP:
		try_sel = v4l2_subdev_get_try_crop(fh, sel->pad);
		break;
	case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL:
	case V4L2_SEL_TGT_COMPOSE:
		try_sel = v4l2_subdev_get_try_compose(fh, sel->pad);
		f = &ctx->d_frame;
		break;
@@ -1486,9 +1486,9 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,
	fimc_capture_try_selection(ctx, r, V4L2_SEL_TGT_CROP);

	switch (sel->target) {
	case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS:
	case V4L2_SEL_TGT_COMPOSE_BOUNDS:
		f = &ctx->d_frame;
	case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS:
	case V4L2_SEL_TGT_CROP_BOUNDS:
		r->width = f->o_width;
		r->height = f->o_height;
		r->left = 0;
@@ -1496,10 +1496,10 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,
		mutex_unlock(&fimc->lock);
		return 0;

	case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL:
	case V4L2_SEL_TGT_CROP:
		try_sel = v4l2_subdev_get_try_crop(fh, sel->pad);
		break;
	case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL:
	case V4L2_SEL_TGT_COMPOSE:
		try_sel = v4l2_subdev_get_try_compose(fh, sel->pad);
		f = &ctx->d_frame;
		break;
@@ -1515,7 +1515,7 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,
		set_frame_crop(f, r->left, r->top, r->width, r->height);
		set_bit(ST_CAPT_APPLY_CFG, &fimc->state);
		spin_unlock_irqrestore(&fimc->slock, flags);
		if (sel->target == V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL)
		if (sel->target == V4L2_SEL_TGT_COMPOSE)
			ctx->state |= FIMC_COMPOSE;
	}

+5 −6
Original line number Diff line number Diff line
@@ -1086,8 +1086,8 @@ static int fimc_lite_subdev_get_selection(struct v4l2_subdev *sd,
	struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
	struct flite_frame *f = &fimc->inp_frame;

	if ((sel->target != V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL &&
	     sel->target != V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS) ||
	if ((sel->target != V4L2_SEL_TGT_CROP &&
	     sel->target != V4L2_SEL_TGT_CROP_BOUNDS) ||
	     sel->pad != FLITE_SD_PAD_SINK)
		return -EINVAL;

@@ -1097,7 +1097,7 @@ static int fimc_lite_subdev_get_selection(struct v4l2_subdev *sd,
	}

	mutex_lock(&fimc->lock);
	if (sel->target == V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL) {
	if (sel->target == V4L2_SEL_TGT_CROP) {
		sel->r = f->rect;
	} else {
		sel->r.left = 0;
@@ -1122,8 +1122,7 @@ static int fimc_lite_subdev_set_selection(struct v4l2_subdev *sd,
	struct flite_frame *f = &fimc->inp_frame;
	int ret = 0;

	if (sel->target != V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL ||
	    sel->pad != FLITE_SD_PAD_SINK)
	if (sel->target != V4L2_SEL_TGT_CROP || sel->pad != FLITE_SD_PAD_SINK)
		return -EINVAL;

	mutex_lock(&fimc->lock);
Loading