From patchwork Tue May 29 10:04:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 921941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-tegra-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="baAcQg9k"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40w8Vm2bq6z9s16 for ; Tue, 29 May 2018 20:05:36 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932922AbeE2KFf (ORCPT ); Tue, 29 May 2018 06:05:35 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:53483 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932921AbeE2KEj (ORCPT ); Tue, 29 May 2018 06:04:39 -0400 Received: by mail-wm0-f68.google.com with SMTP id a67-v6so38674739wmf.3 for ; Tue, 29 May 2018 03:04:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yQ4ukAh6z4qIZhwwXLKnDtTdeOmHdRuam254ohPML9I=; b=baAcQg9kaTj8nhVtTq8QF2TNt9vxE96Z3+M/1pVcZ82pkYfuX8aiN4+VP81JoiMuF5 qZgVQRq1h4Srun7c3RXORjlRnDOfdhDzI2M11Stqn1dvRMcvH5vVqPK9J5PxmNOZQQ1h sw0pGezezZm6N1vfd4lnGd3Yrb6Eup2QgWwzg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yQ4ukAh6z4qIZhwwXLKnDtTdeOmHdRuam254ohPML9I=; b=OYPLVNIcwoByiufST6wx40shDCUEJZCG+aP7I1NNtqmLqG4nQntJAbE2Cwwd/7nNXK 57iu93wf3NEKpythEs2U10ymAkYMeQXsjqTnH441IPeOo4bdTt0EZNClbDGi5DyWGk9j aDcpcSYwoPyQ+xyF7Vmx/XdnrLpf13epB1WRuiP1K0WOVE91keEPUkm3jWBjL7I+tTDY tYyVL1ALIF+zfCiHIEjmRNL7WmygIYR84013bUAWQDzvVg1TG+ZU9tVsS4l2ACVddX9v u6tTOvk3DZ88RObaUl0JHBxAFOf2iiosWA4N32LqVLRr5cR/lVqvo+0FcVW9W5QEzHKD JMjg== X-Gm-Message-State: ALKqPwcSfiAncLtfSX1GeU19fmhukNDTNm1dBTH9uwcaoTawDC9rIe7P oOyn9KyFEPyrgN8qbV5XjY8piA== X-Google-Smtp-Source: ADUXVKJK3dwOGTKFXDCJ5cCyWrUDOuFQ26iIEK3p1ZsbUBz4yn4KPAjlTTTzBDQDPwalUGToKncNBQ== X-Received: by 2002:a2e:1092:: with SMTP id 18-v6mr5777646ljq.115.1527588277835; Tue, 29 May 2018 03:04:37 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id e21-v6sm2561718lfg.74.2018.05.29.03.04.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 May 2018 03:04:37 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Greg Kroah-Hartman , Jon Hunter , Geert Uytterhoeven , Todor Tomov , Rajendra Nayak , Viresh Kumar , Vincent Guittot , Kevin Hilman , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, Rob Herring , devicetree@vger.kernel.org Subject: [PATCH v2 6/9] PM / Domains: Don't attach devices in genpd with multi PM domains Date: Tue, 29 May 2018 12:04:18 +0200 Message-Id: <20180529100421.31022-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529100421.31022-1-ulf.hansson@linaro.org> References: <20180529100421.31022-1-ulf.hansson@linaro.org> Sender: linux-tegra-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org The power-domain DT property may now contain a list of PM domain specifiers, which represents that a device are partitioned across multiple PM domains. This leads to a new situation in genpd_dev_pm_attach(), as only one PM domain can be attached per device. To remain things simple for the most common configuration, when a single PM domain is used, let's treat the multiple PM domain case as being specific. In other words, let's change genpd_dev_pm_attach() to check for multiple PM domains and prevent it from attach any PM domain for this case. Instead, leave this to be managed separately, from following changes to genpd. Cc: Rob Herring Cc: devicetree@vger.kernel.org Suggested-by: Jon Hunter Signed-off-by: Ulf Hansson Acked-by: Jon Hunter Tested-by: Jon Hunter --- Changes in v2: - Minor update to changelog to mention "PM domain specifiers" rather than a "list of phandles". --- drivers/base/power/domain.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7ebf7993273a..12a20f21974d 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2229,10 +2229,10 @@ static void genpd_dev_pm_sync(struct device *dev) * attaches the device to retrieved pm_domain ops. * * Returns 1 on successfully attached PM domain, 0 when the device don't need a - * PM domain or a negative error code in case of failures. Note that if a - * power-domain exists for the device, but it cannot be found or turned on, - * then return -EPROBE_DEFER to ensure that the device is not probed and to - * re-try again later. + * PM domain or when multiple power-domains exists for it, else a negative error + * code. Note that if a power-domain exists for the device, but it cannot be + * found or turned on, then return -EPROBE_DEFER to ensure that the device is + * not probed and to re-try again later. */ int genpd_dev_pm_attach(struct device *dev) { @@ -2243,10 +2243,18 @@ int genpd_dev_pm_attach(struct device *dev) if (!dev->of_node) return 0; + /* + * Devices with multiple PM domains must be attached separately, as we + * can only attach one PM domain per device. + */ + if (of_count_phandle_with_args(dev->of_node, "power-domains", + "#power-domain-cells") != 1) + return 0; + ret = of_parse_phandle_with_args(dev->of_node, "power-domains", "#power-domain-cells", 0, &pd_args); if (ret < 0) - return 0; + return ret; mutex_lock(&gpd_list_lock); pd = genpd_get_from_provider(&pd_args);