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/tc: Add separate intel_tc_phy_port_to_tc() for TC DDI/PHY ports

intel_port_to_tc() returns the PORT_TC1..6 -> TC_PORT_1..6 mapping only
for DDI ports that are connected to a TypeC PHY. In some cases this
mapping is also required for TypeC DDI ports which are not connected to
a TypeC PHY. Such DDI ports are the PORT_TC1..4 ports on RKL/ADLS/BMG.

Add a separate intel_tc_phy_to_tc() helper to return the mapping for
ports connected to a TypeC PHY, and make all the current users - which
expect this semantic - call this helper. A follow-up change will need to
get the same mapping for TypeC DDI ports not connected to a TypeC PHY,
leave intel_port_to_tc() exported for that.

Cc: Suraj Kandpal <suraj.kandpal@intel.com>
Cc: Mika Kahola <mika.kahola@intel.com>
Reviewed-by: Suraj Kandpal <suraj.kandpal@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Link: https://patch.msgid.link/20251120172358.1282765-2-imre.deak@intel.com

Imre Deak 8aa2945f 370f45b1

+22 -6
+2 -2
drivers/gpu/drm/i915/display/intel_ddi.c
··· 5148 5148 port_name(port - PORT_D_XELPD + PORT_D), 5149 5149 phy_name(phy)); 5150 5150 } else if (DISPLAY_VER(display) >= 12) { 5151 - enum tc_port tc_port = intel_port_to_tc(display, port); 5151 + enum tc_port tc_port = intel_tc_phy_port_to_tc(display, port); 5152 5152 5153 5153 seq_buf_printf(s, "DDI %s%c/PHY %s%c", 5154 5154 port >= PORT_TC1 ? "TC" : "", ··· 5156 5156 tc_port != TC_PORT_NONE ? "TC" : "", 5157 5157 tc_port != TC_PORT_NONE ? tc_port_name(tc_port) : phy_name(phy)); 5158 5158 } else if (DISPLAY_VER(display) >= 11) { 5159 - enum tc_port tc_port = intel_port_to_tc(display, port); 5159 + enum tc_port tc_port = intel_tc_phy_port_to_tc(display, port); 5160 5160 5161 5161 seq_buf_printf(s, "DDI %c%s/PHY %s%c", 5162 5162 port_name(port),
+19 -4
drivers/gpu/drm/i915/display/intel_display.c
··· 1859 1859 } 1860 1860 1861 1861 /* Prefer intel_encoder_to_tc() */ 1862 + /* 1863 + * Return TC_PORT_1..I915_MAX_TC_PORTS for any TypeC DDI port. The function 1864 + * can be also called for TypeC DDI ports not connected to a TypeC PHY such as 1865 + * the PORT_TC1..4 ports on RKL/ADLS/BMG. 1866 + */ 1862 1867 enum tc_port intel_port_to_tc(struct intel_display *display, enum port port) 1863 1868 { 1864 - if (!intel_phy_is_tc(display, intel_port_to_phy(display, port))) 1865 - return TC_PORT_NONE; 1866 - 1867 1869 if (DISPLAY_VER(display) >= 12) 1868 1870 return TC_PORT_1 + port - PORT_TC1; 1869 1871 else 1870 1872 return TC_PORT_1 + port - PORT_C; 1873 + } 1874 + 1875 + /* 1876 + * Return TC_PORT_1..I915_MAX_TC_PORTS for TypeC DDI ports connected to a TypeC PHY. 1877 + * Note that on RKL, ADLS, BMG the PORT_TC1..4 ports are connected to a non-TypeC 1878 + * PHY, so on those platforms the function returns TC_PORT_NONE. 1879 + */ 1880 + enum tc_port intel_tc_phy_port_to_tc(struct intel_display *display, enum port port) 1881 + { 1882 + if (!intel_phy_is_tc(display, intel_port_to_phy(display, port))) 1883 + return TC_PORT_NONE; 1884 + 1885 + return intel_port_to_tc(display, port); 1871 1886 } 1872 1887 1873 1888 enum phy intel_encoder_to_phy(struct intel_encoder *encoder) ··· 1917 1902 { 1918 1903 struct intel_display *display = to_intel_display(encoder); 1919 1904 1920 - return intel_port_to_tc(display, encoder->port); 1905 + return intel_tc_phy_port_to_tc(display, encoder->port); 1921 1906 } 1922 1907 1923 1908 enum intel_display_power_domain
+1
drivers/gpu/drm/i915/display/intel_display.h
··· 451 451 bool intel_phy_is_tc(struct intel_display *display, enum phy phy); 452 452 bool intel_phy_is_snps(struct intel_display *display, enum phy phy); 453 453 enum tc_port intel_port_to_tc(struct intel_display *display, enum port port); 454 + enum tc_port intel_tc_phy_port_to_tc(struct intel_display *display, enum port port); 454 455 455 456 enum phy intel_encoder_to_phy(struct intel_encoder *encoder); 456 457 bool intel_encoder_is_combo(struct intel_encoder *encoder);