From patchwork Wed Jun 7 12:46:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 690777 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D899C7EE29 for ; Wed, 7 Jun 2023 12:47:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241001AbjFGMrF (ORCPT ); Wed, 7 Jun 2023 08:47:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240926AbjFGMrC (ORCPT ); Wed, 7 Jun 2023 08:47:02 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 531E31993 for ; Wed, 7 Jun 2023 05:47:01 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-4f62d93f38aso3948894e87.0 for ; Wed, 07 Jun 2023 05:47:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686142019; x=1688734019; 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=eTRBYvWL0ZR20mIms3ANVdkUTRjCIM847wuOR+jiVEw=; b=UPwKH0tEs+HxkzN7zAPP+oUW7O3Xmnkqu2EdonIlsR674Hizqw1pKo+qRI2Mmh7Yed Sv/Uy5UbTUl0vMSbEcGSb4IxCPX6ZSLbvec24un6Ney98zSuBYLDoByxKlOQjWAWbFOf /snJha6Vbf8chEMZxOyL/kr1q/0V5dA2O40Ar4lSwdmL9xFzgY2HkLOe+u6g/6qCn3kI gR83/yyBTx9YDRCYDR8ifwlBqXwm3c92MF5CxgW2HIs+umZpzOTowepyZ2wx47Dd4m3C dIWu2rhEnDdEESg1zmIXaya7FVpf97fmb1tnJBsKiyC5Q+M3mgv4HqzGrOulkazf1kgj U5eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686142019; x=1688734019; 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=eTRBYvWL0ZR20mIms3ANVdkUTRjCIM847wuOR+jiVEw=; b=AB/NIwAZuSXQRO6GNT/OarYruSHonkJ4W0QlwJ+4hAmiz39KbMP8b9xzGvVs4IzMOF xGbGRZaIi17x2O0/kfKBwXQZrZjFK5qKLwXCE6N0Ws8GIktQEPtU8O+qRg9K1z6p6Occ Rr/2iaHBBrviptxyUqrV84GMN/elNK9OaS60SyjUv+v7jDqrUicsV2/Tox7GqkfqnEyX sOilZvv2LbCwyBbvkGUGFxFhMjTHqrm/ddiyT/oNz71W1JZP+6qgiZO90I+GVwkZnUQW 9HG/qY9Wf4lHKrOc2KpK3llR2o1WUj6Ot75w8pISvhF+gM4K2Jp1aMU5CHOuG063v0ZB IVqg== X-Gm-Message-State: AC+VfDyPbDsAsiTxPEAvAXaWzmXb+t1N1Cope2+RnfVWMzPOqDofkHPR rUhojs+q2Ur0yZRTceiGhZFPRA== X-Google-Smtp-Source: ACHHUZ6OeWVc1a0pysopXFADIzRUnuwVtZGnnlXC6I3lDM3M7q6tNmNUt+le2s2yZte65V2isz4k/Q== X-Received: by 2002:a05:6512:243:b0:4f2:579d:6867 with SMTP id b3-20020a056512024300b004f2579d6867mr1934525lfo.20.1686142019556; Wed, 07 Jun 2023 05:46:59 -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 z7-20020a19f707000000b004f4b3e9e0cesm1781708lfe.297.2023.06.07.05.46.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jun 2023 05:46:59 -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 04/16] cpufreq: scmi: Prepare to move OF parsing of domain-id to cpufreq Date: Wed, 7 Jun 2023 14:46:16 +0200 Message-Id: <20230607124628.157465-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230607124628.157465-1-ulf.hansson@linaro.org> References: <20230607124628.157465-1-ulf.hansson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The OF parsing of the clock domain specifier seems to better belong in the scmi cpufreq driver, rather than being implemented behind the generic ->device_domain_id() perf protocol ops. To prepare to remove the ->device_domain_id() ops, let's implement the OF parsing in the scmi cpufreq driver instead. Signed-off-by: Ulf Hansson --- drivers/cpufreq/scmi-cpufreq.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index f34e6382a4c5..7d05d48c0337 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -70,13 +70,24 @@ static unsigned int scmi_cpufreq_fast_switch(struct cpufreq_policy *policy, return 0; } +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; + + return clkspec.args[0]; +} + static int scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) { int cpu, domain, tdomain; struct device *tcpu_dev; - domain = perf_ops->device_domain_id(cpu_dev); + domain = scmi_cpu_domain_id(cpu_dev); if (domain < 0) return domain; @@ -88,7 +99,7 @@ scmi_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask) if (!tcpu_dev) continue; - tdomain = perf_ops->device_domain_id(tcpu_dev); + tdomain = scmi_cpu_domain_id(tcpu_dev); if (tdomain == domain) cpumask_set_cpu(cpu, cpumask); } @@ -104,7 +115,7 @@ scmi_get_cpu_power(struct device *cpu_dev, unsigned long *power, unsigned long Hz; int ret, domain; - domain = perf_ops->device_domain_id(cpu_dev); + domain = scmi_cpu_domain_id(cpu_dev); if (domain < 0) return domain; @@ -209,7 +220,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) } priv->cpu_dev = cpu_dev; - priv->domain_id = perf_ops->device_domain_id(cpu_dev); + priv->domain_id = scmi_cpu_domain_id(cpu_dev); policy->driver_data = priv; policy->freq_table = freq_table;