From patchwork Fri Mar 3 21:48:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 94875 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp443204qgd; Fri, 3 Mar 2017 13:56:09 -0800 (PST) X-Received: by 10.98.34.211 with SMTP id p80mr6091579pfj.174.1488578169278; Fri, 03 Mar 2017 13:56:09 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l3si11644861pgl.298.2017.03.03.13.56.09; Fri, 03 Mar 2017 13:56:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752336AbdCCV4I (ORCPT + 9 others); Fri, 3 Mar 2017 16:56:08 -0500 Received: from mail-pf0-f178.google.com ([209.85.192.178]:36038 "EHLO mail-pf0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752316AbdCCV4I (ORCPT ); Fri, 3 Mar 2017 16:56:08 -0500 Received: by mail-pf0-f178.google.com with SMTP id x66so37109905pfb.3 for ; Fri, 03 Mar 2017 13:56:07 -0800 (PST) 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=LLQLK6gfKneRYNsCbHw6GnSwl9fGy6r9Hg8jLcfeRjk=; b=VSRlHsa+U6REIVwB+GH1yOwbOpszALoZsgwNbPV9oZlnSgsS6py2SuXKcNDUk8hHzU ndCE6LTBASjNch+qkr59iH2Ox6jM+BX/kON3dJXhKG2KE8Su4e/gQs5OjLmtuvydyLoW NdO+0r4KFhNeEAzJNt5/yA3wAknzwcTbn/jm0= 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=LLQLK6gfKneRYNsCbHw6GnSwl9fGy6r9Hg8jLcfeRjk=; b=psL0Tpu28ZzQClzcKa7Q6cXVhBIuOETnhG5k7IPnhKF+tnyMNlbu13f1CTJzi4+QMk k3pmvgkPlj3LVjb/899M//YjtEyxGKr+SZ9iMgf04RPlaT/jYxT2L80+4uA0UovaO9ZY uO74CSneNo9OQ3SPCVPVx3AlmS/bM+9XNmE1k9/LNKnDCiXSFQiY6HJfIaSN7hVT9gL5 iHu4OL5ogOWjobqAFR6FAW1gXJ03KNl7ke4l7r8GRH9/7DHxDVPh7GW9ZfRx+bCa8ODE 5utkupdhrZt9SMPch6HYW48NjKf30/RqbKnJr1rgbwq6css8xSpQSTu4/oj9DH/gMyGA x0Fw== X-Gm-Message-State: AMke39m6CYb+2/+EIo9UH+pUABx4EHkFsD7DEt7SBAwZzMvJFZd0xn+8nXJwhj3vOeY6nHB9 X-Received: by 10.99.146.7 with SMTP id o7mr6013260pgd.6.1488577711601; Fri, 03 Mar 2017 13:48:31 -0800 (PST) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id q23sm25200585pfg.63.2017.03.03.13.48.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Mar 2017 13:48:30 -0800 (PST) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@kernel.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andy.gross@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, brendan.jackman@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, Juri.Lelli@arm.com, Lina Iyer Subject: [PATCH V5 4/6] drivers: firmwware: psci: Support hierachical idle states Date: Fri, 3 Mar 2017 13:48:15 -0800 Message-Id: <1488577697-127445-5-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488577697-127445-1-git-send-email-lina.iyer@linaro.org> References: <1488577697-127445-1-git-send-email-lina.iyer@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Read in the idle state properties for a CPU's idle state from its PM domain, if such a domain exists or use the existing CPU node property. Signed-off-by: Lina Iyer --- drivers/firmware/psci.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index 18ae62d..190d3a7 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -292,15 +292,24 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) { int i, ret, count = 0; u32 *psci_states; - struct device_node *state_node; - - /* Count idle states */ - while ((state_node = of_parse_phandle(cpu_node, "cpu-idle-states", - count))) { - count++; - of_node_put(state_node); + struct device_node *state_node, *dn; + struct of_phandle_args args; + bool cpu_has_domain = false; + const char *property; + + /* Is there a domain provider for this CPU? */ + ret = of_parse_phandle_with_args(cpu_node, "power-domains", + "#power-domain-cells", 0, &args); + if (!ret) { + dn = args.np; + ret = of_count_phandle_with_args(dn, "domain-idle-states", + NULL); + cpu_has_domain = (ret > 0); } + count = (cpu_has_domain) ? ret : + of_count_phandle_with_args(cpu_node, "cpu-idle-states", NULL); + if (!count) return -ENODEV; @@ -308,10 +317,17 @@ static int psci_dt_cpu_init_idle(struct device_node *cpu_node, int cpu) if (!psci_states) return -ENOMEM; + if (cpu_has_domain) { + property = "domain-idle-states"; + } else { + property = "cpu-idle-states"; + dn = cpu_node; + } + for (i = 0; i < count; i++) { u32 state; - state_node = of_parse_phandle(cpu_node, "cpu-idle-states", i); + state_node = of_parse_phandle(dn, property, i); ret = of_property_read_u32(state_node, "arm,psci-suspend-param",