Skip to content

Commit 5e77154

Browse files
abelvesalumag
authored andcommitted
drm/dp: Add helper to set LTTPRs in transparent mode
According to the DisplayPort standard, LTTPRs have two operating modes: - non-transparent - it replies to DPCD LTTPR field specific AUX requests, while passes through all other AUX requests - transparent - it passes through all AUX requests. Switching between this two modes is done by the DPTX by issuing an AUX write to the DPCD PHY_REPEATER_MODE register. Add a generic helper that allows switching between these modes. Also add a generic wrapper for the helper that handles the explicit disabling of non-transparent mode and its disable->enable sequence mentioned in the DP Standard v2.0 section 3.6.6.1. Do this in order to move this handling out of the vendor specific driver implementation into the generic framework. Tested-by: Johan Hovold <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Reviewed-by: Johan Hovold <[email protected]> Reviewed-by: Abhinav Kumar <[email protected]> Signed-off-by: Abel Vesa <[email protected]> Acked-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20250203-drm-dp-msm-add-lttpr-transparent-mode-set-v5-1-c865d0e56d6e@linaro.org Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent 1303773 commit 5e77154

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

drivers/gpu/drm/display/drm_dp_helper.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2875,6 +2875,67 @@ int drm_dp_lttpr_max_link_rate(const u8 caps[DP_LTTPR_COMMON_CAP_SIZE])
28752875
}
28762876
EXPORT_SYMBOL(drm_dp_lttpr_max_link_rate);
28772877

2878+
/**
2879+
* drm_dp_lttpr_set_transparent_mode() - set the LTTPR in transparent mode
2880+
* @aux: DisplayPort AUX channel
2881+
* @enable: Enable or disable transparent mode
2882+
*
2883+
* Returns: 0 on success or a negative error code on failure.
2884+
*/
2885+
int drm_dp_lttpr_set_transparent_mode(struct drm_dp_aux *aux, bool enable)
2886+
{
2887+
u8 val = enable ? DP_PHY_REPEATER_MODE_TRANSPARENT :
2888+
DP_PHY_REPEATER_MODE_NON_TRANSPARENT;
2889+
int ret = drm_dp_dpcd_writeb(aux, DP_PHY_REPEATER_MODE, val);
2890+
2891+
if (ret < 0)
2892+
return ret;
2893+
2894+
return (ret == 1) ? 0 : -EIO;
2895+
}
2896+
EXPORT_SYMBOL(drm_dp_lttpr_set_transparent_mode);
2897+
2898+
/**
2899+
* drm_dp_lttpr_init() - init LTTPR transparency mode according to DP standard
2900+
* @aux: DisplayPort AUX channel
2901+
* @lttpr_count: Number of LTTPRs. Between 0 and 8, according to DP standard.
2902+
* Negative error code for any non-valid number.
2903+
* See drm_dp_lttpr_count().
2904+
*
2905+
* Returns: 0 on success or a negative error code on failure.
2906+
*/
2907+
int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count)
2908+
{
2909+
int ret;
2910+
2911+
if (!lttpr_count)
2912+
return 0;
2913+
2914+
/*
2915+
* See DP Standard v2.0 3.6.6.1 about the explicit disabling of
2916+
* non-transparent mode and the disable->enable non-transparent mode
2917+
* sequence.
2918+
*/
2919+
ret = drm_dp_lttpr_set_transparent_mode(aux, true);
2920+
if (ret)
2921+
return ret;
2922+
2923+
if (lttpr_count < 0)
2924+
return -ENODEV;
2925+
2926+
if (drm_dp_lttpr_set_transparent_mode(aux, false)) {
2927+
/*
2928+
* Roll-back to transparent mode if setting non-transparent
2929+
* mode has failed
2930+
*/
2931+
drm_dp_lttpr_set_transparent_mode(aux, true);
2932+
return -EINVAL;
2933+
}
2934+
2935+
return 0;
2936+
}
2937+
EXPORT_SYMBOL(drm_dp_lttpr_init);
2938+
28782939
/**
28792940
* drm_dp_lttpr_max_lane_count - get the maximum lane count supported by all LTTPRs
28802941
* @caps: LTTPR common capabilities

include/drm/display/drm_dp_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ int drm_dp_read_lttpr_phy_caps(struct drm_dp_aux *aux,
630630
u8 caps[DP_LTTPR_PHY_CAP_SIZE]);
631631
int drm_dp_lttpr_count(const u8 cap[DP_LTTPR_COMMON_CAP_SIZE]);
632632
int drm_dp_lttpr_max_link_rate(const u8 caps[DP_LTTPR_COMMON_CAP_SIZE]);
633+
int drm_dp_lttpr_set_transparent_mode(struct drm_dp_aux *aux, bool enable);
634+
int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count);
633635
int drm_dp_lttpr_max_lane_count(const u8 caps[DP_LTTPR_COMMON_CAP_SIZE]);
634636
bool drm_dp_lttpr_voltage_swing_level_3_supported(const u8 caps[DP_LTTPR_PHY_CAP_SIZE]);
635637
bool drm_dp_lttpr_pre_emphasis_level_3_supported(const u8 caps[DP_LTTPR_PHY_CAP_SIZE]);

0 commit comments

Comments
 (0)