From patchwork Fri Jul 20 14:11:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar Lad X-Patchwork-Id: 1221271 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by patchwork2.kernel.org (Postfix) with ESMTP id A6A79E0038 for ; Fri, 20 Jul 2012 14:13:48 +0000 (UTC) Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q6KEBwKJ006729; Fri, 20 Jul 2012 09:11:58 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6KEBwo7030977; Fri, 20 Jul 2012 09:11:58 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Fri, 20 Jul 2012 09:11:58 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6KEBwFX012316; Fri, 20 Jul 2012 09:11:58 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 323AE80627; Fri, 20 Jul 2012 09:11:58 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dbdp20.itg.ti.com (dbdp20.itg.ti.com [172.24.170.38]) by linux.omap.com (Postfix) with ESMTP id 3E63C80626 for ; Fri, 20 Jul 2012 09:11:56 -0500 (CDT) Received: from DBDE70.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6KEBsie015859; Fri, 20 Jul 2012 19:41:55 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by dbde70.ent.ti.com (172.24.170.148) with Microsoft SMTP Server id 14.1.323.3; Fri, 20 Jul 2012 19:41:54 +0530 Received: from localhost.localdomain (dbdp20.itg.ti.com [172.24.170.38]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q6KEBrS4004775; Fri, 20 Jul 2012 19:41:53 +0530 From: Prabhakar Lad To: LMML Subject: [PATCH] davinci: vpss: enable vpss clocks Date: Fri, 20 Jul 2012 19:41:37 +0530 Message-ID: <1342793497-27793-1-git-send-email-prabhakar.lad@ti.com> X-Mailer: git-send-email 1.7.0.4 MIME-Version: 1.0 CC: dlos X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Lad, Prabhakar By default the VPSS clocks are only enabled in capture driver. and display wont work if the capture is not enabled. This patch adds support to enable the VPSS clocks in VPSS driver. This way we can enable/disable capture and display and use it independently. Signed-off-by: Lad, Prabhakar Signed-off-by: Manjunath Hadli --- drivers/media/video/davinci/vpss.c | 38 ++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-) diff --git a/drivers/media/video/davinci/vpss.c b/drivers/media/video/davinci/vpss.c index 3e5cf27..30283bb 100644 --- a/drivers/media/video/davinci/vpss.c +++ b/drivers/media/video/davinci/vpss.c @@ -25,6 +25,9 @@ #include #include #include +#include +#include + #include #include @@ -104,6 +107,10 @@ struct vpss_oper_config { enum vpss_platform_type platform; spinlock_t vpss_lock; struct vpss_hw_ops hw_ops; + /* Master clock */ + struct clk *mclk; + /* slave clock */ + struct clk *sclk; }; static struct vpss_oper_config oper_cfg; @@ -381,6 +388,29 @@ static int __init vpss_probe(struct platform_device *pdev) return -ENODEV; } + /* Get and enable Master clock */ + oper_cfg.mclk = clk_get(&pdev->dev, "master"); + if (IS_ERR(oper_cfg.mclk)) { + status = PTR_ERR(oper_cfg.mclk); + goto fail_getclk; + } + if (clk_enable(oper_cfg.mclk)) { + status = -ENODEV; + goto fail_mclk; + } + if (oper_cfg.platform == DM355 || oper_cfg.platform == DM644X) { + /* Get and enable Slave clock */ + oper_cfg.sclk = clk_get(&pdev->dev, "slave"); + if (IS_ERR(oper_cfg.sclk)) { + status = PTR_ERR(oper_cfg.sclk); + goto fail_mclk; + } + if (clk_enable(oper_cfg.sclk)) { + status = -ENODEV; + goto fail_sclk; + } + } + dev_info(&pdev->dev, "%s vpss probed\n", platform_name); r1 = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!r1) @@ -442,6 +472,11 @@ fail2: iounmap(oper_cfg.vpss_regs_base0); fail1: release_mem_region(r1->start, resource_size(r1)); +fail_sclk: + clk_put(oper_cfg.sclk); +fail_mclk: + clk_put(oper_cfg.mclk); +fail_getclk: return status; } @@ -452,6 +487,9 @@ static int __devexit vpss_remove(struct platform_device *pdev) iounmap(oper_cfg.vpss_regs_base0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(res->start, resource_size(res)); + clk_put(oper_cfg.mclk); + if (oper_cfg.platform == DM355 || oper_cfg.platform == DM644X) + clk_put(oper_cfg.sclk); if (oper_cfg.platform == DM355 || oper_cfg.platform == DM365) { iounmap(oper_cfg.vpss_regs_base1); res = platform_get_resource(pdev, IORESOURCE_MEM, 1);