xref: /linux/drivers/media/pci/intel/ipu6/ipu6-bus.h (revision 6fd600d742744dc7ef7fc65ca26daa2b1163158a)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Copyright (C) 2013 - 2024 Intel Corporation */
3 
4 #ifndef IPU6_BUS_H
5 #define IPU6_BUS_H
6 
7 #include <linux/auxiliary_bus.h>
8 #include <linux/container_of.h>
9 #include <linux/device.h>
10 #include <linux/irqreturn.h>
11 #include <linux/list.h>
12 #include <linux/scatterlist.h>
13 #include <linux/types.h>
14 
15 struct firmware;
16 struct pci_dev;
17 
18 #define IPU6_BUS_NAME	IPU6_NAME "-bus"
19 
20 struct ipu6_buttress_ctrl;
21 
22 struct ipu6_bus_device {
23 	struct auxiliary_device auxdev;
24 	struct auxiliary_driver *auxdrv;
25 	const struct ipu6_auxdrv_data *auxdrv_data;
26 	struct list_head list;
27 	void *pdata;
28 	struct ipu6_mmu *mmu;
29 	struct ipu6_device *isp;
30 	struct ipu6_buttress_ctrl *ctrl;
31 	u64 dma_mask;
32 	const struct firmware *fw;
33 	struct sg_table fw_sgt;
34 	u64 *pkg_dir;
35 	dma_addr_t pkg_dir_dma_addr;
36 	unsigned int pkg_dir_size;
37 };
38 
39 struct ipu6_auxdrv_data {
40 	irqreturn_t (*isr)(struct ipu6_bus_device *adev);
41 	irqreturn_t (*isr_threaded)(struct ipu6_bus_device *adev);
42 	bool wake_isr_thread;
43 };
44 
45 #define to_ipu6_bus_device(_dev) \
46 	container_of(to_auxiliary_dev(_dev), struct ipu6_bus_device, auxdev)
47 #define auxdev_to_adev(_auxdev) \
48 	container_of(_auxdev, struct ipu6_bus_device, auxdev)
49 #define ipu6_bus_get_drvdata(adev) dev_get_drvdata(&(adev)->auxdev.dev)
50 
51 struct ipu6_bus_device *
52 ipu6_bus_initialize_device(struct pci_dev *pdev, struct device *parent,
53 			   void *pdata, struct ipu6_buttress_ctrl *ctrl,
54 			   char *name);
55 int ipu6_bus_add_device(struct ipu6_bus_device *adev);
56 void ipu6_bus_del_devices(struct pci_dev *pdev);
57 
58 #endif
59