xref: /linux/drivers/staging/media/meson/vdec/vdec_platform.c (revision 3a39d672e7f48b8d6b91a09afa4b55352773b4b5)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2018 BayLibre, SAS
4  * Author: Maxime Jourdan <mjourdan@baylibre.com>
5  */
6 
7 #include "vdec_platform.h"
8 #include "vdec.h"
9 
10 #include "vdec_1.h"
11 #include "vdec_hevc.h"
12 #include "codec_mpeg12.h"
13 #include "codec_h264.h"
14 #include "codec_vp9.h"
15 
16 static const struct amvdec_format vdec_formats_gxbb[] = {
17 	{
18 		.pixfmt = V4L2_PIX_FMT_H264,
19 		.min_buffers = 2,
20 		.max_buffers = 24,
21 		.max_width = 1920,
22 		.max_height = 1080,
23 		.vdec_ops = &vdec_1_ops,
24 		.codec_ops = &codec_h264_ops,
25 		.firmware_path = "meson/vdec/gxbb_h264.bin",
26 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
27 		.flags = V4L2_FMT_FLAG_COMPRESSED |
28 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
29 	}, {
30 		.pixfmt = V4L2_PIX_FMT_MPEG1,
31 		.min_buffers = 8,
32 		.max_buffers = 8,
33 		.max_width = 1920,
34 		.max_height = 1080,
35 		.vdec_ops = &vdec_1_ops,
36 		.codec_ops = &codec_mpeg12_ops,
37 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
38 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
39 		.flags = V4L2_FMT_FLAG_COMPRESSED,
40 	}, {
41 		.pixfmt = V4L2_PIX_FMT_MPEG2,
42 		.min_buffers = 8,
43 		.max_buffers = 8,
44 		.max_width = 1920,
45 		.max_height = 1080,
46 		.vdec_ops = &vdec_1_ops,
47 		.codec_ops = &codec_mpeg12_ops,
48 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
49 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
50 		.flags = V4L2_FMT_FLAG_COMPRESSED,
51 	},
52 };
53 
54 static const struct amvdec_format vdec_formats_gxl[] = {
55 	{
56 		.pixfmt = V4L2_PIX_FMT_VP9,
57 		.min_buffers = 16,
58 		.max_buffers = 24,
59 		.max_width = 3840,
60 		.max_height = 2160,
61 		.vdec_ops = &vdec_hevc_ops,
62 		.codec_ops = &codec_vp9_ops,
63 		.firmware_path = "meson/vdec/gxl_vp9.bin",
64 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
65 		.flags = V4L2_FMT_FLAG_COMPRESSED |
66 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
67 	}, {
68 		.pixfmt = V4L2_PIX_FMT_H264,
69 		.min_buffers = 2,
70 		.max_buffers = 24,
71 		.max_width = 3840,
72 		.max_height = 2160,
73 		.vdec_ops = &vdec_1_ops,
74 		.codec_ops = &codec_h264_ops,
75 		.firmware_path = "meson/vdec/gxl_h264.bin",
76 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
77 		.flags = V4L2_FMT_FLAG_COMPRESSED |
78 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
79 	}, {
80 		.pixfmt = V4L2_PIX_FMT_MPEG1,
81 		.min_buffers = 8,
82 		.max_buffers = 8,
83 		.max_width = 1920,
84 		.max_height = 1080,
85 		.vdec_ops = &vdec_1_ops,
86 		.codec_ops = &codec_mpeg12_ops,
87 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
88 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
89 		.flags = V4L2_FMT_FLAG_COMPRESSED,
90 	}, {
91 		.pixfmt = V4L2_PIX_FMT_MPEG2,
92 		.min_buffers = 8,
93 		.max_buffers = 8,
94 		.max_width = 1920,
95 		.max_height = 1080,
96 		.vdec_ops = &vdec_1_ops,
97 		.codec_ops = &codec_mpeg12_ops,
98 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
99 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
100 		.flags = V4L2_FMT_FLAG_COMPRESSED,
101 	},
102 };
103 
104 static const struct amvdec_format vdec_formats_gxlx[] = {
105 	{
106 		.pixfmt = V4L2_PIX_FMT_H264,
107 		.min_buffers = 2,
108 		.max_buffers = 24,
109 		.max_width = 3840,
110 		.max_height = 2160,
111 		.vdec_ops = &vdec_1_ops,
112 		.codec_ops = &codec_h264_ops,
113 		.firmware_path = "meson/vdec/gxl_h264.bin",
114 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
115 		.flags = V4L2_FMT_FLAG_COMPRESSED |
116 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
117 	}, {
118 		.pixfmt = V4L2_PIX_FMT_MPEG1,
119 		.min_buffers = 8,
120 		.max_buffers = 8,
121 		.max_width = 1920,
122 		.max_height = 1080,
123 		.vdec_ops = &vdec_1_ops,
124 		.codec_ops = &codec_mpeg12_ops,
125 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
126 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
127 		.flags = V4L2_FMT_FLAG_COMPRESSED,
128 	}, {
129 		.pixfmt = V4L2_PIX_FMT_MPEG2,
130 		.min_buffers = 8,
131 		.max_buffers = 8,
132 		.max_width = 1920,
133 		.max_height = 1080,
134 		.vdec_ops = &vdec_1_ops,
135 		.codec_ops = &codec_mpeg12_ops,
136 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
137 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
138 		.flags = V4L2_FMT_FLAG_COMPRESSED,
139 	},
140 };
141 
142 static const struct amvdec_format vdec_formats_gxm[] = {
143 	{
144 		.pixfmt = V4L2_PIX_FMT_VP9,
145 		.min_buffers = 16,
146 		.max_buffers = 24,
147 		.max_width = 3840,
148 		.max_height = 2160,
149 		.vdec_ops = &vdec_hevc_ops,
150 		.codec_ops = &codec_vp9_ops,
151 		.firmware_path = "meson/vdec/gxl_vp9.bin",
152 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
153 		.flags = V4L2_FMT_FLAG_COMPRESSED |
154 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
155 	}, {
156 		.pixfmt = V4L2_PIX_FMT_H264,
157 		.min_buffers = 2,
158 		.max_buffers = 24,
159 		.max_width = 3840,
160 		.max_height = 2160,
161 		.vdec_ops = &vdec_1_ops,
162 		.codec_ops = &codec_h264_ops,
163 		.firmware_path = "meson/vdec/gxm_h264.bin",
164 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
165 		.flags = V4L2_FMT_FLAG_COMPRESSED |
166 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
167 	}, {
168 		.pixfmt = V4L2_PIX_FMT_MPEG1,
169 		.min_buffers = 8,
170 		.max_buffers = 8,
171 		.max_width = 1920,
172 		.max_height = 1080,
173 		.vdec_ops = &vdec_1_ops,
174 		.codec_ops = &codec_mpeg12_ops,
175 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
176 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
177 		.flags = V4L2_FMT_FLAG_COMPRESSED,
178 	}, {
179 		.pixfmt = V4L2_PIX_FMT_MPEG2,
180 		.min_buffers = 8,
181 		.max_buffers = 8,
182 		.max_width = 1920,
183 		.max_height = 1080,
184 		.vdec_ops = &vdec_1_ops,
185 		.codec_ops = &codec_mpeg12_ops,
186 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
187 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
188 		.flags = V4L2_FMT_FLAG_COMPRESSED,
189 	},
190 };
191 
192 static const struct amvdec_format vdec_formats_g12a[] = {
193 	{
194 		.pixfmt = V4L2_PIX_FMT_VP9,
195 		.min_buffers = 16,
196 		.max_buffers = 24,
197 		.max_width = 3840,
198 		.max_height = 2160,
199 		.vdec_ops = &vdec_hevc_ops,
200 		.codec_ops = &codec_vp9_ops,
201 		.firmware_path = "meson/vdec/g12a_vp9.bin",
202 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
203 		.flags = V4L2_FMT_FLAG_COMPRESSED |
204 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
205 	}, {
206 		.pixfmt = V4L2_PIX_FMT_H264,
207 		.min_buffers = 2,
208 		.max_buffers = 24,
209 		.max_width = 3840,
210 		.max_height = 2160,
211 		.vdec_ops = &vdec_1_ops,
212 		.codec_ops = &codec_h264_ops,
213 		.firmware_path = "meson/vdec/g12a_h264.bin",
214 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
215 		.flags = V4L2_FMT_FLAG_COMPRESSED |
216 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
217 	}, {
218 		.pixfmt = V4L2_PIX_FMT_MPEG1,
219 		.min_buffers = 8,
220 		.max_buffers = 8,
221 		.max_width = 1920,
222 		.max_height = 1080,
223 		.vdec_ops = &vdec_1_ops,
224 		.codec_ops = &codec_mpeg12_ops,
225 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
226 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
227 		.flags = V4L2_FMT_FLAG_COMPRESSED,
228 	}, {
229 		.pixfmt = V4L2_PIX_FMT_MPEG2,
230 		.min_buffers = 8,
231 		.max_buffers = 8,
232 		.max_width = 1920,
233 		.max_height = 1080,
234 		.vdec_ops = &vdec_1_ops,
235 		.codec_ops = &codec_mpeg12_ops,
236 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
237 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
238 		.flags = V4L2_FMT_FLAG_COMPRESSED,
239 	},
240 };
241 
242 static const struct amvdec_format vdec_formats_sm1[] = {
243 	{
244 		.pixfmt = V4L2_PIX_FMT_VP9,
245 		.min_buffers = 16,
246 		.max_buffers = 24,
247 		.max_width = 3840,
248 		.max_height = 2160,
249 		.vdec_ops = &vdec_hevc_ops,
250 		.codec_ops = &codec_vp9_ops,
251 		.firmware_path = "meson/vdec/sm1_vp9_mmu.bin",
252 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
253 		.flags = V4L2_FMT_FLAG_COMPRESSED |
254 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
255 	}, {
256 		.pixfmt = V4L2_PIX_FMT_H264,
257 		.min_buffers = 2,
258 		.max_buffers = 24,
259 		.max_width = 3840,
260 		.max_height = 2160,
261 		.vdec_ops = &vdec_1_ops,
262 		.codec_ops = &codec_h264_ops,
263 		.firmware_path = "meson/vdec/g12a_h264.bin",
264 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
265 		.flags = V4L2_FMT_FLAG_COMPRESSED |
266 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
267 	}, {
268 		.pixfmt = V4L2_PIX_FMT_MPEG1,
269 		.min_buffers = 8,
270 		.max_buffers = 8,
271 		.max_width = 1920,
272 		.max_height = 1080,
273 		.vdec_ops = &vdec_1_ops,
274 		.codec_ops = &codec_mpeg12_ops,
275 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
276 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
277 		.flags = V4L2_FMT_FLAG_COMPRESSED,
278 	}, {
279 		.pixfmt = V4L2_PIX_FMT_MPEG2,
280 		.min_buffers = 8,
281 		.max_buffers = 8,
282 		.max_width = 1920,
283 		.max_height = 1080,
284 		.vdec_ops = &vdec_1_ops,
285 		.codec_ops = &codec_mpeg12_ops,
286 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
287 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
288 		.flags = V4L2_FMT_FLAG_COMPRESSED,
289 	},
290 };
291 
292 const struct vdec_platform vdec_platform_gxbb = {
293 	.formats = vdec_formats_gxbb,
294 	.num_formats = ARRAY_SIZE(vdec_formats_gxbb),
295 	.revision = VDEC_REVISION_GXBB,
296 };
297 
298 const struct vdec_platform vdec_platform_gxl = {
299 	.formats = vdec_formats_gxl,
300 	.num_formats = ARRAY_SIZE(vdec_formats_gxl),
301 	.revision = VDEC_REVISION_GXL,
302 };
303 
304 const struct vdec_platform vdec_platform_gxlx = {
305 	.formats = vdec_formats_gxlx,
306 	.num_formats = ARRAY_SIZE(vdec_formats_gxlx),
307 	.revision = VDEC_REVISION_GXLX,
308 };
309 
310 const struct vdec_platform vdec_platform_gxm = {
311 	.formats = vdec_formats_gxm,
312 	.num_formats = ARRAY_SIZE(vdec_formats_gxm),
313 	.revision = VDEC_REVISION_GXM,
314 };
315 
316 const struct vdec_platform vdec_platform_g12a = {
317 	.formats = vdec_formats_g12a,
318 	.num_formats = ARRAY_SIZE(vdec_formats_g12a),
319 	.revision = VDEC_REVISION_G12A,
320 };
321 
322 const struct vdec_platform vdec_platform_sm1 = {
323 	.formats = vdec_formats_sm1,
324 	.num_formats = ARRAY_SIZE(vdec_formats_sm1),
325 	.revision = VDEC_REVISION_SM1,
326 };
327 
328 MODULE_FIRMWARE("meson/vdec/g12a_h264.bin");
329 MODULE_FIRMWARE("meson/vdec/g12a_vp9.bin");
330 MODULE_FIRMWARE("meson/vdec/gxbb_h264.bin");
331 MODULE_FIRMWARE("meson/vdec/gxl_h264.bin");
332 MODULE_FIRMWARE("meson/vdec/gxl_mpeg12.bin");
333 MODULE_FIRMWARE("meson/vdec/gxl_vp9.bin");
334 MODULE_FIRMWARE("meson/vdec/gxm_h264.bin");
335 MODULE_FIRMWARE("meson/vdec/sm1_vp9_mmu.bin");
336