accel/ivpu: Correct DCT interrupt handling
[ Upstream commit e53e004e346062e15df9511bd4b5a19e34701384 ]
Fix improper use of dct_active_percent field in DCT interrupt handler
causing DCT to never get enabled. Set dct_active_percent internally before
IPC to ensure correct driver value even if IPC fails.
Set default DCT value to 30 accordingly to HW architecture specification.
Fixes: a19bffb10c ("accel/ivpu: Implement DCT handling")
Signed-off-by: Karol Wachowski <karol.wachowski@intel.com>
Signed-off-by: Maciej Falkowski <maciej.falkowski@linux.intel.com>
Reviewed-by: Jeff Hugo <jeff.hugo@oss.qualcomm.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Link: https://lore.kernel.org/r/20250416102616.384577-1-maciej.falkowski@linux.intel.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
174161d6f0
commit
92d812df3b
@@ -14,7 +14,7 @@
|
|||||||
#define PLL_PROFILING_FREQ_DEFAULT 38400000
|
#define PLL_PROFILING_FREQ_DEFAULT 38400000
|
||||||
#define PLL_PROFILING_FREQ_HIGH 400000000
|
#define PLL_PROFILING_FREQ_HIGH 400000000
|
||||||
|
|
||||||
#define DCT_DEFAULT_ACTIVE_PERCENT 15u
|
#define DCT_DEFAULT_ACTIVE_PERCENT 30u
|
||||||
#define DCT_PERIOD_US 35300u
|
#define DCT_PERIOD_US 35300u
|
||||||
|
|
||||||
int ivpu_hw_btrs_info_init(struct ivpu_device *vdev);
|
int ivpu_hw_btrs_info_init(struct ivpu_device *vdev);
|
||||||
|
|||||||
@@ -421,16 +421,17 @@ int ivpu_pm_dct_enable(struct ivpu_device *vdev, u8 active_percent)
|
|||||||
active_us = (DCT_PERIOD_US * active_percent) / 100;
|
active_us = (DCT_PERIOD_US * active_percent) / 100;
|
||||||
inactive_us = DCT_PERIOD_US - active_us;
|
inactive_us = DCT_PERIOD_US - active_us;
|
||||||
|
|
||||||
|
vdev->pm->dct_active_percent = active_percent;
|
||||||
|
|
||||||
|
ivpu_dbg(vdev, PM, "DCT requested %u%% (D0: %uus, D0i2: %uus)\n",
|
||||||
|
active_percent, active_us, inactive_us);
|
||||||
|
|
||||||
ret = ivpu_jsm_dct_enable(vdev, active_us, inactive_us);
|
ret = ivpu_jsm_dct_enable(vdev, active_us, inactive_us);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ivpu_err_ratelimited(vdev, "Filed to enable DCT: %d\n", ret);
|
ivpu_err_ratelimited(vdev, "Filed to enable DCT: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
vdev->pm->dct_active_percent = active_percent;
|
|
||||||
|
|
||||||
ivpu_dbg(vdev, PM, "DCT set to %u%% (D0: %uus, D0i2: %uus)\n",
|
|
||||||
active_percent, active_us, inactive_us);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -438,15 +439,16 @@ int ivpu_pm_dct_disable(struct ivpu_device *vdev)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
vdev->pm->dct_active_percent = 0;
|
||||||
|
|
||||||
|
ivpu_dbg(vdev, PM, "DCT requested to be disabled\n");
|
||||||
|
|
||||||
ret = ivpu_jsm_dct_disable(vdev);
|
ret = ivpu_jsm_dct_disable(vdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
ivpu_err_ratelimited(vdev, "Filed to disable DCT: %d\n", ret);
|
ivpu_err_ratelimited(vdev, "Filed to disable DCT: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
vdev->pm->dct_active_percent = 0;
|
|
||||||
|
|
||||||
ivpu_dbg(vdev, PM, "DCT disabled\n");
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +460,7 @@ void ivpu_pm_dct_irq_thread_handler(struct ivpu_device *vdev)
|
|||||||
if (ivpu_hw_btrs_dct_get_request(vdev, &enable))
|
if (ivpu_hw_btrs_dct_get_request(vdev, &enable))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (vdev->pm->dct_active_percent)
|
if (enable)
|
||||||
ret = ivpu_pm_dct_enable(vdev, DCT_DEFAULT_ACTIVE_PERCENT);
|
ret = ivpu_pm_dct_enable(vdev, DCT_DEFAULT_ACTIVE_PERCENT);
|
||||||
else
|
else
|
||||||
ret = ivpu_pm_dct_disable(vdev);
|
ret = ivpu_pm_dct_disable(vdev);
|
||||||
|
|||||||
Reference in New Issue
Block a user