aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil-cisco@xs4all.nl>2020-10-21 13:56:53 +0200
committerHans Verkuil <hverkuil-cisco@xs4all.nl>2020-10-21 14:16:45 +0200
commit01bf31643024cfbfb0f47c8860b431305b9bf256 (patch)
tree9719596573e1be17c533e9b5f1df0df6e10c05b0
parent28df3d403be3d7769d7b10cda3e372a0dbbfa410 (diff)
cec-ctl/cec-compliance: add pulse8-cec kernel version check
The CEC framework had problems with displays that pull down the HPD when in Standby. This was fixed in kernel 5.5 and the fix was backported to LTS kernels 4.19.94 and 5.4.9. Check that the right kernel version is being used to prevent unreliable stress and compliance test results. For the stress test using the wrong kernel is a hard FAIL, for the compliance test it is just a warning since it is much more likely to pass. This is only checked for the pulse8-cec driver, for other CEC devices (most likely on an embedded system) you hopefully know what you are doing. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
-rw-r--r--utils/cec-compliance/cec-test-power.cpp21
-rw-r--r--utils/cec-ctl/cec-ctl.cpp21
2 files changed, 41 insertions, 1 deletions
diff --git a/utils/cec-compliance/cec-test-power.cpp b/utils/cec-compliance/cec-test-power.cpp
index 81faa60e..02661946 100644
--- a/utils/cec-compliance/cec-test-power.cpp
+++ b/utils/cec-compliance/cec-test-power.cpp
@@ -375,6 +375,25 @@ static int standby_resume_standby_toggle(struct node *node, unsigned me, unsigne
fail_on_test(cec_msg_status_is_abort(&msg));
fail_on_test(wait_changing_power_status(node, me, la, new_status, unresponsive_time));
fail_on_test(new_status != CEC_OP_POWER_STATUS_STANDBY);
+
+ if (res == ENONET) {
+ struct cec_caps caps = { };
+ doioctl(node, CEC_ADAP_G_CAPS, &caps);
+ unsigned major = caps.version >> 16;
+ unsigned minor = (caps.version >> 8) & 0xff;
+ if (!strcmp(caps.driver, "pulse8-cec") &&
+ !((major == 4 && minor == 19) || major > 5 ||
+ (major == 5 && minor >= 4))) {
+ // The cec framework had a bug that prevented it from reliably
+ // working with displays that pull down the HPD. This was fixed
+ // in commit ac479b51f3f4 for kernel 5.5 and backported to kernels
+ // 4.19.94 and 5.4.9. We only warn when the pulse8-cec driver is used,
+ // for other CEC devices you hopefully know what you are doing...
+ warn("This display appears to pull down the HPD when in Standby. For such\n");
+ warn("displays kernel 4.19 or kernel 5.4 or higher is required.\n");
+ }
+ }
+
fail_on_test(interactive && !question("Is the device still in standby?"));
node->remote[la].in_standby = true;
if (unresponsive_time > 0)
@@ -571,7 +590,7 @@ static int power_state_transitions(struct node *node, unsigned me, unsigned la,
fail_on_test(!res);
if (res < 0) {
warn("No Report Power Status seen when going to standby.\n");
- info("This might be due to this bug: https://patchwork.linuxtv.org/patch/60447\n");
+ info("This might be due to the bug fix in commit cec935ce69fc\n");
info("However, this was fixed in 5.5 and has been backported to LTS kernels,\n");
info("so any kernel released after January 2020 should have this fix.\n");
return OK_PRESUMED;
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 2ee88ec9..9213aec6 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -1258,6 +1258,27 @@ static int init_power_cycle_test(const struct node &node, unsigned repeats, unsi
printf("%s: ", ts2s(current_ts()).c_str());
printf("Physical Address: %x.%x.%x.%x\n\n",
cec_phys_addr_exp(pa));
+
+ if (pa != CEC_PHYS_ADDR_INVALID)
+ return from;
+
+ struct cec_caps caps = { };
+ doioctl(&node, CEC_ADAP_G_CAPS, &caps);
+ unsigned major = caps.version >> 16;
+ unsigned minor = (caps.version >> 8) & 0xff;
+ if (!strcmp(caps.driver, "pulse8-cec") &&
+ !((major == 4 && minor == 19) || major > 5 ||
+ (major == 5 && minor >= 4))) {
+ // The cec framework had a bug that prevented it from reliably
+ // working with displays that pull down the HPD. This was fixed
+ // in commit ac479b51f3f4 for kernel 5.5 and backported to kernels
+ // 4.19.94 and 5.4.9. We only fail when the pulse8-cec driver is used,
+ // for other CEC devices you hopefully know what you are doing...
+ printf("FAIL: This display appears to pull down the HPD when in Standby. For such\n");
+ printf(" displays kernel 4.19 or kernel 5.4 or higher is required.\n");
+ std::exit(EXIT_FAILURE);
+ }
+
return from;
}

Privacy Policy