This source file includes following definitions.
- vga_switcheroo_unregister_client
- vga_switcheroo_register_client
- vga_switcheroo_client_fb_set
- vga_switcheroo_register_handler
- vga_switcheroo_register_audio_client
- vga_switcheroo_unregister_handler
- vga_switcheroo_lock_ddc
- vga_switcheroo_unlock_ddc
- vga_switcheroo_process_delayed_switch
- vga_switcheroo_client_probe_defer
- vga_switcheroo_get_client_state
- vga_switcheroo_init_domain_pm_ops
- vga_switcheroo_fini_domain_pm_ops
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 #ifndef _LINUX_VGA_SWITCHEROO_H_
32 #define _LINUX_VGA_SWITCHEROO_H_
33
34 #include <linux/fb.h>
35
36 struct pci_dev;
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53 enum vga_switcheroo_handler_flags_t {
54 VGA_SWITCHEROO_CAN_SWITCH_DDC = (1 << 0),
55 VGA_SWITCHEROO_NEEDS_EDP_CONFIG = (1 << 1),
56 };
57
58
59
60
61
62
63
64
65
66
67
68 enum vga_switcheroo_state {
69 VGA_SWITCHEROO_OFF,
70 VGA_SWITCHEROO_ON,
71
72 VGA_SWITCHEROO_NOT_FOUND,
73 };
74
75
76
77
78
79
80
81
82
83
84
85
86 enum vga_switcheroo_client_id {
87 VGA_SWITCHEROO_UNKNOWN_ID = 0x1000,
88 VGA_SWITCHEROO_IGD = 0,
89 VGA_SWITCHEROO_DIS,
90 VGA_SWITCHEROO_MAX_CLIENTS,
91 };
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116 struct vga_switcheroo_handler {
117 int (*init)(void);
118 int (*switchto)(enum vga_switcheroo_client_id id);
119 int (*switch_ddc)(enum vga_switcheroo_client_id id);
120 int (*power_state)(enum vga_switcheroo_client_id id,
121 enum vga_switcheroo_state state);
122 enum vga_switcheroo_client_id (*get_client_id)(struct pci_dev *pdev);
123 };
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143 struct vga_switcheroo_client_ops {
144 void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
145 void (*reprobe)(struct pci_dev *dev);
146 bool (*can_switch)(struct pci_dev *dev);
147 void (*gpu_bound)(struct pci_dev *dev, enum vga_switcheroo_client_id);
148 };
149
150 #if defined(CONFIG_VGA_SWITCHEROO)
151 void vga_switcheroo_unregister_client(struct pci_dev *dev);
152 int vga_switcheroo_register_client(struct pci_dev *dev,
153 const struct vga_switcheroo_client_ops *ops,
154 bool driver_power_control);
155 int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
156 const struct vga_switcheroo_client_ops *ops,
157 struct pci_dev *vga_dev);
158
159 void vga_switcheroo_client_fb_set(struct pci_dev *dev,
160 struct fb_info *info);
161
162 int vga_switcheroo_register_handler(const struct vga_switcheroo_handler *handler,
163 enum vga_switcheroo_handler_flags_t handler_flags);
164 void vga_switcheroo_unregister_handler(void);
165 enum vga_switcheroo_handler_flags_t vga_switcheroo_handler_flags(void);
166 int vga_switcheroo_lock_ddc(struct pci_dev *pdev);
167 int vga_switcheroo_unlock_ddc(struct pci_dev *pdev);
168
169 int vga_switcheroo_process_delayed_switch(void);
170
171 bool vga_switcheroo_client_probe_defer(struct pci_dev *pdev);
172 enum vga_switcheroo_state vga_switcheroo_get_client_state(struct pci_dev *dev);
173
174 int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain);
175 void vga_switcheroo_fini_domain_pm_ops(struct device *dev);
176 #else
177
178 static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
179 static inline int vga_switcheroo_register_client(struct pci_dev *dev,
180 const struct vga_switcheroo_client_ops *ops, bool driver_power_control) { return 0; }
181 static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {}
182 static inline int vga_switcheroo_register_handler(const struct vga_switcheroo_handler *handler,
183 enum vga_switcheroo_handler_flags_t handler_flags) { return 0; }
184 static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
185 const struct vga_switcheroo_client_ops *ops,
186 struct pci_dev *vga_dev) { return 0; }
187 static inline void vga_switcheroo_unregister_handler(void) {}
188 static inline enum vga_switcheroo_handler_flags_t vga_switcheroo_handler_flags(void) { return 0; }
189 static inline int vga_switcheroo_lock_ddc(struct pci_dev *pdev) { return -ENODEV; }
190 static inline int vga_switcheroo_unlock_ddc(struct pci_dev *pdev) { return -ENODEV; }
191 static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
192 static inline bool vga_switcheroo_client_probe_defer(struct pci_dev *pdev) { return false; }
193 static inline enum vga_switcheroo_state vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; }
194
195 static inline int vga_switcheroo_init_domain_pm_ops(struct device *dev, struct dev_pm_domain *domain) { return -EINVAL; }
196 static inline void vga_switcheroo_fini_domain_pm_ops(struct device *dev) {}
197
198 #endif
199 #endif