xref: /linux/drivers/media/pci/mgb4/mgb4_io.h (revision be239684b18e1cdcafcf8c7face4a2f562c745ad)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2021-2022 Digiteq Automotive
4  *     author: Martin Tuma <martin.tuma@digiteqautomotive.com>
5  */
6 
7 #ifndef __MGB4_IO_H__
8 #define __MGB4_IO_H__
9 
10 #include <media/v4l2-dev.h>
11 
12 #define MGB4_DEFAULT_WIDTH     1280
13 #define MGB4_DEFAULT_HEIGHT    640
14 #define MGB4_DEFAULT_PERIOD    (125000000 / 60)
15 
16 /* Register access error indication */
17 #define MGB4_ERR_NO_REG        0xFFFFFFFE
18 /* Frame buffer addresses greater than 0xFFFFFFFA indicate HW errors */
19 #define MGB4_ERR_QUEUE_TIMEOUT 0xFFFFFFFD
20 #define MGB4_ERR_QUEUE_EMPTY   0xFFFFFFFC
21 #define MGB4_ERR_QUEUE_FULL    0xFFFFFFFB
22 
23 struct mgb4_frame_buffer {
24 	struct vb2_v4l2_buffer vb;
25 	struct list_head list;
26 };
27 
28 static inline struct mgb4_frame_buffer *to_frame_buffer(struct vb2_v4l2_buffer *vbuf)
29 {
30 	return container_of(vbuf, struct mgb4_frame_buffer, vb);
31 }
32 
33 #endif
34