]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
staging: fbtft: fb_ssd1331: fix mirrored display
authorJohannes H. Jensen <joh@pseudoberries.com>
Sun, 5 Nov 2017 14:46:53 +0000 (15:46 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 6 Nov 2017 15:44:05 +0000 (16:44 +0100)
When the row scan order is reversed (the default) we also need to
reverse the column scan order. This was not done previously, resulting
in a mirrored display.

Also add support for 180 degree display rotation, in which case simply
disable reversed row and column scan order.

Tested on an Adafruit 0.96" mini Color OLED display.

Signed-off-by: Johannes H. Jensen <joh@pseudoberries.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fbtft/fb_ssd1331.c

index 9aa9864fcf3089c4e3770620fca05118e70fc713..e4a759b54ba031e4659ad878ff6cf7088433e38b 100644 (file)
@@ -26,7 +26,13 @@ static int init_display(struct fbtft_par *par)
        par->fbtftops.reset(par);
 
        write_reg(par, 0xae); /* Display Off */
-       write_reg(par, 0xa0, 0x70 | (par->bgr << 2)); /* Set Colour Depth */
+
+       /* Set Column Address Mapping, COM Scan Direction and Colour Depth */
+       if (par->info->var.rotate == 180)
+               write_reg(par, 0xa0, 0x60 | (par->bgr << 2));
+       else
+               write_reg(par, 0xa0, 0x72 | (par->bgr << 2));
+
        write_reg(par, 0x72); /* RGB colour */
        write_reg(par, 0xa1, 0x00); /* Set Display Start Line */
        write_reg(par, 0xa2, 0x00); /* Set Display Offset */