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: 136284 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1056651lji; Fri, 18 May 2018 03:31:55 -0700 (PDT) X-Received: by 2002:a2e:59d4:: with SMTP id g81-v6mr5713707ljf.4.1526639515735; Fri, 18 May 2018 03:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526639515; cv=none; d=google.com; s=arc-20160816; b=Fn1qLUXGEP5+cYW0VUeWyR29js94F2MCC299rKWTotasca81ddNQuyZfOOUoGKFhHd LcvO4ZSb4rACmpvp+8Vx2o+kqDT/v3tztEU+IUzSqIwY+ps0hs9KOlpFDVVT1W+JoGvf u7Kq0foKWZkANnVlKDodyuez8gD/3cwdNuxrUnGOynQRk3JtzN+5VoOO74LCVbSeoXGX pksLjMYHgRZYs/XBDDFfhFwTUoRnKDYhXrx1SbeSJSx99se9kXBiGD6sSBfw/+6QEu6g XwBymCQgeQcmI/y7wJeYri4m55onPO9HjSy8byS14hgd9dZPxGtoUNc9/66i9L5a2OSi M2JQ== 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=vOMTRNhtUSt3+UjyP2nlZZlBgPAv7fyJ4Yo7WaId5rQ=; b=0v2KO8WE49sY9M5rH7Gyehd4rHpJYKq7kDCVOXLj63h+X9PJrVH0XhKplhyrCwKA/A Ih/I/SL416rLzkrJHKMQKYRqUx0lzPSiJ1WRFeB3iX1MDZrFKBQd7A1YU3cmRva0YsWp OG+xpGqq+szgQWKyGqICeV19Uhimfpluv9f4OL4Y1pXQbmEEKwOV6MGdt7aIWxZmTRgD S7t+GvtVn0NWYI3tJUrbT9kYKVekuk5EguJLFMFfmo8LrzKWXrKDLCb0MbvyFioVyjxx t3Oem7YyB1Vvi2I+Eq3YqeU2PRlAjUy7+Djx749ekQffiMwmZ0t5JAPhiPw+EOWrLLz8 BUvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X6z3qWhc; 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 x22-v6sor181539lfi.12.2018.05.18.03.31.55 for (Google Transport Security); Fri, 18 May 2018 03:31:55 -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=X6z3qWhc; 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=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=ItV9MezTieACJd+px5mrOA19dbDq+rLw5Vg2Uboxopu1vTy/nQOVJpRmx49BE4eSNw 8lSetY3OGkFSbSxkBmjYmrlKnRN0ZY9EvEVEMhxhkHWO3jJmuAJoZvnrFpNQF/8JQuAo 3ebOqiaWDk6EViqF6Jo6Es38iJojzcM2GzGR/ItSxy2MPAmObDlmMQAdPZoaKDrNjBGx GWrsm8QqegXDbQdewkH0UvNItSQI0Q26YhNxdJTC0/TGc83Rp0U0HcewMKLL/I4IZk0t z6uDv2VpB34DIR2IQDjG7S4VnMn3PXIp6TZ62gbX2/XD6O+KNXWLn+x1Y4Vkq4t2sJD9 Nj8Q== X-Gm-Message-State: ALKqPweOrKu+x3ZB/rKSax0Suw/BM1C+rQPj3Dga6buNVmOY7k8a912T 5FI7i299EgBXp26JSSP2CcBbKd4y 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) 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 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> 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(-) -- 2.7.4 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);