From patchwork Fri Aug 25 11:26:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13365461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 45C61C3DA6F for ; Fri, 25 Aug 2023 11:27:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=c74kwfw0xCKIPdu0ml0//HTjmoz0WQZh50SdMsvFfHE=; b=PQ8Dv5CyB8eXYf Rb0B54GGgvWcNmse0XuGCh11UCo1o6x7evm4O10MmPD2tucBzNul7LN0/0pdw7weNhz2C3O+JO6tv MQusYAKogVqb8LBvNJ3DDjmXPlQgpIjSOT17WnlKs7kJBdGGrc41hmlQeuJiigWaFclaJKBuG4Qdh mMEpR/56wfof7REOYBSTxmA2oeqz3zQe4f88EgA926Ohgo6KWmd4+CZKW/Yww/pr8OIU3bDjHXU+g V7zNmEVnaxEz02bWE8ply7HzO7FoBQmn5hgp/Y1zE80M20lKFZQkSlTrm2Jj+jPKYREvWKEQcR2T0 9WzKLLhAk7VEt7GD9IOg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qZUyH-005D3r-0Q; Fri, 25 Aug 2023 11:27:21 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qZUy4-005CqO-0g for linux-arm-kernel@lists.infradead.org; Fri, 25 Aug 2023 11:27:09 +0000 Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4ffa94a7a47so1182691e87.1 for ; Fri, 25 Aug 2023 04:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1692962827; x=1693567627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BQ10KjgMpqc0TH2RSYB+FyfOupm6xniaP3PuJgrZOCQ=; b=jVyfBenIs3YrwoiLJlhjUlRMpDrrXrPF7WvEihCIDBBSds8an1aikYCb3fyZHGwdTp vER9xRn9sAxxrWIPuCMq2qdGg7xBABZe6PErJkOQ1Y96ORMDi6Gfdt4b9HdQFKNDsUos M6sDkqAnFJnfOwUb7W9Wlf8/AQM/xvbSDHteIQo6JrIRDqHshVNdl++RbnNOPH5e+I/E po0Gpd5yGHNBa+l0s+BIqhAxLxb9ibj01d7rGnLQEx5rX/nYqQwQTSJbAPC6H3kLZWZt vQ/YB/+O7akzgEvUVz54Co/Pc47IQWcV6D0wX3RhMzVb3ZxLNLrwS5v9gwm23nsnpGh3 0RTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692962827; x=1693567627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BQ10KjgMpqc0TH2RSYB+FyfOupm6xniaP3PuJgrZOCQ=; b=hCTUEjmEYKcpxJ0ahddpaOTfzOOQWLqhOvC14CFX0V8VjMztV9yDPMbSyVv/Ta6DjO SUpYWEpEZaAGmH+zInZCe9Y/si2kDM5HueGvqEBV6wCbVkAQHzQHf1UjpguaZcaN4d04 TVv7v+mZC0oiwHMlKLe89CkJDj6AT+mpNMQRz+bxDLxT+AcvU8YlYCdRD/ltHa+yzcK0 TTU9+g7IFFbIt5azDdiU8Dv0ZpklSFITQsOYpuCwHk6srRU9CiAyhhY1JjKKP0EBVCOj H/Hue4BpSlfwjXVCMadT+NfEnQn0H/T9GoUF8Ia1UuUBKTHO5AYuqNOi/ciWLXUbxrSp EwAw== X-Gm-Message-State: AOJu0Yya7ELLAUqK9qWpG82KXTfitIK8g3vkUYietf5AJ4z6fmiAVWFe lDv06mxsR/bC9KR9hHJTd0urzg== X-Google-Smtp-Source: AGHT+IHXSuubNrdaloTOGX7P7Udqw4Ibzcy9wqcH/rDCusCFRW5crtQshAf4pXtAAq+Rv4izeqHX2A== X-Received: by 2002:ac2:58f6:0:b0:500:95f7:c416 with SMTP id v22-20020ac258f6000000b0050095f7c416mr5282808lfo.7.1692962826738; Fri, 25 Aug 2023 04:27:06 -0700 (PDT) Received: from uffe-tuxpro14.. (h-94-254-63-18.NA.cust.bahnhof.se. [94.254.63.18]) by smtp.gmail.com with ESMTPSA id g7-20020ac25387000000b004fb7ac67bbdsm259164lfh.41.2023.08.25.04.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Aug 2023 04:27:06 -0700 (PDT) From: Ulf Hansson To: Sudeep Holla , Cristian Marussi , Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Nikunj Kela , Prasad Sodagudi , Alexandre Torgue , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 11/13] cpufreq: scmi: Add support to parse domain-id using #power-domain-cells Date: Fri, 25 Aug 2023 13:26:31 +0200 Message-Id: <20230825112633.236607-12-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230825112633.236607-1-ulf.hansson@linaro.org> References: <20230825112633.236607-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230825_042708_302301_9B182189 X-CRM114-Status: GOOD ( 15.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The performance domain-id can be described in DT using the power-domains property or the clock property. The latter is already supported, so let's add support for the power-domains too. Signed-off-by: Ulf Hansson Acked-by: Viresh Kumar --- Changes in v3: - Move to get the power-domain index from power-domain-names. --- drivers/cpufreq/scmi-cpufreq.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 48bd393a1506..08497b84efe1 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -72,13 +72,26 @@ static unsigned int scmi_cpufreq_fast_switch(struct cpufreq_policy *policy, static int scmi_cpu_domain_id(struct device *cpu_dev) { - struct of_phandle_args clkspec; - - if (of_parse_phandle_with_args(cpu_dev->of_node, "clocks", - "#clock-cells", 0, &clkspec)) - return -EINVAL; + struct device_node *np = cpu_dev->of_node; + struct of_phandle_args domain_id; + int index; + + if (of_parse_phandle_with_args(np, "clocks", "#clock-cells", 0, + &domain_id)) { + + /* Find the corresponding index for power-domain "perf". */ + index = of_property_match_string(np, "power-domain-names", + "perf"); + if (index < 0) + return -EINVAL; + + if (of_parse_phandle_with_args(np, "power-domains", + "#power-domain-cells", index, + &domain_id)) + return -EINVAL; + } - return clkspec.args[0]; + return domain_id.args[0]; } static int