aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2012-05-18 08:31:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 19:15:48 -0400
commit5689b28890f4a7c4e12290dbf2c29a9d23047335 (patch)
treea7df462fdb85c8d59dd1713a184a9d3f39e53e7e
parent1ec0ed083988ae433305d7f4158fda8c3a1a23b9 (diff)
[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: Sakari Ailus <sakari.ailus@iki.fi> Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Acked-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/video/omap3isp/ispccdc.c6
-rw-r--r--drivers/media/video/omap3isp/isppreview.c6
-rw-r--r--drivers/media/video/omap3isp/ispresizer.c6
-rw-r--r--drivers/media/video/s5p-fimc/fimc-capture.c18
-rw-r--r--drivers/media/video/s5p-fimc/fimc-lite.c11
-rw-r--r--drivers/media/video/smiapp/smiapp-core.c30
-rw-r--r--drivers/media/video/v4l2-subdev.c4
-rw-r--r--include/linux/v4l2-common.h57
-rw-r--r--include/linux/v4l2-subdev.h19
-rw-r--r--include/linux/videodev2.h25
10 files changed, 103 insertions, 79 deletions
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index f19774f8396a..82df7a06dc36 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -2014,7 +2014,7 @@ static int ccdc_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
2014 return -EINVAL; 2014 return -EINVAL;
2015 2015
2016 switch (sel->target) { 2016 switch (sel->target) {
2017 case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS: 2017 case V4L2_SEL_TGT_CROP_BOUNDS:
2018 sel->r.left = 0; 2018 sel->r.left = 0;
2019 sel->r.top = 0; 2019 sel->r.top = 0;
2020 sel->r.width = INT_MAX; 2020 sel->r.width = INT_MAX;
@@ -2024,7 +2024,7 @@ static int ccdc_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
2024 ccdc_try_crop(ccdc, format, &sel->r); 2024 ccdc_try_crop(ccdc, format, &sel->r);
2025 break; 2025 break;
2026 2026
2027 case V4L2_SUBDEV_SEL_TGT_CROP: 2027 case V4L2_SEL_TGT_CROP:
2028 sel->r = *__ccdc_get_crop(ccdc, fh, sel->which); 2028 sel->r = *__ccdc_get_crop(ccdc, fh, sel->which);
2029 break; 2029 break;
2030 2030
@@ -2052,7 +2052,7 @@ static int ccdc_set_selection(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
2052 struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd); 2052 struct isp_ccdc_device *ccdc = v4l2_get_subdevdata(sd);
2053 struct v4l2_mbus_framefmt *format; 2053 struct v4l2_mbus_framefmt *format;
2054 2054
2055 if (sel->target != V4L2_SUBDEV_SEL_TGT_CROP || 2055 if (sel->target != V4L2_SEL_TGT_CROP ||
2056 sel->pad != CCDC_PAD_SOURCE_OF) 2056 sel->pad != CCDC_PAD_SOURCE_OF)
2057 return -EINVAL; 2057 return -EINVAL;
2058 2058
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c
index 1086f6a9ff76..6fa70f4e8ea4 100644
--- a/drivers/media/video/omap3isp/isppreview.c
+++ b/drivers/media/video/omap3isp/isppreview.c
@@ -1949,7 +1949,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,
1949 return -EINVAL; 1949 return -EINVAL;
1950 1950
1951 switch (sel->target) { 1951 switch (sel->target) {
1952 case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS: 1952 case V4L2_SEL_TGT_CROP_BOUNDS:
1953 sel->r.left = 0; 1953 sel->r.left = 0;
1954 sel->r.top = 0; 1954 sel->r.top = 0;
1955 sel->r.width = INT_MAX; 1955 sel->r.width = INT_MAX;
@@ -1960,7 +1960,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,
1960 preview_try_crop(prev, format, &sel->r); 1960 preview_try_crop(prev, format, &sel->r);
1961 break; 1961 break;
1962 1962
1963 case V4L2_SUBDEV_SEL_TGT_CROP: 1963 case V4L2_SEL_TGT_CROP:
1964 sel->r = *__preview_get_crop(prev, fh, sel->which); 1964 sel->r = *__preview_get_crop(prev, fh, sel->which);
1965 break; 1965 break;
1966 1966
@@ -1988,7 +1988,7 @@ static int preview_set_selection(struct v4l2_subdev *sd,
1988 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); 1988 struct isp_prev_device *prev = v4l2_get_subdevdata(sd);
1989 struct v4l2_mbus_framefmt *format; 1989 struct v4l2_mbus_framefmt *format;
1990 1990
1991 if (sel->target != V4L2_SUBDEV_SEL_TGT_CROP || 1991 if (sel->target != V4L2_SEL_TGT_CROP ||
1992 sel->pad != PREV_PAD_SINK) 1992 sel->pad != PREV_PAD_SINK)
1993 return -EINVAL; 1993 return -EINVAL;
1994 1994
diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c
index 945665295571..ae17d917f77b 100644
--- a/drivers/media/video/omap3isp/ispresizer.c
+++ b/drivers/media/video/omap3isp/ispresizer.c
@@ -1249,7 +1249,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,
1249 sel->which); 1249 sel->which);
1250 1250
1251 switch (sel->target) { 1251 switch (sel->target) {
1252 case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS: 1252 case V4L2_SEL_TGT_CROP_BOUNDS:
1253 sel->r.left = 0; 1253 sel->r.left = 0;
1254 sel->r.top = 0; 1254 sel->r.top = 0;
1255 sel->r.width = INT_MAX; 1255 sel->r.width = INT_MAX;
@@ -1259,7 +1259,7 @@ static int resizer_get_selection(struct v4l2_subdev *sd,
1259 resizer_calc_ratios(res, &sel->r, format_source, &ratio); 1259 resizer_calc_ratios(res, &sel->r, format_source, &ratio);
1260 break; 1260 break;
1261 1261
1262 case V4L2_SUBDEV_SEL_TGT_CROP: 1262 case V4L2_SEL_TGT_CROP:
1263 sel->r = *__resizer_get_crop(res, fh, sel->which); 1263 sel->r = *__resizer_get_crop(res, fh, sel->which);
1264 resizer_calc_ratios(res, &sel->r, format_source, &ratio); 1264 resizer_calc_ratios(res, &sel->r, format_source, &ratio);
1265 break; 1265 break;
@@ -1293,7 +1293,7 @@ static int resizer_set_selection(struct v4l2_subdev *sd,
1293 struct v4l2_mbus_framefmt *format_sink, *format_source; 1293 struct v4l2_mbus_framefmt *format_sink, *format_source;
1294 struct resizer_ratio ratio; 1294 struct resizer_ratio ratio;
1295 1295
1296 if (sel->target != V4L2_SUBDEV_SEL_TGT_CROP || 1296 if (sel->target != V4L2_SEL_TGT_CROP ||
1297 sel->pad != RESZ_PAD_SINK) 1297 sel->pad != RESZ_PAD_SINK)
1298 return -EINVAL; 1298 return -EINVAL;
1299 1299
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c
index a3cd78d33913..521e3715b9ee 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -1429,9 +1429,9 @@ static int fimc_subdev_get_selection(struct v4l2_subdev *sd,
1429 mutex_lock(&fimc->lock); 1429 mutex_lock(&fimc->lock);
1430 1430
1431 switch (sel->target) { 1431 switch (sel->target) {
1432 case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS: 1432 case V4L2_SEL_TGT_COMPOSE_BOUNDS:
1433 f = &ctx->d_frame; 1433 f = &ctx->d_frame;
1434 case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS: 1434 case V4L2_SEL_TGT_CROP_BOUNDS:
1435 r->width = f->o_width; 1435 r->width = f->o_width;
1436 r->height = f->o_height; 1436 r->height = f->o_height;
1437 r->left = 0; 1437 r->left = 0;
@@ -1439,10 +1439,10 @@ static int fimc_subdev_get_selection(struct v4l2_subdev *sd,
1439 mutex_unlock(&fimc->lock); 1439 mutex_unlock(&fimc->lock);
1440 return 0; 1440 return 0;
1441 1441
1442 case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL: 1442 case V4L2_SEL_TGT_CROP:
1443 try_sel = v4l2_subdev_get_try_crop(fh, sel->pad); 1443 try_sel = v4l2_subdev_get_try_crop(fh, sel->pad);
1444 break; 1444 break;
1445 case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL: 1445 case V4L2_SEL_TGT_COMPOSE:
1446 try_sel = v4l2_subdev_get_try_compose(fh, sel->pad); 1446 try_sel = v4l2_subdev_get_try_compose(fh, sel->pad);
1447 f = &ctx->d_frame; 1447 f = &ctx->d_frame;
1448 break; 1448 break;
@@ -1486,9 +1486,9 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,
1486 fimc_capture_try_selection(ctx, r, V4L2_SEL_TGT_CROP); 1486 fimc_capture_try_selection(ctx, r, V4L2_SEL_TGT_CROP);
1487 1487
1488 switch (sel->target) { 1488 switch (sel->target) {
1489 case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS: 1489 case V4L2_SEL_TGT_COMPOSE_BOUNDS:
1490 f = &ctx->d_frame; 1490 f = &ctx->d_frame;
1491 case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS: 1491 case V4L2_SEL_TGT_CROP_BOUNDS:
1492 r->width = f->o_width; 1492 r->width = f->o_width;
1493 r->height = f->o_height; 1493 r->height = f->o_height;
1494 r->left = 0; 1494 r->left = 0;
@@ -1496,10 +1496,10 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,
1496 mutex_unlock(&fimc->lock); 1496 mutex_unlock(&fimc->lock);
1497 return 0; 1497 return 0;
1498 1498
1499 case V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL: 1499 case V4L2_SEL_TGT_CROP:
1500 try_sel = v4l2_subdev_get_try_crop(fh, sel->pad); 1500 try_sel = v4l2_subdev_get_try_crop(fh, sel->pad);
1501 break; 1501 break;
1502 case V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL: 1502 case V4L2_SEL_TGT_COMPOSE:
1503 try_sel = v4l2_subdev_get_try_compose(fh, sel->pad); 1503 try_sel = v4l2_subdev_get_try_compose(fh, sel->pad);
1504 f = &ctx->d_frame; 1504 f = &ctx->d_frame;
1505 break; 1505 break;
@@ -1515,7 +1515,7 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd,
1515 set_frame_crop(f, r->left, r->top, r->width, r->height); 1515 set_frame_crop(f, r->left, r->top, r->width, r->height);
1516 set_bit(ST_CAPT_APPLY_CFG, &fimc->state); 1516 set_bit(ST_CAPT_APPLY_CFG, &fimc->state);
1517 spin_unlock_irqrestore(&fimc->slock, flags); 1517 spin_unlock_irqrestore(&fimc->slock, flags);
1518 if (sel->target == V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL) 1518 if (sel->target == V4L2_SEL_TGT_COMPOSE)
1519 ctx->state |= FIMC_COMPOSE; 1519 ctx->state |= FIMC_COMPOSE;
1520 } 1520 }
1521 1521
diff --git a/drivers/media/video/s5p-fimc/fimc-lite.c b/drivers/media/video/s5p-fimc/fimc-lite.c
index 52ede56e0758..8785089c4460 100644
--- a/drivers/media/video/s5p-fimc/fimc-lite.c
+++ b/drivers/media/video/s5p-fimc/fimc-lite.c
@@ -1086,9 +1086,9 @@ static int fimc_lite_subdev_get_selection(struct v4l2_subdev *sd,
1086 struct fimc_lite *fimc = v4l2_get_subdevdata(sd); 1086 struct fimc_lite *fimc = v4l2_get_subdevdata(sd);
1087 struct flite_frame *f = &fimc->inp_frame; 1087 struct flite_frame *f = &fimc->inp_frame;
1088 1088
1089 if ((sel->target != V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL && 1089 if ((sel->target != V4L2_SEL_TGT_CROP &&
1090 sel->target != V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS) || 1090 sel->target != V4L2_SEL_TGT_CROP_BOUNDS) ||
1091 sel->pad != FLITE_SD_PAD_SINK) 1091 sel->pad != FLITE_SD_PAD_SINK)
1092 return -EINVAL; 1092 return -EINVAL;
1093 1093
1094 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) { 1094 if (sel->which == V4L2_SUBDEV_FORMAT_TRY) {
@@ -1097,7 +1097,7 @@ static int fimc_lite_subdev_get_selection(struct v4l2_subdev *sd,
1097 } 1097 }
1098 1098
1099 mutex_lock(&fimc->lock); 1099 mutex_lock(&fimc->lock);
1100 if (sel->target == V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL) { 1100 if (sel->target == V4L2_SEL_TGT_CROP) {
1101 sel->r = f->rect; 1101 sel->r = f->rect;
1102 } else { 1102 } else {
1103 sel->r.left = 0; 1103 sel->r.left = 0;
@@ -1122,8 +1122,7 @@ static int fimc_lite_subdev_set_selection(struct v4l2_subdev *sd,
1122 struct flite_frame *f = &fimc->inp_frame; 1122 struct flite_frame *f = &fimc->inp_frame;
1123 int ret = 0; 1123 int ret = 0;
1124 1124
1125 if (sel->target != V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL || 1125 if (sel->target != V4L2_SEL_TGT_CROP || sel->pad != FLITE_SD_PAD_SINK)
1126 sel->pad != FLITE_SD_PAD_SINK)
1127 return -EINVAL; 1126 return -EINVAL;
1128 1127
1129 mutex_lock(&fimc->lock); 1128 mutex_lock(&fimc->lock);
diff --git a/drivers/media/video/smiapp/smiapp-core.c b/drivers/media/video/smiapp/smiapp-core.c
index 37622bb6c667..9bbb5d3f003b 100644
--- a/drivers/media/video/smiapp/smiapp-core.c
+++ b/drivers/media/video/smiapp/smiapp-core.c
@@ -1630,7 +1630,7 @@ static void smiapp_propagate(struct v4l2_subdev *subdev,
1630 smiapp_get_crop_compose(subdev, fh, crops, &comp, which); 1630 smiapp_get_crop_compose(subdev, fh, crops, &comp, which);
1631 1631
1632 switch (target) { 1632 switch (target) {
1633 case V4L2_SUBDEV_SEL_TGT_CROP: 1633 case V4L2_SEL_TGT_CROP:
1634 comp->width = crops[SMIAPP_PAD_SINK]->width; 1634 comp->width = crops[SMIAPP_PAD_SINK]->width;
1635 comp->height = crops[SMIAPP_PAD_SINK]->height; 1635 comp->height = crops[SMIAPP_PAD_SINK]->height;
1636 if (which == V4L2_SUBDEV_FORMAT_ACTIVE) { 1636 if (which == V4L2_SUBDEV_FORMAT_ACTIVE) {
@@ -1646,7 +1646,7 @@ static void smiapp_propagate(struct v4l2_subdev *subdev,
1646 } 1646 }
1647 } 1647 }
1648 /* Fall through */ 1648 /* Fall through */
1649 case V4L2_SUBDEV_SEL_TGT_COMPOSE: 1649 case V4L2_SEL_TGT_COMPOSE:
1650 *crops[SMIAPP_PAD_SRC] = *comp; 1650 *crops[SMIAPP_PAD_SRC] = *comp;
1651 break; 1651 break;
1652 default: 1652 default:
@@ -1722,7 +1722,7 @@ static int smiapp_set_format(struct v4l2_subdev *subdev,
1722 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) 1722 if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE)
1723 ssd->sink_fmt = *crops[ssd->sink_pad]; 1723 ssd->sink_fmt = *crops[ssd->sink_pad];
1724 smiapp_propagate(subdev, fh, fmt->which, 1724 smiapp_propagate(subdev, fh, fmt->which,
1725 V4L2_SUBDEV_SEL_TGT_CROP); 1725 V4L2_SEL_TGT_CROP);
1726 1726
1727 mutex_unlock(&sensor->mutex); 1727 mutex_unlock(&sensor->mutex);
1728 1728
@@ -1957,7 +1957,7 @@ static int smiapp_set_compose(struct v4l2_subdev *subdev,
1957 1957
1958 *comp = sel->r; 1958 *comp = sel->r;
1959 smiapp_propagate(subdev, fh, sel->which, 1959 smiapp_propagate(subdev, fh, sel->which,
1960 V4L2_SUBDEV_SEL_TGT_COMPOSE); 1960 V4L2_SEL_TGT_COMPOSE);
1961 1961
1962 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE) 1962 if (sel->which == V4L2_SUBDEV_FORMAT_ACTIVE)
1963 return smiapp_update_mode(sensor); 1963 return smiapp_update_mode(sensor);
@@ -1973,8 +1973,8 @@ static int __smiapp_sel_supported(struct v4l2_subdev *subdev,
1973 1973
1974 /* We only implement crop in three places. */ 1974 /* We only implement crop in three places. */
1975 switch (sel->target) { 1975 switch (sel->target) {
1976 case V4L2_SUBDEV_SEL_TGT_CROP: 1976 case V4L2_SEL_TGT_CROP:
1977 case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS: 1977 case V4L2_SEL_TGT_CROP_BOUNDS:
1978 if (ssd == sensor->pixel_array 1978 if (ssd == sensor->pixel_array
1979 && sel->pad == SMIAPP_PA_PAD_SRC) 1979 && sel->pad == SMIAPP_PA_PAD_SRC)
1980 return 0; 1980 return 0;
@@ -1987,8 +1987,8 @@ static int __smiapp_sel_supported(struct v4l2_subdev *subdev,
1987 == SMIAPP_DIGITAL_CROP_CAPABILITY_INPUT_CROP) 1987 == SMIAPP_DIGITAL_CROP_CAPABILITY_INPUT_CROP)
1988 return 0; 1988 return 0;
1989 return -EINVAL; 1989 return -EINVAL;
1990 case V4L2_SUBDEV_SEL_TGT_COMPOSE: 1990 case V4L2_SEL_TGT_COMPOSE:
1991 case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS: 1991 case V4L2_SEL_TGT_COMPOSE_BOUNDS:
1992 if (sel->pad == ssd->source_pad) 1992 if (sel->pad == ssd->source_pad)
1993 return -EINVAL; 1993 return -EINVAL;
1994 if (ssd == sensor->binner) 1994 if (ssd == sensor->binner)
@@ -2050,7 +2050,7 @@ static int smiapp_set_crop(struct v4l2_subdev *subdev,
2050 2050
2051 if (ssd != sensor->pixel_array && sel->pad == SMIAPP_PAD_SINK) 2051 if (ssd != sensor->pixel_array && sel->pad == SMIAPP_PAD_SINK)
2052 smiapp_propagate(subdev, fh, sel->which, 2052 smiapp_propagate(subdev, fh, sel->which,
2053 V4L2_SUBDEV_SEL_TGT_CROP); 2053 V4L2_SEL_TGT_CROP);
2054 2054
2055 return 0; 2055 return 0;
2056} 2056}
@@ -2084,7 +2084,7 @@ static int __smiapp_get_selection(struct v4l2_subdev *subdev,
2084 } 2084 }
2085 2085
2086 switch (sel->target) { 2086 switch (sel->target) {
2087 case V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS: 2087 case V4L2_SEL_TGT_CROP_BOUNDS:
2088 if (ssd == sensor->pixel_array) { 2088 if (ssd == sensor->pixel_array) {
2089 sel->r.width = 2089 sel->r.width =
2090 sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1; 2090 sensor->limits[SMIAPP_LIMIT_X_ADDR_MAX] + 1;
@@ -2096,11 +2096,11 @@ static int __smiapp_get_selection(struct v4l2_subdev *subdev,
2096 sel->r = *comp; 2096 sel->r = *comp;
2097 } 2097 }
2098 break; 2098 break;
2099 case V4L2_SUBDEV_SEL_TGT_CROP: 2099 case V4L2_SEL_TGT_CROP:
2100 case V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS: 2100 case V4L2_SEL_TGT_COMPOSE_BOUNDS:
2101 sel->r = *crops[sel->pad]; 2101 sel->r = *crops[sel->pad];
2102 break; 2102 break;
2103 case V4L2_SUBDEV_SEL_TGT_COMPOSE: 2103 case V4L2_SEL_TGT_COMPOSE:
2104 sel->r = *comp; 2104 sel->r = *comp;
2105 break; 2105 break;
2106 } 2106 }
@@ -2147,10 +2147,10 @@ static int smiapp_set_selection(struct v4l2_subdev *subdev,
2147 sel->r.height); 2147 sel->r.height);
2148 2148
2149 switch (sel->target) { 2149 switch (sel->target) {
2150 case V4L2_SUBDEV_SEL_TGT_CROP: 2150 case V4L2_SEL_TGT_CROP:
2151 ret = smiapp_set_crop(subdev, fh, sel); 2151 ret = smiapp_set_crop(subdev, fh, sel);
2152 break; 2152 break;
2153 case V4L2_SUBDEV_SEL_TGT_COMPOSE: 2153 case V4L2_SEL_TGT_COMPOSE:
2154 ret = smiapp_set_compose(subdev, fh, sel); 2154 ret = smiapp_set_compose(subdev, fh, sel);
2155 break; 2155 break;
2156 default: 2156 default:
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
index cd86f0c3ec74..9182f81deb5b 100644
--- a/drivers/media/video/v4l2-subdev.c
+++ b/drivers/media/video/v4l2-subdev.c
@@ -245,7 +245,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
245 memset(&sel, 0, sizeof(sel)); 245 memset(&sel, 0, sizeof(sel));
246 sel.which = crop->which; 246 sel.which = crop->which;
247 sel.pad = crop->pad; 247 sel.pad = crop->pad;
248 sel.target = V4L2_SUBDEV_SEL_TGT_CROP; 248 sel.target = V4L2_SEL_TGT_CROP;
249 249
250 rval = v4l2_subdev_call( 250 rval = v4l2_subdev_call(
251 sd, pad, get_selection, subdev_fh, &sel); 251 sd, pad, get_selection, subdev_fh, &sel);
@@ -274,7 +274,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
274 memset(&sel, 0, sizeof(sel)); 274 memset(&sel, 0, sizeof(sel));
275 sel.which = crop->which; 275 sel.which = crop->which;
276 sel.pad = crop->pad; 276 sel.pad = crop->pad;
277 sel.target = V4L2_SUBDEV_SEL_TGT_CROP; 277 sel.target = V4L2_SEL_TGT_CROP;
278 sel.r = crop->rect; 278 sel.r = crop->rect;
279 279
280 rval = v4l2_subdev_call( 280 rval = v4l2_subdev_call(
diff --git a/include/linux/v4l2-common.h b/include/linux/v4l2-common.h
new file mode 100644
index 000000000000..e85bf15b5994
--- /dev/null
+++ b/include/linux/v4l2-common.h
@@ -0,0 +1,57 @@
1/*
2 * include/linux/v4l2-common.h
3 *
4 * Common V4L2 and V4L2 subdev definitions.
5 *
6 * Users are advised to #include this file either through videodev2.h
7 * (V4L2) or through v4l2-subdev.h (V4L2 subdev) rather than to refer
8 * to this file directly.
9 *
10 * Copyright (C) 2012 Nokia Corporation
11 * Contact: Sakari Ailus <sakari.ailus@iki.fi>
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * version 2 as published by the Free Software Foundation.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
25 * 02110-1301 USA
26 *
27 */
28
29#ifndef __V4L2_COMMON__
30#define __V4L2_COMMON__
31
32/* Selection target definitions */
33
34/* Current cropping area */
35#define V4L2_SEL_TGT_CROP 0x0000
36/* Default cropping area */
37#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
38/* Cropping bounds */
39#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
40/* Current composing area */
41#define V4L2_SEL_TGT_COMPOSE 0x0100
42/* Default composing area */
43#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
44/* Composing bounds */
45#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
46/* Current composing area plus all padding pixels */
47#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
48
49/* Backward compatibility definitions */
50#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP
51#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE
52#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL \
53 V4L2_SEL_TGT_CROP
54#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL \
55 V4L2_SEL_TGT_COMPOSE
56
57#endif /* __V4L2_COMMON__ */
diff --git a/include/linux/v4l2-subdev.h b/include/linux/v4l2-subdev.h
index 3cbe6889fcb5..1d7d45739260 100644
--- a/include/linux/v4l2-subdev.h
+++ b/include/linux/v4l2-subdev.h
@@ -25,6 +25,7 @@
25 25
26#include <linux/ioctl.h> 26#include <linux/ioctl.h>
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/v4l2-common.h>
28#include <linux/v4l2-mediabus.h> 29#include <linux/v4l2-mediabus.h>
29 30
30/** 31/**
@@ -127,27 +128,13 @@ struct v4l2_subdev_frame_interval_enum {
127#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 << 1) 128#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE (1 << 1)
128#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2) 129#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG (1 << 2)
129 130
130/* active cropping area */
131#define V4L2_SUBDEV_SEL_TGT_CROP 0x0000
132/* cropping bounds */
133#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS 0x0002
134/* current composing area */
135#define V4L2_SUBDEV_SEL_TGT_COMPOSE 0x0100
136/* composing bounds */
137#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS 0x0102
138
139/* backward compatibility definitions */
140#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL \
141 V4L2_SUBDEV_SEL_TGT_CROP
142#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL \
143 V4L2_SUBDEV_SEL_TGT_COMPOSE
144
145/** 131/**
146 * struct v4l2_subdev_selection - selection info 132 * struct v4l2_subdev_selection - selection info
147 * 133 *
148 * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY 134 * @which: either V4L2_SUBDEV_FORMAT_ACTIVE or V4L2_SUBDEV_FORMAT_TRY
149 * @pad: pad number, as reported by the media API 135 * @pad: pad number, as reported by the media API
150 * @target: selection target, used to choose one of possible rectangles 136 * @target: Selection target, used to choose one of possible rectangles,
137 * defined in v4l2-common.h; V4L2_SEL_TGT_* .
151 * @flags: constraint flags 138 * @flags: constraint flags
152 * @r: coordinates of the selection window 139 * @r: coordinates of the selection window
153 * @reserved: for future use, set to zero for now 140 * @reserved: for future use, set to zero for now
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index ac1ad33ba3e0..7fdb8710c831 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -64,6 +64,7 @@
64#include <linux/compiler.h> 64#include <linux/compiler.h>
65#include <linux/ioctl.h> 65#include <linux/ioctl.h>
66#include <linux/types.h> 66#include <linux/types.h>
67#include <linux/v4l2-common.h>
67 68
68/* 69/*
69 * Common stuff for both V4L1 and V4L2 70 * Common stuff for both V4L1 and V4L2
@@ -764,31 +765,11 @@ struct v4l2_crop {
764#define V4L2_SEL_FLAG_GE 0x00000001 765#define V4L2_SEL_FLAG_GE 0x00000001
765#define V4L2_SEL_FLAG_LE 0x00000002 766#define V4L2_SEL_FLAG_LE 0x00000002
766 767
767/* Selection targets */
768
769/* Current cropping area */
770#define V4L2_SEL_TGT_CROP 0x0000
771/* Default cropping area */
772#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
773/* Cropping bounds */
774#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
775/* Current composing area */
776#define V4L2_SEL_TGT_COMPOSE 0x0100
777/* Default composing area */
778#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
779/* Composing bounds */
780#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
781/* Current composing area plus all padding pixels */
782#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103
783
784/* Backward compatibility definitions */
785#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP
786#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE
787
788/** 768/**
789 * struct v4l2_selection - selection info 769 * struct v4l2_selection - selection info
790 * @type: buffer type (do not use *_MPLANE types) 770 * @type: buffer type (do not use *_MPLANE types)
791 * @target: selection target, used to choose one of possible rectangles 771 * @target: Selection target, used to choose one of possible rectangles;
772 * defined in v4l2-common.h; V4L2_SEL_TGT_* .
792 * @flags: constraints flags 773 * @flags: constraints flags
793 * @r: coordinates of selection window 774 * @r: coordinates of selection window
794 * @reserved: for future use, rounds structure size to 64 bytes, set to zero 775 * @reserved: for future use, rounds structure size to 64 bytes, set to zero