From patchwork Mon Jan 20 14:41:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 23404 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yk0-f199.google.com (mail-yk0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 29DD32107B for ; Mon, 20 Jan 2014 14:42:33 +0000 (UTC) Received: by mail-yk0-f199.google.com with SMTP id 142sf14750999ykq.2 for ; Mon, 20 Jan 2014 06:42:32 -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=Dg9LoY61gdmNMFutwmAahvvVaC5S/IXcvWX8uO82bII=; b=OpcFwnNh2U/s/neNvfWTAJfHGaHIJaJlKls/n6oJU3BZniQZ1D6tIWo2nVfeVd6Ayw VsAPfSf7/eFXMRFSXKYxHpydKHdWMxMMVRfOHavK/voBQLH/ycE/sqkRItXJCXZTHey0 3UiM9fbfARE2RRvbf1PCDzIhS0qKD74f9z1vuLYzaw7FpKZ1toJvcD2Y0bGBso/74fTS TOxOcHyo1GnmyVfVvhLO0ipOgxyHIfsrjzektuHtAW1B6BANji9RtcWCHjqQD1YVAkz1 OeOd6ADopEth3QepeLXobkBtVGYQLPKd7nIFPDCKMrCEHXcfucna6LCXC26PZZqD2ZhN Lq4Q== X-Gm-Message-State: ALoCoQlGyrIWtqIy/25gIvQ2yRyuNWqRbDmoWtsd45mvHTFuXKUaiqPwfaeAfGCFT/r2VV7cu58M X-Received: by 10.236.127.199 with SMTP id d47mr5503459yhi.29.1390228952365; Mon, 20 Jan 2014 06:42:32 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.100.146 with SMTP id s18ls543470qge.8.gmail; Mon, 20 Jan 2014 06:42:32 -0800 (PST) X-Received: by 10.58.181.165 with SMTP id dx5mr4004896vec.19.1390228952178; Mon, 20 Jan 2014 06:42:32 -0800 (PST) Received: from mail-ve0-f176.google.com (mail-ve0-f176.google.com [209.85.128.176]) by mx.google.com with ESMTPS id tt2si396006vdc.152.2014.01.20.06.42.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 20 Jan 2014 06:42:32 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.176 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.176; Received: by mail-ve0-f176.google.com with SMTP id oz11so1746553veb.35 for ; Mon, 20 Jan 2014 06:42:32 -0800 (PST) X-Received: by 10.52.117.115 with SMTP id kd19mr8970208vdb.15.1390228952081; Mon, 20 Jan 2014 06:42:32 -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.220.174.196 with SMTP id u4csp61206vcz; Mon, 20 Jan 2014 06:42:31 -0800 (PST) X-Received: by 10.68.224.195 with SMTP id re3mr18996518pbc.93.1390228950947; Mon, 20 Jan 2014 06:42:30 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si1686307pax.276.2014.01.20.06.42.29; Mon, 20 Jan 2014 06:42:29 -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 S1753951AbaATOmX (ORCPT + 26 others); Mon, 20 Jan 2014 09:42:23 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:47800 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753870AbaATOl6 (ORCPT ); Mon, 20 Jan 2014 09:41:58 -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 s0KEflqm024444; Mon, 20 Jan 2014 08:41:47 -0600 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s0KEflQ2017431; Mon, 20 Jan 2014 08:41:47 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Mon, 20 Jan 2014 08:41:47 -0600 Received: from localhost.localdomain (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s0KEfUYp010156; Mon, 20 Jan 2014 08:41:44 -0600 From: Roger Quadros To: CC: , , , , , , , , Roger Quadros , Balaji T K Subject: [PATCH v5 4/4] ata: ahci_platform: runtime resume the device before use Date: Mon, 20 Jan 2014 16:41:28 +0200 Message-ID: <1390228888-5537-5-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1390228888-5537-1-git-send-email-rogerq@ti.com> References: <1390228888-5537-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.176 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 Reviewed-by: Bartlomiej Zolnierkiewicz --- 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 580567f..b3a48bb 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); @@ -285,6 +289,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 @@ -356,6 +363,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: