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/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 <johan+linaro@kernel.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Johan Hovold <johan+linaro@kernel.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
Acked-by: Jani Nikula <jani.nikula@intel.com>
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 <dmitry.baryshkov@linaro.org>

authored by

Abel Vesa and committed by
Dmitry Baryshkov
5e771547 13037730

+63
+61
drivers/gpu/drm/display/drm_dp_helper.c
··· 2876 2876 EXPORT_SYMBOL(drm_dp_lttpr_max_link_rate); 2877 2877 2878 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 + 2939 + /** 2879 2940 * drm_dp_lttpr_max_lane_count - get the maximum lane count supported by all LTTPRs 2880 2941 * @caps: LTTPR common capabilities 2881 2942 *
+2
include/drm/display/drm_dp_helper.h
··· 630 630 u8 caps[DP_LTTPR_PHY_CAP_SIZE]); 631 631 int drm_dp_lttpr_count(const u8 cap[DP_LTTPR_COMMON_CAP_SIZE]); 632 632 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); 633 635 int drm_dp_lttpr_max_lane_count(const u8 caps[DP_LTTPR_COMMON_CAP_SIZE]); 634 636 bool drm_dp_lttpr_voltage_swing_level_3_supported(const u8 caps[DP_LTTPR_PHY_CAP_SIZE]); 635 637 bool drm_dp_lttpr_pre_emphasis_level_3_supported(const u8 caps[DP_LTTPR_PHY_CAP_SIZE]);