Merge tag 'driver-core-6.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / drivers / media / platform / mediatek / vcodec / decoder / vdec / vdec_vp8_if.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (c) 2016 MediaTek Inc.
4  * Author: Jungchang Tsao <jungchang.tsao@mediatek.com>
5  *         PC Chen <pc.chen@mediatek.com>
6  */
7
8 #include <linux/slab.h>
9 #include "../vdec_drv_if.h"
10 #include "../mtk_vcodec_dec.h"
11 #include "../../common/mtk_vcodec_intr.h"
12 #include "../vdec_vpu_if.h"
13 #include "../vdec_drv_base.h"
14
15 /* Decoding picture buffer size (3 reference frames plus current frame) */
16 #define VP8_DPB_SIZE                    4
17
18 /* HW working buffer size (bytes) */
19 #define VP8_WORKING_BUF_SZ              (45 * 4096)
20
21 /* HW control register address */
22 #define VP8_SEGID_DRAM_ADDR             0x3c
23 #define VP8_HW_VLD_ADDR                 0x93C
24 #define VP8_HW_VLD_VALUE                0x940
25 #define VP8_BSASET                      0x100
26 #define VP8_BSDSET                      0x104
27 #define VP8_RW_CKEN_SET                 0x0
28 #define VP8_RW_DCM_CON                  0x18
29 #define VP8_WO_VLD_SRST                 0x108
30 #define VP8_RW_MISC_SYS_SEL             0x84
31 #define VP8_RW_MISC_SPEC_CON            0xC8
32 #define VP8_WO_VLD_SRST                 0x108
33 #define VP8_RW_VP8_CTRL                 0xA4
34 #define VP8_RW_MISC_DCM_CON             0xEC
35 #define VP8_RW_MISC_SRST                0xF4
36 #define VP8_RW_MISC_FUNC_CON            0xCC
37
38 #define VP8_MAX_FRM_BUF_NUM             5
39 #define VP8_MAX_FRM_BUF_NODE_NUM        (VP8_MAX_FRM_BUF_NUM * 2)
40
41 /* required buffer size (bytes) to store decode information */
42 #define VP8_HW_SEGMENT_DATA_SZ          272
43 #define VP8_HW_SEGMENT_UINT             4
44
45 #define VP8_DEC_TABLE_PROC_LOOP         96
46 #define VP8_DEC_TABLE_UNIT              3
47 #define VP8_DEC_TABLE_SZ                300
48 #define VP8_DEC_TABLE_OFFSET            2
49 #define VP8_DEC_TABLE_RW_UNIT           4
50
51 /**
52  * struct vdec_vp8_dec_info - decode misc information
53  * @working_buf_dma   : working buffer dma address
54  * @prev_y_dma        : previous decoded frame buffer Y plane address
55  * @cur_y_fb_dma      : current plane Y frame buffer dma address
56  * @cur_c_fb_dma      : current plane C frame buffer dma address
57  * @bs_dma            : bitstream dma address
58  * @bs_sz             : bitstream size
59  * @resolution_changed: resolution change flag 1 - changed,  0 - not change
60  * @show_frame        : display this frame or not
61  * @wait_key_frame    : wait key frame coming
62  */
63 struct vdec_vp8_dec_info {
64         uint64_t working_buf_dma;
65         uint64_t prev_y_dma;
66         uint64_t cur_y_fb_dma;
67         uint64_t cur_c_fb_dma;
68         uint64_t bs_dma;
69         uint32_t bs_sz;
70         uint32_t resolution_changed;
71         uint32_t show_frame;
72         uint32_t wait_key_frame;
73 };
74
75 /**
76  * struct vdec_vp8_vsi - VPU shared information
77  * @dec                 : decoding information
78  * @pic                 : picture information
79  * @dec_table           : decoder coefficient table
80  * @segment_buf         : segmentation buffer
81  * @load_data           : flag to indicate reload decode data
82  */
83 struct vdec_vp8_vsi {
84         struct vdec_vp8_dec_info dec;
85         struct vdec_pic_info pic;
86         uint32_t dec_table[VP8_DEC_TABLE_SZ];
87         uint32_t segment_buf[VP8_HW_SEGMENT_DATA_SZ][VP8_HW_SEGMENT_UINT];
88         uint32_t load_data;
89 };
90
91 /**
92  * struct vdec_vp8_hw_reg_base - HW register base
93  * @misc        : base address for misc
94  * @ld          : base address for ld
95  * @top         : base address for top
96  * @cm          : base address for cm
97  * @hwd         : base address for hwd
98  * @hwb         : base address for hwb
99  */
100 struct vdec_vp8_hw_reg_base {
101         void __iomem *misc;
102         void __iomem *ld;
103         void __iomem *top;
104         void __iomem *cm;
105         void __iomem *hwd;
106         void __iomem *hwb;
107 };
108
109 /**
110  * struct vdec_vp8_vpu_inst - VPU instance for VP8 decode
111  * @wq_hd       : Wait queue to wait VPU message ack
112  * @signaled    : 1 - Host has received ack message from VPU, 0 - not receive
113  * @failure     : VPU execution result status 0 - success, others - fail
114  * @inst_addr   : VPU decoder instance address
115  */
116 struct vdec_vp8_vpu_inst {
117         wait_queue_head_t wq_hd;
118         int signaled;
119         int failure;
120         uint32_t inst_addr;
121 };
122
123 /* frame buffer (fb) list
124  * [available_fb_node_list]  - decode fb are initialized to 0 and populated in
125  * [fb_use_list]  - fb is set after decode and is moved to this list
126  * [fb_free_list] - fb is not needed for reference will be moved from
127  *                   [fb_use_list] to [fb_free_list] and
128  *                   once user remove fb from [fb_free_list],
129  *                   it is circulated back to [available_fb_node_list]
130  * [fb_disp_list] - fb is set after decode and is moved to this list
131  *                   once user remove fb from [fb_disp_list] it is
132  *                   circulated back to [available_fb_node_list]
133  */
134
135 /**
136  * struct vdec_vp8_inst - VP8 decoder instance
137  * @cur_fb                 : current frame buffer
138  * @dec_fb                 : decode frame buffer node
139  * @available_fb_node_list : list to store available frame buffer node
140  * @fb_use_list            : list to store frame buffer in use
141  * @fb_free_list           : list to store free frame buffer
142  * @fb_disp_list           : list to store display ready frame buffer
143  * @working_buf            : HW decoder working buffer
144  * @reg_base               : HW register base address
145  * @frm_cnt                : decode frame count
146  * @ctx                    : V4L2 context
147  * @vpu                    : VPU instance for decoder
148  * @vsi                    : VPU share information
149  */
150 struct vdec_vp8_inst {
151         struct vdec_fb *cur_fb;
152         struct vdec_fb_node dec_fb[VP8_MAX_FRM_BUF_NODE_NUM];
153         struct list_head available_fb_node_list;
154         struct list_head fb_use_list;
155         struct list_head fb_free_list;
156         struct list_head fb_disp_list;
157         struct mtk_vcodec_mem working_buf;
158         struct vdec_vp8_hw_reg_base reg_base;
159         unsigned int frm_cnt;
160         struct mtk_vcodec_dec_ctx *ctx;
161         struct vdec_vpu_inst vpu;
162         struct vdec_vp8_vsi *vsi;
163 };
164
165 static void get_hw_reg_base(struct vdec_vp8_inst *inst)
166 {
167         void __iomem **reg_base = inst->ctx->dev->reg_base;
168
169         inst->reg_base.top = mtk_vcodec_get_reg_addr(reg_base, VDEC_TOP);
170         inst->reg_base.cm = mtk_vcodec_get_reg_addr(reg_base, VDEC_CM);
171         inst->reg_base.hwd = mtk_vcodec_get_reg_addr(reg_base, VDEC_HWD);
172         inst->reg_base.misc = mtk_vcodec_get_reg_addr(reg_base, VDEC_MISC);
173         inst->reg_base.ld = mtk_vcodec_get_reg_addr(reg_base, VDEC_LD);
174         inst->reg_base.hwb = mtk_vcodec_get_reg_addr(reg_base, VDEC_HWB);
175 }
176
177 static void write_hw_segmentation_data(struct vdec_vp8_inst *inst)
178 {
179         int i, j;
180         u32 seg_id_addr;
181         u32 val;
182         void __iomem *cm = inst->reg_base.cm;
183         struct vdec_vp8_vsi *vsi = inst->vsi;
184
185         seg_id_addr = readl(inst->reg_base.top + VP8_SEGID_DRAM_ADDR) >> 4;
186
187         for (i = 0; i < ARRAY_SIZE(vsi->segment_buf); i++) {
188                 for (j = ARRAY_SIZE(vsi->segment_buf[i]) - 1; j >= 0; j--) {
189                         val = (1 << 16) + ((seg_id_addr + i) << 2) + j;
190                         writel(val, cm + VP8_HW_VLD_ADDR);
191
192                         val = vsi->segment_buf[i][j];
193                         writel(val, cm + VP8_HW_VLD_VALUE);
194                 }
195         }
196 }
197
198 static void read_hw_segmentation_data(struct vdec_vp8_inst *inst)
199 {
200         int i, j;
201         u32 seg_id_addr;
202         u32 val;
203         void __iomem *cm = inst->reg_base.cm;
204         struct vdec_vp8_vsi *vsi = inst->vsi;
205
206         seg_id_addr = readl(inst->reg_base.top + VP8_SEGID_DRAM_ADDR) >> 4;
207
208         for (i = 0; i < ARRAY_SIZE(vsi->segment_buf); i++) {
209                 for (j = ARRAY_SIZE(vsi->segment_buf[i]) - 1; j >= 0; j--) {
210                         val = ((seg_id_addr + i) << 2) + j;
211                         writel(val, cm + VP8_HW_VLD_ADDR);
212
213                         val = readl(cm + VP8_HW_VLD_VALUE);
214                         vsi->segment_buf[i][j] = val;
215                 }
216         }
217 }
218
219 /* reset HW and enable HW read/write data function */
220 static void enable_hw_rw_function(struct vdec_vp8_inst *inst)
221 {
222         u32 val = 0;
223         void __iomem *misc = inst->reg_base.misc;
224         void __iomem *ld = inst->reg_base.ld;
225         void __iomem *hwb = inst->reg_base.hwb;
226         void __iomem *hwd = inst->reg_base.hwd;
227
228         mtk_vcodec_write_vdecsys(inst->ctx, VP8_RW_CKEN_SET, 0x1);
229         writel(0x101, ld + VP8_WO_VLD_SRST);
230         writel(0x101, hwb + VP8_WO_VLD_SRST);
231
232         mtk_vcodec_write_vdecsys(inst->ctx, 0, 0x1);
233         val = readl(misc + VP8_RW_MISC_SRST);
234         writel((val & 0xFFFFFFFE), misc + VP8_RW_MISC_SRST);
235
236         writel(0x1, misc + VP8_RW_MISC_SYS_SEL);
237         writel(0x17F, misc + VP8_RW_MISC_SPEC_CON);
238         writel(0x71201100, misc + VP8_RW_MISC_FUNC_CON);
239         writel(0x0, ld + VP8_WO_VLD_SRST);
240         writel(0x0, hwb + VP8_WO_VLD_SRST);
241         mtk_vcodec_write_vdecsys(inst->ctx, VP8_RW_DCM_CON, 0x1);
242         writel(0x1, misc + VP8_RW_MISC_DCM_CON);
243         writel(0x1, hwd + VP8_RW_VP8_CTRL);
244 }
245
246 static void store_dec_table(struct vdec_vp8_inst *inst)
247 {
248         int i, j;
249         u32 addr = 0, val = 0;
250         void __iomem *hwd = inst->reg_base.hwd;
251         u32 *p = &inst->vsi->dec_table[VP8_DEC_TABLE_OFFSET];
252
253         for (i = 0; i < VP8_DEC_TABLE_PROC_LOOP; i++) {
254                 writel(addr, hwd + VP8_BSASET);
255                 for (j = 0; j < VP8_DEC_TABLE_UNIT ; j++) {
256                         val = *p++;
257                         writel(val, hwd + VP8_BSDSET);
258                 }
259                 addr += VP8_DEC_TABLE_RW_UNIT;
260         }
261 }
262
263 static void load_dec_table(struct vdec_vp8_inst *inst)
264 {
265         int i;
266         u32 addr = 0;
267         u32 *p = &inst->vsi->dec_table[VP8_DEC_TABLE_OFFSET];
268         void __iomem *hwd = inst->reg_base.hwd;
269
270         for (i = 0; i < VP8_DEC_TABLE_PROC_LOOP; i++) {
271                 writel(addr, hwd + VP8_BSASET);
272                 /* read total 11 bytes */
273                 *p++ = readl(hwd + VP8_BSDSET);
274                 *p++ = readl(hwd + VP8_BSDSET);
275                 *p++ = readl(hwd + VP8_BSDSET) & 0xFFFFFF;
276                 addr += VP8_DEC_TABLE_RW_UNIT;
277         }
278 }
279
280 static void get_pic_info(struct vdec_vp8_inst *inst, struct vdec_pic_info *pic)
281 {
282         *pic = inst->vsi->pic;
283
284         mtk_vdec_debug(inst->ctx, "pic(%d, %d), buf(%d, %d)",
285                        pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h);
286         mtk_vdec_debug(inst->ctx, "fb size: Y(%d), C(%d)",
287                        pic->fb_sz[0], pic->fb_sz[1]);
288 }
289
290 static void vp8_dec_finish(struct vdec_vp8_inst *inst)
291 {
292         struct vdec_fb_node *node;
293         uint64_t prev_y_dma = inst->vsi->dec.prev_y_dma;
294
295         mtk_vdec_debug(inst->ctx, "prev fb base dma=%llx", prev_y_dma);
296
297         /* put last decode ok frame to fb_free_list */
298         if (prev_y_dma != 0) {
299                 list_for_each_entry(node, &inst->fb_use_list, list) {
300                         struct vdec_fb *fb = (struct vdec_fb *)node->fb;
301
302                         if (prev_y_dma == (uint64_t)fb->base_y.dma_addr) {
303                                 list_move_tail(&node->list,
304                                                &inst->fb_free_list);
305                                 break;
306                         }
307                 }
308         }
309
310         /* available_fb_node_list -> fb_use_list */
311         node = list_first_entry(&inst->available_fb_node_list,
312                                 struct vdec_fb_node, list);
313         node->fb = inst->cur_fb;
314         list_move_tail(&node->list, &inst->fb_use_list);
315
316         /* available_fb_node_list -> fb_disp_list */
317         if (inst->vsi->dec.show_frame) {
318                 node = list_first_entry(&inst->available_fb_node_list,
319                                         struct vdec_fb_node, list);
320                 node->fb = inst->cur_fb;
321                 list_move_tail(&node->list, &inst->fb_disp_list);
322         }
323 }
324
325 static void move_fb_list_use_to_free(struct vdec_vp8_inst *inst)
326 {
327         struct vdec_fb_node *node, *tmp;
328
329         list_for_each_entry_safe(node, tmp, &inst->fb_use_list, list)
330                 list_move_tail(&node->list, &inst->fb_free_list);
331 }
332
333 static void init_list(struct vdec_vp8_inst *inst)
334 {
335         int i;
336
337         INIT_LIST_HEAD(&inst->available_fb_node_list);
338         INIT_LIST_HEAD(&inst->fb_use_list);
339         INIT_LIST_HEAD(&inst->fb_free_list);
340         INIT_LIST_HEAD(&inst->fb_disp_list);
341
342         for (i = 0; i < ARRAY_SIZE(inst->dec_fb); i++) {
343                 INIT_LIST_HEAD(&inst->dec_fb[i].list);
344                 inst->dec_fb[i].fb = NULL;
345                 list_add_tail(&inst->dec_fb[i].list,
346                               &inst->available_fb_node_list);
347         }
348 }
349
350 static void add_fb_to_free_list(struct vdec_vp8_inst *inst, void *fb)
351 {
352         struct vdec_fb_node *node;
353
354         if (fb) {
355                 node = list_first_entry(&inst->available_fb_node_list,
356                                         struct vdec_fb_node, list);
357                 node->fb = fb;
358                 list_move_tail(&node->list, &inst->fb_free_list);
359         }
360 }
361
362 static int alloc_working_buf(struct vdec_vp8_inst *inst)
363 {
364         int err;
365         struct mtk_vcodec_mem *mem = &inst->working_buf;
366
367         mem->size = VP8_WORKING_BUF_SZ;
368         err = mtk_vcodec_mem_alloc(inst->ctx, mem);
369         if (err) {
370                 mtk_vdec_err(inst->ctx, "Cannot allocate working buffer");
371                 return err;
372         }
373
374         inst->vsi->dec.working_buf_dma = (uint64_t)mem->dma_addr;
375         return 0;
376 }
377
378 static void free_working_buf(struct vdec_vp8_inst *inst)
379 {
380         struct mtk_vcodec_mem *mem = &inst->working_buf;
381
382         if (mem->va)
383                 mtk_vcodec_mem_free(inst->ctx, mem);
384
385         inst->vsi->dec.working_buf_dma = 0;
386 }
387
388 static int vdec_vp8_init(struct mtk_vcodec_dec_ctx *ctx)
389 {
390         struct vdec_vp8_inst *inst;
391         int err;
392
393         inst = kzalloc(sizeof(*inst), GFP_KERNEL);
394         if (!inst)
395                 return  -ENOMEM;
396
397         inst->ctx = ctx;
398
399         inst->vpu.id = IPI_VDEC_VP8;
400         inst->vpu.ctx = ctx;
401
402         err = vpu_dec_init(&inst->vpu);
403         if (err) {
404                 mtk_vdec_err(ctx, "vdec_vp8 init err=%d", err);
405                 goto error_free_inst;
406         }
407
408         inst->vsi = (struct vdec_vp8_vsi *)inst->vpu.vsi;
409         init_list(inst);
410         err = alloc_working_buf(inst);
411         if (err)
412                 goto error_deinit;
413
414         get_hw_reg_base(inst);
415         mtk_vdec_debug(ctx, "VP8 Instance >> %p", inst);
416
417         ctx->drv_handle = inst;
418         return 0;
419
420 error_deinit:
421         vpu_dec_deinit(&inst->vpu);
422 error_free_inst:
423         kfree(inst);
424         return err;
425 }
426
427 static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,
428                            struct vdec_fb *fb, bool *res_chg)
429 {
430         struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
431         struct vdec_vp8_dec_info *dec = &inst->vsi->dec;
432         struct vdec_vpu_inst *vpu = &inst->vpu;
433         unsigned char *bs_va;
434         unsigned int data;
435         int err = 0;
436         uint64_t y_fb_dma;
437         uint64_t c_fb_dma;
438
439         /* bs NULL means flush decoder */
440         if (bs == NULL) {
441                 move_fb_list_use_to_free(inst);
442                 return vpu_dec_reset(vpu);
443         }
444
445         y_fb_dma = fb ? (u64)fb->base_y.dma_addr : 0;
446         c_fb_dma = fb ? (u64)fb->base_c.dma_addr : 0;
447
448         mtk_vdec_debug(inst->ctx, "+ [%d] FB y_dma=%llx c_dma=%llx fb=%p",
449                        inst->frm_cnt, y_fb_dma, c_fb_dma, fb);
450
451         inst->cur_fb = fb;
452         dec->bs_dma = (uint64_t)bs->dma_addr;
453         dec->bs_sz = bs->size;
454         dec->cur_y_fb_dma = y_fb_dma;
455         dec->cur_c_fb_dma = c_fb_dma;
456
457         mtk_vdec_debug(inst->ctx, "\n + FRAME[%d] +\n", inst->frm_cnt);
458
459         write_hw_segmentation_data(inst);
460         enable_hw_rw_function(inst);
461         store_dec_table(inst);
462
463         bs_va = (unsigned char *)bs->va;
464
465         /* retrieve width/hight and scale info from header */
466         data = (*(bs_va + 9) << 24) | (*(bs_va + 8) << 16) |
467                (*(bs_va + 7) << 8) | *(bs_va + 6);
468         err = vpu_dec_start(vpu, &data, 1);
469         if (err) {
470                 add_fb_to_free_list(inst, fb);
471                 if (dec->wait_key_frame) {
472                         mtk_vdec_debug(inst->ctx, "wait key frame !");
473                         return 0;
474                 }
475
476                 goto error;
477         }
478
479         if (dec->resolution_changed) {
480                 mtk_vdec_debug(inst->ctx, "- resolution_changed -");
481                 *res_chg = true;
482                 add_fb_to_free_list(inst, fb);
483                 return 0;
484         }
485
486         /* wait decoder done interrupt */
487         mtk_vcodec_wait_for_done_ctx(inst->ctx, MTK_INST_IRQ_RECEIVED,
488                                      WAIT_INTR_TIMEOUT_MS, 0);
489
490         if (inst->vsi->load_data)
491                 load_dec_table(inst);
492
493         vp8_dec_finish(inst);
494         read_hw_segmentation_data(inst);
495
496         err = vpu_dec_end(vpu);
497         if (err)
498                 goto error;
499
500         mtk_vdec_debug(inst->ctx, "\n - FRAME[%d] - show=%d\n", inst->frm_cnt, dec->show_frame);
501         inst->frm_cnt++;
502         *res_chg = false;
503         return 0;
504
505 error:
506         mtk_vdec_err(inst->ctx, "\n - FRAME[%d] - err=%d\n", inst->frm_cnt, err);
507         return err;
508 }
509
510 static void get_disp_fb(struct vdec_vp8_inst *inst, struct vdec_fb **out_fb)
511 {
512         struct vdec_fb_node *node;
513         struct vdec_fb *fb;
514
515         node = list_first_entry_or_null(&inst->fb_disp_list,
516                                         struct vdec_fb_node, list);
517         if (node) {
518                 list_move_tail(&node->list, &inst->available_fb_node_list);
519                 fb = (struct vdec_fb *)node->fb;
520                 fb->status |= FB_ST_DISPLAY;
521                 mtk_vdec_debug(inst->ctx, "[FB] get disp fb %p st=%d", node->fb, fb->status);
522         } else {
523                 fb = NULL;
524                 mtk_vdec_debug(inst->ctx, "[FB] there is no disp fb");
525         }
526
527         *out_fb = fb;
528 }
529
530 static void get_free_fb(struct vdec_vp8_inst *inst, struct vdec_fb **out_fb)
531 {
532         struct vdec_fb_node *node;
533         struct vdec_fb *fb;
534
535         node = list_first_entry_or_null(&inst->fb_free_list,
536                                         struct vdec_fb_node, list);
537         if (node) {
538                 list_move_tail(&node->list, &inst->available_fb_node_list);
539                 fb = (struct vdec_fb *)node->fb;
540                 fb->status |= FB_ST_FREE;
541                 mtk_vdec_debug(inst->ctx, "[FB] get free fb %p st=%d", node->fb, fb->status);
542         } else {
543                 fb = NULL;
544                 mtk_vdec_debug(inst->ctx, "[FB] there is no free fb");
545         }
546
547         *out_fb = fb;
548 }
549
550 static void get_crop_info(struct vdec_vp8_inst *inst, struct v4l2_rect *cr)
551 {
552         cr->left = 0;
553         cr->top = 0;
554         cr->width = inst->vsi->pic.pic_w;
555         cr->height = inst->vsi->pic.pic_h;
556         mtk_vdec_debug(inst->ctx, "get crop info l=%d, t=%d, w=%d, h=%d",
557                        cr->left, cr->top, cr->width, cr->height);
558 }
559
560 static int vdec_vp8_get_param(void *h_vdec, enum vdec_get_param_type type,
561                               void *out)
562 {
563         struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
564
565         switch (type) {
566         case GET_PARAM_DISP_FRAME_BUFFER:
567                 get_disp_fb(inst, out);
568                 break;
569
570         case GET_PARAM_FREE_FRAME_BUFFER:
571                 get_free_fb(inst, out);
572                 break;
573
574         case GET_PARAM_PIC_INFO:
575                 get_pic_info(inst, out);
576                 break;
577
578         case GET_PARAM_CROP_INFO:
579                 get_crop_info(inst, out);
580                 break;
581
582         case GET_PARAM_DPB_SIZE:
583                 *((unsigned int *)out) = VP8_DPB_SIZE;
584                 break;
585
586         default:
587                 mtk_vdec_err(inst->ctx, "invalid get parameter type=%d", type);
588                 return -EINVAL;
589         }
590
591         return 0;
592 }
593
594 static void vdec_vp8_deinit(void *h_vdec)
595 {
596         struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
597
598         vpu_dec_deinit(&inst->vpu);
599         free_working_buf(inst);
600         kfree(inst);
601 }
602
603 const struct vdec_common_if vdec_vp8_if = {
604         .init           = vdec_vp8_init,
605         .decode         = vdec_vp8_decode,
606         .get_param      = vdec_vp8_get_param,
607         .deinit         = vdec_vp8_deinit,
608 };