Skip to content

Commit aa1c2b0

Browse files
committed
accel/ivpu: Fix DCT active percent format
The pcode MAILBOX STATUS register PARAM2 field expects DCT active percent in U1.7 value format. Convert percentage value to this format before writing to the register. Fixes: a19bffb ("accel/ivpu: Implement DCT handling") Reviewed-by: Lizhi Hou <lizhi.hou@amd.com> Signed-off-by: Karol Wachowski <karol.wachowski@linux.intel.com> Link: https://lore.kernel.org/r/20251001104322.1249896-1-karol.wachowski@linux.intel.com
1 parent 30531e9 commit aa1c2b0

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

drivers/accel/ivpu/ivpu_hw_btrs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ int ivpu_hw_btrs_dct_get_request(struct ivpu_device *vdev, bool *enable)
752752
}
753753
}
754754

755-
void ivpu_hw_btrs_dct_set_status(struct ivpu_device *vdev, bool enable, u32 active_percent)
755+
void ivpu_hw_btrs_dct_set_status(struct ivpu_device *vdev, bool enable, u8 active_percent)
756756
{
757757
u32 val = 0;
758758
u32 cmd = enable ? DCT_ENABLE : DCT_DISABLE;

drivers/accel/ivpu/ivpu_hw_btrs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ u32 ivpu_hw_btrs_dpu_freq_get(struct ivpu_device *vdev);
3636
bool ivpu_hw_btrs_irq_handler_mtl(struct ivpu_device *vdev, int irq);
3737
bool ivpu_hw_btrs_irq_handler_lnl(struct ivpu_device *vdev, int irq);
3838
int ivpu_hw_btrs_dct_get_request(struct ivpu_device *vdev, bool *enable);
39-
void ivpu_hw_btrs_dct_set_status(struct ivpu_device *vdev, bool enable, u32 active_percent);
39+
void ivpu_hw_btrs_dct_set_status(struct ivpu_device *vdev, bool enable, u8 active_percent);
4040
u32 ivpu_hw_btrs_telemetry_offset_get(struct ivpu_device *vdev);
4141
u32 ivpu_hw_btrs_telemetry_size_get(struct ivpu_device *vdev);
4242
u32 ivpu_hw_btrs_telemetry_enable_get(struct ivpu_device *vdev);

drivers/accel/ivpu/ivpu_pm.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,11 @@ void ivpu_pm_irq_dct_work_fn(struct work_struct *work)
502502
else
503503
ret = ivpu_pm_dct_disable(vdev);
504504

505-
if (!ret)
506-
ivpu_hw_btrs_dct_set_status(vdev, enable, vdev->pm->dct_active_percent);
505+
if (!ret) {
506+
/* Convert percent to U1.7 format */
507+
u8 val = DIV_ROUND_CLOSEST(vdev->pm->dct_active_percent * 128, 100);
508+
509+
ivpu_hw_btrs_dct_set_status(vdev, enable, val);
510+
}
511+
507512
}

0 commit comments

Comments
 (0)