Merge branch '40GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
[linux-block.git] / drivers / auxdisplay / charlcd.h
CommitLineData
2874c5fd 1/* SPDX-License-Identifier: GPL-2.0-or-later */
39f8ea46
GU
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
39f8ea46
GU
7 */
8
390235c3
MY
9#ifndef _CHARLCD_H
10#define _CHARLCD_H
11
01ec46df
LP
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 */
18
66ce7d5c
LP
19enum charlcd_onoff {
20 CHARLCD_OFF = 0,
21 CHARLCD_ON,
22};
23
d2f2187e
LP
24enum charlcd_shift_dir {
25 CHARLCD_SHIFT_LEFT,
26 CHARLCD_SHIFT_RIGHT,
27};
28
29enum charlcd_fontsize {
30 CHARLCD_FONTSIZE_SMALL,
31 CHARLCD_FONTSIZE_LARGE,
32};
33
34enum charlcd_lines {
35 CHARLCD_LINES_1,
36 CHARLCD_LINES_2,
37};
38
39f8ea46
GU
39struct charlcd {
40 const struct charlcd_ops *ops;
41 const unsigned char *char_conv; /* Optional */
42
43 int height;
44 int width;
39f8ea46 45
11588b59
LP
46 /* Contains the LCD X and Y offset */
47 struct {
48 unsigned long x;
49 unsigned long y;
50 } addr;
51
2545c1c9 52 void *drvdata;
39f8ea46
GU
53};
54
b26deabb
LP
55/**
56 * struct charlcd_ops - Functions used by charlcd. Drivers have to implement
57 * these.
b26deabb
LP
58 * @backlight: Turn backlight on or off. Optional.
59 * @print: Print one character to the display at current cursor position.
b26deabb
LP
60 * The buffered cursor position is advanced by charlcd. The cursor should not
61 * wrap to the next line at the end of a line.
d3a2fb81
LP
62 * @gotoxy: Set cursor to x, y. The x and y values to set the cursor to are
63 * previously set in addr.x and addr.y by charlcd.
88645a86
LP
64 * @home: Set cursor to 0, 0. The values in addr.x and addr.y are set to 0, 0 by
65 * charlcd prior to calling this function.
377cf2cb
LP
66 * @clear_display: Clear the whole display and set the cursor to 0, 0. The
67 * values in addr.x and addr.y are set to 0, 0 by charlcd after to calling this
45421ffe 68 * function.
01ec46df 69 * @init_display: Initialize the display.
d2f2187e
LP
70 * @shift_cursor: Shift cursor left or right one position.
71 * @shift_display: Shift whole display content left or right.
72 * @display: Turn display on or off.
73 * @cursor: Turn cursor on or off.
74 * @blink: Turn cursor blink on or off.
75 * @lines: One or two lines.
339acb08 76 * @redefine_char: Redefine the actual pixel matrix of character.
b26deabb 77 */
39f8ea46 78struct charlcd_ops {
66ce7d5c 79 void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
b26deabb 80 int (*print)(struct charlcd *lcd, int c);
40c2b72e 81 int (*gotoxy)(struct charlcd *lcd, unsigned int x, unsigned int y);
88645a86 82 int (*home)(struct charlcd *lcd);
45421ffe 83 int (*clear_display)(struct charlcd *lcd);
01ec46df 84 int (*init_display)(struct charlcd *lcd);
d2f2187e
LP
85 int (*shift_cursor)(struct charlcd *lcd, enum charlcd_shift_dir dir);
86 int (*shift_display)(struct charlcd *lcd, enum charlcd_shift_dir dir);
87 int (*display)(struct charlcd *lcd, enum charlcd_onoff on);
88 int (*cursor)(struct charlcd *lcd, enum charlcd_onoff on);
89 int (*blink)(struct charlcd *lcd, enum charlcd_onoff on);
90 int (*fontsize)(struct charlcd *lcd, enum charlcd_fontsize size);
91 int (*lines)(struct charlcd *lcd, enum charlcd_lines lines);
339acb08 92 int (*redefine_char)(struct charlcd *lcd, char *esc);
39f8ea46
GU
93};
94
2bf82b5a 95void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on);
2545c1c9 96struct charlcd *charlcd_alloc(void);
8e44fc85 97void charlcd_free(struct charlcd *lcd);
39f8ea46
GU
98
99int charlcd_register(struct charlcd *lcd);
100int charlcd_unregister(struct charlcd *lcd);
101
102void charlcd_poke(struct charlcd *lcd);
390235c3
MY
103
104#endif /* CHARLCD_H */