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: 4799871 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 284B2C033A for ; Thu, 28 Aug 2014 08:39:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5E6BE20158 for ; Thu, 28 Aug 2014 08:39:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 92D19201C7 for ; Thu, 28 Aug 2014 08:39:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936426AbaH1Ijj (ORCPT ); Thu, 28 Aug 2014 04:39:39 -0400 Received: from mail-la0-f44.google.com ([209.85.215.44]:49746 "EHLO mail-la0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936428AbaH1Ija (ORCPT ); Thu, 28 Aug 2014 04:39:30 -0400 Received: by mail-la0-f44.google.com with SMTP id hz20so516421lab.17 for ; Thu, 28 Aug 2014 01:39:29 -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=XU3l5pPVa4id1Owx6MXixxF6x57C/VEmcfJxLto3829748CtQpOid8+eaGdEZfGbN6 9TpcNPJRFtOSv75B8PcFnpQmqLrMwFClycjimVb+8LVUVbA9aABsk75ycssTf3wC+Y2S VUvxUGPh1H5774K2VyuwoanJsageNpk/KqX2/AF0gc/J6ARmoG5ZdOm3xZKpc2guWYwD +OVaczY6aRNHxsGH7LmACSYM6JYA+pr6xuuEq7nCVuwco5CdyPaTA3rGMD2iBSycmdvC WhsJC3BRACp0W0iZZIs4web5XaKGSw8S5YXDyVzQmZjGOs4Zz77gBDsdw5aF0Rcdd41m i1lw== X-Gm-Message-State: ALoCoQm+2szHa+yrVyNfMCLC2WNntrcJze/9r8yLrvp6HHtrh0JhwIJFxK76hcQzSHCXRSPQdUOR 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> 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=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 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; }