| // 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, |
| }; |