From: "GIBEOM LEE (이기범)" <rtx4060@gmail.com>
To: Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org,
Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Subject: [PATCH] soc: mediatek: mtk-dvfsrc: Add missing calc_dram_bw callback for MT6893
Date: Wed, 18 Nov 2026 01:57:17 +0900 [thread overview]
Message-ID: <20261117165717.1348-1-rtx4060@gmail.com> (raw)
Commit ddb5862a43b1 ("soc: mediatek: mtk-dvfsrc: Add a new callback for
calc_dram_bw") made __dvfsrc_set_dram_bw_v1() call the calc_dram_bw
callback of the SoC data without checking it, and set that callback for
MT8183 and MT8195. The MT6893 data use the same bandwidth setters, but
were left without the callback.
Any bandwidth request for MT6893 (MTK_DVFSRC_CMD_BW, MTK_DVFSRC_CMD_PEAK_BW
or MTK_DVFSRC_CMD_HRT_BW) therefore calls a NULL function pointer.
Nothing in the tree sends such a request for MT6893 today: they come from
the EMI interconnect driver, which has no data for this SoC, and there is
no MT6893 device tree yet.
Set the callback to dvfsrc_calc_dram_bw_v1(), as for MT8195, which has
the same registers and bandwidth limits.
Claude, an AI coding assistant, found this while reading the driver to
add another SoC.
Fixes: ddb5862a43b1 ("soc: mediatek: mtk-dvfsrc: Add a new callback for calc_dram_bw")
Signed-off-by: GIBEOM LEE (이기범) <rtx4060@gmail.com>
---
The MediaTek for-next branch and linux-next (next-20261116) have the
same lines.
Testing: this has not run on hardware, as I have no MT6893 board. It
builds with W=1 at the base commit below. mtk-dvfsrc.c also ran
unchanged in user space, with the registers as a plain array and with
ASan and UBSan: mtk_dvfsrc_send_request() was called with each of the
three bandwidth commands for every SoC in the match table. Before the
patch the three MT6893 calls jump to address 0 from
dvfsrc_set_dram_bw_v1() and its two siblings; after it they write the
same values as on MT8195 (20 for 2 Gbit/s) to 0x26c, 0x278 and 0x290.
The other SoCs give the same results before and after.
That model only shows the call path; it says nothing about the hardware.
How this was made: Claude (claude-fable-5-2, an AI coding assistant)
found this during a longer session of porting mainline Linux to a Lenovo
TB375FC tablet (MT6897), while reading this driver. It wrote the patch
and this message, and it ran the checks above. I reviewed the result
before signing off.
drivers/soc/mediatek/mtk-dvfsrc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/soc/mediatek/mtk-dvfsrc.c b/drivers/soc/mediatek/mtk-dvfsrc.c
index c691a895c92c..8ae924bb81c3 100644
--- a/drivers/soc/mediatek/mtk-dvfsrc.c
+++ b/drivers/soc/mediatek/mtk-dvfsrc.c
@@ -736,6 +736,7 @@ static const struct dvfsrc_opp_desc dvfsrc_opp_mt6893_desc[] = {
static const struct dvfsrc_soc_data mt6893_data = {
.opps_desc = dvfsrc_opp_mt6893_desc,
.regs = dvfsrc_mt8195_regs,
+ .calc_dram_bw = dvfsrc_calc_dram_bw_v1,
.get_target_level = dvfsrc_get_target_level_v2,
.get_current_level = dvfsrc_get_current_level_v2,
.get_vcore_level = dvfsrc_get_vcore_level_v2,
base-commit: 666539eecdf4db623f5e3c3e55cf9f2dfad24aa4
reply other threads:[~2026-11-17 17:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261117165717.1348-1-rtx4060@gmail.com \
--to=rtx4060@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=nicolas.frattaroli@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox