162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Character line display core support
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2016 Imagination Technologies
662306a36Sopenharmony_ci * Author: Paul Burton <paul.burton@mips.com>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Copyright (C) 2021 Glider bv
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#ifndef _LINEDISP_H
1262306a36Sopenharmony_ci#define _LINEDISP_H
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci/**
1562306a36Sopenharmony_ci * struct linedisp - character line display private data structure
1662306a36Sopenharmony_ci * @dev: the line display device
1762306a36Sopenharmony_ci * @timer: timer used to implement scrolling
1862306a36Sopenharmony_ci * @update: function called to update the display
1962306a36Sopenharmony_ci * @buf: pointer to the buffer for the string currently displayed
2062306a36Sopenharmony_ci * @message: the full message to display or scroll on the display
2162306a36Sopenharmony_ci * @num_chars: the number of characters that can be displayed
2262306a36Sopenharmony_ci * @message_len: the length of the @message string
2362306a36Sopenharmony_ci * @scroll_pos: index of the first character of @message currently displayed
2462306a36Sopenharmony_ci * @scroll_rate: scroll interval in jiffies
2562306a36Sopenharmony_ci */
2662306a36Sopenharmony_cistruct linedisp {
2762306a36Sopenharmony_ci	struct device dev;
2862306a36Sopenharmony_ci	struct timer_list timer;
2962306a36Sopenharmony_ci	void (*update)(struct linedisp *linedisp);
3062306a36Sopenharmony_ci	char *buf;
3162306a36Sopenharmony_ci	char *message;
3262306a36Sopenharmony_ci	unsigned int num_chars;
3362306a36Sopenharmony_ci	unsigned int message_len;
3462306a36Sopenharmony_ci	unsigned int scroll_pos;
3562306a36Sopenharmony_ci	unsigned int scroll_rate;
3662306a36Sopenharmony_ci};
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ciint linedisp_register(struct linedisp *linedisp, struct device *parent,
3962306a36Sopenharmony_ci		      unsigned int num_chars, char *buf,
4062306a36Sopenharmony_ci		      void (*update)(struct linedisp *linedisp));
4162306a36Sopenharmony_civoid linedisp_unregister(struct linedisp *linedisp);
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#endif /* LINEDISP_H */
44