From: Robert Abel <rabel@robertabel.eu>
To: linux-kernel@vger.kernel.org
Cc: Robert Abel <rabel@robertabel.eu>,
miguel.ojeda.sandonis@gmail.com, w@1wt.eu, geert@linux-m68k.org,
andy.shevchenko@gmail.com
Subject: [PATCH 2/2] auxdisplay: charlcd: make home command unshift display
Date: Wed, 28 Feb 2018 01:05:36 +0100 [thread overview]
Message-ID: <20180228000536.9489-3-rabel@robertabel.eu> (raw)
In-Reply-To: <20180228000536.9489-2-rabel@robertabel.eu>
A user has no way of unshifting the display programmatically once shifted.
Users cannot rely on ^[[H (home) to result in their message being seen either.
Use the actual HOME command 0x02 instead of only returning to x0/y0.
Users can still do ^[[Lx0y0; (go to x/y) if they wish to use the 'old' home
function.
Implement fast clearing of LCD by going to x0/y0 first, clearing display and
then calling home to possibly unshift display possibly avoiding artifacts by
not unshifting before clearing display.
Signed-off-by: Robert Abel <rabel@robertabel.eu>
---
drivers/auxdisplay/charlcd.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index ae078f414539..fdb3aa6423bf 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -43,6 +43,8 @@
/* LCD commands */
#define LCD_CMD_DISPLAY_CLEAR 0x01 /* Clear entire display */
+#define LCD_CMD_HOME 0x02 /* Set DDRAM address to 0 and unshift display */
+
#define LCD_CMD_ENTRY_MODE 0x04 /* Set entry mode */
#define LCD_CMD_CURSOR_INC 0x02 /* Increment cursor */
@@ -174,13 +176,24 @@ static void charlcd_gotoxy(struct charlcd *lcd)
lcd->ops->write_cmd(lcd, LCD_CMD_SET_DDRAM_ADDR | addr);
}
+/**
+ * charlcd_home() - Return to DDRAM address 0 and unshift the display.
+ * @lcd: LCD descriptor structure.
+ *
+ * Return to coordinates x0/y0 and unshift the display.
+ *
+ * Note: Use the movement command ^[[Lx0y0; instead of home
+ * in case the display should not be unshifted.
+ */
static void charlcd_home(struct charlcd *lcd)
{
struct charlcd_priv *priv = to_priv(lcd);
+ /* return to x0/y0 and unshift the display */
priv->addr.x = 0;
priv->addr.y = 0;
- charlcd_gotoxy(lcd);
+ lcd->ops->write_cmd(lcd, LCD_CMD_HOME);
+ long_sleep(2);
}
static void charlcd_print(struct charlcd *lcd, char c)
@@ -198,11 +211,21 @@ static void charlcd_print(struct charlcd *lcd, char c)
charlcd_gotoxy(lcd);
}
+/**
+ * charlcd_clear_fast() - Perform a fast clear of the display and return home.
+ * @lcd: LCD descriptor structure.
+ *
+ * The display will be unshifted and at coordinates x0/y0 after fast clear.
+ */
static void charlcd_clear_fast(struct charlcd *lcd)
{
+ struct charlcd_priv *priv = to_priv(lcd);
int pos;
- charlcd_home(lcd);
+ /* avoid artifacts by going to x0/y0 without unshifting the display */
+ priv->addr.x = 0;
+ priv->addr.y = 0;
+ charlcd_gotoxy(lcd);
if (lcd->ops->clear_fast)
lcd->ops->clear_fast(lcd);
@@ -210,6 +233,7 @@ static void charlcd_clear_fast(struct charlcd *lcd)
for (pos = 0; pos < min(2, lcd->height) * lcd->hwidth; pos++)
lcd->ops->write_data(lcd, ' ');
+ /* return to x0/y0 and unshift the display */
charlcd_home(lcd);
}
--
2.11.0
next prev parent reply other threads:[~2018-02-28 0:06 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-09 23:50 [PATCH 0/3] auxdisplay: charlcd: miscellaneous patches Robert Abel
2018-02-09 23:50 ` [PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command Robert Abel
2018-02-09 23:50 ` [PATCH 2/3] auxdisplay: charlcd: use null character instead of zero literal to terminate strings Robert Abel
2018-02-09 23:50 ` [PATCH 3/3] auxdisplay: charlcd: replace octal literal with form-feed escape sequence Robert Abel
2018-02-10 9:43 ` Miguel Ojeda
2018-02-10 9:29 ` [PATCH 2/3] auxdisplay: charlcd: use null character instead of zero literal to terminate strings Miguel Ojeda
2018-02-10 8:58 ` [PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command Miguel Ojeda
2018-02-10 9:20 ` Willy Tarreau
2018-02-10 9:41 ` Miguel Ojeda
2018-02-12 13:56 ` Miguel Ojeda
2018-02-13 13:36 ` Andy Shevchenko
2018-02-13 19:15 ` Willy Tarreau
2018-02-14 23:17 ` Robert Abel
2018-02-15 10:57 ` Andy Shevchenko
2018-02-25 23:34 ` Robert Abel
2018-02-25 23:52 ` Robert Abel
2018-02-25 23:54 ` Robert Abel
2018-02-25 23:54 ` [PATCH 1/4] auxdisplay: charlcd: fix two-line command ^[[LN not marked as processed Robert Abel
2018-02-25 23:54 ` [PATCH 2/4] auxdisplay: charlcd: name x/y address struct Robert Abel
2018-02-25 23:54 ` [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands Robert Abel
2018-02-25 23:54 ` [PATCH 4/4] auxdisplay: charlcd: make home command unshift display Robert Abel
2018-02-26 17:16 ` Miguel Ojeda
2018-02-26 8:46 ` [PATCH 3/4] auxdisplay: charlcd: fix x/y address commands Geert Uytterhoeven
2018-02-26 22:29 ` Robert Abel
2018-02-26 11:44 ` Andy Shevchenko
2018-02-26 16:54 ` Miguel Ojeda
2018-02-26 17:09 ` Andy Shevchenko
2018-02-26 17:26 ` Miguel Ojeda
2018-02-26 17:56 ` Andy Shevchenko
2018-02-26 23:00 ` Robert Abel
2018-02-26 22:38 ` Robert Abel
2018-02-26 23:06 ` Miguel Ojeda
2018-02-26 16:49 ` Miguel Ojeda
2018-02-26 16:57 ` Miguel Ojeda
2018-02-26 22:43 ` Robert Abel
2018-02-27 5:19 ` Willy Tarreau
2018-02-27 19:31 ` Miguel Ojeda
2018-02-27 23:29 ` Robert Abel
2018-02-28 0:05 ` [PATCH RFC 0/2] auxdisplay: charlcd: fix movement and home commands Robert Abel
2018-02-28 0:05 ` [PATCH 1/2] auxdisplay: charlcd: fix x/y address commands Robert Abel
2018-02-28 0:05 ` Robert Abel [this message]
2018-02-28 4:21 ` [PATCH 3/4] " Willy Tarreau
2018-02-26 23:05 ` Robert Abel
2018-02-27 5:20 ` Willy Tarreau
2018-02-26 8:35 ` [PATCH 2/4] auxdisplay: charlcd: name x/y address struct Geert Uytterhoeven
2018-02-26 15:59 ` Miguel Ojeda
2018-02-26 8:34 ` [PATCH 1/4] auxdisplay: charlcd: fix two-line command ^[[LN not marked as processed Geert Uytterhoeven
2018-02-26 15:53 ` Miguel Ojeda
2018-02-26 23:08 ` [PATCH 1/3] auxdisplay: charlcd: fix hex literal ranges for graphics command Robert Abel
2018-02-10 18:31 ` Geert Uytterhoeven
2018-02-10 18:58 ` Willy Tarreau
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=20180228000536.9489-3-rabel@robertabel.eu \
--to=rabel@robertabel.eu \
--cc=andy.shevchenko@gmail.com \
--cc=geert@linux-m68k.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=w@1wt.eu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).