kernel: bump 5.4 to 5.4.69
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0577-drm-vc4-hdmi-Pass-vc4_hdmi-to-CEC-code.patch
1 From 8af2552e862100e843b8d1f36543b718dde393ad Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Mon, 6 Jan 2020 18:47:53 +0100
4 Subject: [PATCH] drm/vc4: hdmi: Pass vc4_hdmi to CEC code
5
6 Our CEC code also retrieves the associated vc4_hdmi by setting the
7 vc4_dev pointer as its private data, and then dereferences its vc4_hdmi
8 pointer.
9
10 In order to eventually get rid of that pointer, we can simply pass the
11 vc4_hdmi pointer directly.
12
13 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 ---
15 drivers/gpu/drm/vc4/vc4_hdmi.c | 24 +++++++++---------------
16 1 file changed, 9 insertions(+), 15 deletions(-)
17
18 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
19 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
20 @@ -1044,8 +1044,7 @@ static int vc4_hdmi_audio_init(struct vc
21 #ifdef CONFIG_DRM_VC4_HDMI_CEC
22 static irqreturn_t vc4_cec_irq_handler_thread(int irq, void *priv)
23 {
24 - struct vc4_dev *vc4 = priv;
25 - struct vc4_hdmi *vc4_hdmi = vc4->hdmi;
26 + struct vc4_hdmi *vc4_hdmi = priv;
27
28 if (vc4_hdmi->cec_irq_was_rx) {
29 if (vc4_hdmi->cec_rx_msg.len)
30 @@ -1065,9 +1064,8 @@ static irqreturn_t vc4_cec_irq_handler_t
31 return IRQ_HANDLED;
32 }
33
34 -static void vc4_cec_read_msg(struct vc4_dev *vc4, u32 cntrl1)
35 +static void vc4_cec_read_msg(struct vc4_hdmi *vc4_hdmi, u32 cntrl1)
36 {
37 - struct vc4_hdmi *vc4_hdmi = vc4->hdmi;
38 struct cec_msg *msg = &vc4_hdmi->cec_rx_msg;
39 unsigned int i;
40
41 @@ -1085,8 +1083,7 @@ static void vc4_cec_read_msg(struct vc4_
42
43 static irqreturn_t vc4_cec_irq_handler(int irq, void *priv)
44 {
45 - struct vc4_dev *vc4 = priv;
46 - struct vc4_hdmi *vc4_hdmi = vc4->hdmi;
47 + struct vc4_hdmi *vc4_hdmi = priv;
48 u32 stat = HDMI_READ(VC4_HDMI_CPU_STATUS);
49 u32 cntrl1, cntrl5;
50
51 @@ -1097,7 +1094,7 @@ static irqreturn_t vc4_cec_irq_handler(i
52 cntrl5 = HDMI_READ(VC4_HDMI_CEC_CNTRL_5);
53 vc4_hdmi->cec_irq_was_rx = cntrl5 & VC4_HDMI_CEC_RX_CEC_INT;
54 if (vc4_hdmi->cec_irq_was_rx) {
55 - vc4_cec_read_msg(vc4, cntrl1);
56 + vc4_cec_read_msg(vc4_hdmi, cntrl1);
57 cntrl1 |= VC4_HDMI_CEC_CLEAR_RECEIVE_OFF;
58 HDMI_WRITE(VC4_HDMI_CEC_CNTRL_1, cntrl1);
59 cntrl1 &= ~VC4_HDMI_CEC_CLEAR_RECEIVE_OFF;
60 @@ -1113,8 +1110,7 @@ static irqreturn_t vc4_cec_irq_handler(i
61
62 static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable)
63 {
64 - struct vc4_dev *vc4 = cec_get_drvdata(adap);
65 - struct vc4_hdmi *vc4_hdmi = vc4->hdmi;
66 + struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
67 /* clock period in microseconds */
68 const u32 usecs = 1000000 / CEC_CLOCK_FREQ;
69 u32 val = HDMI_READ(VC4_HDMI_CEC_CNTRL_5);
70 @@ -1157,8 +1153,7 @@ static int vc4_hdmi_cec_adap_enable(stru
71
72 static int vc4_hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr)
73 {
74 - struct vc4_dev *vc4 = cec_get_drvdata(adap);
75 - struct vc4_hdmi *vc4_hdmi = vc4->hdmi;
76 + struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
77
78 HDMI_WRITE(VC4_HDMI_CEC_CNTRL_1,
79 (HDMI_READ(VC4_HDMI_CEC_CNTRL_1) & ~VC4_HDMI_CEC_ADDR_MASK) |
80 @@ -1169,8 +1164,7 @@ static int vc4_hdmi_cec_adap_log_addr(st
81 static int vc4_hdmi_cec_adap_transmit(struct cec_adapter *adap, u8 attempts,
82 u32 signal_free_time, struct cec_msg *msg)
83 {
84 - struct vc4_dev *vc4 = cec_get_drvdata(adap);
85 - struct vc4_hdmi *vc4_hdmi = vc4->hdmi;
86 + struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
87 u32 val;
88 unsigned int i;
89
90 @@ -1316,7 +1310,7 @@ static int vc4_hdmi_bind(struct device *
91
92 #ifdef CONFIG_DRM_VC4_HDMI_CEC
93 vc4_hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops,
94 - vc4, "vc4",
95 + vc4_hdmi, "vc4",
96 CEC_CAP_DEFAULTS |
97 CEC_CAP_CONNECTOR_INFO, 1);
98 ret = PTR_ERR_OR_ZERO(vc4_hdmi->cec_adap);
99 @@ -1340,7 +1334,7 @@ static int vc4_hdmi_bind(struct device *
100 ret = devm_request_threaded_irq(dev, platform_get_irq(pdev, 0),
101 vc4_cec_irq_handler,
102 vc4_cec_irq_handler_thread, 0,
103 - "vc4 hdmi cec", vc4);
104 + "vc4 hdmi cec", vc4_hdmi);
105 if (ret)
106 goto err_delete_cec_adap;
107 ret = cec_register_adapter(vc4_hdmi->cec_adap, dev);