From patchwork Fri May 18 10:31:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 916179 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="X6z3qWhc"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40nPd14jfZz9s29 for ; Fri, 18 May 2018 20:32:37 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752664AbeERKcB (ORCPT ); Fri, 18 May 2018 06:32:01 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34676 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752622AbeERKb5 (ORCPT ); Fri, 18 May 2018 06:31:57 -0400 Received: by mail-lf0-f66.google.com with SMTP id x145-v6so1197047lff.1 for ; Fri, 18 May 2018 03:31:56 -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=vOMTRNhtUSt3+UjyP2nlZZlBgPAv7fyJ4Yo7WaId5rQ=; b=X6z3qWhcSmJF+BSaodWX2IwnI3TRkHuarLbkzzirLp3//Dl9XxFE83X3QsOzt9yZiz peNtDxrr+dFdYbrd52h8rF6rGrmfWaXRfHz9e6gtDAcqJydGFysqeKxKvgXUqy+YJxws 3OyVD6b3NAZTLYqc4ooYxqkk6oH/d6/l7r/QY= 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=vOMTRNhtUSt3+UjyP2nlZZlBgPAv7fyJ4Yo7WaId5rQ=; b=Hmha4MPjaTA/rm7E+tNcqtF5NPJm4ly2gj5yrevWI6LTLzI0h5fM+26o8u/Np2I+A+ G5HhcdNfg7+JVSkrGWstCO7lF/w9UkvC8YmmIaWGSYd52lASlq6I3oMGg/JDPR8/cH67 HOZzZ1bOy+W1eRUjnoxJ8zJ6nVVlF1+vZIXHmt6pNggSoLwBRtTheenKG3sTuyxKYA3j ibndo2iSq2Z/y70i7RZi/H2PvhphdjDjqZbs6lkAu+8WTlSaO94qR7tfPTpN3sIk80lW 4u6P5Ji8HKjYqflri+YHD95dicDhpXn37yXU5vtNArHAXgZqhi8O7X9ujaZh9W9kMDDV SLig== X-Gm-Message-State: ALKqPweI2mXUiiuYDn1kP9YnNcm1QJ0LP7ZqRoguW6WCCmWGfxS7z42a D9ay/GLeekyy2Se0d4yS7L2TAQ== X-Google-Smtp-Source: AB8JxZoDjYfqlw1Mw1sfEZLrtPeCkPK3p/6U38zWopdmXmNDtTS+kkQ9UAI7Jk8m+uL+2pifybjtUA== X-Received: by 2002:a19:17e9:: with SMTP id 102-v6mr13768283lfx.19.1526639515471; Fri, 18 May 2018 03:31:55 -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 u14-v6sm393447lfk.55.2018.05.18.03.31.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 18 May 2018 03:31:54 -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 6/9] PM / Domains: Don't attach devices in genpd with multi PM domains Date: Fri, 18 May 2018 12:31:27 +0200 Message-Id: <1526639490-12167-7-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526639490-12167-1-git-send-email-ulf.hansson@linaro.org> References: <1526639490-12167-1-git-send-email-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 phandles, 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 --- 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 050ce07..4597e1c 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);