From patchwork Wed Aug 11 11:58:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495162 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp4899947jap; Wed, 11 Aug 2021 05:06:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNDr3kQnmT7zOG914n6fdYTIcjqyFgUuyslsr0rjx5CAriVW60VMfw3P05JN0bawlI2zcc X-Received: by 2002:aa7:c4d4:: with SMTP id p20mr10909524edr.382.1628683584133; Wed, 11 Aug 2021 05:06:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683584; cv=none; d=google.com; s=arc-20160816; b=c1X2dMQ7irnr38ifMOvjXQJWO7wjqwPdGNCsF2MMZ/5SfO5t17BEiLN9iv+B5BKqAB OjF2eiTyol+VM4bL6VGz0vAmo9FillhpthdrC+iIv44jAlL+R0lI2XYQVn2qoogINkSd EoNMU8p4htjj9ghU5tHByiAkhEb7D5xcHCw9eJmjsWEwlTAlxzZflmsDXRWqEe4PDEuM sJszzUc4ZAcTh/QMMLARL9Rp+psFrEr6QWjOwFvalcpP6zqGYx5G9uGUjhxJjqlMhhOC fIo4WYxsbJeyVGkMAT8Lc2NTpxkPOLXA7wuHbRRgeR4juO1aEmdgA5BI7j+Zg/nfwtb6 JqTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PCfZOEpIhIENyNI7NFl9TKqagaadd2OPxUYrFvWYUZk=; b=aBa/NwpEyRMrEjbf0pOkI8slZ+NqpiODCbaZ76w0pczr4JUmIbyNS7jK88fOm7VFlz 1b9829kJ5BZqff1PYb8nhENXM6fdSS5+RGILvK3VOnjiPwZpkTdeZ+0ZP0d8o4aE+YnE iwlWVzAV0tU2mFM/N3EmmlArMI5qaNaU0DieeBhT1kr4f8bbvTZrD+7/RhRof0YlwRXO dU2fU9YCPRHcAtiNrUszZ7fy+7o7ZnTmRBihifrVOG9BwZ9FWRZTxbP+KYBpTCyHUOKc DsyuMUa2tN9yVzNr9Euaf7oEjPmfeUMZ09XveTUXmbmmSoyPvP3555/CseunpRwN96g4 Esrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N0+z2ZI5; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si24410170edd.252.2021.08.11.05.06.23; Wed, 11 Aug 2021 05:06:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N0+z2ZI5; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237522AbhHKMGm (ORCPT + 7 others); Wed, 11 Aug 2021 08:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237497AbhHKMGm (ORCPT ); Wed, 11 Aug 2021 08:06:42 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A22FC0613D3 for ; Wed, 11 Aug 2021 05:06:18 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id a8so2970994pjk.4 for ; Wed, 11 Aug 2021 05:06:18 -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=PCfZOEpIhIENyNI7NFl9TKqagaadd2OPxUYrFvWYUZk=; b=N0+z2ZI5wdHwMuZJpOC52Yxq1cpcYeyyFJ06OSD2lZSHVAZCISKIzdeDukQ/oN3CdI J9+ZezPKKCSnLLTT2NIyKVcXd10uZFruG8Ua5ul1sPmziqln/pUVioG3h5r6/t0PSxxe NhbXigYmE1MR4lQcoFkv3RlIrh59Z6HqJAj6qSpAx2alGFTB2bQ4/WBYp6nLJ0it96gM ShOiv7G4wLXTUBSeCm3rB32YwyiBVLTcG5LIdbdsCZRM1WANgE8bhilW3B1RvzODpMgh v+Sd/Aw5n3sLZ8qvJWO+O1ToWi+GZA7NkO7kqyBLOzDwy2qQEZS9oRY6u6SIk2loGcrH 6K7A== 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:mime-version:content-transfer-encoding; bh=PCfZOEpIhIENyNI7NFl9TKqagaadd2OPxUYrFvWYUZk=; b=jrNsEfBdzqMaTXHo3naHjEh0Odhd5tGHOQelYDJbYiPs3Pp5YcIzY0q6+QjW1N6kXD ZcKU+I/EHtz4JS3epfXRS5MJ5J2vdO0LzJrOCK47ILBj9PIx2B0BHJ84w8QQGAQ4cXhS 9IHYmL2uE8vopz1aENe3+Bh9Q9U26oReU79DT+Q8kt2xtrA1bkMC1sqCgQ0vl7gHQmWF 4Y76xrHCKMv/Pn5etJ/QwOL5e4OkSIbRYXFJ00yncSUamNrUS5NjBcXL6ncY7BULmmd8 UUZS50oPuHStmWNgUWU2rNgBXFniEbHGEfRwi5AzRF63mZnrjl03NEbQA6KeAx/73LtW 0pHg== X-Gm-Message-State: AOAM530Z/6Oa3+PDWk4cWpf9ZjUBNW2ppTQk+8pCc0lsEQds8iS2BlPj PQMjTiGq2/feN0ObR1dptRwRwt8QbIuNXg== X-Received: by 2002:a17:903:2309:b029:12c:f6bd:23a4 with SMTP id d9-20020a1709032309b029012cf6bd23a4mr4014927plh.75.1628683577546; Wed, 11 Aug 2021 05:06:17 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id o22sm26851065pfu.87.2021.08.11.05.06.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:17 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-kernel@vger.kernel.org Subject: [PATCH V2 1/9] cpufreq: Auto-register with energy model if asked Date: Wed, 11 Aug 2021 17:28:39 +0530 Message-Id: <9ca302a02d6b51240af8668634c93972183b593f.1628682874.git.viresh.kumar@linaro.org> 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 Many cpufreq drivers register with the energy model for each policy and do exactly the same thing. Follow the footsteps of thermal-cooling, to get it done from the cpufreq core itself. Provide a new callback, which will be called, if present, by the cpufreq core at the right moment (more on that in the code's comment). Also provide a generic implementation that uses dev_pm_opp_of_register_em(). This also allows us to register with the EM at a later point of time, compared to ->init(), from where the EM core can access cpufreq policy directly using cpufreq_cpu_get() type of helpers and perform other work, like marking few frequencies inefficient, this will be done separately. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 12 ++++++++++++ include/linux/cpufreq.h | 14 ++++++++++++++ 2 files changed, 26 insertions(+) -- 2.31.1.272.g89b43f80a514 Reviewed-by: Quentin Perret Reviewed-by: Lukasz Luba diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 06c526d66dd3..75974e7d6cc5 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1493,6 +1493,18 @@ static int cpufreq_online(unsigned int cpu) write_unlock_irqrestore(&cpufreq_driver_lock, flags); } + /* + * Register with the energy model before sched_cpufreq_governor_change() + * is called, which will result in rebuilding of the sched domains, + * which should only be done once the energy model is properly + * initialized for the policy first. + * + * Also, this should be called before the policy is registered with + * cooling framework. + */ + if (cpufreq_driver->register_em) + cpufreq_driver->register_em(policy); + ret = cpufreq_init_policy(policy); if (ret) { pr_err("%s: Failed to initialize policy for cpu: %d (%d)\n", diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 9fd719475fcd..1295621f6c28 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -9,10 +9,12 @@ #define _LINUX_CPUFREQ_H #include +#include #include #include #include #include +#include #include #include #include @@ -373,6 +375,12 @@ struct cpufreq_driver { /* platform specific boost support code */ bool boost_enabled; int (*set_boost)(struct cpufreq_policy *policy, int state); + + /* + * Set by drivers that want the core to automatically register the + * policy's devices with Energy Model. + */ + void (*register_em)(struct cpufreq_policy *policy); }; /* flags */ @@ -1046,4 +1054,10 @@ unsigned int cpufreq_generic_get(unsigned int cpu); void cpufreq_generic_init(struct cpufreq_policy *policy, struct cpufreq_frequency_table *table, unsigned int transition_latency); + +static inline void cpufreq_register_em_with_opp(struct cpufreq_policy *policy) +{ + dev_pm_opp_of_register_em(get_cpu_device(policy->cpu), + policy->related_cpus); +} #endif /* _LINUX_CPUFREQ_H */ From patchwork Wed Aug 11 11:58:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495163 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp4900005jap; Wed, 11 Aug 2021 05:06:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwe01j+9YuUKulojkC9LeJGcCMBdSZk/4IEHhSL3BS0FQ+GIVhrrBpuI9Ivz4/Yh/elCaV9 X-Received: by 2002:a05:6402:b56:: with SMTP id bx22mr11051305edb.285.1628683586726; Wed, 11 Aug 2021 05:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683586; cv=none; d=google.com; s=arc-20160816; b=JTxp4ypl1xOG5j70uA4CiJlkX6WKU4O61SLUqwr8LAZ279za8fvC9PN0AHB6OhcsEU TLd2JjNKfakG9jdf0sVZKoZMccO5Dg0XadtyxrfjYmyW8gnZekZRDdI8FJbJDhbkhdTO KufDbEm9Q/hGBtpEkxlH9RDFnEX+EOmRtpaQVSXNnJyCwRIViINvFYI/YGxyGcDknRVc HY8dFw5eHQ+uuRLDDrxZoVg3zXz1EG4nnu7l9pXKKH3qWO8xh2Uj2XXAobK+xKGAtX+B SQjKWQ/q0s15gFeyhLo05nGS/QrKd9lxLHm8UMQxPG1Pe7Sav9XNi2j4evpAjU+lvsq/ fPyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rjqWWeUctts4V9t7V1TVNNowsy6/ZHXWitYbSRTUDSc=; b=P6MBREDSM6HYhIh+E5bksWdghDqQmbZ+bY0g/rG+XEEWqYVtULxUarAZcdrJiAkWEV PMJ2/NOxX0cailkWVQnI6JyCkAGLpbxZhwL0ePwHW7r4ebQfpcGLtJSDezfxU+JtREQq qGt0SH33gbojiiwOhnDpM63I8Vlr+seKdq8P5piwz4ikTJPEmXsC2JjbjK1pTuZlmBms dCINfGhDBKclmNahxUlQG3eeTB4uQzukiYihMCCTXh7H2l+jroEOrnJWHzTStuj2QEpn VywPeLDujGo//PPotwaLmtfwZqt8T/eR/5Rc+ETMKpGe8qpIfr3TPO8c5ZjnwvmrPK23 rMLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GDcrWYD/"; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w11si24410170edd.252.2021.08.11.05.06.26; Wed, 11 Aug 2021 05:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GDcrWYD/"; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237541AbhHKMGp (ORCPT + 7 others); Wed, 11 Aug 2021 08:06:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237537AbhHKMGo (ORCPT ); Wed, 11 Aug 2021 08:06:44 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C2EFC061765 for ; Wed, 11 Aug 2021 05:06:21 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id l11so2407722plk.6 for ; Wed, 11 Aug 2021 05:06:21 -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=rjqWWeUctts4V9t7V1TVNNowsy6/ZHXWitYbSRTUDSc=; b=GDcrWYD/meMGdmLUcwRP+ZSS1yHCTBfETzpliLc0BUmSRq1VDCDFIdqogWXghBAXhy GGpoLbqpYOnvSOL70DilcmuBjmb7CQV+pUCwpHHftCTKSy30gAZv+ksKZPLnUACmonjQ t5Out2pAzeJpd3jQEunHadrC0ZZVPadZyLS+UfVDzTIOC+UxnZHvJwYDK19eVfvQQh44 az45xkP3tRAD8a4eJIRfA2Qq83zJ1pab59IGeIUCUIBkrlU1fsm/HREzVPTGgW/JLLaB sdIHBvnVWgFslF2UDmdbia8Rmnp2Hm/jkH6/IkgTv37+QdCX35BzvaujNkenzDVcAfu3 ADOA== 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:mime-version:content-transfer-encoding; bh=rjqWWeUctts4V9t7V1TVNNowsy6/ZHXWitYbSRTUDSc=; b=W2Vn/y2JL8bwxn0DkOQTbSnoOY3sM/POugfTnIaIeVmHLsESX8h86kTi4Loc2ANvON i4xDMt+eQ2pvN9sFDBco3hMtjaypzZ68ygi5SXeZmQ44+N3cnRh5HXVYiQe3LThTYC3T 99JgahBoKu2jOCA/0pLsTWpHfXP0GipZLn8phAN8de1fi+HBmJAmQdjq+lzMLy0RGoGW XUVPqAXehnWDod+JhsQ5lRbc9CgRIi7Nj2ZubNDzRSwzThjpw3bF6cGT8GYcLahnvjX0 NwdDM1zP5BrPPIA3xhfQ6DizBLNlcAjP+zYyuAQeKA1zsDFQSSw8vXx11VmS7ILSJ5af qQPQ== X-Gm-Message-State: AOAM530yZkdglNmzVgE+IfPf+VQtSwKX25F4GfbKBQ9zzKcMrz9xQtx/ HysPWSqxvBwToVeIjC9OxO34zbjnkmY9oA== X-Received: by 2002:a65:5bc9:: with SMTP id o9mr107174pgr.24.1628683580894; Wed, 11 Aug 2021 05:06:20 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id s31sm33016791pgm.27.2021.08.11.05.06.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:20 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-kernel@vger.kernel.org Subject: [PATCH V2 2/9] cpufreq: dt: Use auto-registration for energy model Date: Wed, 11 Aug 2021 17:28:40 +0530 Message-Id: <8c7478a9aa26740448539e9fdaba22789cb28287.1628682874.git.viresh.kumar@linaro.org> 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 Set the newly added .register_em() callback with cpufreq_register_em_with_opp() to automatically register with the EM core. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-dt.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index ece52863ba62..8fcaba541539 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -143,8 +143,6 @@ static int cpufreq_init(struct cpufreq_policy *policy) cpufreq_dt_attr[1] = &cpufreq_freq_attr_scaling_boost_freqs; } - dev_pm_opp_of_register_em(cpu_dev, policy->cpus); - return 0; out_clk_put: @@ -184,6 +182,7 @@ static struct cpufreq_driver dt_cpufreq_driver = { .exit = cpufreq_exit, .online = cpufreq_online, .offline = cpufreq_offline, + .register_em = cpufreq_register_em_with_opp, .name = "cpufreq-dt", .attr = cpufreq_dt_attr, .suspend = cpufreq_generic_suspend, From patchwork Wed Aug 11 11:58:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495164 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp4900206jap; Wed, 11 Aug 2021 05:06:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0vX3xk5X5U7nq5kGzu3dCCempGpltYuu4wmm/d9qz8SE3mFfQy0QMJcPMzrVdGNi2dluB X-Received: by 2002:a05:6402:299:: with SMTP id l25mr11008852edv.283.1628683597778; Wed, 11 Aug 2021 05:06:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683597; cv=none; d=google.com; s=arc-20160816; b=NwAcEg+D2LQj4je8Zb76efXOEZCezMIs8S8vkaGmFn41zMfouDR4C9rnHCTG9rtNVi mBHoY8vDb7KgUM/G35w6OFxOS8j65m4lDsH2nXScgXuHTZGTxWwkhWx6+hsNU7z/Veuv mWBziR/Sano0A7aKD6WS3NsybdArV0J2EbnA0Rt8UPXuryWlf2qqeJKehYtEnJK1P7EI 4safGrAxtht82OCayJOXuJr/L+aFZxlRMFbI2q8IEDVrQi8PZ7fhf9I8WKnx5HpGDOF1 3stzGeTUy0yHVkei368BHfZ67E4Bm04e9Wo0DTQaA+mSsdmarrwKujqW9l9nPuHxVgEI JxjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3ofSxGdnm5bQgO5ybUPtJlTPnLp/1dUTraYQIc2Dj88=; b=mAf8qa3rRE5bHUPhAmw7b2Zv6qYOVPBDKiE7ZFpuN09K5PvpZqaItkhjyj+BJu7aav s1xrImQxcJMeFNa6JO4PygZdhz+EuzkPTBPXVBVcFzvGAQkyV6YCESQhzd2trfykOT4A wQl1nGVQoSN95tracJEzt9GbUx8hqCl9LnRNkT5WsiFrkg+9Ew1gezQ97F3cs5Ux7fdd 5m82xqq3rdJb13VtHP280yQCo1EUkNxRpn4sBMf1iCgMeHHwfuRJaZCAxm2R7B5FIlhm peEp+/vHGq8wWBBtkn4D4xF+aIJcr7e9Z3gxCfJiBXNOG0DRXNcBu+aAJlq24lFQhcnf fiUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iwTOkiC/"; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si4066647edq.232.2021.08.11.05.06.37; Wed, 11 Aug 2021 05:06:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iwTOkiC/"; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237556AbhHKMG7 (ORCPT + 7 others); Wed, 11 Aug 2021 08:06:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237570AbhHKMGv (ORCPT ); Wed, 11 Aug 2021 08:06:51 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7A18C0613D3 for ; Wed, 11 Aug 2021 05:06:24 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id d17so2376312plr.12 for ; Wed, 11 Aug 2021 05:06:24 -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=3ofSxGdnm5bQgO5ybUPtJlTPnLp/1dUTraYQIc2Dj88=; b=iwTOkiC/FXUeP1MLxGDlrpK1q06mt4TyUQNlfCjlir/zVNQVwmC8IyZx1okkLu9f/j 606hr/6LLIzeQjXQ+gfVkmRvwMz4YDiy+OMpHXFxUDReYSC1TvYUeK1zgTx7cyIWKHya 55Hv68e/543vCLaQpFrJNuOrjoAA/GphQd9g/FJuN5c6ngePB3XNSNhm58UFR2n1TjSU wPjXtCe5Lul1gMnoDsBOUUEHlYqDovYwMAbip1yoSpdkQ25r3e6hx7qrzJW4Ha4SR3+k y3evmJrMv5CVxHCDUXDyKcPKiojH6Fdp7VMRO0Tn8B8g27ZozDaQysQZ8T2urFOcaeHW y2bg== 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:mime-version:content-transfer-encoding; bh=3ofSxGdnm5bQgO5ybUPtJlTPnLp/1dUTraYQIc2Dj88=; b=Eh3rr2hdFg9fB0uP/TWK3Zrf+9dehqQ4JbqAn6S7KOTWKNhjWVaVQ7RJ8lIFZZvGmb 3I2rDN9/wlyNSTpebuNbW/KUIJeVCz6lP6MlcaaCJfjnlT7fODWVmtLD3DW9afXQ+dka pI5Ou4K39p012Crk4GqtAJYbLiFcpReNUrpsXpmKlfYfgI62nj+SV6lmtcmra3LVyZAB C8fa6bmxf9SBlQnN1MZR2L1NugkjHRaElcBmXl/W/oXb/GB62ggydZx8IOm81BmCE5At m+rxBjCk02DaJ9DtQaAczaJ3XJFoQTiD/bIjWj2lRvXSX7HIyS42W+bObP6660IwEXqV eiCg== X-Gm-Message-State: AOAM531cuJkAgZe+NgI8W2ffba9LCbZ023ZgeFW4V5jvX7CWpTVKNaoR 973KlqGggv9hgQAhFFXcjIJGWg== X-Received: by 2002:a17:90a:ff94:: with SMTP id hf20mr20868931pjb.64.1628683584303; Wed, 11 Aug 2021 05:06:24 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id x19sm28203832pfa.104.2021.08.11.05.06.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:23 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 3/9] cpufreq: imx6q: Use auto-registration for energy model Date: Wed, 11 Aug 2021 17:28:41 +0530 Message-Id: <69cd4b06c671fabf828c853a7dd6ea6225357d42.1628682874.git.viresh.kumar@linaro.org> 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 Set the newly added .register_em() callback with cpufreq_register_em_with_opp() to automatically register with the EM core. Signed-off-by: Viresh Kumar --- drivers/cpufreq/imx6q-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/imx6q-cpufreq.c b/drivers/cpufreq/imx6q-cpufreq.c index 5bf5fc759881..90beb26ed34e 100644 --- a/drivers/cpufreq/imx6q-cpufreq.c +++ b/drivers/cpufreq/imx6q-cpufreq.c @@ -192,7 +192,6 @@ static int imx6q_cpufreq_init(struct cpufreq_policy *policy) policy->clk = clks[ARM].clk; cpufreq_generic_init(policy, freq_table, transition_latency); policy->suspend_freq = max_freq; - dev_pm_opp_of_register_em(cpu_dev, policy->cpus); return 0; } @@ -204,6 +203,7 @@ static struct cpufreq_driver imx6q_cpufreq_driver = { .target_index = imx6q_set_target, .get = cpufreq_generic_get, .init = imx6q_cpufreq_init, + .register_em = cpufreq_register_em_with_opp, .name = "imx6q-cpufreq", .attr = cpufreq_generic_attr, .suspend = cpufreq_generic_suspend, From patchwork Wed Aug 11 11:58:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495165 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp4900221jap; Wed, 11 Aug 2021 05:06:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAcjUYKSv9x1iwZe1xC2LTgWhwDLzAGXJ3bMZ9tDuNM/uJCvCOyZwMRYqZoQPw6NoSXQxo X-Received: by 2002:a2e:a447:: with SMTP id v7mr8304090ljn.46.1628683598426; Wed, 11 Aug 2021 05:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683598; cv=none; d=google.com; s=arc-20160816; b=ajX7pfIRqKmYPKLw+HeG1BrBPHWZeClLfsPYTD8kI0WlMQnvmTPkTciGf7AmYdP34K K9pxfRh90gKSs34bvnQTa+TOTBlpgGop6PMU8LbBvtMfnKV9J2msIU+37G5LsdA5F4Pa ZzvLqZL7mDXUclqLhHWpd3nIWe/IW0h54gCOB4YMGEDu8MpOWykXiWqXUa9cWXYA04EJ ag1ywmVkZzofp4XhG7CxPs3ioVsifU+jayv535RF5DVWCeLZuDpizFN1J7OG2JaE6ivb rgniV27SmVvtaUjpIi1nycc5by/9SoDKkk5yLC+eebkZ+LqHyVdgYyZ91WubdE8p/y2Z z66w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6ufaB+OMXdYU7j7TBo3XtAZpCHOejyA+3wA93Op1lzU=; b=BefVx/D2BX0E+6+oNAPetLfjdCTXdDEtQ0mFhhXpqffzI6VBLeo01kMrGgB04L1M92 sRvYC3h2bzQD5l3YAEdw/luFaakqp0/NPxntlmO0C941IsHzKZp59QnkLa7dhNaZgNLk vqr+Li1syxUualHsvvuiOjLxlsqbA5x2ueY+g2SPxJBMcc5UoKldj5qXXlc3RlxJ/PUX CN+EMXX1HkpZOssES90m08oYL2lhGmPZJb1ba5ihv0oGcVNwhHiOLflb9S3c1HG86bTY FlVGraNEBmodRgwo9ahFi6ooOYTY6Qdg6N0rJEGNh/HfdcAYvotRWc5yFirQTz4lGlrb R2AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t8lLzjPF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f3si4066647edq.232.2021.08.11.05.06.38; Wed, 11 Aug 2021 05:06:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=t8lLzjPF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237540AbhHKMHA (ORCPT + 7 others); Wed, 11 Aug 2021 08:07:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237312AbhHKMG5 (ORCPT ); Wed, 11 Aug 2021 08:06:57 -0400 Received: from mail-pl1-x633.google.com (mail-pl1-x633.google.com [IPv6:2607:f8b0:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6219EC06179C for ; Wed, 11 Aug 2021 05:06:27 -0700 (PDT) Received: by mail-pl1-x633.google.com with SMTP id n12so1747311plf.4 for ; Wed, 11 Aug 2021 05:06:27 -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=6ufaB+OMXdYU7j7TBo3XtAZpCHOejyA+3wA93Op1lzU=; b=t8lLzjPFZAWIYgTJOrFd2HG+scMTfIhGn3oErjtmiM//ccrcySFz8JOOZKulU+EiNL OXO+8zbdgMhoqwmYzFPpIQvy4NwR+3xGy5J0bpgHy4m6WaA+Vf+QrgkpMTwpC5PcNtPD +3lIVvpcRqaoz4+sOPxLsf88Wq0iRFXBDSECTlXfjDnmdjovXDpk2WgY//lc1NDMlyiD OH+cO8WaQ/hiuH1bJmO6CiXIanr5Wlii23Zg8EHPNS8qNTCNeQvGb7mbutXNddc+MLFl bh2hLW7kZP4owycILCEv6xAz8aM45z9ROAHxGDHqSi3Dwf27fyvzFcDHRtXM4FVUR9Kw QHfA== 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:mime-version:content-transfer-encoding; bh=6ufaB+OMXdYU7j7TBo3XtAZpCHOejyA+3wA93Op1lzU=; b=bMZo9zfCTBoAFbNz5gkJQg1ju7627zb20OAi71OdJOsXaIvUiSPQVl9GGFC24wzKxD pzMnSwrzzp88J0CYlWsB7+tG2U2P8Vo9NzISnMPayvmMlkUU+rPgTfUtsBniuPrCHlGs Hxp+dIW1dbGuMS6tE0dMFKT3m0dYpdZaTuBS7DSF9xbdAkBh72a9S4eC5PkKQJVn+k7p MQmxFwOEyALBOoA5kUN8x47+ny50aUiUCPLUlJIo76LfKSf2bcJ63MkZrkTkg7U8dxp0 ey1hH32qZDOJMPj9p6fxcN2k2FwhPAaQ4J1yZRrukMaYWN31mluOpyPJwh7P1Wd+VQS/ E4Ww== X-Gm-Message-State: AOAM530YC5H89AftXHdQDXgFWkWC+GWosr5qcjgraC6w6OYXiqvm64v+ wnRmWrJwFI8K1ZU7eFjHpKTp0A== X-Received: by 2002:a63:4b60:: with SMTP id k32mr562898pgl.198.1628683587396; Wed, 11 Aug 2021 05:06:27 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id j22sm31239903pgb.62.2021.08.11.05.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:27 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Matthias Brugger Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH V2 4/9] cpufreq: mediatek: Use auto-registration for energy model Date: Wed, 11 Aug 2021 17:28:42 +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 Set the newly added .register_em() callback with cpufreq_register_em_with_opp() to automatically register with the EM core. Signed-off-by: Viresh Kumar --- drivers/cpufreq/mediatek-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c index 87019d5a9547..866163883b48 100644 --- a/drivers/cpufreq/mediatek-cpufreq.c +++ b/drivers/cpufreq/mediatek-cpufreq.c @@ -448,8 +448,6 @@ static int mtk_cpufreq_init(struct cpufreq_policy *policy) policy->driver_data = info; policy->clk = info->cpu_clk; - dev_pm_opp_of_register_em(info->cpu_dev, policy->cpus); - return 0; } @@ -471,6 +469,7 @@ static struct cpufreq_driver mtk_cpufreq_driver = { .get = cpufreq_generic_get, .init = mtk_cpufreq_init, .exit = mtk_cpufreq_exit, + .register_em = cpufreq_register_em_with_opp, .name = "mtk-cpufreq", .attr = cpufreq_generic_attr, }; From patchwork Wed Aug 11 11:58:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495491 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55E6AC4320A for ; Wed, 11 Aug 2021 12:06:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3C67260FC3 for ; Wed, 11 Aug 2021 12:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237577AbhHKMHD (ORCPT ); Wed, 11 Aug 2021 08:07:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237582AbhHKMG6 (ORCPT ); Wed, 11 Aug 2021 08:06:58 -0400 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48AFCC0617A0 for ; Wed, 11 Aug 2021 05:06:31 -0700 (PDT) Received: by mail-pl1-x631.google.com with SMTP id d1so2432358pll.1 for ; Wed, 11 Aug 2021 05:06:31 -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=BXHghljtL4EI/XqtTqMJz5EFL6+UxuiO/TdGXUvnvkE=; b=pGvvmyLgKXMq/gHVrO+ZoqLit5xJiuyTTDJ8SaKmoTWv2du9Ih0MpPYTsTRPbJlCOV hghx6irrx50AxT5V8KZGbN9uwrEEfCdHXcGxqT1tPcLtEvwg1uP3fpvWgcPdMLullHVH PtE6/eF0rKi+S+kC+vh6dzIr3l1cozoJal4JPPrkJGKni8qrYPFLdCxpQUSLd4lGiYmX 1bAIHU3WKZFsNP2BQwCSJYT7kv1RZLcP6QK4/UHlHAQhmZcvVZkCd0ZfOQXY2n+eJ5xG epdcTT1+J31BHoWqBzAblw3GyVFWPT05aqg8VSHsYB81pxYeuwVgIo2zt45f3PpuVAdJ pbYw== 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:mime-version:content-transfer-encoding; bh=BXHghljtL4EI/XqtTqMJz5EFL6+UxuiO/TdGXUvnvkE=; b=YZK2QePf+qNmxmBiOdmdwMHfst8vtysj92H4PbacDkUZUiv7CXNSy42tPh0XQDW/gB h5yVSi+Bht7lRJbPYkiy0ZKFIL7Z0QQ5C1aEQ/naNzkq8ncYTR6AYMhDZHtW2c2pIvQw z9E9KIYM7ImsyPMhhTC2PEBtUxVqyzbNRm5sU+/J1VKpbwLm8FHzBb+jEi3Votku+UkU Psi2fpYpQItSicNMz+Aq9hKdokm1muPi43J6cqCu3eRs+AXYo7IQQldRWye5p3Inxv+s SUicweuthwaTCpBOAVL4jdUzN5s9GXOc7zN3ryHPsdMYHfW094cw5vO8PxkdIi7V/pSL vN2g== X-Gm-Message-State: AOAM532HFrVrE8Bk3qTmyBjfkaJ9Y08IIZRNmc8aRn0npR2dqLaAyUzm i9dUXzPS8uuDqz0ikA7tJRTvdg== X-Google-Smtp-Source: ABdhPJwJ/mGfSpLjHlI0GUojG9K5o+B+piJZ7HN2yU7A5gnjRZVE9IYg888XxbaTktEE/Q6svThKEw== X-Received: by 2002:a63:4b20:: with SMTP id y32mr384518pga.382.1628683590823; Wed, 11 Aug 2021 05:06:30 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id b20sm26614754pfl.9.2021.08.11.05.06.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:30 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Kevin Hilman , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 5/9] cpufreq: omap: Use auto-registration for energy model Date: Wed, 11 Aug 2021 17:28:43 +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 Set the newly added .register_em() callback with cpufreq_register_em_with_opp() to automatically register with the EM core. Signed-off-by: Viresh Kumar --- drivers/cpufreq/omap-cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index e035ee216b0f..1b50df06c6bc 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c @@ -131,7 +131,6 @@ static int omap_cpu_init(struct cpufreq_policy *policy) /* FIXME: what's the actual transition time? */ cpufreq_generic_init(policy, freq_table, 300 * 1000); - dev_pm_opp_of_register_em(mpu_dev, policy->cpus); return 0; } @@ -150,6 +149,7 @@ static struct cpufreq_driver omap_driver = { .get = cpufreq_generic_get, .init = omap_cpu_init, .exit = omap_cpu_exit, + .register_em = cpufreq_register_em_with_opp, .name = "omap", .attr = cpufreq_generic_attr, }; From patchwork Wed Aug 11 11:58:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495490 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D17EC4320E for ; Wed, 11 Aug 2021 12:06:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2454B61076 for ; Wed, 11 Aug 2021 12:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237595AbhHKMHK (ORCPT ); Wed, 11 Aug 2021 08:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237594AbhHKMG7 (ORCPT ); Wed, 11 Aug 2021 08:06:59 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CF07C0617A5 for ; Wed, 11 Aug 2021 05:06:34 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id oa17so3013755pjb.1 for ; Wed, 11 Aug 2021 05:06:34 -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=8F5SodJNfZE6KLwiwfoFbQqrxkGaRIBPPPD9UGRC3ww=; b=XLmt0RwRxkY54+csl1bEURnOu6nSVNo0HexFPjRrACsqp5nUdMT5GiaXwHYYKHumcO eDri9hdGrhQbXSSCeCwDMBbqiXNTzj4F5EK5Fpfu49Lv/yw3ZRSkPCWBKFxSugE0gARd CuRia5Bn4kQUmAvW9QBWw2FXYdHqb7z1hcn3ZR0q3r+hiXUbkBtZ7AlS/v9NOW+d8V5y 12d1YPLHJsv5wdvuf1hA0HWL31k38hWirLw7RcCtOVaQFxyHlSuoDyc4n6ayTDoUKYbU /ZwlVgyOqZCLeVtXMXToZX9hm1b+TGsGiKsBWwQrrf/DsqCHPz5darnPw/crM8CRERum 9ZXw== 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:mime-version:content-transfer-encoding; bh=8F5SodJNfZE6KLwiwfoFbQqrxkGaRIBPPPD9UGRC3ww=; b=ESQZ0A40q08peVz4iyrLTZg+tERur0MtN2+MmP3kmxBIhXTF//bFpoddv5XnwZ2c4c Sz9yjL04FtZGv6o4HDe0wKX2ejXJ/cbFWY/9r2IoE9tcJEbZtmlObV/RRQRDjPKCTvKx jN7ecMgyqtSb3KgvCsq2qchZXXuDEPDnRfO9ly4i6ReZnyWSx8e1BNt5Izy7NgcbS89v vilrNjImT5uYkT1VfAnWZw0Yn5qsJfyasbQNy/kQZHUrA6TpKZjZR5VyGsKzQ8Xl+KXq QT6Ch892SG6QCIATtrlbR6NwCybmir8KV4A3wuHPsN2s/iOWq6YfKizOHTOzeD5mOsdo sTlg== X-Gm-Message-State: AOAM532sIZi5GNZmZj76yTFhGzKNPJVmpAvntvTgvokUok/QvjY32f8f jomHxwteQfNAr5zF+V/trfmj5w== X-Google-Smtp-Source: ABdhPJyyrLqmNEXs7dWJno2o5R6jsUJAX3OwRMSbvWYslCG+rvMw8eOX4ntT8HvmtZWFX7DGRdBirg== X-Received: by 2002:a17:90a:2fc2:: with SMTP id n2mr35205665pjm.112.1628683593885; Wed, 11 Aug 2021 05:06:33 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id 186sm28642393pfg.11.2021.08.11.05.06.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:33 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Andy Gross , Bjorn Andersson , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 6/9] cpufreq: qcom-cpufreq-hw: Use auto-registration for energy model Date: Wed, 11 Aug 2021 17:28:44 +0530 Message-Id: <701477f4b76a7c055b6df33f74668293b8205a96.1628682874.git.viresh.kumar@linaro.org> 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 Set the newly added .register_em() callback with cpufreq_register_em_with_opp() to automatically register with the EM core. Signed-off-by: Viresh Kumar --- drivers/cpufreq/qcom-cpufreq-hw.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c index f86859bf76f1..c2e71c430fbf 100644 --- a/drivers/cpufreq/qcom-cpufreq-hw.c +++ b/drivers/cpufreq/qcom-cpufreq-hw.c @@ -362,8 +362,6 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) goto error; } - dev_pm_opp_of_register_em(cpu_dev, policy->cpus); - if (policy_has_boost_freq(policy)) { ret = cpufreq_enable_boost_support(); if (ret) @@ -412,6 +410,7 @@ static struct cpufreq_driver cpufreq_qcom_hw_driver = { .get = qcom_cpufreq_hw_get, .init = qcom_cpufreq_hw_cpu_init, .exit = qcom_cpufreq_hw_cpu_exit, + .register_em = cpufreq_register_em_with_opp, .fast_switch = qcom_cpufreq_hw_fast_switch, .name = "qcom-cpufreq-hw", .attr = qcom_cpufreq_hw_attr, From patchwork Wed Aug 11 11:58:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495168 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp4900372jap; Wed, 11 Aug 2021 05:06:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1rTKTt3pJvmzFAXJJ1aQldKTwZ9hCowl1x94DTX6rTwn+Q268YX7kX/Hj5le/B27cooca X-Received: by 2002:a50:8fe1:: with SMTP id y88mr10918054edy.101.1628683607911; Wed, 11 Aug 2021 05:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683607; cv=none; d=google.com; s=arc-20160816; b=0b9FtvzoC/OpDoDlWiUDBg28itzVyaxw5ndGTu4lrnkA0UbkFkTUeUVUoa345i2j/9 vca1mx/fjl4Tzzzkdg9ZDpyCkZ+OqsQ09LNEg+VpKobcsKDu4qavA8usiACKgdZyHT09 0RCFuT6rtjmpQDB1nGLKrWvN1zOAOcnumqrLZ7gVIB8eBUNBDlCgkH6tlKa8QgSN5Cvy dgnwxE4xAdaCQ3IEHSqNTB4z3Y7ZCWeNY4sPEV3a4rZRyQFrGKKA6aNnChqh1V/8nWVJ IdwFXsgrRKW29AKLnQFirKtYrNW+LIivOpIrBQXcqi9Adxm0FqHTBQ7EuA0xpSffuZOg bOHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4ZC+FP75mFAQwlcrfkbIZ+KkPc6ZyFBFhH1NecTG31o=; b=ZLaB77DqjTTsULhD1XNaT7nUBDB34Otpzk26d7oIGcbzvULGBUYUrrRnL/1lPgBPU/ bf7T40fqrFUzBF+n21kIQ5lXBevVFm4innEBrgIdQdiim3Coj2Zn3Jb8X6MBARHyYqvq hFi8OQkA32JYjFz3VSE5Ai5YBcCE/2+6IqxY32yj6ZJ2dk55hge3QfFle3TXXdvSTe/n epgVTbmg6uWjXpEVIRXaHqG3D4ArOoNIHaL7W5udg5BG2b+nahQK2HcYxCesQUCJ9T/o OiP6XpYN5XCNr3ezz3dwEV7z/Oda+hXRFp+voGY6uWwIXzfgxN+pgi4enDsFPhGPXv46 kgrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LkS+DJyC; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q25si23486069ejn.362.2021.08.11.05.06.47; Wed, 11 Aug 2021 05:06:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LkS+DJyC; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237665AbhHKMHI (ORCPT + 7 others); Wed, 11 Aug 2021 08:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50930 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237567AbhHKMHB (ORCPT ); Wed, 11 Aug 2021 08:07:01 -0400 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF451C0613D5 for ; Wed, 11 Aug 2021 05:06:37 -0700 (PDT) Received: by mail-pj1-x102b.google.com with SMTP id gz13-20020a17090b0ecdb0290178c0e0ce8bso5745457pjb.1 for ; Wed, 11 Aug 2021 05:06:37 -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=4ZC+FP75mFAQwlcrfkbIZ+KkPc6ZyFBFhH1NecTG31o=; b=LkS+DJyCHnMxf56bNqFv4JSdLFaYjYrHiVV7mc3191cjFeYU3wHMqGpRM4gdjWsoAp MQJ4C/itAshvVXwGwO0e3Z2SG1ympyGA4sHg5fcQuGy769EMvr48vlOXEDlps+AMmvob 2bTZAOPXVOSz7g8rruXoulxOthp3RA6tJlmz9SJLfipbJTG226hE+c+VVrzYKhZypikQ I5OU4VJ3PEwx0lqwyHjDNO9EoYf8i6Krx/tylt0uhBBd4eCiVZha55T4ptkfiWUxRe6E nQOTmEUtmsGA+4cjv2I6J7D3TKxjHdMSkKn3iu0fUmY+nlCfnYG0zRgwcFR3496FyTfu b0NQ== 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:mime-version:content-transfer-encoding; bh=4ZC+FP75mFAQwlcrfkbIZ+KkPc6ZyFBFhH1NecTG31o=; b=lGYmqGYDDAHtziGcsHbFgc3/Ab6uzqXBjICNQe67+sAmJ1VUnfCKYhHhXOT9TqkdXW f6RqRzd5WAEXRYsSAyF/p3+0OyFpbYETCLmg9p+9YLfn2qM7KLqEYqCreQMCOb0LRoMk eVkGcSAyB8TrDO2GL3HIqlukNEbUMAygk6SfAo2DAvwi4Vxf8TAhlg8rtwXPSwHJmYD5 B5Io4CCAY0trkveWiLkFaQrDrEu9oS9HINXtP/dHdNp6kBKGTkU20yZtlT91iuU/3wek Nf9wtQ8MENfdZ2OjfWJMuB2gKOXH6/ndrWuZUL5Cjws6xPBADJpM2uf1Nu4Czcpilck2 /q7w== X-Gm-Message-State: AOAM530vKZ3bm5LdancRYM1f1cNuvyywEtcfu2CN4V8/so4fF/LVFfyB DhFGFD8v1it1hofSRxgrmuovNg== X-Received: by 2002:aa7:8889:0:b029:3bc:e8a5:50ea with SMTP id z9-20020aa788890000b02903bce8a550eamr28572168pfe.73.1628683597329; Wed, 11 Aug 2021 05:06:37 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id 23sm14538606pgk.89.2021.08.11.05.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:36 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Sudeep Holla , Cristian Marussi , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 7/9] cpufreq: scpi: Use auto-registration for energy model Date: Wed, 11 Aug 2021 17:28:45 +0530 Message-Id: <29c65db2dfcbfebdb291a3056cc2adaca8b34cec.1628682874.git.viresh.kumar@linaro.org> 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 Set the newly added .register_em() callback with cpufreq_register_em_with_opp() to automatically register with the EM core. Signed-off-by: Viresh Kumar --- drivers/cpufreq/scpi-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/scpi-cpufreq.c b/drivers/cpufreq/scpi-cpufreq.c index d6a698a1b5d1..bda3e7d42964 100644 --- a/drivers/cpufreq/scpi-cpufreq.c +++ b/drivers/cpufreq/scpi-cpufreq.c @@ -163,8 +163,6 @@ static int scpi_cpufreq_init(struct cpufreq_policy *policy) policy->fast_switch_possible = false; - dev_pm_opp_of_register_em(cpu_dev, policy->cpus); - return 0; out_free_cpufreq_table: @@ -200,6 +198,7 @@ static struct cpufreq_driver scpi_cpufreq_driver = { .init = scpi_cpufreq_init, .exit = scpi_cpufreq_exit, .target_index = scpi_cpufreq_set_target, + .register_em = cpufreq_register_em_with_opp, }; static int scpi_cpufreq_probe(struct platform_device *pdev) From patchwork Wed Aug 11 11:58:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495167 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp4900331jap; Wed, 11 Aug 2021 05:06:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJznILu4N1n+z2noPmdXv4l7Q9imdzbu3cRh6ELbNII0Gmi8nzcQviL02gsXPbhXFNaE2g4V X-Received: by 2002:a17:907:1b22:: with SMTP id mp34mr3373879ejc.408.1628683605507; Wed, 11 Aug 2021 05:06:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683605; cv=none; d=google.com; s=arc-20160816; b=qqH5tnyxljRuvUEiUQVb2nP84xvGcguhqW2KK8C+EqAHhxHguPowHPfZZq0hMm9oUQ 6dM4BID9rG1yD/IJXb8z74sbk0Y2dfZcKbyabySff80GU41oysDJrQSSorYu9P0cpTwh t9nsbnxQrJh958f5ZgTqHZTHaDrOLgxQ2uafAAfbZf2Q3G2QcTIcDuduuk1skYq3yIUl 3WZiFAJs50UI/kv8QzZEWje+RxB6eKffUOZ+8awvofXHF4BQPFbQMJowou7kO35j0+LF AYWhgzq2YkWt6H64GxT7oSD5W+QRkXXh9TgHCah6BmVIhusLYc5B4tMY5uBfycgvtpFM sWqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ufOzb/yHm+Yy0muA4H19fAJdjtQW7OC7JUKwWc/tDWo=; b=LwOULXYp1jNz++XnD4J9aPj418iY+mq+VLLMCbQkgF9ZglJA5qINkyhN1pbvsr5nf7 gKiBM/jqtXgK6fKk8yaBXtdUStzL1KOt/bx3cxejiix8TfJNlYjPbuayH4diNvgRATIE 1ERhnUNIO7+REs1xnNykKEt6RfMcO25nmtr+aMNlWNE8XrRN1WV4giS/MYg//43z/ShD BjvYzuj+h1V6bnx7wDiv0f5hAxYUK5Qw8tAT0SIbxJ6OyoGK/TK6jsLCQkEd5Iy/Vyfw V9//WkO5TG0cJ5KxHoOWD/pp8MxTBbmNFf4W60ceEs6SMKA9+bU54dIi1JN3y9cMpp3/ 5E9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C9FEmgjF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q25si23486069ejn.362.2021.08.11.05.06.45; Wed, 11 Aug 2021 05:06:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C9FEmgjF; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237610AbhHKMHG (ORCPT + 7 others); Wed, 11 Aug 2021 08:07:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237581AbhHKMHE (ORCPT ); Wed, 11 Aug 2021 08:07:04 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5801C06179C for ; Wed, 11 Aug 2021 05:06:40 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d17so2377424plr.12 for ; Wed, 11 Aug 2021 05:06:40 -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=ufOzb/yHm+Yy0muA4H19fAJdjtQW7OC7JUKwWc/tDWo=; b=C9FEmgjFCyHEUOJxkqjYRENiWra7tJpf8wDbmNI1upCMG/ARVHHAifgv/ZnJhTgg3R UaSyeUK7cR6CUQ7gEIpyBEmz0yZJronlHOtiOkhy8HTJD7HDIC2Egbkj2df8jpcjkiM6 Z2lZ7INFiaX+paBNzkqx3ShGy+TEq9OidaoBaI7yyGw5VFP3//0mZJf5QJzBy++KNoO2 002Y3ulPb+Sdez2kGgqsqteBtAqnSe5lBczDjfBDRIIc+8OkzvfMCAfZ7zSYCdT0TMhr 9m5xhlK7Fhg1DzjpVeItxBu4kC1BGD145jv9p4RGy6I9KJPaTRPDi0ssLbPznIw88f89 dWdg== 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:mime-version:content-transfer-encoding; bh=ufOzb/yHm+Yy0muA4H19fAJdjtQW7OC7JUKwWc/tDWo=; b=VBPWsiWp6/CL4+23D41cQEhSzyjP4u+UmmJLCGSg3vW+118D5OgzNqYnh8ZpwUmYG3 x0N3Bbvp+g8CMHODIh/ch4qdZilUnU/RRFWJL90GhTUbTtF/Xg81Gtr1XU+k7APugFcv P8/oYtefn7Bq1wIj0STMtbY9JZwKrzpIYIgKcduutXln7z69ylGBRxlYc6hwAWXjrd9m TqO+wBDMKqEDO0K6QkcDcppzhy9XaXrn/05iHJjEQnHJzNaXonZ+GL8+YzSMC7kidYMq 6nUVI8v1XB333OReJCF1escOZRZ1lJPzLC829/wtGEV8uFqwz8EWFa1PDUM5L5xc01Im Eg5w== X-Gm-Message-State: AOAM532rEa9ggieR7l0qoX3QYdNN8UCeqRGTQ7YKTYG6/r+o4JTynB0e HXZSBwJUBL5dWXjrv/9R6IeB9g== X-Received: by 2002:aa7:8d0c:0:b029:3e0:2e32:3148 with SMTP id j12-20020aa78d0c0000b02903e02e323148mr2128487pfe.23.1628683600347; Wed, 11 Aug 2021 05:06:40 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id j18sm17649389pfc.98.2021.08.11.05.06.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:39 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar , Sudeep Holla Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 8/9] cpufreq: vexpress: Use auto-registration for energy model Date: Wed, 11 Aug 2021 17:28:46 +0530 Message-Id: <0bc6387893ea7215da658943ddaa2208f5f3e239.1628682874.git.viresh.kumar@linaro.org> 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 Set the newly added .register_em() callback with cpufreq_register_em_with_opp() to automatically register with the EM core. Signed-off-by: Viresh Kumar --- drivers/cpufreq/vexpress-spc-cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/vexpress-spc-cpufreq.c b/drivers/cpufreq/vexpress-spc-cpufreq.c index ab56813b7256..284b6bd040b1 100644 --- a/drivers/cpufreq/vexpress-spc-cpufreq.c +++ b/drivers/cpufreq/vexpress-spc-cpufreq.c @@ -440,8 +440,6 @@ static int ve_spc_cpufreq_init(struct cpufreq_policy *policy) policy->freq_table = freq_table[cur_cluster]; policy->cpuinfo.transition_latency = 1000000; /* 1 ms */ - dev_pm_opp_of_register_em(cpu_dev, policy->cpus); - if (is_bL_switching_enabled()) per_cpu(cpu_last_req_freq, policy->cpu) = clk_get_cpu_rate(policy->cpu); @@ -475,6 +473,7 @@ static struct cpufreq_driver ve_spc_cpufreq_driver = { .get = ve_spc_cpufreq_get_rate, .init = ve_spc_cpufreq_init, .exit = ve_spc_cpufreq_exit, + .register_em = cpufreq_register_em_with_opp, .attr = cpufreq_generic_attr, }; From patchwork Wed Aug 11 11:58:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495170 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp4900458jap; Wed, 11 Aug 2021 05:06:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvS5mrszQegfOpLUPtzDFlXjHXS7xiGK2XRS89cf9d0/XuGEIfzDH39YaT/srlpfi0mukt X-Received: by 2002:a05:651c:4cf:: with SMTP id e15mr10788448lji.414.1628683612734; Wed, 11 Aug 2021 05:06:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683612; cv=none; d=google.com; s=arc-20160816; b=O1KbQT0CEZ8zVWCL4LVl19E7j916IE0sFT0EQblwTwX9f8FieWBF0y47UvOStoep/Z JsjbUJ21BTrtQszg0WOmPETUsWThYpuGBgu1/GbPTVnt2l865F6f/lIXqgULSiOusuU7 AT48XziuewsNYb/HHoywPjWdqRj4hh4s02h1HLhGSYrrF0i9aH9pYMXCvPQJyvtdZ+Lm OYyAbOvwQwcQwEMf44GcwhQoP8puWWiDYXfoG9urNISLTiHt46SeFpjT1bh7v2m1ciiV fTgTMxvNs2TYkOiq/LgKaUAvXtcAwP/2g1ys6aYPXvcpi5PNfsVFP14rCcf5OVIj3Z97 f7iQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lWMPxMr+0+XtByl7tZGdcG2GFI54dtlZAQg+hT8HCaQ=; b=h3OLgnvS+ytGL4a2f+uOHU0Cw8EHISB/6ot9AR2awmuGf/eEXrR52k73qKYeRMm063 o9DUmVVoW/vPccheYqtbbC1J88osXhJ/63QqWRnDlfyXHKljdnO4NeI6FJbU6ieKd+V0 FpYO3MdH9Jt0t87Pu/JPcIPzXP+auRwatmn3SIgJw7wJdufuRSb9QGqOpihhyu/uKzqb IU9bGYqgL7m4r6mHE8GWN4gJdnwyLYK6o7E0NmLPVUfX2MqXd9LwIL5EwC8RIwGjKQww IG3azyJn/fjCyYp8SU/qNYxBKMH6B1zpVhFZrUIGOTFkx/Nd7AD1YL75/ZxxazPequZA 18Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kNo51Ty2; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw10si24270455ejc.360.2021.08.11.05.06.52; Wed, 11 Aug 2021 05:06:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kNo51Ty2; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237639AbhHKMHN (ORCPT + 7 others); Wed, 11 Aug 2021 08:07:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237648AbhHKMHH (ORCPT ); Wed, 11 Aug 2021 08:07:07 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEDA8C061798 for ; Wed, 11 Aug 2021 05:06:43 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id a5so2414360plh.5 for ; Wed, 11 Aug 2021 05:06:43 -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=lWMPxMr+0+XtByl7tZGdcG2GFI54dtlZAQg+hT8HCaQ=; b=kNo51Ty287+Kf3xWLJBGIhyPm4y4DKiLm98i3Pq848jWbLqTuUdKifktM6kOb8qJw0 F/sq6JVvy/bWf1cOTxFySRV4rHJLp+UX64TZypAKdYtU3JkS7zkMYq95K1YmsZOZIXzT p1rPaHOcyg8Rrm/Y/j3JC6D4bK9jmywwIxlIaGa+a2SByYNW9PkjDxnkDg0CypZrn+em rfZHy34KzjrzNllk+I0kOIjPH8Ror6DiLlRUOOkn2vA5bKpfw4Tsq+QfLy1MeZepCUQ5 gOlaSUNNiqSlbAbLb5CvD5r/f6Bm2r/Nhqod+ejhJFCOfHndYqhyTyN7gYra+c46BSff 9O9A== 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:mime-version:content-transfer-encoding; bh=lWMPxMr+0+XtByl7tZGdcG2GFI54dtlZAQg+hT8HCaQ=; b=LXsu95pkNW928a/jDYNrolusfJYqvQlpdgIS35v9GQXHD5rQeXJhknkl7bvK9kqhLm tKgBtpIdKluF9mOCUFaE3j9i0JnDBDYoRl5H2ZvwraYLuurpeGcupVD8fO6SV2rwVCZS bMsYbh4BtdhhULkzwOyYCUvIlYPCYKdvAmBsZ20boWJ6+vB1JMaZVrNLS4WKm4uAhw27 HERTqlrEBjThVfFT/jR+VeiGXTQmGHvkMkf0gakRjMOBgtC62DxiRlB+N9oe/6ccHzG6 xdCD3kyq143pIMH0H5ihfyM6aBRoMW22M3OaMSwXhu4Slo1G3MEZfjYJdvTIXxonCcqE L0fg== X-Gm-Message-State: AOAM530PfKMDuffl2bbsh/eIZfYVr+eAz3JBS8nPd6w3nECzfdw0dZTQ 9d41WHK3SdDe8OzXtTH45AY+msAGnMQ4Ig== X-Received: by 2002:a65:6a0a:: with SMTP id m10mr744726pgu.82.1628683603490; Wed, 11 Aug 2021 05:06:43 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id c9sm26616579pgq.58.2021.08.11.05.06.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:43 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Sudeep Holla , Cristian Marussi , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH V2 9/9] cpufreq: scmi: Use .register_em() callback Date: Wed, 11 Aug 2021 17:28:47 +0530 Message-Id: <6094d891b4cb0cba3357e2894c8a4431c4c65e67.1628682874.git.viresh.kumar@linaro.org> 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 Set the newly added .register_em() callback to register with the EM after the cpufreq policy is properly initialized. Signed-off-by: Viresh Kumar --- drivers/cpufreq/scmi-cpufreq.c | 55 ++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 23 deletions(-) -- 2.31.1.272.g89b43f80a514 diff --git a/drivers/cpufreq/scmi-cpufreq.c b/drivers/cpufreq/scmi-cpufreq.c index 75f818d04b48..b916c9e22921 100644 --- a/drivers/cpufreq/scmi-cpufreq.c +++ b/drivers/cpufreq/scmi-cpufreq.c @@ -22,7 +22,9 @@ struct scmi_data { int domain_id; + int nr_opp; struct device *cpu_dev; + cpumask_var_t opp_shared_cpus; }; static struct scmi_protocol_handle *ph; @@ -123,9 +125,6 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) struct device *cpu_dev; struct scmi_data *priv; struct cpufreq_frequency_table *freq_table; - struct em_data_callback em_cb = EM_DATA_CB(scmi_get_cpu_power); - cpumask_var_t opp_shared_cpus; - bool power_scale_mw; cpu_dev = get_cpu_device(policy->cpu); if (!cpu_dev) { @@ -133,9 +132,15 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) return -ENODEV; } - if (!zalloc_cpumask_var(&opp_shared_cpus, GFP_KERNEL)) + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) return -ENOMEM; + if (!zalloc_cpumask_var(&priv->opp_shared_cpus, GFP_KERNEL)) { + ret = -ENOMEM; + goto out_free_priv; + } + /* Obtain CPUs that share SCMI performance controls */ ret = scmi_get_sharing_cpus(cpu_dev, policy->cpus); if (ret) { @@ -148,14 +153,14 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) * The OPP 'sharing cpus' info may come from DT through an empty opp * table and opp-shared. */ - ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, opp_shared_cpus); - if (ret || !cpumask_weight(opp_shared_cpus)) { + ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, priv->opp_shared_cpus); + if (ret || !cpumask_weight(priv->opp_shared_cpus)) { /* * Either opp-table is not set or no opp-shared was found. * Use the CPU mask from SCMI to designate CPUs sharing an OPP * table. */ - cpumask_copy(opp_shared_cpus, policy->cpus); + cpumask_copy(priv->opp_shared_cpus, policy->cpus); } /* @@ -180,7 +185,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) goto out_free_opp; } - ret = dev_pm_opp_set_sharing_cpus(cpu_dev, opp_shared_cpus); + ret = dev_pm_opp_set_sharing_cpus(cpu_dev, priv->opp_shared_cpus); if (ret) { dev_err(cpu_dev, "%s: failed to mark OPPs as shared: %d\n", __func__, ret); @@ -188,21 +193,13 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) goto out_free_opp; } - power_scale_mw = perf_ops->power_scale_mw_get(ph); - em_dev_register_perf_domain(cpu_dev, nr_opp, &em_cb, - opp_shared_cpus, power_scale_mw); - } - - priv = kzalloc(sizeof(*priv), GFP_KERNEL); - if (!priv) { - ret = -ENOMEM; - goto out_free_opp; + priv->nr_opp = nr_opp; } ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table); if (ret) { dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret); - goto out_free_priv; + goto out_free_opp; } priv->cpu_dev = cpu_dev; @@ -223,17 +220,16 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy) policy->fast_switch_possible = perf_ops->fast_switch_possible(ph, cpu_dev); - free_cpumask_var(opp_shared_cpus); return 0; -out_free_priv: - kfree(priv); - out_free_opp: dev_pm_opp_remove_all_dynamic(cpu_dev); out_free_cpumask: - free_cpumask_var(opp_shared_cpus); + free_cpumask_var(priv->opp_shared_cpus); + +out_free_priv: + kfree(priv); return ret; } @@ -244,11 +240,23 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy) dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table); dev_pm_opp_remove_all_dynamic(priv->cpu_dev); + free_cpumask_var(priv->opp_shared_cpus); kfree(priv); return 0; } +static void scmi_cpufreq_register_em(struct cpufreq_policy *policy) +{ + struct em_data_callback em_cb = EM_DATA_CB(scmi_get_cpu_power); + bool power_scale_mw = perf_ops->power_scale_mw_get(ph); + struct scmi_data *priv = policy->driver_data; + + em_dev_register_perf_domain(get_cpu_device(policy->cpu), priv->nr_opp, + &em_cb, priv->opp_shared_cpus, + power_scale_mw); +} + static struct cpufreq_driver scmi_cpufreq_driver = { .name = "scmi", .flags = CPUFREQ_HAVE_GOVERNOR_PER_POLICY | @@ -261,6 +269,7 @@ static struct cpufreq_driver scmi_cpufreq_driver = { .get = scmi_cpufreq_get_rate, .init = scmi_cpufreq_init, .exit = scmi_cpufreq_exit, + .register_em = scmi_cpufreq_register_em, }; static int scmi_cpufreq_probe(struct scmi_device *sdev)