drivers/accel/ivpu/ivpu_hw_btrs.c
Source file repositories/reference/linux-study-clean/drivers/accel/ivpu/ivpu_hw_btrs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/accel/ivpu/ivpu_hw_btrs.c- Extension
.c- Size
- 28646 bytes
- Lines
- 972
- Domain
- Driver Families
- Bucket
- drivers/accel
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/units.hivpu_drv.hivpu_hw.hivpu_hw_btrs.hivpu_hw_btrs_lnl_reg.hivpu_hw_btrs_mtl_reg.hivpu_hw_reg_io.hivpu_jsm_msg.hivpu_pm.h
Detected Declarations
struct wp_requestfunction Copyrightfunction freq_ratios_init_mtlfunction freq_ratios_init_lnlfunction ivpu_hw_btrs_freq_ratios_initfunction tile_disable_checkfunction read_tile_config_fusefunction info_init_mtlfunction info_init_lnlfunction ivpu_hw_btrs_info_initfunction wp_request_syncfunction wait_for_status_readyfunction wp_request_mtlfunction wp_request_lnlfunction wp_requestfunction wp_request_sendfunction prepare_wp_requestfunction wait_for_pll_lockfunction wait_for_cdyn_deassertfunction ivpu_hw_btrs_wp_drivefunction d0i3_drive_mtlfunction d0i3_drive_lnlfunction d0i3_drivefunction ivpu_hw_btrs_d0i3_enablefunction ivpu_hw_btrs_d0i3_disablefunction ivpu_hw_btrs_wait_for_clock_res_own_ackfunction ivpu_hw_btrs_set_port_arbitration_weights_lnlfunction ip_reset_mtlfunction ip_reset_lnlfunction ivpu_hw_btrs_ip_resetfunction ivpu_hw_btrs_profiling_freq_reg_set_lnlfunction ivpu_hw_btrs_ats_print_lnlfunction ivpu_hw_btrs_clock_relinquish_disable_lnlfunction ivpu_hw_btrs_is_idlefunction ivpu_hw_btrs_wait_for_idlefunction pll_config_get_mtlfunction pll_config_get_lnlfunction pll_ratio_to_mhz_mtlfunction pll_ratio_to_mhz_lnlfunction ivpu_hw_btrs_pll_ratio_to_mhzfunction ivpu_hw_btrs_pll_ratio_to_hzfunction ivpu_hw_btrs_current_freq_getfunction ivpu_hw_btrs_cfg_freq_setfunction dpu_mhz_to_pll_ratio_lnlfunction ivpu_hw_btrs_cfg_max_freq_setfunction ivpu_hw_btrs_cfg_min_freq_setfunction ivpu_hw_btrs_cfg_freq_initfunction ivpu_hw_btrs_irq_handler_mtl
Annotated Snippet
struct wp_request {
u16 min;
u16 max;
u16 target;
u16 cfg;
u16 epp;
u16 cdyn;
};
static void wp_request_mtl(struct ivpu_device *vdev, struct wp_request *wp)
{
u32 val;
val = REGB_RD32(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD0);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD0, MIN_RATIO, wp->min, val);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD0, MAX_RATIO, wp->max, val);
REGB_WR32(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD0, val);
val = REGB_RD32(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD1);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD1, TARGET_RATIO, wp->target, val);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD1, EPP, PLL_EPP_DEFAULT, val);
REGB_WR32(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD1, val);
val = REGB_RD32(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD2);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD2, CONFIG, wp->cfg, val);
REGB_WR32(VPU_HW_BTRS_MTL_WP_REQ_PAYLOAD2, val);
val = REGB_RD32(VPU_HW_BTRS_MTL_WP_REQ_CMD);
val = REG_SET_FLD(VPU_HW_BTRS_MTL_WP_REQ_CMD, SEND, val);
REGB_WR32(VPU_HW_BTRS_MTL_WP_REQ_CMD, val);
}
static void wp_request_lnl(struct ivpu_device *vdev, struct wp_request *wp)
{
u32 val;
val = REGB_RD32(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD0);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD0, MIN_RATIO, wp->min, val);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD0, MAX_RATIO, wp->max, val);
REGB_WR32(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD0, val);
val = REGB_RD32(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD1);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD1, TARGET_RATIO, wp->target, val);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD1, EPP, wp->epp, val);
REGB_WR32(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD1, val);
val = REGB_RD32(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD2);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD2, CONFIG, wp->cfg, val);
val = REG_SET_FLD_NUM(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD2, CDYN, wp->cdyn, val);
REGB_WR32(VPU_HW_BTRS_LNL_WP_REQ_PAYLOAD2, val);
val = REGB_RD32(VPU_HW_BTRS_LNL_WP_REQ_CMD);
val = REG_SET_FLD(VPU_HW_BTRS_LNL_WP_REQ_CMD, SEND, val);
REGB_WR32(VPU_HW_BTRS_LNL_WP_REQ_CMD, val);
}
static void wp_request(struct ivpu_device *vdev, struct wp_request *wp)
{
if (ivpu_hw_btrs_gen(vdev) == IVPU_HW_BTRS_MTL)
wp_request_mtl(vdev, wp);
else
wp_request_lnl(vdev, wp);
}
static int wp_request_send(struct ivpu_device *vdev, struct wp_request *wp)
{
int ret;
ret = wp_request_sync(vdev);
if (ret) {
ivpu_err(vdev, "Failed to sync before workpoint request: %d\n", ret);
return ret;
}
wp_request(vdev, wp);
ret = wp_request_sync(vdev);
if (ret)
ivpu_err(vdev, "Failed to sync after workpoint request: %d\n", ret);
return ret;
}
static void prepare_wp_request(struct ivpu_device *vdev, struct wp_request *wp, bool enable)
{
struct ivpu_hw_info *hw = vdev->hw;
wp->min = hw->pll.min_ratio;
wp->max = hw->pll.max_ratio;
Annotation
- Immediate include surface: `linux/units.h`, `ivpu_drv.h`, `ivpu_hw.h`, `ivpu_hw_btrs.h`, `ivpu_hw_btrs_lnl_reg.h`, `ivpu_hw_btrs_mtl_reg.h`, `ivpu_hw_reg_io.h`, `ivpu_jsm_msg.h`.
- Detected declarations: `struct wp_request`, `function Copyright`, `function freq_ratios_init_mtl`, `function freq_ratios_init_lnl`, `function ivpu_hw_btrs_freq_ratios_init`, `function tile_disable_check`, `function read_tile_config_fuse`, `function info_init_mtl`, `function info_init_lnl`, `function ivpu_hw_btrs_info_init`.
- Atlas domain: Driver Families / drivers/accel.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.