diff options
Diffstat (limited to 'drivers/auxdisplay/hd44780_common.c')
| -rw-r--r-- | drivers/auxdisplay/hd44780_common.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/drivers/auxdisplay/hd44780_common.c b/drivers/auxdisplay/hd44780_common.c index 3934c2eebf33..1792fe2a4460 100644 --- a/drivers/auxdisplay/hd44780_common.c +++ b/drivers/auxdisplay/hd44780_common.c @@ -82,7 +82,15 @@ int hd44780_common_clear_display(struct charlcd *lcd) hdc->write_cmd(hdc, LCD_CMD_DISPLAY_CLEAR); /* datasheet says to wait 1,64 milliseconds */ long_sleep(2); - return 0; + + /* + * The Hitachi HD44780 controller (and compatible ones) reset the DDRAM + * address when executing the DISPLAY_CLEAR command, thus the + * following call is not required. However, other controllers do not + * (e.g. NewHaven NHD-0220DZW-AG5), thus move the cursor to home + * unconditionally to support both. + */ + return hd44780_common_home(lcd); } EXPORT_SYMBOL_GPL(hd44780_common_clear_display); @@ -343,19 +351,28 @@ int hd44780_common_redefine_char(struct charlcd *lcd, char *esc) } EXPORT_SYMBOL_GPL(hd44780_common_redefine_char); -struct hd44780_common *hd44780_common_alloc(void) +struct charlcd *hd44780_common_alloc(void) { - struct hd44780_common *hd; + struct hd44780_common *hdc; + struct charlcd *lcd; - hd = kzalloc(sizeof(*hd), GFP_KERNEL); - if (!hd) + lcd = charlcd_alloc(sizeof(*hdc)); + if (!lcd) return NULL; - hd->ifwidth = 8; - hd->bwidth = DEFAULT_LCD_BWIDTH; - hd->hwidth = DEFAULT_LCD_HWIDTH; - return hd; + hdc = lcd->drvdata; + hdc->ifwidth = 8; + hdc->bwidth = DEFAULT_LCD_BWIDTH; + hdc->hwidth = DEFAULT_LCD_HWIDTH; + return lcd; } EXPORT_SYMBOL_GPL(hd44780_common_alloc); +void hd44780_common_free(struct charlcd *lcd) +{ + charlcd_free(lcd); +} +EXPORT_SYMBOL_GPL(hd44780_common_free); + +MODULE_DESCRIPTION("Common functions for HD44780 (and compatibles) LCD displays"); MODULE_LICENSE("GPL"); |
