From mboxrd@z Thu Jan 1 00:00:00 1970 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_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,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 8A023C432BE for ; Wed, 11 Aug 2021 12:06:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6CA636101E for ; Wed, 11 Aug 2021 12:06:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237508AbhHKMGj (ORCPT ); Wed, 11 Aug 2021 08:06:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237499AbhHKMGi (ORCPT ); Wed, 11 Aug 2021 08:06:38 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F699C0613D3 for ; Wed, 11 Aug 2021 05:06:14 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id a8so2970707pjk.4 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=Ilwh1mQTkjHecRCNE/32uQMteK/1QcDMPVgG3vQ7qZbFe/VBxrcAlIeywIgoibOU9n 3UQov8m50qPkW/qe16V+owH20CKF5gD7Hp+DIu0HqLs6ym36lFwZhuIaKZTgDjxFmQ54 /S7aScTe+9jut43y2oAisS1upbcqbZar9ygh3TBYxG2X9yP5JqFh0Cl7QHtmqfI4OoIQ ej9XBr9/hEucvgXX3Yow9pQbVSbHcsMxFRBUgKAoaV4pq6miHFReez6QY1fOFZKhc4qD y88YSoBCkPji/OD9s7oRrxSAcvhDpAyE1MsTu1JYV0YcegXXE37lNKDuZNwQ5e9TdVhb E6VQ== X-Gm-Message-State: AOAM530C014+YP4sdyzGC7r2XSS8jD4LspIRvo06cbcFxBXWMEYXGBc9 tfwMb1LLCdhDB4F4z89aSrhh0w== X-Google-Smtp-Source: ABdhPJztfFMMqUn9AEZt5iJ8AdfS9ivDU1oMjYwxS6YRWF0FK+JSOzQ526ggirfhbR8GWllwV35JIQ== 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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 From mboxrd@z Thu Jan 1 00:00:00 1970 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,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 6378BC4338F for ; Wed, 11 Aug 2021 12:06:47 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1CDF560F56 for ; Wed, 11 Aug 2021 12:06:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 1CDF560F56 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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: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:In-Reply-To:References: List-Owner; bh=odhYGCfkPpoCfk7qfSOeeRaxyVJscm/H3S1wtvBchkc=; b=k152YYSGwkU+RU hHRQ8VFuKEsfZCoBJJuBKDyF+YtKO8K9NtYrwokDHZjwlyKlgsi/sROjxeLy95+aw6NAOIMEk7Il8 eLVhYDFZVHvfq9BK+UhmqT6w9qHG2BmEz5oFgYV7bFixrAYCetMSbl6Mud++WhY1XAzE311XKo+IK eG4rjoAR+kB6yTAHAczFY1VtgJO2XnfdoEGXutIlyeGIuZAB0lXVcNPe6mEucsqz/d0SFvbuV8Hv6 CkLOidqcVDd1oxnxvi2T0eRhqYyucXWLDgDwZ5aLs51tWSFtNLMVuRXgEv7qxqFAo59nDu0i7ICDi blUGyAFaIkuVfW0ISHTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDn0B-006taL-8Z; Wed, 11 Aug 2021 12:06:31 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDmzv-006tWn-8s for linux-mediatek@lists.infradead.org; Wed, 11 Aug 2021 12:06:19 +0000 Received: by mail-pl1-x62c.google.com with SMTP id e19so2387013pla.10 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=SCjAcHgSH56f+aJuYN/pYDBD+mejCh7wi58hdSyzvJ4kCguYgJzrWfSBoj6QQoxpTr AiTszKtMbEA85Knu9KpnMEcxdr7Vuc9ekzI4sP+uYiGUnXWFfA+W8VmQu0nATB93lXQs 27rKLcNffrMEZruvpjoG+IPtBCG01Yc81TmVqp9MWxusYj9iiv6DGtNBjZWMZX4LPRx5 Pp3NRGGUpl4oMeuKuqi39FsI2jjHVj0T9P2kWq7Xo/2UQe4202LtADvGJTNZP112hHIZ fy6Uei7ip2TfGDzqEQzIox9xC6te2NEuQXequEhuO2W4BUOWoKhcE0XgEiHzp0DlctxH rw3A== X-Gm-Message-State: AOAM530yW0WXzN2mdrKLdhFynCgNnIWUbQx2s4GJ1seKGJ9+H0VUrlyJ zg5GVdzUyBrSMtEoqJTD3vf/CA== X-Google-Smtp-Source: ABdhPJztfFMMqUn9AEZt5iJ8AdfS9ivDU1oMjYwxS6YRWF0FK+JSOzQ526ggirfhbR8GWllwV35JIQ== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210811_050615_361381_E2D6982D X-CRM114-Status: GOOD ( 10.82 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.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 _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 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=-17.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,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 016EFC4338F for ; Wed, 11 Aug 2021 12:09:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8D8B760F56 for ; Wed, 11 Aug 2021 12:09:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8D8B760F56 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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: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:In-Reply-To:References: List-Owner; bh=eVSMyRZ9SdR46kut+2UV7UJJ6DJB2/gfSLeDNS6ngR8=; b=0EZCC1oqFSg3aH RiFaT+Y68EwRqJ/4mfKTlyD/RkzISsBfhmc6vZEcbJarW+kAAJcJgDgOwfEoZg29WT/chq98HIcRC KM4ePYYBPhTl9bXwQU4mN39O7f34RUXorO0hHzFcAMxGn4pRLzcxxKcMXHQnHj7MwL6YWWfwBfDVJ Sxqu7+T5NVC1JLHZ0zJXdTfuLt9zIwKCgpEe26LQm5m3w9pAcu2PDmBCsYT1Jx+YiNOKxCgyPddgU NEKMugnYW/uSAL7ED8Zi8LyVXuiv/hHBu4X+JEYxZ72KzofrYsehcwSWXIR0nejgyFXtvyjfwsFum UO8LzwgcYlYiyvfn6VSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDn01-006tYH-GE; Wed, 11 Aug 2021 12:06:21 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDmzv-006tWo-9C for linux-arm-kernel@lists.infradead.org; Wed, 11 Aug 2021 12:06:19 +0000 Received: by mail-pj1-x1030.google.com with SMTP id bo18so3066623pjb.0 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=fS+4YfXeA7dnAHU7nJqOSp6h+jJNw16DNTGqLhS5Ur4+odCjFgnjkTOAfE/9Rpc093 Ng/Hl9VwMXkUODJcidm3Tv8aLZJvfqWqSm9NX5gkPsj8cGkH+TIqAR2CilTMILByaHeZ 1buOEVx594zaR5899Rxhl716qr53n/NS4RIwI15DVFOPj0himVqbrz+kgXhfRDFZPR7E rffaF2bfLoD/tnj+QU3yf8M/LY7TMCHp8yWlgion8Kgk1up6gs8pQbM3MYsYfV7lskm/ mIm5Y6q/1DdqM3obSkIR/kH0hNmSYmRGsM/q36BxcEoUv6COYaAnQwXwlXcZic7Q8zgd y5Dw== X-Gm-Message-State: AOAM531r1hQTWwhSofMZ/PrEJI2AdgWfmnqbtrj1r11pdR0WN9fmYyCu jW57/UKW144rtFmd7/BAi0fO5A== X-Google-Smtp-Source: ABdhPJztfFMMqUn9AEZt5iJ8AdfS9ivDU1oMjYwxS6YRWF0FK+JSOzQ526ggirfhbR8GWllwV35JIQ== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210811_050615_363247_7F28E170 X-CRM114-Status: GOOD ( 12.23 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel