diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-10-23 07:11:55 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-28 07:51:40 -0500 |
commit | e023a11342b6624cc019c8cecfc488882f0721f9 (patch) | |
tree | 8623aa2a5831e06e917d87fea7a58c5469a4b4fd /drivers/media/platform | |
parent | 4feca39b3d9a7480b5e622a0b4a29941c85cdcd2 (diff) |
[media] omap3isp: preview: Add support for 8-bit formats at the sink pad
Support both grayscale (Y8) and Bayer (SBGGR8, SGBRG8, SGRBG8 and
SRGGB8) formats.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r-- | drivers/media/platform/omap3isp/isppreview.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c index 1ae1c0909ed1..691b92a3c3e7 100644 --- a/drivers/media/platform/omap3isp/isppreview.c +++ b/drivers/media/platform/omap3isp/isppreview.c | |||
@@ -200,10 +200,10 @@ static void preview_enable_invalaw(struct isp_prev_device *prev, bool enable) | |||
200 | 200 | ||
201 | if (enable) | 201 | if (enable) |
202 | isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | 202 | isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, |
203 | ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW); | 203 | ISPPRV_PCR_INVALAW); |
204 | else | 204 | else |
205 | isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | 205 | isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, |
206 | ISPPRV_PCR_WIDTH | ISPPRV_PCR_INVALAW); | 206 | ISPPRV_PCR_INVALAW); |
207 | } | 207 | } |
208 | 208 | ||
209 | /* | 209 | /* |
@@ -1014,7 +1014,7 @@ static void preview_config_averager(struct isp_prev_device *prev, u8 average) | |||
1014 | /* | 1014 | /* |
1015 | * preview_config_input_format - Configure the input format | 1015 | * preview_config_input_format - Configure the input format |
1016 | * @prev: The preview engine | 1016 | * @prev: The preview engine |
1017 | * @format: Format on the preview engine sink pad | 1017 | * @info: Sink pad format information |
1018 | * | 1018 | * |
1019 | * Enable and configure CFA interpolation for Bayer formats and disable it for | 1019 | * Enable and configure CFA interpolation for Bayer formats and disable it for |
1020 | * greyscale formats. | 1020 | * greyscale formats. |
@@ -1025,22 +1025,29 @@ static void preview_config_averager(struct isp_prev_device *prev, u8 average) | |||
1025 | * reordered to support non-GRBG Bayer patterns. | 1025 | * reordered to support non-GRBG Bayer patterns. |
1026 | */ | 1026 | */ |
1027 | static void preview_config_input_format(struct isp_prev_device *prev, | 1027 | static void preview_config_input_format(struct isp_prev_device *prev, |
1028 | const struct v4l2_mbus_framefmt *format) | 1028 | const struct isp_format_info *info) |
1029 | { | 1029 | { |
1030 | struct isp_device *isp = to_isp_device(prev); | 1030 | struct isp_device *isp = to_isp_device(prev); |
1031 | struct prev_params *params; | 1031 | struct prev_params *params; |
1032 | 1032 | ||
1033 | switch (format->code) { | 1033 | if (info->width == 8) |
1034 | case V4L2_MBUS_FMT_SGRBG10_1X10: | 1034 | isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, |
1035 | ISPPRV_PCR_WIDTH); | ||
1036 | else | ||
1037 | isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | ||
1038 | ISPPRV_PCR_WIDTH); | ||
1039 | |||
1040 | switch (info->flavor) { | ||
1041 | case V4L2_MBUS_FMT_SGRBG8_1X8: | ||
1035 | prev->params.cfa_order = 0; | 1042 | prev->params.cfa_order = 0; |
1036 | break; | 1043 | break; |
1037 | case V4L2_MBUS_FMT_SRGGB10_1X10: | 1044 | case V4L2_MBUS_FMT_SRGGB8_1X8: |
1038 | prev->params.cfa_order = 1; | 1045 | prev->params.cfa_order = 1; |
1039 | break; | 1046 | break; |
1040 | case V4L2_MBUS_FMT_SBGGR10_1X10: | 1047 | case V4L2_MBUS_FMT_SBGGR8_1X8: |
1041 | prev->params.cfa_order = 2; | 1048 | prev->params.cfa_order = 2; |
1042 | break; | 1049 | break; |
1043 | case V4L2_MBUS_FMT_SGBRG10_1X10: | 1050 | case V4L2_MBUS_FMT_SGBRG8_1X8: |
1044 | prev->params.cfa_order = 3; | 1051 | prev->params.cfa_order = 3; |
1045 | break; | 1052 | break; |
1046 | default: | 1053 | default: |
@@ -1081,7 +1088,8 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active) | |||
1081 | unsigned int elv = prev->crop.top + prev->crop.height - 1; | 1088 | unsigned int elv = prev->crop.top + prev->crop.height - 1; |
1082 | u32 features; | 1089 | u32 features; |
1083 | 1090 | ||
1084 | if (format->code != V4L2_MBUS_FMT_Y10_1X10) { | 1091 | if (format->code != V4L2_MBUS_FMT_Y8_1X8 && |
1092 | format->code != V4L2_MBUS_FMT_Y10_1X10) { | ||
1085 | sph -= 2; | 1093 | sph -= 2; |
1086 | eph += 2; | 1094 | eph += 2; |
1087 | slv -= 2; | 1095 | slv -= 2; |
@@ -1389,6 +1397,7 @@ static unsigned int preview_max_out_width(struct isp_prev_device *prev) | |||
1389 | static void preview_configure(struct isp_prev_device *prev) | 1397 | static void preview_configure(struct isp_prev_device *prev) |
1390 | { | 1398 | { |
1391 | struct isp_device *isp = to_isp_device(prev); | 1399 | struct isp_device *isp = to_isp_device(prev); |
1400 | const struct isp_format_info *info; | ||
1392 | struct v4l2_mbus_framefmt *format; | 1401 | struct v4l2_mbus_framefmt *format; |
1393 | unsigned long flags; | 1402 | unsigned long flags; |
1394 | u32 update; | 1403 | u32 update; |
@@ -1402,17 +1411,18 @@ static void preview_configure(struct isp_prev_device *prev) | |||
1402 | 1411 | ||
1403 | /* PREV_PAD_SINK */ | 1412 | /* PREV_PAD_SINK */ |
1404 | format = &prev->formats[PREV_PAD_SINK]; | 1413 | format = &prev->formats[PREV_PAD_SINK]; |
1414 | info = omap3isp_video_format_info(format->code); | ||
1405 | 1415 | ||
1406 | preview_adjust_bandwidth(prev); | 1416 | preview_adjust_bandwidth(prev); |
1407 | 1417 | ||
1408 | preview_config_input_format(prev, format); | 1418 | preview_config_input_format(prev, info); |
1409 | preview_config_input_size(prev, active); | 1419 | preview_config_input_size(prev, active); |
1410 | 1420 | ||
1411 | if (prev->input == PREVIEW_INPUT_CCDC) | 1421 | if (prev->input == PREVIEW_INPUT_CCDC) |
1412 | preview_config_inlineoffset(prev, 0); | 1422 | preview_config_inlineoffset(prev, 0); |
1413 | else | 1423 | else |
1414 | preview_config_inlineoffset(prev, | 1424 | preview_config_inlineoffset(prev, ALIGN(format->width, 0x20) * |
1415 | ALIGN(format->width, 0x20) * 2); | 1425 | info->bpp); |
1416 | 1426 | ||
1417 | preview_setup_hw(prev, update, active); | 1427 | preview_setup_hw(prev, update, active); |
1418 | 1428 | ||
@@ -1709,6 +1719,11 @@ __preview_get_crop(struct isp_prev_device *prev, struct v4l2_subdev_fh *fh, | |||
1709 | 1719 | ||
1710 | /* previewer format descriptions */ | 1720 | /* previewer format descriptions */ |
1711 | static const unsigned int preview_input_fmts[] = { | 1721 | static const unsigned int preview_input_fmts[] = { |
1722 | V4L2_MBUS_FMT_Y8_1X8, | ||
1723 | V4L2_MBUS_FMT_SGRBG8_1X8, | ||
1724 | V4L2_MBUS_FMT_SRGGB8_1X8, | ||
1725 | V4L2_MBUS_FMT_SBGGR8_1X8, | ||
1726 | V4L2_MBUS_FMT_SGBRG8_1X8, | ||
1712 | V4L2_MBUS_FMT_Y10_1X10, | 1727 | V4L2_MBUS_FMT_Y10_1X10, |
1713 | V4L2_MBUS_FMT_SGRBG10_1X10, | 1728 | V4L2_MBUS_FMT_SGRBG10_1X10, |
1714 | V4L2_MBUS_FMT_SRGGB10_1X10, | 1729 | V4L2_MBUS_FMT_SRGGB10_1X10, |