summaryrefslogtreecommitdiff
path: root/drivers/auxdisplay/charlcd.c
diff options
context:
space:
mode:
authorLars Poeschel <poeschel@lemonage.de>2020-11-03 10:58:14 +0100
committerMiguel Ojeda <ojeda@kernel.org>2020-11-04 11:04:03 +0100
commit45421ffefbb5f195de02ead952755329ef8576d8 (patch)
tree37fb7be29a8b25c6df3648512212d669d6dd90d8 /drivers/auxdisplay/charlcd.c
parent88645a86e3420cddfe5bb9cd8d7c15aff8f54b46 (diff)
auxdisplay: Move clear_display to hd44780_common
This moves the clear_display function from charlcd to hd44780_common. This is one more step to make charlcd independent from device specific code. The two hd44780 drivers use the new function from hd44780_common and charlcd calls this function through its function pointer in its ops structure. Reviewed-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Lars Poeschel <poeschel@lemonage.de> Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'drivers/auxdisplay/charlcd.c')
-rw-r--r--drivers/auxdisplay/charlcd.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/auxdisplay/charlcd.c b/drivers/auxdisplay/charlcd.c
index 44dd6e02eaf9..fc0daf4987d5 100644
--- a/drivers/auxdisplay/charlcd.c
+++ b/drivers/auxdisplay/charlcd.c
@@ -34,8 +34,6 @@
#define LCD_FLAG_L 0x0080 /* Backlight enabled */
/* LCD commands */
-#define LCD_CMD_DISPLAY_CLEAR 0x01 /* Clear entire display */
-
#define LCD_CMD_ENTRY_MODE 0x04 /* Set entry mode */
#define LCD_CMD_CURSOR_INC 0x02 /* Increment cursor */
@@ -178,18 +176,6 @@ static void charlcd_clear_fast(struct charlcd *lcd)
charlcd_home(lcd);
}
-/* clears the display and resets X/Y */
-static void charlcd_clear_display(struct charlcd *lcd)
-{
- struct hd44780_common *hdc = lcd->drvdata;
-
- hdc->write_cmd(hdc, LCD_CMD_DISPLAY_CLEAR);
- lcd->addr.x = 0;
- lcd->addr.y = 0;
- /* we must wait a few milliseconds (15) */
- long_sleep(15);
-}
-
static int charlcd_init_display(struct charlcd *lcd)
{
void (*write_cmd_raw)(struct hd44780_common *hdc, int cmd);
@@ -254,7 +240,9 @@ static int charlcd_init_display(struct charlcd *lcd)
/* entry mode set : increment, cursor shifting */
hdc->write_cmd(hdc, LCD_CMD_ENTRY_MODE | LCD_CMD_CURSOR_INC);
- charlcd_clear_display(lcd);
+ lcd->ops->clear_display(lcd);
+ lcd->addr.x = 0;
+ lcd->addr.y = 0;
return 0;
}
@@ -670,8 +658,10 @@ static int charlcd_open(struct inode *inode, struct file *file)
goto fail;
if (priv->must_clear) {
- charlcd_clear_display(&priv->lcd);
+ priv->lcd.ops->clear_display(&priv->lcd);
priv->must_clear = false;
+ priv->lcd.addr.x = 0;
+ priv->lcd.addr.y = 0;
}
return nonseekable_open(inode, file);