Skip to content

Commit 10a4487

Browse files
author
Christoph Rudorff
committed
drm/msm/a3xx: use speed-bin to setup opp
a3xx_set_supported_hw() set opp-supported-hw from fuse value, defaults to 0x1 in case the value wasn't set. Signed-off-by: Christoph Rudorff <[email protected]>
1 parent a7adae0 commit 10a4487

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

drivers/gpu/drm/msm/adreno/a3xx_gpu.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
#include "a3xx_gpu.h"
10+
#include <linux/nvmem-consumer.h>
1011

1112
#define A3XX_INT0_MASK \
1213
(A3XX_INT0_RBBM_AHB_ERROR | \
@@ -493,6 +494,43 @@ static u32 a3xx_get_rptr(struct msm_gpu *gpu, struct msm_ringbuffer *ring)
493494
return ring->memptrs->rptr;
494495
}
495496

497+
static int a3xx_set_supported_hw(struct device *dev, struct adreno_gpu *adreno_gpu)
498+
{
499+
u32 speedbin, version;
500+
int ret;
501+
502+
ret = nvmem_cell_read_variable_le_u32(dev, "speed_bin_version", &version);
503+
/*
504+
* -ENOENT means that the platform doesn't support speedbin which is
505+
* fine
506+
*/
507+
if (ret == -ENOENT) {
508+
return 0;
509+
} else if (ret) {
510+
dev_err_probe(dev, ret,
511+
"failed to read speed-bin-version. Some OPPs may not be supported by hardware\n");
512+
return ret;
513+
}
514+
515+
ret = nvmem_cell_read_variable_le_u32(dev, "speed_bin", &speedbin);
516+
if (ret) {
517+
dev_err_probe(dev, ret,
518+
"failed to read speed-bin. Some OPPs may not be supported by hardware\n");
519+
return ret;
520+
}
521+
dev_info(dev, "speed-bin version: %u value: %u\n", version, speedbin);
522+
523+
// if (version > 0)
524+
// we must set at least version 0x1 otherwise no opp gets selected
525+
// having opp-supported-hw property
526+
if (speedbin == 0)
527+
speedbin = 0x1;
528+
529+
return devm_pm_opp_set_supported_hw(dev, &speedbin, 1);
530+
531+
return 0;
532+
}
533+
496534
static const struct adreno_gpu_funcs funcs = {
497535
.base = {
498536
.get_param = adreno_get_param,
@@ -554,6 +592,9 @@ struct msm_gpu *a3xx_gpu_init(struct drm_device *dev)
554592

555593
adreno_gpu->registers = a3xx_registers;
556594

595+
/* speed-bin */
596+
a3xx_set_supported_hw(&pdev->dev, adreno_gpu);
597+
557598
ret = adreno_gpu_init(dev, pdev, adreno_gpu, &funcs, 1);
558599
if (ret)
559600
goto fail;

0 commit comments

Comments
 (0)