drm/panel-edp: Add STA 116QHD024002
[drm/drm-misc.git] / drivers / auxdisplay / charlcd.h
blob4d4287209d04c4c8f8e983de25c8c91a313b6370
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Character LCD driver for Linux
5 * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
6 * Copyright (C) 2016-2017 Glider bvba
7 */
9 #ifndef _CHARLCD_H
10 #define _CHARLCD_H
12 #define LCD_FLAG_B 0x0004 /* Blink on */
13 #define LCD_FLAG_C 0x0008 /* Cursor on */
14 #define LCD_FLAG_D 0x0010 /* Display on */
15 #define LCD_FLAG_F 0x0020 /* Large font mode */
16 #define LCD_FLAG_N 0x0040 /* 2-rows mode */
17 #define LCD_FLAG_L 0x0080 /* Backlight enabled */
19 enum charlcd_onoff {
20 CHARLCD_OFF = 0,
21 CHARLCD_ON,
24 enum charlcd_shift_dir {
25 CHARLCD_SHIFT_LEFT,
26 CHARLCD_SHIFT_RIGHT,
29 enum charlcd_fontsize {
30 CHARLCD_FONTSIZE_SMALL,
31 CHARLCD_FONTSIZE_LARGE,
34 enum charlcd_lines {
35 CHARLCD_LINES_1,
36 CHARLCD_LINES_2,
39 struct charlcd_ops;
41 struct charlcd {
42 const struct charlcd_ops *ops;
43 const unsigned char *char_conv; /* Optional */
45 int height;
46 int width;
48 /* Contains the LCD X and Y offset */
49 struct {
50 unsigned long x;
51 unsigned long y;
52 } addr;
54 void *drvdata;
57 /**
58 * struct charlcd_ops - Functions used by charlcd. Drivers have to implement
59 * these.
60 * @backlight: Turn backlight on or off. Optional.
61 * @print: Print one character to the display at current cursor position.
62 * The buffered cursor position is advanced by charlcd. The cursor should not
63 * wrap to the next line at the end of a line.
64 * @gotoxy: Set cursor to x, y. The x and y values to set the cursor to are
65 * previously set in addr.x and addr.y by charlcd.
66 * @home: Set cursor to 0, 0. The values in addr.x and addr.y are set to 0, 0 by
67 * charlcd prior to calling this function.
68 * @clear_display: Clear the whole display and set the cursor to 0, 0. The
69 * values in addr.x and addr.y are set to 0, 0 by charlcd after to calling this
70 * function.
71 * @init_display: Initialize the display.
72 * @shift_cursor: Shift cursor left or right one position.
73 * @shift_display: Shift whole display content left or right.
74 * @display: Turn display on or off.
75 * @cursor: Turn cursor on or off.
76 * @blink: Turn cursor blink on or off.
77 * @lines: One or two lines.
78 * @redefine_char: Redefine the actual pixel matrix of character.
80 struct charlcd_ops {
81 void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
82 int (*print)(struct charlcd *lcd, int c);
83 int (*gotoxy)(struct charlcd *lcd, unsigned int x, unsigned int y);
84 int (*home)(struct charlcd *lcd);
85 int (*clear_display)(struct charlcd *lcd);
86 int (*init_display)(struct charlcd *lcd);
87 int (*shift_cursor)(struct charlcd *lcd, enum charlcd_shift_dir dir);
88 int (*shift_display)(struct charlcd *lcd, enum charlcd_shift_dir dir);
89 int (*display)(struct charlcd *lcd, enum charlcd_onoff on);
90 int (*cursor)(struct charlcd *lcd, enum charlcd_onoff on);
91 int (*blink)(struct charlcd *lcd, enum charlcd_onoff on);
92 int (*fontsize)(struct charlcd *lcd, enum charlcd_fontsize size);
93 int (*lines)(struct charlcd *lcd, enum charlcd_lines lines);
94 int (*redefine_char)(struct charlcd *lcd, char *esc);
97 void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on);
98 struct charlcd *charlcd_alloc(void);
99 void charlcd_free(struct charlcd *lcd);
101 int charlcd_register(struct charlcd *lcd);
102 int charlcd_unregister(struct charlcd *lcd);
104 void charlcd_poke(struct charlcd *lcd);
106 #endif /* CHARLCD_H */