diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-03 11:18:02 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2014-07-11 23:39:36 +0100 |
commit | b9c705f4da0b3817462c544e04bead926bfaf75d (patch) | |
tree | 61077fd6946e7b200116ed0421d49de1ac08fa55 /overlay | |
parent | 98165d60bec04d258eeb9623550e58a8bc2f3906 (diff) |
overlay: Baytrail needs a custom GPU frequency parser
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'overlay')
-rw-r--r-- | overlay/gpu-freq.c | 74 | ||||
-rw-r--r-- | overlay/gpu-freq.h | 1 |
2 files changed, 48 insertions, 27 deletions
diff --git a/overlay/gpu-freq.c b/overlay/gpu-freq.c index 08b1bff7..a2d8f084 100644 --- a/overlay/gpu-freq.c +++ b/overlay/gpu-freq.c @@ -88,26 +88,39 @@ int gpu_freq_init(struct gpu_freq *gf) buf[len] = '\0'; - s = strstr(buf, "(RPN)"); - if (s == NULL) - goto err; - sscanf(s, "(RPN) frequency: %dMHz", &gf->rpn); - - s = strstr(s, "(RP1)"); - if (s == NULL) - goto err; - sscanf(s, "(RP1) frequency: %dMHz", &gf->rp1); - - s = strstr(s, "(RP0)"); - if (s == NULL) - goto err; - sscanf(s, "(RP0) frequency: %dMHz", &gf->rp0); - - s = strstr(s, "Max"); - if (s == NULL) - goto err; - sscanf(s, "Max overclocked frequency: %dMHz", &gf->max); - gf->min = gf->rpn; + if (strstr(buf, "PUNIT_REG_GPU_FREQ_STS")) { + /* Baytrail is special, ofc. */ + gf->is_byt = 1; + s = strstr(buf, "max"); + if (s == NULL) + goto err; + sscanf(s, "max GPU freq: %d MHz", &gf->max); + sscanf(s, "min GPU freq: %d MHz", &gf->min); + + gf->rp0 = gf->rp1 = gf->max; + gf->rpn = gf->min; + } else { + s = strstr(buf, "(RPN)"); + if (s == NULL) + goto err; + sscanf(s, "(RPN) frequency: %dMHz", &gf->rpn); + + s = strstr(s, "(RP1)"); + if (s == NULL) + goto err; + sscanf(s, "(RP1) frequency: %dMHz", &gf->rp1); + + s = strstr(s, "(RP0)"); + if (s == NULL) + goto err; + sscanf(s, "(RP0) frequency: %dMHz", &gf->rp0); + + s = strstr(s, "Max"); + if (s == NULL) + goto err; + sscanf(s, "Max overclocked frequency: %dMHz", &gf->max); + gf->min = gf->rpn; + } return 0; @@ -140,13 +153,20 @@ int gpu_freq_update(struct gpu_freq *gf) buf[len] = '\0'; - s = strstr(buf, "RPNSWREQ:"); - if (s) - sscanf(s, "RPNSWREQ: %dMHz", &gf->request); - - s = strstr(buf, "CAGF:"); - if (s) - sscanf(s, "CAGF: %dMHz", &gf->current); + if (gf->is_byt) { + s = strstr(buf, "current"); + if (s) + sscanf(s, "current GPU freq: %d MHz", &gf->current); + gf->request = gf->current; + } else { + s = strstr(buf, "RPNSWREQ:"); + if (s) + sscanf(s, "RPNSWREQ: %dMHz", &gf->request); + + s = strstr(buf, "CAGF:"); + if (s) + sscanf(s, "CAGF: %dMHz", &gf->current); + } } else { struct gpu_freq_stat *s = &gf->stat[gf->count++&1]; struct gpu_freq_stat *d = &gf->stat[gf->count&1]; diff --git a/overlay/gpu-freq.h b/overlay/gpu-freq.h index cdd2bb6c..62b21f3b 100644 --- a/overlay/gpu-freq.h +++ b/overlay/gpu-freq.h @@ -34,6 +34,7 @@ struct gpu_freq { } stat[2]; int fd; int count; + int is_byt; int min, max; int rpn, rp1, rp0; int request; |