xref: /openbsd/sys/dev/video_if.h (revision 0d6a2fde)
1*0d6a2fdeSmiod /*	$OpenBSD: video_if.h,v 1.19 2022/03/21 19:22:40 miod Exp $	*/
2cf110a4aSrobert /*
3cf110a4aSrobert  * Copyright (c) 2008 Robert Nagy <robert@openbsd.org>
47dbc509fSmglocker  * Copyright (c) 2008 Marcus Glocker <mglocker@openbsd.org>
5cf110a4aSrobert  *
6cf110a4aSrobert  * Permission to use, copy, modify, and distribute this software for any
7cf110a4aSrobert  * purpose with or without fee is hereby granted, provided that the above
8cf110a4aSrobert  * copyright notice and this permission notice appear in all copies.
9cf110a4aSrobert  *
10cf110a4aSrobert  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11cf110a4aSrobert  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12cf110a4aSrobert  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13cf110a4aSrobert  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14cf110a4aSrobert  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15cf110a4aSrobert  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16cf110a4aSrobert  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17cf110a4aSrobert  */
18cf110a4aSrobert 
19cf110a4aSrobert #ifndef _SYS_DEV_VIDEO_IF_H
20cf110a4aSrobert #define _SYS_DEV_VIDEO_IF_H
21cf110a4aSrobert 
22cf110a4aSrobert /*
23cf110a4aSrobert  * Generic interface to hardware driver
24cf110a4aSrobert  */
25cf110a4aSrobert 
26cf110a4aSrobert #define VIDEOUNIT(x)	(minor(x))
27cf110a4aSrobert 
28cf110a4aSrobert struct video_hw_if {
29cf110a4aSrobert 	/* open hardware */
30dabf5a5aSmglocker 	int	(*open)(void *, int, int *, uint8_t *, void (*)(void *),
31dabf5a5aSmglocker 		    void *);
32cf110a4aSrobert 
33cf110a4aSrobert 	/* close hardware */
34cf110a4aSrobert 	int	(*close)(void *);
35cf110a4aSrobert 
36d279d26dSmglocker 	/* ioctl's */
37cf110a4aSrobert 	int	(*querycap)(void *, struct v4l2_capability *);
380aa3ede6Smglocker 	int	(*enum_fmt)(void *, struct v4l2_fmtdesc *);
3912262cecSmglocker 	int	(*enum_fsizes)(void *, struct v4l2_frmsizeenum *);
4012262cecSmglocker 	int	(*enum_fivals)(void *, struct v4l2_frmivalenum *);
41cf110a4aSrobert 	int	(*s_fmt)(void *, struct v4l2_format *);
42cf110a4aSrobert 	int	(*g_fmt)(void *, struct v4l2_format *);
43c9ba893eSjakemsr 	int	(*s_parm)(void *, struct v4l2_streamparm *);
44c9ba893eSjakemsr 	int	(*g_parm)(void *, struct v4l2_streamparm *);
450aa3ede6Smglocker 	int	(*enum_input)(void *, struct v4l2_input *);
460aa3ede6Smglocker 	int	(*s_input)(void *, int);
479c924229Sarmani 	int	(*g_input)(void *, int *);
48f7821c14Smglocker 	int	(*reqbufs)(void *, struct v4l2_requestbuffers *);
49f7821c14Smglocker 	int	(*querybuf)(void *, struct v4l2_buffer *);
501dc1fa5aSmglocker 	int	(*qbuf)(void *, struct v4l2_buffer *);
51cf110a4aSrobert 	int	(*dqbuf)(void *, struct v4l2_buffer *);
521dc1fa5aSmglocker 	int	(*streamon)(void *, int);
53952b8b3eSrobert 	int	(*streamoff)(void *, int);
540aa3ede6Smglocker 	int	(*try_fmt)(void *, struct v4l2_format *);
556a4f627aSrobert 	int	(*queryctrl)(void *, struct v4l2_queryctrl *);
562ee56f53Smglocker 	int	(*g_ctrl)(void *, struct v4l2_control *);
572ee56f53Smglocker 	int	(*s_ctrl)(void *, struct v4l2_control *);
58f7821c14Smglocker 	caddr_t	(*mappage)(void *, off_t, int);
590e1aed5fSrobert 
600e1aed5fSrobert 	/* other functions */
610e1aed5fSrobert 	int	(*get_bufsize)(void *);
626e7dc0a3Smglocker 	int	(*start_read)(void *);
63cf110a4aSrobert };
64cf110a4aSrobert 
65cf110a4aSrobert struct video_attach_args {
66*0d6a2fdeSmiod         const void *hwif;
67cf110a4aSrobert         void	*hdl;
68cf110a4aSrobert };
69cf110a4aSrobert 
70*0d6a2fdeSmiod struct device  *video_attach_mi(const struct video_hw_if *, void *,
71*0d6a2fdeSmiod 	    struct device *);
72cf110a4aSrobert 
73cf110a4aSrobert #endif /* _SYS_DEV_VIDEO_IF_H */
74