From patchwork Tue Oct 21 17:01:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulo Zanoni X-Patchwork-Id: 5126471 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 202B5C11AC for ; Tue, 21 Oct 2014 17:02:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F9D8201ED for ; Tue, 21 Oct 2014 17:02:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 53D1A2015A for ; Tue, 21 Oct 2014 17:02:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6B278981D; Tue, 21 Oct 2014 10:02:01 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-qa0-f51.google.com (mail-qa0-f51.google.com [209.85.216.51]) by gabe.freedesktop.org (Postfix) with ESMTP id D9A648981D for ; Tue, 21 Oct 2014 10:02:00 -0700 (PDT) Received: by mail-qa0-f51.google.com with SMTP id k15so1125513qaq.24 for ; Tue, 21 Oct 2014 10:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=E4Nvy/hshiq9bFTb1JFupH0SV54zubJ4N0Jtg97qQO0=; b=yfqJrWtNJCxaxfNawsMA58kfOUW9v1fhffJeHf+k+enjD05b9dgyz53fVYWMp1VqTO GVqUzpbH8UuQzzEFjrl8SFT0MorvupbSUW3eC7PmHn/AYmMQlITlINiJheA5mtjTf7HI QWmkDvzB9NITmfOgjmGU7v7CrrwhoHNUEus1dGLUyxXAhmsHgha8Teico0Xq6EPb2A67 3erhiwuAIqNBJ4zU4S32ntfFEydgJQ8cet7e+rTtayyuwQ52MXeKngZKgYiTKYWoUAZp Ex0IZdrggusnqYNTOv5YOkdg+yCnFeAjq+zOHopxuBP7Z9p+ZYrk1SaYqrXlI2j2hTRP LEhA== X-Received: by 10.140.88.70 with SMTP id s64mr1098650qgd.65.1413910920307; Tue, 21 Oct 2014 10:02:00 -0700 (PDT) Received: from localhost.localdomain ([187.59.149.157]) by mx.google.com with ESMTPSA id 8sm11163378qab.12.2014.10.21.10.01.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 21 Oct 2014 10:01:59 -0700 (PDT) From: Paulo Zanoni To: intel-gfx@lists.freedesktop.org Date: Tue, 21 Oct 2014 15:01:49 -0200 Message-Id: <1413910909-2080-1-git-send-email-przanoni@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: Daniel Vetter , Paulo Zanoni Subject: [Intel-gfx] [PATCH] lib/igt_aux: move audio RPM code to igt_setup_runtime_pm() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Paulo Zanoni If we don't enable audio runtime PM, the audio driver won't release its reference, the refcount won't ever become zero, so we will never actually runtime suspend. So move this code from pm_rpm.c to igt_aux.c, so kms_flip - and any other IGT test case using RPM - can benefit from it. Previously, if you ran pm_rpm before running the other tests - or if you just didn't have snd_hda_intel loaded - you wouldn't notice this bug. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=78893 Cc: Daniel Vetter Signed-off-by: Paulo Zanoni Reviewed-by: Daniel Vetter --- lib/igt_aux.c | 14 ++++++++++++++ tests/pm_rpm.c | 12 ------------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/igt_aux.c b/lib/igt_aux.c index 01654f0..0e1eeea 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -431,6 +431,20 @@ bool igt_setup_runtime_pm(void) if (pm_status_fd >= 0) return true; + /* The Audio driver can get runtime PM references, so we need to make + * sure its runtime PM is enabled, so it can release the refs and + * actually enable us to runtime suspend. */ + fd = open("/sys/module/snd_hda_intel/parameters/power_save", O_WRONLY); + if (fd >= 0) { + igt_assert(write(fd, "1\n", 2) == 2); + close(fd); + } + fd = open("/sys/bus/pci/devices/0000:00:03.0/power/control", O_WRONLY); + if (fd >= 0) { + igt_assert(write(fd, "auto\n", 5) == 5); + close(fd); + } + /* Our implementation uses autosuspend. Try to set it to 0ms so the test * suite goes faster and we have a higher probability of triggering race * conditions. */ diff --git a/tests/pm_rpm.c b/tests/pm_rpm.c index 4ee3ca7..25c9900 100644 --- a/tests/pm_rpm.c +++ b/tests/pm_rpm.c @@ -697,18 +697,6 @@ static void setup_non_graphics_runtime_pm(void) close(fd); } free(file_name); - - /* Audio runtime PM policies. */ - fd = open("/sys/module/snd_hda_intel/parameters/power_save", O_WRONLY); - if (fd >= 0) { - igt_assert(write(fd, "1\n", 2) == 2); - close(fd); - } - fd = open("/sys/bus/pci/devices/0000:00:03.0/power/control", O_WRONLY); - if (fd >= 0) { - igt_assert(write(fd, "auto\n", 5) == 5); - close(fd); - } } static void setup_environment(void)