soc: mediatek: mtk-dvfsrc: Add missing calc_dram_bw callback for MT6893
PATCH 1/1 soc: mediatek: mtk-dvfsrc: Add missing calc_dram_bw callback for MT6893
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.
---
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(+)
drivers/soc/mediatek/mtk-dvfsrc.c +1 -0
@@ -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