1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2021-2023 Digiteq Automotive
7 #ifndef __MGB4_CORE_H__
8 #define __MGB4_CORE_H__
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"
16 #define MGB4_HW_FREQ 125000000
18 #define MGB4_VIN_DEVICES 2
19 #define MGB4_VOUT_DEVICES 2
21 #define MGB4_IS_GMSL(mgbdev) \
22 ((mgbdev)->module_version >> 4 == 2)
23 #define MGB4_IS_FPDL3(mgbdev) \
24 ((mgbdev)->module_version >> 4 == 1)
26 struct mgb4_dma_channel {
27 struct dma_chan *chan;
28 struct completion req_compl;
33 struct platform_device *xdev;
34 struct mgb4_vin_dev *vin[MGB4_VIN_DEVICES];
35 struct mgb4_vout_dev *vout[MGB4_VOUT_DEVICES];
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];
41 struct mgb4_regs video;
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 */
50 struct platform_device *spi_pdev;
51 struct flash_platform_data flash_data;
52 struct mtd_partition partitions[2];
54 char fw_part_name[16];
55 char data_part_name[16];
56 char channel_names[MGB4_VIN_DEVICES + MGB4_VOUT_DEVICES][16];
58 struct iio_dev *indio_dev;
59 #if IS_REACHABLE(CONFIG_HWMON)
60 struct device *hwmon_dev;
63 unsigned long io_reconfig;
68 struct dentry *debugfs;