Skip to content

Commit

Permalink
Merge tag 'auxdisplay-for-linus-v4.18-rc1' of git://github.com/ojeda/…
Browse files Browse the repository at this point in the history
…linux

Pull auxdisplay updates from Miguel Ojeda:
 "Mostly small fixes and cleanups, plus a non-trivial fix for charlcd

  - charlcd: fixes and cleanups (Robert Abel and Sean Young)

  - Kconfig fixes (Randy Dunlap, Corentin Labbe and Ulf Magnusson)

  - cfag12864bfb: const cleanup (Gustavo A. R. Silva)

  - Docs/licenses/warnings cleanups"

* tag 'auxdisplay-for-linus-v4.18-rc1' of git://github.com/ojeda/linux:
  auxdisplay: Replace licenses with SPDX identifiers
  auxdisplay: make PANEL a menuconfig
  auxdisplay: fix broken menu
  auxdisplay: charlcd: Fix and clean up handling of x/y commands
  auxdisplay: charlcd: fix hex literal ranges for graphics command
  auxdisplay: charlcd: fix two-line command ^[[LN not marked as processed
  auxdisplay: charlcd: replace octal literal with form-feed escape sequence
  auxdisplay: charlcd: use null character instead of zero literal to terminate strings
  auxdisplay: charlcd: no need to call charlcd_gotoxy() if nothing changes
  auxdisplay: cfag12864bfb: constify fb_fix_screeninfo and fb_var_screeninfo structures
  auxdisplay: img-ascii-lcd: fix typo on select SYSCON/MFD_SYSCON
  auxdisplay: img-ascii-lcd: kconfig: Remove MIPS_SEAD3 reference
  auxdisplay: arm-charlcd: Fix struct charlcd doc line
  MAINTAINERS: auxdisplay: remove obsolete webpages
  Doc: misc-devices: move lcd-panel-cgram.txt to auxdisplay/
  • Loading branch information
torvalds committed Jun 7, 2018
2 parents edb2a38 + 351f683 commit 7423fd7
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 158 deletions.
8 changes: 0 additions & 8 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2533,8 +2533,6 @@ F: kernel/audit*

AUXILIARY DISPLAY DRIVERS
M: Miguel Ojeda Sandonis <[email protected]>
W: http://miguelojeda.es/auxdisplay.htm
W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm
S: Maintained
F: drivers/auxdisplay/
F: include/linux/cfag12864b.h
Expand Down Expand Up @@ -3384,16 +3382,12 @@ F: include/linux/usb/wusb*

CFAG12864B LCD DRIVER
M: Miguel Ojeda Sandonis <[email protected]>
W: http://miguelojeda.es/auxdisplay.htm
W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm
S: Maintained
F: drivers/auxdisplay/cfag12864b.c
F: include/linux/cfag12864b.h

CFAG12864BFB LCD FRAMEBUFFER DRIVER
M: Miguel Ojeda Sandonis <[email protected]>
W: http://miguelojeda.es/auxdisplay.htm
W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm
S: Maintained
F: drivers/auxdisplay/cfag12864bfb.c
F: include/linux/cfag12864b.h
Expand Down Expand Up @@ -7977,8 +7971,6 @@ F: kernel/kprobes.c

KS0108 LCD CONTROLLER DRIVER
M: Miguel Ojeda Sandonis <[email protected]>
W: http://miguelojeda.es/auxdisplay.htm
W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm
S: Maintained
F: Documentation/auxdisplay/ks0108
F: drivers/auxdisplay/ks0108.c
Expand Down
16 changes: 8 additions & 8 deletions drivers/auxdisplay/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ menuconfig AUXDISPLAY

If you say N, all options in this submenu will be skipped and disabled.

config CHARLCD
tristate "Character LCD core support" if COMPILE_TEST

if AUXDISPLAY

config HD44780
Expand Down Expand Up @@ -137,8 +134,8 @@ config CFAG12864B_RATE
config IMG_ASCII_LCD
tristate "Imagination Technologies ASCII LCD Display"
depends on HAS_IOMEM
default y if MIPS_MALTA || MIPS_SEAD3
select SYSCON
default y if MIPS_MALTA
select MFD_SYSCON
help
Enable this to support the simple ASCII LCD displays found on
development boards such as the MIPS Boston, MIPS Malta & MIPS SEAD3
Expand All @@ -157,8 +154,6 @@ config HT16K33
Say yes here to add support for Holtek HT16K33, RAM mapping 16*8
LED controller driver with keyscan.

endif # AUXDISPLAY

config ARM_CHARLCD
bool "ARM Ltd. Character LCD Driver"
depends on PLAT_VERSATILE
Expand All @@ -169,7 +164,9 @@ config ARM_CHARLCD
line and the Linux version on the second line, but that's
still useful.

config PANEL
endif # AUXDISPLAY

menuconfig PANEL
tristate "Parallel port LCD/Keypad Panel support"
depends on PARPORT
select CHARLCD
Expand Down Expand Up @@ -448,3 +445,6 @@ config PANEL_BOOT_MESSAGE
printf()-formatted message is valid with newline and escape codes.

endif # PANEL

config CHARLCD
tristate "Character LCD core support" if COMPILE_TEST
4 changes: 3 additions & 1 deletion drivers/auxdisplay/arm-charlcd.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Driver for the on-board character LCD found on some ARM reference boards
* This is basically an Hitachi HD44780 LCD with a custom IP block to drive it
* http://en.wikipedia.org/wiki/HD44780_Character_LCD
* Currently it will just display the text "ARM Linux" and the linux version
*
* License terms: GNU General Public License (GPL) version 2
* Author: Linus Walleij <[email protected]>
*/
#include <linux/init.h>
Expand Down Expand Up @@ -54,12 +54,14 @@
#define HD_BUSY_FLAG 0x80U

/**
* struct charlcd - Private data structure
* @dev: a pointer back to containing device
* @phybase: the offset to the controller in physical memory
* @physize: the size of the physical page
* @virtbase: the offset to the controller in virtual memory
* @irq: reserved interrupt number
* @complete: completion structure for the last LCD command
* @init_work: delayed work structure to initialize the display on boot
*/
struct charlcd {
struct device *dev;
Expand Down
16 changes: 1 addition & 15 deletions drivers/auxdisplay/cfag12864b.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Filename: cfag12864b.c
* Version: 0.1.0
* Description: cfag12864b LCD driver
* License: GPLv2
* Depends: ks0108
*
* Author: Copyright (C) Miguel Ojeda Sandonis
* Date: 2006-10-31
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#include <linux/init.h>
Expand Down
20 changes: 3 additions & 17 deletions drivers/auxdisplay/cfag12864bfb.c
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Filename: cfag12864bfb.c
* Version: 0.1.0
* Description: cfag12864b LCD framebuffer driver
* License: GPLv2
* Depends: cfag12864b
*
* Author: Copyright (C) Miguel Ojeda Sandonis
* Date: 2006-10-31
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/

#include <linux/init.h>
Expand All @@ -37,7 +23,7 @@

#define CFAG12864BFB_NAME "cfag12864bfb"

static struct fb_fix_screeninfo cfag12864bfb_fix = {
static const struct fb_fix_screeninfo cfag12864bfb_fix = {
.id = "cfag12864b",
.type = FB_TYPE_PACKED_PIXELS,
.visual = FB_VISUAL_MONO10,
Expand All @@ -48,7 +34,7 @@ static struct fb_fix_screeninfo cfag12864bfb_fix = {
.accel = FB_ACCEL_NONE,
};

static struct fb_var_screeninfo cfag12864bfb_var = {
static const struct fb_var_screeninfo cfag12864bfb_var = {
.xres = CFAG12864B_WIDTH,
.yres = CFAG12864B_HEIGHT,
.xres_virtual = CFAG12864B_WIDTH,
Expand Down
119 changes: 89 additions & 30 deletions drivers/auxdisplay/charlcd.c
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Character LCD driver for Linux
*
* Copyright (C) 2000-2008, Willy Tarreau <[email protected]>
* Copyright (C) 2016-2017 Glider bvba
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/

#include <linux/atomic.h>
#include <linux/ctype.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
Expand Down Expand Up @@ -192,10 +189,11 @@ static void charlcd_print(struct charlcd *lcd, char c)
c = lcd->char_conv[(unsigned char)c];
lcd->ops->write_data(lcd, c);
priv->addr.x++;

/* prevents the cursor from wrapping onto the next line */
if (priv->addr.x == lcd->bwidth)
charlcd_gotoxy(lcd);
}
/* prevents the cursor from wrapping onto the next line */
if (priv->addr.x == lcd->bwidth)
charlcd_gotoxy(lcd);
}

static void charlcd_clear_fast(struct charlcd *lcd)
Expand Down Expand Up @@ -292,6 +290,79 @@ static int charlcd_init_display(struct charlcd *lcd)
return 0;
}

/*
* Parses an unsigned integer from a string, until a non-digit character
* is found. The empty string is not accepted. No overflow checks are done.
*
* Returns whether the parsing was successful. Only in that case
* the output parameters are written to.
*
* TODO: If the kernel adds an inplace version of kstrtoul(), this function
* could be easily replaced by that.
*/
static bool parse_n(const char *s, unsigned long *res, const char **next_s)
{
if (!isdigit(*s))
return false;

*res = 0;
while (isdigit(*s)) {
*res = *res * 10 + (*s - '0');
++s;
}

*next_s = s;
return true;
}

/*
* Parses a movement command of the form "(.*);", where the group can be
* any number of subcommands of the form "(x|y)[0-9]+".
*
* Returns whether the command is valid. The position arguments are
* only written if the parsing was successful.
*
* For instance:
* - ";" returns (<original x>, <original y>).
* - "x1;" returns (1, <original y>).
* - "y2x1;" returns (1, 2).
* - "x12y34x56;" returns (56, 34).
* - "" fails.
* - "x" fails.
* - "x;" fails.
* - "x1" fails.
* - "xy12;" fails.
* - "x12yy12;" fails.
* - "xx" fails.
*/
static bool parse_xy(const char *s, unsigned long *x, unsigned long *y)
{
unsigned long new_x = *x;
unsigned long new_y = *y;

for (;;) {
if (!*s)
return false;

if (*s == ';')
break;

if (*s == 'x') {
if (!parse_n(s + 1, &new_x, &s))
return false;
} else if (*s == 'y') {
if (!parse_n(s + 1, &new_y, &s))
return false;
} else {
return false;
}
}

*x = new_x;
*y = new_y;
return true;
}

/*
* These are the file operation function for user access to /dev/lcd
* This function can also be called from inside the kernel, by
Expand Down Expand Up @@ -362,6 +433,7 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
break;
case 'N': /* Two Lines */
priv->flags |= LCD_FLAG_N;
processed = 1;
break;
case 'l': /* Shift Cursor Left */
if (priv->addr.x > 0) {
Expand Down Expand Up @@ -441,9 +513,9 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
shift ^= 4;
if (*esc >= '0' && *esc <= '9') {
value |= (*esc - '0') << shift;
} else if (*esc >= 'A' && *esc <= 'Z') {
} else if (*esc >= 'A' && *esc <= 'F') {
value |= (*esc - 'A' + 10) << shift;
} else if (*esc >= 'a' && *esc <= 'z') {
} else if (*esc >= 'a' && *esc <= 'f') {
value |= (*esc - 'a' + 10) << shift;
} else {
esc++;
Expand All @@ -469,24 +541,11 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
}
case 'x': /* gotoxy : LxXXX[yYYY]; */
case 'y': /* gotoxy : LyYYY[xXXX]; */
if (!strchr(esc, ';'))
break;

while (*esc) {
if (*esc == 'x') {
esc++;
if (kstrtoul(esc, 10, &priv->addr.x) < 0)
break;
} else if (*esc == 'y') {
esc++;
if (kstrtoul(esc, 10, &priv->addr.y) < 0)
break;
} else {
break;
}
}
/* If the command is valid, move to the new address */
if (parse_xy(esc, &priv->addr.x, &priv->addr.y))
charlcd_gotoxy(lcd);

charlcd_gotoxy(lcd);
/* Regardless of its validity, mark as processed */
processed = 1;
break;
}
Expand Down Expand Up @@ -527,7 +586,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
if ((c != '\n') && priv->esc_seq.len >= 0) {
/* yes, let's add this char to the buffer */
priv->esc_seq.buf[priv->esc_seq.len++] = c;
priv->esc_seq.buf[priv->esc_seq.len] = 0;
priv->esc_seq.buf[priv->esc_seq.len] = '\0';
} else {
/* aborts any previous escape sequence */
priv->esc_seq.len = -1;
Expand All @@ -536,7 +595,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
case LCD_ESCAPE_CHAR:
/* start of an escape sequence */
priv->esc_seq.len = 0;
priv->esc_seq.buf[priv->esc_seq.len] = 0;
priv->esc_seq.buf[priv->esc_seq.len] = '\0';
break;
case '\b':
/* go back one char and clear it */
Expand All @@ -555,7 +614,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
/* back one char again */
lcd->ops->write_cmd(lcd, LCD_CMD_SHIFT);
break;
case '\014':
case '\f':
/* quickly clear the display */
charlcd_clear_fast(lcd);
break;
Expand Down
6 changes: 1 addition & 5 deletions drivers/auxdisplay/hd44780.c
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* HD44780 Character LCD driver for Linux
*
* Copyright (C) 2000-2008, Willy Tarreau <[email protected]>
* Copyright (C) 2016-2017 Glider bvba
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/

#include <linux/delay.h>
Expand Down
Loading

0 comments on commit 7423fd7

Please sign in to comment.