xref: /linux/drivers/media/platform/qcom/venus/hfi_platform_v6.c (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3  * Copyright (c) 2020, The Linux Foundation. All rights reserved.
4  */
5 #include "hfi_platform.h"
6 
7 static const struct hfi_plat_caps caps[] = {
8 {
9 	.codec = HFI_VIDEO_CODEC_H264,
10 	.domain = VIDC_SESSION_TYPE_DEC,
11 	.cap_bufs_mode_dynamic = true,
12 	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 8192, 1},
13 	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 8192, 1},
14 	/* ((5760 * 2880) / 256) */
15 	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 138240, 1},
16 	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 220000000, 1},
17 	.caps[4] = {HFI_CAPABILITY_SCALE_X, 65536, 65536, 1},
18 	.caps[5] = {HFI_CAPABILITY_SCALE_Y, 65536, 65536, 1},
19 	.caps[6] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 7833600, 1},
20 	.caps[7] = {HFI_CAPABILITY_FRAMERATE, 1, 960, 1},
21 	.caps[8] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
22 	.num_caps = 9,
23 	.pl[0] = {HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_52},
24 	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_52},
25 	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_52},
26 	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_52},
27 	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_52},
28 	.num_pl = 5,
29 	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
30 	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
31 	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
32 	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
33 	.num_fmts = 4,
34 }, {
35 	.codec = HFI_VIDEO_CODEC_HEVC,
36 	.domain = VIDC_SESSION_TYPE_DEC,
37 	.cap_bufs_mode_dynamic = true,
38 	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 8192, 1},
39 	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 8192, 1},
40 	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 138240, 1},
41 	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 220000000, 1},
42 	.caps[4] = {HFI_CAPABILITY_SCALE_X, 65536, 65536, 1},
43 	.caps[5] = {HFI_CAPABILITY_SCALE_Y, 65536, 65536, 1},
44 	.caps[6] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 7833600, 1},
45 	.caps[7] = {HFI_CAPABILITY_FRAMERATE, 1, 960, 1},
46 	.caps[8] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
47 	.caps[9] = {HFI_CAPABILITY_MAX_WORKMODES, 1, 3, 1},
48 	.num_caps = 10,
49 	.pl[0] = {HFI_HEVC_PROFILE_MAIN, HFI_HEVC_LEVEL_6 | HFI_HEVC_TIER_HIGH0},
50 	.pl[1] = {HFI_HEVC_PROFILE_MAIN10, HFI_HEVC_LEVEL_6 | HFI_HEVC_TIER_HIGH0},
51 	.num_pl = 2,
52 	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
53 	.fmts[1] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_YUV420_TP10_UBWC},
54 	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
55 	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
56 	.fmts[4] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
57 	.fmts[5] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_P010},
58 	.fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10_UBWC},
59 	.num_fmts = 7,
60 }, {
61 	.codec = HFI_VIDEO_CODEC_VP8,
62 	.domain = VIDC_SESSION_TYPE_DEC,
63 	.cap_bufs_mode_dynamic = true,
64 	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 4096, 1},
65 	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 4096, 1},
66 	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 36864, 1},
67 	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 100000000, 1},
68 	.caps[4] = {HFI_CAPABILITY_SCALE_X, 65536, 65536, 1},
69 	.caps[5] = {HFI_CAPABILITY_SCALE_Y, 65536, 65536, 1},
70 	.caps[6] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 4423680, 1},
71 	.caps[7] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
72 	.caps[8] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
73 	.caps[9] = {HFI_CAPABILITY_MAX_WORKMODES, 1, 3, 1},
74 	.num_caps = 10,
75 	.pl[0] = {HFI_VPX_PROFILE_MAIN, HFI_VPX_LEVEL_VERSION_0},
76 	.pl[1] = {HFI_VPX_PROFILE_MAIN, HFI_VPX_LEVEL_VERSION_1},
77 	.pl[2] = {HFI_VPX_PROFILE_MAIN, HFI_VPX_LEVEL_VERSION_2},
78 	.pl[3] = {HFI_VPX_PROFILE_MAIN, HFI_VPX_LEVEL_VERSION_3},
79 	.num_pl = 4,
80 	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
81 	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
82 	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
83 	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
84 	.num_fmts = 4,
85 }, {
86 	.codec = HFI_VIDEO_CODEC_VP9,
87 	.domain = VIDC_SESSION_TYPE_DEC,
88 	.cap_bufs_mode_dynamic = true,
89 	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 8192, 1},
90 	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 8192, 1},
91 	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 138240, 1},
92 	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 220000000, 1},
93 	.caps[4] = {HFI_CAPABILITY_SCALE_X, 65536, 65536, 1},
94 	.caps[5] = {HFI_CAPABILITY_SCALE_Y, 65536, 65536, 1},
95 	.caps[6] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 7833600, 1},
96 	.caps[7] = {HFI_CAPABILITY_FRAMERATE, 1, 960, 1},
97 	.caps[8] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
98 	.caps[9] = {HFI_CAPABILITY_MAX_WORKMODES, 1, 3, 1},
99 	.num_caps = 10,
100 	.pl[0] = {HFI_VP9_PROFILE_P0, 200},
101 	.pl[1] = {HFI_VP9_PROFILE_P2_10B, 200},
102 	.num_pl = 2,
103 	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
104 	.fmts[1] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_YUV420_TP10_UBWC},
105 	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
106 	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
107 	.fmts[4] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
108 	.fmts[5] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_P010},
109 	.fmts[6] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_YUV420_TP10_UBWC},
110 	.num_fmts = 7,
111 }, {
112 	.codec = HFI_VIDEO_CODEC_MPEG2,
113 	.domain = VIDC_SESSION_TYPE_DEC,
114 	.cap_bufs_mode_dynamic = true,
115 	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 1920, 1},
116 	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 1920, 1},
117 	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 8160, 1},
118 	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 40000000, 1},
119 	.caps[4] = {HFI_CAPABILITY_SCALE_X, 65536, 65536, 1},
120 	.caps[5] = {HFI_CAPABILITY_SCALE_Y, 65536, 65536, 1},
121 	.caps[6] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 7833600, 1},
122 	.caps[7] = {HFI_CAPABILITY_FRAMERATE, 1, 30, 1},
123 	.caps[8] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
124 	.caps[9] = {HFI_CAPABILITY_MAX_WORKMODES, 1, 1, 1},
125 	.num_caps = 10,
126 	.pl[0] = {HFI_MPEG2_PROFILE_SIMPLE, HFI_MPEG2_LEVEL_H14},
127 	.pl[1] = {HFI_MPEG2_PROFILE_MAIN, HFI_MPEG2_LEVEL_H14},
128 	.num_pl = 2,
129 	.fmts[0] = {HFI_BUFFER_OUTPUT, HFI_COLOR_FORMAT_NV12_UBWC},
130 	.fmts[1] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12_UBWC},
131 	.fmts[2] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV12},
132 	.fmts[3] = {HFI_BUFFER_OUTPUT2, HFI_COLOR_FORMAT_NV21},
133 	.num_fmts = 4,
134 }, {
135 	.codec = HFI_VIDEO_CODEC_H264,
136 	.domain = VIDC_SESSION_TYPE_ENC,
137 	.cap_bufs_mode_dynamic = true,
138 	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 8192, 1},
139 	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 8192, 1},
140 	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 138240, 1},
141 	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 220000000, 1},
142 	.caps[4] = {HFI_CAPABILITY_SCALE_X, 8192, 65536, 1},
143 	.caps[5] = {HFI_CAPABILITY_SCALE_Y, 8192, 65536, 1},
144 	.caps[6] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 7833600, 1},
145 	.caps[7] = {HFI_CAPABILITY_FRAMERATE, 1, 960, 1},
146 	.caps[8] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
147 	.caps[9] = {HFI_CAPABILITY_PEAKBITRATE, 32000, 160000000, 1},
148 	.caps[10] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS, 0, 6, 1},
149 	.caps[11] = {HFI_CAPABILITY_ENC_LTR_COUNT, 0, 2, 1},
150 	.caps[12] = {HFI_CAPABILITY_LCU_SIZE, 16, 16, 1},
151 	.caps[13] = {HFI_CAPABILITY_BFRAME, 0, 1, 1},
152 	.caps[14] = {HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS, 0, 6, 1},
153 	.caps[15] = {HFI_CAPABILITY_I_FRAME_QP, 0, 51, 1},
154 	.caps[16] = {HFI_CAPABILITY_P_FRAME_QP, 0, 51, 1},
155 	.caps[17] = {HFI_CAPABILITY_B_FRAME_QP, 0, 51, 1},
156 	.caps[18] = {HFI_CAPABILITY_MAX_WORKMODES, 1, 2, 1},
157 	.caps[19] = {HFI_CAPABILITY_RATE_CONTROL_MODES, 0x1000001, 0x1000005, 1},
158 	.caps[20] = {HFI_CAPABILITY_COLOR_SPACE_CONVERSION, 0, 2, 1},
159 	.num_caps = 21,
160 	.pl[0] = {HFI_H264_PROFILE_BASELINE, HFI_H264_LEVEL_52},
161 	.pl[1] = {HFI_H264_PROFILE_MAIN, HFI_H264_LEVEL_52},
162 	.pl[2] = {HFI_H264_PROFILE_HIGH, HFI_H264_LEVEL_52},
163 	.pl[3] = {HFI_H264_PROFILE_CONSTRAINED_BASE, HFI_H264_LEVEL_52},
164 	.pl[4] = {HFI_H264_PROFILE_CONSTRAINED_HIGH, HFI_H264_LEVEL_52},
165 	.num_pl = 5,
166 	.fmts[0] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12},
167 	.fmts[1] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12_UBWC},
168 	.fmts[2] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_YUV420_TP10_UBWC},
169 	.fmts[3] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_P010},
170 	.num_fmts = 4,
171 }, {
172 	.codec = HFI_VIDEO_CODEC_HEVC,
173 	.domain = VIDC_SESSION_TYPE_ENC,
174 	.cap_bufs_mode_dynamic = true,
175 	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 8192, 16},
176 	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 8192, 16},
177 	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 138240, 1},
178 	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 160000000, 1},
179 	.caps[4] = {HFI_CAPABILITY_SCALE_X, 8192, 65536, 1},
180 	.caps[5] = {HFI_CAPABILITY_SCALE_Y, 8192, 65536, 1},
181 	.caps[6] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 7833600, 1},
182 	.caps[7] = {HFI_CAPABILITY_FRAMERATE, 1, 960, 1},
183 	.caps[8] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
184 	.caps[9] = {HFI_CAPABILITY_PEAKBITRATE, 32000, 160000000, 1},
185 	.caps[10] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS, 0, 5, 1},
186 	.caps[11] = {HFI_CAPABILITY_ENC_LTR_COUNT, 0, 2, 1},
187 	.caps[12] = {HFI_CAPABILITY_LCU_SIZE, 32, 32, 1},
188 	.caps[13] = {HFI_CAPABILITY_BFRAME, 0, 1, 1},
189 	.caps[14] = {HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS, 0, 5, 1},
190 	.caps[15] = {HFI_CAPABILITY_I_FRAME_QP, 0, 51, 1},
191 	.caps[16] = {HFI_CAPABILITY_P_FRAME_QP, 0, 51, 1},
192 	.caps[17] = {HFI_CAPABILITY_B_FRAME_QP, 0, 51, 1},
193 	.caps[18] = {HFI_CAPABILITY_MAX_WORKMODES, 1, 2, 1},
194 	.caps[19] = {HFI_CAPABILITY_RATE_CONTROL_MODES, 0x1000001, 0x1000005, 1},
195 	.caps[20] = {HFI_CAPABILITY_COLOR_SPACE_CONVERSION, 0, 2, 1},
196 	.caps[21] = {HFI_CAPABILITY_ROTATION, 1, 4, 90},
197 	.caps[22] = {HFI_CAPABILITY_BLUR_WIDTH, 96, 4096, 16},
198 	.caps[23] = {HFI_CAPABILITY_BLUR_HEIGHT, 96, 4096, 16},
199 	.num_caps = 24,
200 	.pl[0] = {HFI_HEVC_PROFILE_MAIN, HFI_HEVC_LEVEL_6 | HFI_HEVC_TIER_HIGH0},
201 	.pl[1] = {HFI_HEVC_PROFILE_MAIN10, HFI_HEVC_LEVEL_6 | HFI_HEVC_TIER_HIGH0},
202 	.num_pl = 2,
203 	.fmts[0] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12},
204 	.fmts[1] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12_UBWC},
205 	.fmts[2] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_YUV420_TP10_UBWC},
206 	.fmts[3] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_P010},
207 	.num_fmts = 4,
208 }, {
209 	.codec = HFI_VIDEO_CODEC_VP8,
210 	.domain = VIDC_SESSION_TYPE_ENC,
211 	.cap_bufs_mode_dynamic = true,
212 	.caps[0] = {HFI_CAPABILITY_FRAME_WIDTH, 128, 4096, 16},
213 	.caps[1] = {HFI_CAPABILITY_FRAME_HEIGHT, 128, 4096, 16},
214 	.caps[2] = {HFI_CAPABILITY_MBS_PER_FRAME, 64, 36864, 1},
215 	.caps[3] = {HFI_CAPABILITY_BITRATE, 1, 74000000, 1},
216 	.caps[4] = {HFI_CAPABILITY_SCALE_X, 8192, 65536, 1},
217 	.caps[5] = {HFI_CAPABILITY_SCALE_Y, 8192, 65536, 1},
218 	.caps[6] = {HFI_CAPABILITY_MBS_PER_SECOND, 64, 4423680, 1},
219 	.caps[7] = {HFI_CAPABILITY_FRAMERATE, 1, 120, 1},
220 	.caps[8] = {HFI_CAPABILITY_MAX_VIDEOCORES, 0, 1, 1},
221 	.caps[9] = {HFI_CAPABILITY_PEAKBITRATE, 32000, 160000000, 1},
222 	.caps[10] = {HFI_CAPABILITY_HIER_P_NUM_ENH_LAYERS, 0, 3, 1},
223 	.caps[11] = {HFI_CAPABILITY_ENC_LTR_COUNT, 0, 2, 1},
224 	.caps[12] = {HFI_CAPABILITY_LCU_SIZE, 16, 16, 1},
225 	.caps[13] = {HFI_CAPABILITY_BFRAME, 0, 0, 1},
226 	.caps[14] = {HFI_CAPABILITY_HIER_P_HYBRID_NUM_ENH_LAYERS, 0, 5, 1},
227 	.caps[15] = {HFI_CAPABILITY_I_FRAME_QP, 0, 127, 1},
228 	.caps[16] = {HFI_CAPABILITY_P_FRAME_QP, 0, 127, 1},
229 	.caps[17] = {HFI_CAPABILITY_MAX_WORKMODES, 1, 2, 1},
230 	.caps[18] = {HFI_CAPABILITY_RATE_CONTROL_MODES, 0x1000001, 0x1000005, 1},
231 	.caps[19] = {HFI_CAPABILITY_BLUR_WIDTH, 96, 4096, 16},
232 	.caps[20] = {HFI_CAPABILITY_BLUR_HEIGHT, 96, 4096, 16},
233 	.caps[21] = {HFI_CAPABILITY_COLOR_SPACE_CONVERSION, 0, 2, 1},
234 	.caps[22] = {HFI_CAPABILITY_ROTATION, 1, 4, 90},
235 	.num_caps = 23,
236 	.pl[0] = {HFI_VPX_PROFILE_MAIN, HFI_VPX_LEVEL_VERSION_0},
237 	.pl[1] = {HFI_VPX_PROFILE_MAIN, HFI_VPX_LEVEL_VERSION_1},
238 	.pl[2] = {HFI_VPX_PROFILE_MAIN, HFI_VPX_LEVEL_VERSION_2},
239 	.pl[3] = {HFI_VPX_PROFILE_MAIN, HFI_VPX_LEVEL_VERSION_3},
240 	.num_pl = 4,
241 	.fmts[0] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12},
242 	.fmts[1] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_NV12_UBWC},
243 	.fmts[2] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_YUV420_TP10_UBWC},
244 	.fmts[3] = {HFI_BUFFER_INPUT, HFI_COLOR_FORMAT_P010},
245 	.num_fmts = 4,
246 } };
247 
get_capabilities(unsigned int * entries)248 static const struct hfi_plat_caps *get_capabilities(unsigned int *entries)
249 {
250 	*entries = ARRAY_SIZE(caps);
251 	return caps;
252 }
253 
get_codecs(u32 * enc_codecs,u32 * dec_codecs,u32 * count)254 static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count)
255 {
256 	*enc_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
257 		      HFI_VIDEO_CODEC_VP8;
258 	*dec_codecs = HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC |
259 		      HFI_VIDEO_CODEC_VP8 | HFI_VIDEO_CODEC_VP9 |
260 		      HFI_VIDEO_CODEC_MPEG2;
261 	*count = 8;
262 }
263 
264 static const struct hfi_platform_codec_freq_data codec_freq_data[] = {
265 	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_ENC, 675, 25, 320 },
266 	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_ENC, 675, 25, 320 },
267 	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_ENC, 675, 60, 320 },
268 	{ V4L2_PIX_FMT_MPEG2, VIDC_SESSION_TYPE_DEC, 200, 25, 200 },
269 	{ V4L2_PIX_FMT_H264, VIDC_SESSION_TYPE_DEC, 200, 25, 200 },
270 	{ V4L2_PIX_FMT_HEVC, VIDC_SESSION_TYPE_DEC, 200, 25, 200 },
271 	{ V4L2_PIX_FMT_VP8, VIDC_SESSION_TYPE_DEC, 200, 60, 200 },
272 	{ V4L2_PIX_FMT_VP9, VIDC_SESSION_TYPE_DEC, 200, 60, 200 },
273 };
274 
275 static const struct hfi_platform_codec_freq_data *
get_codec_freq_data(u32 session_type,u32 pixfmt)276 get_codec_freq_data(u32 session_type, u32 pixfmt)
277 {
278 	const struct hfi_platform_codec_freq_data *data = codec_freq_data;
279 	unsigned int i, data_size = ARRAY_SIZE(codec_freq_data);
280 	const struct hfi_platform_codec_freq_data *found = NULL;
281 
282 	for (i = 0; i < data_size; i++) {
283 		if (data[i].pixfmt == pixfmt && data[i].session_type == session_type) {
284 			found = &data[i];
285 			break;
286 		}
287 	}
288 
289 	return found;
290 }
291 
codec_vpp_freq(u32 session_type,u32 codec)292 static unsigned long codec_vpp_freq(u32 session_type, u32 codec)
293 {
294 	const struct hfi_platform_codec_freq_data *data;
295 
296 	data = get_codec_freq_data(session_type, codec);
297 	if (data)
298 		return data->vpp_freq;
299 
300 	return 0;
301 }
302 
codec_vsp_freq(u32 session_type,u32 codec)303 static unsigned long codec_vsp_freq(u32 session_type, u32 codec)
304 {
305 	const struct hfi_platform_codec_freq_data *data;
306 
307 	data = get_codec_freq_data(session_type, codec);
308 	if (data)
309 		return data->vsp_freq;
310 
311 	return 0;
312 }
313 
codec_lp_freq(u32 session_type,u32 codec)314 static unsigned long codec_lp_freq(u32 session_type, u32 codec)
315 {
316 	const struct hfi_platform_codec_freq_data *data;
317 
318 	data = get_codec_freq_data(session_type, codec);
319 	if (data)
320 		return data->low_power_freq;
321 
322 	return 0;
323 }
324 
325 const struct hfi_platform hfi_plat_v6 = {
326 	.codec_vpp_freq = codec_vpp_freq,
327 	.codec_vsp_freq = codec_vsp_freq,
328 	.codec_lp_freq = codec_lp_freq,
329 	.codecs = get_codecs,
330 	.capabilities = get_capabilities,
331 	.bufreq = hfi_plat_bufreq_v6,
332 };
333