Skip to content

Commit d5979fb

Browse files
kdrag0nExactExampl
authored andcommitted
clk: qcom: clk-cpu-osm: Advertise transition latency to cpufreq
The cpufreq subsystem can be made aware of the frequency transition latency for governors to make better default value choices, such as rate limits and sampling rates. This also exposes the transition latency to userspace through the cpuinfo_transition_latency sysfs node. Signed-off-by: Danny Lin <danny@kdrag0n.dev>
1 parent 3b6dd46 commit d5979fb

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

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

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

4444
#define OSM_INIT_RATE 300000000UL
4545
#define XO_RATE 19200000UL
46+
#define RATE_LIMIT_US 10000
4647
#define OSM_TABLE_SIZE 40
4748
#define SINGLE_CORE 1
4849
#define MAX_CLUSTER_CNT 3
@@ -675,8 +676,9 @@ osm_set_index(struct clk_osm *c, unsigned int index)
675676

676677
/* The old rate needs time to settle before it can be changed again */
677678
delta_us = ktime_us_delta(ktime_get_boottime(), parent->last_update);
678-
if (delta_us < 10000)
679-
usleep_range(10000 - delta_us, 11000 - delta_us);
679+
if (delta_us < RATE_LIMIT_US)
680+
usleep_range(RATE_LIMIT_US - delta_us,
681+
(RATE_LIMIT_US + 1000) - delta_us);
680682
parent->last_update = ktime_get_boottime();
681683

682684
clk_set_rate(c->hw.clk, clk_round_rate(c->hw.clk, rate));
@@ -790,6 +792,7 @@ static int osm_cpufreq_cpu_init(struct cpufreq_policy *policy)
790792
goto err;
791793
}
792794

795+
policy->cpuinfo.transition_latency = RATE_LIMIT_US;
793796
policy->driver_data = c;
794797
return 0;
795798

0 commit comments

Comments
 (0)