1 // SPDX-License-Identifier: GPL-2.0
3 * Hantro VPU codec driver
5 * Copyright (C) 2018 Rockchip Electronics Co., Ltd.
6 * Jeffy Chen <jeffy.chen@rock-chips.com>
12 #include "hantro_jpeg.h"
13 #include "hantro_g1_regs.h"
14 #include "hantro_h1_regs.h"
15 #include "rockchip_vpu2_regs.h"
17 #define RK3066_ACLK_MAX_FREQ (300 * 1000 * 1000)
18 #define RK3288_ACLK_MAX_FREQ (400 * 1000 * 1000)
24 static const struct hantro_fmt rockchip_vpu_enc_fmts[] = {
26 .fourcc = V4L2_PIX_FMT_YUV420M,
27 .codec_mode = HANTRO_MODE_NONE,
28 .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420P,
31 .fourcc = V4L2_PIX_FMT_NV12M,
32 .codec_mode = HANTRO_MODE_NONE,
33 .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUV420SP,
36 .fourcc = V4L2_PIX_FMT_YUYV,
37 .codec_mode = HANTRO_MODE_NONE,
38 .enc_fmt = ROCKCHIP_VPU_ENC_FMT_YUYV422,
41 .fourcc = V4L2_PIX_FMT_UYVY,
42 .codec_mode = HANTRO_MODE_NONE,
43 .enc_fmt = ROCKCHIP_VPU_ENC_FMT_UYVY422,
46 .fourcc = V4L2_PIX_FMT_JPEG,
47 .codec_mode = HANTRO_MODE_JPEG_ENC,
49 .header_size = JPEG_HEADER_SIZE,
56 .step_height = MB_DIM,
61 static const struct hantro_fmt rockchip_vpu1_postproc_fmts[] = {
63 .fourcc = V4L2_PIX_FMT_YUYV,
64 .codec_mode = HANTRO_MODE_NONE,
65 .postprocessed = true,
67 .min_width = FMT_MIN_WIDTH,
68 .max_width = FMT_FHD_WIDTH,
70 .min_height = FMT_MIN_HEIGHT,
71 .max_height = FMT_FHD_HEIGHT,
72 .step_height = MB_DIM,
77 static const struct hantro_fmt rk3066_vpu_dec_fmts[] = {
79 .fourcc = V4L2_PIX_FMT_NV12,
80 .codec_mode = HANTRO_MODE_NONE,
82 .min_width = FMT_MIN_WIDTH,
83 .max_width = FMT_FHD_WIDTH,
85 .min_height = FMT_MIN_HEIGHT,
86 .max_height = FMT_FHD_HEIGHT,
87 .step_height = MB_DIM,
91 .fourcc = V4L2_PIX_FMT_H264_SLICE,
92 .codec_mode = HANTRO_MODE_H264_DEC,
95 .min_width = FMT_MIN_WIDTH,
96 .max_width = FMT_FHD_WIDTH,
98 .min_height = FMT_MIN_HEIGHT,
99 .max_height = FMT_FHD_HEIGHT,
100 .step_height = MB_DIM,
104 .fourcc = V4L2_PIX_FMT_MPEG2_SLICE,
105 .codec_mode = HANTRO_MODE_MPEG2_DEC,
108 .min_width = FMT_MIN_WIDTH,
109 .max_width = FMT_FHD_WIDTH,
110 .step_width = MB_DIM,
111 .min_height = FMT_MIN_HEIGHT,
112 .max_height = FMT_FHD_HEIGHT,
113 .step_height = MB_DIM,
117 .fourcc = V4L2_PIX_FMT_VP8_FRAME,
118 .codec_mode = HANTRO_MODE_VP8_DEC,
121 .min_width = FMT_MIN_WIDTH,
122 .max_width = FMT_FHD_WIDTH,
123 .step_width = MB_DIM,
124 .min_height = FMT_MIN_HEIGHT,
125 .max_height = FMT_FHD_HEIGHT,
126 .step_height = MB_DIM,
131 static const struct hantro_fmt rk3288_vpu_dec_fmts[] = {
133 .fourcc = V4L2_PIX_FMT_NV12,
134 .codec_mode = HANTRO_MODE_NONE,
136 .min_width = FMT_MIN_WIDTH,
137 .max_width = FMT_4K_WIDTH,
138 .step_width = MB_DIM,
139 .min_height = FMT_MIN_HEIGHT,
140 .max_height = FMT_4K_HEIGHT,
141 .step_height = MB_DIM,
145 .fourcc = V4L2_PIX_FMT_H264_SLICE,
146 .codec_mode = HANTRO_MODE_H264_DEC,
149 .min_width = FMT_MIN_WIDTH,
150 .max_width = FMT_4K_WIDTH,
151 .step_width = MB_DIM,
152 .min_height = FMT_MIN_HEIGHT,
153 .max_height = FMT_4K_HEIGHT,
154 .step_height = MB_DIM,
158 .fourcc = V4L2_PIX_FMT_MPEG2_SLICE,
159 .codec_mode = HANTRO_MODE_MPEG2_DEC,
162 .min_width = FMT_MIN_WIDTH,
163 .max_width = FMT_FHD_WIDTH,
164 .step_width = MB_DIM,
165 .min_height = FMT_MIN_HEIGHT,
166 .max_height = FMT_FHD_HEIGHT,
167 .step_height = MB_DIM,
171 .fourcc = V4L2_PIX_FMT_VP8_FRAME,
172 .codec_mode = HANTRO_MODE_VP8_DEC,
175 .min_width = FMT_MIN_WIDTH,
176 .max_width = FMT_UHD_WIDTH,
177 .step_width = MB_DIM,
178 .min_height = FMT_MIN_HEIGHT,
179 .max_height = FMT_UHD_HEIGHT,
180 .step_height = MB_DIM,
185 static const struct hantro_fmt rockchip_vdpu2_dec_fmts[] = {
187 .fourcc = V4L2_PIX_FMT_NV12,
188 .codec_mode = HANTRO_MODE_NONE,
190 .min_width = FMT_MIN_WIDTH,
191 .max_width = FMT_FHD_WIDTH,
192 .step_width = MB_DIM,
193 .min_height = FMT_MIN_HEIGHT,
194 .max_height = FMT_FHD_HEIGHT,
195 .step_height = MB_DIM,
199 .fourcc = V4L2_PIX_FMT_H264_SLICE,
200 .codec_mode = HANTRO_MODE_H264_DEC,
203 .min_width = FMT_MIN_WIDTH,
204 .max_width = FMT_FHD_WIDTH,
205 .step_width = MB_DIM,
206 .min_height = FMT_MIN_HEIGHT,
207 .max_height = FMT_FHD_HEIGHT,
208 .step_height = MB_DIM,
212 .fourcc = V4L2_PIX_FMT_MPEG2_SLICE,
213 .codec_mode = HANTRO_MODE_MPEG2_DEC,
216 .min_width = FMT_MIN_WIDTH,
217 .max_width = FMT_FHD_WIDTH,
218 .step_width = MB_DIM,
219 .min_height = FMT_MIN_HEIGHT,
220 .max_height = FMT_FHD_HEIGHT,
221 .step_height = MB_DIM,
225 .fourcc = V4L2_PIX_FMT_VP8_FRAME,
226 .codec_mode = HANTRO_MODE_VP8_DEC,
229 .min_width = FMT_MIN_WIDTH,
230 .max_width = FMT_UHD_WIDTH,
231 .step_width = MB_DIM,
232 .min_height = FMT_MIN_HEIGHT,
233 .max_height = FMT_UHD_HEIGHT,
234 .step_height = MB_DIM,
239 static const struct hantro_fmt rk3399_vpu_dec_fmts[] = {
241 .fourcc = V4L2_PIX_FMT_NV12,
242 .codec_mode = HANTRO_MODE_NONE,
244 .min_width = FMT_MIN_WIDTH,
245 .max_width = FMT_FHD_WIDTH,
246 .step_width = MB_DIM,
247 .min_height = FMT_MIN_HEIGHT,
248 .max_height = FMT_FHD_HEIGHT,
249 .step_height = MB_DIM,
253 .fourcc = V4L2_PIX_FMT_MPEG2_SLICE,
254 .codec_mode = HANTRO_MODE_MPEG2_DEC,
257 .min_width = FMT_MIN_WIDTH,
258 .max_width = FMT_FHD_WIDTH,
259 .step_width = MB_DIM,
260 .min_height = FMT_MIN_HEIGHT,
261 .max_height = FMT_FHD_HEIGHT,
262 .step_height = MB_DIM,
266 .fourcc = V4L2_PIX_FMT_VP8_FRAME,
267 .codec_mode = HANTRO_MODE_VP8_DEC,
270 .min_width = FMT_MIN_WIDTH,
271 .max_width = FMT_UHD_WIDTH,
272 .step_width = MB_DIM,
273 .min_height = FMT_MIN_HEIGHT,
274 .max_height = FMT_UHD_HEIGHT,
275 .step_height = MB_DIM,
280 static irqreturn_t rockchip_vpu1_vepu_irq(int irq, void *dev_id)
282 struct hantro_dev *vpu = dev_id;
283 enum vb2_buffer_state state;
286 status = vepu_read(vpu, H1_REG_INTERRUPT);
287 state = (status & H1_REG_INTERRUPT_FRAME_RDY) ?
288 VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
290 vepu_write(vpu, 0, H1_REG_INTERRUPT);
291 vepu_write(vpu, 0, H1_REG_AXI_CTRL);
293 hantro_irq_done(vpu, state);
298 static irqreturn_t rockchip_vpu2_vdpu_irq(int irq, void *dev_id)
300 struct hantro_dev *vpu = dev_id;
301 enum vb2_buffer_state state;
304 status = vdpu_read(vpu, VDPU_REG_INTERRUPT);
305 state = (status & VDPU_REG_INTERRUPT_DEC_IRQ) ?
306 VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
308 vdpu_write(vpu, 0, VDPU_REG_INTERRUPT);
309 vdpu_write(vpu, 0, VDPU_REG_AXI_CTRL);
311 hantro_irq_done(vpu, state);
316 static irqreturn_t rockchip_vpu2_vepu_irq(int irq, void *dev_id)
318 struct hantro_dev *vpu = dev_id;
319 enum vb2_buffer_state state;
322 status = vepu_read(vpu, VEPU_REG_INTERRUPT);
323 state = (status & VEPU_REG_INTERRUPT_FRAME_READY) ?
324 VB2_BUF_STATE_DONE : VB2_BUF_STATE_ERROR;
326 vepu_write(vpu, 0, VEPU_REG_INTERRUPT);
327 vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
329 hantro_irq_done(vpu, state);
334 static int rk3036_vpu_hw_init(struct hantro_dev *vpu)
336 /* Bump ACLK to max. possible freq. to improve performance. */
337 clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ);
341 static int rk3066_vpu_hw_init(struct hantro_dev *vpu)
343 /* Bump ACLKs to max. possible freq. to improve performance. */
344 clk_set_rate(vpu->clocks[0].clk, RK3066_ACLK_MAX_FREQ);
345 clk_set_rate(vpu->clocks[2].clk, RK3066_ACLK_MAX_FREQ);
349 static int rockchip_vpu_hw_init(struct hantro_dev *vpu)
351 /* Bump ACLK to max. possible freq. to improve performance. */
352 clk_set_rate(vpu->clocks[0].clk, RK3288_ACLK_MAX_FREQ);
356 static void rk3066_vpu_dec_reset(struct hantro_ctx *ctx)
358 struct hantro_dev *vpu = ctx->dev;
360 vdpu_write(vpu, G1_REG_INTERRUPT_DEC_IRQ_DIS, G1_REG_INTERRUPT);
361 vdpu_write(vpu, G1_REG_CONFIG_DEC_CLK_GATE_E, G1_REG_CONFIG);
364 static void rockchip_vpu1_enc_reset(struct hantro_ctx *ctx)
366 struct hantro_dev *vpu = ctx->dev;
368 vepu_write(vpu, H1_REG_INTERRUPT_DIS_BIT, H1_REG_INTERRUPT);
369 vepu_write(vpu, 0, H1_REG_ENC_CTRL);
370 vepu_write(vpu, 0, H1_REG_AXI_CTRL);
373 static void rockchip_vpu2_dec_reset(struct hantro_ctx *ctx)
375 struct hantro_dev *vpu = ctx->dev;
377 vdpu_write(vpu, VDPU_REG_INTERRUPT_DEC_IRQ_DIS, VDPU_REG_INTERRUPT);
378 vdpu_write(vpu, 0, VDPU_REG_EN_FLAGS);
379 vdpu_write(vpu, 1, VDPU_REG_SOFT_RESET);
382 static void rockchip_vpu2_enc_reset(struct hantro_ctx *ctx)
384 struct hantro_dev *vpu = ctx->dev;
386 vepu_write(vpu, VEPU_REG_INTERRUPT_DIS_BIT, VEPU_REG_INTERRUPT);
387 vepu_write(vpu, 0, VEPU_REG_ENCODE_START);
388 vepu_write(vpu, 0, VEPU_REG_AXI_CTRL);
392 * Supported codec ops.
394 static const struct hantro_codec_ops rk3036_vpu_codec_ops[] = {
395 [HANTRO_MODE_H264_DEC] = {
396 .run = hantro_g1_h264_dec_run,
397 .reset = hantro_g1_reset,
398 .init = hantro_h264_dec_init,
399 .exit = hantro_h264_dec_exit,
401 [HANTRO_MODE_MPEG2_DEC] = {
402 .run = hantro_g1_mpeg2_dec_run,
403 .reset = hantro_g1_reset,
404 .init = hantro_mpeg2_dec_init,
405 .exit = hantro_mpeg2_dec_exit,
407 [HANTRO_MODE_VP8_DEC] = {
408 .run = hantro_g1_vp8_dec_run,
409 .reset = hantro_g1_reset,
410 .init = hantro_vp8_dec_init,
411 .exit = hantro_vp8_dec_exit,
415 static const struct hantro_codec_ops rk3066_vpu_codec_ops[] = {
416 [HANTRO_MODE_JPEG_ENC] = {
417 .run = hantro_h1_jpeg_enc_run,
418 .reset = rockchip_vpu1_enc_reset,
419 .done = hantro_h1_jpeg_enc_done,
421 [HANTRO_MODE_H264_DEC] = {
422 .run = hantro_g1_h264_dec_run,
423 .reset = rk3066_vpu_dec_reset,
424 .init = hantro_h264_dec_init,
425 .exit = hantro_h264_dec_exit,
427 [HANTRO_MODE_MPEG2_DEC] = {
428 .run = hantro_g1_mpeg2_dec_run,
429 .reset = rk3066_vpu_dec_reset,
430 .init = hantro_mpeg2_dec_init,
431 .exit = hantro_mpeg2_dec_exit,
433 [HANTRO_MODE_VP8_DEC] = {
434 .run = hantro_g1_vp8_dec_run,
435 .reset = rk3066_vpu_dec_reset,
436 .init = hantro_vp8_dec_init,
437 .exit = hantro_vp8_dec_exit,
441 static const struct hantro_codec_ops rk3288_vpu_codec_ops[] = {
442 [HANTRO_MODE_JPEG_ENC] = {
443 .run = hantro_h1_jpeg_enc_run,
444 .reset = rockchip_vpu1_enc_reset,
445 .done = hantro_h1_jpeg_enc_done,
447 [HANTRO_MODE_H264_DEC] = {
448 .run = hantro_g1_h264_dec_run,
449 .reset = hantro_g1_reset,
450 .init = hantro_h264_dec_init,
451 .exit = hantro_h264_dec_exit,
453 [HANTRO_MODE_MPEG2_DEC] = {
454 .run = hantro_g1_mpeg2_dec_run,
455 .reset = hantro_g1_reset,
456 .init = hantro_mpeg2_dec_init,
457 .exit = hantro_mpeg2_dec_exit,
459 [HANTRO_MODE_VP8_DEC] = {
460 .run = hantro_g1_vp8_dec_run,
461 .reset = hantro_g1_reset,
462 .init = hantro_vp8_dec_init,
463 .exit = hantro_vp8_dec_exit,
467 static const struct hantro_codec_ops rk3399_vpu_codec_ops[] = {
468 [HANTRO_MODE_JPEG_ENC] = {
469 .run = rockchip_vpu2_jpeg_enc_run,
470 .reset = rockchip_vpu2_enc_reset,
471 .done = rockchip_vpu2_jpeg_enc_done,
473 [HANTRO_MODE_H264_DEC] = {
474 .run = rockchip_vpu2_h264_dec_run,
475 .reset = rockchip_vpu2_dec_reset,
476 .init = hantro_h264_dec_init,
477 .exit = hantro_h264_dec_exit,
479 [HANTRO_MODE_MPEG2_DEC] = {
480 .run = rockchip_vpu2_mpeg2_dec_run,
481 .reset = rockchip_vpu2_dec_reset,
482 .init = hantro_mpeg2_dec_init,
483 .exit = hantro_mpeg2_dec_exit,
485 [HANTRO_MODE_VP8_DEC] = {
486 .run = rockchip_vpu2_vp8_dec_run,
487 .reset = rockchip_vpu2_dec_reset,
488 .init = hantro_vp8_dec_init,
489 .exit = hantro_vp8_dec_exit,
493 static const struct hantro_codec_ops rk3568_vepu_codec_ops[] = {
494 [HANTRO_MODE_JPEG_ENC] = {
495 .run = rockchip_vpu2_jpeg_enc_run,
496 .reset = rockchip_vpu2_enc_reset,
497 .done = rockchip_vpu2_jpeg_enc_done,
505 static const struct hantro_irq rockchip_vdpu1_irqs[] = {
506 { "vdpu", hantro_g1_irq },
509 static const struct hantro_irq rockchip_vpu1_irqs[] = {
510 { "vepu", rockchip_vpu1_vepu_irq },
511 { "vdpu", hantro_g1_irq },
514 static const struct hantro_irq rockchip_vdpu2_irqs[] = {
515 { "vdpu", rockchip_vpu2_vdpu_irq },
518 static const struct hantro_irq rockchip_vpu2_irqs[] = {
519 { "vepu", rockchip_vpu2_vepu_irq },
520 { "vdpu", rockchip_vpu2_vdpu_irq },
523 static const struct hantro_irq rk3568_vepu_irqs[] = {
524 { "vepu", rockchip_vpu2_vepu_irq },
527 static const char * const rk3066_vpu_clk_names[] = {
528 "aclk_vdpu", "hclk_vdpu",
529 "aclk_vepu", "hclk_vepu"
532 static const char * const rockchip_vpu_clk_names[] = {
538 const struct hantro_variant rk3036_vpu_variant = {
540 .dec_fmts = rk3066_vpu_dec_fmts,
541 .num_dec_fmts = ARRAY_SIZE(rk3066_vpu_dec_fmts),
542 .postproc_fmts = rockchip_vpu1_postproc_fmts,
543 .num_postproc_fmts = ARRAY_SIZE(rockchip_vpu1_postproc_fmts),
544 .postproc_ops = &hantro_g1_postproc_ops,
545 .codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
547 .codec_ops = rk3036_vpu_codec_ops,
548 .irqs = rockchip_vdpu1_irqs,
549 .num_irqs = ARRAY_SIZE(rockchip_vdpu1_irqs),
550 .init = rk3036_vpu_hw_init,
551 .clk_names = rockchip_vpu_clk_names,
552 .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
556 * Despite this variant has separate clocks for decoder and encoder,
557 * it's still required to enable all four of them for either decoding
558 * or encoding and we can't split it in separate g1/h1 variants.
560 const struct hantro_variant rk3066_vpu_variant = {
562 .enc_fmts = rockchip_vpu_enc_fmts,
563 .num_enc_fmts = ARRAY_SIZE(rockchip_vpu_enc_fmts),
565 .dec_fmts = rk3066_vpu_dec_fmts,
566 .num_dec_fmts = ARRAY_SIZE(rk3066_vpu_dec_fmts),
567 .postproc_fmts = rockchip_vpu1_postproc_fmts,
568 .num_postproc_fmts = ARRAY_SIZE(rockchip_vpu1_postproc_fmts),
569 .postproc_ops = &hantro_g1_postproc_ops,
570 .codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER |
571 HANTRO_VP8_DECODER | HANTRO_H264_DECODER,
572 .codec_ops = rk3066_vpu_codec_ops,
573 .irqs = rockchip_vpu1_irqs,
574 .num_irqs = ARRAY_SIZE(rockchip_vpu1_irqs),
575 .init = rk3066_vpu_hw_init,
576 .clk_names = rk3066_vpu_clk_names,
577 .num_clocks = ARRAY_SIZE(rk3066_vpu_clk_names)
580 const struct hantro_variant rk3288_vpu_variant = {
582 .enc_fmts = rockchip_vpu_enc_fmts,
583 .num_enc_fmts = ARRAY_SIZE(rockchip_vpu_enc_fmts),
585 .dec_fmts = rk3288_vpu_dec_fmts,
586 .num_dec_fmts = ARRAY_SIZE(rk3288_vpu_dec_fmts),
587 .postproc_fmts = rockchip_vpu1_postproc_fmts,
588 .num_postproc_fmts = ARRAY_SIZE(rockchip_vpu1_postproc_fmts),
589 .postproc_ops = &hantro_g1_postproc_ops,
590 .codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER |
591 HANTRO_VP8_DECODER | HANTRO_H264_DECODER,
592 .codec_ops = rk3288_vpu_codec_ops,
593 .irqs = rockchip_vpu1_irqs,
594 .num_irqs = ARRAY_SIZE(rockchip_vpu1_irqs),
595 .init = rockchip_vpu_hw_init,
596 .clk_names = rockchip_vpu_clk_names,
597 .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
602 const struct hantro_variant rk3328_vpu_variant = {
604 .dec_fmts = rockchip_vdpu2_dec_fmts,
605 .num_dec_fmts = ARRAY_SIZE(rockchip_vdpu2_dec_fmts),
606 .codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
608 .codec_ops = rk3399_vpu_codec_ops,
609 .irqs = rockchip_vdpu2_irqs,
610 .num_irqs = ARRAY_SIZE(rockchip_vdpu2_irqs),
611 .init = rockchip_vpu_hw_init,
612 .clk_names = rockchip_vpu_clk_names,
613 .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names),
617 * H.264 decoding explicitly disabled in RK3399.
618 * This ensures userspace applications use the Rockchip VDEC core,
619 * which has better performance.
621 const struct hantro_variant rk3399_vpu_variant = {
623 .enc_fmts = rockchip_vpu_enc_fmts,
624 .num_enc_fmts = ARRAY_SIZE(rockchip_vpu_enc_fmts),
626 .dec_fmts = rk3399_vpu_dec_fmts,
627 .num_dec_fmts = ARRAY_SIZE(rk3399_vpu_dec_fmts),
628 .codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER |
630 .codec_ops = rk3399_vpu_codec_ops,
631 .irqs = rockchip_vpu2_irqs,
632 .num_irqs = ARRAY_SIZE(rockchip_vpu2_irqs),
633 .init = rockchip_vpu_hw_init,
634 .clk_names = rockchip_vpu_clk_names,
635 .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
638 const struct hantro_variant rk3568_vepu_variant = {
640 .enc_fmts = rockchip_vpu_enc_fmts,
641 .num_enc_fmts = ARRAY_SIZE(rockchip_vpu_enc_fmts),
642 .codec = HANTRO_JPEG_ENCODER,
643 .codec_ops = rk3568_vepu_codec_ops,
644 .irqs = rk3568_vepu_irqs,
645 .num_irqs = ARRAY_SIZE(rk3568_vepu_irqs),
646 .init = rockchip_vpu_hw_init,
647 .clk_names = rockchip_vpu_clk_names,
648 .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
651 const struct hantro_variant rk3568_vpu_variant = {
653 .dec_fmts = rockchip_vdpu2_dec_fmts,
654 .num_dec_fmts = ARRAY_SIZE(rockchip_vdpu2_dec_fmts),
655 .codec = HANTRO_MPEG2_DECODER |
656 HANTRO_VP8_DECODER | HANTRO_H264_DECODER,
657 .codec_ops = rk3399_vpu_codec_ops,
658 .irqs = rockchip_vdpu2_irqs,
659 .num_irqs = ARRAY_SIZE(rockchip_vdpu2_irqs),
660 .init = rockchip_vpu_hw_init,
661 .clk_names = rockchip_vpu_clk_names,
662 .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)
665 const struct hantro_variant px30_vpu_variant = {
667 .enc_fmts = rockchip_vpu_enc_fmts,
668 .num_enc_fmts = ARRAY_SIZE(rockchip_vpu_enc_fmts),
670 .dec_fmts = rockchip_vdpu2_dec_fmts,
671 .num_dec_fmts = ARRAY_SIZE(rockchip_vdpu2_dec_fmts),
672 .codec = HANTRO_JPEG_ENCODER | HANTRO_MPEG2_DECODER |
673 HANTRO_VP8_DECODER | HANTRO_H264_DECODER,
674 .codec_ops = rk3399_vpu_codec_ops,
675 .irqs = rockchip_vpu2_irqs,
676 .num_irqs = ARRAY_SIZE(rockchip_vpu2_irqs),
677 .init = rk3036_vpu_hw_init,
678 .clk_names = rockchip_vpu_clk_names,
679 .num_clocks = ARRAY_SIZE(rockchip_vpu_clk_names)