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: 36713 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f197.google.com (mail-ig0-f197.google.com [209.85.213.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 36ACA20CBB for ; Thu, 4 Sep 2014 13:53:11 +0000 (UTC) Received: by mail-ig0-f197.google.com with SMTP id r2sf48817238igi.8 for ; Thu, 04 Sep 2014 06:53:10 -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=22ppTG3ng7XBlerzvAo/JagSfbPNnJ41Qd2iIbdPmks=; b=CRwg5GF7PV7Y9mrVfGchnvbNDtuXw7Z1sXDear7a4hMkKmngPfhRPP0wTH6mwD7ucj QmVu0j2JIK2RptXZOcD+fvzZShf2WfUzZYAMNuZgdLKdZXDoQN1illNKuQZ2n8XDkf/G TO41I8oLCYIaXRoYkBj6yU2h4A7mtrgxU1qkZOxLlpjhCZgSRpJKzlYz/e6wz4k5cqw1 zcPdvW8d43VRsAJnG+RSOCMxgwi2vH4O2lyhGdl8xceBoDgMmb6Z9TwLUsy8ml5gzg3a fwmNkFinU73kbwO+s3FexxMZCKUYXWiq6rQvNDe1aqvy/hOUht48v44+CpXj3azdvuj/ KWWA== X-Gm-Message-State: ALoCoQmkBvKfe7fmbpBN1IUzJFuDPbgX0aCB1OQGPQZo+SLulNtQtbfio4r1rgiHhwxurUXiR9As X-Received: by 10.182.129.37 with SMTP id nt5mr2492037obb.8.1409838790828; Thu, 04 Sep 2014 06:53:10 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.51.51 with SMTP id t48ls284319qga.67.gmail; Thu, 04 Sep 2014 06:53:10 -0700 (PDT) X-Received: by 10.220.132.207 with SMTP id c15mr4012875vct.12.1409838790726; Thu, 04 Sep 2014 06:53:10 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id ee2si2926184vdb.40.2014.09.04.06.53.10 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 06:53:10 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id hy4so10593025vcb.38 for ; Thu, 04 Sep 2014 06:53:10 -0700 (PDT) X-Received: by 10.52.94.108 with SMTP id db12mr3347014vdb.8.1409838790647; Thu, 04 Sep 2014 06:53:10 -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 uj3csp841245vcb; Thu, 4 Sep 2014 06:53:09 -0700 (PDT) X-Received: by 10.112.166.139 with SMTP id zg11mr4622325lbb.62.1409838789385; Thu, 04 Sep 2014 06:53:09 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) by mx.google.com with ESMTPS id ao5si2647066lbd.88.2014.09.04.06.53.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Sep 2014 06:53:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.217.181 as permitted sender) client-ip=209.85.217.181; Received: by mail-lb0-f181.google.com with SMTP id s7so3195534lbd.40 for ; Thu, 04 Sep 2014 06:53:08 -0700 (PDT) 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> 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.179 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 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; }