This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: cec-ctl: add hpd-may-be-low suboption for the CEC tests
Author:  Hans Verkuil <[email protected]>
Date:    Fri Aug 11 13:47:50 2023 +0200

Some displays may occasionally pull the HPD low when in standby.
Usually it is either always high or always low in standby, but with
this option it can be either. The standby/wake up tests needs to
know about this, so add this option.

Signed-off-by: Hans Verkuil <[email protected]>

 utils/cec-ctl/cec-ctl.1.in |  9 +++++---
 utils/cec-ctl/cec-ctl.cpp  | 56 +++++++++++++++++++++++++++++++++-------------
 2 files changed, 47 insertions(+), 18 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=8f8284f2313a5804b9958c458124335442adbf3d
diff --git a/utils/cec-ctl/cec-ctl.1.in b/utils/cec-ctl/cec-ctl.1.in
index 6282a1a6a33e..36b2d7f6093b 100644
--- a/utils/cec-ctl/cec-ctl.1.in
+++ b/utils/cec-ctl/cec-ctl.1.in
@@ -271,12 +271,13 @@ via the \fB\-\-analyze\-pin\fR option. Use \- to write to 
stdout instead of to a
 Read and analyze the CEC pin events from the given file. Use \- to read from 
stdin
 instead of from a file.
 .TP
-\fB\-\-test\-standby\-wakeup\-cycle\fR 
[\fIpolls\fR=\fI<n>\fR][,\fIsleep\fR=\fI<secs>\fR]
+\fB\-\-test\-standby\-wakeup\-cycle\fR 
[\fIpolls\fR=\fI<n>\fR][,\fIsleep\fR=\fI<secs>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0,1>\fR]
 This option tests the standby-wakeup cycle behavior of the display. It polls 
up to
 \fI<n>\fR times (default 15), waiting for a state change. If that fails then it
 waits \fI<secs>\fR seconds (default 10) before retrying this.
+If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in 
standby.
 .TP
-\fB\-\-stress\-test\-standby\-wakeup\-cycle\fR 
\fIcnt\fR=\fI<count>\fR[,\fIpolls\fR=\fI<n>\fR][,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIrepeats\fR=\fI<reps>\fR][,\fIsleep-before-on\fR=\fI<secs1>\fR][,\fIsleep-before-off\fR=\fI<secs2>\fR]
+\fB\-\-stress\-test\-standby\-wakeup\-cycle\fR 
\fIcnt\fR=\fI<count>\fR[,\fIpolls\fR=\fI<n>\fR][,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIrepeats\fR=\fI<reps>\fR][,\fIsleep-before-on\fR=\fI<secs1>\fR][,\fIsleep-before-off\fR=\fI<secs2>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0,1>\fR]
 This option performs a stress test for a display: it cycles the display 
\fI<count>\fR
 times in and out of standby using the CEC Standby and Image View On commands.
 If \fI<count>\fR is 0, then never stop.
@@ -292,8 +293,9 @@ non-zero \fI<reps>\fR value is needed in order to pass this 
test, then that indi
 a problem.
 If \fI<secs1>\fR is specified, then sleep for <secs1> seconds before 
transmitting <Image View On>.
 If \fI<secs2>\fR is specified, then sleep for <secs2> seconds before 
transmitting <Standby>.
+If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in 
standby.
 .TP
-\fB\-\-stress\-test\-random\-standby\-wakeup\-cycle\fR 
\fIcnt\fR=\fI<count>\fR[,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR]
+\fB\-\-stress\-test\-random\-standby\-wakeup\-cycle\fR 
\fIcnt\fR=\fI<count>\fR[,\fImax-sleep\fR=\fI<maxsecs>\fR][,\fImin-sleep\fR=\fI<minsecs>\fR][,\fIseed\fR=\fI<seed>\fR][,\fIhpd\-may\-be\-low\fR=\fI<0,1>\fR]
 This option performs a stress test for a display: it cycles the display 
\fI<count>\fR
 times in and out of standby using the CEC Standby and Image View On commands.
 After each command wait between \fI<minsecs>\fR (default is 0) and 
\fI<maxsecs>\fR (default is 10)
@@ -305,6 +307,7 @@ wake up the display and check if that works. If not, this 
test fails.
 If \fI<count>\fR is 0, then never stop.
 If \fI<seed>\fR is specified, then set the randomizer seed to that value 
instead of
 using the current time as seed.
+If \fI<hpd\-may\-be\-low>\fR is 1, then the HPD is allowed to be low when in 
standby.
 .TP
 \fB\-\-help\-all\fR
 Prints the help message for all options.
diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index 13d52574cb9b..adeff1f9d29b 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -326,13 +326,14 @@ static void usage()
               "                           Use - for stdout.\n"
               "  --analyze-pin <from>     Analyze the low-level CEC pin 
changes from the file <from>.\n"
               "                           Use - for stdin.\n"
-              "  --test-standby-wakeup-cycle [polls=<n>][,sleep=<secs>]\n"
+              "  --test-standby-wakeup-cycle 
[polls=<n>][,sleep=<secs>][,hpd-may-be-low=<0/1>]\n"
               "                           Test standby-wakeup cycle behavior 
of the display. It polls up to\n"
               "                           <n> times (default 15), waiting for 
a state change. If\n"
               "                           that fails it waits <secs> seconds 
(default 10) before\n"
               "                           retrying this.\n"
+              "                           If <hpd-may-be-low> is 1, then the 
HPD is allowed to be low when in standby.\n"
               "  --stress-test-standby-wakeup-cycle 
cnt=<count>[,polls=<n>][,max-sleep=<maxsecs>][,min-sleep=<minsecs>][,seed=<seed>][,repeats=<reps>]\n"
-              "                            
[,sleep-before-on=<secs1>][,sleep-before-off=<secs2>]\n"
+              "                            
[,sleep-before-on=<secs1>][,sleep-before-off=<secs2>][,hpd-may-be-low=<0/1>]\n"
               "                           Standby-Wakeup cycle display <count> 
times. If 0, then never stop.\n"
               "                           It polls up to <n> times (default 
30), waiting for a state change.\n"
               "                           If <maxsecs> is non-zero (0 is the 
default), then sleep for\n"
@@ -346,12 +347,14 @@ static void usage()
               "                           before transmitting <Image View 
On>.\n"
               "                           If <secs2> is specified, then sleep 
for <secs2> seconds\n"
               "                           before transmitting <Standby>.\n"
-              "  --stress-test-random-standby-wakeup-cycle 
cnt=<count>[,max-sleep=<maxsecs>][,min-sleep=<minsecs>][,seed=<seed>]\n"
+              "                           If <hpd-may-be-low> is 1, then the 
HPD is allowed to be low when in standby.\n"
+              "  --stress-test-random-standby-wakeup-cycle 
cnt=<count>[,max-sleep=<maxsecs>][,min-sleep=<minsecs>][,seed=<seed>][,hpd-may-be-low=<0/1>]\n"
               "                           Randomly transmit <Standby> or 
<Image View On> up to <count> times.\n"
               "                           If <count> is 0, then never stop. 
After each transmit wait between\n"
               "                           <min-sleep> (default 0) and 
<max-sleep> (default 10) seconds.\n"
               "                           If <seed> is specified, then set the 
randomizer seed to\n"
               "                           that value instead of using the 
current time as seed.\n"
+              "                           If <hpd-may-be-low> is 1, then the 
HPD is allowed to be low when in standby.\n"
               "                           This test does not check if the 
display reached the new state,\n"
               "                           it checks if the display can handle 
this situation without\n"
               "                           locking up. After every 10 cycles it 
attempts to properly\n"
@@ -1438,7 +1441,7 @@ static int init_standby_wakeup_cycle_test(const struct 
node &node, unsigned repe
 }
 
 static void test_standby_wakeup_cycle(const struct node &node, unsigned int 
max_tries,
-                                     unsigned int retry_sleep)
+                                     unsigned int retry_sleep, bool 
hpd_may_be_low)
 {
        struct cec_log_addrs laddrs = { };
        struct cec_msg msg;
@@ -1459,10 +1462,11 @@ static void test_standby_wakeup_cycle(const struct node 
&node, unsigned int max_
        else
                wakeup_la = CEC_LOG_ADDR_UNREGISTERED;
 
-       bool hpd_is_low = wakeup_la == CEC_LOG_ADDR_UNREGISTERED;
+       bool hpd_is_low = (wakeup_la == CEC_LOG_ADDR_UNREGISTERED) || 
hpd_may_be_low;
 
        printf("The Hotplug Detect pin %s when in Standby\n\n",
-              hpd_is_low ? "is pulled low" : "remains high");
+              hpd_may_be_low ? "may be pulled low" :
+              (hpd_is_low ? "is pulled low" : "remains high"));
 
        for (unsigned iter = 0; iter <= 2 * 12; iter++) {
                unsigned i = iter / 2;
@@ -1652,7 +1656,8 @@ static void test_standby_wakeup_cycle(const struct node 
&node, unsigned int max_
 static void stress_test_standby_wakeup_cycle(const struct node &node, unsigned 
cnt,
                                             double min_sleep, double 
max_sleep, unsigned max_tries,
                                             bool has_seed, unsigned seed, 
unsigned repeats,
-                                            double sleep_before_on, double 
sleep_before_off)
+                                            double sleep_before_on, double 
sleep_before_off,
+                                            bool hpd_may_be_low)
 {
        struct cec_log_addrs laddrs = { };
        struct cec_msg msg;
@@ -1682,10 +1687,11 @@ static void stress_test_standby_wakeup_cycle(const 
struct node &node, unsigned c
        else
                wakeup_la = CEC_LOG_ADDR_UNREGISTERED;
 
-       bool hpd_is_low = wakeup_la == CEC_LOG_ADDR_UNREGISTERED;
+       bool hpd_is_low = (wakeup_la == CEC_LOG_ADDR_UNREGISTERED) || 
hpd_may_be_low;
 
        printf("The Hotplug Detect pin %s when in Standby\n\n",
-              hpd_is_low ? "is pulled low" : "remains high");
+              hpd_may_be_low ? "may be pulled low" :
+              (hpd_is_low ? "is pulled low" : "remains high"));
 
        srandom(seed);
 
@@ -1886,7 +1892,8 @@ static void stress_test_standby_wakeup_cycle(const struct 
node &node, unsigned c
 
 static void stress_test_random_standby_wakeup_cycle(const struct node &node, 
unsigned cnt,
                                                    double min_sleep, double 
max_sleep,
-                                                   bool has_seed, unsigned 
seed)
+                                                   bool has_seed, unsigned 
seed,
+                                                   bool hpd_may_be_low)
 {
        struct cec_log_addrs laddrs = { };
        struct cec_msg msg;
@@ -1939,10 +1946,11 @@ static void 
stress_test_random_standby_wakeup_cycle(const struct node &node, uns
        else
                wakeup_la = CEC_LOG_ADDR_UNREGISTERED;
 
-       bool hpd_is_low = wakeup_la == CEC_LOG_ADDR_UNREGISTERED;
+       bool hpd_is_low = (wakeup_la == CEC_LOG_ADDR_UNREGISTERED) || 
hpd_may_be_low;
 
        printf("The Hotplug Detect pin %s when in Standby\n\n",
-              hpd_is_low ? "is pulled low" : "remains high");
+              hpd_may_be_low ? "may be pulled low" :
+              (hpd_is_low ? "is pulled low" : "remains high"));
 
        srandom(seed);
 
@@ -2295,13 +2303,16 @@ int main(int argc, char **argv)
        unsigned int stress_test_standby_wakeup_cycle_repeats = 0;
        double stress_test_standby_wakeup_cycle_sleep_before_on = 0;
        double stress_test_standby_wakeup_cycle_sleep_before_off = 0;
+       bool stress_test_standby_wakeup_cycle_hpd_may_be_low = false;
        unsigned int test_standby_wakeup_cycle_polls = 15;
        unsigned int test_standby_wakeup_cycle_sleep = 10;
+       bool test_standby_wakeup_cycle_hpd_may_be_low = false;
        unsigned int stress_test_random_standby_wakeup_cnt = 0;
        double stress_test_random_standby_wakeup_min_sleep = 0;
        double stress_test_random_standby_wakeup_max_sleep = 10;
        bool stress_test_random_standby_wakeup_has_seed = false;
        unsigned int stress_test_random_standby_wakeup_seed = 0;
+       bool stress_test_random_standby_wakeup_hpd_may_be_low = false;
        bool warn_if_unconfigured = false;
        __u16 phys_addr;
        __u8 from = 0, to = 0, first_to = 0xff;
@@ -2681,6 +2692,7 @@ int main(int argc, char **argv)
                        static constexpr const char *arg_names[] = {
                                "polls",
                                "sleep",
+                               "hpd-may-be-low",
                                nullptr
                        };
                        char *value, *subs = optarg;
@@ -2697,6 +2709,9 @@ int main(int argc, char **argv)
                                case 1:
                                        test_standby_wakeup_cycle_sleep = 
strtoul(value, nullptr, 0);
                                        break;
+                               case 2:
+                                       
test_standby_wakeup_cycle_hpd_may_be_low = true;
+                                       break;
                                default:
                                        std::exit(EXIT_FAILURE);
                                }
@@ -2714,6 +2729,7 @@ int main(int argc, char **argv)
                                "sleep-before-on",
                                "sleep-before-off",
                                "polls",
+                               "hpd-may-be-low",
                                nullptr
                        };
                        char *value, *subs = optarg;
@@ -2745,6 +2761,9 @@ int main(int argc, char **argv)
                                case 7:
                                        stress_test_standby_wakeup_cycle_polls 
= strtoul(value, nullptr, 0);
                                        break;
+                               case 8:
+                                       
stress_test_standby_wakeup_cycle_hpd_may_be_low = true;
+                                       break;
                                default:
                                        std::exit(EXIT_FAILURE);
                                }
@@ -2763,6 +2782,7 @@ int main(int argc, char **argv)
                                "min-sleep",
                                "max-sleep",
                                "seed",
+                               "hpd-may-be-low",
                                nullptr
                        };
                        char *value, *subs = optarg;
