2020-11-03 10:58:05 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
|
2020-11-03 10:58:11 +01:00
|
|
|
#include "charlcd.h"
|
2020-11-03 10:58:05 +01:00
|
|
|
#include "hd44780_common.h"
|
|
|
|
|
2020-11-03 10:58:11 +01:00
|
|
|
int hd44780_common_print(struct charlcd *lcd, int c)
|
|
|
|
{
|
|
|
|
struct hd44780_common *hdc = lcd->drvdata;
|
|
|
|
|
|
|
|
if (lcd->addr.x < hdc->bwidth) {
|
|
|
|
hdc->write_data(hdc, c);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(hd44780_common_print);
|
|
|
|
|
2020-11-03 10:58:05 +01:00
|
|
|
struct hd44780_common *hd44780_common_alloc(void)
|
|
|
|
{
|
|
|
|
struct hd44780_common *hd;
|
|
|
|
|
|
|
|
hd = kzalloc(sizeof(*hd), GFP_KERNEL);
|
|
|
|
if (!hd)
|
|
|
|
return NULL;
|
|
|
|
|
2020-11-03 10:58:07 +01:00
|
|
|
hd->ifwidth = 8;
|
2020-11-03 10:58:06 +01:00
|
|
|
hd->bwidth = DEFAULT_LCD_BWIDTH;
|
|
|
|
hd->hwidth = DEFAULT_LCD_HWIDTH;
|
2020-11-03 10:58:05 +01:00
|
|
|
return hd;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(hd44780_common_alloc);
|
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|