This source file includes following definitions.
- dev_to_vop
- drv_to_vop
1
2
3
4
5
6
7
8
9 #ifndef _VOP_BUS_H_
10 #define _VOP_BUS_H_
11
12
13
14
15 #include <linux/dmaengine.h>
16 #include <linux/interrupt.h>
17
18 #include "../common/mic_dev.h"
19
20 struct vop_device_id {
21 u32 device;
22 u32 vendor;
23 };
24
25 #define VOP_DEV_TRNSP 1
26 #define VOP_DEV_ANY_ID 0xffffffff
27
28
29
30
31 #define VOP_INT_DMA_BUF_SIZE PAGE_ALIGN(64 * 1024ULL)
32
33
34
35
36
37
38
39
40
41
42
43 struct vop_device {
44 struct vop_hw_ops *hw_ops;
45 struct vop_device_id id;
46 struct device dev;
47 u8 dnode;
48 struct mic_mw *aper;
49 struct dma_chan *dma_ch;
50 int index;
51 };
52
53
54
55
56
57
58
59
60 struct vop_driver {
61 struct device_driver driver;
62 const struct vop_device_id *id_table;
63 int (*probe)(struct vop_device *dev);
64 void (*remove)(struct vop_device *dev);
65 };
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84 struct vop_hw_ops {
85 int (*next_db)(struct vop_device *vpdev);
86 struct mic_irq *(*request_irq)(struct vop_device *vpdev,
87 irqreturn_t (*func)(int irq, void *data),
88 const char *name, void *data,
89 int intr_src);
90 void (*free_irq)(struct vop_device *vpdev,
91 struct mic_irq *cookie, void *data);
92 void (*ack_interrupt)(struct vop_device *vpdev, int num);
93 void __iomem * (*get_remote_dp)(struct vop_device *vpdev);
94 void * (*get_dp)(struct vop_device *vpdev);
95 void (*send_intr)(struct vop_device *vpdev, int db);
96 void __iomem * (*remap)(struct vop_device *vpdev,
97 dma_addr_t pa, size_t len);
98 void (*unmap)(struct vop_device *vpdev, void __iomem *va);
99 };
100
101 struct vop_device *
102 vop_register_device(struct device *pdev, int id,
103 const struct dma_map_ops *dma_ops,
104 struct vop_hw_ops *hw_ops, u8 dnode, struct mic_mw *aper,
105 struct dma_chan *chan);
106 void vop_unregister_device(struct vop_device *dev);
107 int vop_register_driver(struct vop_driver *drv);
108 void vop_unregister_driver(struct vop_driver *drv);
109
110
111
112
113
114
115
116 #define module_vop_driver(__vop_driver) \
117 module_driver(__vop_driver, vop_register_driver, \
118 vop_unregister_driver)
119
120 static inline struct vop_device *dev_to_vop(struct device *dev)
121 {
122 return container_of(dev, struct vop_device, dev);
123 }
124
125 static inline struct vop_driver *drv_to_vop(struct device_driver *drv)
126 {
127 return container_of(drv, struct vop_driver, driver);
128 }
129 #endif