1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (C) 2020-2024 Intel Corporation 4 */ 5 6 #ifndef __IVPU_HW_BTRS_H__ 7 #define __IVPU_HW_BTRS_H__ 8 9 #include "ivpu_drv.h" 10 #include "ivpu_hw_37xx_reg.h" 11 #include "ivpu_hw_40xx_reg.h" 12 #include "ivpu_hw_reg_io.h" 13 14 #define PLL_PROFILING_FREQ_DEFAULT 38400000 15 #define PLL_PROFILING_FREQ_HIGH 400000000 16 #define PLL_RATIO_TO_FREQ(x) ((x) * PLL_REF_CLK_FREQ) 17 18 #define DCT_DEFAULT_ACTIVE_PERCENT 15u 19 #define DCT_PERIOD_US 35300u 20 21 int ivpu_hw_btrs_info_init(struct ivpu_device *vdev); 22 void ivpu_hw_btrs_freq_ratios_init(struct ivpu_device *vdev); 23 int ivpu_hw_btrs_irqs_clear_with_0_mtl(struct ivpu_device *vdev); 24 int ivpu_hw_btrs_wp_drive(struct ivpu_device *vdev, bool enable); 25 int ivpu_hw_btrs_wait_for_clock_res_own_ack(struct ivpu_device *vdev); 26 int ivpu_hw_btrs_d0i3_enable(struct ivpu_device *vdev); 27 int ivpu_hw_btrs_d0i3_disable(struct ivpu_device *vdev); 28 void ivpu_hw_btrs_set_port_arbitration_weights_lnl(struct ivpu_device *vdev); 29 bool ivpu_hw_btrs_is_idle(struct ivpu_device *vdev); 30 int ivpu_hw_btrs_wait_for_idle(struct ivpu_device *vdev); 31 int ivpu_hw_btrs_ip_reset(struct ivpu_device *vdev); 32 void ivpu_hw_btrs_profiling_freq_reg_set_lnl(struct ivpu_device *vdev); 33 void ivpu_hw_btrs_ats_print_lnl(struct ivpu_device *vdev); 34 void ivpu_hw_btrs_clock_relinquish_disable_lnl(struct ivpu_device *vdev); 35 bool ivpu_hw_btrs_irq_handler_mtl(struct ivpu_device *vdev, int irq); 36 bool ivpu_hw_btrs_irq_handler_lnl(struct ivpu_device *vdev, int irq); 37 int ivpu_hw_btrs_dct_get_request(struct ivpu_device *vdev, bool *enable); 38 void ivpu_hw_btrs_dct_set_status(struct ivpu_device *vdev, bool enable, u32 dct_percent); 39 u32 ivpu_hw_btrs_pll_freq_get(struct ivpu_device *vdev); 40 u32 ivpu_hw_btrs_ratio_to_freq(struct ivpu_device *vdev, u32 ratio); 41 u32 ivpu_hw_btrs_telemetry_offset_get(struct ivpu_device *vdev); 42 u32 ivpu_hw_btrs_telemetry_size_get(struct ivpu_device *vdev); 43 u32 ivpu_hw_btrs_telemetry_enable_get(struct ivpu_device *vdev); 44 void ivpu_hw_btrs_global_int_enable(struct ivpu_device *vdev); 45 void ivpu_hw_btrs_global_int_disable(struct ivpu_device *vdev); 46 void ivpu_hw_btrs_irq_enable(struct ivpu_device *vdev); 47 void ivpu_hw_btrs_irq_disable(struct ivpu_device *vdev); 48 void ivpu_hw_btrs_diagnose_failure(struct ivpu_device *vdev); 49 50 #endif /* __IVPU_HW_BTRS_H__ */ 51