video: driver: add scale clocks and buses functions
Add clocks and buses scaling functionality. Change-Id: Ifa61043a938bc5c1990f6baf1777a3f2270fc77d Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
This commit is contained in:
36
driver/vidc/src/msm_vidc_power.c
Normal file
36
driver/vidc/src/msm_vidc_power.c
Normal file
@@ -0,0 +1,36 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include "msm_vidc_power.h"
|
||||
#include "msm_vidc_debug.h"
|
||||
#include "msm_vidc_internal.h"
|
||||
#include "msm_vidc_inst.h"
|
||||
#include "msm_vidc_core.h"
|
||||
#include "venus_hfi.h"
|
||||
|
||||
int msm_vidc_scale_power(struct msm_vidc_inst *inst)
|
||||
{
|
||||
int rc = 0;
|
||||
u64 freq;
|
||||
struct msm_vidc_core* core;
|
||||
|
||||
if (!inst || !inst->core) {
|
||||
d_vpr_e("%s: invalid params %pK\n", __func__, inst);
|
||||
return -EINVAL;
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
freq = call_session_op(core, calc_freq, inst);
|
||||
rc = venus_hfi_scale_clocks(inst, freq);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
freq = call_session_op(core, calc_bw, inst);
|
||||
rc = venus_hfi_scale_buses(inst, freq);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
return 0;
|
||||
}
|
@@ -2970,3 +2970,45 @@ int venus_hfi_release_buffer(struct msm_vidc_inst *inst,
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int venus_hfi_scale_clocks(struct msm_vidc_inst* inst, u64 freq)
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_vidc_core* core;
|
||||
|
||||
if (!inst || inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
mutex_lock(&core->lock);
|
||||
if (__resume(core)) {
|
||||
s_vpr_e(inst->sid, "Resume from power collapse failed\n");
|
||||
rc = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
rc = __set_clocks(core, freq);
|
||||
exit:
|
||||
mutex_unlock(&core->lock);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int venus_hfi_scale_buses(struct msm_vidc_inst *inst, u64 freq)
|
||||
{
|
||||
int rc = 0;
|
||||
struct msm_vidc_core* core;
|
||||
|
||||
if (!inst || inst->core) {
|
||||
d_vpr_e("%s: invalid params\n", __func__);
|
||||
return -EINVAL;
|
||||
}
|
||||
core = inst->core;
|
||||
|
||||
mutex_lock(&core->lock);
|
||||
rc = __vote_buses(core, freq, freq);
|
||||
mutex_unlock(&core->lock);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
Verwijs in nieuw issue
Block a user