Commit 79f5da7d authored by Priit Laes's avatar Priit Laes Committed by Greg Kroah-Hartman

staging: fbtft: Use standard MIPI DCS command defines for st7735r

This patch makes use of the standard MIPI Display Command Set to remove
some of the magic constants found in source code.
Signed-off-by: default avatarPriit Laes <plaes@plaes.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3d6924dd
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <video/mipi_display.h>
#include "fbtft.h" #include "fbtft.h"
...@@ -25,12 +26,10 @@ ...@@ -25,12 +26,10 @@
"0F 1B 0F 17 33 2C 29 2E 30 30 39 3F 00 07 03 10" "0F 1B 0F 17 33 2C 29 2E 30 30 39 3F 00 07 03 10"
static int default_init_sequence[] = { static int default_init_sequence[] = {
/* SWRESET - Software reset */ -1, MIPI_DCS_SOFT_RESET,
-1, 0x01,
-2, 150, /* delay */ -2, 150, /* delay */
/* SLPOUT - Sleep out & booster on */ -1, MIPI_DCS_EXIT_SLEEP_MODE,
-1, 0x11,
-2, 500, /* delay */ -2, 500, /* delay */
/* FRMCTR1 - frame rate control: normal mode /* FRMCTR1 - frame rate control: normal mode
...@@ -71,18 +70,14 @@ static int default_init_sequence[] = { ...@@ -71,18 +70,14 @@ static int default_init_sequence[] = {
/* VMCTR1 - Power Control */ /* VMCTR1 - Power Control */
-1, 0xC5, 0x0E, -1, 0xC5, 0x0E,
/* INVOFF - Display inversion off */ -1, MIPI_DCS_EXIT_INVERT_MODE,
-1, 0x20,
/* COLMOD - Interface pixel format */ -1, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT,
-1, 0x3A, 0x05,
/* DISPON - Display On */ -1, MIPI_DCS_SET_DISPLAY_ON,
-1, 0x29,
-2, 100, /* delay */ -2, 100, /* delay */
/* NORON - Partial off (Normal) */ -1, MIPI_DCS_ENTER_NORMAL_MODE,
-1, 0x13,
-2, 10, /* delay */ -2, 10, /* delay */
/* end marker */ /* end marker */
...@@ -91,14 +86,13 @@ static int default_init_sequence[] = { ...@@ -91,14 +86,13 @@ static int default_init_sequence[] = {
static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye) static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
{ {
/* Column address */ write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
write_reg(par, 0x2A, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF); xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
/* Row address */ write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
write_reg(par, 0x2B, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF); ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
/* Memory write */ write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
write_reg(par, 0x2C);
} }
#define MY BIT(7) #define MY BIT(7)
...@@ -114,16 +108,20 @@ static int set_var(struct fbtft_par *par) ...@@ -114,16 +108,20 @@ static int set_var(struct fbtft_par *par)
RGB-BGR ORDER color filter panel: 0=RGB, 1=BGR */ RGB-BGR ORDER color filter panel: 0=RGB, 1=BGR */
switch (par->info->var.rotate) { switch (par->info->var.rotate) {
case 0: case 0:
write_reg(par, 0x36, MX | MY | (par->bgr << 3)); write_reg(par, MIPI_DCS_SET_ADDRESS_MODE,
MX | MY | (par->bgr << 3));
break; break;
case 270: case 270:
write_reg(par, 0x36, MY | MV | (par->bgr << 3)); write_reg(par, MIPI_DCS_SET_ADDRESS_MODE,
MY | MV | (par->bgr << 3));
break; break;
case 180: case 180:
write_reg(par, 0x36, par->bgr << 3); write_reg(par, MIPI_DCS_SET_ADDRESS_MODE,
par->bgr << 3);
break; break;
case 90: case 90:
write_reg(par, 0x36, MX | MV | (par->bgr << 3)); write_reg(par, MIPI_DCS_SET_ADDRESS_MODE,
MX | MV | (par->bgr << 3));
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment