Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/i915/dp_tunnel: Split update_tunnel_state()

Split update_tunnel_state() into two helpers: one that updates the
tunnel state, and another that detects whether the tunnel bandwidth
has changed.

This prepares for a follow-up change that needs to compare the current
bandwidth against the value from before the DP tunnel was detected and
bandwidth allocation mode was enabled.

While at it, document the return value of update_tunnel_state().

Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20260219182823.926702-4-imre.deak@intel.com

Imre Deak bcc79073 02feab82

+34 -7
+34 -7
drivers/gpu/drm/i915/display/intel_dp_tunnel.c
··· 62 62 return intel_dp_max_link_data_rate(intel_dp, rate, lane_count); 63 63 } 64 64 65 - static int update_tunnel_state(struct intel_dp *intel_dp) 65 + static int __update_tunnel_state(struct intel_dp *intel_dp) 66 66 { 67 67 struct intel_display *display = to_intel_display(intel_dp); 68 68 struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; 69 - int old_bw; 70 - int new_bw; 71 69 int ret; 72 - 73 - old_bw = get_current_link_bw(intel_dp); 74 70 75 71 ret = drm_dp_tunnel_update_state(intel_dp->tunnel); 76 72 if (ret < 0) { ··· 85 89 86 90 intel_dp_update_sink_caps(intel_dp); 87 91 92 + return 0; 93 + } 94 + 95 + static bool has_tunnel_bw_changed(struct intel_dp *intel_dp, int old_bw) 96 + { 97 + struct intel_display *display = to_intel_display(intel_dp); 98 + struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; 99 + int new_bw; 100 + 88 101 new_bw = get_current_link_bw(intel_dp); 89 102 90 103 /* Suppress the notification if the mode list can't change due to bw. */ 91 104 if (old_bw == new_bw) 92 - return 0; 105 + return false; 93 106 94 107 drm_dbg_kms(display->drm, 95 108 "[DPTUN %s][ENCODER:%d:%s] Notify users about BW change: %d -> %d\n", ··· 106 101 encoder->base.base.id, encoder->base.name, 107 102 kbytes_to_mbits(old_bw), kbytes_to_mbits(new_bw)); 108 103 109 - return 1; 104 + return true; 105 + } 106 + 107 + /* 108 + * Returns: 109 + * - 0 in case of success - if there wasn't any change in the tunnel state 110 + * requiring a user notification 111 + * - 1 in case of success - if there was a change in the tunnel state 112 + * requiring a user notification 113 + * - Negative error code if updating the tunnel state failed 114 + */ 115 + static int update_tunnel_state(struct intel_dp *intel_dp) 116 + { 117 + int old_bw; 118 + int err; 119 + 120 + old_bw = get_current_link_bw(intel_dp); 121 + 122 + err = __update_tunnel_state(intel_dp); 123 + if (err) 124 + return err; 125 + 126 + return has_tunnel_bw_changed(intel_dp, old_bw) ? 1 : 0; 110 127 } 111 128 112 129 /*