From patchwork Wed Aug 11 11:58:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 495161 Delivered-To: patch@linaro.org Received: by 2002:a05:6638:396:0:0:0:0 with SMTP id y22csp4899814jap; Wed, 11 Aug 2021 05:06:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoQvZDEpda3d31leXNL5IfTtSTrN3dv2c92F+83Z4Y0iG/WcHJGOgfFL3kY9vc6ZDrcoZh X-Received: by 2002:a7b:cc8b:: with SMTP id p11mr9595262wma.25.1628683577275; Wed, 11 Aug 2021 05:06:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628683577; cv=none; d=google.com; s=arc-20160816; b=M8RyyS57CAxbGbsTTtShI0wU7QYHaURzkACth5UrgVfsJG7wEp75goFJnY4GtzzDJ6 XjDL+/I/7nmoLRxOfwturScKN6MvIzarmIwIQqDoXOuyBZ2R/MbeTiw9ES9gusCmIjRq 2cCpKbcJUDxGwDTTBYU1o8sPNQMKOBpLz2ofxkgnSrzB0Xi6tQ1V78Oe2OzaDpQtTOeF yKPoiv7BueUJk2k0ELzeZIv7n1ym/5uw4O1QDFwbFGOxN6uZ/r1DqivQwIpRDYPTg+VF PpS1aqGDHPkJ9A2EQ1BihfbvtyiFLw7cc8WFciL9kwRgbJKSa6Je2hagU7CHDEiiiEHp gV7w== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=FKg83oB/EOubumHMLyW/+CxlonCs6Sr8DZwUqs7o61s=; b=erbGE3o9QdE1pkaAQsUW2kCmULdVBZjxvkxUPXFw2d9izQrSXTkSfA8cEh/9EgeKIz btjVyjM3JEw8Q6/j1kIuPad13ciiDxkCW1L3N0hFvnD91Zrjt/dAE/WgsHv0nheZfAwt y/G4Fpfs/d5Q9/Cj0jWqM5Tge9+OnxbIm9UtRpW0jdDBj0A1fD9V0vP+x+uReL70F++r MIyJEAbiKBId8Sw9iKoA2d12vzrEl2Obm/jcDAs8gd7cNxGk+ktQUdCHpPaL344A7XQJ 796zqhgpDqZboQp2eaRYdpP9FjcPieYgD/UBLpBxY0cs7pxlWVTdLiiiAqbvVKyjOT7K db0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hVsCtquq; 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.17; Wed, 11 Aug 2021 05:06:17 -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=hVsCtquq; 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 S237506AbhHKMGj (ORCPT + 7 others); Wed, 11 Aug 2021 08:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237453AbhHKMGi (ORCPT ); Wed, 11 Aug 2021 08:06:38 -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 97D6FC061798 for ; Wed, 11 Aug 2021 05:06:14 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id t7-20020a17090a5d87b029017807007f23so9121929pji.5 for ; Wed, 11 Aug 2021 05:06:14 -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:mime-version :content-transfer-encoding; bh=FKg83oB/EOubumHMLyW/+CxlonCs6Sr8DZwUqs7o61s=; b=hVsCtquq6U45kkQsI7Vj3hNlKPy4eJSsAmLAbQEn+7pXV2fOQSrxopruKn3Ijor4hJ G3XsS5s9jVLqw0cMSMl5wK6FVWYmItaavWYetcFnlX4D5xn3TCcyZaVSIVPzMQQJ6I5R dx1WDeV5O6HZSPu941m4uq2vC2UQNKfSo7DfOH5e2VWf4Gw+gb0cgXH7QF8UrNJHR05Q ASd86ZctPo0kjcQxyD0AcAr7jotdkEb09HtawOdq2Yg9MgJ7Q7EkgYv6WJZ8hN8c7JGa czQYiGXR9gLjmD+F/9aozWcLXiB4+NT46gLj7Ed2ICK9sOgrgVSsXmWHZmxmz0ZpZed1 iI9A== 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:mime-version :content-transfer-encoding; bh=FKg83oB/EOubumHMLyW/+CxlonCs6Sr8DZwUqs7o61s=; b=NHGxsRVJhFVTdr0rYZLY4GFCwKRmUZcm0KgoTry1UPzBSfjHwkytd4QiKUCGRKyl+P rZC5C5/ZYYM0gk1DiseU1FVPNBkPG94iPz632oSs/BZs0rOMenwaTqZzvYYENeNZZNFU QBbMPlnDRL7ajhu88dEq3qAsufDVsGDvC4+jG7tSlI9zMkKWk/hsVTyPbcdapftjkivl IpOdwONNdYU5FTdEbEmIqqCG1mbmS/6RsaRrgEnoSSNkFelEaN2sr7Ly108qV9QrAB6W /M8BQuKSgdfrnbRW69PJA/G87B48Tzyh+ETkcsiVvjFylczIsNgPX/aa0sdlylH2EVdv v47Q== X-Gm-Message-State: AOAM532ci6NPzG1QNLlUe/6wHRXwhwoqBxvpgS7+8xmQXHSGPWd0IStG PWOVfLsoQEgG5NbMJrUt1Bd2Gg== X-Received: by 2002:a17:90a:404a:: with SMTP id k10mr37162653pjg.145.1628683574049; Wed, 11 Aug 2021 05:06:14 -0700 (PDT) Received: from localhost ([122.172.201.85]) by smtp.gmail.com with ESMTPSA id v20sm2695779pgi.39.2021.08.11.05.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 05:06:13 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Andy Gross , Bjorn Andersson , Cristian Marussi , Fabio Estevam , Kevin Hilman , Matthias Brugger , NXP Linux Team , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Sudeep Holla , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , Lukasz Luba , Quentin Perret , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-omap@vger.kernel.org Subject: [PATCH V2 0/9] cpufreq: Auto-register with energy model Date: Wed, 11 Aug 2021 17:28:38 +0530 Message-Id: X-Mailer: git-send-email 2.31.1.272.g89b43f80a514 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. This is build/boot tested by the bot for a couple of boards. https://gitlab.com/vireshk/pmko/-/pipelines/351525873 Note that I haven't picked any of the Reviewed-by tags from the first version since the idea is very much changed here. V1->V2: - Add a callback instead of flag. - Register before governor is initialized. - Update scmi driver as well. - Don't unregister from the EM core. -- Viresh Viresh Kumar (9): cpufreq: Auto-register with energy model if asked cpufreq: dt: Use auto-registration for energy model cpufreq: imx6q: Use auto-registration for energy model cpufreq: mediatek: Use auto-registration for energy model cpufreq: omap: Use auto-registration for energy model cpufreq: qcom-cpufreq-hw: Use auto-registration for energy model cpufreq: scpi: Use auto-registration for energy model cpufreq: vexpress: Use auto-registration for energy model cpufreq: scmi: Use .register_em() callback drivers/cpufreq/cpufreq-dt.c | 3 +- drivers/cpufreq/cpufreq.c | 12 ++++++ drivers/cpufreq/imx6q-cpufreq.c | 2 +- drivers/cpufreq/mediatek-cpufreq.c | 3 +- drivers/cpufreq/omap-cpufreq.c | 2 +- drivers/cpufreq/qcom-cpufreq-hw.c | 3 +- drivers/cpufreq/scmi-cpufreq.c | 55 +++++++++++++++----------- drivers/cpufreq/scpi-cpufreq.c | 3 +- drivers/cpufreq/vexpress-spc-cpufreq.c | 3 +- include/linux/cpufreq.h | 14 +++++++ 10 files changed, 65 insertions(+), 35 deletions(-) -- 2.31.1.272.g89b43f80a514