From patchwork Fri Aug 28 00:17:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: santiago.nunez@ridgerun.com X-Patchwork-Id: 44365 Received: from arroyo.ext.ti.com (arroyo.ext.ti.com [192.94.94.40]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n7S0J6Vu030360 for ; Fri, 28 Aug 2009 00:19:06 GMT Received: from dlep36.itg.ti.com ([157.170.170.91]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7S0HN2q009378; Thu, 27 Aug 2009 19:17:28 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by dlep36.itg.ti.com (8.13.8/8.13.8) with ESMTP id n7S0HN1s028907; Thu, 27 Aug 2009 19:17:23 -0500 (CDT) Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 83B1F80627; Thu, 27 Aug 2009 19:17:21 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 7560380626 for ; Thu, 27 Aug 2009 19:17:19 -0500 (CDT) Received: from neches.ext.ti.com (localhost [127.0.0.1]) by dflp52.itg.ti.com (8.13.7/8.13.7) with ESMTP id n7S0HJMe028741 for ; Thu, 27 Aug 2009 19:17:19 -0500 (CDT) Received: from mail170-tx2-R.bigfish.com (mail-tx2.bigfish.com [65.55.88.114]) by neches.ext.ti.com (8.13.7/8.13.7) with ESMTP id n7S0HERu028053 for ; Thu, 27 Aug 2009 19:17:19 -0500 Received: from mail170-tx2 (localhost.localdomain [127.0.0.1]) by mail170-tx2-R.bigfish.com (Postfix) with ESMTP id 1A7BB12E05DD for ; Fri, 28 Aug 2009 00:17:14 +0000 (UTC) X-SpamScore: 7 X-BigFish: vps7(zza4b1ozz1202hzzz2fh63h) X-Spam-TCS-SCL: 2:0 X-FB-SS: 5, X-MS-Exchange-Organization-Antispam-Report: OrigIP: 74.208.67.6; Service: EHS Received: by mail170-tx2 (MessageSwitch) id 1251418631479876_2763; Fri, 28 Aug 2009 00:17:11 +0000 (UCT) Received: from mail.navvo.net (mail.navvo.net [74.208.67.6]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail170-tx2.bigfish.com (Postfix) with ESMTP id 3B430C28052; Fri, 28 Aug 2009 00:17:11 +0000 (UTC) Received: from [200.122.155.113] (helo=localhost.localdomain) by mail.navvo.net with esmtpa (Exim 4.63) (envelope-from ) id 1Mgp9N-0001ua-Gl; Thu, 27 Aug 2009 19:17:07 -0500 From: santiago.nunez@ridgerun.com To: m-karicheri2@ti.com Date: Thu, 27 Aug 2009 18:17:11 -0600 Message-Id: <1251418631-16196-1-git-send-email-santiago.nunez@ridgerun.com> X-Mailer: git-send-email 1.6.0.4 X-SA-Exim-Connect-IP: 200.122.155.113 X-SA-Exim-Mail-From: santiago.nunez@ridgerun.com X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on mail.navvo.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00, NO_REAL_NAME autolearn=ham version=3.1.7-deb X-SA-Exim-Version: 4.2.1 (built Tue, 09 Jan 2007 17:23:22 +0000) X-SA-Exim-Scanned: Yes (on mail.navvo.net) Cc: davinci-linux-open-source@linux.davincidsp.com, clark.becker@ridgerun.com, Santiago Nunez-Corrales , todd.fischer@ridgerun.com Subject: [PATCH 3/6] Support for TVP7002 in VPFE X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.4 Precedence: list List-Id: davinci-linux-open-source.linux.davincidsp.com List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: davinci-linux-open-source-bounces@linux.davincidsp.com Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Santiago Nunez-Corrales This patch adds support for TVP7002 in the DM365 VPFE inteface. Signed-off-by: Santiago Nunez-Corrales --- drivers/media/video/davinci/vpfe_capture.c | 53 ++++++++++++++++++++++++++-- 1 files changed, 50 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index 2a4a05a..98c288a 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c @@ -140,8 +140,17 @@ static DEFINE_MUTEX(ccdc_lock); static struct ccdc_config *ccdc_cfg; const struct vpfe_standard vpfe_standards[] = { - {V4L2_STD_525_60, 720, 480, {11, 10}, 1}, - {V4L2_STD_625_50, 720, 576, {54, 59}, 1}, + {V4L2_STD_480P_60, 720, 480, {11, 10}, 0}, + {V4L2_STD_480I_60, 720, 480, {11, 10}, 1}, + {V4L2_STD_576P_50, 720, 576, {54, 59}, 0}, + {V4L2_STD_576I_50, 720, 576, {54, 59}, 1}, + {V4L2_STD_720P_50, 1280, 720, {12, 10}, 0}, + {V4L2_STD_720P_50, 1280, 720, {12, 10}, 0}, + {V4L2_STD_720P_60, 1280, 720, {12, 10}, 0}, + {V4L2_STD_1080I_50, 1920, 1080, {12, 10}, 1}, + {V4L2_STD_1080I_60, 1920, 1080, {12, 10}, 1}, + {V4L2_STD_1080P_50, 1920, 1080, {12, 10}, 0}, + {V4L2_STD_1080P_60, 1920, 1080, {12, 10}, 0}, }; /* Used when raw Bayer image from ccdc is directly captured to SDRAM */ @@ -249,6 +258,7 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev) BUG_ON(!dev->hw_ops.set_image_window); BUG_ON(!dev->hw_ops.get_image_window); BUG_ON(!dev->hw_ops.get_line_length); + BUG_ON(!dev->hw_ops.setfbaddr); BUG_ON(!dev->hw_ops.getfid); mutex_lock(&ccdc_lock); @@ -276,6 +286,8 @@ int vpfe_register_ccdc_device(struct ccdc_hw_device *dev) } ccdc_dev = dev; + dev->hw_ops.set_ccdc_base(ccdc_cfg->ccdc_addr, + ccdc_cfg->ccdc_addr_size); unlock: mutex_unlock(&ccdc_lock); return ret; @@ -2170,12 +2182,37 @@ static __init int vpfe_probe(struct platform_device *pdev) } vpfe_dev->ccdc_irq1 = res1->start; + /* Get address base of CCDC */ + res1 = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res1) { + v4l2_err(pdev->dev.driver, + "Unable to get register address map\n"); + ret = -ENOENT; + goto probe_disable_clock; + } + + ccdc_cfg->ccdc_addr_size = res1->end - res1->start + 1; + if (!request_mem_region(res1->start, ccdc_cfg->ccdc_addr_size, + pdev->dev.driver->name)) { + v4l2_err(pdev->dev.driver, + "Failed request_mem_region for ccdc base\n"); + ret = -ENXIO; + goto probe_disable_clock; + } + ccdc_cfg->ccdc_addr = ioremap_nocache(res1->start, + ccdc_cfg->ccdc_addr_size); + if (!ccdc_cfg->ccdc_addr) { + v4l2_err(pdev->dev.driver, "Unable to ioremap ccdc addr\n"); + ret = -ENXIO; + goto probe_out_release_mem1; + } + ret = request_irq(vpfe_dev->ccdc_irq0, vpfe_isr, IRQF_DISABLED, "vpfe_capture0", vpfe_dev); if (0 != ret) { v4l2_err(pdev->dev.driver, "Unable to request interrupt\n"); - goto probe_disable_clock; + goto probe_out_unmap1; } /* Allocate memory for video device */ @@ -2331,6 +2368,10 @@ probe_out_video_release: video_device_release(vpfe_dev->video_dev); probe_out_release_irq: free_irq(vpfe_dev->ccdc_irq0, vpfe_dev); +probe_out_unmap1: + iounmap(ccdc_cfg->ccdc_addr); +probe_out_release_mem1: + release_mem_region(res1->start, res1->end - res1->start + 1); probe_disable_clock: vpfe_disable_clock(vpfe_dev); mutex_unlock(&ccdc_lock); @@ -2346,6 +2387,7 @@ probe_free_dev_mem: static int vpfe_remove(struct platform_device *pdev) { struct vpfe_device *vpfe_dev = platform_get_drvdata(pdev); + struct resource *res; v4l2_info(pdev->dev.driver, "vpfe_remove\n"); @@ -2353,6 +2395,11 @@ static int vpfe_remove(struct platform_device *pdev) kfree(vpfe_dev->sd); v4l2_device_unregister(&vpfe_dev->v4l2_dev); video_unregister_device(vpfe_dev->video_dev); + mutex_lock(&ccdc_lock); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + release_mem_region(res->start, res->end - res->start + 1); + iounmap(ccdc_cfg->ccdc_addr); + mutex_unlock(&ccdc_lock); vpfe_disable_clock(vpfe_dev); kfree(vpfe_dev); kfree(ccdc_cfg);