Skip to content

Commit dde67fd

Browse files
kdrag0nExactExampl
authored andcommitted
clk: qcom: clk-cpu-osm: Reduce CPU frequency update rate limit to 500 us
Rate-limiting frequency updates to once every 10 ms has a substantial impact on performance due to how slowly the frequency tends to ramp with such a long delay. Reduce the delay to 500 us which is closer to the actual frequency switch delay in hardware. Signed-off-by: Danny Lin <danny@kdrag0n.dev>
1 parent d588903 commit dde67fd

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

drivers/clk/qcom/clk-cpu-osm.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343

4444
#define OSM_INIT_RATE 300000000UL
4545
#define XO_RATE 19200000UL
46-
#define RATE_LIMIT_US 10000
46+
#define MIN_RATE_LIMIT_US 500
47+
#define MAX_RATE_LIMIT_US 1000
4748
#define OSM_TABLE_SIZE 40
4849
#define SINGLE_CORE 1
4950
#define MAX_CLUSTER_CNT 3
@@ -676,9 +677,9 @@ osm_set_index(struct clk_osm *c, unsigned int index)
676677

677678
/* The old rate needs time to settle before it can be changed again */
678679
delta_us = ktime_us_delta(ktime_get_boottime(), parent->last_update);
679-
if (delta_us < RATE_LIMIT_US)
680-
usleep_range(RATE_LIMIT_US - delta_us,
681-
(RATE_LIMIT_US + 1000) - delta_us);
680+
if (delta_us < MIN_RATE_LIMIT_US)
681+
usleep_range(MIN_RATE_LIMIT_US - delta_us,
682+
MAX_RATE_LIMIT_US - delta_us);
682683
parent->last_update = ktime_get_boottime();
683684

684685
clk_set_rate(c->hw.clk, clk_round_rate(c->hw.clk, rate));
@@ -792,7 +793,7 @@ static int osm_cpufreq_cpu_init(struct cpufreq_policy *policy)
792793
goto err;
793794
}
794795

795-
policy->cpuinfo.transition_latency = RATE_LIMIT_US;
796+
policy->cpuinfo.transition_latency = MIN_RATE_LIMIT_US;
796797
policy->driver_data = c;
797798
return 0;
798799

0 commit comments

Comments
 (0)