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: 4780891 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 60C8A9F383 for ; Tue, 26 Aug 2014 12:08:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 252F920176 for ; Tue, 26 Aug 2014 12:08:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B5E09201C0 for ; Tue, 26 Aug 2014 12:08:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757914AbaHZMIO (ORCPT ); Tue, 26 Aug 2014 08:08:14 -0400 Received: from mail-lb0-f181.google.com ([209.85.217.181]:60555 "EHLO mail-lb0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757921AbaHZMIE (ORCPT ); Tue, 26 Aug 2014 08:08:04 -0400 Received: by mail-lb0-f181.google.com with SMTP id 10so1241230lbg.12 for ; Tue, 26 Aug 2014 05:08:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=VkzdvXhqcbQsrDIxwOfo+RY6J9/WPxvisidcSZIlH+o=; b=VrpaEOx6nI8SjefT/A6ZmBIr+xdbLzLMQ9y2W7uZrEXBMVIfU5dzb77bH1J5Tm5NNu DHn0QMPp9T29hrT1OdiqgTxLLSD9ecQfupA1sCOfRdLE4s7a1Ynql8a2ymX/LsmZFxFD BfU/DRmPi7TGDRSbixYcV2zINj/prrhYBBbRjCl6hfQ4KWwanO4OR2iVQ4mXP++JZt3n uI6FdhWnRmcoSrLNBt/Y2L+/Rl3YA2drHUWzGwMSfpgzQFiQb8aEMvPRtaQZGuQaglHT +xDhMLcHunXpqe8j+3rUt3us44gnwc7/wWhNh2HCJwHBM5AakAjwSZBgzsM+pQ/4/sZq grMA== X-Gm-Message-State: ALoCoQn3S1UV36DKMkzTEqRZ1PKUm3K2kVLNgn+tznz8TnHNLQn5cVcUO7bfm7IQBJrJVkjGVW1m 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> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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; }