[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c1c96a65-b322-44ad-39ad-5f9f27fdc4a4@linaro.org>
Date: Thu, 18 Mar 2021 11:14:22 +0200
From: Georgi Djakov <georgi.djakov@...aro.org>
To: Henry Chen <henryc.chen@...iatek.com>,
Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Stephen Boyd <swboyd@...omium.org>,
Ryan Case <ryandcase@...omium.org>
Cc: Mark Rutland <mark.rutland@....com>,
Nicolas Boichat <drinkcat@...gle.com>,
Fan Chen <fan.chen@...iatek.com>,
James Liao <jamesjj.liao@...iatek.com>,
Arvin Wang <arvin.wang@...iatek.com>,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
linux-pm@...r.kernel.org
Subject: Re: [PATCH V9 03/12] soc: mediatek: add driver for dvfsrc support
Hi Henry,
On 3/2/21 05:47, Henry Chen wrote:
> Add dvfsrc driver for MT6873/MT8183/MT8192
>
> Signed-off-by: Henry Chen <henryc.chen@...iatek.com>
> ---
> drivers/soc/mediatek/Kconfig | 11 +
> drivers/soc/mediatek/Makefile | 1 +
> drivers/soc/mediatek/mtk-dvfsrc.c | 421 ++++++++++++++++++++++++++++++++
> include/linux/soc/mediatek/mtk_dvfsrc.h | 35 +++
> 4 files changed, 468 insertions(+)
> create mode 100644 drivers/soc/mediatek/mtk-dvfsrc.c
> create mode 100644 include/linux/soc/mediatek/mtk_dvfsrc.h
>
> diff --git a/drivers/soc/mediatek/Kconfig b/drivers/soc/mediatek/Kconfig
> index fdd8bc0..2dcf023 100644
> --- a/drivers/soc/mediatek/Kconfig
> +++ b/drivers/soc/mediatek/Kconfig
> @@ -26,6 +26,17 @@ config MTK_DEVAPC
> The violation information is logged for further analysis or
> countermeasures.
>
> +config MTK_DVFSRC
> + tristate "MediaTek DVFSRC Support"
> + depends on ARCH_MEDIATEK
I'm wondering whether adding COMPILE_TEST would make sense here, but it's
also fine as is.
> + help
> + Say yes here to add support for the MediaTek DVFSRC (dynamic voltage
> + and frequency scaling resource collector) found
> + on different MediaTek SoCs. The DVFSRC is a proprietary
> + hardware which is used to collect all the requests from
> + system and turn into the decision of minimum Vcore voltage
> + and minimum DRAM frequency to fulfill those requests.
> +
> config MTK_INFRACFG
> bool "MediaTek INFRACFG Support"
> select REGMAP
> diff --git a/drivers/soc/mediatek/Makefile b/drivers/soc/mediatek/Makefile
> index b6908db..4ead103 100644
> --- a/drivers/soc/mediatek/Makefile
> +++ b/drivers/soc/mediatek/Makefile
[..]
> +void mtk_dvfsrc_send_request(const struct device *dev, u32 cmd, u64 data)
> +{
> + int ret, state;
> + struct mtk_dvfsrc *dvfsrc = dev_get_drvdata(dev);
> +
> + dev_dbg(dvfsrc->dev, "cmd: %d, data: %llu\n", cmd, data);
> +
> + switch (cmd) {
> + case MTK_DVFSRC_CMD_BW_REQUEST:
> + dvfsrc->dvd->set_dram_bw(dvfsrc, data);
> + return;
> + case MTK_DVFSRC_CMD_PEAK_BW_REQUEST:
> + if (dvfsrc->dvd->set_dram_peak_bw)
> + dvfsrc->dvd->set_dram_peak_bw(dvfsrc, data);
> + return;
> + case MTK_DVFSRC_CMD_OPP_REQUEST:
> + if (dvfsrc->dvd->set_opp_level)
> + dvfsrc->dvd->set_opp_level(dvfsrc, data);
> + break;
> + case MTK_DVFSRC_CMD_VCORE_REQUEST:
> + dvfsrc->dvd->set_vcore_level(dvfsrc, data);
> + break;
> + case MTK_DVFSRC_CMD_HRTBW_REQUEST:
> + if (dvfsrc->dvd->set_dram_hrtbw)
> + dvfsrc->dvd->set_dram_hrtbw(dvfsrc, data);
> + else
> + return;
> + break;
> + case MTK_DVFSRC_CMD_VSCP_REQUEST:
> + dvfsrc->dvd->set_vscp_level(dvfsrc, data);
> + break;
> + default:
> + dev_err(dvfsrc->dev, "unknown command: %d\n", cmd);
> + return;
> + }
> +
> + /* DVFSRC need to wait at least 2T(~196ns) to handle request
> + * after recieving command
Nit: s/recieving/receiving/
Thanks,
Georgi
Powered by blists - more mailing lists