diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-04-19 12:38:29 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-05-08 13:11:41 -0400 |
commit | b2da46e52fe7871cba36e1a435844502c0eccf39 (patch) | |
tree | 3b17620a3672b39b8c84adf18539859760e05159 /drivers | |
parent | 6173850c95e3c2e51bd670011ae347862b098635 (diff) |
[media] omap3isp: preview: Add support for greyscale input
Configure CFA interpolation automatically based on the input format.
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')
-rw-r--r-- | drivers/media/video/omap3isp/isppreview.c | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c index f839cf866fa9..420b131282d8 100644 --- a/drivers/media/video/omap3isp/isppreview.c +++ b/drivers/media/video/omap3isp/isppreview.c | |||
@@ -441,23 +441,6 @@ preview_enable_dcor(struct isp_prev_device *prev, u8 enable) | |||
441 | } | 441 | } |
442 | 442 | ||
443 | /* | 443 | /* |
444 | * preview_enable_cfa - Enable/Disable the CFA Interpolation. | ||
445 | * @enable: 1 - Enables the CFA. | ||
446 | */ | ||
447 | static void | ||
448 | preview_enable_cfa(struct isp_prev_device *prev, u8 enable) | ||
449 | { | ||
450 | struct isp_device *isp = to_isp_device(prev); | ||
451 | |||
452 | if (enable) | ||
453 | isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | ||
454 | ISPPRV_PCR_CFAEN); | ||
455 | else | ||
456 | isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | ||
457 | ISPPRV_PCR_CFAEN); | ||
458 | } | ||
459 | |||
460 | /* | ||
461 | * preview_enable_gammabypass - Enables/Disables the GammaByPass | 444 | * preview_enable_gammabypass - Enables/Disables the GammaByPass |
462 | * @enable: 1 - Bypasses Gamma - 10bit input is cropped to 8MSB. | 445 | * @enable: 1 - Bypasses Gamma - 10bit input is cropped to 8MSB. |
463 | * 0 - Goes through Gamma Correction. input and output is 10bit. | 446 | * 0 - Goes through Gamma Correction. input and output is 10bit. |
@@ -831,7 +814,7 @@ static const struct preview_update update_attrs[] = { | |||
831 | offsetof(struct omap3isp_prev_update_config, hmed), | 814 | offsetof(struct omap3isp_prev_update_config, hmed), |
832 | }, /* OMAP3ISP_PREV_CFA */ { | 815 | }, /* OMAP3ISP_PREV_CFA */ { |
833 | preview_config_cfa, | 816 | preview_config_cfa, |
834 | preview_enable_cfa, | 817 | NULL, |
835 | offsetof(struct prev_params, cfa), | 818 | offsetof(struct prev_params, cfa), |
836 | FIELD_SIZEOF(struct prev_params, cfa), | 819 | FIELD_SIZEOF(struct prev_params, cfa), |
837 | offsetof(struct omap3isp_prev_update_config, cfa), | 820 | offsetof(struct omap3isp_prev_update_config, cfa), |
@@ -1078,6 +1061,27 @@ static void preview_config_averager(struct isp_prev_device *prev, u8 average) | |||
1078 | } | 1061 | } |
1079 | 1062 | ||
1080 | /* | 1063 | /* |
1064 | * preview_config_input_format - Configure the input format | ||
1065 | * @prev: The preview engine | ||
1066 | * @format: Format on the preview engine sink pad | ||
1067 | * | ||
1068 | * Enable CFA interpolation for Bayer formats and disable it for greyscale | ||
1069 | * formats. | ||
1070 | */ | ||
1071 | static void preview_config_input_format(struct isp_prev_device *prev, | ||
1072 | const struct v4l2_mbus_framefmt *format) | ||
1073 | { | ||
1074 | struct isp_device *isp = to_isp_device(prev); | ||
1075 | |||
1076 | if (format->code != V4L2_MBUS_FMT_Y10_1X10) | ||
1077 | isp_reg_set(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | ||
1078 | ISPPRV_PCR_CFAEN); | ||
1079 | else | ||
1080 | isp_reg_clr(isp, OMAP3_ISP_IOMEM_PREV, ISPPRV_PCR, | ||
1081 | ISPPRV_PCR_CFAEN); | ||
1082 | } | ||
1083 | |||
1084 | /* | ||
1081 | * preview_config_input_size - Configure the input frame size | 1085 | * preview_config_input_size - Configure the input frame size |
1082 | * | 1086 | * |
1083 | * The preview engine crops several rows and columns internally depending on | 1087 | * The preview engine crops several rows and columns internally depending on |
@@ -1090,6 +1094,7 @@ static void preview_config_averager(struct isp_prev_device *prev, u8 average) | |||
1090 | */ | 1094 | */ |
1091 | static void preview_config_input_size(struct isp_prev_device *prev, u32 active) | 1095 | static void preview_config_input_size(struct isp_prev_device *prev, u32 active) |
1092 | { | 1096 | { |
1097 | const struct v4l2_mbus_framefmt *format = &prev->formats[PREV_PAD_SINK]; | ||
1093 | struct isp_device *isp = to_isp_device(prev); | 1098 | struct isp_device *isp = to_isp_device(prev); |
1094 | unsigned int sph = prev->crop.left; | 1099 | unsigned int sph = prev->crop.left; |
1095 | unsigned int eph = prev->crop.left + prev->crop.width - 1; | 1100 | unsigned int eph = prev->crop.left + prev->crop.width - 1; |
@@ -1097,15 +1102,16 @@ static void preview_config_input_size(struct isp_prev_device *prev, u32 active) | |||
1097 | unsigned int elv = prev->crop.top + prev->crop.height - 1; | 1102 | unsigned int elv = prev->crop.top + prev->crop.height - 1; |
1098 | u32 features; | 1103 | u32 features; |
1099 | 1104 | ||
1100 | features = (prev->params.params[0].features & active) | 1105 | if (format->code == V4L2_MBUS_FMT_Y10_1X10) { |
1101 | | (prev->params.params[1].features & ~active); | ||
1102 | |||
1103 | if (features & OMAP3ISP_PREV_CFA) { | ||
1104 | sph -= 2; | 1106 | sph -= 2; |
1105 | eph += 2; | 1107 | eph += 2; |
1106 | slv -= 2; | 1108 | slv -= 2; |
1107 | elv += 2; | 1109 | elv += 2; |
1108 | } | 1110 | } |
1111 | |||
1112 | features = (prev->params.params[0].features & active) | ||
1113 | | (prev->params.params[1].features & ~active); | ||
1114 | |||
1109 | if (features & (OMAP3ISP_PREV_DEFECT_COR | OMAP3ISP_PREV_NF)) { | 1115 | if (features & (OMAP3ISP_PREV_DEFECT_COR | OMAP3ISP_PREV_NF)) { |
1110 | sph -= 2; | 1116 | sph -= 2; |
1111 | eph += 2; | 1117 | eph += 2; |
@@ -1436,6 +1442,7 @@ static void preview_configure(struct isp_prev_device *prev) | |||
1436 | 1442 | ||
1437 | preview_adjust_bandwidth(prev); | 1443 | preview_adjust_bandwidth(prev); |
1438 | 1444 | ||
1445 | preview_config_input_format(prev, format); | ||
1439 | preview_config_input_size(prev, active); | 1446 | preview_config_input_size(prev, active); |
1440 | 1447 | ||
1441 | if (prev->input == PREVIEW_INPUT_CCDC) | 1448 | if (prev->input == PREVIEW_INPUT_CCDC) |
@@ -1723,6 +1730,7 @@ __preview_get_crop(struct isp_prev_device *prev, struct v4l2_subdev_fh *fh, | |||
1723 | 1730 | ||
1724 | /* previewer format descriptions */ | 1731 | /* previewer format descriptions */ |
1725 | static const unsigned int preview_input_fmts[] = { | 1732 | static const unsigned int preview_input_fmts[] = { |
1733 | V4L2_MBUS_FMT_Y10_1X10, | ||
1726 | V4L2_MBUS_FMT_SGRBG10_1X10, | 1734 | V4L2_MBUS_FMT_SGRBG10_1X10, |
1727 | V4L2_MBUS_FMT_SRGGB10_1X10, | 1735 | V4L2_MBUS_FMT_SRGGB10_1X10, |
1728 | V4L2_MBUS_FMT_SBGGR10_1X10, | 1736 | V4L2_MBUS_FMT_SBGGR10_1X10, |