Linux Audio

Check our new training course

Loading...
v6.8
  1// SPDX-License-Identifier: GPL-2.0-or-later
  2/*
  3 * Copyright (C) 2016 Imagination Technologies
  4 * Author: Paul Burton <paul.burton@mips.com>
 
 
 
 
 
  5 */
  6
 
  7#include <linux/kernel.h>
  8#include <linux/io.h>
  9#include <linux/mfd/syscon.h>
 10#include <linux/module.h>
 11#include <linux/of.h>
 
 12#include <linux/platform_device.h>
 13#include <linux/property.h>
 14#include <linux/regmap.h>
 15#include <linux/slab.h>
 16
 17#include "line-display.h"
 18
 19struct img_ascii_lcd_ctx;
 20
 21/**
 22 * struct img_ascii_lcd_config - Configuration information about an LCD model
 23 * @num_chars: the number of characters the LCD can display
 24 * @external_regmap: true if registers are in a system controller, else false
 25 * @update: function called to update the LCD
 26 */
 27struct img_ascii_lcd_config {
 28	unsigned int num_chars;
 29	bool external_regmap;
 30	void (*update)(struct linedisp *linedisp);
 31};
 32
 33/**
 34 * struct img_ascii_lcd_ctx - Private data structure
 
 35 * @base: the base address of the LCD registers
 36 * @regmap: the regmap through which LCD registers are accessed
 37 * @offset: the offset within regmap to the start of the LCD registers
 38 * @cfg: pointer to the LCD model configuration
 39 * @linedisp: line display structure
 
 
 
 
 40 * @curr: the string currently displayed on the LCD
 41 */
 42struct img_ascii_lcd_ctx {
 
 43	union {
 44		void __iomem *base;
 45		struct regmap *regmap;
 46	};
 47	u32 offset;
 48	const struct img_ascii_lcd_config *cfg;
 49	struct linedisp linedisp;
 
 
 
 
 50	char curr[] __aligned(8);
 51};
 52
 53/*
 54 * MIPS Boston development board
 55 */
 56
 57static void boston_update(struct linedisp *linedisp)
 58{
 59	struct img_ascii_lcd_ctx *ctx =
 60		container_of(linedisp, struct img_ascii_lcd_ctx, linedisp);
 61	ulong val;
 62
 63#if BITS_PER_LONG == 64
 64	val = *((u64 *)&ctx->curr[0]);
 65	__raw_writeq(val, ctx->base);
 66#elif BITS_PER_LONG == 32
 67	val = *((u32 *)&ctx->curr[0]);
 68	__raw_writel(val, ctx->base);
 69	val = *((u32 *)&ctx->curr[4]);
 70	__raw_writel(val, ctx->base + 4);
 71#else
 72# error Not 32 or 64 bit
 73#endif
 74}
 75
 76static struct img_ascii_lcd_config boston_config = {
 77	.num_chars = 8,
 78	.update = boston_update,
 79};
 80
 81/*
 82 * MIPS Malta development board
 83 */
 84
 85static void malta_update(struct linedisp *linedisp)
 86{
 87	struct img_ascii_lcd_ctx *ctx =
 88		container_of(linedisp, struct img_ascii_lcd_ctx, linedisp);
 89	unsigned int i;
 90	int err = 0;
 91
 92	for (i = 0; i < linedisp->num_chars; i++) {
 93		err = regmap_write(ctx->regmap,
 94				   ctx->offset + (i * 8), ctx->curr[i]);
 95		if (err)
 96			break;
 97	}
 98
 99	if (unlikely(err))
100		pr_err_ratelimited("Failed to update LCD display: %d\n", err);
101}
102
103static struct img_ascii_lcd_config malta_config = {
104	.num_chars = 8,
105	.external_regmap = true,
106	.update = malta_update,
107};
108
109/*
110 * MIPS SEAD3 development board
111 */
112
113enum {
114	SEAD3_REG_LCD_CTRL		= 0x00,
115#define SEAD3_REG_LCD_CTRL_SETDRAM	BIT(7)
116	SEAD3_REG_LCD_DATA		= 0x08,
117	SEAD3_REG_CPLD_STATUS		= 0x10,
118#define SEAD3_REG_CPLD_STATUS_BUSY	BIT(0)
119	SEAD3_REG_CPLD_DATA		= 0x18,
120#define SEAD3_REG_CPLD_DATA_BUSY	BIT(7)
121};
122
123static int sead3_wait_sm_idle(struct img_ascii_lcd_ctx *ctx)
124{
125	unsigned int status;
126	int err;
127
128	do {
129		err = regmap_read(ctx->regmap,
130				  ctx->offset + SEAD3_REG_CPLD_STATUS,
131				  &status);
132		if (err)
133			return err;
134	} while (status & SEAD3_REG_CPLD_STATUS_BUSY);
135
136	return 0;
137
138}
139
140static int sead3_wait_lcd_idle(struct img_ascii_lcd_ctx *ctx)
141{
142	unsigned int cpld_data;
143	int err;
144
145	err = sead3_wait_sm_idle(ctx);
146	if (err)
147		return err;
148
149	do {
150		err = regmap_read(ctx->regmap,
151				  ctx->offset + SEAD3_REG_LCD_CTRL,
152				  &cpld_data);
153		if (err)
154			return err;
155
156		err = sead3_wait_sm_idle(ctx);
157		if (err)
158			return err;
159
160		err = regmap_read(ctx->regmap,
161				  ctx->offset + SEAD3_REG_CPLD_DATA,
162				  &cpld_data);
163		if (err)
164			return err;
165	} while (cpld_data & SEAD3_REG_CPLD_DATA_BUSY);
166
167	return 0;
168}
169
170static void sead3_update(struct linedisp *linedisp)
171{
172	struct img_ascii_lcd_ctx *ctx =
173		container_of(linedisp, struct img_ascii_lcd_ctx, linedisp);
174	unsigned int i;
175	int err = 0;
176
177	for (i = 0; i < linedisp->num_chars; i++) {
178		err = sead3_wait_lcd_idle(ctx);
179		if (err)
180			break;
181
182		err = regmap_write(ctx->regmap,
183				   ctx->offset + SEAD3_REG_LCD_CTRL,
184				   SEAD3_REG_LCD_CTRL_SETDRAM | i);
185		if (err)
186			break;
187
188		err = sead3_wait_lcd_idle(ctx);
189		if (err)
190			break;
191
192		err = regmap_write(ctx->regmap,
193				   ctx->offset + SEAD3_REG_LCD_DATA,
194				   ctx->curr[i]);
195		if (err)
196			break;
197	}
198
199	if (unlikely(err))
200		pr_err_ratelimited("Failed to update LCD display: %d\n", err);
201}
202
203static struct img_ascii_lcd_config sead3_config = {
204	.num_chars = 16,
205	.external_regmap = true,
206	.update = sead3_update,
207};
208
209static const struct of_device_id img_ascii_lcd_matches[] = {
210	{ .compatible = "img,boston-lcd", .data = &boston_config },
211	{ .compatible = "mti,malta-lcd", .data = &malta_config },
212	{ .compatible = "mti,sead3-lcd", .data = &sead3_config },
213	{ /* sentinel */ }
214};
215MODULE_DEVICE_TABLE(of, img_ascii_lcd_matches);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
217/**
218 * img_ascii_lcd_probe() - probe an LCD display device
219 * @pdev: the LCD platform device
220 *
221 * Probe an LCD display device, ensuring that we have the required resources in
222 * order to access the LCD & setting up private data as well as sysfs files.
223 *
224 * Return: 0 on success, else -ERRNO
225 */
226static int img_ascii_lcd_probe(struct platform_device *pdev)
227{
228	struct device *dev = &pdev->dev;
229	const struct img_ascii_lcd_config *cfg = device_get_match_data(dev);
230	struct img_ascii_lcd_ctx *ctx;
 
231	int err;
232
233	ctx = devm_kzalloc(dev, sizeof(*ctx) + cfg->num_chars, GFP_KERNEL);
 
 
 
 
 
 
234	if (!ctx)
235		return -ENOMEM;
236
237	if (cfg->external_regmap) {
238		ctx->regmap = syscon_node_to_regmap(dev->parent->of_node);
239		if (IS_ERR(ctx->regmap))
240			return PTR_ERR(ctx->regmap);
241
242		if (of_property_read_u32(dev->of_node, "offset", &ctx->offset))
 
243			return -EINVAL;
244	} else {
245		ctx->base = devm_platform_ioremap_resource(pdev, 0);
 
246		if (IS_ERR(ctx->base))
247			return PTR_ERR(ctx->base);
248	}
249
250	err = linedisp_register(&ctx->linedisp, dev, cfg->num_chars, ctx->curr,
251				cfg->update);
 
 
 
 
 
 
 
 
 
 
 
 
 
252	if (err)
253		return err;
254
255	/* for backwards compatibility */
256	err = compat_only_sysfs_link_entry_to_kobj(&dev->kobj,
257						   &ctx->linedisp.dev.kobj,
258						   "message", NULL);
259	if (err)
260		goto err_unregister;
261
262	platform_set_drvdata(pdev, ctx);
263	return 0;
264
265err_unregister:
266	linedisp_unregister(&ctx->linedisp);
267	return err;
268}
269
270/**
271 * img_ascii_lcd_remove() - remove an LCD display device
272 * @pdev: the LCD platform device
273 *
274 * Remove an LCD display device, freeing private resources & ensuring that the
275 * driver stops using the LCD display registers.
276 *
277 * Return: 0
278 */
279static int img_ascii_lcd_remove(struct platform_device *pdev)
280{
281	struct img_ascii_lcd_ctx *ctx = platform_get_drvdata(pdev);
282
283	sysfs_remove_link(&pdev->dev.kobj, "message");
284	linedisp_unregister(&ctx->linedisp);
285	return 0;
286}
287
288static struct platform_driver img_ascii_lcd_driver = {
289	.driver = {
290		.name		= "img-ascii-lcd",
291		.of_match_table	= img_ascii_lcd_matches,
292	},
293	.probe	= img_ascii_lcd_probe,
294	.remove	= img_ascii_lcd_remove,
295};
296module_platform_driver(img_ascii_lcd_driver);
297
298MODULE_DESCRIPTION("Imagination Technologies ASCII LCD Display");
299MODULE_AUTHOR("Paul Burton <paul.burton@mips.com>");
300MODULE_LICENSE("GPL");
v4.10.11
 
  1/*
  2 * Copyright (C) 2016 Imagination Technologies
  3 * Author: Paul Burton <paul.burton@imgtec.com>
  4 *
  5 * This program is free software; you can redistribute it and/or modify it
  6 * under the terms of the GNU General Public License as published by the
  7 * Free Software Foundation; either version 2 of the License, or (at your
  8 * option) any later version.
  9 */
 10
 11#include <generated/utsrelease.h>
 12#include <linux/kernel.h>
 13#include <linux/io.h>
 14#include <linux/mfd/syscon.h>
 15#include <linux/module.h>
 16#include <linux/of_address.h>
 17#include <linux/of_platform.h>
 18#include <linux/platform_device.h>
 
 19#include <linux/regmap.h>
 20#include <linux/slab.h>
 21#include <linux/sysfs.h>
 
 22
 23struct img_ascii_lcd_ctx;
 24
 25/**
 26 * struct img_ascii_lcd_config - Configuration information about an LCD model
 27 * @num_chars: the number of characters the LCD can display
 28 * @external_regmap: true if registers are in a system controller, else false
 29 * @update: function called to update the LCD
 30 */
 31struct img_ascii_lcd_config {
 32	unsigned int num_chars;
 33	bool external_regmap;
 34	void (*update)(struct img_ascii_lcd_ctx *ctx);
 35};
 36
 37/**
 38 * struct img_ascii_lcd_ctx - Private data structure
 39 * @pdev: the ASCII LCD platform device
 40 * @base: the base address of the LCD registers
 41 * @regmap: the regmap through which LCD registers are accessed
 42 * @offset: the offset within regmap to the start of the LCD registers
 43 * @cfg: pointer to the LCD model configuration
 44 * @message: the full message to display or scroll on the LCD
 45 * @message_len: the length of the @message string
 46 * @scroll_pos: index of the first character of @message currently displayed
 47 * @scroll_rate: scroll interval in jiffies
 48 * @timer: timer used to implement scrolling
 49 * @curr: the string currently displayed on the LCD
 50 */
 51struct img_ascii_lcd_ctx {
 52	struct platform_device *pdev;
 53	union {
 54		void __iomem *base;
 55		struct regmap *regmap;
 56	};
 57	u32 offset;
 58	const struct img_ascii_lcd_config *cfg;
 59	char *message;
 60	unsigned int message_len;
 61	unsigned int scroll_pos;
 62	unsigned int scroll_rate;
 63	struct timer_list timer;
 64	char curr[] __aligned(8);
 65};
 66
 67/*
 68 * MIPS Boston development board
 69 */
 70
 71static void boston_update(struct img_ascii_lcd_ctx *ctx)
 72{
 
 
 73	ulong val;
 74
 75#if BITS_PER_LONG == 64
 76	val = *((u64 *)&ctx->curr[0]);
 77	__raw_writeq(val, ctx->base);
 78#elif BITS_PER_LONG == 32
 79	val = *((u32 *)&ctx->curr[0]);
 80	__raw_writel(val, ctx->base);
 81	val = *((u32 *)&ctx->curr[4]);
 82	__raw_writel(val, ctx->base + 4);
 83#else
 84# error Not 32 or 64 bit
 85#endif
 86}
 87
 88static struct img_ascii_lcd_config boston_config = {
 89	.num_chars = 8,
 90	.update = boston_update,
 91};
 92
 93/*
 94 * MIPS Malta development board
 95 */
 96
 97static void malta_update(struct img_ascii_lcd_ctx *ctx)
 98{
 
 
 99	unsigned int i;
100	int err;
101
102	for (i = 0; i < ctx->cfg->num_chars; i++) {
103		err = regmap_write(ctx->regmap,
104				   ctx->offset + (i * 8), ctx->curr[i]);
105		if (err)
106			break;
107	}
108
109	if (unlikely(err))
110		pr_err_ratelimited("Failed to update LCD display: %d\n", err);
111}
112
113static struct img_ascii_lcd_config malta_config = {
114	.num_chars = 8,
115	.external_regmap = true,
116	.update = malta_update,
117};
118
119/*
120 * MIPS SEAD3 development board
121 */
122
123enum {
124	SEAD3_REG_LCD_CTRL		= 0x00,
125#define SEAD3_REG_LCD_CTRL_SETDRAM	BIT(7)
126	SEAD3_REG_LCD_DATA		= 0x08,
127	SEAD3_REG_CPLD_STATUS		= 0x10,
128#define SEAD3_REG_CPLD_STATUS_BUSY	BIT(0)
129	SEAD3_REG_CPLD_DATA		= 0x18,
130#define SEAD3_REG_CPLD_DATA_BUSY	BIT(7)
131};
132
133static int sead3_wait_sm_idle(struct img_ascii_lcd_ctx *ctx)
134{
135	unsigned int status;
136	int err;
137
138	do {
139		err = regmap_read(ctx->regmap,
140				  ctx->offset + SEAD3_REG_CPLD_STATUS,
141				  &status);
142		if (err)
143			return err;
144	} while (status & SEAD3_REG_CPLD_STATUS_BUSY);
145
146	return 0;
147
148}
149
150static int sead3_wait_lcd_idle(struct img_ascii_lcd_ctx *ctx)
151{
152	unsigned int cpld_data;
153	int err;
154
155	err = sead3_wait_sm_idle(ctx);
156	if (err)
157		return err;
158
159	do {
160		err = regmap_read(ctx->regmap,
161				  ctx->offset + SEAD3_REG_LCD_CTRL,
162				  &cpld_data);
163		if (err)
164			return err;
165
166		err = sead3_wait_sm_idle(ctx);
167		if (err)
168			return err;
169
170		err = regmap_read(ctx->regmap,
171				  ctx->offset + SEAD3_REG_CPLD_DATA,
172				  &cpld_data);
173		if (err)
174			return err;
175	} while (cpld_data & SEAD3_REG_CPLD_DATA_BUSY);
176
177	return 0;
178}
179
180static void sead3_update(struct img_ascii_lcd_ctx *ctx)
181{
 
 
182	unsigned int i;
183	int err;
184
185	for (i = 0; i < ctx->cfg->num_chars; i++) {
186		err = sead3_wait_lcd_idle(ctx);
187		if (err)
188			break;
189
190		err = regmap_write(ctx->regmap,
191				   ctx->offset + SEAD3_REG_LCD_CTRL,
192				   SEAD3_REG_LCD_CTRL_SETDRAM | i);
193		if (err)
194			break;
195
196		err = sead3_wait_lcd_idle(ctx);
197		if (err)
198			break;
199
200		err = regmap_write(ctx->regmap,
201				   ctx->offset + SEAD3_REG_LCD_DATA,
202				   ctx->curr[i]);
203		if (err)
204			break;
205	}
206
207	if (unlikely(err))
208		pr_err_ratelimited("Failed to update LCD display: %d\n", err);
209}
210
211static struct img_ascii_lcd_config sead3_config = {
212	.num_chars = 16,
213	.external_regmap = true,
214	.update = sead3_update,
215};
216
217static const struct of_device_id img_ascii_lcd_matches[] = {
218	{ .compatible = "img,boston-lcd", .data = &boston_config },
219	{ .compatible = "mti,malta-lcd", .data = &malta_config },
220	{ .compatible = "mti,sead3-lcd", .data = &sead3_config },
221	{ /* sentinel */ }
222};
223
224/**
225 * img_ascii_lcd_scroll() - scroll the display by a character
226 * @arg: really a pointer to the private data structure
227 *
228 * Scroll the current message along the LCD by one character, rearming the
229 * timer if required.
230 */
231static void img_ascii_lcd_scroll(unsigned long arg)
232{
233	struct img_ascii_lcd_ctx *ctx = (struct img_ascii_lcd_ctx *)arg;
234	unsigned int i, ch = ctx->scroll_pos;
235	unsigned int num_chars = ctx->cfg->num_chars;
236
237	/* update the current message string */
238	for (i = 0; i < num_chars;) {
239		/* copy as many characters from the string as possible */
240		for (; i < num_chars && ch < ctx->message_len; i++, ch++)
241			ctx->curr[i] = ctx->message[ch];
242
243		/* wrap around to the start of the string */
244		ch = 0;
245	}
246
247	/* update the LCD */
248	ctx->cfg->update(ctx);
249
250	/* move on to the next character */
251	ctx->scroll_pos++;
252	ctx->scroll_pos %= ctx->message_len;
253
254	/* rearm the timer */
255	if (ctx->message_len > ctx->cfg->num_chars)
256		mod_timer(&ctx->timer, jiffies + ctx->scroll_rate);
257}
258
259/**
260 * img_ascii_lcd_display() - set the message to be displayed
261 * @ctx: pointer to the private data structure
262 * @msg: the message to display
263 * @count: length of msg, or -1
264 *
265 * Display a new message @msg on the LCD. @msg can be longer than the number of
266 * characters the LCD can display, in which case it will begin scrolling across
267 * the LCD display.
268 *
269 * Return: 0 on success, -ENOMEM on memory allocation failure
270 */
271static int img_ascii_lcd_display(struct img_ascii_lcd_ctx *ctx,
272			     const char *msg, ssize_t count)
273{
274	char *new_msg;
275
276	/* stop the scroll timer */
277	del_timer_sync(&ctx->timer);
278
279	if (count == -1)
280		count = strlen(msg);
281
282	/* if the string ends with a newline, trim it */
283	if (msg[count - 1] == '\n')
284		count--;
285
286	new_msg = devm_kmalloc(&ctx->pdev->dev, count + 1, GFP_KERNEL);
287	if (!new_msg)
288		return -ENOMEM;
289
290	memcpy(new_msg, msg, count);
291	new_msg[count] = 0;
292
293	if (ctx->message)
294		devm_kfree(&ctx->pdev->dev, ctx->message);
295
296	ctx->message = new_msg;
297	ctx->message_len = count;
298	ctx->scroll_pos = 0;
299
300	/* update the LCD */
301	img_ascii_lcd_scroll((unsigned long)ctx);
302
303	return 0;
304}
305
306/**
307 * message_show() - read message via sysfs
308 * @dev: the LCD device
309 * @attr: the LCD message attribute
310 * @buf: the buffer to read the message into
311 *
312 * Read the current message being displayed or scrolled across the LCD display
313 * into @buf, for reads from sysfs.
314 *
315 * Return: the number of characters written to @buf
316 */
317static ssize_t message_show(struct device *dev, struct device_attribute *attr,
318			    char *buf)
319{
320	struct img_ascii_lcd_ctx *ctx = dev_get_drvdata(dev);
321
322	return sprintf(buf, "%s\n", ctx->message);
323}
324
325/**
326 * message_store() - write a new message via sysfs
327 * @dev: the LCD device
328 * @attr: the LCD message attribute
329 * @buf: the buffer containing the new message
330 * @count: the size of the message in @buf
331 *
332 * Write a new message to display or scroll across the LCD display from sysfs.
333 *
334 * Return: the size of the message on success, else -ERRNO
335 */
336static ssize_t message_store(struct device *dev, struct device_attribute *attr,
337			     const char *buf, size_t count)
338{
339	struct img_ascii_lcd_ctx *ctx = dev_get_drvdata(dev);
340	int err;
341
342	err = img_ascii_lcd_display(ctx, buf, count);
343	return err ?: count;
344}
345
346static DEVICE_ATTR_RW(message);
347
348/**
349 * img_ascii_lcd_probe() - probe an LCD display device
350 * @pdev: the LCD platform device
351 *
352 * Probe an LCD display device, ensuring that we have the required resources in
353 * order to access the LCD & setting up private data as well as sysfs files.
354 *
355 * Return: 0 on success, else -ERRNO
356 */
357static int img_ascii_lcd_probe(struct platform_device *pdev)
358{
359	const struct of_device_id *match;
360	const struct img_ascii_lcd_config *cfg;
361	struct img_ascii_lcd_ctx *ctx;
362	struct resource *res;
363	int err;
364
365	match = of_match_device(img_ascii_lcd_matches, &pdev->dev);
366	if (!match)
367		return -ENODEV;
368
369	cfg = match->data;
370	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx) + cfg->num_chars,
371			   GFP_KERNEL);
372	if (!ctx)
373		return -ENOMEM;
374
375	if (cfg->external_regmap) {
376		ctx->regmap = syscon_node_to_regmap(pdev->dev.parent->of_node);
377		if (IS_ERR(ctx->regmap))
378			return PTR_ERR(ctx->regmap);
379
380		if (of_property_read_u32(pdev->dev.of_node, "offset",
381					 &ctx->offset))
382			return -EINVAL;
383	} else {
384		res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
385		ctx->base = devm_ioremap_resource(&pdev->dev, res);
386		if (IS_ERR(ctx->base))
387			return PTR_ERR(ctx->base);
388	}
389
390	ctx->pdev = pdev;
391	ctx->cfg = cfg;
392	ctx->message = NULL;
393	ctx->scroll_pos = 0;
394	ctx->scroll_rate = HZ / 2;
395
396	/* initialise a timer for scrolling the message */
397	init_timer(&ctx->timer);
398	ctx->timer.function = img_ascii_lcd_scroll;
399	ctx->timer.data = (unsigned long)ctx;
400
401	platform_set_drvdata(pdev, ctx);
402
403	/* display a default message */
404	err = img_ascii_lcd_display(ctx, "Linux " UTS_RELEASE "       ", -1);
405	if (err)
406		goto out_del_timer;
407
408	err = device_create_file(&pdev->dev, &dev_attr_message);
 
 
 
409	if (err)
410		goto out_del_timer;
411
 
412	return 0;
413out_del_timer:
414	del_timer_sync(&ctx->timer);
 
415	return err;
416}
417
418/**
419 * img_ascii_lcd_remove() - remove an LCD display device
420 * @pdev: the LCD platform device
421 *
422 * Remove an LCD display device, freeing private resources & ensuring that the
423 * driver stops using the LCD display registers.
424 *
425 * Return: 0
426 */
427static int img_ascii_lcd_remove(struct platform_device *pdev)
428{
429	struct img_ascii_lcd_ctx *ctx = platform_get_drvdata(pdev);
430
431	device_remove_file(&pdev->dev, &dev_attr_message);
432	del_timer_sync(&ctx->timer);
433	return 0;
434}
435
436static struct platform_driver img_ascii_lcd_driver = {
437	.driver = {
438		.name		= "img-ascii-lcd",
439		.of_match_table	= img_ascii_lcd_matches,
440	},
441	.probe	= img_ascii_lcd_probe,
442	.remove	= img_ascii_lcd_remove,
443};
444module_platform_driver(img_ascii_lcd_driver);