Commit 0478b4fc authored by Jordan Crouse's avatar Jordan Crouse Committed by Rob Clark

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: default avatarJordan Crouse <jcrouse@codeaurora.org>
Reviewed-by: default avatarEric Anholt <eric@anholt.net>
Signed-off-by: default avatarRob Clark <robdclark@chromium.org>
parent e6790f72
...@@ -1446,18 +1446,31 @@ static const struct adreno_gpu_funcs funcs = { ...@@ -1446,18 +1446,31 @@ static const struct adreno_gpu_funcs funcs = {
static void check_speed_bin(struct device *dev) static void check_speed_bin(struct device *dev)
{ {
struct nvmem_cell *cell; struct nvmem_cell *cell;
u32 bin, val; u32 val;
/*
* If the OPP table specifies a opp-supported-hw property then we have
* to set something with dev_pm_opp_set_supported_hw() or the table
* doesn't get populated so pick an arbitrary value that should
* ensure the default frequencies are selected but not conflict with any
* actual bins
*/
val = 0x80;
cell = nvmem_cell_get(dev, "speed_bin"); cell = nvmem_cell_get(dev, "speed_bin");
/* If a nvmem cell isn't defined, nothing to do */ if (!IS_ERR(cell)) {
if (IS_ERR(cell)) void *buf = nvmem_cell_read(cell, NULL);
return;
bin = *((u32 *) nvmem_cell_read(cell, NULL)); if (!IS_ERR(buf)) {
nvmem_cell_put(cell); u8 bin = *((u8 *) buf);
val = (1 << bin); val = (1 << bin);
kfree(buf);
}
nvmem_cell_put(cell);
}
dev_pm_opp_set_supported_hw(dev, &val, 1); dev_pm_opp_set_supported_hw(dev, &val, 1);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment