From patchwork Tue Aug 26 12:07:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 36006 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 300BD2054F for ; Tue, 26 Aug 2014 12:08:06 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id va2sf70073945obc.7 for ; Tue, 26 Aug 2014 05:08:05 -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=VkzdvXhqcbQsrDIxwOfo+RY6J9/WPxvisidcSZIlH+o=; b=L3cr1HlhmJdGmnCnaZ9/WEFQw/Pk1Re0tJFIfbuZv4d55xn9G+I2w7AxFl5GiUZs7G zGRKFbf4/o5yYjDI7V/z734AwibgX40tC3X3bmpw5w/Rsy9t47vJL4npdxS/kQ/Ql3Ib jrHnr8YkWIKQ/LZO4Kb1NXVp3iNwzoKpsVO086OMPQAnezO+wCdG/7KMl66vz+vgOdcl zkhMOku77bdlLAiKpf5wxAkTHWDe7vV3OnRr0E+MY78o8f17ztcHOV92fuUcCWuMB1bg oX+1PJM01GApymAHrpVFwf1OJiQO+DMAf/M9fixEH3R2wvEakkZiAgha1VF18AwFDhrM /Vaw== X-Gm-Message-State: ALoCoQm2PDe8X06iSqYS4zRSnACmAEMKro1kD+VBUaYwWUznDp/5SM20CF3Q+thN3vnPqG91tbKB X-Received: by 10.50.28.68 with SMTP id z4mr3299670igg.2.1409054885768; Tue, 26 Aug 2014 05:08:05 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.108.230 with SMTP id j93ls2468271qgf.31.gmail; Tue, 26 Aug 2014 05:08:05 -0700 (PDT) X-Received: by 10.52.26.206 with SMTP id n14mr9814153vdg.0.1409054885622; Tue, 26 Aug 2014 05:08:05 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id dd1si1270466vdc.26.2014.08.26.05.08.05 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 05:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id ij19so16807862vcb.11 for ; Tue, 26 Aug 2014 05:08:05 -0700 (PDT) X-Received: by 10.220.74.195 with SMTP id v3mr23698002vcj.23.1409054885532; Tue, 26 Aug 2014 05:08:05 -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 uj3csp193053vcb; Tue, 26 Aug 2014 05:08:04 -0700 (PDT) X-Received: by 10.112.166.139 with SMTP id zg11mr26245187lbb.62.1409054883361; Tue, 26 Aug 2014 05:08:03 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by mx.google.com with ESMTPS id u1si3354533lae.37.2014.08.26.05.08.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 05:08:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by mail-lb0-f179.google.com with SMTP id v6so1212991lbi.38 for ; Tue, 26 Aug 2014 05:08:02 -0700 (PDT) X-Received: by 10.112.166.139 with SMTP id zg11mr26245139lbb.62.1409054882798; Tue, 26 Aug 2014 05:08: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 ai1sm4908979lbd.12.2014.08.26.05.08.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 26 Aug 2014 05:08:02 -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 8/9] amba: Add support for attach/detach of power domains Date: Tue, 26 Aug 2014 14:07:16 +0200 Message-Id: <1409054837-5667-9-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409054837-5667-1-git-send-email-ulf.hansson@linaro.org> References: <1409054837-5667-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.180 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 power domains. To be able to manage these devices from there, let's try to attach devices to their corresponding power domain during the probe phase. To reverse these actions at the remove phase, we try to detach the device from it's power domain. Signed-off-by: Ulf Hansson --- 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; }