]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
media: cec: allow any initiator for Ping and Image/Text View On
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Tue, 23 Apr 2019 12:14:01 +0000 (08:14 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 23 May 2019 09:37:02 +0000 (05:37 -0400)
Some displays pull down the HPD when in standby, but CEC is still
active and the display can be woken up by sending an Image View On
or Text View On CEC command. The CEC specification doesn't tell you
what the initiator should be for such a command (without a HPD it's
unclear if the CEC adapter can claim a logical address).

This patch allows any initiator value when there is no HPD for the
Image/Text View On commands and for the Ping command.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/cec/cec-adap.c

index 9a1ec9299aca122eebbf38095b7e1a238bd9e745..5827d8c3742a86411973aba0be7cab695d71e1fe 100644 (file)
@@ -809,14 +809,23 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
                                __func__);
                        return -EINVAL;
                }
-               if (msg->len > 1 && adap->is_configured &&
+               if (adap->is_configured &&
                    !cec_has_log_addr(adap, cec_msg_initiator(msg))) {
                        dprintk(1, "%s: initiator has unknown logical address %d\n",
                                __func__, cec_msg_initiator(msg));
                        return -EINVAL;
                }
+               /*
+                * Special case: allow Ping and IMAGE/TEXT_VIEW_ON to be
+                * transmitted to a TV, even if the adapter is unconfigured.
+                * This makes it possible to detect or wake up displays that
+                * pull down the HPD when in standby.
+                */
                if (!adap->is_configured && !adap->is_configuring &&
-                   msg->msg[0] != 0xf0) {
+                   (msg->len > 2 ||
+                    cec_msg_destination(msg) != CEC_LOG_ADDR_TV ||
+                    (msg->len == 2 && msg->msg[1] != CEC_MSG_IMAGE_VIEW_ON &&
+                     msg->msg[1] != CEC_MSG_TEXT_VIEW_ON))) {
                        dprintk(1, "%s: adapter is unconfigured\n", __func__);
                        return -ENONET;
                }