From patchwork Fri Sep 19 18:27:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 37654 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f69.google.com (mail-wg0-f69.google.com [74.125.82.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 66D7E20293 for ; Fri, 19 Sep 2014 18:28:33 +0000 (UTC) Received: by mail-wg0-f69.google.com with SMTP id l18sf72445wgh.4 for ; Fri, 19 Sep 2014 11:28:32 -0700 (PDT) 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Zjsb8mJ2BAEW3w++JPSpHas/8fgD2dUL4DzCHx8Knxs=; b=F2yAi0FJ9MVL0U0nmvWvHwVVWtfWtV16OehmQqYogOB855va7BREc7fKB0jo9oM2U2 yczGIB1hwLS4cGYpmwTf50o1pMCOftL6Wm8yEeYreVPT2wJHRsJSHGfNecRh3AC7B4Ae k3MFh8XOl8g1FbyoT73yv/f9PnPalBatJY+NfngYOiA0cHGYxM/UTEX2JP5z2WJr0ZOq L5jFrLpDp1aU6PRvM+J16isk7jMgNnPXOPx8qQVYXb9qxwCKtdi1+NJy8XnRR63hQVM9 6vef1/47Tzrn6psnu5e32+8S6T2Ykr/u9HcXnyQu94ArKPYiuIwCAr6a5RG7qkFTmE5e /2JQ== X-Gm-Message-State: ALoCoQl/k0tFA9+hgWRBTcWrb9lTzWu/bRrNvvADSte/WwaEaU0Ybo2tE3H0ypmDvIB50E1TAb7j X-Received: by 10.152.26.225 with SMTP id o1mr2235024lag.4.1411151312521; Fri, 19 Sep 2014 11:28:32 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.80 with SMTP id v16ls362069laz.21.gmail; Fri, 19 Sep 2014 11:28:32 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr8554136lac.44.1411151312382; Fri, 19 Sep 2014 11:28:32 -0700 (PDT) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com [209.85.217.174]) by mx.google.com with ESMTPS id c10si3617832lab.76.2014.09.19.11.28.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Sep 2014 11:28:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id l4so3727191lbv.33 for ; Fri, 19 Sep 2014 11:28:32 -0700 (PDT) X-Received: by 10.152.42.136 with SMTP id o8mr8422524lal.71.1411151312305; Fri, 19 Sep 2014 11:28:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.130.169 with SMTP id of9csp989585lbb; Fri, 19 Sep 2014 11:28:31 -0700 (PDT) X-Received: by 10.67.5.40 with SMTP id cj8mr3870568pad.137.1411151302460; Fri, 19 Sep 2014 11:28:22 -0700 (PDT) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by mx.google.com with ESMTPS id xa3si4335953pab.24.2014.09.19.11.28.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 19 Sep 2014 11:28:22 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.52 as permitted sender) client-ip=209.85.220.52; Received: by mail-pa0-f52.google.com with SMTP id hz1so593550pad.25 for ; Fri, 19 Sep 2014 11:28:21 -0700 (PDT) X-Received: by 10.66.140.8 with SMTP id rc8mr3693662pab.75.1411151301769; Fri, 19 Sep 2014 11:28:21 -0700 (PDT) Received: from localhost.localdomain ([38.126.120.10]) by mx.google.com with ESMTPSA id ki1sm2495071pdb.59.2014.09.19.11.28.16 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 19 Sep 2014 11:28:20 -0700 (PDT) From: Ulf Hansson To: "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , linux-pm@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, Geert Uytterhoeven , Kevin Hilman , Alan Stern , Daniel Lezcano , Tomasz Figa , devicetree@vger.kernel.org, Linus Walleij , Simon Horman , Magnus Damm , Ben Dooks , Kukjin Kim , Stephen Boyd , Philipp Zabel , Mark Brown , Wolfram Sang , Chris Ball , Russell King , Dmitry Torokhov , Ulf Hansson Subject: [PATCH v5 09/11] amba: Add support for attach/detach of PM domains Date: Fri, 19 Sep 2014 20:27:42 +0200 Message-Id: <1411151264-16245-10-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1411151264-16245-1-git-send-email-ulf.hansson@linaro.org> References: <1411151264-16245-1-git-send-email-ulf.hansson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: ulf.hansson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , AMBA devices may on some SoCs resides in PM domains. To be able to manage these devices from there, let's try to attach devices to their corresponding PM domain during the probe phase. To reverse these actions at the remove phase, we try to detach the device from its PM domain. Signed-off-by: Ulf Hansson Reviewed-by: Kevin Hilman --- drivers/amba/bus.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 3cf61a1..8f52393 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c @@ -182,9 +182,15 @@ static int amba_probe(struct device *dev) int ret; do { + ret = dev_pm_domain_attach(dev, true); + if (ret == -EPROBE_DEFER) + break; + ret = amba_get_enable_pclk(pcdev); - if (ret) + if (ret) { + dev_pm_domain_detach(dev, true); break; + } pm_runtime_get_noresume(dev); pm_runtime_set_active(dev); @@ -199,6 +205,7 @@ static int amba_probe(struct device *dev) pm_runtime_put_noidle(dev); amba_put_disable_pclk(pcdev); + dev_pm_domain_detach(dev, true); } while (0); return ret; @@ -220,6 +227,7 @@ static int amba_remove(struct device *dev) pm_runtime_put_noidle(dev); amba_put_disable_pclk(pcdev); + dev_pm_domain_detach(dev, true); return ret; }