Commit graph

3 commits

Author SHA1 Message Date
guanyi3
31041f84ea drivers/devfreq: fix qos_get_value returning wrong min/max aggregation
QOS_REQ_MIN should return the highest value among all min requests
(most restrictive lower bound), but plist_first returns the lowest.
QOS_REQ_MAX should return the lowest value among all max requests
(most restrictive upper bound), but plist_last returns the highest.

This caused qos constraints to be ineffective. For example, two
requests (32, 208000) and (104000, 104000) would merge to (32, 208000)
instead of the correct (104000, 104000).

Fix by using plist_last for QOS_REQ_MIN and plist_first for QOS_REQ_MAX.

Signed-off-by: guanyi3 <guanyi3@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi
827b455f68 driver/devfreq: add procfs for devfreq
> ls /proc/devfreq
 /proc/devfreq:
 test_devfreq
> cat /proc/devfreq/test_devfreq
 devfreq:     test_devfreq
 governor:    test_devfreq_governor
 cur_freq:    500
 suspended:   False
 freq_table:  100 300 500 700 900
 qos_list(min, max, backtrace):
 195, 829, 0x4007c26 0x40a0e0e 0x405c706 0x4011186 0x4010dca 0x42777cc 0x4062f7e 0x409da6a

Signed-off-by: guanyi <guanyi@xiaomi.com>
2026-08-08 15:23:54 -03:00
guanyi
e29a7bcb07 driver/devfreq: DVFS framework for devices
This commit introduces a devfreq framework to manage device frequency
scaling. The framework includes the following features:
1.devfreq governor
  - provide governor ops, including init, start, stop, exit
  - default governor, performance & powersave
  - customized governor, device can provide governor when register
2.runtime register and unregister
  - device can runtime register & unregister, search by name
3.suspend and resume
  - suspend and resume frequency scaling
4.notify
  - register & unregister notifier callback, notify frequency changes
5.qos support
  - simplified QoS, manage multiple freq range request
  - including init, add/remove/update request, get value

Signed-off-by: guanyi <guanyi@xiaomi.com>
2026-08-08 15:23:54 -03:00