Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / auxdisplay / line-display.h
blob4348d7a2f69ade792cb059cf21540d39d6c3f749
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * Character line display core support
5 * Copyright (C) 2016 Imagination Technologies
6 * Author: Paul Burton <paul.burton@mips.com>
8 * Copyright (C) 2021 Glider bv
9 */
11 #ifndef _LINEDISP_H
12 #define _LINEDISP_H
14 #include <linux/device.h>
15 #include <linux/timer_types.h>
17 #include <linux/map_to_7segment.h>
18 #include <linux/map_to_14segment.h>
20 struct linedisp;
22 /**
23 * enum linedisp_map_type - type of the character mapping
24 * @LINEDISP_MAP_SEG7: Map characters to 7 segment display
25 * @LINEDISP_MAP_SEG14: Map characters to 14 segment display
27 enum linedisp_map_type {
28 LINEDISP_MAP_SEG7,
29 LINEDISP_MAP_SEG14,
32 /**
33 * struct linedisp_map - character mapping
34 * @type: type of the character mapping
35 * @map: conversion character mapping
36 * @size: size of the @map
38 struct linedisp_map {
39 enum linedisp_map_type type;
40 union {
41 struct seg7_conversion_map seg7;
42 struct seg14_conversion_map seg14;
43 } map;
44 unsigned int size;
47 /**
48 * struct linedisp_ops - character line display operations
49 * @get_map_type: Function called to get the character mapping, if required
50 * @update: Function called to update the display. This must not sleep!
52 struct linedisp_ops {
53 int (*get_map_type)(struct linedisp *linedisp);
54 void (*update)(struct linedisp *linedisp);
57 /**
58 * struct linedisp - character line display private data structure
59 * @dev: the line display device
60 * @timer: timer used to implement scrolling
61 * @ops: character line display operations
62 * @buf: pointer to the buffer for the string currently displayed
63 * @message: the full message to display or scroll on the display
64 * @num_chars: the number of characters that can be displayed
65 * @message_len: the length of the @message string
66 * @scroll_pos: index of the first character of @message currently displayed
67 * @scroll_rate: scroll interval in jiffies
68 * @id: instance id of this display
70 struct linedisp {
71 struct device dev;
72 struct timer_list timer;
73 const struct linedisp_ops *ops;
74 struct linedisp_map *map;
75 char *buf;
76 char *message;
77 unsigned int num_chars;
78 unsigned int message_len;
79 unsigned int scroll_pos;
80 unsigned int scroll_rate;
81 unsigned int id;
84 int linedisp_register(struct linedisp *linedisp, struct device *parent,
85 unsigned int num_chars, const struct linedisp_ops *ops);
86 void linedisp_unregister(struct linedisp *linedisp);
88 #endif /* LINEDISP_H */