@@ -825,6 +825,14 @@ struct edid *vga_switcheroo_get_edid(struct pci_dev *pdev)
}
EXPORT_SYMBOL(vga_switcheroo_get_edid);
+bool vga_switcheroo_handler_pm(void) {
+ if (!vgasr_priv.handler)
+ return false;
+
+ return vgasr_priv.handler->handler_pm;
+}
+EXPORT_SYMBOL(vga_switcheroo_handler_pm);
+
static int __init vga_switcheroo_setup(char *str)
{
if (!strcmp(str, "IGD"))
@@ -36,6 +36,7 @@ struct vga_switcheroo_handler {
enum vga_switcheroo_state state);
int (*init)(void);
int (*get_client_id)(struct pci_dev *pdev);
+ bool handler_pm;
};
struct vga_switcheroo_client_ops {
@@ -76,6 +77,8 @@ u8 *vga_switcheroo_get_dpcd(struct pci_dev *pdev);
int vga_switcheroo_set_edid(struct edid *edid);
struct edid *vga_switcheroo_get_edid(struct pci_dev *pdev);
+bool vga_switcheroo_handler_pm(void);
+
#else
static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {}
@@ -101,5 +104,7 @@ static inline u8 *vga_switcheroo_get_dpcd(struct pci_dev *pdev) { return NULL };
static inline int vga_switcheroo_set_edid(struct edid *edid) { return 0 };
static inline struct edid *vga_switcheroo_get_edid(struct pci_dev *pdev) { return NULL };
+static inline bool vga_switcheroo_handler_pm(void) { return false; };
+
#endif
#endif /* _LINUX_VGA_SWITCHEROO_H_ */
Most switcheroo setups attach power management to one of the GPUs. This is not always the case, so provide a mechanism for handlers to declare that they can change the power state of GPUs and permit drivers to obtain this information. Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com> --- drivers/gpu/vga/vga_switcheroo.c | 8 ++++++++ include/linux/vga_switcheroo.h | 5 +++++ 2 files changed, 13 insertions(+)