Skip to content

Commit

Permalink
Staging: fbtft: Fix GPIO handling
Browse files Browse the repository at this point in the history
Commit c440eee ("Staging: fbtft: Switch to the gpio descriptor
interface") breaks GPIO handling. In several places, checks to only set
a GPIO if it was configured ended up backwards.
I have tested this fix. The fixed driver works with a ili9486
display connected to a raspberry pi via SPI.

Fixes: c440eee ("Staging: fbtft: Switch to the gpio descriptor interface")
Tested-by: Jan Sebastian Götte <linux@jaseg.net>
Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Jan Sebastian Götte <linux@jaseg.net>
Link: https://lore.kernel.org/r/75ada52f-afa1-08bc-d0ce-966fc1110e70@jaseg.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Jan Sebastian Götte authored and Greg Kroah-Hartman committed Jul 25, 2019
1 parent 6105043 commit 92e3e88
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion drivers/staging/fbtft/fb_bd663474.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

static int init_display(struct fbtft_par *par)
{
if (!par->gpio.cs)
if (par->gpio.cs)
gpiod_set_value(par->gpio.cs, 0); /* Activate chip */

par->fbtftops.reset(par);
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/fbtft/fb_ili9163.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);

if (!par->gpio.cs)
if (par->gpio.cs)
gpiod_set_value(par->gpio.cs, 0); /* Activate chip */

write_reg(par, MIPI_DCS_SOFT_RESET); /* software reset */
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/fbtft/fb_ili9325.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);

if (!par->gpio.cs)
if (par->gpio.cs)
gpiod_set_value(par->gpio.cs, 0); /* Activate chip */

bt &= 0x07;
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/fbtft/fb_s6d1121.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);

if (!par->gpio.cs)
if (par->gpio.cs)
gpiod_set_value(par->gpio.cs, 0); /* Activate chip */

/* Initialization sequence from Lib_UTFT */
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/fbtft/fb_ssd1289.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);

if (!par->gpio.cs)
if (par->gpio.cs)
gpiod_set_value(par->gpio.cs, 0); /* Activate chip */

write_reg(par, 0x00, 0x0001);
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/fbtft/fb_ssd1331.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
va_start(args, len);

*buf = (u8)va_arg(args, unsigned int);
if (!par->gpio.dc)
if (par->gpio.dc)
gpiod_set_value(par->gpio.dc, 0);
ret = par->fbtftops.write(par, par->buf, sizeof(u8));
if (ret < 0) {
Expand All @@ -104,7 +104,7 @@ static void write_reg8_bus8(struct fbtft_par *par, int len, ...)
return;
}
}
if (!par->gpio.dc)
if (par->gpio.dc)
gpiod_set_value(par->gpio.dc, 1);
va_end(args);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/fbtft/fb_upd161704.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static int init_display(struct fbtft_par *par)
{
par->fbtftops.reset(par);

if (!par->gpio.cs)
if (par->gpio.cs)
gpiod_set_value(par->gpio.cs, 0); /* Activate chip */

/* Initialization sequence from Lib_UTFT */
Expand Down
2 changes: 1 addition & 1 deletion drivers/staging/fbtft/fbtft-bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int fbtft_write_vmem16_bus8(struct fbtft_par *par, size_t offset, size_t len)
remain = len / 2;
vmem16 = (u16 *)(par->info->screen_buffer + offset);

if (!par->gpio.dc)
if (par->gpio.dc)
gpiod_set_value(par->gpio.dc, 1);

/* non buffered write */
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/fbtft/fbtft-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,7 @@ static int fbtft_init_display_dt(struct fbtft_par *par)
return -EINVAL;

par->fbtftops.reset(par);
if (!par->gpio.cs)
if (par->gpio.cs)
gpiod_set_value(par->gpio.cs, 0); /* Activate chip */

while (p) {
Expand Down Expand Up @@ -1009,7 +1009,7 @@ int fbtft_init_display(struct fbtft_par *par)
}

par->fbtftops.reset(par);
if (!par->gpio.cs)
if (par->gpio.cs)
gpiod_set_value(par->gpio.cs, 0); /* Activate chip */

i = 0;
Expand Down

0 comments on commit 92e3e88

Please sign in to comment.