Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: mediatek: mtk-dvfsrc: Add and propagate DVFSRC bandwidth type

In preparation for adding support for DVFSRC Version 4, add a new
mtk_dvfsrc_bw_type enumeration, and propagate it from specific bw
setting callbacks to __dvfsrc_set_dram_bw_v1(), which will use it
to choose calculation multipliers and dividers in v4 callbacks.

Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

+11 -4
+11 -4
drivers/soc/mediatek/mtk-dvfsrc.c
··· 36 36 #define MTK_SIP_DVFSRC_INIT 0x0 37 37 #define MTK_SIP_DVFSRC_START 0x1 38 38 39 + enum mtk_dvfsrc_bw_type { 40 + DVFSRC_BW_AVG, 41 + DVFSRC_BW_PEAK, 42 + DVFSRC_BW_HRT, 43 + DVFSRC_BW_MAX, 44 + }; 45 + 39 46 struct dvfsrc_bw_constraints { 40 47 u16 max_dram_nom_bw; 41 48 u16 max_dram_peak_bw; ··· 275 268 } 276 269 277 270 static void __dvfsrc_set_dram_bw_v1(struct mtk_dvfsrc *dvfsrc, u32 reg, 278 - u16 max_bw, u16 min_bw, u64 bw) 271 + int type, u16 max_bw, u16 min_bw, u64 bw) 279 272 { 280 273 u32 new_bw = (u32)div_u64(bw, 100 * 1000); 281 274 ··· 292 285 { 293 286 u64 max_bw = dvfsrc->dvd->bw_constraints->max_dram_nom_bw; 294 287 295 - __dvfsrc_set_dram_bw_v1(dvfsrc, DVFSRC_SW_BW, max_bw, 0, bw); 288 + __dvfsrc_set_dram_bw_v1(dvfsrc, DVFSRC_SW_BW, DVFSRC_BW_AVG, max_bw, 0, bw); 296 289 }; 297 290 298 291 static void dvfsrc_set_dram_peak_bw_v1(struct mtk_dvfsrc *dvfsrc, u64 bw) 299 292 { 300 293 u64 max_bw = dvfsrc->dvd->bw_constraints->max_dram_peak_bw; 301 294 302 - __dvfsrc_set_dram_bw_v1(dvfsrc, DVFSRC_SW_PEAK_BW, max_bw, 0, bw); 295 + __dvfsrc_set_dram_bw_v1(dvfsrc, DVFSRC_SW_PEAK_BW, DVFSRC_BW_PEAK, max_bw, 0, bw); 303 296 } 304 297 305 298 static void dvfsrc_set_dram_hrt_bw_v1(struct mtk_dvfsrc *dvfsrc, u64 bw) 306 299 { 307 300 u64 max_bw = dvfsrc->dvd->bw_constraints->max_dram_hrt_bw; 308 301 309 - __dvfsrc_set_dram_bw_v1(dvfsrc, DVFSRC_SW_HRT_BW, max_bw, 0, bw); 302 + __dvfsrc_set_dram_bw_v1(dvfsrc, DVFSRC_SW_HRT_BW, DVFSRC_BW_HRT, max_bw, 0, bw); 310 303 } 311 304 312 305 static void dvfsrc_set_opp_level_v1(struct mtk_dvfsrc *dvfsrc, u32 level)