summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorNicolas Frattaroli <nicolas.frattaroli@collabora.com>2025-11-24 12:06:59 +0100
committerAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>2026-01-08 10:27:50 +0100
commit3da293d70005496317d1ff3a49b89c29dd7c21e8 (patch)
tree05566f5b6d8cbd07eae3774c99c02bd4e9f51020 /include/linux
parent39aa8c4e762ea9b00d66cc55957527167ed89435 (diff)
soc: mediatek: mtk-dvfsrc: Rework bandwidth calculations
The code, as it is, plays fast and loose with bandwidth units. It also doesn't specify its constraints in the actual maximum hardware value, but as some roundabout thing that then ends up multiplied into the actual hardware value constraint after some indirections. In part, this is due to the use of individual members for storing each limit, instead of making it possible to index them by type. Rework all of this by adding const array members indexed by the bandwidth type enum to the soc_data struct. This array expresses the actual hardware value limitations, not a factor thereof. Use the clamp function macro to clamp the values between the minimum and maximum constraints after all the calculations, which also means the code doesn't write nonsense to a hardware register when the math is wrong, as it'll constrain after all the calculations. Pass the type as the actual enum type as well, and not as an int. If there's some type checking that can be extracted from the function signature, then we may as well use it. Don't needlessly explicitly cast return values to the return type either; this is both unnecessary and makes it harder to spot type safety issues. Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions