From patchwork Wed Feb 19 12:01:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 24949 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 293BC2054E for ; Wed, 19 Feb 2014 12:03:56 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf1064214iec.8 for ; Wed, 19 Feb 2014 04:03:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=6yd/q4rVsZZQNZIFpat5Ab3ubhOzOk1WrxHJeZ/xfxI=; b=HTEyWduGIGn1QWrA1w4IgiXDNPu4fH+vFGZfK7TSTFmO48fC3aKoNDPYgugRcU1wdH GggpWka/30UAUhWkUGxonlN2TimVsmCePyShmPCgOXlYmVYJcmIz41wTkY0W/V5F1Zrb Koow9P2nrtztgm9gRU1HW41bqM2z2NWp/YGaSK75tMzKLxHr57m8V6X2zpBgZUvUMpFA Jvc0nlKnbgjbPxFOn4xWTwzxTSfS6vJfjVtMT9t6Pw+bupQJ0tYpIEb82SqVirhyO0Sh jawDN1QtmysnT/GZF+h2X5XDSHQgUnpiIXfOCgMjjoxPrFN5KvcKxGnOXRMgHqqZpMUz ssRA== X-Gm-Message-State: ALoCoQkcoHonQZKhF2T0BT0e2WvIe4HI4oloMlw66aa1SNKtWkL6JU9XC5KBy2BEdrXg5jfTZXus X-Received: by 10.42.235.132 with SMTP id kg4mr13840241icb.32.1392811435587; Wed, 19 Feb 2014 04:03:55 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.106.71 with SMTP id d65ls62655qgf.60.gmail; Wed, 19 Feb 2014 04:03:55 -0800 (PST) X-Received: by 10.221.29.137 with SMTP id ry9mr25230112vcb.6.1392811435470; Wed, 19 Feb 2014 04:03:55 -0800 (PST) Received: from mail-ve0-f173.google.com (mail-ve0-f173.google.com [209.85.128.173]) by mx.google.com with ESMTPS id cz20si6669947veb.91.2014.02.19.04.03.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Feb 2014 04:03:55 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.173 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.173; Received: by mail-ve0-f173.google.com with SMTP id jw12so258757veb.18 for ; Wed, 19 Feb 2014 04:03:55 -0800 (PST) X-Received: by 10.220.81.71 with SMTP id w7mr217655vck.71.1392811435387; Wed, 19 Feb 2014 04:03:55 -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 u4csp291725vcz; Wed, 19 Feb 2014 04:03:54 -0800 (PST) X-Received: by 10.68.212.161 with SMTP id nl1mr1782121pbc.142.1392811434534; Wed, 19 Feb 2014 04:03:54 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3si21792451pbh.130.2014.02.19.04.03.53; Wed, 19 Feb 2014 04:03:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of devicetree-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 S1752909AbaBSMDw (ORCPT + 9 others); Wed, 19 Feb 2014 07:03:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22080 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbaBSMDv (ORCPT ); Wed, 19 Feb 2014 07:03:51 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1JC3Og4021137 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Feb 2014 07:03:25 -0500 Received: from shalem.localdomain.com (vpn1-4-52.ams2.redhat.com [10.36.4.52]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s1JC24jP012728; Wed, 19 Feb 2014 07:03:19 -0500 From: Hans de Goede To: Tejun Heo , Maxime Ripard Cc: Oliver Schinagl , Richard Zhu , Roger Quadros , Lee Jones , linux-ide@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Balaji T K , Hans de Goede Subject: [PATCH v6 15/18] ata: ahci_platform: runtime resume the device before use Date: Wed, 19 Feb 2014 13:01:57 +0100 Message-Id: <1392811320-3132-16-git-send-email-hdegoede@redhat.com> In-Reply-To: <1392811320-3132-1-git-send-email-hdegoede@redhat.com> References: <1392811320-3132-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: hdegoede@redhat.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.173 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: , From: Roger Quadros 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(). CC: Balaji T K Signed-off-by: Roger Quadros Signed-off-by: Hans de Goede --- 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 f8ef780..bb2e7ab 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -24,6 +24,7 @@ #include #include #include +#include #include "ahci.h" static void ahci_host_stop(struct ata_host *host); @@ -234,6 +235,9 @@ struct ahci_host_priv *ahci_platform_get_resources( } } + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); + return hpriv; free_clk: @@ -248,6 +252,9 @@ void ahci_platform_put_resources(struct device *dev, { int c; + pm_runtime_put_sync(dev); + pm_runtime_disable(dev); + for (c = 0; c < AHCI_MAX_CLKS && hpriv->clks[c]; c++) clk_put(hpriv->clks[c]); } @@ -480,6 +487,11 @@ int ahci_platform_resume(struct device *dev) if (rc) goto disable_resources; + /* We resumed so update PM runtime state */ + pm_runtime_disable(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); + return 0; disable_resources: