Skip to content

Commit 377cf2c

Browse files
poeschelojeda
authored andcommitted
auxdisplay: hd44780: Remove clear_fast
We remove the hd44780_clear_fast (display) clear implementation. With the new timeout the normal clear_display is reasonably fast. So there is no need for a clear_fast anymore. Link: https://lore.kernel.org/lkml/[email protected]/ Signed-off-by: Lars Poeschel <[email protected]> Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 7b231bb commit 377cf2c

File tree

3 files changed

+8
-87
lines changed

3 files changed

+8
-87
lines changed

drivers/auxdisplay/charlcd.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,11 @@ static void charlcd_print(struct charlcd *lcd, char c)
125125
lcd->ops->gotoxy(lcd);
126126
}
127127

128-
static void charlcd_clear_fast(struct charlcd *lcd)
128+
static void charlcd_clear_display(struct charlcd *lcd)
129129
{
130-
struct hd44780_common *hdc = lcd->drvdata;
131-
int pos;
132-
133-
charlcd_home(lcd);
134-
135-
if (lcd->ops->clear_fast)
136-
lcd->ops->clear_fast(lcd);
137-
else
138-
for (pos = 0; pos < min(2, lcd->height) * hdc->hwidth; pos++)
139-
lcd->ops->print(lcd, ' ');
140-
141-
charlcd_home(lcd);
130+
lcd->ops->clear_display(lcd);
131+
lcd->addr.x = 0;
132+
lcd->addr.y = 0;
142133
}
143134

144135
/*
@@ -409,7 +400,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
409400
break;
410401
case '\f':
411402
/* quickly clear the display */
412-
charlcd_clear_fast(lcd);
403+
charlcd_clear_display(lcd);
413404
break;
414405
case '\n':
415406
/*
@@ -448,7 +439,7 @@ static void charlcd_write_char(struct charlcd *lcd, char c)
448439

449440
if (!strcmp(priv->esc_seq.buf, "[2J")) {
450441
/* clear the display */
451-
charlcd_clear_fast(lcd);
442+
charlcd_clear_display(lcd);
452443
processed = 1;
453444
} else if (!strcmp(priv->esc_seq.buf, "[H")) {
454445
/* cursor to home */

drivers/auxdisplay/charlcd.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ struct charlcd {
5555
/**
5656
* struct charlcd_ops - Functions used by charlcd. Drivers have to implement
5757
* these.
58-
* @clear_fast: Clear the whole display and set cursor to position 0, 0.
59-
* Optional.
6058
* @backlight: Turn backlight on or off. Optional.
6159
* @print: Print one character to the display at current cursor position.
6260
* The buffered cursor position is advanced by charlcd. The cursor should not
@@ -65,8 +63,8 @@ struct charlcd {
6563
* previously set in addr.x and addr.y by charlcd.
6664
* @home: Set cursor to 0, 0. The values in addr.x and addr.y are set to 0, 0 by
6765
* charlcd prior to calling this function.
68-
* @clear_display: Again clear the whole display, set the cursor to 0, 0. The
69-
* values in addr.x and addr.y are set to 0, 0 by charlcd prior to calling this
66+
* @clear_display: Clear the whole display and set the cursor to 0, 0. The
67+
* values in addr.x and addr.y are set to 0, 0 by charlcd after to calling this
7068
* function.
7169
* @init_display: Initialize the display.
7270
* @shift_cursor: Shift cursor left or right one position.
@@ -78,7 +76,6 @@ struct charlcd {
7876
* @redefine_char: Redefine the actual pixel matrix of character.
7977
*/
8078
struct charlcd_ops {
81-
void (*clear_fast)(struct charlcd *lcd);
8279
void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);
8380
int (*print)(struct charlcd *lcd, int c);
8481
int (*gotoxy)(struct charlcd *lcd);

drivers/auxdisplay/panel.c

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -808,72 +808,7 @@ static void lcd_write_data_tilcd(struct hd44780_common *hdc, int data)
808808
spin_unlock_irq(&pprt_lock);
809809
}
810810

811-
/* fills the display with spaces and resets X/Y */
812-
static void lcd_clear_fast_s(struct charlcd *charlcd)
813-
{
814-
struct hd44780_common *hdc = charlcd->drvdata;
815-
int pos;
816-
817-
spin_lock_irq(&pprt_lock);
818-
for (pos = 0; pos < charlcd->height * hdc->hwidth; pos++) {
819-
lcd_send_serial(0x5F); /* R/W=W, RS=1 */
820-
lcd_send_serial(' ' & 0x0F);
821-
lcd_send_serial((' ' >> 4) & 0x0F);
822-
/* the shortest data takes at least 40 us */
823-
udelay(40);
824-
}
825-
spin_unlock_irq(&pprt_lock);
826-
}
827-
828-
/* fills the display with spaces and resets X/Y */
829-
static void lcd_clear_fast_p8(struct charlcd *charlcd)
830-
{
831-
struct hd44780_common *hdc = charlcd->drvdata;
832-
int pos;
833-
834-
spin_lock_irq(&pprt_lock);
835-
for (pos = 0; pos < charlcd->height * hdc->hwidth; pos++) {
836-
/* present the data to the data port */
837-
w_dtr(pprt, ' ');
838-
839-
/* maintain the data during 20 us before the strobe */
840-
udelay(20);
841-
842-
set_bit(LCD_BIT_E, bits);
843-
set_bit(LCD_BIT_RS, bits);
844-
clear_bit(LCD_BIT_RW, bits);
845-
set_ctrl_bits();
846-
847-
/* maintain the strobe during 40 us */
848-
udelay(40);
849-
850-
clear_bit(LCD_BIT_E, bits);
851-
set_ctrl_bits();
852-
853-
/* the shortest data takes at least 45 us */
854-
udelay(45);
855-
}
856-
spin_unlock_irq(&pprt_lock);
857-
}
858-
859-
/* fills the display with spaces and resets X/Y */
860-
static void lcd_clear_fast_tilcd(struct charlcd *charlcd)
861-
{
862-
struct hd44780_common *hdc = charlcd->drvdata;
863-
int pos;
864-
865-
spin_lock_irq(&pprt_lock);
866-
for (pos = 0; pos < charlcd->height * hdc->hwidth; pos++) {
867-
/* present the data to the data port */
868-
w_dtr(pprt, ' ');
869-
udelay(60);
870-
}
871-
872-
spin_unlock_irq(&pprt_lock);
873-
}
874-
875811
static const struct charlcd_ops charlcd_serial_ops = {
876-
.clear_fast = lcd_clear_fast_s,
877812
.backlight = lcd_backlight,
878813
.gotoxy = hd44780_common_gotoxy,
879814
.home = hd44780_common_home,
@@ -890,7 +825,6 @@ static const struct charlcd_ops charlcd_serial_ops = {
890825
};
891826

892827
static const struct charlcd_ops charlcd_parallel_ops = {
893-
.clear_fast = lcd_clear_fast_p8,
894828
.backlight = lcd_backlight,
895829
.gotoxy = hd44780_common_gotoxy,
896830
.home = hd44780_common_home,
@@ -907,7 +841,6 @@ static const struct charlcd_ops charlcd_parallel_ops = {
907841
};
908842

909843
static const struct charlcd_ops charlcd_tilcd_ops = {
910-
.clear_fast = lcd_clear_fast_tilcd,
911844
.backlight = lcd_backlight,
912845
.gotoxy = hd44780_common_gotoxy,
913846
.home = hd44780_common_home,

0 commit comments

Comments
 (0)