| 1 | /* SPDX-License-Identifier: MIT */ |
| 2 | /* |
| 3 | * Copyright © 2023 Intel Corporation |
| 4 | */ |
| 5 | |
| 6 | #ifndef __INTEL_DP_TUNNEL_H__ |
| 7 | #define __INTEL_DP_TUNNEL_H__ |
| 8 | |
| 9 | #include <linux/errno.h> |
| 10 | #include <linux/types.h> |
| 11 | |
| 12 | struct drm_connector_state; |
| 13 | struct drm_modeset_acquire_ctx; |
| 14 | struct intel_atomic_state; |
| 15 | struct intel_connector; |
| 16 | struct intel_crtc; |
| 17 | struct intel_crtc_state; |
| 18 | struct intel_display; |
| 19 | struct intel_dp; |
| 20 | struct intel_encoder; |
| 21 | struct intel_link_bw_limits; |
| 22 | |
| 23 | #if (IS_ENABLED(CONFIG_DRM_I915_DP_TUNNEL) && defined(I915)) || \ |
| 24 | (IS_ENABLED(CONFIG_DRM_XE_DP_TUNNEL) && !defined(I915)) |
| 25 | |
| 26 | int intel_dp_tunnel_detect(struct intel_dp *intel_dp, struct drm_modeset_acquire_ctx *ctx); |
| 27 | void intel_dp_tunnel_disconnect(struct intel_dp *intel_dp); |
| 28 | void intel_dp_tunnel_destroy(struct intel_dp *intel_dp); |
| 29 | void intel_dp_tunnel_resume(struct intel_dp *intel_dp, |
| 30 | const struct intel_crtc_state *crtc_state, |
| 31 | bool dpcd_updated); |
| 32 | void intel_dp_tunnel_suspend(struct intel_dp *intel_dp); |
| 33 | |
| 34 | bool intel_dp_tunnel_bw_alloc_is_enabled(struct intel_dp *intel_dp); |
| 35 | |
| 36 | void |
| 37 | intel_dp_tunnel_atomic_cleanup_inherited_state(struct intel_atomic_state *state); |
| 38 | |
| 39 | int intel_dp_tunnel_atomic_compute_stream_bw(struct intel_atomic_state *state, |
| 40 | struct intel_dp *intel_dp, |
| 41 | const struct intel_connector *connector, |
| 42 | struct intel_crtc_state *crtc_state); |
| 43 | void intel_dp_tunnel_atomic_clear_stream_bw(struct intel_atomic_state *state, |
| 44 | struct intel_crtc_state *crtc_state); |
| 45 | |
| 46 | int intel_dp_tunnel_atomic_add_state_for_crtc(struct intel_atomic_state *state, |
| 47 | struct intel_crtc *crtc); |
| 48 | int intel_dp_tunnel_atomic_check_link(struct intel_atomic_state *state, |
| 49 | struct intel_link_bw_limits *limits); |
| 50 | int intel_dp_tunnel_atomic_check_state(struct intel_atomic_state *state, |
| 51 | struct intel_dp *intel_dp, |
| 52 | struct intel_connector *connector); |
| 53 | |
| 54 | void intel_dp_tunnel_atomic_alloc_bw(struct intel_atomic_state *state); |
| 55 | |
| 56 | int intel_dp_tunnel_mgr_init(struct intel_display *display); |
| 57 | void intel_dp_tunnel_mgr_cleanup(struct intel_display *display); |
| 58 | |
| 59 | #else |
| 60 | |
| 61 | static inline int |
| 62 | intel_dp_tunnel_detect(struct intel_dp *intel_dp, struct drm_modeset_acquire_ctx *ctx) |
| 63 | { |
| 64 | return -EOPNOTSUPP; |
| 65 | } |
| 66 | |
| 67 | static inline void intel_dp_tunnel_disconnect(struct intel_dp *intel_dp) {} |
| 68 | static inline void intel_dp_tunnel_destroy(struct intel_dp *intel_dp) {} |
| 69 | static inline void intel_dp_tunnel_resume(struct intel_dp *intel_dp, |
| 70 | const struct intel_crtc_state *crtc_state, |
| 71 | bool dpcd_updated) {} |
| 72 | static inline void intel_dp_tunnel_suspend(struct intel_dp *intel_dp) {} |
| 73 | |
| 74 | static inline bool intel_dp_tunnel_bw_alloc_is_enabled(struct intel_dp *intel_dp) |
| 75 | { |
| 76 | return false; |
| 77 | } |
| 78 | |
| 79 | static inline void |
| 80 | intel_dp_tunnel_atomic_cleanup_inherited_state(struct intel_atomic_state *state) {} |
| 81 | |
| 82 | static inline int |
| 83 | intel_dp_tunnel_atomic_compute_stream_bw(struct intel_atomic_state *state, |
| 84 | struct intel_dp *intel_dp, |
| 85 | const struct intel_connector *connector, |
| 86 | struct intel_crtc_state *crtc_state) |
| 87 | { |
| 88 | return 0; |
| 89 | } |
| 90 | |
| 91 | static inline void |
| 92 | intel_dp_tunnel_atomic_clear_stream_bw(struct intel_atomic_state *state, |
| 93 | struct intel_crtc_state *crtc_state) {} |
| 94 | |
| 95 | static inline int |
| 96 | intel_dp_tunnel_atomic_add_state_for_crtc(struct intel_atomic_state *state, |
| 97 | struct intel_crtc *crtc) |
| 98 | { |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | static inline int |
| 103 | intel_dp_tunnel_atomic_check_link(struct intel_atomic_state *state, |
| 104 | struct intel_link_bw_limits *limits) |
| 105 | { |
| 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | static inline int |
| 110 | intel_dp_tunnel_atomic_check_state(struct intel_atomic_state *state, |
| 111 | struct intel_dp *intel_dp, |
| 112 | struct intel_connector *connector) |
| 113 | { |
| 114 | return 0; |
| 115 | } |
| 116 | |
| 117 | static inline int |
| 118 | intel_dp_tunnel_atomic_alloc_bw(struct intel_atomic_state *state) |
| 119 | { |
| 120 | return 0; |
| 121 | } |
| 122 | |
| 123 | static inline int |
| 124 | intel_dp_tunnel_mgr_init(struct intel_display *display) |
| 125 | { |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | static inline void intel_dp_tunnel_mgr_cleanup(struct intel_display *display) {} |
| 130 | |
| 131 | #endif /* CONFIG_DRM_I915_DP_TUNNEL || CONFIG_DRM_XE_DP_TUNNEL */ |
| 132 | |
| 133 | #endif /* __INTEL_DP_TUNNEL_H__ */ |
| 134 | |