summaryrefslogtreecommitdiff
path: root/lib/igt_psr.c
diff options
context:
space:
mode:
authorJosé Roberto de Souza <jose.souza@intel.com>2019-01-11 16:04:09 -0800
committerJosé Roberto de Souza <jose.souza@intel.com>2019-01-22 14:08:56 -0800
commit3f828a7a8cf22b5440372234b7814c4bd1b9315e (patch)
treef04ae34afc66c45dedab7ed28b3a7c44523d1499 /lib/igt_psr.c
parent21a5e27af21bdf71108f84598a30129030779784 (diff)
lib/psr: Make psr_wait_entry and psr_wait_update aware of the PSR version tested
This way we can test both PSR version separated. v4: Dropping psr_state_check() to psr_active_check() Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Diffstat (limited to 'lib/igt_psr.c')
-rw-r--r--lib/igt_psr.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/igt_psr.c b/lib/igt_psr.c
index 5edec6a2..5bc7e006 100644
--- a/lib/igt_psr.c
+++ b/lib/igt_psr.c
@@ -25,26 +25,33 @@
#include "igt_sysfs.h"
#include <errno.h>
-static bool psr_active(int debugfs_fd, bool check_active)
+static bool psr_active_check(int debugfs_fd, enum psr_mode mode)
{
- bool active;
char buf[PSR_STATUS_MAX_LEN];
+ const char *state = mode == PSR_MODE_1 ? "SRDENT" : "DEEP_SLEEP";
igt_debugfs_simple_read(debugfs_fd, "i915_edp_psr_status", buf,
sizeof(buf));
- active = strstr(buf, "SRDENT") || strstr(buf, "DEEP_SLEEP");
- return check_active ? active : !active;
+ return strstr(buf, state);
}
-bool psr_wait_entry(int debugfs_fd)
+static inline const char *psr_active_state_get(enum psr_mode mode)
{
- return igt_wait(psr_active(debugfs_fd, true), 500, 20);
+ return mode == PSR_MODE_1 ? "SRDENT" : "DEEP_SLEEP";
}
-bool psr_wait_update(int debugfs_fd)
+/*
+ * For PSR1, we wait until PSR is active. We wait until DEEP_SLEEP for PSR2.
+ */
+bool psr_wait_entry(int debugfs_fd, enum psr_mode mode)
+{
+ return igt_wait(psr_active_check(debugfs_fd, mode), 500, 20);
+}
+
+bool psr_wait_update(int debugfs_fd, enum psr_mode mode)
{
- return igt_wait(psr_active(debugfs_fd, false), 40, 10);
+ return igt_wait(!psr_active_check(debugfs_fd, mode), 40, 10);
}
static ssize_t psr_write(int debugfs_fd, const char *buf)