From patchwork Sat Feb 22 15:53:41 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: 25134 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0EC6F2066E for ; Sat, 22 Feb 2014 15:55:02 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id to1sf13445559ieb.3 for ; Sat, 22 Feb 2014 07:55:02 -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=73yh8OJY25IyoyvGExhtXPe4atsSjYvHEh0yEqfKRi8=; b=QHZJW3oB4TkzFwGeTHR7kSYZRHjmUT+mto4EsnF1h67N0uEKU50YarBbfabtkX7bYZ 6DIsJtIsEpUYWhWwmFRYBydjOC1/GJpBaW59bpBGWjlnO1fQL91cLk/tdBDeSaR0oqpn x5Xrg3NR38UKbqZyue1kQjZtr97VMV6UBPai6ThM7HoOSb7/4UqOWlxPdsM9sWEX7twZ R24Oi1Q8UhKJfIk6ClmKZf8l7eatCoVwC0YNaVq5rLys5XCD5xf/W0D80DEOA+hrzjnz ikVh5EBiFKQFOmTYOS+cMWYbrp0kjXew2WyAgnf5PAez2xRY0tm/BTrqZzc4e8CA9mPF wjBg== X-Gm-Message-State: ALoCoQld6XL+Jq30CLff90ZCC0cDrZ2UfMzl95miPgS61SJP4cC0Bh+mafdmEE6RnKLb8rv2zBT6 X-Received: by 10.50.88.100 with SMTP id bf4mr5025715igb.1.1393084502183; Sat, 22 Feb 2014 07:55:02 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.34.235 with SMTP id l98ls1324056qgl.90.gmail; Sat, 22 Feb 2014 07:55:02 -0800 (PST) X-Received: by 10.52.243.164 with SMTP id wz4mr6746853vdc.31.1393084502008; Sat, 22 Feb 2014 07:55:02 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id wz4si4214441vdc.98.2014.02.22.07.55.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 22 Feb 2014 07:55:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.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.220.174; Received: by mail-vc0-f174.google.com with SMTP id im17so4431457vcb.33 for ; Sat, 22 Feb 2014 07:55:01 -0800 (PST) X-Received: by 10.52.246.227 with SMTP id xz3mr6797582vdc.95.1393084501919; Sat, 22 Feb 2014 07:55:01 -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 u4csp112280vcz; Sat, 22 Feb 2014 07:55:01 -0800 (PST) X-Received: by 10.68.227.4 with SMTP id rw4mr15630386pbc.3.1393084492403; Sat, 22 Feb 2014 07:54:52 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n8si8817065pab.29.2014.02.22.07.54.51; Sat, 22 Feb 2014 07:54:51 -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 S1751793AbaBVPyv (ORCPT + 9 others); Sat, 22 Feb 2014 10:54:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53325 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751786AbaBVPyu (ORCPT ); Sat, 22 Feb 2014 10:54:50 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s1MFsL41012619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 22 Feb 2014 10:54:21 -0500 Received: from shalem.localdomain.com (vpn1-6-222.ams2.redhat.com [10.36.6.222]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s1MFrjaF003748; Sat, 22 Feb 2014 10:54:18 -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 v7 12/15] ata: ahci_platform: runtime resume the device before use Date: Sat, 22 Feb 2014 16:53:41 +0100 Message-Id: <1393084424-31099-13-git-send-email-hdegoede@redhat.com> In-Reply-To: <1393084424-31099-1-git-send-email-hdegoede@redhat.com> References: <1393084424-31099-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 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.220.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: , 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 after .remove(). 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.h | 1 + drivers/ata/ahci_platform.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 3ab7ac9..51af275 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h @@ -324,6 +324,7 @@ struct ahci_host_priv { u32 em_loc; /* enclosure management location */ u32 em_buf_sz; /* EM buffer size in byte */ u32 em_msg_type; /* EM message type */ + bool got_runtime_pm; /* Did we do pm_runtime_get? */ struct clk *clks[AHCI_MAX_CLKS]; /* Optional */ struct regulator *target_pwr; /* Optional */ struct phy *phy; /* If platform uses phy */ diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 99d38c1..75698a4 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); @@ -229,6 +230,11 @@ static void ahci_platform_put_resources(struct device *dev, void *res) struct ahci_host_priv *hpriv = res; int c; + if (hpriv->got_runtime_pm) { + 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]); } @@ -326,6 +332,10 @@ struct ahci_host_priv *ahci_platform_get_resources( } } + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); + hpriv->got_runtime_pm = true; + devres_remove_group(dev, NULL); return hpriv; @@ -635,6 +645,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: