From patchwork Tue Sep 9 11:36:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 37102 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f71.google.com (mail-pa0-f71.google.com [209.85.220.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 176F920491 for ; Tue, 9 Sep 2014 11:37:07 +0000 (UTC) Received: by mail-pa0-f71.google.com with SMTP id rd3sf23124748pab.6 for ; Tue, 09 Sep 2014 04:37:06 -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=lC2UBWPN5WI3jGxNl4TVg9x2AzBI2I4CB3YgvZUopUmdxFu5nb9++wtHwIWZNoU+hi c+C7AkDo/LCeeJecnR3fZKpIxw3x43Qwh0vNm7apRT45F+q/bwW68kCRVbraXDl87IvB lAAtY6r7pZ6o5s1fVkTylZ5g2MdHT1bePd+p/Rtp20smZ96zh1dGWGmdeoit9uSg5DIp TwestLTY0vc2Cqirl1xNIjdmmOUyQAQLSxAVKBu7zMLwDc62kUxBGEeYXYz/nkxq+bnm 411y2IEiEBhhFWxPJ2TKdkDeMhmZzDrQzMb4MFRUjbuOm+j9NDvMEAMIj1WKng1vopWO CjrA== X-Gm-Message-State: ALoCoQlrrXL/Z6XdrW8dJdh6IhqQY7PlCJxDmH66DZsl1GSApUzekJTGx6cfZHB9N4Ux4nod5CId X-Received: by 10.66.196.193 with SMTP id io1mr7404684pac.28.1410262626273; Tue, 09 Sep 2014 04:37:06 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.38.176 with SMTP id t45ls2109824qgt.60.gmail; Tue, 09 Sep 2014 04:37:06 -0700 (PDT) X-Received: by 10.221.68.66 with SMTP id xx2mr30507253vcb.1.1410262626165; Tue, 09 Sep 2014 04:37:06 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id dx5si5696344vdb.10.2014.09.09.04.37.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 04:37:06 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy10so2465588vcb.19 for ; Tue, 09 Sep 2014 04:37:06 -0700 (PDT) X-Received: by 10.52.103.8 with SMTP id fs8mr339446vdb.77.1410262626058; Tue, 09 Sep 2014 04:37:06 -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.221.45.67 with SMTP id uj3csp270241vcb; Tue, 9 Sep 2014 04:37:05 -0700 (PDT) X-Received: by 10.112.130.129 with SMTP id oe1mr2299476lbb.4.1410262623092; Tue, 09 Sep 2014 04:37:03 -0700 (PDT) Received: from mail-lb0-f175.google.com (mail-lb0-f175.google.com [209.85.217.175]) by mx.google.com with ESMTPS id t2si17443414lbm.102.2014.09.09.04.37.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 09 Sep 2014 04:37:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.175 as permitted sender) client-ip=209.85.217.175; Received: by mail-lb0-f175.google.com with SMTP id v6so2713185lbi.34 for ; Tue, 09 Sep 2014 04:37:02 -0700 (PDT) X-Received: by 10.152.10.203 with SMTP id k11mr19381756lab.30.1410262622612; Tue, 09 Sep 2014 04:37:02 -0700 (PDT) Received: from uffe-Latitude-E6430s.lan (90-231-160-185-no158.tbcn.telia.com. [90.231.160.185]) by mx.google.com with ESMTPSA id gn7sm4476961lbc.10.2014.09.09.04.36.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 Sep 2014 04:37:01 -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 , Ulf Hansson Subject: [PATCH v4 8/9] amba: Add support for attach/detach of PM domains Date: Tue, 9 Sep 2014 13:36:09 +0200 Message-Id: <1410262570-22785-9-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1410262570-22785-1-git-send-email-ulf.hansson@linaro.org> References: <1409838756-31963-1-git-send-email-ulf.hansson@linaro.org> <1410262570-22785-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.220.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; }