Linux Audio

Check our new training course

Loading...
 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_VIN_H__
 8#define __MGB4_VIN_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
17struct 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};
29
30struct mgb4_vin_config {
31	int id;
32	int dma_channel;
33	int vin_irq;
34	int err_irq;
35	struct mgb4_vin_regs regs;
36};
37
38struct mgb4_vin_dev {
39	struct mgb4_dev *mgbdev;
40	struct v4l2_device v4l2dev;
41	struct video_device vdev;
42	struct vb2_queue queue;
43	struct mutex lock; /* vdev lock */
44
45	spinlock_t qlock; /* video buffer queue lock */
46	struct list_head buf_list;
47	struct work_struct dma_work, err_work;
48
49	unsigned int sequence;
50
51	struct v4l2_dv_timings timings;
52	u32 freq_range;
53	u32 padding;
54
55	struct mgb4_i2c_client deser;
56
57	const struct mgb4_vin_config *config;
58
59#ifdef CONFIG_DEBUG_FS
60	struct dentry *debugfs;
61	struct debugfs_regset32 regset;
62	struct debugfs_reg32 regs[9];
63#endif
64};
65
66struct mgb4_vin_dev *mgb4_vin_create(struct mgb4_dev *mgbdev, int id);
67void mgb4_vin_free(struct mgb4_vin_dev *vindev);
68
69#endif