From patchwork Thu Aug 28 08:39:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 36167 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8CD48202DD for ; Thu, 28 Aug 2014 08:39:31 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id rl12sf6328594iec.9 for ; Thu, 28 Aug 2014 01:39:31 -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=gZL0sattwfOJD1LhV1HhanmWB0bmvAmM+XhCGuITVG6cOirRAeLLOK9pzWKHL8BTiS K4KHcE0M27yQMtCtS73B997C0Ja/oD/VWz+7IN6AODuZPrlbu1qfrCLGeheaR0NtPF2q MZ5VUZD9jrV9ip8cZp+hJekjIR7s4j/OBiFnh4i0qpAU80nY9NQJMaI1UaDJqx/OnMFy /sDpu1mVCv6roTjkYHWN8u8QKdnbAFF5a33fxXXkoDfAVKt60Xe2WcKVTswAT0v4vFrn kp5UUAiad7OY/Xn+LBVyi7rJ9nWXvoIz4kpAjUDI8QkI/zUBvxy7PnZo6tEq/I4YS4HX hWxg== X-Gm-Message-State: ALoCoQl576EJ6IrwD5gPDekMdGlQnJAsEBbibrp5C4R7rXnUe4pcCQLM+/GCUG/mC14clCom3nHm X-Received: by 10.42.133.200 with SMTP id i8mr1982185ict.14.1409215171128; Thu, 28 Aug 2014 01:39:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.97.134 with SMTP id m6ls472361qge.8.gmail; Thu, 28 Aug 2014 01:39:31 -0700 (PDT) X-Received: by 10.220.163.69 with SMTP id z5mr2054664vcx.10.1409215171035; Thu, 28 Aug 2014 01:39:31 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id yx12si2918506vdb.70.2014.08.28.01.39.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 01:39:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id hq11so451439vcb.14 for ; Thu, 28 Aug 2014 01:39:31 -0700 (PDT) X-Received: by 10.52.243.10 with SMTP id wu10mr29898vdc.45.1409215170968; Thu, 28 Aug 2014 01:39:30 -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 uj3csp201180vcb; Thu, 28 Aug 2014 01:39:30 -0700 (PDT) X-Received: by 10.152.115.171 with SMTP id jp11mr518755lab.90.1409215169690; Thu, 28 Aug 2014 01:39:29 -0700 (PDT) Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by mx.google.com with ESMTPS id wq5si4240801lac.65.2014.08.28.01.39.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 28 Aug 2014 01:39:29 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.215.46 as permitted sender) client-ip=209.85.215.46; Received: by mail-la0-f46.google.com with SMTP id pv20so514222lab.19 for ; Thu, 28 Aug 2014 01:39:29 -0700 (PDT) X-Received: by 10.152.28.67 with SMTP id z3mr2805982lag.12.1409215169188; Thu, 28 Aug 2014 01:39:29 -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 t12sm4826676lbp.44.2014.08.28.01.39.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 28 Aug 2014 01:39:28 -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 v2 8/9] amba: Add support for attach/detach of power domains Date: Thu, 28 Aug 2014 10:39:01 +0200 Message-Id: <1409215142-8218-9-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409215142-8218-1-git-send-email-ulf.hansson@linaro.org> References: <1409215142-8218-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.169 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; }