From patchwork Thu Sep 4 13:52:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 4845921 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 856CD9F2EC for ; Thu, 4 Sep 2014 13:53:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B6C220303 for ; Thu, 4 Sep 2014 13:53:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5CD2320377 for ; Thu, 4 Sep 2014 13:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753214AbaIDNxR (ORCPT ); Thu, 4 Sep 2014 09:53:17 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:50030 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753167AbaIDNxK (ORCPT ); Thu, 4 Sep 2014 09:53:10 -0400 Received: by mail-la0-f47.google.com with SMTP id el20so3332934lab.34 for ; Thu, 04 Sep 2014 06:53:08 -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=22ppTG3ng7XBlerzvAo/JagSfbPNnJ41Qd2iIbdPmks=; b=HYgTncMjjWO8PBjI9u2S5eh2W3RSrAFKjCkebcHq4z1MHmBgfKummcWbcHHY4p1k8+ PC2uVkPRU78iFH/CZSHxhNpxv0gMGfLc1wBG1nNZ0M7gTFu4BARKHP+KeJqypaZpjUof B87Hh0IvuEdh3QnzNpav9PP0E6/YlsAbLuWa9f51DISVUdf0XAcosKQDX6mLjX1yol3v oEGAzTwuoIbCcOMGEJ8pmjfbHPBxfvWVvjgKO7a1jKwKBMjXVEGdZAseXWCl+NWNmNcq 4D8/2Qn0hyGRhepPGFdC/lI29zZ3HmBkK993cQnzK+I087DcS5cfgLzWMpCd4dUjsVOe 4/tg== X-Gm-Message-State: ALoCoQlkWhn0wWeGfct7aVqf8YRM2m0dvk8E7PP2Hppsd9fS8mL4uIGpQ05f6RRAqMpmaW6ZIzZh X-Received: by 10.112.118.141 with SMTP id km13mr4529459lbb.37.1409838788827; Thu, 04 Sep 2014 06:53:08 -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 p3sm2085260lap.14.2014.09.04.06.53.06 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 04 Sep 2014 06:53:08 -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 v3 8/9] amba: Add support for attach/detach of PM domains Date: Thu, 4 Sep 2014 15:52:35 +0200 Message-Id: <1409838756-31963-9-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1409838756-31963-1-git-send-email-ulf.hansson@linaro.org> References: <1409838756-31963-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=-8.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 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 --- 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; }