From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thierry Reding Subject: Re: [PATCH v2 01/15] drm/dsi: Make mipi_dsi_dcs_{read, write}() symmetrical Date: Tue, 14 Oct 2014 13:47:04 +0200 Message-ID: <20141014114701.GC5057@ulmo> References: <1413195395-3355-1-git-send-email-thierry.reding@gmail.com> <543CD820.8080606@samsung.com> <20141014094400.GD18993@ulmo> <543CFD17.10806@samsung.com> <20141014105730.GH18993@ulmo> <20141014111337.GA4807@ulmo> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0158548727==" Return-path: Received: from mail-wi0-f175.google.com (mail-wi0-f175.google.com [209.85.212.175]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D3EC6E0EF for ; Tue, 14 Oct 2014 04:47:07 -0700 (PDT) Received: by mail-wi0-f175.google.com with SMTP id d1so9833750wiv.8 for ; Tue, 14 Oct 2014 04:47:06 -0700 (PDT) In-Reply-To: <20141014111337.GA4807@ulmo> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Andrzej Hajda Cc: dri-devel@lists.freedesktop.org List-Id: dri-devel@lists.freedesktop.org --===============0158548727== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="L6iaP+gRLNZHKoI4" Content-Disposition: inline --L6iaP+gRLNZHKoI4 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 14, 2014 at 01:13:38PM +0200, Thierry Reding wrote: > On Tue, Oct 14, 2014 at 12:57:31PM +0200, Thierry Reding wrote: > > On Tue, Oct 14, 2014 at 12:38:15PM +0200, Andrzej Hajda wrote: > [...] > > > It has nothing to do with helpers symmetry, this is serious API chang= e. > >=20 > > No, it's not. It replaces an existing API, mipi_dsi_dcs_write() with a > > different one, mipi_dsi_dcs_write_buffer() and converts the one call > > site where the function is used. > >=20 > > Then it introduces a new function that behaves the same but uses a > > different signature that takes the DCS command byte as an explicit > > parameter instead of embedding the DCS command byte into the "payload" > > buffer. > >=20 > > I don't understand why you think we're changing anything fundamental > > here. >=20 > I think I understand now why you think this is a problem. It seems like > the Exynos driver was implemented in a way that it injects the length of > the payload manually, whereas mipi_dsi_dcs_write() is written in a way > to insert the length into the payload already. >=20 > Letting host implementations take care of this is just going to lead to > duplicating the same code everywhere. I think we should let the DSI core > figure out what type of packet it is supposed to generate and then build > the complete message using that data. That way what the DSI host gets is > a raw buffer that it just needs to write into the right registers. >=20 > Specifically, if we don't do this in the DSI core, then *every* DSI host > driver needs to do something similar to the >=20 > if (exynos_dsi_is_short_dsi_type(msg->type)) { > ... > } >=20 > block in their implementation of the .transfer() function. And none of > that is really driver specific. It's defined by the DSI specification > and therefore has no place in the individual drivers. It should be pretty trivial to adapt the Exynos implementation to deal with the DSI core providing the payload this way. I'm thinking something like: xfer.data[0] =3D msg->tx_buf[0]; if (msg->tx_len > 1) xfer.data[1] =3D msg->tx_buf[1]; else xfer.data[1] =3D 0; xfer.tx_len =3D 0; if (msg->tx_len > 2) { xfer.tx_payload =3D &msg->tx_buf[2]; xfer.tx_len =3D msg->tx_len - 2; } And it can probably be even more reduced if the now unneeded .data or =2Etx_payload fields are removed. Thierry --L6iaP+gRLNZHKoI4 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJUPQ01AAoJEN0jrNd/PrOh6OwP/359anXG2/pirQe/dhDxuFWQ 4rEM/2pbzGjOEuhBYOUAMlVhiU6l9EIvVhXYstHCZWIuiXJmjA1v6zLdw0yuwdTp Vea49E2Ymnn7J+OSaHs+sIzQBvc5Uw/yzuy63w8riGwpAOPz7882bWJxF1hCv344 PHEELSoykbWoz+zELT6JqytmxoQcV/zISixjhMQcfgNYy4kfBdsbS/cwqlIbYW0G LzHhoED59jOSmxQDCJz9rlUuDWFpQ2HDcGxzm+MklMlK/eF0tGcUqEIbsqiewez/ nCUF6ocSqc6dX9mefUKcT1addwcScy9JfFN6Ox7rukpEs5bUe8F6faYQAEqxawSc /I9Vt5Cra61V2+7FbuvSNX6u7x3++pZamEes+e3HVhxG9vDQPgpbvbov9NCHfUQn TlxW22TfFqRw6kIvJpfaOVQ4T34ftANj+EKw8jioGZq/mV7VctMTrC+Q9JcjVXv5 a8tVjiu5yNCMgjKjQ/1vINttZrYDKRTu66l6Bvl3CzWrVBhA+/WQv7fcco2YXplt GjIB2kmTlqqVHTq3cl567hGsDawhQBCS7Eeiwww+wv87E6k2OKD4r6ae6N2lzcP4 onGcTYqrMofkb+546EnjTHIoXN5Y896VruVJ40LRy7PNvLPND+WM34teGMUCBuTk eWEg3Dczw9UI7Dt1QLSR =JOe3 -----END PGP SIGNATURE----- --L6iaP+gRLNZHKoI4-- --===============0158548727== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel --===============0158548727==--