xref: /linux/include/drm/intel/display_parent_interface.h (revision 29fdc6e98d3c3657c8b4874ab3bfc75f9df59bf4)
1 /* SPDX-License-Identifier: MIT */
2 /* Copyright © 2025 Intel Corporation x*/
3 
4 #ifndef __DISPLAY_PARENT_INTERFACE_H__
5 #define __DISPLAY_PARENT_INTERFACE_H__
6 
7 #include <linux/types.h>
8 
9 struct dma_fence;
10 struct drm_device;
11 struct intel_hdcp_gsc_context;
12 struct ref_tracker;
13 
14 struct intel_display_rpm_interface {
15 	struct ref_tracker *(*get)(const struct drm_device *drm);
16 	struct ref_tracker *(*get_raw)(const struct drm_device *drm);
17 	struct ref_tracker *(*get_if_in_use)(const struct drm_device *drm);
18 	struct ref_tracker *(*get_noresume)(const struct drm_device *drm);
19 
20 	void (*put)(const struct drm_device *drm, struct ref_tracker *wakeref);
21 	void (*put_raw)(const struct drm_device *drm, struct ref_tracker *wakeref);
22 	void (*put_unchecked)(const struct drm_device *drm);
23 
24 	bool (*suspended)(const struct drm_device *drm);
25 	void (*assert_held)(const struct drm_device *drm);
26 	void (*assert_block)(const struct drm_device *drm);
27 	void (*assert_unblock)(const struct drm_device *drm);
28 };
29 
30 struct intel_display_hdcp_interface {
31 	ssize_t (*gsc_msg_send)(struct intel_hdcp_gsc_context *gsc_context,
32 				void *msg_in, size_t msg_in_len,
33 				void *msg_out, size_t msg_out_len);
34 	bool (*gsc_check_status)(struct drm_device *drm);
35 	struct intel_hdcp_gsc_context *(*gsc_context_alloc)(struct drm_device *drm);
36 	void (*gsc_context_free)(struct intel_hdcp_gsc_context *gsc_context);
37 };
38 
39 struct intel_display_irq_interface {
40 	bool (*enabled)(struct drm_device *drm);
41 	void (*synchronize)(struct drm_device *drm);
42 };
43 
44 struct intel_display_rps_interface {
45 	void (*boost_if_not_started)(struct dma_fence *fence);
46 	void (*mark_interactive)(struct drm_device *drm, bool interactive);
47 	void (*ilk_irq_handler)(struct drm_device *drm);
48 };
49 
50 /**
51  * struct intel_display_parent_interface - services parent driver provides to display
52  *
53  * The parent, or core, driver provides a pointer to this structure to display
54  * driver when calling intel_display_device_probe(). The display driver uses it
55  * to access services provided by the parent driver. The structure may contain
56  * sub-struct pointers to group function pointers by functionality.
57  *
58  * All function and sub-struct pointers must be initialized and callable unless
59  * explicitly marked as "optional" below. The display driver will only NULL
60  * check the optional pointers.
61  */
62 struct intel_display_parent_interface {
63 	/** @hdcp: HDCP GSC interface */
64 	const struct intel_display_hdcp_interface *hdcp;
65 
66 	/** @rpm: Runtime PM functions */
67 	const struct intel_display_rpm_interface *rpm;
68 
69 	/** @irq: IRQ interface */
70 	const struct intel_display_irq_interface *irq;
71 
72 	/** @rpm: RPS interface. Optional. */
73 	const struct intel_display_rps_interface *rps;
74 
75 	/** @vgpu_active: Is vGPU active? Optional. */
76 	bool (*vgpu_active)(struct drm_device *drm);
77 
78 	/** @has_fenced_regions: Support legacy fencing? Optional. */
79 	bool (*has_fenced_regions)(struct drm_device *drm);
80 
81 	/** @fence_priority_display: Set display priority. Optional. */
82 	void (*fence_priority_display)(struct dma_fence *fence);
83 };
84 
85 #endif
86