/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* Character line display core support3*4* Copyright (C) 2016 Imagination Technologies5* Author: Paul Burton <[email protected]>6*7* Copyright (C) 2021 Glider bv8*/910#ifndef _LINEDISP_H11#define _LINEDISP_H1213#include <linux/device.h>14#include <linux/timer_types.h>1516#include <linux/map_to_7segment.h>17#include <linux/map_to_14segment.h>1819struct linedisp;2021/**22* enum linedisp_map_type - type of the character mapping23* @LINEDISP_MAP_SEG7: Map characters to 7 segment display24* @LINEDISP_MAP_SEG14: Map characters to 14 segment display25*/26enum linedisp_map_type {27LINEDISP_MAP_SEG7,28LINEDISP_MAP_SEG14,29};3031/**32* struct linedisp_map - character mapping33* @type: type of the character mapping34* @map: conversion character mapping35* @size: size of the @map36*/37struct linedisp_map {38enum linedisp_map_type type;39union {40struct seg7_conversion_map seg7;41struct seg14_conversion_map seg14;42} map;43unsigned int size;44};4546/**47* struct linedisp_ops - character line display operations48* @get_map_type: Function called to get the character mapping, if required49* @update: Function called to update the display. This must not sleep!50*/51struct linedisp_ops {52int (*get_map_type)(struct linedisp *linedisp);53void (*update)(struct linedisp *linedisp);54};5556/**57* struct linedisp - character line display private data structure58* @dev: the line display device59* @timer: timer used to implement scrolling60* @ops: character line display operations61* @buf: pointer to the buffer for the string currently displayed62* @message: the full message to display or scroll on the display63* @num_chars: the number of characters that can be displayed64* @message_len: the length of the @message string65* @scroll_pos: index of the first character of @message currently displayed66* @scroll_rate: scroll interval in jiffies67* @id: instance id of this display68*/69struct linedisp {70struct device dev;71struct timer_list timer;72const struct linedisp_ops *ops;73struct linedisp_map *map;74char *buf;75char *message;76unsigned int num_chars;77unsigned int message_len;78unsigned int scroll_pos;79unsigned int scroll_rate;80unsigned int id;81};8283int linedisp_register(struct linedisp *linedisp, struct device *parent,84unsigned int num_chars, const struct linedisp_ops *ops);85void linedisp_unregister(struct linedisp *linedisp);8687#endif /* LINEDISP_H */888990