* [PATCH v4 1/2] drm/tiny: ili9486: Enable driver module autoloading
2022-12-19 9:02 [PATCH v4 0/2] Make ILI9486 driver working with 16-bits SPI controllers Carlo Caione
@ 2022-12-19 9:02 ` Carlo Caione
2023-01-02 10:33 ` Thomas Zimmermann
2022-12-19 9:02 ` [PATCH v4 2/2] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers Carlo Caione
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Carlo Caione @ 2022-12-19 9:02 UTC (permalink / raw)
To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Mark Brown,
Daniel Vetter, David Airlie, Kamlesh Gurudasani,
Martin Blumenstingl
Cc: dri-devel, linux-arm-kernel, Carlo Caione, linux-kernel, linux-amlogic
SPI devices use the spi_device_id for module autoloading even on
systems using device tree.
Add the spi_device_id entry to enable autoloading for the 3.5inch RPi
Display (rpi-lcd-35 and piscreen).
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
---
drivers/gpu/drm/tiny/ili9486.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
index 1bb847466b10..8bf0dca0b05d 100644
--- a/drivers/gpu/drm/tiny/ili9486.c
+++ b/drivers/gpu/drm/tiny/ili9486.c
@@ -183,6 +183,8 @@ MODULE_DEVICE_TABLE(of, ili9486_of_match);
static const struct spi_device_id ili9486_id[] = {
{ "ili9486", 0 },
+ { "rpi-lcd-35", 0 },
+ { "piscreen", 0 },
{ }
};
MODULE_DEVICE_TABLE(spi, ili9486_id);
--
b4 0.10.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v4 1/2] drm/tiny: ili9486: Enable driver module autoloading
2022-12-19 9:02 ` [PATCH v4 1/2] drm/tiny: ili9486: Enable driver module autoloading Carlo Caione
@ 2023-01-02 10:33 ` Thomas Zimmermann
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Zimmermann @ 2023-01-02 10:33 UTC (permalink / raw)
To: Carlo Caione, Neil Armstrong, Kevin Hilman, Jerome Brunet,
Mark Brown, Daniel Vetter, David Airlie, Kamlesh Gurudasani,
Martin Blumenstingl
Cc: linux-kernel, linux-amlogic, linux-arm-kernel, dri-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 1258 bytes --]
Hi
Am 19.12.22 um 10:02 schrieb Carlo Caione:
> SPI devices use the spi_device_id for module autoloading even on
> systems using device tree.
>
> Add the spi_device_id entry to enable autoloading for the 3.5inch RPi
> Display (rpi-lcd-35 and piscreen).
>
> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
> ---
> drivers/gpu/drm/tiny/ili9486.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
> index 1bb847466b10..8bf0dca0b05d 100644
> --- a/drivers/gpu/drm/tiny/ili9486.c
> +++ b/drivers/gpu/drm/tiny/ili9486.c
> @@ -183,6 +183,8 @@ MODULE_DEVICE_TABLE(of, ili9486_of_match);
>
> static const struct spi_device_id ili9486_id[] = {
> { "ili9486", 0 },
> + { "rpi-lcd-35", 0 },
> + { "piscreen", 0 },
Alphabetical sorting please.
With that:
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Best regards
Thomas
> { }
> };
> MODULE_DEVICE_TABLE(spi, ili9486_id);
>
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
[-- Attachment #2: Type: text/plain, Size: 167 bytes --]
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v4 2/2] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers
2022-12-19 9:02 [PATCH v4 0/2] Make ILI9486 driver working with 16-bits SPI controllers Carlo Caione
2022-12-19 9:02 ` [PATCH v4 1/2] drm/tiny: ili9486: Enable driver module autoloading Carlo Caione
@ 2022-12-19 9:02 ` Carlo Caione
2022-12-19 13:43 ` [PATCH v4 0/2] Make ILI9486 driver working with 16-bits " Neil Armstrong
2023-01-02 10:03 ` Neil Armstrong
3 siblings, 0 replies; 6+ messages in thread
From: Carlo Caione @ 2022-12-19 9:02 UTC (permalink / raw)
To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Mark Brown,
Daniel Vetter, David Airlie, Kamlesh Gurudasani,
Martin Blumenstingl
Cc: dri-devel, linux-arm-kernel, Carlo Caione, linux-kernel, linux-amlogic
The pixel data for the ILI9486 is always 16-bits wide and it must be
sent over the SPI bus. When the controller is only able to deal with
8-bit transfers, this 16-bits data needs to be swapped before the
sending to account for the big endian bus, this is on the contrary not
needed when the SPI controller already supports 16-bits transfers.
The decision about swapping the pixel data or not is taken in the MIPI
DBI code by probing the controller capabilities: if the controller only
suppors 8-bit transfers the data is swapped, otherwise it is not.
This swapping/non-swapping is relying on the assumption that when the
controller does support 16-bit transactions then the data is sent
unswapped in 16-bits-per-word over SPI.
The problem with the ILI9486 driver is that it is forcing 8-bit
transactions also for controllers supporting 16-bits, violating the
assumption and corrupting the pixel data.
Align the driver to what is done in the MIPI DBI code by adjusting the
transfer size to the maximum allowed by the SPI controller.
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Carlo Caione <ccaione@baylibre.com>
---
drivers/gpu/drm/tiny/ili9486.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
index 8bf0dca0b05d..6f03531175bd 100644
--- a/drivers/gpu/drm/tiny/ili9486.c
+++ b/drivers/gpu/drm/tiny/ili9486.c
@@ -43,6 +43,7 @@ static int waveshare_command(struct mipi_dbi *mipi, u8 *cmd, u8 *par,
size_t num)
{
struct spi_device *spi = mipi->spi;
+ unsigned int bpw = 8;
void *data = par;
u32 speed_hz;
int i, ret;
@@ -56,8 +57,6 @@ static int waveshare_command(struct mipi_dbi *mipi, u8 *cmd, u8 *par,
* The displays are Raspberry Pi HATs and connected to the 8-bit only
* SPI controller, so 16-bit command and parameters need byte swapping
* before being transferred as 8-bit on the big endian SPI bus.
- * Pixel data bytes have already been swapped before this function is
- * called.
*/
buf[0] = cpu_to_be16(*cmd);
gpiod_set_value_cansleep(mipi->dc, 0);
@@ -71,12 +70,18 @@ static int waveshare_command(struct mipi_dbi *mipi, u8 *cmd, u8 *par,
for (i = 0; i < num; i++)
buf[i] = cpu_to_be16(par[i]);
num *= 2;
- speed_hz = mipi_dbi_spi_cmd_max_speed(spi, num);
data = buf;
}
+ /*
+ * Check whether pixel data bytes needs to be swapped or not
+ */
+ if (*cmd == MIPI_DCS_WRITE_MEMORY_START && !mipi->swap_bytes)
+ bpw = 16;
+
gpiod_set_value_cansleep(mipi->dc, 1);
- ret = mipi_dbi_spi_transfer(spi, speed_hz, 8, data, num);
+ speed_hz = mipi_dbi_spi_cmd_max_speed(spi, num);
+ ret = mipi_dbi_spi_transfer(spi, speed_hz, bpw, data, num);
free:
kfree(buf);
--
b4 0.10.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v4 0/2] Make ILI9486 driver working with 16-bits SPI controllers
2022-12-19 9:02 [PATCH v4 0/2] Make ILI9486 driver working with 16-bits SPI controllers Carlo Caione
2022-12-19 9:02 ` [PATCH v4 1/2] drm/tiny: ili9486: Enable driver module autoloading Carlo Caione
2022-12-19 9:02 ` [PATCH v4 2/2] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers Carlo Caione
@ 2022-12-19 13:43 ` Neil Armstrong
2023-01-02 10:03 ` Neil Armstrong
3 siblings, 0 replies; 6+ messages in thread
From: Neil Armstrong @ 2022-12-19 13:43 UTC (permalink / raw)
To: Carlo Caione, Kevin Hilman, Jerome Brunet, Mark Brown,
Daniel Vetter, David Airlie, Kamlesh Gurudasani,
Martin Blumenstingl
Cc: dri-devel, linux-arm-kernel, linux-kernel, linux-amlogic
Hi Kamlesh,
On 19/12/2022 10:02, Carlo Caione wrote:
> This patchset is trying to fix problems seen on S905X boards when interfacing
> with an ILI9486 equipped SPI panel.
I fully reviewed both patches, but I'd like a review from the maintainer,
can you have a look ?
Thanks,
Neil
>
> To: Kamlesh Gurudasani <kamlesh.gurudasani@gmail.com>
> To: David Airlie <airlied@gmail.com>
> To: Daniel Vetter <daniel@ffwll.ch>
> To: Mark Brown <broonie@kernel.org>
> To: Neil Armstrong <neil.armstrong@linaro.org>
> To: Kevin Hilman <khilman@baylibre.com>
> To: Jerome Brunet <jbrunet@baylibre.com>
> To: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
> Cc: dri-devel@lists.freedesktop.org
> Cc: linux-kernel@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-amlogic@lists.infradead.org
> Signed-off-by: Carlo Caione <ccaione@baylibre.com>
>
> ---
> Changes in v4:
> - Removed NAK-ed patch from patchset
> - Link to v3: https://lore.kernel.org/r/20221116-s905x_spi_ili9486-v3-0-59c6b58cbfe3@baylibre.com
>
> Changes in v3:
> - Added trailers
> - Added new patch to use drm_aperture_remove_framebuffers()
> - Link to v2: https://lore.kernel.org/r/20221116-s905x_spi_ili9486-v2-0-084c6e3cd930@baylibre.com
>
> Changes in v2:
> - Removed SPICC patch
> - Reworked commit message
> - Link to v1: https://lore.kernel.org/r/20221116-s905x_spi_ili9486-v1-0-630401cb62d5@baylibre.com
>
> ---
> Carlo Caione (2):
> drm/tiny: ili9486: Enable driver module autoloading
> drm/tiny: ili9486: Do not assume 8-bit only SPI controllers
>
> drivers/gpu/drm/tiny/ili9486.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
> ---
> base-commit: 84e57d292203a45c96dbcb2e6be9dd80961d981a
> change-id: 20221116-s905x_spi_ili9486-aed54ff3cb21
>
> Best regards,
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v4 0/2] Make ILI9486 driver working with 16-bits SPI controllers
2022-12-19 9:02 [PATCH v4 0/2] Make ILI9486 driver working with 16-bits SPI controllers Carlo Caione
` (2 preceding siblings ...)
2022-12-19 13:43 ` [PATCH v4 0/2] Make ILI9486 driver working with 16-bits " Neil Armstrong
@ 2023-01-02 10:03 ` Neil Armstrong
3 siblings, 0 replies; 6+ messages in thread
From: Neil Armstrong @ 2023-01-02 10:03 UTC (permalink / raw)
To: Daniel Vetter, Mark Brown, Jerome Brunet, Carlo Caione,
Kamlesh Gurudasani, David Airlie, Kevin Hilman,
Martin Blumenstingl
Cc: linux-amlogic, linux-kernel, dri-devel, linux-arm-kernel
Hi,
On Mon, 19 Dec 2022 10:02:36 +0100, Carlo Caione wrote:
> This patchset is trying to fix problems seen on S905X boards when interfacing
> with an ILI9486 equipped SPI panel.
>
>
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)
[1/2] drm/tiny: ili9486: Enable driver module autoloading
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=e9c7cfe7b71d26ee4a9f17192632f3d0ff246001
[2/2] drm/tiny: ili9486: Do not assume 8-bit only SPI controllers
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=77772e607522daa61f3af74df018559db75c43d6
--
Neil
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 6+ messages in thread