1 /* SPDX-License-Identifier: GPL-2.0-or-later */
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
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>
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
{
33 * struct linedisp_map - character mapping
34 * @type: type of the character mapping
35 * @map: conversion character mapping
36 * @size: size of the @map
39 enum linedisp_map_type type
;
41 struct seg7_conversion_map seg7
;
42 struct seg14_conversion_map seg14
;
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!
53 int (*get_map_type
)(struct linedisp
*linedisp
);
54 void (*update
)(struct linedisp
*linedisp
);
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
72 struct timer_list timer
;
73 const struct linedisp_ops
*ops
;
74 struct linedisp_map
*map
;
77 unsigned int num_chars
;
78 unsigned int message_len
;
79 unsigned int scroll_pos
;
80 unsigned int scroll_rate
;
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 */