Skip to content

Instantly share code, notes, and snippets.

@Ansuel
Created November 11, 2021 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ansuel/cfd74b8036482ab94845e0b0d0b1f8f8 to your computer and use it in GitHub Desktop.
Save Ansuel/cfd74b8036482ab94845e0b0d0b1f8f8 to your computer and use it in GitHub Desktop.
From caa88d596a65069bda124f13003d4e9969568ef2 Mon Sep 17 00:00:00 2001
From: Ansuel Smith <ansuelsmth@gmail.com>
Date: Tue, 13 Jul 2021 00:34:24 +0200
Subject: [PATCH] ipq806x: handle custom nss-cc driver
Use opp framework to scale freq, if available
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
nss_hal/ipq806x/nss_hal_pvt.c | 25 ++++++++++++++++---------
1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/nss_hal/ipq806x/nss_hal_pvt.c b/nss_hal/ipq806x/nss_hal_pvt.c
index 56944cd..3908c5c 100644
--- a/nss_hal/ipq806x/nss_hal_pvt.c
+++ b/nss_hal/ipq806x/nss_hal_pvt.c
@@ -252,11 +254,17 @@ void nss_hal_pm_support(uint32_t work_frequency)
*/
void nss_hal_freq_change(nss_work_t *my_work)
{
+ struct device *clk_cc_dev = get_nss_clk_cc_dev();
+
nss_freq_change(&nss_top_main.nss[NSS_CORE_0], my_work->frequency, my_work->stats_enable, 0);
if (nss_top_main.nss[NSS_CORE_1].state == NSS_CORE_STATE_INITIALIZED) {
nss_freq_change(&nss_top_main.nss[NSS_CORE_1], my_work->frequency, my_work->stats_enable, 0);
}
- clk_set_rate(nss_core0_clk, my_work->frequency);
+
+ if (clk_cc_dev)
+ dev_pm_opp_set_rate(clk_cc_dev, my_work->frequency);
+ else
+ clk_set_rate(nss_core0_clk, my_work->frequency);
nss_freq_change(&nss_top_main.nss[NSS_CORE_0], my_work->frequency, my_work->stats_enable, 1);
if (nss_top_main.nss[NSS_CORE_1].state == NSS_CORE_STATE_INITIALIZED) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment