From a1ff3bf0ac7f4a87c5ccb837a43d16cdb030369b Mon Sep 17 00:00:00 2001 From: Choonghoon Park Date: Fri, 15 Jun 2018 18:24:16 +0900 Subject: [PATCH] hafm: deliver zero pb when frequency is equal to or above threshold This zero value notifies hwboost plugin that the plugin have to use the power budget it stored recently. Change-Id: I8157aa07de4ed6306c68fb7daecd8b9608c31f74 --- drivers/soc/samsung/exynos-hafm.c | 11 ++++++++++- drivers/soc/samsung/exynos-hiu.h | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/soc/samsung/exynos-hafm.c b/drivers/soc/samsung/exynos-hafm.c index 02401b22f3a2..88d9f0f83bcd 100644 --- a/drivers/soc/samsung/exynos-hafm.c +++ b/drivers/soc/samsung/exynos-hafm.c @@ -49,7 +49,15 @@ static unsigned int hiu_get_freq_level(unsigned int freq) static unsigned int hiu_get_power_budget(unsigned int freq) { - return data->sw_pbl; + if (unlikely(!data->pb_delivered)) { + data->pb_delivered = true; + return data->sw_pbl; + } + + if (freq >= data->boost_threshold) + return 0; + else + return data->sw_pbl; } static void hiu_update_reg(int offset, int mask, int shift, unsigned int val) @@ -558,6 +566,7 @@ static int exynos_hiu_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); data->base = ioremap(GCU_BASE, SZ_4K); + data->pb_delivered = false; ret = hiu_dt_parsing(dn); if (ret) { diff --git a/drivers/soc/samsung/exynos-hiu.h b/drivers/soc/samsung/exynos-hiu.h index 89dfab10c8fe..04304b306c7d 100644 --- a/drivers/soc/samsung/exynos-hiu.h +++ b/drivers/soc/samsung/exynos-hiu.h @@ -127,7 +127,7 @@ struct exynos_hiu_data { bool pc_enabled; bool tb_enabled; bool hwidvfs_done; - bool boosting_activated; + bool pb_delivered; int operation_mode; -- 2.20.1