xref: /linux/drivers/gpu/drm/xe/display/xe_display.h (revision 570f7e331f5febb30f1384817463c7e42b65ca7d)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 
6 #ifndef _XE_DISPLAY_H_
7 #define _XE_DISPLAY_H_
8 
9 #include <linux/types.h>
10 
11 struct drm_driver;
12 struct drm_fb_helper;
13 struct drm_fb_helper_surface_size;
14 struct pci_dev;
15 struct xe_device;
16 
17 #if IS_ENABLED(CONFIG_DRM_XE_DISPLAY)
18 
19 bool xe_display_driver_probe_defer(struct pci_dev *pdev);
20 
21 int xe_display_driver_fbdev_probe(struct drm_fb_helper *fbh,
22 				  struct drm_fb_helper_surface_size *sizes);
23 
24 int xe_display_probe(struct xe_device *xe);
25 
26 int xe_display_init_early(struct xe_device *xe);
27 int xe_display_init(struct xe_device *xe);
28 
29 void xe_display_register(struct xe_device *xe);
30 void xe_display_unregister(struct xe_device *xe);
31 
32 void xe_display_shutdown(struct xe_device *xe);
33 void xe_display_shutdown_late(struct xe_device *xe);
34 
35 void xe_display_irq_handler(struct xe_device *xe, u32 master_ctl);
36 void xe_display_irq_enable(struct xe_device *xe, u32 gu_misc_iir);
37 void xe_display_irq_reset(struct xe_device *xe);
38 void xe_display_irq_postinstall(struct xe_device *xe);
39 
40 void xe_display_pm_suspend(struct xe_device *xe);
41 void xe_display_pm_suspend_late(struct xe_device *xe);
42 void xe_display_pm_resume_early(struct xe_device *xe);
43 void xe_display_pm_resume(struct xe_device *xe);
44 void xe_display_pm_runtime_suspend(struct xe_device *xe);
45 void xe_display_pm_runtime_suspend_late(struct xe_device *xe);
46 void xe_display_pm_runtime_resume_early(struct xe_device *xe);
47 void xe_display_pm_runtime_resume(struct xe_device *xe);
48 
49 #define XE_DISPLAY_DRIVER_FEATURES	(DRIVER_MODESET | DRIVER_ATOMIC)
50 #define XE_DISPLAY_DRIVER_OPS						\
51 	.fbdev_probe = PTR_IF(IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION),	\
52 			      xe_display_driver_fbdev_probe)
53 
54 #else
55 
56 #define XE_DISPLAY_DRIVER_FEATURES	0
57 #define XE_DISPLAY_DRIVER_OPS \
58 	.fbdev_probe = NULL
59 
60 static inline int xe_display_driver_probe_defer(struct pci_dev *pdev) { return 0; }
61 
62 static inline int xe_display_probe(struct xe_device *xe) { return 0; }
63 
64 static inline int xe_display_init_early(struct xe_device *xe) { return 0; }
65 static inline int xe_display_init(struct xe_device *xe) { return 0; }
66 
67 static inline void xe_display_register(struct xe_device *xe) {}
68 static inline void xe_display_unregister(struct xe_device *xe) {}
69 
70 static inline void xe_display_shutdown(struct xe_device *xe) {}
71 static inline void xe_display_shutdown_late(struct xe_device *xe) {}
72 
73 static inline void xe_display_irq_handler(struct xe_device *xe, u32 master_ctl) {}
74 static inline void xe_display_irq_enable(struct xe_device *xe, u32 gu_misc_iir) {}
75 static inline void xe_display_irq_reset(struct xe_device *xe) {}
76 static inline void xe_display_irq_postinstall(struct xe_device *xe) {}
77 
78 static inline void xe_display_pm_suspend(struct xe_device *xe) {}
79 static inline void xe_display_pm_suspend_late(struct xe_device *xe) {}
80 static inline void xe_display_pm_resume_early(struct xe_device *xe) {}
81 static inline void xe_display_pm_resume(struct xe_device *xe) {}
82 static inline void xe_display_pm_runtime_suspend(struct xe_device *xe) {}
83 static inline void xe_display_pm_runtime_suspend_late(struct xe_device *xe) {}
84 static inline void xe_display_pm_runtime_resume_early(struct xe_device *xe) {}
85 static inline void xe_display_pm_runtime_resume(struct xe_device *xe) {}
86 
87 #endif /* CONFIG_DRM_XE_DISPLAY */
88 #endif /* _XE_DISPLAY_H_ */
89