All of lore.kernel.org
 help / color / mirror / Atom feed
From: Priit Laes <plaes@plaes.org>
To: "Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>,
	"Noralf Trønnes" <noralf@tronnes.org>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
	Priit Laes <plaes@plaes.org>
Subject: [PATCH 03/13] staging: fbtft: Use standard MIPI DCS command defines for hx8357d
Date: Sun, 20 Dec 2015 20:35:57 +0200	[thread overview]
Message-ID: <1450636567-2040-4-git-send-email-plaes@plaes.org> (raw)
In-Reply-To: <1450636567-2040-1-git-send-email-plaes@plaes.org>

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: Priit Laes <plaes@plaes.org>
---
 drivers/staging/fbtft/fb_hx8357d.c | 38 ++++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/fbtft/fb_hx8357d.c b/drivers/staging/fbtft/fb_hx8357d.c
index a381dbc..89be9ec 100644
--- a/drivers/staging/fbtft/fb_hx8357d.c
+++ b/drivers/staging/fbtft/fb_hx8357d.c
@@ -22,6 +22,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <video/mipi_display.h>
 
 #include "fbtft.h"
 #include "fb_hx8357d.h"
@@ -35,7 +36,7 @@ static int init_display(struct fbtft_par *par)
 	par->fbtftops.reset(par);
 
 	/* Reset things like Gamma */
-	write_reg(par, HX8357B_SWRESET);
+	write_reg(par, MIPI_DCS_SOFT_RESET);
 	usleep_range(5000, 7000);
 
 	/* setextc */
@@ -116,22 +117,22 @@ static int init_display(struct fbtft_par *par)
 		0x01);
 
 	/* 16 bit */
-	write_reg(par, HX8357_COLMOD, 0x55);
+	write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, 0x55);
 
-	write_reg(par, HX8357_MADCTL, 0xC0);
+	write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, 0xC0);
 
 	/* TE off */
-	write_reg(par, HX8357_TEON, 0x00);
+	write_reg(par, MIPI_DCS_SET_TEAR_ON, 0x00);
 
 	/* tear line */
-	write_reg(par, HX8357_TEARLINE, 0x00, 0x02);
+	write_reg(par, MIPI_DCS_SET_TEAR_SCANLINE, 0x00, 0x02);
 
 	/* Exit Sleep */
-	write_reg(par, HX8357_SLPOUT);
+	write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
 	msleep(150);
 
 	/* display on */
-	write_reg(par, HX8357_DISPON);
+	write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
 	usleep_range(5000, 7000);
 
 	return 0;
@@ -139,18 +140,15 @@ static int init_display(struct fbtft_par *par)
 
 static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
 {
-	/* Column addr set */
-	write_reg(par, HX8357_CASET,
-		xs >> 8, xs & 0xff,  /* XSTART */
-		xe >> 8, xe & 0xff); /* XEND */
-
-	/* Row addr set */
-	write_reg(par, HX8357_PASET,
-		ys >> 8, ys & 0xff,  /* YSTART */
-		ye >> 8, ye & 0xff); /* YEND */
-
-	/* write to RAM */
-	write_reg(par, HX8357_RAMWR);
+	write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
+		  xs >> 8, xs & 0xff,  /* XSTART */
+		  xe >> 8, xe & 0xff); /* XEND */
+
+	write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
+		  ys >> 8, ys & 0xff,  /* YSTART */
+		  ye >> 8, ye & 0xff); /* YEND */
+
+	write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
 }
 
 #define HX8357D_MADCTL_MY  0x80
@@ -182,7 +180,7 @@ static int set_var(struct fbtft_par *par)
 	val |= (par->bgr ? HX8357D_MADCTL_RGB : HX8357D_MADCTL_BGR);
 
 	/* Memory Access Control */
-	write_reg(par, HX8357_MADCTL, val);
+	write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, val);
 
 	return 0;
 }
-- 
2.6.4


  parent reply	other threads:[~2015-12-20 18:36 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-20 18:35 [PATCH 00/13] staging: fbtft - Use standard MIPI DCS defines Priit Laes
2015-12-20 18:35 ` [PATCH 01/13] staging: fbtft: Use standard MIPI DCS command defines for hx8340bn Priit Laes
2015-12-20 18:35 ` [PATCH 02/13] staging: fbtft: Use standard MIPI DCS command defines for hx8353d Priit Laes
2015-12-20 18:35 ` Priit Laes [this message]
2015-12-20 18:35 ` [PATCH 04/13] staging: fbtft: Use standard MIPI DCS command defines for ili9163 Priit Laes
2015-12-20 18:35 ` [PATCH 05/13] staging: fbtft: Use standard MIPI DCS command defines for ili9340 Priit Laes
2015-12-20 18:36 ` [PATCH 06/13] staging: fbtft: Use standard MIPI DCS command defines for ili9341 Priit Laes
2015-12-20 18:36 ` [PATCH 07/13] staging: fbtft: Use standard MIPI DCS command defines for ili9481 Priit Laes
2015-12-20 18:36 ` [PATCH 08/13] staging: fbtft: Use standard MIPI DCS command defines for ili9486 Priit Laes
2015-12-20 18:36 ` [PATCH 09/13] staging: fbtft: Use standard MIPI DCS command defines for s6d02a1 Priit Laes
2015-12-20 18:36 ` [PATCH 10/13] staging: fbtft: Use standard MIPI DCS command defines for st7735r Priit Laes
2015-12-20 18:36 ` [PATCH 11/13] staging: fbtft: Use standard MIPI DCS command defines for fbtft driver Priit Laes
2015-12-20 18:36 ` [PATCH 12/13] staging: fbtft: Use standard MIPI DCS command defines for tinylcd Priit Laes
2015-12-20 18:36 ` [PATCH 13/13] staging: fbtft: Remove unused and duplicated defines Priit Laes
2016-02-08  3:40   ` Greg Kroah-Hartman
2016-02-08  3:41     ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1450636567-2040-4-git-send-email-plaes@plaes.org \
    --to=plaes@plaes.org \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noralf@tronnes.org \
    --cc=thomas.petazzoni@free-electrons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.