From patchwork Thu Jan 9 10:56:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 22999 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 58BBF216D9 for ; Thu, 9 Jan 2014 10:57:23 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id e14sf11742662iej.8 for ; Thu, 09 Jan 2014 02:57:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=mwRGtEhLv//8Fuc+sUOhvWi73p6OgNydhxaQsbYz7Vo=; b=MYF333FNYLFpUG9bSSLG/Jc8KA+5cG4BscBVONZTH93LG8TJ9tQG92fd8jpAbRKu+I fI/5KgHzmN2ZP6w8DaOw6Tt17IT++Z7nFqWsW64tWDm6lbnBFckj4WCPojCKzNdhZhlT 5ZQyQZWVRNDe2No8SL566sj72LT1284iDcDtygp2lkGdHPKkQUr1bkiojvboiFKhOG2z uA0/1n3Vw+4X2tNto/7m+QA2rlqctPmGp+ylsMYbFrpD1SsxvYYEu1YLmNEJ/NRTNYJp rtMZJj4KJRG0oH4jDdvW6E8EkFYQLvk31GljVoHeYS6LTPr2zg0s/WTwYTieq95F6h0T 4a4g== X-Gm-Message-State: ALoCoQkpExpTDPUp76RC0i3y3jfeOct7i25MaHNhT9cz1KpV69QU9eSw5RvbDaWLOucaxdvU5F2o X-Received: by 10.42.123.139 with SMTP id s11mr750771icr.15.1389265042616; Thu, 09 Jan 2014 02:57:22 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.76.72 with SMTP id i8ls961450qew.59.gmail; Thu, 09 Jan 2014 02:57:22 -0800 (PST) X-Received: by 10.52.236.132 with SMTP id uu4mr842587vdc.47.1389265042513; Thu, 09 Jan 2014 02:57:22 -0800 (PST) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by mx.google.com with ESMTPS id xb5si2618413vdc.42.2014.01.09.02.57.22 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 09 Jan 2014 02:57:22 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.174; Received: by mail-ve0-f174.google.com with SMTP id pa12so2246831veb.19 for ; Thu, 09 Jan 2014 02:57:22 -0800 (PST) X-Received: by 10.52.227.233 with SMTP id sd9mr835386vdc.53.1389265042387; Thu, 09 Jan 2014 02:57:22 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp4144ved; Thu, 9 Jan 2014 02:57:21 -0800 (PST) X-Received: by 10.68.198.68 with SMTP id ja4mr3010062pbc.24.1389265041398; Thu, 09 Jan 2014 02:57:21 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bc9si3570006pbd.251.2014.01.09.02.57.20; Thu, 09 Jan 2014 02:57:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754772AbaAIK5N (ORCPT + 26 others); Thu, 9 Jan 2014 05:57:13 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:41719 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754480AbaAIK4f (ORCPT ); Thu, 9 Jan 2014 05:56:35 -0500 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id s09AuLBv014829; Thu, 9 Jan 2014 04:56:21 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s09AuLOU009194; Thu, 9 Jan 2014 04:56:21 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Thu, 9 Jan 2014 04:56:21 -0600 Received: from rockdesk.local.lan (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s09Au4Kf012806; Thu, 9 Jan 2014 04:56:17 -0600 From: Roger Quadros To: CC: , , , , , , , , Roger Quadros , Balaji T K Subject: [PATCH v4 3/3] ata: ahci_platform: runtime resume the device before use Date: Thu, 9 Jan 2014 16:26:02 +0530 Message-ID: <1389264962-22858-4-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1389264962-22858-1-git-send-email-rogerq@ti.com> References: <1389264962-22858-1-git-send-email-rogerq@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: rogerq@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.174 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On OMAP platforms the device needs to be runtime resumed before it can be accessed. The OMAP HWMOD framework takes care of enabling the module and its resources based on the device's runtime PM state. In this patch we runtime resume during .probe() and runtime suspend during .remove() (i.e. ahci_host_stop()). We also update the runtime PM state during .resume(). Signed-off-by: Roger Quadros Signed-off-by: Balaji T K --- drivers/ata/ahci_platform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index b476642..8a70e5b 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "ahci.h" static void ahci_host_stop(struct ata_host *host); @@ -142,6 +143,9 @@ static int ahci_probe(struct platform_device *pdev) } } + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); + hpriv->phy = devm_phy_get(dev, "sata-phy"); if (IS_ERR(hpriv->phy)) { rc = PTR_ERR(hpriv->phy); @@ -287,6 +291,9 @@ static void ahci_host_stop(struct ata_host *host) clk_disable_unprepare(hpriv->clk); clk_put(hpriv->clk); } + + pm_runtime_put_sync(dev); + pm_runtime_disable(dev); } #ifdef CONFIG_PM_SLEEP @@ -358,6 +365,11 @@ static int ahci_resume(struct device *dev) ata_host_resume(host); + /* We resumed so update PM runtime state */ + pm_runtime_disable(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return 0; disable_unprepare_clk: