Skip to content

Commit 7423fd7

Browse files
committed
Merge tag 'auxdisplay-for-linus-v4.18-rc1' of git://github.com/ojeda/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/
2 parents edb2a38 + 351f683 commit 7423fd7

File tree

14 files changed

+111
-158
lines changed

14 files changed

+111
-158
lines changed

MAINTAINERS

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2533,8 +2533,6 @@ F: kernel/audit*
25332533

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

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

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

79787972
KS0108 LCD CONTROLLER DRIVER
79797973
M: Miguel Ojeda Sandonis <[email protected]>
7980-
W: http://miguelojeda.es/auxdisplay.htm
7981-
W: http://jair.lab.fi.uva.es/~migojed/auxdisplay.htm
79827974
S: Maintained
79837975
F: Documentation/auxdisplay/ks0108
79847976
F: drivers/auxdisplay/ks0108.c

drivers/auxdisplay/Kconfig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ menuconfig AUXDISPLAY
1414

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

17-
config CHARLCD
18-
tristate "Character LCD core support" if COMPILE_TEST
19-
2017
if AUXDISPLAY
2118

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

160-
endif # AUXDISPLAY
161-
162157
config ARM_CHARLCD
163158
bool "ARM Ltd. Character LCD Driver"
164159
depends on PLAT_VERSATILE
@@ -169,7 +164,9 @@ config ARM_CHARLCD
169164
line and the Linux version on the second line, but that's
170165
still useful.
171166

172-
config PANEL
167+
endif # AUXDISPLAY
168+
169+
menuconfig PANEL
173170
tristate "Parallel port LCD/Keypad Panel support"
174171
depends on PARPORT
175172
select CHARLCD
@@ -448,3 +445,6 @@ config PANEL_BOOT_MESSAGE
448445
printf()-formatted message is valid with newline and escape codes.
449446

450447
endif # PANEL
448+
449+
config CHARLCD
450+
tristate "Character LCD core support" if COMPILE_TEST

drivers/auxdisplay/arm-charlcd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Driver for the on-board character LCD found on some ARM reference boards
34
* This is basically an Hitachi HD44780 LCD with a custom IP block to drive it
45
* http://en.wikipedia.org/wiki/HD44780_Character_LCD
56
* Currently it will just display the text "ARM Linux" and the linux version
67
*
7-
* License terms: GNU General Public License (GPL) version 2
88
* Author: Linus Walleij <[email protected]>
99
*/
1010
#include <linux/init.h>
@@ -54,12 +54,14 @@
5454
#define HD_BUSY_FLAG 0x80U
5555

