aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/omap3isp/ispccdc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/omap3isp/ispccdc.c')
-rw-r--r--drivers/media/platform/omap3isp/ispccdc.c112
1 files changed, 55 insertions, 57 deletions
diff --git a/drivers/media/platform/omap3isp/ispccdc.c b/drivers/media/platform/omap3isp/ispccdc.c
index 81a9dc053d58..587489a072d5 100644
--- a/drivers/media/platform/omap3isp/ispccdc.c
+++ b/drivers/media/platform/omap3isp/ispccdc.c
@@ -36,23 +36,23 @@ __ccdc_get_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh,
36 unsigned int pad, enum v4l2_subdev_format_whence which); 36 unsigned int pad, enum v4l2_subdev_format_whence which);
37 37
38static const unsigned int ccdc_fmts[] = { 38static const unsigned int ccdc_fmts[] = {
39 V4L2_MBUS_FMT_Y8_1X8, 39 MEDIA_BUS_FMT_Y8_1X8,
40 V4L2_MBUS_FMT_Y10_1X10, 40 MEDIA_BUS_FMT_Y10_1X10,
41 V4L2_MBUS_FMT_Y12_1X12, 41 MEDIA_BUS_FMT_Y12_1X12,
42 V4L2_MBUS_FMT_SGRBG8_1X8, 42 MEDIA_BUS_FMT_SGRBG8_1X8,
43 V4L2_MBUS_FMT_SRGGB8_1X8, 43 MEDIA_BUS_FMT_SRGGB8_1X8,
44 V4L2_MBUS_FMT_SBGGR8_1X8, 44 MEDIA_BUS_FMT_SBGGR8_1X8,
45 V4L2_MBUS_FMT_SGBRG8_1X8, 45 MEDIA_BUS_FMT_SGBRG8_1X8,
46 V4L2_MBUS_FMT_SGRBG10_1X10, 46 MEDIA_BUS_FMT_SGRBG10_1X10,
47 V4L2_MBUS_FMT_SRGGB10_1X10, 47 MEDIA_BUS_FMT_SRGGB10_1X10,
48 V4L2_MBUS_FMT_SBGGR10_1X10, 48 MEDIA_BUS_FMT_SBGGR10_1X10,
49 V4L2_MBUS_FMT_SGBRG10_1X10, 49 MEDIA_BUS_FMT_SGBRG10_1X10,
50 V4L2_MBUS_FMT_SGRBG12_1X12, 50 MEDIA_BUS_FMT_SGRBG12_1X12,
51 V4L2_MBUS_FMT_SRGGB12_1X12, 51 MEDIA_BUS_FMT_SRGGB12_1X12,
52 V4L2_MBUS_FMT_SBGGR12_1X12, 52 MEDIA_BUS_FMT_SBGGR12_1X12,
53 V4L2_MBUS_FMT_SGBRG12_1X12, 53 MEDIA_BUS_FMT_SGBRG12_1X12,
54 V4L2_MBUS_FMT_YUYV8_2X8, 54 MEDIA_BUS_FMT_YUYV8_2X8,
55 V4L2_MBUS_FMT_UYVY8_2X8, 55 MEDIA_BUS_FMT_UYVY8_2X8,
56}; 56};
57 57
58/* 58/*
@@ -266,10 +266,10 @@ static int __ccdc_lsc_enable(struct isp_ccdc_device *ccdc, int enable)
266 __ccdc_get_format(ccdc, NULL, CCDC_PAD_SINK, 266 __ccdc_get_format(ccdc, NULL, CCDC_PAD_SINK,
267 V4L2_SUBDEV_FORMAT_ACTIVE); 267 V4L2_SUBDEV_FORMAT_ACTIVE);
268 268
269 if ((format->code != V4L2_MBUS_FMT_SGRBG10_1X10) && 269 if ((format->code != MEDIA_BUS_FMT_SGRBG10_1X10) &&
270 (format->code != V4L2_MBUS_FMT_SRGGB10_1X10) && 270 (format->code != MEDIA_BUS_FMT_SRGGB10_1X10) &&
271 (format->code != V4L2_MBUS_FMT_SBGGR10_1X10) && 271 (format->code != MEDIA_BUS_FMT_SBGGR10_1X10) &&
272 (format->code != V4L2_MBUS_FMT_SGBRG10_1X10)) 272 (format->code != MEDIA_BUS_FMT_SGBRG10_1X10))
273 return -EINVAL; 273 return -EINVAL;
274 274
275 if (enable) 275 if (enable)
@@ -971,8 +971,8 @@ static void ccdc_config_sync_if(struct isp_ccdc_device *ccdc,
971 971
972 format = &ccdc->formats[CCDC_PAD_SINK]; 972 format = &ccdc->formats[CCDC_PAD_SINK];
973 973
974 if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 || 974 if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 ||
975 format->code == V4L2_MBUS_FMT_UYVY8_2X8) { 975 format->code == MEDIA_BUS_FMT_UYVY8_2X8) {
976 /* According to the OMAP3 TRM the input mode only affects SYNC 976 /* According to the OMAP3 TRM the input mode only affects SYNC
977 * mode, enabling BT.656 mode should take precedence. However, 977 * mode, enabling BT.656 mode should take precedence. However,
978 * in practice setting the input mode to YCbCr data on 8 bits 978 * in practice setting the input mode to YCbCr data on 8 bits
@@ -1020,7 +1020,7 @@ static void ccdc_config_sync_if(struct isp_ccdc_device *ccdc,
1020 /* The CCDC_CFG.Y8POS bit is used in YCbCr8 input mode only. The 1020 /* The CCDC_CFG.Y8POS bit is used in YCbCr8 input mode only. The
1021 * hardware seems to ignore it in all other input modes. 1021 * hardware seems to ignore it in all other input modes.
1022 */ 1022 */
1023 if (format->code == V4L2_MBUS_FMT_UYVY8_2X8) 1023 if (format->code == MEDIA_BUS_FMT_UYVY8_2X8)
1024 isp_reg_set(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_CFG, 1024 isp_reg_set(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_CFG,
1025 ISPCCDC_CFG_Y8POS); 1025 ISPCCDC_CFG_Y8POS);
1026 else 1026 else
@@ -1168,9 +1168,9 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
1168 1168
1169 if (ccdc->bt656) 1169 if (ccdc->bt656)
1170 bridge = ISPCTRL_PAR_BRIDGE_DISABLE; 1170 bridge = ISPCTRL_PAR_BRIDGE_DISABLE;
1171 else if (fmt_info->code == V4L2_MBUS_FMT_YUYV8_2X8) 1171 else if (fmt_info->code == MEDIA_BUS_FMT_YUYV8_2X8)
1172 bridge = ISPCTRL_PAR_BRIDGE_LENDIAN; 1172 bridge = ISPCTRL_PAR_BRIDGE_LENDIAN;
1173 else if (fmt_info->code == V4L2_MBUS_FMT_UYVY8_2X8) 1173 else if (fmt_info->code == MEDIA_BUS_FMT_UYVY8_2X8)
1174 bridge = ISPCTRL_PAR_BRIDGE_BENDIAN; 1174 bridge = ISPCTRL_PAR_BRIDGE_BENDIAN;
1175 else 1175 else
1176 bridge = ISPCTRL_PAR_BRIDGE_DISABLE; 1176 bridge = ISPCTRL_PAR_BRIDGE_DISABLE;
@@ -1199,16 +1199,16 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
1199 1199
1200 /* Mosaic filter */ 1200 /* Mosaic filter */
1201 switch (format->code) { 1201 switch (format->code) {
1202 case V4L2_MBUS_FMT_SRGGB10_1X10: 1202 case MEDIA_BUS_FMT_SRGGB10_1X10:
1203 case V4L2_MBUS_FMT_SRGGB12_1X12: 1203 case MEDIA_BUS_FMT_SRGGB12_1X12:
1204 ccdc_pattern = ccdc_srggb_pattern; 1204 ccdc_pattern = ccdc_srggb_pattern;
1205 break; 1205 break;
1206 case V4L2_MBUS_FMT_SBGGR10_1X10: 1206 case MEDIA_BUS_FMT_SBGGR10_1X10:
1207 case V4L2_MBUS_FMT_SBGGR12_1X12: 1207 case MEDIA_BUS_FMT_SBGGR12_1X12:
1208 ccdc_pattern = ccdc_sbggr_pattern; 1208 ccdc_pattern = ccdc_sbggr_pattern;
1209 break; 1209 break;
1210 case V4L2_MBUS_FMT_SGBRG10_1X10: 1210 case MEDIA_BUS_FMT_SGBRG10_1X10:
1211 case V4L2_MBUS_FMT_SGBRG12_1X12: 1211 case MEDIA_BUS_FMT_SGBRG12_1X12:
1212 ccdc_pattern = ccdc_sgbrg_pattern; 1212 ccdc_pattern = ccdc_sgbrg_pattern;
1213 break; 1213 break;
1214 default: 1214 default:
@@ -1267,7 +1267,7 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc)
1267 /* The CCDC outputs data in UYVY order by default. Swap bytes to get 1267 /* The CCDC outputs data in UYVY order by default. Swap bytes to get
1268 * YUYV. 1268 * YUYV.
1269 */ 1269 */
1270 if (format->code == V4L2_MBUS_FMT_YUYV8_1X16) 1270 if (format->code == MEDIA_BUS_FMT_YUYV8_1X16)
1271 isp_reg_set(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_CFG, 1271 isp_reg_set(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_CFG,
1272 ISPCCDC_CFG_BSWD); 1272 ISPCCDC_CFG_BSWD);
1273 else 1273 else
@@ -1967,7 +1967,7 @@ ccdc_try_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh,
1967 enum v4l2_subdev_format_whence which) 1967 enum v4l2_subdev_format_whence which)
1968{ 1968{
1969 const struct isp_format_info *info; 1969 const struct isp_format_info *info;
1970 enum v4l2_mbus_pixelcode pixelcode; 1970 u32 pixelcode;
1971 unsigned int width = fmt->width; 1971 unsigned int width = fmt->width;
1972 unsigned int height = fmt->height; 1972 unsigned int height = fmt->height;
1973 struct v4l2_rect *crop; 1973 struct v4l2_rect *crop;
@@ -1983,7 +1983,7 @@ ccdc_try_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh,
1983 1983
1984 /* If not found, use SGRBG10 as default */ 1984 /* If not found, use SGRBG10 as default */
1985 if (i >= ARRAY_SIZE(ccdc_fmts)) 1985 if (i >= ARRAY_SIZE(ccdc_fmts))
1986 fmt->code = V4L2_MBUS_FMT_SGRBG10_1X10; 1986 fmt->code = MEDIA_BUS_FMT_SGRBG10_1X10;
1987 1987
1988 /* Clamp the input size. */ 1988 /* Clamp the input size. */
1989 fmt->width = clamp_t(u32, width, 32, 4096); 1989 fmt->width = clamp_t(u32, width, 32, 4096);
@@ -2007,19 +2007,19 @@ ccdc_try_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh,
2007 * configured to pack bytes in BT.656, hiding the inaccuracy. 2007 * configured to pack bytes in BT.656, hiding the inaccuracy.
2008 * In all cases bytes can be swapped. 2008 * In all cases bytes can be swapped.
2009 */ 2009 */
2010 if (fmt->code == V4L2_MBUS_FMT_YUYV8_2X8 || 2010 if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8 ||
2011 fmt->code == V4L2_MBUS_FMT_UYVY8_2X8) { 2011 fmt->code == MEDIA_BUS_FMT_UYVY8_2X8) {
2012 /* Use the user requested format if YUV. */ 2012 /* Use the user requested format if YUV. */
2013 if (pixelcode == V4L2_MBUS_FMT_YUYV8_2X8 || 2013 if (pixelcode == MEDIA_BUS_FMT_YUYV8_2X8 ||
2014 pixelcode == V4L2_MBUS_FMT_UYVY8_2X8 || 2014 pixelcode == MEDIA_BUS_FMT_UYVY8_2X8 ||
2015 pixelcode == V4L2_MBUS_FMT_YUYV8_1X16 || 2015 pixelcode == MEDIA_BUS_FMT_YUYV8_1X16 ||
2016 pixelcode == V4L2_MBUS_FMT_UYVY8_1X16) 2016 pixelcode == MEDIA_BUS_FMT_UYVY8_1X16)
2017 fmt->code = pixelcode; 2017 fmt->code = pixelcode;
2018 2018
2019 if (fmt->code == V4L2_MBUS_FMT_YUYV8_2X8) 2019 if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8)
2020 fmt->code = V4L2_MBUS_FMT_YUYV8_1X16; 2020 fmt->code = MEDIA_BUS_FMT_YUYV8_1X16;
2021 else if (fmt->code == V4L2_MBUS_FMT_UYVY8_2X8) 2021 else if (fmt->code == MEDIA_BUS_FMT_UYVY8_2X8)
2022 fmt->code = V4L2_MBUS_FMT_UYVY8_1X16; 2022 fmt->code = MEDIA_BUS_FMT_UYVY8_1X16;
2023 } 2023 }
2024 2024
2025 /* Hardcode the output size to the crop rectangle size. */ 2025 /* Hardcode the output size to the crop rectangle size. */
@@ -2047,8 +2047,8 @@ ccdc_try_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh,
2047 fmt->code = info->truncated; 2047 fmt->code = info->truncated;
2048 2048
2049 /* YUV formats are not supported by the video port. */ 2049 /* YUV formats are not supported by the video port. */
2050 if (fmt->code == V4L2_MBUS_FMT_YUYV8_2X8 || 2050 if (fmt->code == MEDIA_BUS_FMT_YUYV8_2X8 ||
2051 fmt->code == V4L2_MBUS_FMT_UYVY8_2X8) 2051 fmt->code == MEDIA_BUS_FMT_UYVY8_2X8)
2052 fmt->code = 0; 2052 fmt->code = 0;
2053 2053
2054 /* The number of lines that can be clocked out from the video 2054 /* The number of lines that can be clocked out from the video
@@ -2083,7 +2083,7 @@ static void ccdc_try_crop(struct isp_ccdc_device *ccdc,
2083 * to keep the Bayer pattern. 2083 * to keep the Bayer pattern.
2084 */ 2084 */
2085 info = omap3isp_video_format_info(sink->code); 2085 info = omap3isp_video_format_info(sink->code);
2086 if (info->flavor != V4L2_MBUS_FMT_Y8_1X8) { 2086 if (info->flavor != MEDIA_BUS_FMT_Y8_1X8) {
2087 crop->left &= ~1; 2087 crop->left &= ~1;
2088 crop->top &= ~1; 2088 crop->top &= ~1;
2089 } 2089 }
@@ -2103,7 +2103,7 @@ static void ccdc_try_crop(struct isp_ccdc_device *ccdc,
2103 sink->height - crop->top); 2103 sink->height - crop->top);
2104 2104
2105 /* Odd width/height values don't make sense for Bayer formats. */ 2105 /* Odd width/height values don't make sense for Bayer formats. */
2106 if (info->flavor != V4L2_MBUS_FMT_Y8_1X8) { 2106 if (info->flavor != MEDIA_BUS_FMT_Y8_1X8) {
2107 crop->width &= ~1; 2107 crop->width &= ~1;
2108 crop->height &= ~1; 2108 crop->height &= ~1;
2109 } 2109 }
@@ -2135,13 +2135,13 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd,
2135 format = __ccdc_get_format(ccdc, fh, code->pad, 2135 format = __ccdc_get_format(ccdc, fh, code->pad,
2136 V4L2_SUBDEV_FORMAT_TRY); 2136 V4L2_SUBDEV_FORMAT_TRY);
2137 2137
2138 if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 || 2138 if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 ||
2139 format->code == V4L2_MBUS_FMT_UYVY8_2X8) { 2139 format->code == MEDIA_BUS_FMT_UYVY8_2X8) {
2140 /* In YUV mode the CCDC can swap bytes. */ 2140 /* In YUV mode the CCDC can swap bytes. */
2141 if (code->index == 0) 2141 if (code->index == 0)
2142 code->code = V4L2_MBUS_FMT_YUYV8_1X16; 2142 code->code = MEDIA_BUS_FMT_YUYV8_1X16;
2143 else if (code->index == 1) 2143 else if (code->index == 1)
2144 code->code = V4L2_MBUS_FMT_UYVY8_1X16; 2144 code->code = MEDIA_BUS_FMT_UYVY8_1X16;
2145 else 2145 else
2146 return -EINVAL; 2146 return -EINVAL;
2147 } else { 2147 } else {
@@ -2383,9 +2383,7 @@ static int ccdc_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
2383 * return true if the combination is possible 2383 * return true if the combination is possible
2384 * return false otherwise 2384 * return false otherwise
2385 */ 2385 */
2386static bool ccdc_is_shiftable(enum v4l2_mbus_pixelcode in, 2386static bool ccdc_is_shiftable(u32 in, u32 out, unsigned int additional_shift)
2387 enum v4l2_mbus_pixelcode out,
2388 unsigned int additional_shift)
2389{ 2387{
2390 const struct isp_format_info *in_info, *out_info; 2388 const struct isp_format_info *in_info, *out_info;
2391 2389
@@ -2452,7 +2450,7 @@ static int ccdc_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
2452 memset(&format, 0, sizeof(format)); 2450 memset(&format, 0, sizeof(format));
2453 format.pad = CCDC_PAD_SINK; 2451 format.pad = CCDC_PAD_SINK;
2454 format.which = fh ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; 2452 format.which = fh ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
2455 format.format.code = V4L2_MBUS_FMT_SGRBG10_1X10; 2453 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
2456 format.format.width = 4096; 2454 format.format.width = 4096;
2457 format.format.height = 4096; 2455 format.format.height = 4096;
2458 ccdc_set_format(sd, fh, &format); 2456 ccdc_set_format(sd, fh, &format);