summaryrefslogtreecommitdiffstats
path: root/drivers/auxdisplay/charlcd.c
AgeCommit message (Collapse)AuthorFilesLines
2019-12-04auxdisplay: charlcd: deduplicate simple_strtoul()Andy Shevchenko1-27/+7
Like in commit 8b2303de399f ("serial: core: Fix handling of options after MMIO address") we may use simple_strtoul() which in comparison to kstrtoul() can do conversion in-place without additional and unnecessary code to be written. Link: http://lkml.kernel.org/r/20190801192904.41087-2-andriy.shevchenko@linux.intel.com Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Mans Rullgard <mans@mansr.com> Cc: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-08-08auxdisplay: charlcd: move charlcd.h to drivers/auxdisplayMasahiro Yamada1-1/+1
This header is included in drivers/auxdisplay/. Make it a local header. Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2019-03-17auxdisplay: charlcd: make backlight initial state configurableMans Rullgard1-1/+9
The charlcd driver currently flashes the backlight once on init. This may not be desirable. Thus, add options for turning the backlight off or on as well. Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2019-03-17auxdisplay: charlcd: simplify init message displayMans Rullgard1-7/+8
If CONFIG_PANEL_CHANGE_MESSAGE is set, CONFIG_PANEL_BOOT_MESSAGE will also be defined, so the double ifdef is pointless. Simplify the code further by using an intermediate macro rather duplicating most of the line. Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2019-03-17auxdisplay: charlcd: Introduce charlcd_free() helperAndy Shevchenko1-0/+6
The charlcd_free() is a counterpart to charlcd_alloc() and should be called symmetrically on tear down. Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2019-03-17auxdisplay: charlcd: Move to_priv() to charlcd namespaceAndy Shevchenko1-13/+13
In order to be more particular in names, rename to_priv() macro to charlcd_to_priv(). No functional change intended. Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-12-21auxdisplay: charlcd: fix x/y command parsingMans Rullgard1-0/+3
The x/y command parsing has been broken since commit 129957069e6a ("staging: panel: Fixed checkpatch warning about simple_strtoul()"). Commit b34050fadb86 ("auxdisplay: charlcd: Fix and clean up handling of x/y commands") fixed some problems by rewriting the parsing code, but also broke things further by removing the check for a complete command before attempting to parse it. As a result, parsing is terminated at the first x or y character. This reinstates the check for a final semicolon. Whereas the original code use strchr(), this is wasteful seeing as the semicolon is always at the end of the buffer. Thus check this character directly instead. Signed-off-by: Mans Rullgard <mans@mansr.com> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-08-01auxdisplay: charlcd: delete mdelay in long_sleepJia-Ju Bai1-4/+1
The function long_sleep() calls mdelay() when in an interrupt handler. But only charlcd_clear_display() and charlcd_init_display calls long_sleep(), and my tool finds that the two functions are never called in an interrupt handler. Thus mdelay() and in_interrupt() are not necessary. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com> Acked-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-04-12auxdisplay: Replace licenses with SPDX identifiersMiguel Ojeda1-5/+1
Cc: Philippe Ombredanne <pombredanne@nexb.com> Acked-by: Willy Tarreau <w@1wt.eu> Acked-by: Linus Walleij <triad@dflund.se> Acked-by: Robin van der Gracht <robin@protonic.nl> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-04-12auxdisplay: charlcd: Fix and clean up handling of x/y commandsMiguel Ojeda1-17/+78
The current version is not parsing multiple x/y commands as the code originally intended. On top of that, kstrtoul() expects NULL-terminated strings. Finally, the code does two passes over the string. Some explanations about the supported syntax are added as well. Cc: Willy Tarreau <w@1wt.eu> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Robert Abel <rabel@robertabel.eu> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-04-12auxdisplay: charlcd: fix hex literal ranges for graphics commandRobert Abel1-2/+2
The graphics command expects 16 hexadecimal literals, but would allow characters in range [0-9a-zA-Z] instead of [0-9a-fA-F]. Signed-off-by: Robert Abel <rabel@robertabel.eu> Acked-by: Willy Tarreau <w@1wt.eu> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-04-12auxdisplay: charlcd: fix two-line command ^[[LN not marked as processedRobert Abel1-0/+1
Signed-off-by: Robert Abel <rabel@robertabel.eu> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-04-12auxdisplay: charlcd: replace octal literal with form-feed escape sequenceRobert Abel1-1/+1
There is no need to resort to octal escape sequence for the form feed character when an established escape sequence exists. Signed-off-by: Robert Abel <rabel@robertabel.eu> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-04-12auxdisplay: charlcd: use null character instead of zero literal to terminate ↵Robert Abel1-2/+2
strings Using '\0' instead of plain 0 makes the intent clearer that this is indeed a string and not a series of integers. Signed-off-by: Robert Abel <rabel@robertabel.eu> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2018-04-12auxdisplay: charlcd: no need to call charlcd_gotoxy() if nothing changesSean Young1-3/+4
If the line extends beyond the width to the screen, nothing changes. The existing code will call charlcd_gotoxy every time for this case. Signed-off-by: Sean Young <sean@mess.org> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
2017-09-18auxdisplay: charlcd: properly restore atomic counter on error pathWilly Tarreau1-2/+9
Commit f4757af ("staging: panel: Fix single-open policy race condition") introduced in 3.19-rc1 attempted to fix a race condition on the open, but failed to properly do it and used to exit without restoring the semaphore. This results in -EBUSY being returned after the first open error until the module is reloaded or the system restarted (ie: consecutive to a dual open resulting in -EBUSY or to a permission error). [ Note for stable maintainers: the code moved from drivers/misc/panel.c to drivers/auxdisplay/{charlcd,panel}.c during 4.12. The patch easily applies there (modulo the renamed atomic counter) but I can provide a tested backport if desired. ] Fixes: f4757af85 # 3.19-rc1 Cc: stable@vger.kernel.org Cc: Mariusz Gorski <marius.gorski@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Miguel Ojeda Sandonis <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Willy Tarreau <w@1wt.eu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-17auxdisplay: charlcd: Add support for displays with more than two linesGeert Uytterhoeven1-9/+13
On displays with more than two lines, the additional lines are stored in the buffers used for the first two lines, but beyond the visible parts. Adjust the DDRAM address calculation to cater for this. When clearing the display, avoid writing more spaces than the actual size of the physical buffer. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-17auxdisplay: charlcd: Add support for 4-bit interfacesGeert Uytterhoeven1-6/+30
In 4-bit mode, 8-bit commands and data are written using two raw writes to the data interface: high nibble first, low nibble last. This must be handled by the low-level driver. However, as we don't know in which mode (4-bit or 8-bit) nor 4-bit phase the LCD was left, initialization must always be handled using raw writes, and needs to configure the LCD for 8-bit mode first. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-17auxdisplay: charlcd: Extract character LCD core from misc/panelGeert Uytterhoeven1-0/+790
Extract the character LCD core from the Parallel port LCD/Keypad Panel driver in the misc subsystem, and convert it into a subdriver in the auxdisplay subsystem. This allows the character LCD core to be used by other drivers later. Compilation is controlled by its own Kconfig symbol CHARLCD, which is to be selected by its users, but can be enabled manually for compile-testing. All functions changed their prefix from "lcd_" to "charlcd_", and gained a "struct charlcd *" parameter to operate on a specific instance. While the driver API thus is ready to support multiple instances, the current limitation of a single display (/dev/lcd has a single misc minor assigned) is retained. No functional changes intended. Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>