71 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Copyright (C) 2021-2023 Digiteq Automotive4 * 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 u32 timer;29};30 31struct mgb4_vin_config {32 int id;33 int dma_channel;34 int vin_irq;35 int err_irq;36 struct mgb4_vin_regs regs;37};38 39struct 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 */45 46 spinlock_t qlock; /* video buffer queue lock */47 struct list_head buf_list;48 struct work_struct dma_work, err_work;49 50 unsigned int sequence;51 52 struct v4l2_dv_timings timings;53 u32 freq_range;54 u32 padding;55 56 struct mgb4_i2c_client deser;57 58 const struct mgb4_vin_config *config;59 60#ifdef CONFIG_DEBUG_FS61 struct dentry *debugfs;62 struct debugfs_regset32 regset;63 struct debugfs_reg32 regs[sizeof(struct mgb4_vin_regs) / 4];64#endif65};66 67struct mgb4_vin_dev *mgb4_vin_create(struct mgb4_dev *mgbdev, int id);68void mgb4_vin_free(struct mgb4_vin_dev *vindev);69 70#endif71