bcm27xx-userland: update to latest version
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.4 / 950-0573-drm-vc4-hdmi-Move-structure-to-header.patch
1 From 13bb65d33681b0095214033a5e80186faa325854 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Wed, 18 Dec 2019 18:35:12 +0100
4 Subject: [PATCH] drm/vc4: hdmi: Move structure to header
5
6 We will need to share the vc4_hdmi and related structures with multiple
7 files, so let's create a header for it.
8
9 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
10 ---
11 drivers/gpu/drm/vc4/vc4_hdmi.c | 76 +-----------------------------
12 drivers/gpu/drm/vc4/vc4_hdmi.h | 86 ++++++++++++++++++++++++++++++++++
13 2 files changed, 87 insertions(+), 75 deletions(-)
14 create mode 100644 drivers/gpu/drm/vc4/vc4_hdmi.h
15
16 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
17 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
18 @@ -48,87 +48,13 @@
19 #include <sound/soc.h>
20 #include "media/cec.h"
21 #include "vc4_drv.h"
22 +#include "vc4_hdmi.h"
23 #include "vc4_regs.h"
24
25 #define HSM_CLOCK_FREQ 163682864
26 #define CEC_CLOCK_FREQ 40000
27 #define CEC_CLOCK_DIV (HSM_CLOCK_FREQ / CEC_CLOCK_FREQ)
28
29 -/* HDMI audio information */
30 -struct vc4_hdmi_audio {
31 - struct snd_soc_card card;
32 - struct snd_soc_dai_link link;
33 - struct snd_soc_dai_link_component cpu;
34 - struct snd_soc_dai_link_component codec;
35 - struct snd_soc_dai_link_component platform;
36 - int samplerate;
37 - int channels;
38 - struct snd_dmaengine_dai_dma_data dma_data;
39 - struct snd_pcm_substream *substream;
40 -};
41 -
42 -/* General HDMI hardware state. */
43 -struct vc4_hdmi {
44 - struct platform_device *pdev;
45 -
46 - struct drm_encoder *encoder;
47 - struct drm_connector *connector;
48 -
49 - struct vc4_hdmi_audio audio;
50 -
51 - struct i2c_adapter *ddc;
52 - void __iomem *hdmicore_regs;
53 - void __iomem *hd_regs;
54 - int hpd_gpio;
55 - bool hpd_active_low;
56 -
57 - struct cec_adapter *cec_adap;
58 - struct cec_msg cec_rx_msg;
59 - bool cec_tx_ok;
60 - bool cec_irq_was_rx;
61 -
62 - struct clk *pixel_clock;
63 - struct clk *hsm_clock;
64 -
65 - struct debugfs_regset32 hdmi_regset;
66 - struct debugfs_regset32 hd_regset;
67 -};
68 -
69 -#define HDMI_READ(offset) readl(vc4->hdmi->hdmicore_regs + offset)
70 -#define HDMI_WRITE(offset, val) writel(val, vc4->hdmi->hdmicore_regs + offset)
71 -#define HD_READ(offset) readl(vc4->hdmi->hd_regs + offset)
72 -#define HD_WRITE(offset, val) writel(val, vc4->hdmi->hd_regs + offset)
73 -
74 -/* VC4 HDMI encoder KMS struct */
75 -struct vc4_hdmi_encoder {
76 - struct vc4_encoder base;
77 - bool hdmi_monitor;
78 - bool limited_rgb_range;
79 -};
80 -
81 -static inline struct vc4_hdmi_encoder *
82 -to_vc4_hdmi_encoder(struct drm_encoder *encoder)
83 -{
84 - return container_of(encoder, struct vc4_hdmi_encoder, base.base);
85 -}
86 -
87 -/* VC4 HDMI connector KMS struct */
88 -struct vc4_hdmi_connector {
89 - struct drm_connector base;
90 -
91 - /* Since the connector is attached to just the one encoder,
92 - * this is the reference to it so we can do the best_encoder()
93 - * hook.
94 - */
95 - struct drm_encoder *encoder;
96 -};
97 -
98 -static inline struct vc4_hdmi_connector *
99 -to_vc4_hdmi_connector(struct drm_connector *connector)
100 -{
101 - return container_of(connector, struct vc4_hdmi_connector, base);
102 -}
103 -
104 static const struct debugfs_reg32 hdmi_regs[] = {
105 VC4_REG32(VC4_HDMI_CORE_REV),
106 VC4_REG32(VC4_HDMI_SW_RESET_CONTROL),
107 --- /dev/null
108 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
109 @@ -0,0 +1,86 @@
110 +#ifndef _VC4_HDMI_H_
111 +#define _VC4_HDMI_H_
112 +
113 +#include <drm/drm_connector.h>
114 +#include <media/cec.h>
115 +#include <sound/dmaengine_pcm.h>
116 +#include <sound/soc.h>
117 +
118 +#include "vc4_drv.h"
119 +
120 +/* HDMI audio information */
121 +struct vc4_hdmi_audio {
122 + struct snd_soc_card card;
123 + struct snd_soc_dai_link link;
124 + struct snd_soc_dai_link_component cpu;
125 + struct snd_soc_dai_link_component codec;
126 + struct snd_soc_dai_link_component platform;
127 + int samplerate;
128 + int channels;
129 + struct snd_dmaengine_dai_dma_data dma_data;
130 + struct snd_pcm_substream *substream;
131 +};
132 +
133 +/* General HDMI hardware state. */
134 +struct vc4_hdmi {
135 + struct platform_device *pdev;
136 +
137 + struct drm_encoder *encoder;
138 + struct drm_connector *connector;
139 +
140 + struct vc4_hdmi_audio audio;
141 +
142 + struct i2c_adapter *ddc;
143 + void __iomem *hdmicore_regs;
144 + void __iomem *hd_regs;
145 + int hpd_gpio;
146 + bool hpd_active_low;
147 +
148 + struct cec_adapter *cec_adap;
149 + struct cec_msg cec_rx_msg;
150 + bool cec_tx_ok;
151 + bool cec_irq_was_rx;
152 +
153 + struct clk *pixel_clock;
154 + struct clk *hsm_clock;
155 +
156 + struct debugfs_regset32 hdmi_regset;
157 + struct debugfs_regset32 hd_regset;
158 +};
159 +
160 +#define HDMI_READ(offset) readl(vc4->hdmi->hdmicore_regs + offset)
161 +#define HDMI_WRITE(offset, val) writel(val, vc4->hdmi->hdmicore_regs + offset)
162 +#define HD_READ(offset) readl(vc4->hdmi->hd_regs + offset)
163 +#define HD_WRITE(offset, val) writel(val, vc4->hdmi->hd_regs + offset)
164 +
165 +/* VC4 HDMI encoder KMS struct */
166 +struct vc4_hdmi_encoder {
167 + struct vc4_encoder base;
168 + bool hdmi_monitor;
169 + bool limited_rgb_range;
170 +};
171 +
172 +static inline struct vc4_hdmi_encoder *
173 +to_vc4_hdmi_encoder(struct drm_encoder *encoder)
174 +{
175 + return container_of(encoder, struct vc4_hdmi_encoder, base.base);
176 +}
177 +
178 +/* VC4 HDMI connector KMS struct */
179 +struct vc4_hdmi_connector {
180 + struct drm_connector base;
181 +
182 + /* Since the connector is attached to just the one encoder,
183 + * this is the reference to it so we can do the best_encoder()
184 + * hook.
185 + */
186 + struct drm_encoder *encoder;
187 +};
188 +
189 +static inline struct vc4_hdmi_connector *
190 +to_vc4_hdmi_connector(struct drm_connector *connector)
191 +{
192 + return container_of(connector, struct vc4_hdmi_connector, base);
193 +}
194 +
195 +#endif /* _VC4_HDMI_H_ */