xref: /linux/drivers/media/platform/chips-media/wave5/wave5-helper.h (revision 7f71507851fc7764b36a3221839607d3a45c2025)
1 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
2 /*
3  * Wave5 series multi-standard codec IP - basic types
4  *
5  * Copyright (C) 2021-2023 CHIPS&MEDIA INC
6  */
7 
8 #ifndef __WAVE_HELPER_H__
9 #define __WAVE_HELPER_H__
10 
11 #include "wave5-vpu.h"
12 
13 #define FMT_TYPES	2
14 #define MAX_FMTS	12
15 
16 const char *state_to_str(enum vpu_instance_state state);
17 void wave5_cleanup_instance(struct vpu_instance *inst);
18 int wave5_vpu_release_device(struct file *filp,
19 			     int (*close_func)(struct vpu_instance *inst, u32 *fail_res),
20 			     char *name);
21 int wave5_vpu_queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq,
22 			 const struct vb2_ops *ops);
23 int wave5_vpu_subscribe_event(struct v4l2_fh *fh, const struct v4l2_event_subscription *sub);
24 int wave5_vpu_g_fmt_out(struct file *file, void *fh, struct v4l2_format *f);
25 const struct vpu_format *wave5_find_vpu_fmt(unsigned int v4l2_pix_fmt,
26 					    const struct vpu_format fmt_list[MAX_FMTS]);
27 const struct vpu_format *wave5_find_vpu_fmt_by_idx(unsigned int idx,
28 						   const struct vpu_format fmt_list[MAX_FMTS]);
29 enum wave_std wave5_to_vpu_std(unsigned int v4l2_pix_fmt, enum vpu_instance_type type);
30 void wave5_return_bufs(struct vb2_queue *q, u32 state);
31 void wave5_update_pix_fmt(struct v4l2_pix_format_mplane *pix_mp,
32 			  int pix_fmt_type,
33 			  unsigned int width,
34 			  unsigned int height,
35 			  const struct v4l2_frmsize_stepwise *frmsize);
36 #endif
37