From: Paul Cercueil <paul@crapouillou.net>
To: "Noralf Trønnes" <noralf@tronnes.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>,
dri-devel@lists.freedesktop.org, stable@vger.kernel.org,
Sam Ravnborg <sam@ravnborg.org>
Subject: Re: [PATCH] drm/dbi: Fix SPI Type 1 (9-bit) transfer
Date: Tue, 07 Jul 2020 01:49:59 +0200 [thread overview]
Message-ID: <BJN2DQ.10EODF78DAWA@crapouillou.net> (raw)
In-Reply-To: <0dda6b3f-ea8c-6a7e-5c7c-f26874b825c8@tronnes.org>
Hi Noralf,
Le dim. 5 juil. 2020 à 17:58, Noralf Trønnes <noralf@tronnes.org> a
écrit :
>
>
> Den 03.07.2020 16.13, skrev Paul Cercueil:
>> The function mipi_dbi_spi1_transfer() will transfer its payload as
>> 9-bit
>> data, the 9th (MSB) bit being the data/command bit. In order to do
>> that,
>> it unpacks the 8-bit values into 16-bit values, then sets the 9th
>> bit if
>> the byte corresponds to data, clears it otherwise. The 7 MSB are
>> padding. The array of now 16-bit values is then passed to the SPI
>> core
>> for transfer.
>>
>> This function was broken since its introduction, as the length of
>> the
>> SPI transfer was set to the payload size before its conversion, but
>> the
>> payload doubled in size due to the 8-bit -> 16-bit conversion.
>>
>> Fixes: 02dd95fe3169 ("drm/tinydrm: Add MIPI DBI support")
>> Cc: <stable@vger.kernel.org> # 4.10
>
> The code was moved to drm_mipi_dbi.c in 5.4 so this patch won't apply
> before that.
I believe I can submit a patch for pre-5.4 too.
>> Signed-off-by: Paul Cercueil <paul@crapouillou.net>
>> ---
>
> Thanks for fixing this, clearly I didn't test this. Probably because
> the
> aux spi ip block on the Raspberry Pi that can do 9 bit didn't have a
> driver at the time. Did you actually test this or was it spotted
> reading
> the code?
I did test it on hardware, yes - that's how I spotted the bug.
-Paul
> Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
>
>> drivers/gpu/drm/drm_mipi_dbi.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c
>> b/drivers/gpu/drm/drm_mipi_dbi.c
>> index bb27c82757f1..bf7888ad9ad4 100644
>> --- a/drivers/gpu/drm/drm_mipi_dbi.c
>> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
>> @@ -923,7 +923,7 @@ static int mipi_dbi_spi1_transfer(struct
>> mipi_dbi *dbi, int dc,
>> }
>> }
>>
>> - tr.len = chunk;
>> + tr.len = chunk * 2;
>> len -= chunk;
>>
>> ret = spi_sync(spi, &m);
>>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
prev parent reply other threads:[~2020-07-07 7:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-03 14:13 [PATCH] drm/dbi: Fix SPI Type 1 (9-bit) transfer Paul Cercueil
2020-07-03 14:23 ` Sam Ravnborg
2020-07-27 18:36 ` Sam Ravnborg
2020-07-03 14:26 ` Sam Ravnborg
2020-07-05 15:58 ` Noralf Trønnes
2020-07-06 23:49 ` Paul Cercueil [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BJN2DQ.10EODF78DAWA@crapouillou.net \
--to=paul@crapouillou.net \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=noralf@tronnes.org \
--cc=sam@ravnborg.org \
--cc=stable@vger.kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox