1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
---|---|
2 | /* |
3 | * Copyright (C) 2021-2023 Digiteq Automotive |
4 | * author: Martin Tuma <martin.tuma@digiteqautomotive.com> |
5 | */ |
6 | |
7 | #ifndef __MGB4_VOUT_H__ |
8 | #define __MGB4_VOUT_H__ |
9 | |
10 | #include <media/v4l2-device.h> |
11 | #include <media/v4l2-dev.h> |
12 | #include <media/v4l2-ctrls.h> |
13 | #include <media/videobuf2-core.h> |
14 | #include <linux/debugfs.h> |
15 | #include "mgb4_i2c.h" |
16 | |
17 | struct mgb4_vout_regs { |
18 | u32 address; |
19 | u32 config; |
20 | u32 status; |
21 | u32 resolution; |
22 | u32 frame_period; |
23 | u32 hsync; |
24 | u32 vsync; |
25 | u32 padding; |
26 | }; |
27 | |
28 | struct mgb4_vout_config { |
29 | int id; |
30 | int dma_channel; |
31 | int irq; |
32 | struct mgb4_vout_regs regs; |
33 | }; |
34 | |
35 | struct mgb4_vout_dev { |
36 | struct mgb4_dev *mgbdev; |
37 | struct v4l2_device v4l2dev; |
38 | struct video_device vdev; |
39 | struct vb2_queue queue; |
40 | struct mutex lock; /* vdev lock */ |
41 | |
42 | spinlock_t qlock; /* buffer queue lock */ |
43 | struct list_head buf_list; |
44 | struct work_struct dma_work; |
45 | |
46 | u32 width; |
47 | u32 height; |
48 | u32 freq; |
49 | u32 padding; |
50 | |
51 | struct mgb4_i2c_client ser; |
52 | |
53 | const struct mgb4_vout_config *config; |
54 | |
55 | #ifdef CONFIG_DEBUG_FS |
56 | struct dentry *debugfs; |
57 | struct debugfs_regset32 regset; |
58 | struct debugfs_reg32 regs[7]; |
59 | #endif |
60 | }; |
61 | |
62 | struct mgb4_vout_dev *mgb4_vout_create(struct mgb4_dev *mgbdev, int id); |
63 | void mgb4_vout_free(struct mgb4_vout_dev *voutdev); |
64 | |
65 | #endif |
66 |