Thomas Gleixner | 2874c5f | 2019-05-27 08:55:01 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 2 | /* |
| 3 | * Character LCD driver for Linux |
| 4 | * |
| 5 | * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu> |
| 6 | * Copyright (C) 2016-2017 Glider bvba |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 7 | */ |
| 8 | |
Masahiro Yamada | 390235c | 2019-08-06 16:14:45 +0900 | [diff] [blame] | 9 | #ifndef _CHARLCD_H |
| 10 | #define _CHARLCD_H |
| 11 | |
Lars Poeschel | 66ce7d5 | 2020-11-03 10:58:04 +0100 | [diff] [blame] | 12 | enum charlcd_onoff { |
| 13 | CHARLCD_OFF = 0, |
| 14 | CHARLCD_ON, |
| 15 | }; |
| 16 | |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 17 | struct charlcd { |
| 18 | const struct charlcd_ops *ops; |
| 19 | const unsigned char *char_conv; /* Optional */ |
| 20 | |
| 21 | int height; |
| 22 | int width; |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 23 | |
Lars Poeschel | 11588b5 | 2020-11-03 10:58:10 +0100 | [diff] [blame] | 24 | /* Contains the LCD X and Y offset */ |
| 25 | struct { |
| 26 | unsigned long x; |
| 27 | unsigned long y; |
| 28 | } addr; |
| 29 | |
Lars Poeschel | 2545c1c | 2020-11-03 10:58:06 +0100 | [diff] [blame] | 30 | void *drvdata; |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 31 | }; |
| 32 | |
Lars Poeschel | b26deab | 2020-11-03 10:58:11 +0100 | [diff] [blame^] | 33 | /** |
| 34 | * struct charlcd_ops - Functions used by charlcd. Drivers have to implement |
| 35 | * these. |
| 36 | * @clear_fast: Clear the whole display and set cursor to position 0, 0. |
| 37 | * Optional. |
| 38 | * @backlight: Turn backlight on or off. Optional. |
| 39 | * @print: Print one character to the display at current cursor position. |
| 40 | * The cursor is advanced by charlcd. |
| 41 | * The buffered cursor position is advanced by charlcd. The cursor should not |
| 42 | * wrap to the next line at the end of a line. |
| 43 | */ |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 44 | struct charlcd_ops { |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 45 | void (*clear_fast)(struct charlcd *lcd); |
Lars Poeschel | 66ce7d5 | 2020-11-03 10:58:04 +0100 | [diff] [blame] | 46 | void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on); |
Lars Poeschel | b26deab | 2020-11-03 10:58:11 +0100 | [diff] [blame^] | 47 | int (*print)(struct charlcd *lcd, int c); |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 48 | }; |
| 49 | |
Lars Poeschel | 2545c1c | 2020-11-03 10:58:06 +0100 | [diff] [blame] | 50 | struct charlcd *charlcd_alloc(void); |
Andy Shevchenko | 8e44fc8 | 2019-03-12 16:44:30 +0200 | [diff] [blame] | 51 | void charlcd_free(struct charlcd *lcd); |
Geert Uytterhoeven | 39f8ea4 | 2017-03-10 15:15:17 +0100 | [diff] [blame] | 52 | |
| 53 | int charlcd_register(struct charlcd *lcd); |
| 54 | int charlcd_unregister(struct charlcd *lcd); |
| 55 | |
| 56 | void charlcd_poke(struct charlcd *lcd); |
Masahiro Yamada | 390235c | 2019-08-06 16:14:45 +0900 | [diff] [blame] | 57 | |
| 58 | #endif /* CHARLCD_H */ |