mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-03 01:28:04 +00:00

In order to support the SM8650 iris33 hardware, we need to provide a specific constoller power off sequences via the vpu_ops callbacks. Add the callback, and use the current helper for currently supported platforms. Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Dikshita Agarwal <quic_dikshita@quicinc.com> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # x1e Dell Reviewed-by: Vikash Garodia <quic_vgarodia@quicinc.com> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Bryan O'Donoghue <bod@kernel.org> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
*/
|
|
|
|
#include "iris_instance.h"
|
|
#include "iris_vpu_common.h"
|
|
|
|
static u64 iris_vpu2_calc_freq(struct iris_inst *inst, size_t data_size)
|
|
{
|
|
struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps;
|
|
struct v4l2_format *inp_f = inst->fmt_src;
|
|
u32 mbs_per_second, mbpf, height, width;
|
|
unsigned long vpp_freq, vsp_freq;
|
|
u32 fps = DEFAULT_FPS;
|
|
|
|
width = max(inp_f->fmt.pix_mp.width, inst->crop.width);
|
|
height = max(inp_f->fmt.pix_mp.height, inst->crop.height);
|
|
|
|
mbpf = NUM_MBS_PER_FRAME(height, width);
|
|
mbs_per_second = mbpf * fps;
|
|
|
|
vpp_freq = mbs_per_second * caps->mb_cycles_vpp;
|
|
|
|
/* 21 / 20 is overhead factor */
|
|
vpp_freq += vpp_freq / 20;
|
|
vsp_freq = mbs_per_second * caps->mb_cycles_vsp;
|
|
|
|
/* 10 / 7 is overhead factor */
|
|
vsp_freq += ((fps * data_size * 8) * 10) / 7;
|
|
|
|
return max(vpp_freq, vsp_freq);
|
|
}
|
|
|
|
const struct vpu_ops iris_vpu2_ops = {
|
|
.power_off_hw = iris_vpu_power_off_hw,
|
|
.power_off_controller = iris_vpu_power_off_controller,
|
|
.calc_freq = iris_vpu2_calc_freq,
|
|
};
|