1 From 602ec343e69479dbec368f67d09c9f3e3e5ac248 Mon Sep 17 00:00:00 2001
2 From: Dom Cobley <popcornmix@gmail.com>
3 Date: Thu, 7 May 2020 18:16:07 +0100
4 Subject: [PATCH] vc4_hdmi: Fix register offset when sending longer CEC
7 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
9 drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++++++--
10 1 file changed, 11 insertions(+), 2 deletions(-)
12 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
13 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
14 @@ -1265,8 +1265,13 @@ static void vc4_cec_read_msg(struct vc4_
16 msg->len = 1 + ((cntrl1 & VC4_HDMI_CEC_REC_WRD_CNT_MASK) >>
17 VC4_HDMI_CEC_REC_WRD_CNT_SHIFT);
19 + if (msg->len > 16) {
20 + DRM_ERROR("Attempting to read too much data (%d)\n", msg->len);
23 for (i = 0; i < msg->len; i += 4) {
24 - u32 val = HDMI_READ(HDMI_CEC_RX_DATA_1 + i);
25 + u32 val = HDMI_READ(HDMI_CEC_RX_DATA_1 + (i>>2));
27 msg->msg[i] = val & 0xff;
28 msg->msg[i + 1] = (val >> 8) & 0xff;
29 @@ -1362,8 +1367,12 @@ static int vc4_hdmi_cec_adap_transmit(st
33 + if (msg->len > 16) {
34 + DRM_ERROR("Attempting to transmit too much data (%d)\n", msg->len);
37 for (i = 0; i < msg->len; i += 4)
38 - HDMI_WRITE(HDMI_CEC_TX_DATA_1 + i,
39 + HDMI_WRITE(HDMI_CEC_TX_DATA_1 + (i>>2),
41 (msg->msg[i + 1] << 8) |
42 (msg->msg[i + 2] << 16) |