drm/nouveau: consume the return of large GSP message
[drm/drm-misc.git] / drivers / media / pci / mgb4 / mgb4_vin.h
blob8fd10c0a55546a9fbecee575e230f315f57aa504
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 */
7 #ifndef __MGB4_VIN_H__
8 #define __MGB4_VIN_H__
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"
17 struct mgb4_vin_regs {
18 u32 address;
19 u32 config;
20 u32 status;
21 u32 resolution;
22 u32 frame_period;
23 u32 sync;
24 u32 pclk;
25 u32 signal;
26 u32 signal2;
27 u32 padding;
28 u32 timer;
31 struct mgb4_vin_config {
32 int id;
33 int dma_channel;
34 int vin_irq;
35 int err_irq;
36 struct mgb4_vin_regs regs;
39 struct mgb4_vin_dev {
40 struct mgb4_dev *mgbdev;
41 struct v4l2_device v4l2dev;
42 struct video_device vdev;
43 struct vb2_queue queue;
44 struct mutex lock; /* vdev lock */
46 spinlock_t qlock; /* video buffer queue lock */
47 struct list_head buf_list;
48 struct work_struct dma_work, err_work;
50 unsigned int sequence;
52 struct v4l2_dv_timings timings;
53 u32 freq_range;
54 u32 padding;
56 struct mgb4_i2c_client deser;
58 const struct mgb4_vin_config *config;
60 #ifdef CONFIG_DEBUG_FS
61 struct debugfs_regset32 regset;
62 struct debugfs_reg32 regs[sizeof(struct mgb4_vin_regs) / 4];
63 #endif
66 struct mgb4_vin_dev *mgb4_vin_create(struct mgb4_dev *mgbdev, int id);
67 void mgb4_vin_free(struct mgb4_vin_dev *vindev);
69 #endif