drm/amd/display: Add KUnit test for ISM functions
authorAlex Hung <alex.hung@amd.com>
Thu, 23 Apr 2026 20:12:36 +0000 (14:12 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 May 2026 15:54:37 +0000 (11:54 -0400)
commit5838a89515c87c072057c12cf022f958ece1c720
tree2641a8f0405a01fc2a47a28e4a101290b2756e05
parent15b2363e90f7a0b5b904ab2f011593fef3f73e16
drm/amd/display: Add KUnit test for ISM functions

Add KUnit tests for three static functions in amdgpu_dm_ism.c:
dm_ism_next_state, dm_ism_get_sso_delay, and
dm_ism_get_idle_allow_delay.

The 32 test cases cover the full FSM transition table,
SSO delay calculation with various timings, and
hysteresis-based idle allow delay including circular
buffer wraparound and old history cutoff logic.

Conditionally remove static linkage and export the three
functions under CONFIG_DRM_AMD_DC_KUNIT_TEST so the test
module can call them.

Assisted-by: Copilot:Claude-Opus-4.6
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Ivan Lipski <ivan.lipski@amd.com>
Tested-by: Dan Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_ism.h
drivers/gpu/drm/amd/display/amdgpu_dm/tests/Makefile
drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_ism_test.c [new file with mode: 0644]