/* 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* Copyright (C) 2025 Jean-François Lessard9*/1011#ifndef _LINEDISP_H12#define _LINEDISP_H1314#include <linux/device.h>15#include <linux/timer_types.h>1617#include <linux/map_to_7segment.h>18#include <linux/map_to_14segment.h>1920struct linedisp;2122/**23* enum linedisp_map_type - type of the character mapping24* @LINEDISP_MAP_SEG7: Map characters to 7 segment display25* @LINEDISP_MAP_SEG14: Map characters to 14 segment display26*/27enum linedisp_map_type {28LINEDISP_MAP_SEG7,29LINEDISP_MAP_SEG14,30};3132/**33* struct linedisp_map - character mapping34* @type: type of the character mapping35* @map: conversion character mapping36* @size: size of the @map37*/38struct linedisp_map {39enum linedisp_map_type type;40union {41struct seg7_conversion_map seg7;42struct seg14_conversion_map seg14;43} map;44unsigned int size;45};4647/**48* struct linedisp_ops - character line display operations49* @get_map_type: Function called to get the character mapping, if required50* @update: Function called to update the display. This must not sleep!51*/52struct linedisp_ops {53int (*get_map_type)(struct linedisp *linedisp);54void (*update)(struct linedisp *linedisp);55};5657/**58* struct linedisp - character line display private data structure59* @dev: the line display device60* @timer: timer used to implement scrolling61* @ops: character line display operations62* @buf: pointer to the buffer for the string currently displayed63* @message: the full message to display or scroll on the display64* @num_chars: the number of characters that can be displayed65* @message_len: the length of the @message string66* @scroll_pos: index of the first character of @message currently displayed67* @scroll_rate: scroll interval in jiffies68* @id: instance id of this display69*/70struct linedisp {71struct device dev;72struct timer_list timer;73const struct linedisp_ops *ops;74struct linedisp_map *map;75char *buf;76char *message;77unsigned int num_chars;78unsigned int message_len;79unsigned int scroll_pos;80unsigned int scroll_rate;81unsigned int id;82};8384int linedisp_attach(struct linedisp *linedisp, struct device *dev,85unsigned int num_chars, const struct linedisp_ops *ops);86void linedisp_detach(struct device *dev);87int linedisp_register(struct linedisp *linedisp, struct device *parent,88unsigned int num_chars, const struct linedisp_ops *ops);89void linedisp_unregister(struct linedisp *linedisp);9091#endif /* LINEDISP_H */929394