On Wed, Dec 11, 2024 at 03:04:12PM +0200, Abel Vesa wrote: > 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. > > Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxx> > --- > drivers/gpu/drm/display/drm_dp_helper.c | 50 +++++++++++++++++++++++++++++++++ > include/drm/display/drm_dp_helper.h | 2 ++ > 2 files changed, 52 insertions(+) > > +/** > + * drm_dp_lttpr_init - init LTTPR transparency mode according to DP standard > + * > + * @aux: DisplayPort AUX channel > + * @lttpr_count: Number of LTTPRs > + * > + * Returns 0 on success or a negative error code on failure. > + */ > +int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count) > +{ > + if (!lttpr_count) > + return 0; > + > + /* > + * See DP Standard v2.0 3.6.6.1 about the explicit disabling of > + * non-transparent mode and the disable->enable non-transparent mode > + * sequence. > + */ > + drm_dp_lttpr_set_transparent_mode(aux, true); > + > + if (lttpr_count > 0 && !drm_dp_lttpr_set_transparent_mode(aux, false)) > + return 0; > + > + /* > + * Roll-back to tranparent mode if setting non-tranparent mode failed or > + * the number of LTTPRs is invalid > + */ > + drm_dp_lttpr_set_transparent_mode(aux, true); This means that if lttpr_count < 0, then there will be two requests to set LTTPRs to a transparent mode. Is that expected? > + > + return -EINVAL; > +} > +EXPORT_SYMBOL(drm_dp_lttpr_init); > + -- With best wishes Dmitry