Mention branches and keyring.
[releases.git] / hantro / sama5d4_vdec_hw.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Hantro VDEC driver
4  *
5  * Copyright (C) 2021 Collabora Ltd, Emil Velikov <emil.velikov@collabora.com>
6  */
7
8 #include "hantro.h"
9
10 /*
11  * Supported formats.
12  */
13
14 static const struct hantro_fmt sama5d4_vdec_postproc_fmts[] = {
15         {
16                 .fourcc = V4L2_PIX_FMT_YUYV,
17                 .codec_mode = HANTRO_MODE_NONE,
18                 .postprocessed = true,
19         },
20 };
21
22 static const struct hantro_fmt sama5d4_vdec_fmts[] = {
23         {
24                 .fourcc = V4L2_PIX_FMT_NV12,
25                 .codec_mode = HANTRO_MODE_NONE,
26         },
27         {
28                 .fourcc = V4L2_PIX_FMT_MPEG2_SLICE,
29                 .codec_mode = HANTRO_MODE_MPEG2_DEC,
30                 .max_depth = 2,
31                 .frmsize = {
32                         .min_width = 48,
33                         .max_width = 1280,
34                         .step_width = MB_DIM,
35                         .min_height = 48,
36                         .max_height = 720,
37                         .step_height = MB_DIM,
38                 },
39         },
40         {
41                 .fourcc = V4L2_PIX_FMT_VP8_FRAME,
42                 .codec_mode = HANTRO_MODE_VP8_DEC,
43                 .max_depth = 2,
44                 .frmsize = {
45                         .min_width = 48,
46                         .max_width = 1280,
47                         .step_width = MB_DIM,
48                         .min_height = 48,
49                         .max_height = 720,
50                         .step_height = MB_DIM,
51                 },
52         },
53         {
54                 .fourcc = V4L2_PIX_FMT_H264_SLICE,
55                 .codec_mode = HANTRO_MODE_H264_DEC,
56                 .max_depth = 2,
57                 .frmsize = {
58                         .min_width = 48,
59                         .max_width = 1280,
60                         .step_width = MB_DIM,
61                         .min_height = 48,
62                         .max_height = 720,
63                         .step_height = MB_DIM,
64                 },
65         },
66 };
67
68 /*
69  * Supported codec ops.
70  */
71
72 static const struct hantro_codec_ops sama5d4_vdec_codec_ops[] = {
73         [HANTRO_MODE_MPEG2_DEC] = {
74                 .run = hantro_g1_mpeg2_dec_run,
75                 .reset = hantro_g1_reset,
76                 .init = hantro_mpeg2_dec_init,
77                 .exit = hantro_mpeg2_dec_exit,
78         },
79         [HANTRO_MODE_VP8_DEC] = {
80                 .run = hantro_g1_vp8_dec_run,
81                 .reset = hantro_g1_reset,
82                 .init = hantro_vp8_dec_init,
83                 .exit = hantro_vp8_dec_exit,
84         },
85         [HANTRO_MODE_H264_DEC] = {
86                 .run = hantro_g1_h264_dec_run,
87                 .reset = hantro_g1_reset,
88                 .init = hantro_h264_dec_init,
89                 .exit = hantro_h264_dec_exit,
90         },
91 };
92
93 static const struct hantro_irq sama5d4_irqs[] = {
94         { "vdec", hantro_g1_irq },
95 };
96
97 static const char * const sama5d4_clk_names[] = { "vdec_clk" };
98
99 const struct hantro_variant sama5d4_vdec_variant = {
100         .dec_fmts = sama5d4_vdec_fmts,
101         .num_dec_fmts = ARRAY_SIZE(sama5d4_vdec_fmts),
102         .postproc_fmts = sama5d4_vdec_postproc_fmts,
103         .num_postproc_fmts = ARRAY_SIZE(sama5d4_vdec_postproc_fmts),
104         .postproc_ops = &hantro_g1_postproc_ops,
105         .codec = HANTRO_MPEG2_DECODER | HANTRO_VP8_DECODER |
106                  HANTRO_H264_DECODER,
107         .codec_ops = sama5d4_vdec_codec_ops,
108         .irqs = sama5d4_irqs,
109         .num_irqs = ARRAY_SIZE(sama5d4_irqs),
110         .clk_names = sama5d4_clk_names,
111         .num_clocks = ARRAY_SIZE(sama5d4_clk_names),
112 };