| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2010 Red Hat Inc. | 
					
						
							|  |  |  |  * Author : Dave Airlie <airlied@redhat.com> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * Licensed under GPLv2 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * vga_switcheroo.h - Support for laptop with dual GPU using one set of outputs | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-14 15:02:35 +03:00
										 |  |  | #ifndef _LINUX_VGA_SWITCHEROO_H_
 | 
					
						
							|  |  |  | #define _LINUX_VGA_SWITCHEROO_H_
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | #include <linux/fb.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-15 12:46:17 -07:00
										 |  |  | struct pci_dev; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | enum vga_switcheroo_state { | 
					
						
							|  |  |  | 	VGA_SWITCHEROO_OFF, | 
					
						
							|  |  |  | 	VGA_SWITCHEROO_ON, | 
					
						
							| 
									
										
										
										
											2012-06-07 12:15:15 +02:00
										 |  |  | 	/* below are referred only from vga_switcheroo_get_client_state() */ | 
					
						
							|  |  |  | 	VGA_SWITCHEROO_INIT, | 
					
						
							|  |  |  | 	VGA_SWITCHEROO_NOT_FOUND, | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | enum vga_switcheroo_client_id { | 
					
						
							|  |  |  | 	VGA_SWITCHEROO_IGD, | 
					
						
							|  |  |  | 	VGA_SWITCHEROO_DIS, | 
					
						
							|  |  |  | 	VGA_SWITCHEROO_MAX_CLIENTS, | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct vga_switcheroo_handler { | 
					
						
							|  |  |  | 	int (*switchto)(enum vga_switcheroo_client_id id); | 
					
						
							|  |  |  | 	int (*power_state)(enum vga_switcheroo_client_id id, | 
					
						
							|  |  |  | 			   enum vga_switcheroo_state state); | 
					
						
							|  |  |  | 	int (*init)(void); | 
					
						
							|  |  |  | 	int (*get_client_id)(struct pci_dev *pdev); | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-05-11 07:51:17 +02:00
										 |  |  | struct vga_switcheroo_client_ops { | 
					
						
							|  |  |  | 	void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state); | 
					
						
							|  |  |  | 	void (*reprobe)(struct pci_dev *dev); | 
					
						
							|  |  |  | 	bool (*can_switch)(struct pci_dev *dev); | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | #if defined(CONFIG_VGA_SWITCHEROO)
 | 
					
						
							|  |  |  | void vga_switcheroo_unregister_client(struct pci_dev *dev); | 
					
						
							|  |  |  | int vga_switcheroo_register_client(struct pci_dev *dev, | 
					
						
							| 
									
										
										
										
											2012-05-11 07:51:17 +02:00
										 |  |  | 				   const struct vga_switcheroo_client_ops *ops); | 
					
						
							| 
									
										
										
										
											2012-04-26 14:29:48 +02:00
										 |  |  | int vga_switcheroo_register_audio_client(struct pci_dev *pdev, | 
					
						
							|  |  |  | 					 const struct vga_switcheroo_client_ops *ops, | 
					
						
							|  |  |  | 					 int id, bool active); | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | void vga_switcheroo_client_fb_set(struct pci_dev *dev, | 
					
						
							|  |  |  | 				  struct fb_info *info); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler); | 
					
						
							|  |  |  | void vga_switcheroo_unregister_handler(void); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int vga_switcheroo_process_delayed_switch(void); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-06-07 12:15:15 +02:00
										 |  |  | int vga_switcheroo_get_client_state(struct pci_dev *dev); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | #else
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} | 
					
						
							|  |  |  | static inline int vga_switcheroo_register_client(struct pci_dev *dev, | 
					
						
							| 
									
										
										
										
											2012-05-11 07:51:17 +02:00
										 |  |  | 		const struct vga_switcheroo_client_ops *ops) { return 0; } | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} | 
					
						
							|  |  |  | static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } | 
					
						
							| 
									
										
										
										
											2012-04-26 14:29:48 +02:00
										 |  |  | static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev, | 
					
						
							|  |  |  | 	const struct vga_switcheroo_client_ops *ops, | 
					
						
							|  |  |  | 	int id, bool active) { return 0; } | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | static inline void vga_switcheroo_unregister_handler(void) {} | 
					
						
							|  |  |  | static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } | 
					
						
							| 
									
										
										
										
											2012-06-08 12:49:17 +02:00
										 |  |  | static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; } | 
					
						
							| 
									
										
										
										
											2012-06-07 12:15:15 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-01 15:38:10 +10:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-06-14 15:02:35 +03:00
										 |  |  | #endif /* _LINUX_VGA_SWITCHEROO_H_ */
 |