From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH 06/15] drm/dp: Read AUX read interval from DPCD Date: Mon, 21 Oct 2019 09:55:56 +0200 Message-ID: <20191021075556.GA1118266@ulmo> References: <20191015143509.1104985-1-thierry.reding@gmail.com> <20191015143509.1104985-7-thierry.reding@gmail.com> <83d91ac4c67768d013615ee6312b84da3fb959fe.camel@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1472450498==" Return-path: Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by gabe.freedesktop.org (Postfix) with ESMTPS id 65D9D89ACC for ; Mon, 21 Oct 2019 07:56:01 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id r141so2100074wme.4 for ; Mon, 21 Oct 2019 00:56:01 -0700 (PDT) In-Reply-To: <83d91ac4c67768d013615ee6312b84da3fb959fe.camel@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Lyude Paul Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============1472450498== Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Q68bSM7Ycu6FN28Q" Content-Disposition: inline --Q68bSM7Ycu6FN28Q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 18, 2019 at 05:27:59PM -0400, Lyude Paul wrote: > On Tue, 2019-10-15 at 16:35 +0200, Thierry Reding wrote: > > From: Thierry Reding > >=20 > > Store the AUX read interval from DPCD, so that it can be used to wait > > for the durations given in the specification during link training. > >=20 > > Signed-off-by: Thierry Reding > > --- > > include/drm/drm_dp_helper.h | 33 +++++++++++++++++++++++++++++++++ > > 1 file changed, 33 insertions(+) > >=20 > > diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h > > index 7a537ffc2fb1..6c12de6f7e46 100644 > > --- a/include/drm/drm_dp_helper.h > > +++ b/include/drm/drm_dp_helper.h > > @@ -25,8 +25,11 @@ > > =20 > > #include > > #include > > +#include > > #include > > =20 > > +#include > > + > > /* > > * Unless otherwise noted, all values are from the DP 1.1a spec. Note= that > > * DP and DPCD versions are independent. Differences from 1.0 are not > > noted, > > @@ -1297,6 +1300,36 @@ drm_dp_alternate_scrambler_reset_cap(const u8 > > dpcd[DP_RECEIVER_CAP_SIZE]) > > DP_ALTERNATE_SCRAMBLER_RESET_CAP; > > } > > =20 > > +/** > > + * drm_dp_read_aux_interval() - read the AUX read interval from the DP= CD > > + * @dpcd: receiver capacity buffer > > + * > > + * Reads the AUX read interval (in microseconds) from the DPCD. Note t= hat > > the > > + * TRAINING_AUX_RD_INTERVAL stores the value in units of 4 millisecond= s. If > > no > > + * read interval is specified and for DPCD v1.4 and later, the read > > interval > > + * is always 100 microseconds. > > + * > > + * Returns: > > + * The read AUX interval in microseconds. > > + */ > > +static inline unsigned int > > +drm_dp_aux_rd_interval(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) > > +{ > > + unsigned int rd_interval =3D dpcd[DP_TRAINING_AUX_RD_INTERVAL] & > > + DP_TRAINING_AUX_RD_MASK; > > + > > + if (rd_interval > 4) > > + DRM_DEBUG_KMS("AUX interval %u, out of range (max: 4)\n", > > + rd_interval); > Do you think it might be worth clamping the value to 4 here? Yeah, I think that makes sense. It might also be worth increasing the log level for this, perhaps even make it a WARN to make sure we catch it when this happens. > > + > > + if (rd_interval > 0 && dpcd[DP_DPCD_REV] < DP_DPCD_REV_14) >=20 > Also small nit pick: you can just use rd_interval instead of rd_interval= > 0 Yeah, I suppose so. I thought > 0 was making it really explicit, but I don't really mind either way. Thierry > > + rd_interval *=3D 4 * USEC_PER_MSEC; > > + else > > + rd_interval =3D 100; > > + > > + return rd_interval; > > +} > > + > > /* > > * DisplayPort AUX channel > > */ > --=20 > Cheers, > Lyude Paul >=20 --Q68bSM7Ycu6FN28Q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAl2tZIgACgkQ3SOs138+ s6HX8A/8DacwJDyqrDa4GNX6+jugk6R6dxsc0VTH9H25CZpUwy+8DxXDjdBY3Wr5 Rx1pSD2rJooEZF9v+IJsYD6Sn4ZrEPfa/Tdzd+YbCZGkdQvO7dFbsIB91L7fPv+u oNlGwXnKLBdTTZtxRJuvEUBKBVxB6kOoaSD1tDvCt9YPrOLpVUgiM3Pv/n4cK2L8 5plMSOIGp1Mt1KqRxLJTe21voDGqTMYwXBY7NhWlYoSR4R3ZqBHQr+cjplXXQKBA SHG2wAPU43bSZpyeyod2IidEDVssc0Lrmuq2fznqbVJ/fB42I8PULiRZgREqKxXE ew29Vd/s8fZw5U+jEczQvAnHNXWCgR10v20mjc/jMgUNA2wUdqfxxbemwp39wweJ iXbQqzct+K4jHRGCsvTLnIPxNFVxANLePcqmQGf2V7MLSCP44Ec21zhLKmO8fc3/ GmISUnnMbvMr/tIwJoG1dpgE2q7/6mqicI0g6XRkUd1djC0Nq1xG0rwK7TsGJI+y yRAEg+BXhtN6ud8awDMEsXP4c1g7NTAym2sp5x0LDq+aRpLj35umcehCWhNb6kMM xn5+CyunOan2iIilcOMUdvywomFJfWmNBq7QTjo1Etkk1bJE9Tz3cJgcNEuk9wm1 WpFjQxUFJDXeLOTN4e2J5+baR59dStdZ+V5nInm6KnNJz85RiQQ= =J92J -----END PGP SIGNATURE----- --Q68bSM7Ycu6FN28Q-- --===============1472450498== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVs --===============1472450498==--