alistair23-linux/include/misc/charlcd.h
Geert Uytterhoeven ac201479cc auxdisplay: charlcd: Add support for 4-bit interfaces
In 4-bit mode, 8-bit commands and data are written using two raw writes
to the data interface: high nibble first, low nibble last.  This must be
handled by the low-level driver.

However, as we don't know in which mode (4-bit or 8-bit) nor 4-bit phase
the LCD was left, initialization must always be handled using raw
writes, and needs to configure the LCD for 8-bit mode first.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-17 15:10:49 +09:00

43 lines
1.2 KiB
C

/*
* Character LCD driver for Linux
*
* Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
* Copyright (C) 2016-2017 Glider bvba
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
struct charlcd {
const struct charlcd_ops *ops;
const unsigned char *char_conv; /* Optional */
int ifwidth; /* 4-bit or 8-bit (default) */
int height;
int width;
int bwidth; /* Default set by charlcd_alloc() */
int hwidth; /* Default set by charlcd_alloc() */
void *drvdata; /* Set by charlcd_alloc() */
};
struct charlcd_ops {
/* Required */
void (*write_cmd)(struct charlcd *lcd, int cmd);
void (*write_data)(struct charlcd *lcd, int data);
/* Optional */
void (*write_cmd_raw4)(struct charlcd *lcd, int cmd); /* 4-bit only */
void (*clear_fast)(struct charlcd *lcd);
void (*backlight)(struct charlcd *lcd, int on);
};
struct charlcd *charlcd_alloc(unsigned int drvdata_size);
int charlcd_register(struct charlcd *lcd);
int charlcd_unregister(struct charlcd *lcd);
void charlcd_poke(struct charlcd *lcd);