aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/fbtft
diff options
context:
space:
mode:
authorGravatar Andy Shevchenko <andriy.shevchenko@linux.intel.com> 2017-01-19 12:45:44 +0200
committerGravatar Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2017-01-19 12:50:28 +0100
commit95ecde0f65661d7fd34bb3e846e1cc7bcbfe7b6d (patch)
tree9143a456c99f07913a1171f12a13bd55b9b7de88 /drivers/staging/fbtft
parentstaging: fbtft: propagate error code from kstrto*() (diff)
downloadlinux-95ecde0f65661d7fd34bb3e846e1cc7bcbfe7b6d.tar.gz
linux-95ecde0f65661d7fd34bb3e846e1cc7bcbfe7b6d.tar.bz2
linux-95ecde0f65661d7fd34bb3e846e1cc7bcbfe7b6d.zip
staging: fbtft: fb_ssd1306: Support smaller screen sizes
There is 64x48 display exists. In order to support that set multiplexer to 48 pixels and window address to proper position in the graphic display data RAM. Acked-by: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fbtft')
-rw-r--r--drivers/staging/fbtft/fb_ssd1306.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/staging/fbtft/fb_ssd1306.c b/drivers/staging/fbtft/fb_ssd1306.c
index 80fc57029fee..bede2d5a5571 100644
--- a/drivers/staging/fbtft/fb_ssd1306.c
+++ b/drivers/staging/fbtft/fb_ssd1306.c
@@ -62,6 +62,8 @@ static int init_display(struct fbtft_par *par)
write_reg(par, 0xA8);
if (par->info->var.yres == 64)
write_reg(par, 0x3F);
+ else if (par->info->var.yres == 48)
+ write_reg(par, 0x2F);
else
write_reg(par, 0x1F);
@@ -95,6 +97,9 @@ static int init_display(struct fbtft_par *par)
if (par->info->var.yres == 64)
/* A[4]=1b, Alternative COM pin configuration */
write_reg(par, 0x12);
+ else if (par->info->var.yres == 48)
+ /* A[4]=1b, Alternative COM pin configuration */
+ write_reg(par, 0x12);
else
/* A[4]=0b, Sequential COM pin configuration */
write_reg(par, 0x02);
@@ -124,6 +129,19 @@ static int init_display(struct fbtft_par *par)
return 0;
}
+static void set_addr_win_64x48(struct fbtft_par *par)
+{
+ /* Set Column Address */
+ write_reg(par, 0x21);
+ write_reg(par, 0x20);
+ write_reg(par, 0x5F);
+
+ /* Set Page Address */
+ write_reg(par, 0x22);
+ write_reg(par, 0x0);
+ write_reg(par, 0x5);
+}
+
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{
/* Set Lower Column Start Address for Page Addressing Mode */
@@ -132,6 +150,9 @@ static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
write_reg(par, 0x10 | 0x0);
/* Set Display Start Line */
write_reg(par, 0x40 | 0x0);
+
+ if (par->info->var.xres == 64 && par->info->var.yres == 48)
+ set_addr_win_64x48(par);
}
static int blank(struct fbtft_par *par, bool on)