Re: [PATCH v2 1/4] drm/dp: Add helper to set LTTPRs in transparent mode
From: Abel Vesa
Date: Thu Dec 26 2024 - 07:10:02 EST
On 24-12-11 21:22:00, Dmitry Baryshkov wrote:
> 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?
Yes, exactly. If counting the LTTPRs (see drm_dp_lttpr_count) results in an
invalid number (e.g. more than 8), then according to the DP standard,
we need to roll back to transparent mode.
Do you think I need to re-word the comment above more to make it more
clearer?
>
> > +
> > + return -EINVAL;
> > +}
> > +EXPORT_SYMBOL(drm_dp_lttpr_init);
> > +
>
> --
> With best wishes
> Dmitry
Thanks for reviewing,
Abel