From patchwork Thu May 31 10:59:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 137358 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6441312lji; Thu, 31 May 2018 04:00:09 -0700 (PDT) X-Received: by 2002:a2e:1218:: with SMTP id t24-v6mr4825935lje.143.1527764409742; Thu, 31 May 2018 04:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527764409; cv=none; d=google.com; s=arc-20160816; b=KtL3zj7008V6Jz3QCsKtA96qzEhYgaJnGZgXfOD7nCZGK0e/Fo6GpIA7s4lUOCXckn Oc193YltGifqNh3xRfN/TH3GV/aHX14YSJE7OgF38LT2fg3CoZ8gFhe0EPGQ7puoxA7m 89gayaoxhxcTBMaNarbiaGRdo+ougt2zQzLbd/Nouu5novUP26JKEXxcyfTBg2rSef0k K9dN2uvSI2hkeYP4MCjUEAMycm9ry20u+0AxM5BxKTSi+HX7ns4An/4UC9SGIVlEYZrV X5WVtUFB7DtgqssKY+Xv2D7peXV/ys6hB4L9ZpSFFvh7IrDIdPhHRRWX4SQMrhEOBoQQ fGgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=jKz+vlX/PouqjXRFdu2AfA12MJxmgGmBdpobmfJzBo8=; b=wriocLtpjpBgdB3X2xUeta5vRQEJeh1VjBj9vCx8GztwQBLiXY/5D0bRNNx1H4TfjL sa6wP0mO2+aL7lPcycJz+6RzMpytTdXJgIs5cw58qtmHJGMG3V5at3KfCMFMzcXWU51R 0YKql4GGVqfPsxWLjHmNRDUsCLz098Q4ltbEWQG+JbTIkCLUiEdGe8btx/gQzi+2N0aJ dusyFOM2BrjguoersYX56qNeBMo/UtJWcomCHdw9EPYZ0yVxob7POaN2BTk0eoFY1yVH xRAAByujr3MHPrTBrhRyT2dpJ7gXqWMlLaEBS2Q2NFJfKRO8K2ay/xryaoPOqfS1ZhXW wvsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cfms82ve; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a10-v6sor1481651lfe.63.2018.05.31.04.00.09 for (Google Transport Security); Thu, 31 May 2018 04:00:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Cfms82ve; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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=jKz+vlX/PouqjXRFdu2AfA12MJxmgGmBdpobmfJzBo8=; b=Cfms82veV6wwqnFDu+KXZpAM+5lc10354WQbxw+tBsDCKTCWSGwF/ybvNCMYF3xfyw ShQVSi2fg5zaGigjwjh+swjebs4GLTXq74Z7yM0BbLIitg8Geh1ShOv53kbLZFk6v58U 2VL2JMgmRoE0QoZwDmrEP6IkRjwL1o/dCZFBw= 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=jKz+vlX/PouqjXRFdu2AfA12MJxmgGmBdpobmfJzBo8=; b=Yaj97MO9IkgiUeLPiwdbv8Ab7OdB1Axdufqks8XWTuzcYVD51aht49/aFnAPO7E4zC z6AfV70kf5qR1egnESJFu8skVJXXLW4BFlrTB85mI06xILQrs+ZJGK/WrEdKVU6lzXpr 5JzwshWPuDZSO8NFSLg1B0XjOVTnIqpLSu+U+bRSuTIEvx+vYLcwjomkFKr/sSBktODZ 8RAXbKYsItDZUt0oz5Mj2UWgekGjRbkUkCoCjsg8btGsuULL2qSnpQa9dvj/Rh7Warl/ E/OJAsULWbxXwumoArqkXzRCGVaoeb8OymxQvXHT2Xs4nOrj01Pb7N0vXdPNvWAsBnP9 1ldQ== X-Gm-Message-State: ALKqPwcq5gEPixeuVZrGriYyi1gkFwmqRZ3EZZJcKwLhCzNBtGKu//yG WmYvTEkeqBtdO7k3aqOALtkRRVnqB2wxsA== X-Google-Smtp-Source: ADUXVKJaBAMUAME0WoR58IrYcwMfr1qnoovK4ayEa2WfcnWH12CiE4JS8/9mBk9fAf5BSUPAQCvi/w== X-Received: by 2002:a19:1f51:: with SMTP id f78-v6mr4205925lff.42.1527764409363; Thu, 31 May 2018 04:00:09 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b20-v6sm7454383ljf.51.2018.05.31.04.00.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 04:00:08 -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 v3 2/5] PM / Domains: Don't attach devices in genpd with multi PM domains Date: Thu, 31 May 2018 12:59:56 +0200 Message-Id: <20180531105959.14843-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180531105959.14843-1-ulf.hansson@linaro.org> References: <20180531105959.14843-1-ulf.hansson@linaro.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 Reviewed-by: Viresh Kumar --- drivers/base/power/domain.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) -- 2.17.0 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 6f403d6fccb2..908c44779ae7 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);