From patchwork Fri Jul 1 08:19:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 12902908 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 7D25ECCA47F for ; Fri, 1 Jul 2022 08:21:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235466AbiGAIVD (ORCPT ); Fri, 1 Jul 2022 04:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234608AbiGAIVB (ORCPT ); Fri, 1 Jul 2022 04:21:01 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BE1B70E47 for ; Fri, 1 Jul 2022 01:20:53 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id s206so1779105pgs.3 for ; Fri, 01 Jul 2022 01:20:53 -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 :mime-version:content-transfer-encoding; bh=5sBbegLJ1lchy2hqalQ5gJ7BZ0uunI8SG7qvUv41a9Y=; b=LtIggMzGQOAaeuUsH5+tfhe8ltdiSJAT7ASyNnbMKUFwg5LRGyfiXxcle/SSV3NIfW GQx6G+M3HwU+tGz8WVhrwKpvnD+qxamu07mrJMSSs/0srPapAZo80RW4dEZjQcTXyHls K3W0fNeg6V086Ehpk8Xs3rbfyBwd0uu3rlLw41Cb9Do8OTDOOUrFx0l7MGq9ATh1GCEe cksw4Ni/rTwjaO7EyJIu6wLnrCu75x0oloKisDodgwtR/wlb9pyibOWZ8qFCsM1WWV+s P7zuR7ZQLb9ZlwxBaYaLz4eDRX5qaMGQ5zSwoNL2Cw8PjF/0Bchum01YJKqkzUAyKtm9 H90w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5sBbegLJ1lchy2hqalQ5gJ7BZ0uunI8SG7qvUv41a9Y=; b=Fkenr/DiLEppaM8vNGlQ1Cex3uTJhf2Z+hPbSsqC+QwLCQ6C1c6pnGRR8i3u5+jM9s MUuTLhEMapQ9JzCeotD76H2DE13sL/9x8flL5jEhGVYEyvmlissdrCktwCQFSOHb6SPv xmVmBoobuO309+0P+3/ipMAnd753KRb6qdkD05ylKmmLDqJgvTJte6D31SzXYfMoEbnO GadogLg4xNtBo82MuWwoqqfSLFttvGeu34ejLzmjMzpgMlkBynk1ZGQGUJg3C/wHeXCI 2kCmVXaYY8gAe95vjaqul1NJP3Qcy4fymeegeTnZK1noYKcJj/STfSBs4oAkWliR+ywM CWJQ== X-Gm-Message-State: AJIora++5Oq8hw0cD1DKKYpd+Hy9cR6zNlInjni6Uo9bNvAPb7lscpUW nszyR0oT4gzW87Z/Ywgx6AhoAQ== X-Google-Smtp-Source: AGRyM1uu8zggOPnDHNiBGQHOAPYQblLb5K23eAAtyPxBWbytzSoamd5/4G+YcLRQ/dpteT5fpwljKw== X-Received: by 2002:a63:455b:0:b0:411:bf36:f56e with SMTP id u27-20020a63455b000000b00411bf36f56emr4288740pgk.105.1656663653143; Fri, 01 Jul 2022 01:20:53 -0700 (PDT) Received: from localhost ([122.172.201.58]) by smtp.gmail.com with ESMTPSA id cm24-20020a17090afa1800b001ec87220fb9sm5938601pjb.16.2022.07.01.01.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Jul 2022 01:20:52 -0700 (PDT) From: Viresh Kumar To: "Rafael J. Wysocki" , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Stephen Boyd , Nishanth Menon , Dmitry Osipenko , linux-kernel@vger.kernel.org Subject: [PATCH V2 03/30] cpufreq: dt: Migrate to dev_pm_opp_set_config() Date: Fri, 1 Jul 2022 13:49:58 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The OPP core now provides a unified API for setting all configuration types, i.e. dev_pm_opp_set_config(). Lets start using it. Tested-by: Dmitry Osipenko Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-dt.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index 8fcaba541539..9e25bf86e512 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -29,8 +29,8 @@ struct private_data { cpumask_var_t cpus; struct device *cpu_dev; - struct opp_table *opp_table; struct cpufreq_frequency_table *freq_table; + int opp_token; bool have_static_opps; }; @@ -220,12 +220,16 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu) */ reg_name = find_supply_name(cpu_dev); if (reg_name) { - priv->opp_table = dev_pm_opp_set_regulators(cpu_dev, ®_name, - 1); - if (IS_ERR(priv->opp_table)) { - ret = PTR_ERR(priv->opp_table); + struct dev_pm_opp_config config = { + .regulator_names = ®_name, + .regulator_count = 1, + }; + + priv->opp_token = dev_pm_opp_set_config(cpu_dev, &config); + if (priv->opp_token < 0) { + ret = priv->opp_token; if (ret != -EPROBE_DEFER) - dev_err(cpu_dev, "failed to set regulators: %d\n", + dev_err(cpu_dev, "failed to set OPP config: %d\n", ret); goto free_cpumask; } @@ -295,7 +299,7 @@ static int dt_cpufreq_early_init(struct device *dev, int cpu) out: if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(priv->cpus); - dev_pm_opp_put_regulators(priv->opp_table); + dev_pm_opp_clear_config(priv->opp_token); free_cpumask: free_cpumask_var(priv->cpus); return ret; @@ -309,7 +313,7 @@ static void dt_cpufreq_release(void) dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &priv->freq_table); if (priv->have_static_opps) dev_pm_opp_of_cpumask_remove_table(priv->cpus); - dev_pm_opp_put_regulators(priv->opp_table); + dev_pm_opp_clear_config(priv->opp_token); free_cpumask_var(priv->cpus); list_del(&priv->node); }