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_limit; 23 u32 hsync; 24 u32 vsync; 25 u32 padding; 26 u32 timer; 27 }; 28 29 struct mgb4_vout_config { 30 int id; 31 int dma_channel; 32 int irq; 33 struct mgb4_vout_regs regs; 34 }; 35 36 struct mgb4_vout_dev { 37 struct mgb4_dev *mgbdev; 38 struct v4l2_device v4l2dev; 39 struct video_device vdev; 40 struct vb2_queue queue; 41 struct mutex lock; /* vdev lock */ 42 43 spinlock_t qlock; /* buffer queue lock */ 44 struct list_head buf_list; 45 struct work_struct dma_work; 46 47 u32 width; 48 u32 height; 49 u32 freq; 50 u32 padding; 51 52 struct mgb4_i2c_client ser; 53 54 const struct mgb4_vout_config *config; 55 56 #ifdef CONFIG_DEBUG_FS 57 struct debugfs_regset32 regset; 58 struct debugfs_reg32 regs[sizeof(struct mgb4_vout_regs) / 4]; 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