This source file includes following definitions.
- dev_to_cosm
- drv_to_cosm
1
2
3
4
5
6
7
8
9 #ifndef _COSM_BUS_H_
10 #define _COSM_BUS_H_
11
12 #include <linux/scif.h>
13 #include <linux/mic_common.h>
14 #include "../common/mic_dev.h"
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 struct cosm_device {
45 const struct attribute_group **attr_group;
46 struct device *sdev;
47 u8 state;
48 u8 prev_state;
49 u8 shutdown_status;
50 u8 shutdown_status_int;
51 struct mutex cosm_mutex;
52 struct work_struct reset_trigger_work;
53 struct work_struct scif_work;
54 char *cmdline;
55 char *firmware;
56 char *ramdisk;
57 char *bootmode;
58 void *log_buf_addr;
59 int *log_buf_len;
60 struct kernfs_node *state_sysfs;
61 struct cosm_hw_ops *hw_ops;
62 struct device dev;
63 int index;
64 struct dentry *dbg_dir;
65 scif_epd_t newepd;
66 scif_epd_t epd;
67 bool heartbeat_watchdog_enable;
68 bool sysfs_heartbeat_enable;
69 };
70
71
72
73
74
75
76
77
78 struct cosm_driver {
79 struct device_driver driver;
80 int (*probe)(struct cosm_device *dev);
81 void (*remove)(struct cosm_device *dev);
82 };
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97 struct cosm_hw_ops {
98 void (*reset)(struct cosm_device *cdev);
99 void (*force_reset)(struct cosm_device *cdev);
100 void (*post_reset)(struct cosm_device *cdev, enum mic_states state);
101 bool (*ready)(struct cosm_device *cdev);
102 int (*start)(struct cosm_device *cdev, int id);
103 void (*stop)(struct cosm_device *cdev, bool force);
104 ssize_t (*family)(struct cosm_device *cdev, char *buf);
105 ssize_t (*stepping)(struct cosm_device *cdev, char *buf);
106 struct mic_mw *(*aper)(struct cosm_device *cdev);
107 };
108
109 struct cosm_device *
110 cosm_register_device(struct device *pdev, struct cosm_hw_ops *hw_ops);
111 void cosm_unregister_device(struct cosm_device *dev);
112 int cosm_register_driver(struct cosm_driver *drv);
113 void cosm_unregister_driver(struct cosm_driver *drv);
114 struct cosm_device *cosm_find_cdev_by_id(int id);
115
116 static inline struct cosm_device *dev_to_cosm(struct device *dev)
117 {
118 return container_of(dev, struct cosm_device, dev);
119 }
120
121 static inline struct cosm_driver *drv_to_cosm(struct device_driver *drv)
122 {
123 return container_of(drv, struct cosm_driver, driver);
124 }
125 #endif