From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5EDDFCD8C9D for ; Thu, 11 Jun 2026 03:52:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DA3FB10E214; Thu, 11 Jun 2026 03:52:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TTy3H68Y"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2D80C10E214 for ; Thu, 11 Jun 2026 03:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1781149929; x=1812685929; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=KO8lg1Q7ibm5BUABt1e2ThXvbFFfWz4yxIg/pRvh8dw=; b=TTy3H68Yg/ysNjgTiRJwUl9IIA45l79QRpNISr9pLQWgAVVUusr0uzHD o87+8XZcy8QSGjxj8mSuc2XoOi+/9s9oGLMQ3hbpPNSREW98qAtg6JVZM XC5c8W2qS6S/dVmbWIXu28HgxEtK1MIfh4icSGzUKdn9Ou9LtgZr5XrwS hcAk5LaYya1RA6TU5O+wrY3U2NVs0vPF040Vigm8wJqIDTtF47enMY+a0 jlj8+Dj/6hS7fvFJHAQ2Z2K5gOtKq9/sTwwW2N7XsIxZs6p0bt/RFx90h pq8Ut9VmZPR6CwY94bHXTmZDxbNQT5Kyx66YdL9jJJ50l4V2jVMOlP6A+ A==; X-CSE-ConnectionGUID: wM1U5TV6S+ym5mv8fHAZfA== X-CSE-MsgGUID: xsi7sjl1TfueoskUS7PlLg== X-IronPort-AV: E=McAfee;i="6800,10657,11813"; a="69499792" X-IronPort-AV: E=Sophos;i="6.24,198,1774335600"; d="scan'208";a="69499792" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2026 20:52:09 -0700 X-CSE-ConnectionGUID: pxvoaMBxS1K3X06hI29KKA== X-CSE-MsgGUID: xhbNJw1VTci9LMfzdPkpug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,198,1774335600"; d="scan'208";a="246230620" Received: from jeevan-x299-aorus-gaming-3-pro.iind.intel.com ([10.227.90.91]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jun 2026 20:52:07 -0700 From: Jeevan B To: igt-dev@lists.freedesktop.org Cc: kunal1.joshi@intel.com, Jeevan B Subject: [PATCH i-g-t] tests/chamelium/kms_chamelium_audio: Add suspend/resume audio tests Date: Thu, 11 Jun 2026 09:22:00 +0530 Message-ID: <20260611035200.2296907-1-jeevan.b@intel.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" Add test to validate audio works before and after suspend/resume on HDMI/DP connector. v2: Perform a single suspend/resume for all audio combinations. Re-enable chamelium after suspend and separate pre-suspend and post-resume validation paths for clearer failure diagnostics. v3: Drop commit and use igt_assert_f with explicit messages to distinguish failure in audio tests. v4: Removed inner igt_assert, changed from tracking execution to aggregating test results with success &=, so function now returns actual pass/fail. Signed-off-by: Jeevan B --- tests/chamelium/kms_chamelium_audio.c | 147 ++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/tests/chamelium/kms_chamelium_audio.c b/tests/chamelium/kms_chamelium_audio.c index df8d27c0c..bd121fa8d 100644 --- a/tests/chamelium/kms_chamelium_audio.c +++ b/tests/chamelium/kms_chamelium_audio.c @@ -52,6 +52,12 @@ * SUBTEST: hdmi-audio-edid * Description: Plug a connector with an EDID suitable for audio, check ALSA's * EDID-Like Data reports the correct audio parameters + * + * SUBTEST: dp-audio-after-suspend + * Description: Verify audio works before and after system suspend/resume + * + * SUBTEST: hdmi-audio-after-suspend + * Description: Verify audio works before and after system suspend/resume */ /* Playback parameters control the audio signal we synthesize and send */ @@ -695,6 +701,63 @@ static bool check_audio_configuration(struct alsa *alsa, return true; } +static bool run_audio_test_once(chamelium_data_t *data, + struct alsa *alsa, + struct chamelium_port *port, + snd_pcm_format_t format, + int channels, + int sampling_rate) +{ + struct audio_state state; + bool success; + + audio_state_init(&state, data, alsa, port, format, channels, + sampling_rate); + success = test_audio_frequencies(&state); + success &= test_audio_flatline(&state); + audio_state_fini(&state); + + return success; +} + +static bool run_audio_tests(chamelium_data_t *data, + struct alsa *alsa, + struct chamelium_port *port, + const char *audio_device) +{ + bool success = true; + int ret, i, j; + int channels, sampling_rate; + snd_pcm_format_t format; + + for (i = 0; i < test_sampling_rates_count; i++) { + for (j = 0; j < test_formats_count; j++) { + ret = alsa_open_output(alsa, audio_device); + igt_assert_f(ret >= 0, + "Failed to open ALSA output\n"); + + format = test_formats[j]; + channels = PLAYBACK_CHANNELS; + sampling_rate = test_sampling_rates[i]; + + if (!check_audio_configuration(alsa, format, + channels, + sampling_rate)) { + alsa_close_output(alsa); + continue; + } + + success &= run_audio_test_once(data, alsa, port, + format, channels, + sampling_rate); + + alsa_close_output(alsa); + } + } + + return success; +} + static const char test_display_audio_desc[] = "Playback various audio signals with various audio formats/rates, " "capture them and check they are correct"; @@ -789,6 +852,80 @@ static void test_display_audio(chamelium_data_t *data, free(alsa); } +static const char test_display_audio_suspend_resume_desc[] = + "Verify audio works before and after system suspend/resume"; +static void test_display_audio_suspend_resume( + chamelium_data_t *data, + struct chamelium_port *port, + const char *audio_device, + enum igt_custom_edid_type edid) +{ + struct alsa *alsa; + igt_output_t *output; + igt_plane_t *primary; + struct igt_fb fb; + drmModeModeInfo *mode; + drmModeConnector *connector; + int fb_id; + + igt_require(alsa_has_exclusive_access()); + + igt_require(chamelium_has_audio_support(data->chamelium, + port)); + + alsa = alsa_init(); + igt_assert(alsa); + + igt_modeset_disable_all_outputs(&data->display); + + chamelium_reset_state(&data->display, data->chamelium, + port, data->ports, + data->port_count); + + output = chamelium_prepare_output(data, port, edid); + + connector = chamelium_port_get_connector(data->chamelium, + port, false); + + primary = igt_output_get_plane_type(output, + DRM_PLANE_TYPE_PRIMARY); + igt_assert(primary); + + igt_assert(connector->count_modes > 0); + + mode = &connector->modes[0]; + + fb_id = igt_create_color_pattern_fb(data->drm_fd, + mode->hdisplay, + mode->vdisplay, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_MOD_LINEAR, + 0, 0, 0, &fb); + + igt_assert(fb_id > 0); + + chamelium_enable_output(data, port, output, + mode, &fb); + + igt_assert_f(run_audio_tests(data, alsa, port, audio_device), + "Audio test failed before suspend\n"); + + igt_system_suspend_autoresume(SUSPEND_STATE_MEM, + SUSPEND_TEST_NONE); + + chamelium_enable_output(data, port, output, + mode, &fb); + + igt_assert_f(run_audio_tests(data, alsa, port, audio_device), + "Audio test failed after suspend\n"); + + igt_remove_fb(data->drm_fd, &fb); + + drmModeFreeConnector(connector); + + free(alsa); +} + static const char test_display_audio_edid_desc[] = "Plug a connector with an EDID suitable for audio, check ALSA's " "EDID-Like Data reports the correct audio parameters"; @@ -866,6 +1003,11 @@ int igt_main() connector_subtest("dp-audio-edid", DisplayPort, &data, test_display_audio_edid, IGT_CUSTOM_EDID_DP_AUDIO); + igt_describe(test_display_audio_suspend_resume_desc); + connector_subtest("dp-audio-after-suspend", DisplayPort, &data, + test_display_audio_suspend_resume, + "HDMI", IGT_CUSTOM_EDID_DP_AUDIO); + igt_describe("HDMI tests"); igt_describe(test_display_audio_desc); @@ -876,6 +1018,11 @@ int igt_main() connector_subtest("hdmi-audio-edid", HDMIA, &data, test_display_audio_edid, IGT_CUSTOM_EDID_HDMI_AUDIO); + igt_describe(test_display_audio_suspend_resume_desc); + connector_subtest("hdmi-audio-after-suspend", HDMIA, &data, + test_display_audio_suspend_resume, + "HDMI", IGT_CUSTOM_EDID_HDMI_AUDIO); + igt_fixture() { igt_display_fini(&data.display); drm_close_driver(data.drm_fd); -- 2.43.0