]> Git Repo - linux.git/blob - drivers/media/pci/mgb4/mgb4_core.h
Linux 6.14-rc3
[linux.git] / drivers / media / pci / mgb4 / mgb4_core.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2021-2023 Digiteq Automotive
4  *     author: Martin Tuma <[email protected]>
5  */
6
7 #ifndef __MGB4_CORE_H__
8 #define __MGB4_CORE_H__
9
10 #include <linux/spi/flash.h>
11 #include <linux/mtd/partitions.h>
12 #include <linux/mutex.h>
13 #include <linux/dmaengine.h>
14 #include "mgb4_regs.h"
15
16 #define MGB4_HW_FREQ 125000000
17
18 #define MGB4_VIN_DEVICES  2
19 #define MGB4_VOUT_DEVICES 2
20
21 #define MGB4_IS_GMSL(mgbdev) \
22         ((mgbdev)->module_version >> 4 == 2)
23 #define MGB4_IS_FPDL3(mgbdev) \
24         ((mgbdev)->module_version >> 4 == 1)
25
26 struct mgb4_dma_channel {
27         struct dma_chan *chan;
28         struct completion req_compl;
29 };
30
31 struct mgb4_dev {
32         struct pci_dev *pdev;
33         struct platform_device *xdev;
34         struct mgb4_vin_dev *vin[MGB4_VIN_DEVICES];
35         struct mgb4_vout_dev *vout[MGB4_VOUT_DEVICES];
36
37         struct mgb4_dma_channel c2h_chan[MGB4_VIN_DEVICES];
38         struct mgb4_dma_channel h2c_chan[MGB4_VOUT_DEVICES];
39         struct dma_slave_map slave_map[MGB4_VIN_DEVICES + MGB4_VOUT_DEVICES];
40
41         struct mgb4_regs video;
42         struct mgb4_regs cmt;
43
44         struct clk_hw *i2c_clk;
45         struct clk_lookup *i2c_cl;
46         struct platform_device *i2c_pdev;
47         struct i2c_adapter *i2c_adap;
48         struct mutex i2c_lock; /* I2C bus access lock */
49
50         struct platform_device *spi_pdev;
51         struct flash_platform_data flash_data;
52         struct mtd_partition partitions[2];
53         char flash_name[16];
54         char fw_part_name[16];
55         char data_part_name[16];
56         char channel_names[MGB4_VIN_DEVICES + MGB4_VOUT_DEVICES][16];
57
58         struct iio_dev *indio_dev;
59 #if IS_REACHABLE(CONFIG_HWMON)
60         struct device *hwmon_dev;
61 #endif
62
63         unsigned long io_reconfig;
64
65         u8 module_version;
66         u32 serial_number;
67
68         struct dentry *debugfs;
69 };
70
71 #endif
This page took 0.114461 seconds and 4 git commands to generate.