On 25-01-07 10:30:29, Johan Hovold wrote: > On Fri, Jan 03, 2025 at 02:58:15PM +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. > > > > Tested-by: Johan Hovold <johan+linaro@xxxxxxxxxx> > > Signed-off-by: Abel Vesa <abel.vesa@xxxxxxxxxx> > > > +/** > > + * drm_dp_lttpr_init - init LTTPR transparency mode according to DP standard > > + * > > + * @aux: DisplayPort AUX channel > > + * @lttpr_count: Number of LTTPRs. Between 0 and 8, according to DP standard. > > + * Negative error code for any non-valid number. > > + * See drm_dp_lttpr_count(). > > + * > > + * Returns 0 on success or a negative error code on failure. > > + */ > > +int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count) > > +{ > > + int ret; > > + > > + 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. > > + */ > > + ret = drm_dp_lttpr_set_transparent_mode(aux, true); > > + if (ret) > > + return ret; > > + > > + if (lttpr_count < 0) > > + return -ENODEV; > > + > > + /* > > + * Roll-back to tranparent mode if setting non-tranparent mode failed > > typo: transparent (2x) Will fix. > > > + */ > > I think this comment now needs to go inside the conditional, if you want > to keep it at all. Yes, will move it. > > > + if (drm_dp_lttpr_set_transparent_mode(aux, false)) { > > + drm_dp_lttpr_set_transparent_mode(aux, true); > > + return -EINVAL; > > + } > > + > > + return 0; > > +} > > +EXPORT_SYMBOL(drm_dp_lttpr_init); > > This looks much better to me now, so with the above addressed: > > Reviewed-by: Johan Hovold <johan+linaro@xxxxxxxxxx> Thanks for reviewing! Abel