Skip to content

Commit 0478b4f

Browse files
Jordan Crouserobclark
authored andcommitted
drm/msm/a5xx: Always set an OPP supported hardware value
If the opp table specifies opp-supported-hw as a property but the driver has not set a supported hardware value the OPP subsystem will reject all the table entries. Set a "default" value that will match the default table entries but not conflict with any possible real bin values. Also fix a small memory leak and free the buffer allocated by nvmem_cell_read(). Signed-off-by: Jordan Crouse <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Signed-off-by: Rob Clark <[email protected]>
1 parent e6790f7 commit 0478b4f

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

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

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,18 +1446,31 @@ static const struct adreno_gpu_funcs funcs = {
14461446
static void check_speed_bin(struct device *dev)
14471447
{
14481448
struct nvmem_cell *cell;
1449-
u32 bin, val;
1449+
u32 val;
1450+
1451+
/*
1452+
* If the OPP table specifies a opp-supported-hw property then we have
1453+
* to set something with dev_pm_opp_set_supported_hw() or the table
1454+
* doesn't get populated so pick an arbitrary value that should
1455+
* ensure the default frequencies are selected but not conflict with any
1456+
* actual bins
1457+
*/
1458+
val = 0x80;
14501459

14511460
cell = nvmem_cell_get(dev, "speed_bin");
14521461

1453-
/* If a nvmem cell isn't defined, nothing to do */
1454-
if (IS_ERR(cell))
1455-
return;
1462+
if (!IS_ERR(cell)) {
1463+
void *buf = nvmem_cell_read(cell, NULL);
1464+
1465+
if (!IS_ERR(buf)) {
1466+
u8 bin = *((u8 *) buf);
14561467

1457-
bin = *((u32 *) nvmem_cell_read(cell, NULL));
1458-
nvmem_cell_put(cell);
1468+
val = (1 << bin);
1469+
kfree(buf);
1470+
}
14591471

1460-
val = (1 << bin);
1472+
nvmem_cell_put(cell);
1473+
}
14611474

14621475
dev_pm_opp_set_supported_hw(dev, &val, 1);
14631476
}

0 commit comments

Comments
 (0)