Skip to content

Commit 69e90c1

Browse files
Wayne Lingregkh
authored andcommitted
drm/dp_mst: Fix drm RAD print
[ Upstream commit 6bbce87 ] [Why] The RAD of sideband message printed today is incorrect. For RAD stored within MST branch - If MST branch LCT is 1, it's RAD array is untouched and remained as 0. - If MST branch LCT is larger than 1, use nibble to store the up facing port number in cascaded sequence as illustrated below: u8 RAD[0] = (LCT_2_UFP << 4) | LCT_3_UFP RAD[1] = (LCT_4_UFP << 4) | LCT_5_UFP ... In drm_dp_mst_rad_to_str(), it wrongly to use BIT_MASK(4) to fetch the port number of one nibble. [How] Adjust the code by: - RAD array items are valuable only for LCT >= 1. - Use 0xF as the mask to replace BIT_MASK(4) V2: - Document how RAD is constructed (Imre) V3: - Adjust the comment for rad[] so kdoc formats it properly (Lyude) Fixes: 2f015ec ("drm/dp_mst: Add sideband down request tracing + selftests") Cc: Imre Deak <imre.deak@intel.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Harry Wentland <hwentlan@amd.com> Cc: Lyude Paul <lyude@redhat.com> Reviewed-by: Lyude Paul <lyude@redhat.com> Signed-off-by: Wayne Lin <Wayne.Lin@amd.com> Signed-off-by: Lyude Paul <lyude@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250113091100.3314533-2-Wayne.Lin@amd.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 5ffb6b9 commit 69e90c1

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

drivers/gpu/drm/display/drm_dp_mst_topology.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ static int
179179
drm_dp_mst_rad_to_str(const u8 rad[8], u8 lct, char *out, size_t len)
180180
{
181181
int i;
182-
u8 unpacked_rad[16];
182+
u8 unpacked_rad[16] = {};
183183

184-
for (i = 0; i < lct; i++) {
184+
for (i = 1; i < lct; i++) {
185185
if (i % 2)
186-
unpacked_rad[i] = rad[i / 2] >> 4;
186+
unpacked_rad[i] = rad[(i - 1) / 2] >> 4;
187187
else
188-
unpacked_rad[i] = rad[i / 2] & BIT_MASK(4);
188+
unpacked_rad[i] = rad[(i - 1) / 2] & 0xF;
189189
}
190190

191191
/* TODO: Eventually add something to printk so we can format the rad

include/drm/display/drm_dp_mst_helper.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ struct drm_dp_mst_branch {
222222
*/
223223
struct list_head destroy_next;
224224

225+
/**
226+
* @rad: Relative Address of the MST branch.
227+
* For &drm_dp_mst_topology_mgr.mst_primary, it's rad[8] are all 0,
228+
* unset and unused. For MST branches connected after mst_primary,
229+
* in each element of rad[] the nibbles are ordered by the most
230+
* signifcant 4 bits first and the least significant 4 bits second.
231+
*/
225232
u8 rad[8];
226233
u8 lct;
227234
int num_ports;

0 commit comments

Comments
 (0)