5656
/**
57+
* struct charlcd - Private data structure
5758
* @dev: a pointer back to containing device
5859
* @phybase: the offset to the controller in physical memory
5960
* @physize: the size of the physical page
6061
* @virtbase: the offset to the controller in virtual memory
6162
* @irq: reserved interrupt number
6263
* @complete: completion structure for the last LCD command
64+
* @init_work: delayed work structure to initialize the display on boot
6365
*/
6466
struct charlcd {
6567
struct device *dev;

drivers/auxdisplay/cfag12864b.c

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Filename: cfag12864b.c
34
* Version: 0.1.0
45
* Description: cfag12864b LCD driver
5-
* License: GPLv2
66
* Depends: ks0108
77
*
88
* Author: Copyright (C) Miguel Ojeda Sandonis
99
* Date: 2006-10-31
10-
*
11-
* This program is free software; you can redistribute it and/or modify
12-
* it under the terms of the GNU General Public License version 2 as
13-
* published by the Free Software Foundation.
14-
*
15-
* This program is distributed in the hope that it will be useful,
16-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
* GNU General Public License for more details.
19-
*
20-
* You should have received a copy of the GNU General Public License
21-
* along with this program; if not, write to the Free Software
22-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23-
*
2410
*/
2511

2612
#include <linux/init.h>

drivers/auxdisplay/cfag12864bfb.c

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,12 @@
1+
// SPDX-License-Identifier: GPL-2.0
12
/*
23
* Filename: cfag12864bfb.c
34
* Version: 0.1.0
45
* Description: cfag12864b LCD framebuffer driver
5-
* License: GPLv2
66
* Depends: cfag12864b
77
*
88
* Author: Copyright (C) Miguel Ojeda Sandonis
99
* Date: 2006-10-31
10-
*
11-
* This program is free software; you can redistribute it and/or modify
12-
* it under the terms of the GNU General Public License version 2 as
13-
* published by the Free Software Foundation.
14-
*
15-
* This program is distributed in the hope that it will be useful,
16-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18-
* GNU General Public License for more details.
19-
*
20-
* You should have received a copy of the GNU General Public License
21-
* along with this program; if not, write to the Free Software
22-
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23-
*
2410
*/
2511

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

3824
#define CFAG12864BFB_NAME "cfag12864bfb"
3925

40-
static struct fb_fix_screeninfo cfag12864bfb_fix = {
26+
static const struct fb_fix_screeninfo cfag12864bfb_fix = {
4127
.id = "cfag12864b",
4228
.type = FB_TYPE_PACKED_PIXELS,
4329
.visual = FB_VISUAL_MONO10,
@@ -48,7 +34,7 @@ static struct fb_fix_screeninfo cfag12864bfb_fix = {
4834
.accel = FB_ACCEL_NONE,
4935
};
5036

51-
static struct fb_var_screeninfo cfag12864bfb_var = {
37+
static const struct fb_var_screeninfo cfag12864bfb_var = {
5238
.xres = CFAG12864B_WIDTH,
5339
.yres = CFAG12864B_HEIGHT,
5440
.xres_virtual = CFAG12864B_WIDTH,

drivers/auxdisplay/charlcd.c

Lines changed: 89 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
23
* Character LCD driver for Linux
34
*
45
* Copyright (C) 2000-2008, Willy Tarreau <[email protected]>
56
* Copyright (C) 2016-2017 Glider bvba
6-
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License
9-
* as published by the Free Software Foundation; either version
10-
* 2 of the License, or (at your option) any later version.
117
*/
128

139
#include <linux/atomic.h>
10+
#include <linux/ctype.h>
1411
#include <linux/delay.h>
1512
#include <linux/fs.h>
1613
#include <linux/miscdevice.h>
@@ -192,10 +189,11 @@ static void charlcd_print(struct charlcd *lcd, char c)
192189
c = lcd->char_conv[(unsigned char)c];
193190
lcd->ops->write_data(lcd, c);
194191
priv->addr.x++;
192+
193+
/* prevents the cursor from wrapping onto the next line */
194+
if (priv->addr.x == lcd->bwidth)
195+
charlcd_gotoxy(lcd);
195196
}
196-
/* prevents the cursor from wrapping onto the next line */
197-
if (priv->addr.x == lcd->bwidth)
198-
charlcd_gotoxy(lcd);
199197
}
200198

201199
static void charlcd_clear_fast(struct charlcd *lcd)
@@ -292,6 +290,79 @@ static int charlcd_init_display(struct charlcd *lcd)
292290
return 0;
293291
}
294292

293+
/*
294+
* Parses an unsigned integer from a string, until a non-digit character
295+
* is found. The empty string is not accepted. No overflow checks are done.
296+
*
297+
* Returns whether the parsing was successful. Only in that case
298+
* the output parameters are written to.
299+
*
300+
* TODO: If the kernel adds an inplace version of kstrtoul(), this function
301+
* could be easily replaced by that.
302+
*/
303+
static bool parse_n(const char *s, unsigned long *res, const char **next_s)
304+
{
305+
if (!isdigit(*s))
306+
return false;
307+
308+
*res = 0;
309+
while (isdigit(*s)) {
310+
*res = *res * 10 + (*s - '0');
311+
++s;
312+
}
313+
314+
*next_s = s;
315+
return true;
316+
}
317+
318+
/*
319+
* Parses a movement command of the form "(.*);", where the group can be
320+
* any number of subcommands of the form "(x|y)[0-9]+".
321+
*
322+
* Returns whether the command is valid. The position arguments are
323+
* only written if the parsing was successful.
324+
*
325+
* For instance:
326+
* - ";" returns (<original x>, <original y>).
327+
* - "x1;" returns (1, <original y>).
328+
* - "y2x1;" returns (1, 2).
329+
* - "x12y34x56;" returns (56, 34).
330+
* - "" fails.
331+
* - "x" fails.
332+
* - "x;" fails.
333+
* - "x1" fails.
334+
* - "xy12;" fails.
335+
* - "x12yy12;" fails.
336+
* - "xx" fails.
337+
*/
338+
static bool parse_xy(const char *s, unsigned long *x, unsigned long *y)
339+
{
340+
unsigned long new_x = *x;
341+
unsigned long new_y = *y;
342+
343+
for (;;) {
344+
if (!*s)
345+
return false;
346+
347+
if (*s == ';')
348+
break;
349+
350+
if (*s == 'x') {
351+
if (!parse_n(s + 1, &new_x, &s))
352+
return false;
353+
} else if (*s == 'y') {
354+
if (!parse_n(s + 1, &new_y, &s))
355+
return false;
356+
} else {
357+
return false;
358+
}
359+
}
360+
361+
*x = new_x;
362+
*y = new_y;
363+
return true;
364+
}
365+
295366
/*
296367
* These are the file operation function for user access to /dev/lcd
297368
* This function can also be called from inside the kernel, by
@@ -362,6 +433,7 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
362433
break;
363434
case 'N': /* Two Lines */
364435
priv->flags |= LCD_FLAG_N;
436+
processed = 1;
365437
break;
366438
case 'l': /* Shift Cursor Left */
367439
if (priv->addr.x > 0) {
@@ -441,9 +513,9 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
441513
shift ^= 4;
442514
if (*esc >= '0' && *esc <= '9') {
443515
value |= (*esc - '0') << shift;
444-
} else if (*esc >= 'A' && *esc <= 'Z') {
516+
} else if (*esc >= 'A' && *esc <= 'F') {
445517
value |= (*esc - 'A' + 10) << shift;
446-
} else if (*esc >= 'a' && *esc <= 'z') {
518+
} else if (*esc >= 'a' && *esc <= 'f') {
447519
value |= (*esc - 'a' + 10) << shift;
448520
} else {
449521
esc++;
@@ -469,24 +541,11 @@ static inline int handle_lcd_special_code(struct charlcd *lcd)
469541
}
470542
case 'x': /* gotoxy : LxXXX[yYYY]; */
471543
case 'y': /* gotoxy : LyYYY[xXXX]; */
472-
if (!strchr(esc, ';'))
473-
break;
474-
475-
while (*esc) {
476-
if (*esc == 'x') {
477-
esc++;
478-
if (kstrtoul(esc, 10, &priv->addr.x) < 0)
479-
break;
480-
} else if (*esc == 'y') {
481-
esc++;
482-
if (kstrtoul(esc, 10, &priv->addr.y) < 0)
483-
break;
484-
} else {
485-
break;
486-
}
487-
}
544+
/* If the command is valid, move to the new address */
545+
if (parse_xy(esc, &priv->addr.x, &priv->addr.y))
546+
charlcd_gotoxy(lcd);
488547

489-
charlcd_gotoxy(lcd);
548+
/* Regardless of its validity, mark as processed */
490549
processed = 1;
491550
break;
492551
}
@@ -527,7 +586,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
527586
if ((c != '\n') && priv->esc_seq.len >= 0) {
528587
/* yes, let's add this char to the buffer */
529588
priv->esc_seq.buf[priv->esc_seq.len++] = c;
530-
priv->esc_seq.buf[priv->esc_seq.len] = 0;
589+
priv->esc_seq.buf[priv->esc_seq.len] = '\0';
531590
} else {
532591
/* aborts any previous escape sequence */
533592
priv->esc_seq.len = -1;
@@ -536,7 +595,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
536595
case LCD_ESCAPE_CHAR:
537596
/* start of an escape sequence */
538597
priv->esc_seq.len = 0;
539-
priv->esc_seq.buf[priv->esc_seq.len] = 0;
598+
priv->esc_seq.buf[priv->esc_seq.len] = '\0';
540599
break;
541600
case '\b':
542601
/* go back one char and clear it */
@@ -555,7 +614,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
555614
/* back one char again */
556615
lcd->ops->write_cmd(lcd, LCD_CMD_SHIFT);
557616
break;
558-
case '\014':
617+
case '\f':
559618
/* quickly clear the display */
560619
charlcd_clear_fast(lcd);
561620
break;

drivers/auxdisplay/hd44780.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1+
// SPDX-License-Identifier: GPL-2.0+
12
/*
23
* HD44780 Character LCD driver for Linux
34
*
45
* Copyright (C) 2000-2008, Willy Tarreau <[email protected]>
56
* Copyright (C) 2016-2017 Glider bvba
6-
*
7-
* This program is free software; you can redistribute it and/or
8-
* modify it under the terms of the GNU General Public License
9-
* as published by the Free Software Foundation; either version
10-
* 2 of the License, or (at your option) any later version.
117
*/
128

139
#include <linux/delay.h>

0 commit comments

Comments
 (0)