1 // SPDX-License-Identifier: GPL-2.0-only 2 /* 3 * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved. 4 */ 5 6 #include "iris_instance.h" 7 #include "iris_vpu_common.h" 8 9 static u64 iris_vpu2_calc_freq(struct iris_inst *inst, size_t data_size) 10 { 11 struct platform_inst_caps *caps = inst->core->iris_platform_data->inst_caps; 12 struct v4l2_format *inp_f = inst->fmt_src; 13 u32 mbs_per_second, mbpf, height, width; 14 unsigned long vpp_freq, vsp_freq; 15 u32 fps = DEFAULT_FPS; 16 17 width = max(inp_f->fmt.pix_mp.width, inst->crop.width); 18 height = max(inp_f->fmt.pix_mp.height, inst->crop.height); 19 20 mbpf = NUM_MBS_PER_FRAME(height, width); 21 mbs_per_second = mbpf * fps; 22 23 vpp_freq = mbs_per_second * caps->mb_cycles_vpp; 24 25 /* 21 / 20 is overhead factor */ 26 vpp_freq += vpp_freq / 20; 27 vsp_freq = mbs_per_second * caps->mb_cycles_vsp; 28 29 /* 10 / 7 is overhead factor */ 30 vsp_freq += ((fps * data_size * 8) * 10) / 7; 31 32 return max(vpp_freq, vsp_freq); 33 } 34 35 const struct vpu_ops iris_vpu2_ops = { 36 .power_off_hw = iris_vpu_power_off_hw, 37 .power_off_controller = iris_vpu_power_off_controller, 38 .calc_freq = iris_vpu2_calc_freq, 39 }; 40