linux/drivers/devfreq
Nicolas Frattaroli 03f90e4f05 PM / devfreq: rockchip-dfi: double count on RK3588
[ Upstream commit f89c7fb83a ]

On RK3588 with LPDDR4X memory, the cycle count as returned by

  perf stat -a -e rockchip_ddr/cycles/ sleep 1

consistently reads half as much as what the actual DDR frequency is at.
For a LPDDR4X module running at 2112MHz, I get more like 1056059916
cycles per second, which is almost bang-on half what it should be. No,
I'm not mixing up megatransfers and megahertz.

Consulting the downstream driver, this appears to be because the RK3588
hardware specifically (and RK3528 as well, for future reference) needs a
multiplier of 2 to get to the correct frequency with everything but
LPDDR5.

The RK3588's actual memory bandwidth measurements in MB/s are correct
however, as confirmed with stress-ng --stream. This makes me think the
access counters are not affected in the same way. This tracks with the
vendor kernel not multiplying the access counts either.

Solve this by adding a new member to the dfi struct, which each SoC can
set to whatever they want, but defaults to 1 if left unset by the SoC
init functions. The event_get_count op can then use this multiplier if
the cycle count is requested.

The cycle multiplier is not used in rockchip_dfi_get_event because the
vendor driver doesn't use it there either, and we don't do other actual
bandwidth unit conversion stuff in there anyway.

Fixes: 481d97ba61 ("PM / devfreq: rockchip-dfi: add support for RK3588")
Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Link: https://lore.kernel.org/lkml/20250530-rk3588-dfi-improvements-v1-1-6e077c243a95@collabora.com/
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2025-10-15 12:03:27 +02:00
..
event PM / devfreq: rockchip-dfi: double count on RK3588 2025-10-15 12:03:27 +02:00
devfreq-event.c PM / devfreq: event: Call of_node_put() only once in devfreq_event_get_edev_by_phandle() 2024-12-08 21:58:55 +09:00
devfreq.c PM / devfreq: Allow devfreq driver to add custom sysfs ABIs 2025-07-14 20:22:59 +09:00
exynos-bus.c PM / devfreq: exynos: remove unused function parameter 2025-01-11 21:03:07 +09:00
governor.h PM / devfreq: passive: Keep cpufreq_policy for possible cpus 2022-05-17 18:24:39 +09:00
governor_passive.c PM / devfreq: passive: revert an editing accident in SPDX-License line 2022-06-30 05:11:17 +09:00
governor_performance.c PM/devfreq: governor: add missing MODULE_DESCRIPTION() macros 2024-09-05 00:33:00 +09:00
governor_powersave.c PM/devfreq: governor: add missing MODULE_DESCRIPTION() macros 2024-09-05 00:33:00 +09:00
governor_simpleondemand.c PM/devfreq: governor: add missing MODULE_DESCRIPTION() macros 2024-09-05 00:33:00 +09:00
governor_userspace.c PM / devfreq: governor: Replace sscanf() with kstrtoul() in set_freq_store() 2025-07-14 20:04:16 +09:00
hisi_uncore_freq.c PM / devfreq: Add HiSilicon uncore frequency scaling driver 2025-07-14 20:23:57 +09:00
imx-bus.c PM / devfreq: imx-bus: Use of_property_present() 2024-09-05 01:23:56 +09:00
imx8m-ddrc.c PM / devfreq: Explicitly include correct DT includes 2023-07-24 05:19:26 +09:00
Kconfig PM / devfreq: Add HiSilicon uncore frequency scaling driver 2025-07-14 20:23:57 +09:00
Makefile PM / devfreq: Add HiSilicon uncore frequency scaling driver 2025-07-14 20:23:57 +09:00
mtk-cci-devfreq.c PM / devfreq: mtk-cci: Fix potential error pointer dereference in probe() 2025-10-15 12:03:25 +02:00
rk3399_dmc.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
sun8i-a33-mbus.c PM / devfreq: sun8i-a33-mbus: Simplify by using more devm functions 2025-07-14 20:04:17 +09:00
tegra30-devfreq.c PM / devfreq: Explicitly include correct DT includes 2023-07-24 05:19:26 +09:00