Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2609806rdb; Mon, 25 Dec 2023 21:12:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZqyjyChUxx1e/K4yCUjsb7K2TxvEZFziFCfkFUtni2Ax1gA7OBP/TlmGcSG2nIcHldbRD X-Received: by 2002:a05:6358:41a1:b0:170:c921:bf85 with SMTP id w33-20020a05635841a100b00170c921bf85mr9092774rwc.27.1703567563664; Mon, 25 Dec 2023 21:12:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703567563; cv=none; d=google.com; s=arc-20160816; b=Rhg18fNWFw+cie7400LB59rqBDw9X0NSx337TxyNQ9WAIQtHFHC4QwLCp0KEPxLmd1 +0eGhqTG694EYPn62Ksm4mhntokj7woOfx4ZZTrAQfAJ1jdYqYr2GYU6fAX59ZJ0U93+ uPOvR1SEJ18XwGKcFTSjUkcdoLhVtrGio4oz/qfwhByrGAvwPVbzh+V4QEuqRltvmh8Z 3yyj6SbnvijBia1rWWXtKkREA8DnJXeRMjwdGQ4IjVHqh0obF4Zon94C8F/iLyjd62cb GN6X/d6DIHPDpen0F+s+UqRqDNkZ4Ca8INo5/CqAbt+w9tvzzmfdKjnt6IOi39x6Fm0R OQ8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=0iNKdIpJSITWaZLzy5O8z2rRPM6jmHasdKMlm7CuZQ4=; fh=n9jKJTxdTcPnA7egm0mBwlVL7m1aGIuCdVLKcLJ5mXY=; b=FdSq8K0bRvQlm+pJrj5QnR5pI4JzH8JyV0uEPv7bS0Q608CWtBRmJpXE9I9XFjL98j lotG1i5ie8CBLzZmj0O/IRZVCs12sGuDLlQvJvndIuulAUNfXYkx9tuX3+iJuaO1l6sp fRVRnUilbjCPKwLGIhVhaF7LImtCB1Wp7mSdhGfHJLYnC0OD1m/ek/ZUAe/VldYpEb+v UukKfCbL4i29OzO9vN/qq90KiMeI8Op5cLDYP0pPkzOvAvuGvaiyGAOLHdOPiG9S8CeG XfNkbqJQU/sCmNBtlqmPNENyOXJ7NwLNBb8VKejuH6oHBJquxbgTMTPU/L+ok3kiMvPN FdwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x5IPCPV/"; spf=pass (google.com: domain of linux-kernel+bounces-11348-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id kk9-20020a17090b4a0900b0028bd8180740si9143295pjb.112.2023.12.25.21.12.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 21:12:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11348-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x5IPCPV/"; spf=pass (google.com: domain of linux-kernel+bounces-11348-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11348-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A52F282C9F for ; Tue, 26 Dec 2023 05:12:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3A7D64AF95; Tue, 26 Dec 2023 05:12:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="x5IPCPV/" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E96D44AF94 for ; Tue, 26 Dec 2023 05:12:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6dbd6a9b8d0so1478042a34.0 for ; Mon, 25 Dec 2023 21:12:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703567552; x=1704172352; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0iNKdIpJSITWaZLzy5O8z2rRPM6jmHasdKMlm7CuZQ4=; b=x5IPCPV/OkExca36+bDZzhqS6xPzDkB4Fl+wJOGPj009Jnc1FuiqArYkA6VpU6orXY E4FTiU8Ip9PKMWFLGlgFBUr2ISvScv0sqwyhddkIWSwjfrr0GCWEfz//mgzy1B4F3ki5 w6xlHmvzsov7omWm3KpQiIp3Xa8WqXuiRTTs7+Xqnjajz26u81PbiDz64RgoGsY30sYm 8dbsGL7VUuEypWQni6PhZ1m8WkxoPSDhSHqBN4i/vmqBkwM8AD+Ubj0qLkqT9HK0vqvB y4FS24ytxrD3RnROyV1IjqIj2WNL1r05Kjk204zfTer8YPg13sxYUFUHn4LOMQLW8wMX 7PnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703567552; x=1704172352; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0iNKdIpJSITWaZLzy5O8z2rRPM6jmHasdKMlm7CuZQ4=; b=Je874We3Ve/plPaXeI65j89Cc0hkGqxaIoTL2ueWv/8mky1oJBzv0AJ65MternsAfI GCsHiFAddsQSijeG4/EqciJAg9upSNL/TcLccUNP1Jj1mEdRMqixfZoZnuObt3xR2qEV pxuu+wNnOo1ZKWlZLfBiPU66edkx10OOIbNDHGCee1PH5iV55dDZpCuOET8QQsxmRa14 IcARkugQdh4khDr+QLX5wkqKugKPcGvvZV7HY7EwF0HBnZktFLNFJdWBdB5c7rlgCeWE VaT92aDbGxomUGjJ6Z6+jk0PTo1BLMdgcZAqBmqPt0AW8aYrDCZqv/KMsNv5+SeknLFh Y6BQ== X-Gm-Message-State: AOJu0Yxx4yW/MGVe6MB3K5YbVisD3OqatbJY/c/2emeb9A1RfuhalzoO kGeatlErHJID/oHw6g3fE/zLVfUBKlR+Ag== X-Received: by 2002:a05:6830:1610:b0:6da:32b3:529f with SMTP id g16-20020a056830161000b006da32b3529fmr4096002otr.49.1703567552036; Mon, 25 Dec 2023 21:12:32 -0800 (PST) Received: from localhost ([122.172.86.168]) by smtp.gmail.com with ESMTPSA id y12-20020aa7854c000000b006d9af59eecesm3810268pfn.20.2023.12.25.21.12.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 21:12:31 -0800 (PST) Date: Tue, 26 Dec 2023 10:42:28 +0530 From: Viresh Kumar To: Lukasz Luba Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dietmar.eggemann@arm.com, linux-arm-kernel@lists.infradead.org, sboyd@kernel.org, nm@ti.com, linux-samsung-soc@vger.kernel.org, daniel.lezcano@linaro.org, rafael@kernel.org, krzysztof.kozlowski@linaro.org, alim.akhtar@samsung.com, m.szyprowski@samsung.com, xuewen.yan94@gmail.com, mhiramat@kernel.org, qyousef@layalina.io, wvw@google.com Subject: Re: [PATCH 1/2] OPP: Add API to update EM after adjustment of voltage for OPPs Message-ID: <20231226051228.oe7rpgf34nwgr5ah@vireshk-i7> References: <20231220110339.1065505-1-lukasz.luba@arm.com> <20231220110339.1065505-2-lukasz.luba@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231220110339.1065505-2-lukasz.luba@arm.com> On 20-12-23, 11:03, Lukasz Luba wrote: > There are device drivers which can modify voltage values for OPPs. It > could be due to the chip binning and those drivers have specific chip > knowledge about this. This adjustment can happen after Energy Model is > registered, thus EM can have stale data about power. > > Introduce new API function which can be used by device driver which > adjusted the voltage for OPPs. The implementation takes care about > calculating needed internal details in the new EM table ('cost' field). > It plugs in the new EM table to the framework so other subsystems would > use the correct data. > > Signed-off-by: Lukasz Luba > --- > drivers/opp/of.c | 69 ++++++++++++++++++++++++++++++++++++++++++ > include/linux/pm_opp.h | 6 ++++ > 2 files changed, 75 insertions(+) > > diff --git a/drivers/opp/of.c b/drivers/opp/of.c > index 81fa27599d58..992434c0b711 100644 > --- a/drivers/opp/of.c > +++ b/drivers/opp/of.c > @@ -1596,3 +1596,72 @@ int dev_pm_opp_of_register_em(struct device *dev, struct cpumask *cpus) > return ret; > } > EXPORT_SYMBOL_GPL(dev_pm_opp_of_register_em); > + > +/** > + * dev_pm_opp_of_update_em() - Update Energy Model with new power values > + * @dev : Device for which an Energy Model has to be registered > + * > + * This uses the "dynamic-power-coefficient" devicetree property to calculate > + * power values for EM. It uses the new adjusted voltage values known for OPPs > + * which have changed after boot. > + */ > +int dev_pm_opp_of_update_em(struct device *dev) I don't see anything OPP or OF related in this function, I don't think it needs to be part of the OPP core. You just want to reuse _get_power() I guess, which can be exported then. This should really be part of the EM core instead. -- viresh