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: 137140 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp3845481lji; Tue, 29 May 2018 03:04:38 -0700 (PDT) X-Received: by 2002:a19:4b52:: with SMTP id y79-v6mr8756172lfa.49.1527588278063; Tue, 29 May 2018 03:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527588278; cv=none; d=google.com; s=arc-20160816; b=yBSHtBN+yCQ66lwxnPAXh9vq8TWvRoUVwxRIwysAgaoVov9ehQ3CIvlwQTRwEKZzR5 H2DejG/atlOIsltJXhHXx6zbk3IF0hOWkEhy/+RzI3l9xYWYP+tY4WEX5MKjiy9wUyRO SOIdKWBIVO2glPPzDetQm4Fhs63K+7aksjjinFJIkAOApMu7yZSme7FzAd47ri995xHP TdQdc0thEKSTUZb7riC1i+NuQEN67tkfwWn8hHzuhqxeNmS5f8kGFRIkO/8CTlfxiYrT wq3zZYPBD7r2jrR4whKP1rl6s6slraoXNE5PaZKAG2397vmPgDfdyLgwq4xfpYzt2Foi cvcA== 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=yQ4ukAh6z4qIZhwwXLKnDtTdeOmHdRuam254ohPML9I=; b=w2AIM7yUQAvk2eHNpWZDikeEbKGp8GVPb3yp9phd/up9iEpCWoKJGKIi91L0Y1BANf 0AqUhvsRkerT6et1UXa3HpvHO2SKVYFLlYIMn/lEXsT4I56whbQ3gxL+asuHrJ8lgfIq burySu5nHYX7Fb1WVbLEvSZnvCUzICna7HQYlAT7MlqYdcfcLBfTVOZ7XhAU+hDX4tYX 65yFo++jGQIPIpU6r6aFWwu7oLgQajhmQjrs7eAJB5RFMDR/BKR7/EvxbXy6P6l12DfW RmHSNtZ6owLhm0aXm85xB09Zpp0utqgPsqDzripzOTEA6GYnD4I0Q1op+yrkw4oSQC0k CXyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=baAcQg9k; 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 142-v6sor7441660ljj.43.2018.05.29.03.04.38 for (Google Transport Security); Tue, 29 May 2018 03:04:38 -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=baAcQg9k; 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=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=n/2tBx24mDsTT1Lg5VEecFPLQhQFOeDQhmgN3yeYjv+lm1zGgSQbZq2LIqtxDoZXeR hsOTZelRFlu0Jre23Hx/X+jbcgOri5XydRiiEfdahswB43F/XqOTZlTiupQ7lCD+aqsF c1j/JOZmCjCwH4S+xpfKmR+oRoSKgbGcth37t18ihNJTfPXqxuxY3sqbGnz0U7oxnnYd 4EK3O6ANLLMmeYthL3wwfKWL6oNU4qUY2oDt2l0U0ovVmMDSh0Si0XtuMrlTNFksmths rKMRGDqXQic0ke5eF255QcQ5FWDfAAnTQR7DtenrT0hgghmS1yT2VlsT5nndmG0tm8Ij uvWg== X-Gm-Message-State: ALKqPwfPqIBpBXBS4BGcPAYllHMJOZc6NCCbyjmaBlmqA23crhav8sIH I2itDMVwiUII09Vvj1N6dd//mLzo 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) 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 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> 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 --- 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(-) -- 2.17.0 Acked-by: Jon Hunter Tested-by: Jon Hunter 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);