xref: /linux/drivers/accel/ivpu/ivpu_hw_btrs.h (revision 8a27ad81f7d3a4bc30e00e334a369b69c5f8da90)
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 int ivpu_hw_btrs_info_init(struct ivpu_device *vdev);
19 void ivpu_hw_btrs_freq_ratios_init(struct ivpu_device *vdev);
20 int ivpu_hw_btrs_irqs_clear_with_0_mtl(struct ivpu_device *vdev);
21 int ivpu_hw_btrs_wp_drive(struct ivpu_device *vdev, bool enable);
22 int ivpu_hw_btrs_wait_for_clock_res_own_ack(struct ivpu_device *vdev);
23 int ivpu_hw_btrs_d0i3_enable(struct ivpu_device *vdev);
24 int ivpu_hw_btrs_d0i3_disable(struct ivpu_device *vdev);
25 void ivpu_hw_btrs_set_port_arbitration_weights_lnl(struct ivpu_device *vdev);
26 bool ivpu_hw_btrs_is_idle(struct ivpu_device *vdev);
27 int ivpu_hw_btrs_wait_for_idle(struct ivpu_device *vdev);
28 int ivpu_hw_btrs_ip_reset(struct ivpu_device *vdev);
29 void ivpu_hw_btrs_profiling_freq_reg_set_lnl(struct ivpu_device *vdev);
30 void ivpu_hw_btrs_ats_print_lnl(struct ivpu_device *vdev);
31 void ivpu_hw_btrs_clock_relinquish_disable_lnl(struct ivpu_device *vdev);
32 bool ivpu_hw_btrs_irq_handler_mtl(struct ivpu_device *vdev, int irq);
33 bool ivpu_hw_btrs_irq_handler_lnl(struct ivpu_device *vdev, int irq);
34 void ivpu_hw_btrs_dct_drive(struct ivpu_device *vdev, u32 dct_val);
35 u32 ivpu_hw_btrs_pll_freq_get(struct ivpu_device *vdev);
36 u32 ivpu_hw_btrs_ratio_to_freq(struct ivpu_device *vdev, u32 ratio);
37 u32 ivpu_hw_btrs_telemetry_offset_get(struct ivpu_device *vdev);
38 u32 ivpu_hw_btrs_telemetry_size_get(struct ivpu_device *vdev);
39 u32 ivpu_hw_btrs_telemetry_enable_get(struct ivpu_device *vdev);
40 void ivpu_hw_btrs_global_int_enable(struct ivpu_device *vdev);
41 void ivpu_hw_btrs_global_int_disable(struct ivpu_device *vdev);
42 void ivpu_hw_btrs_irq_enable(struct ivpu_device *vdev);
43 void ivpu_hw_btrs_irq_disable(struct ivpu_device *vdev);
44 void ivpu_hw_btrs_diagnose_failure(struct ivpu_device *vdev);
45 
46 #endif /* __IVPU_HW_BTRS_H__ */
47