diff options
author | Burt P <pburt0@gmail.com> | 2018-09-28 20:43:41 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2018-10-22 19:45:03 -0700 |
commit | 61ffa17d01ef8668def03e15c33d1bd0dc9be93e (patch) | |
tree | e0f92bde2f13d5ae246f41d54678ed13ac1198cd /hardinfo/gpu_util.c | |
parent | 7c3ba61e9e433bbad816833320c39cf5bb8afcd8 (diff) |
devicetree: get opp-v2 freq range for gpu, if available
* opp-v2 = operating-points-v2, frequency scaling information
from device tree that can be used for cpu, gpu, etc.
* adds helper function to get the opp-v2 range of frequencies
for a node, dtr_get_opp_range() in dt_util.c
* adds a freq range in opp-v2 property for a node in dt
* reports a gpu's max clock frequency if avaiable via opp-v2
Signed-off-by: Burt P <pburt0@gmail.com>
Diffstat (limited to 'hardinfo/gpu_util.c')
-rw-r--r-- | hardinfo/gpu_util.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/hardinfo/gpu_util.c b/hardinfo/gpu_util.c index 4347aad6..dee3c431 100644 --- a/hardinfo/gpu_util.c +++ b/hardinfo/gpu_util.c @@ -97,6 +97,7 @@ void gpud_free(gpud *s) { free(s->drm_dev); free(s->sysfs_drm_path); free(s->dt_compat); + free(s->dt_opp); pcid_free(s->pci_dev); nvgpu_free(s->nv_info); g_free(s); @@ -301,6 +302,10 @@ gpud *dt_soc_gpu() { gpu->dt_status = dtr_get_string(tmp_path, 1); snprintf(tmp_path, 255, "%s/name", dt_gpu_path); gpu->dt_name = dtr_get_string(tmp_path, 1); + gpu->dt_opp = dtr_get_opp_range(dt, dt_gpu_path); + if (gpu->dt_opp) { + gpu->khz_max = gpu->dt_opp->khz_max; + } EMPIFNULL(gpu->dt_name); EMPIFNULL(gpu->dt_status); |