@@ -2782,6 +2802,9 @@ int main(int argc, char **argv)
                                        
stress_test_random_standby_wakeup_has_seed = true;
                                        stress_test_random_standby_wakeup_seed 
= strtoul(value, nullptr, 0);
                                        break;
+                               case 4:
+                                       
stress_test_random_standby_wakeup_hpd_may_be_low = true;
+                                       break;
                                default:
                                        std::exit(EXIT_FAILURE);
                                }
@@ -3166,7 +3189,8 @@ int main(int argc, char **argv)
        if (options[OptTestStandbyWakeupCycle])
                test_standby_wakeup_cycle(node,
                                          test_standby_wakeup_cycle_polls,
-                                         test_standby_wakeup_cycle_sleep);
+                                         test_standby_wakeup_cycle_sleep,
+                                         
test_standby_wakeup_cycle_hpd_may_be_low);
        if (options[OptStressTestStandbyWakeupCycle])
                stress_test_standby_wakeup_cycle(node,
                                                 
stress_test_standby_wakeup_cycle_cnt,
@@ -3177,14 +3201,16 @@ int main(int argc, char **argv)
                                                 
stress_test_standby_wakeup_cycle_seed,
                                                 
stress_test_standby_wakeup_cycle_repeats,
                                                 
stress_test_standby_wakeup_cycle_sleep_before_on,
-                                                
stress_test_standby_wakeup_cycle_sleep_before_off);
+                                                
stress_test_standby_wakeup_cycle_sleep_before_off,
+                                                
stress_test_standby_wakeup_cycle_hpd_may_be_low);
        if (options[OptStressTestRandomStandbyWakeupCycle])
                stress_test_random_standby_wakeup_cycle(node,
                                                        
stress_test_random_standby_wakeup_cnt,
                                                        
stress_test_random_standby_wakeup_min_sleep,
                                                        
stress_test_random_standby_wakeup_max_sleep,
                                                        
stress_test_random_standby_wakeup_has_seed,
-                                                       
stress_test_random_standby_wakeup_seed);
+                                                       
stress_test_random_standby_wakeup_seed,
+                                                       
stress_test_random_standby_wakeup_hpd_may_be_low);
 
 skip_la:
        if (options[OptMonitor] || options[OptMonitorAll] ||

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to