From patchwork Tue Dec 14 14:43:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Hostettler X-Patchwork-Id: 409921 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBEEi0wa002211 for ; Tue, 14 Dec 2010 14:44:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756310Ab0LNOn7 (ORCPT ); Tue, 14 Dec 2010 09:43:59 -0500 Received: from moutng.kundenserver.de ([212.227.126.171]:53195 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752752Ab0LNOn6 (ORCPT ); Tue, 14 Dec 2010 09:43:58 -0500 Received: from localhost (dslb-084-063-122-222.pools.arcor-ip.net [84.63.122.222]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0LaJMk-1QAyG70c0M-00lRq0; Tue, 14 Dec 2010 15:43:53 +0100 From: Martin Hostettler To: Laurent Pinchart , linux-media@vger.kernel.org Cc: Martin Hostettler Subject: [PATCH] v4l: OMAP3 ISP CCDC: Add support for 8bit greyscale sensors Date: Tue, 14 Dec 2010 15:43:43 +0100 Message-Id: <1292337823-15994-1-git-send-email-martin@neutronstar.dyndns.org> X-Mailer: git-send-email 1.7.1 X-Provags-ID: V02:K0:z/7cCnD9KWAlCoP5Y1/AzVfIoJ8L9gUFm5o2voOfj38 aMvWGZBLMgmGnJqQ+5l31P393potZ5lyScxQkg4bdSQB0JY/7m 0PbdR5jz7yD3sHgzkQeKNYQ/Jj7A54X+rUzW+tGRPlEtvDsZqa 85sy+/T5CBeWuv+2baO09/rSET1aZLBh2gCbNqgNPIMhuazbGM EkzI++OZoMRVhRRJvGtotdXedvvEqPcbw5eAe7ih7c= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Tue, 14 Dec 2010 14:44:03 +0000 (UTC) diff --git a/drivers/media/video/isp/isp.h b/drivers/media/video/isp/isp.h index edc029c..76c09ed 100644 --- a/drivers/media/video/isp/isp.h +++ b/drivers/media/video/isp/isp.h @@ -132,11 +132,13 @@ struct isp_reg { * ISPCTRL_PAR_BRIDGE_DISABLE - Disable * ISPCTRL_PAR_BRIDGE_LENDIAN - Little endian * ISPCTRL_PAR_BRIDGE_BENDIAN - Big endian + * @datsz: Width of the data-bus in bits (8, 10, 11, 12, 13) or 0 for default (10bit) */ struct isp_parallel_platform_data { unsigned int data_lane_shift:2; unsigned int clk_pol:1; unsigned int bridge:4; + unsigned int data_bus_width; }; /** diff --git a/drivers/media/video/isp/ispccdc.c b/drivers/media/video/isp/ispccdc.c index be4581e..bff217a 100644 --- a/drivers/media/video/isp/ispccdc.c +++ b/drivers/media/video/isp/ispccdc.c @@ -45,6 +45,7 @@ static const unsigned int ccdc_fmts[] = { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10, + V4L2_MBUS_FMT_Y8_1X8, }; /* @@ -1069,6 +1070,10 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) isp_configure_bridge(isp, ccdc->input, pdata); ispccdc_config_sync_if(ccdc, &ccdc->syncif); + /* CCDC_PAD_SINK */ + format = &ccdc->formats[CCDC_PAD_SINK]; + isp_video_mbus_to_pix(&ccdc->video_out, format, &pix); + syn_mode = isp_reg_readl(isp, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_SYN_MODE); /* Use the raw, unprocessed data when writing to memory. The H3A and @@ -1086,10 +1091,14 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) else syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ; - isp_reg_writel(isp, syn_mode, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_SYN_MODE); + /* Use PACK8 mode for 1byte per pixel formats */ + if (pix.bytesperline < format->width * 2) + syn_mode |= ISPCCDC_SYN_MODE_PACK8; + else + syn_mode &= ~ISPCCDC_SYN_MODE_PACK8; - /* CCDC_PAD_SINK */ - format = &ccdc->formats[CCDC_PAD_SINK]; + + isp_reg_writel(isp, syn_mode, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_SYN_MODE); /* Mosaic filter */ switch (format->code) { @@ -1128,7 +1137,6 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) << ISPCCDC_VERT_LINES_NLV_SHIFT, OMAP3_ISP_IOMEM_CCDC, ISPCCDC_VERT_LINES); - isp_video_mbus_to_pix(&ccdc->video_out, format, &pix); ispccdc_config_outlineoffset(ccdc, pix.bytesperline, 0, 0); /* CCDC_PAD_SOURCE_VP */ @@ -2164,6 +2172,9 @@ int isp_ccdc_init(struct isp_device *isp) ccdc->syncif.ccdc_mastermode = 0; ccdc->syncif.datapol = 0; ccdc->syncif.datsz = 10; + if (isp->pdata->subdevs->interface == ISP_INTERFACE_PARALLEL + && isp->pdata->subdevs->bus.parallel.data_bus_width != 0) + ccdc->syncif.datsz = isp->pdata->subdevs->bus.parallel.data_bus_width; ccdc->syncif.fldmode = 0; ccdc->syncif.fldout = 0; ccdc->syncif.fldpol = 0; @@ -2172,7 +2183,7 @@ int isp_ccdc_init(struct isp_device *isp) ccdc->syncif.vdpol = 0; ccdc->clamp.oblen = 0; - ccdc->clamp.dcsubval = 64; + ccdc->clamp.dcsubval = (ccdc->syncif.datsz == 8) ? 0 : 64; ccdc->vpcfg.pixelclk = 0; diff --git a/drivers/media/video/isp/ispvideo.c b/drivers/media/video/isp/ispvideo.c index 64068ff..35e8c72 100644 --- a/drivers/media/video/isp/ispvideo.c +++ b/drivers/media/video/isp/ispvideo.c @@ -228,6 +228,10 @@ void isp_video_mbus_to_pix(const struct isp_video *video, pix->pixelformat = V4L2_PIX_FMT_YUYV; pix->bytesperline = pix->width * 2; break; + case V4L2_MBUS_FMT_Y8_1X8: + pix->pixelformat = V4L2_PIX_FMT_GREY; + pix->bytesperline = pix->width; + break; case V4L2_MBUS_FMT_UYVY8_1X16: default: pix->pixelformat = V4L2_PIX_FMT_UYVY; @@ -261,6 +265,9 @@ void isp_video_pix_to_mbus(const struct v4l2_pix_format *pix, case V4L2_PIX_FMT_YUYV: mbus->code = V4L2_MBUS_FMT_YUYV8_1X16; break; + case V4L2_PIX_FMT_GREY: + mbus->code = V4L2_MBUS_FMT_Y8_1X8; + break; case V4L2_PIX_FMT_UYVY: default: mbus->code = V4L2_MBUS_FMT_UYVY8_1X16;