From patchwork Tue Apr 2 13:41:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2378561 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from comal.ext.ti.com (comal.ext.ti.com [198.47.26.152]) by patchwork1.kernel.org (Postfix) with ESMTP id DB40E3FDDA for ; Tue, 2 Apr 2013 13:45:46 +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 r32Dflm7009537; Tue, 2 Apr 2013 08:41:48 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r32Dfkaf011328; Tue, 2 Apr 2013 08:41:47 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Tue, 2 Apr 2013 08:41:45 -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 r32Dfj6T031313; Tue, 2 Apr 2013 08:41:45 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 9070280627; Tue, 2 Apr 2013 07:41:45 -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 E360B80626 for ; Tue, 2 Apr 2013 07:41:43 -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 r32Dfhtg012627 for ; Tue, 2 Apr 2013 08:41:43 -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 r32Dfh58009293 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 2 Apr 2013 08:41:43 -0500 Received: from [216.82.253.67:30835] by server-3.bemta-7.messagelabs.com id D7/2C-12019-610EA515; Tue, 02 Apr 2013 13:41:42 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-8.tower-158.messagelabs.com!1364910101!3077431!1 X-Originating-IP: [209.85.210.45] 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 16722 invoked from network); 2 Apr 2013 13:41:42 -0000 Received: from mail-da0-f45.google.com (HELO mail-da0-f45.google.com) (209.85.210.45) by server-8.tower-158.messagelabs.com with RC4-SHA encrypted SMTP; 2 Apr 2013 13:41:42 -0000 Received: by mail-da0-f45.google.com with SMTP id v40so199280dad.4 for ; Tue, 02 Apr 2013 06:41:41 -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=jqnv93hirHnAJtFHze+RIy/0SHTnmaIn2iXrHVnZpFw=; b=fzgNcSH+BTGzea9w+XerCwZzx4gMoGJf5Pz2ULshy7vn9NuK8Gh4zHyv7U3ZbbBcSO mQZtwJ+umbfqyE+WAql/2XpIRAsx9cwKHDBRTlibtja1hbcy0ZXx4Tv1cIO32NFisUJH TBPDbH1zwfiLvTHjeLvyN34f8gBVPNwBDivGyt4bO3vDzyZHBzuN+zQC7FPpNiSGu6Ty myLScRljDEo3+phM06NB880r/Qxz+HGxuxbKsCWbS06Lt5R9Pbi4ziWjjaH0bXxcb/Fu IS6niSRy1mfuBGAYDgsgfNUwN/ZN2Fw82h7aZ0f8csV6tWMmaDKVaAzcqiYmtcD1CMSu DexQ== X-Received: by 10.66.9.7 with SMTP id v7mr25334195paa.216.1364910101530; Tue, 02 Apr 2013 06:41:41 -0700 (PDT) Received: from localhost.localdomain ([59.98.242.90]) by mx.google.com with ESMTPS id m18sm2439871pad.17.2013.04.02.06.41.36 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 02 Apr 2013 06:41:40 -0700 (PDT) From: Prabhakar lad To: DLOS , LMML Subject: [PATCH v3] davinci: vpif: add pm_runtime support Date: Tue, 2 Apr 2013 19:11:30 +0530 Message-ID: <1364910090-5501-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. Signed-off-by: Lad, Prabhakar Cc: Mauro Carvalho Chehab Cc: Hans Verkuil Cc: Laurent Pinchart Cc: Sakari Ailus Cc: Sekhar Nori Acked-by: Hans Verkuil --- Changes for v3: 1: Removed pm_runtime_resume() from probe as pm_runtime_get() calls it as pointed by Hans. Changes for v2: 1: Removed use of clk API as pointed by Laurent and Sekhar. drivers/media/platform/davinci/vpif.c | 24 ++++++------------------ 1 files changed, 6 insertions(+), 18 deletions(-) diff --git a/drivers/media/platform/davinci/vpif.c b/drivers/media/platform/davinci/vpif.c index 3bc4db8..ea82a8b 100644 --- a/drivers/media/platform/davinci/vpif.c +++ b/drivers/media/platform/davinci/vpif.c @@ -23,8 +23,8 @@ #include #include #include -#include #include +#include #include #include @@ -46,8 +46,6 @@ spinlock_t vpif_lock; void __iomem *vpif_base; EXPORT_SYMBOL_GPL(vpif_base); -struct clk *vpif_clk; - /** * vpif_ch_params: video standard configuration parameters for vpif * The table must include all presets from supported subdevices. @@ -443,19 +441,13 @@ static int vpif_probe(struct platform_device *pdev) goto fail; } - vpif_clk = clk_get(&pdev->dev, "vpif"); - if (IS_ERR(vpif_clk)) { - status = PTR_ERR(vpif_clk); - goto clk_fail; - } - clk_prepare_enable(vpif_clk); + pm_runtime_enable(&pdev->dev); + pm_runtime_get(&pdev->dev); spin_lock_init(&vpif_lock); dev_info(&pdev->dev, "vpif probe success\n"); return 0; -clk_fail: - iounmap(vpif_base); fail: release_mem_region(res->start, res_len); return status; @@ -463,11 +455,7 @@ fail: static int vpif_remove(struct platform_device *pdev) { - if (vpif_clk) { - clk_disable_unprepare(vpif_clk); - clk_put(vpif_clk); - } - + pm_runtime_disable(&pdev->dev); iounmap(vpif_base); release_mem_region(res->start, res_len); return 0; @@ -476,13 +464,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; }