From patchwork Fri Aug 31 04:39:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yadav, Jyoti R" X-Patchwork-Id: 10583119 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F8F614BD for ; Fri, 31 Aug 2018 04:39:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E69AF2C25F for ; Fri, 31 Aug 2018 04:39:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D83782C268; Fri, 31 Aug 2018 04:39:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6D0862C25F for ; Fri, 31 Aug 2018 04:39:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FF066E7B6; Fri, 31 Aug 2018 04:39:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id E9D9A6E01C; Fri, 31 Aug 2018 04:39:47 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Aug 2018 21:39:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,309,1531810800"; d="scan'208";a="66529895" Received: from unknown (HELO localhost.localdomain) ([10.109.67.16]) by fmsmga007.fm.intel.com with ESMTP; 30 Aug 2018 21:39:08 -0700 From: Jyoti Yadav To: igt-dev@lists.freedesktop.org Date: Fri, 31 Aug 2018 00:39:05 -0400 Message-Id: <1535690345-408-1-git-send-email-jyoti.r.yadav@intel.com> X-Mailer: git-send-email 1.9.1 Subject: [Intel-gfx] [PATCH] [intel-gfx][igt-dev] [PATCH i-g-t] tests/pm_backlight.c : Brightness test with DPMS and System suspend. X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, rodrigo.vivi@intel.com MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Jyoti BIOS programs few of PWM related registers during initial boot. But during System suspend those registers are cleared. This test aim to check whether display programs those registers properly after system resume. Also checks brightness programming during DPMS ON/OFF cycle to check backlight programming is done properly from display side. v2 : Optimize the code to avoid code redundancy. (Rodrigo) Signed-off-by: Jyoti Yadav Reviewed-by: Rodrigo Vivi --- tests/pm_backlight.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/pm_backlight.c b/tests/pm_backlight.c index a695f90..8b5c79d 100644 --- a/tests/pm_backlight.c +++ b/tests/pm_backlight.c @@ -47,6 +47,7 @@ struct context { #define FADESPEED 100 /* milliseconds between steps */ IGT_TEST_DESCRIPTION("Basic backlight sysfs test"); +static int8_t *pm_data = NULL; static int backlight_read(int *result, const char *fname) { @@ -150,19 +151,38 @@ static void test_fade(struct context *context) nanosleep(&ts, NULL); } } +static void test_fade_with_dpms(struct context *context, igt_output_t *output) +{ + bool has_runtime_pm; + has_runtime_pm = igt_setup_runtime_pm(); + igt_info("Runtime PM support: %d\n", has_runtime_pm); + igt_assert(has_runtime_pm); + kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF); + igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED)); + kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_ON); + igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_ACTIVE)); + test_fade(context); +} +static void test_fade_with_suspend(struct context *context, igt_output_t *output) +{ + kmstest_set_connector_dpms(output->display->drm_fd, output->config.connector, DRM_MODE_DPMS_OFF); + igt_assert(igt_wait_for_pm_status(IGT_RUNTIME_PM_STATUS_SUSPENDED)); + igt_system_suspend_autoresume(SUSPEND_STATE_MEM, SUSPEND_TEST_NONE); + test_fade(context); +} igt_main { struct context context = {0}; int old; igt_display_t display; + igt_output_t *output; struct igt_fb fb; igt_skip_on_simulation(); igt_fixture { enum pipe pipe; - igt_output_t *output; bool found = false; char full_name[32] = {}; char *name; @@ -187,7 +207,6 @@ igt_main for_each_pipe_with_valid_output(&display, pipe, output) { if (strcmp(name + 6, output->name)) continue; - found = true; break; } @@ -205,6 +224,7 @@ igt_main igt_plane_set_fb(primary, &fb); igt_display_commit2(&display, display.is_atomic ? COMMIT_ATOMIC : COMMIT_LEGACY); + pm_data = igt_pm_enable_sata_link_power_management(); } igt_subtest("basic-brightness") @@ -213,6 +233,10 @@ igt_main test_bad_brightness(&context); igt_subtest("fade") test_fade(&context); + igt_subtest("fade_with_dpms") + test_fade_with_dpms(&context, output); + igt_subtest("fade_with_suspend") + test_fade_with_suspend(&context, output); igt_fixture { /* Restore old brightness */ @@ -220,6 +244,8 @@ igt_main igt_display_fini(&display); igt_remove_fb(display.drm_fd, &fb); + igt_pm_restore_sata_link_power_management(pm_data); + free(pm_data); close(display.drm_fd); } }