diff mbox

[1/3] backlight: tdo24m: fix the spi cs between transfers

Message ID 20171006195826.27500-1-robert.jarzmik@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Robert Jarzmik Oct. 6, 2017, 7:58 p.m. UTC
Currently the LCD display (TD035S) on the cm-x300 platform is broken and
remains blank.

The TD0245S specification requires that the chipselect is toggled
between commands sent to the panel. This was also the purpose of the
former patch of commit f64dcac0b124 ("backlight: tdo24m: ensure chip
select changes between transfers").

Unfortunately, the "cs_change" field of a SPI transfer is
misleading. Its true meaning is that for a SPI message holding multiple
transfers, the chip select is toggled between each transfer, but for the
last transfer it remains asserted.

In this driver, all the SPI messages contain exactly one transfer, which
means that each transfer is the last of its message, and as a
consequence the chip select is never toggled.

This fix makes the TD035S work again on a cm-x300 board.

Fixes: f64dcac0b124 ("backlight: tdo24m: ensure chip select changes
       between transfers")
Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
---
 drivers/video/backlight/tdo24m.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Thompson Oct. 9, 2017, 11:14 a.m. UTC | #1
On 06/10/17 20:58, Robert Jarzmik wrote:
> Currently the LCD display (TD035S) on the cm-x300 platform is broken and
> remains blank.
> 
> The TD0245S specification requires that the chipselect is toggled
> between commands sent to the panel. This was also the purpose of the
> former patch of commit f64dcac0b124 ("backlight: tdo24m: ensure chip
> select changes between transfers").
> 
> Unfortunately, the "cs_change" field of a SPI transfer is
> misleading. Its true meaning is that for a SPI message holding multiple
> transfers, the chip select is toggled between each transfer, but for the
> last transfer it remains asserted.
> 
> In this driver, all the SPI messages contain exactly one transfer, which
> means that each transfer is the last of its message, and as a
> consequence the chip select is never toggled.
> 
> This fix makes the TD035S work again on a cm-x300 board.
> 
> Fixes: f64dcac0b124 ("backlight: tdo24m: ensure chip select changes
>         between transfers")
> Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>

I'm a tiny bit worried about see-saw bug fixing here but nevertheless 
this change looks correct to me.

Mike's change was eight years ago and it is reasonable to hope that the 
patch was really just working around a (hopefully long fixed) bug in the 
SPI driver!


Acked-by: Daniel Thompson <daniel.thompson@linaro.org>


> ---
>   drivers/video/backlight/tdo24m.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
> index eab1f842f9c0..e4bd63e9db6b 100644
> --- a/drivers/video/backlight/tdo24m.c
> +++ b/drivers/video/backlight/tdo24m.c
> @@ -369,7 +369,7 @@ static int tdo24m_probe(struct spi_device *spi)
>   
>   	spi_message_init(m);
>   
> -	x->cs_change = 1;
> +	x->cs_change = 0;
>   	x->tx_buf = &lcd->buf[0];
>   	spi_message_add_tail(x, m);
>   
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Robert Jarzmik Oct. 9, 2017, 6:30 p.m. UTC | #2
Daniel Thompson <daniel.thompson@linaro.org> writes:

> On 06/10/17 20:58, Robert Jarzmik wrote:
>
> I'm a tiny bit worried about see-saw bug fixing here but nevertheless this
> change looks correct to me.
>
> Mike's change was eight years ago and it is reasonable to hope that the patch
> was really just working around a (hopefully long fixed) bug in the SPI driver!
Actually I think it's the case.
And the driver bug fix is here :
  a52db659c79c ("spi: pxa2xx: Fix cs_change management")

And please don't apply this as there are 2 other LCDs which are affected by the
same issue and reported by Andrea, for which I had not correlated the issue
until yesterday, so I'll have to respin this 2 others files, namely :
 - drivers/video/backlight/corgi_lcd.c.
 - drivers/video/backlight/tosa_lcd.c.

There 2 other candidates I won't touch as they are not under my maintainance,
and I have no way to test them :
 - ili922x.c
 - ltv350qv.c

> Acked-by: Daniel Thompson <daniel.thompson@linaro.org>
Thanks, but there will be a v2 with exactly the same fix in 3 files.

Cheers.

--
Robert
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/video/backlight/tdo24m.c b/drivers/video/backlight/tdo24m.c
index eab1f842f9c0..e4bd63e9db6b 100644
--- a/drivers/video/backlight/tdo24m.c
+++ b/drivers/video/backlight/tdo24m.c
@@ -369,7 +369,7 @@  static int tdo24m_probe(struct spi_device *spi)
 
 	spi_message_init(m);
 
-	x->cs_change = 1;
+	x->cs_change = 0;
 	x->tx_buf = &lcd->buf[0];
 	spi_message_add_tail(x, m);