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

drm/i915/dp_mst: Rename intel_dp_mst_encoder_active_links() to intel_dp_mst_active_streams()

It's not clear which encoder intel_dp_mst_encoder_active_links() refers
to (primary/stream), but there is also no reason to call the queried
property an encoder property; remove encoder from the name. Also it's
the number of MST streams being queried, vs. the number of MST links
(there is one MST link carrying one or more MST streams), so rename link
to stream as well.

While at it pass intel_dp to the function, which is more logical and
makes it easier to re-use the function later (without the need to get
the digital port pointer).

Also move the function earlier, next to the related ones.

Suggested-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://lore.kernel.org/r/20250404150310.1156696-5-imre.deak@intel.com

+20 -21
+4 -4
drivers/gpu/drm/i915/display/intel_ddi.c
··· 877 877 encoder->base.base.id, encoder->base.name); 878 878 879 879 if (!mst_pipe_mask && dp128b132b_pipe_mask) { 880 - struct intel_digital_port *dig_port = enc_to_dig_port(encoder); 880 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 881 881 882 882 /* 883 883 * If we don't have 8b/10b MST, but have more than one ··· 890 890 * can assume it's SST. 891 891 */ 892 892 if (hweight8(dp128b132b_pipe_mask) > 1 || 893 - intel_dp_mst_encoder_active_links(dig_port)) 893 + intel_dp_mst_active_streams(intel_dp)) 894 894 mst_pipe_mask = dp128b132b_pipe_mask; 895 895 } 896 896 ··· 4109 4109 } else if (ddi_mode == TRANS_DDI_MODE_SELECT_DP_MST) { 4110 4110 intel_ddi_read_func_ctl_dp_mst(encoder, pipe_config, ddi_func_ctl); 4111 4111 } else if (ddi_mode == TRANS_DDI_MODE_SELECT_FDI_OR_128B132B && HAS_DP20(display)) { 4112 - struct intel_digital_port *dig_port = enc_to_dig_port(encoder); 4112 + struct intel_dp *intel_dp = enc_to_intel_dp(encoder); 4113 4113 4114 4114 /* 4115 4115 * If this is true, we know we're being called from mst stream 4116 4116 * encoder's ->get_config(). 4117 4117 */ 4118 - if (intel_dp_mst_encoder_active_links(dig_port)) 4118 + if (intel_dp_mst_active_streams(intel_dp)) 4119 4119 intel_ddi_read_func_ctl_dp_mst(encoder, pipe_config, ddi_func_ctl); 4120 4120 else 4121 4121 intel_ddi_read_func_ctl_dp_sst(encoder, pipe_config, ddi_func_ctl);
+5 -6
drivers/gpu/drm/i915/display/intel_dp_mst.c
··· 105 105 return &dig_port->dp; 106 106 } 107 107 108 + int intel_dp_mst_active_streams(struct intel_dp *intel_dp) 109 + { 110 + return intel_dp->mst.active_links; 111 + } 112 + 108 113 static bool intel_dp_mst_dec_active_streams(struct intel_dp *intel_dp) 109 114 { 110 115 struct intel_display *display = to_intel_display(intel_dp); ··· 1890 1885 for_each_pipe(display, pipe) 1891 1886 intel_dp->mst.stream_encoders[pipe] = mst_stream_encoder_create(dig_port, pipe); 1892 1887 return true; 1893 - } 1894 - 1895 - int 1896 - intel_dp_mst_encoder_active_links(struct intel_digital_port *dig_port) 1897 - { 1898 - return dig_port->dp.mst.active_links; 1899 1888 } 1900 1889 1901 1890 int
+1 -1
drivers/gpu/drm/i915/display/intel_dp_mst.h
··· 18 18 19 19 int intel_dp_mst_encoder_init(struct intel_digital_port *dig_port, int conn_id); 20 20 void intel_dp_mst_encoder_cleanup(struct intel_digital_port *dig_port); 21 - int intel_dp_mst_encoder_active_links(struct intel_digital_port *dig_port); 21 + int intel_dp_mst_active_streams(struct intel_dp *intel_dp); 22 22 bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state); 23 23 bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state); 24 24 bool intel_dp_mst_source_support(struct intel_dp *intel_dp);
+10 -10
drivers/gpu/drm/i915/display/intel_tc.c
··· 1547 1547 mutex_unlock(&tc->lock); 1548 1548 } 1549 1549 1550 - static bool tc_port_has_active_links(struct intel_tc_port *tc, 1551 - const struct intel_crtc_state *crtc_state) 1550 + static bool tc_port_has_active_streams(struct intel_tc_port *tc, 1551 + const struct intel_crtc_state *crtc_state) 1552 1552 { 1553 1553 struct intel_display *display = to_intel_display(tc->dig_port); 1554 1554 struct intel_digital_port *dig_port = tc->dig_port; 1555 1555 enum icl_port_dpll_id pll_type = ICL_PORT_DPLL_DEFAULT; 1556 - int active_links = 0; 1556 + int active_streams = 0; 1557 1557 1558 1558 if (dig_port->dp.is_mst) { 1559 1559 /* TODO: get the PLL type for MST, once HW readout is done for it. */ 1560 - active_links = intel_dp_mst_encoder_active_links(dig_port); 1560 + active_streams = intel_dp_mst_active_streams(&dig_port->dp); 1561 1561 } else if (crtc_state && crtc_state->hw.active) { 1562 1562 pll_type = intel_ddi_port_pll_type(&dig_port->base, crtc_state); 1563 - active_links = 1; 1563 + active_streams = 1; 1564 1564 } 1565 1565 1566 - if (active_links && !tc_phy_is_connected(tc, pll_type)) 1566 + if (active_streams && !tc_phy_is_connected(tc, pll_type)) 1567 1567 drm_err(display->drm, 1568 - "Port %s: PHY disconnected with %d active link(s)\n", 1569 - tc->port_name, active_links); 1568 + "Port %s: PHY disconnected with %d active stream(s)\n", 1569 + tc->port_name, active_streams); 1570 1570 1571 - return active_links; 1571 + return active_streams; 1572 1572 } 1573 1573 1574 1574 /** ··· 1592 1592 mutex_lock(&tc->lock); 1593 1593 1594 1594 drm_WARN_ON(display->drm, tc->link_refcount != 1); 1595 - if (!tc_port_has_active_links(tc, crtc_state)) { 1595 + if (!tc_port_has_active_streams(tc, crtc_state)) { 1596 1596 /* 1597 1597 * TBT-alt is the default mode in any case the PHY ownership is not 1598 1598 * held (regardless of the sink's connected live state), so