From patchwork Thu Mar 28 08:50:32 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2355591 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 CDAE2DF2A1 for ; Thu, 28 Mar 2013 08:54:59 +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 r2S8on3D004972; Thu, 28 Mar 2013 03:50:50 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r2S8onHL003074; Thu, 28 Mar 2013 03:50:49 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Thu, 28 Mar 2013 03:50:49 -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 r2S8onlB030455; Thu, 28 Mar 2013 03:50:49 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 33DAE80627; Thu, 28 Mar 2013 02:50:49 -0600 (CST) 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 04F4180626 for ; Thu, 28 Mar 2013 02:50:47 -0600 (CST) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r2S8okvZ008296 for ; Thu, 28 Mar 2013 03:50:46 -0500 (CDT) Received: from mail6.bemta7.messagelabs.com (mail6.bemta7.messagelabs.com [216.82.255.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id r2S8ojYV001492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 28 Mar 2013 03:50:46 -0500 Received: from [216.82.253.163:10633] by server-14.bemta-7.messagelabs.com id BC/CE-00330-56404515; Thu, 28 Mar 2013 08:50:45 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-4.tower-166.messagelabs.com!1364460644!12130659!1 X-Originating-IP: [209.85.210.41] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.8.6.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 28012 invoked from network); 28 Mar 2013 08:50:45 -0000 Received: from mail-da0-f41.google.com (HELO mail-da0-f41.google.com) (209.85.210.41) by server-4.tower-166.messagelabs.com with RC4-SHA encrypted SMTP; 28 Mar 2013 08:50:45 -0000 Received: by mail-da0-f41.google.com with SMTP id w4so4482464dam.14 for ; Thu, 28 Mar 2013 01:50:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=SdjnFJyozDfJ2lAWc8nQrwRC+Km/udEYvS+h5ApLBjw=; b=LEgdgHM1r22IGL1zvL7+rx1eeRIF4mftGUMxdHio1lUza9WEPQvKXWjA+KAa6gPb3R 1tzcMEPoVyUyUetabTSYEXbAO2mt02infhOsh1OJSZpQvtRZkUZQhhxmS1AtoVfzv6C3 +E5ga1gFNvK5fKC8ABXT6b9VJvxc5YYY5kBLg/SrBcb9PWunarSrws8vLheA4NBYLA4h e+31dnlCEEHZiGe61H9iKY/EoXxBzGH8Es8yNsYkkLjr5NW1dy4w2bS6DYWmMABVw8oQ 0ODK8iM3eU/Dtxscw9Njnh/nAwQg/tif2NxE9woJLwt6wAFQv0SYzNylgErdmdqg6DL7 /dQA== X-Received: by 10.68.75.109 with SMTP id b13mr34349493pbw.25.1364460644544; Thu, 28 Mar 2013 01:50:44 -0700 (PDT) Received: from localhost.localdomain ([122.166.13.141]) by mx.google.com with ESMTPS id hs8sm24771041pbc.27.2013.03.28.01.50.40 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 28 Mar 2013 01:50:43 -0700 (PDT) From: Prabhakar lad To: DLOS , LMML Subject: [PATCH] davinci: vpif: add pm_runtime support Date: Thu, 28 Mar 2013 14:20:32 +0530 Message-ID: <1364460632-21697-1-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 CC: Mauro Carvalho Chehab , LKML , Sakari Ailus , Hans Verkuil 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: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces@linux.davincidsp.com From: Lad, Prabhakar Add pm_runtime support to the TI Davinci VPIF driver. Along side this patch replaces clk_get() with devm_clk_get() to simplify the error handling. Signed-off-by: Lad, Prabhakar --- drivers/media/platform/davinci/vpif.c | 21 +++++++++++---------- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 28638a8..7d14625 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -44,7 +45,6 @@ static struct resource *res; spinlock_t vpif_lock; void __iomem *vpif_base; -struct clk *vpif_clk; /** * ch_params: video standard configuration parameters for vpif @@ -421,6 +421,7 @@ EXPORT_SYMBOL(vpif_channel_getfid); static int vpif_probe(struct platform_device *pdev) { + struct clk *vpif_clk; int status = 0; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); @@ -439,12 +440,17 @@ static int vpif_probe(struct platform_device *pdev) goto fail; } - vpif_clk = clk_get(&pdev->dev, "vpif"); + vpif_clk = devm_clk_get(&pdev->dev, "vpif"); if (IS_ERR(vpif_clk)) { status = PTR_ERR(vpif_clk); goto clk_fail; } - clk_prepare_enable(vpif_clk); + clk_put(vpif_clk); + + pm_runtime_enable(&pdev->dev); + pm_runtime_resume(&pdev->dev); + + pm_runtime_get(&pdev->dev); spin_lock_init(&vpif_lock); dev_info(&pdev->dev, "vpif probe success\n"); @@ -459,11 +465,6 @@ fail: static int vpif_remove(struct platform_device *pdev) { - if (vpif_clk) { - clk_disable_unprepare(vpif_clk); - clk_put(vpif_clk); - } - iounmap(vpif_base); release_mem_region(res->start, res_len); return 0; @@ -472,13 +473,13 @@ static int vpif_remove(struct platform_device *pdev) #ifdef CONFIG_PM static int vpif_suspend(struct device *dev) { - clk_disable_unprepare(vpif_clk); + pm_runtime_put(dev); return 0; } static int vpif_resume(struct device *dev) { - clk_prepare_enable(vpif_clk); + pm_runtime_get(dev); return 0; }