Skip to content

Commit afb100a

Browse files
Renjiang HanHans Verkuil
authored andcommitted
media: venus: pm_helpers: add fallback for the opp-table
Since the device trees for both HFI_VERSION_1XX and HFI_VERSION_3XX do not include an opp-table and have not configured opp-pmdomain, they still need to use the frequencies defined in the driver's freq_tbl. Both core_power_v1 and core_power_v4 functions require core_clks_enable function during POWER_ON. Therefore, in the core_clks_enable function, if calling dev_pm_opp_find_freq_ceil to obtain the frequency fails, it needs to fall back to the freq_tbl to retrieve the frequency. Fixes: b179234 ("media: venus: pm_helpers: use opp-table for the frequency") Cc: [email protected] Reviewed-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Bryan O'Donoghue <[email protected]> Reviewed-by: Vikash Garodia <[email protected]> Closes: https://lore.kernel.org/linux-media/CA+G9fYu5=3n84VY+vTbCAcfFKOq7Us5vgBZgpypY4MveM=eVwg@mail.gmail.com Signed-off-by: Renjiang Han <[email protected]> Signed-off-by: Bryan O'Donoghue <[email protected]> Signed-off-by: Hans Verkuil <[email protected]>
1 parent 94662f5 commit afb100a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/media/platform/qcom/venus/pm_helpers.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ static int core_clks_get(struct venus_core *core)
4040

4141
static int core_clks_enable(struct venus_core *core)
4242
{
43+
const struct freq_tbl *freq_tbl = core->res->freq_tbl;
44+
unsigned int freq_tbl_size = core->res->freq_tbl_size;
4345
const struct venus_resources *res = core->res;
4446
struct device *dev = core->dev;
4547
unsigned long freq = 0;
@@ -48,8 +50,13 @@ static int core_clks_enable(struct venus_core *core)
4850
int ret;
4951

5052
opp = dev_pm_opp_find_freq_ceil(dev, &freq);
51-
if (!IS_ERR(opp))
53+
if (IS_ERR(opp)) {
54+
if (!freq_tbl)
55+
return -ENODEV;
56+
freq = freq_tbl[freq_tbl_size - 1].freq;
57+
} else {
5258
dev_pm_opp_put(opp);
59+
}
5360

5461
for (i = 0; i < res->clks_num; i++) {
5562
if (IS_V6(core) || (IS_V4(core) && is_lite(core))) {

0 commit comments

Comments
 (0)