xref: /linux/drivers/staging/media/meson/vdec/vdec_platform.c (revision b83deaa741558babf4b8d51d34f6637ccfff1b26)
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_gxm[] = {
105 	{
106 		.pixfmt = V4L2_PIX_FMT_VP9,
107 		.min_buffers = 16,
108 		.max_buffers = 24,
109 		.max_width = 3840,
110 		.max_height = 2160,
111 		.vdec_ops = &vdec_hevc_ops,
112 		.codec_ops = &codec_vp9_ops,
113 		.firmware_path = "meson/vdec/gxl_vp9.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_H264,
119 		.min_buffers = 2,
120 		.max_buffers = 24,
121 		.max_width = 3840,
122 		.max_height = 2160,
123 		.vdec_ops = &vdec_1_ops,
124 		.codec_ops = &codec_h264_ops,
125 		.firmware_path = "meson/vdec/gxm_h264.bin",
126 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
127 		.flags = V4L2_FMT_FLAG_COMPRESSED |
128 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
129 	}, {
130 		.pixfmt = V4L2_PIX_FMT_MPEG1,
131 		.min_buffers = 8,
132 		.max_buffers = 8,
133 		.max_width = 1920,
134 		.max_height = 1080,
135 		.vdec_ops = &vdec_1_ops,
136 		.codec_ops = &codec_mpeg12_ops,
137 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
138 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
139 		.flags = V4L2_FMT_FLAG_COMPRESSED,
140 	}, {
141 		.pixfmt = V4L2_PIX_FMT_MPEG2,
142 		.min_buffers = 8,
143 		.max_buffers = 8,
144 		.max_width = 1920,
145 		.max_height = 1080,
146 		.vdec_ops = &vdec_1_ops,
147 		.codec_ops = &codec_mpeg12_ops,
148 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
149 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
150 		.flags = V4L2_FMT_FLAG_COMPRESSED,
151 	},
152 };
153 
154 static const struct amvdec_format vdec_formats_g12a[] = {
155 	{
156 		.pixfmt = V4L2_PIX_FMT_VP9,
157 		.min_buffers = 16,
158 		.max_buffers = 24,
159 		.max_width = 3840,
160 		.max_height = 2160,
161 		.vdec_ops = &vdec_hevc_ops,
162 		.codec_ops = &codec_vp9_ops,
163 		.firmware_path = "meson/vdec/g12a_vp9.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_H264,
169 		.min_buffers = 2,
170 		.max_buffers = 24,
171 		.max_width = 3840,
172 		.max_height = 2160,
173 		.vdec_ops = &vdec_1_ops,
174 		.codec_ops = &codec_h264_ops,
175 		.firmware_path = "meson/vdec/g12a_h264.bin",
176 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
177 		.flags = V4L2_FMT_FLAG_COMPRESSED |
178 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
179 	}, {
180 		.pixfmt = V4L2_PIX_FMT_MPEG1,
181 		.min_buffers = 8,
182 		.max_buffers = 8,
183 		.max_width = 1920,
184 		.max_height = 1080,
185 		.vdec_ops = &vdec_1_ops,
186 		.codec_ops = &codec_mpeg12_ops,
187 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
188 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
189 		.flags = V4L2_FMT_FLAG_COMPRESSED,
190 	}, {
191 		.pixfmt = V4L2_PIX_FMT_MPEG2,
192 		.min_buffers = 8,
193 		.max_buffers = 8,
194 		.max_width = 1920,
195 		.max_height = 1080,
196 		.vdec_ops = &vdec_1_ops,
197 		.codec_ops = &codec_mpeg12_ops,
198 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
199 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
200 		.flags = V4L2_FMT_FLAG_COMPRESSED,
201 	},
202 };
203 
204 static const struct amvdec_format vdec_formats_sm1[] = {
205 	{
206 		.pixfmt = V4L2_PIX_FMT_VP9,
207 		.min_buffers = 16,
208 		.max_buffers = 24,
209 		.max_width = 3840,
210 		.max_height = 2160,
211 		.vdec_ops = &vdec_hevc_ops,
212 		.codec_ops = &codec_vp9_ops,
213 		.firmware_path = "meson/vdec/sm1_vp9_mmu.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_H264,
219 		.min_buffers = 2,
220 		.max_buffers = 24,
221 		.max_width = 3840,
222 		.max_height = 2160,
223 		.vdec_ops = &vdec_1_ops,
224 		.codec_ops = &codec_h264_ops,
225 		.firmware_path = "meson/vdec/g12a_h264.bin",
226 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, 0 },
227 		.flags = V4L2_FMT_FLAG_COMPRESSED |
228 			 V4L2_FMT_FLAG_DYN_RESOLUTION,
229 	}, {
230 		.pixfmt = V4L2_PIX_FMT_MPEG1,
231 		.min_buffers = 8,
232 		.max_buffers = 8,
233 		.max_width = 1920,
234 		.max_height = 1080,
235 		.vdec_ops = &vdec_1_ops,
236 		.codec_ops = &codec_mpeg12_ops,
237 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
238 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
239 		.flags = V4L2_FMT_FLAG_COMPRESSED,
240 	}, {
241 		.pixfmt = V4L2_PIX_FMT_MPEG2,
242 		.min_buffers = 8,
243 		.max_buffers = 8,
244 		.max_width = 1920,
245 		.max_height = 1080,
246 		.vdec_ops = &vdec_1_ops,
247 		.codec_ops = &codec_mpeg12_ops,
248 		.firmware_path = "meson/vdec/gxl_mpeg12.bin",
249 		.pixfmts_cap = { V4L2_PIX_FMT_NV12M, V4L2_PIX_FMT_YUV420M, 0 },
250 		.flags = V4L2_FMT_FLAG_COMPRESSED,
251 	},
252 };
253 
254 const struct vdec_platform vdec_platform_gxbb = {
255 	.formats = vdec_formats_gxbb,
256 	.num_formats = ARRAY_SIZE(vdec_formats_gxbb),
257 	.revision = VDEC_REVISION_GXBB,
258 };
259 
260 const struct vdec_platform vdec_platform_gxl = {
261 	.formats = vdec_formats_gxl,
262 	.num_formats = ARRAY_SIZE(vdec_formats_gxl),
263 	.revision = VDEC_REVISION_GXL,
264 };
265 
266 const struct vdec_platform vdec_platform_gxm = {
267 	.formats = vdec_formats_gxm,
268 	.num_formats = ARRAY_SIZE(vdec_formats_gxm),
269 	.revision = VDEC_REVISION_GXM,
270 };
271 
272 const struct vdec_platform vdec_platform_g12a = {
273 	.formats = vdec_formats_g12a,
274 	.num_formats = ARRAY_SIZE(vdec_formats_g12a),
275 	.revision = VDEC_REVISION_G12A,
276 };
277 
278 const struct vdec_platform vdec_platform_sm1 = {
279 	.formats = vdec_formats_sm1,
280 	.num_formats = ARRAY_SIZE(vdec_formats_sm1),
281 	.revision = VDEC_REVISION_SM1,
282 };
283