panel.c (2545c1c948a6a765f1a0e820c7598138b36f67ef) panel.c (71ff701bbefec9e3c342f3a01d2d89b7ae026c71)
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Front panel driver for Linux
4 * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
5 * Copyright (C) 2016-2017 Glider bvba
6 *
7 * This code drives an LCD module (/dev/lcd), and a keypad (/dev/keypad)
8 * connected to a parallel printer port.

--- 720 unchanged lines hidden (view full) ---

729 lcd_send_serial(0x1F); /* R/W=W, RS=0 */
730 lcd_send_serial(cmd & 0x0F);
731 lcd_send_serial((cmd >> 4) & 0x0F);
732 udelay(40); /* the shortest command takes at least 40 us */
733 spin_unlock_irq(&pprt_lock);
734}
735
736/* send data to the LCD panel in serial mode */
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Front panel driver for Linux
4 * Copyright (C) 2000-2008, Willy Tarreau <w@1wt.eu>
5 * Copyright (C) 2016-2017 Glider bvba
6 *
7 * This code drives an LCD module (/dev/lcd), and a keypad (/dev/keypad)
8 * connected to a parallel printer port.

--- 720 unchanged lines hidden (view full) ---

729 lcd_send_serial(0x1F); /* R/W=W, RS=0 */
730 lcd_send_serial(cmd & 0x0F);
731 lcd_send_serial((cmd >> 4) & 0x0F);
732 udelay(40); /* the shortest command takes at least 40 us */
733 spin_unlock_irq(&pprt_lock);
734}
735
736/* send data to the LCD panel in serial mode */
737static void lcd_write_data_s(struct charlcd *charlcd, int data)
737static void lcd_write_data_s(struct hd44780_common *hdc, int data)
738{
739 spin_lock_irq(&pprt_lock);
740 lcd_send_serial(0x5F); /* R/W=W, RS=1 */
741 lcd_send_serial(data & 0x0F);
742 lcd_send_serial((data >> 4) & 0x0F);
743 udelay(40); /* the shortest data takes at least 40 us */
744 spin_unlock_irq(&pprt_lock);
745}

--- 16 unchanged lines hidden (view full) ---

762 clear_bit(LCD_BIT_E, bits);
763 set_ctrl_bits();
764
765 udelay(120); /* the shortest command takes at least 120 us */
766 spin_unlock_irq(&pprt_lock);
767}
768
769/* send data to the LCD panel in 8 bits parallel mode */
738{
739 spin_lock_irq(&pprt_lock);
740 lcd_send_serial(0x5F); /* R/W=W, RS=1 */
741 lcd_send_serial(data & 0x0F);
742 lcd_send_serial((data >> 4) & 0x0F);
743 udelay(40); /* the shortest data takes at least 40 us */
744 spin_unlock_irq(&pprt_lock);
745}

--- 16 unchanged lines hidden (view full) ---

762 clear_bit(LCD_BIT_E, bits);
763 set_ctrl_bits();
764
765 udelay(120); /* the shortest command takes at least 120 us */
766 spin_unlock_irq(&pprt_lock);
767}
768
769/* send data to the LCD panel in 8 bits parallel mode */
770static void lcd_write_data_p8(struct charlcd *charlcd, int data)
770static void lcd_write_data_p8(struct hd44780_common *hdc, int data)
771{
772 spin_lock_irq(&pprt_lock);
773 /* present the data to the data port */
774 w_dtr(pprt, data);
775 udelay(20); /* maintain the data during 20 us before the strobe */
776
777 set_bit(LCD_BIT_E, bits);
778 set_bit(LCD_BIT_RS, bits);

--- 15 unchanged lines hidden (view full) ---

794 spin_lock_irq(&pprt_lock);
795 /* present the data to the control port */
796 w_ctr(pprt, cmd);
797 udelay(60);
798 spin_unlock_irq(&pprt_lock);
799}
800
801/* send data to the TI LCD panel */
771{
772 spin_lock_irq(&pprt_lock);
773 /* present the data to the data port */
774 w_dtr(pprt, data);
775 udelay(20); /* maintain the data during 20 us before the strobe */
776
777 set_bit(LCD_BIT_E, bits);
778 set_bit(LCD_BIT_RS, bits);

--- 15 unchanged lines hidden (view full) ---

794 spin_lock_irq(&pprt_lock);
795 /* present the data to the control port */
796 w_ctr(pprt, cmd);
797 udelay(60);
798 spin_unlock_irq(&pprt_lock);
799}
800
801/* send data to the TI LCD panel */
802static void lcd_write_data_tilcd(struct charlcd *charlcd, int data)
802static void lcd_write_data_tilcd(struct hd44780_common *hdc, int data)
803{
804 spin_lock_irq(&pprt_lock);
805 /* present the data to the data port */
806 w_dtr(pprt, data);
807 udelay(60);
808 spin_unlock_irq(&pprt_lock);
809}
810

--- 58 unchanged lines hidden (view full) ---

869 udelay(60);
870 }
871
872 spin_unlock_irq(&pprt_lock);
873}
874
875static const struct charlcd_ops charlcd_serial_ops = {
876 .write_cmd = lcd_write_cmd_s,
803{
804 spin_lock_irq(&pprt_lock);
805 /* present the data to the data port */
806 w_dtr(pprt, data);
807 udelay(60);
808 spin_unlock_irq(&pprt_lock);
809}
810

--- 58 unchanged lines hidden (view full) ---

869 udelay(60);
870 }
871
872 spin_unlock_irq(&pprt_lock);
873}
874
875static const struct charlcd_ops charlcd_serial_ops = {
876 .write_cmd = lcd_write_cmd_s,
877 .write_data = lcd_write_data_s,
878 .clear_fast = lcd_clear_fast_s,
879 .backlight = lcd_backlight,
880};
881
882static const struct charlcd_ops charlcd_parallel_ops = {
883 .write_cmd = lcd_write_cmd_p8,
877 .clear_fast = lcd_clear_fast_s,
878 .backlight = lcd_backlight,
879};
880
881static const struct charlcd_ops charlcd_parallel_ops = {
882 .write_cmd = lcd_write_cmd_p8,
884 .write_data = lcd_write_data_p8,
885 .clear_fast = lcd_clear_fast_p8,
886 .backlight = lcd_backlight,
887};
888
889static const struct charlcd_ops charlcd_tilcd_ops = {
890 .write_cmd = lcd_write_cmd_tilcd,
883 .clear_fast = lcd_clear_fast_p8,
884 .backlight = lcd_backlight,
885};
886
887static const struct charlcd_ops charlcd_tilcd_ops = {
888 .write_cmd = lcd_write_cmd_tilcd,
891 .write_data = lcd_write_data_tilcd,
892 .clear_fast = lcd_clear_fast_tilcd,
893 .backlight = lcd_backlight,
894};
895
896/* initialize the LCD driver */
897static void lcd_init(void)
898{
899 struct charlcd *charlcd;

--- 114 unchanged lines hidden (view full) ---

1014 hdc->bwidth = DEFAULT_LCD_BWIDTH;
1015 if (hdc->hwidth <= 0)
1016 hdc->hwidth = DEFAULT_LCD_HWIDTH;
1017 if (charlcd->height <= 0)
1018 charlcd->height = DEFAULT_LCD_HEIGHT;
1019
1020 if (lcd.proto == LCD_PROTO_SERIAL) { /* SERIAL */
1021 charlcd->ops = &charlcd_serial_ops;
889 .clear_fast = lcd_clear_fast_tilcd,
890 .backlight = lcd_backlight,
891};
892
893/* initialize the LCD driver */
894static void lcd_init(void)
895{
896 struct charlcd *charlcd;

--- 114 unchanged lines hidden (view full) ---

1011 hdc->bwidth = DEFAULT_LCD_BWIDTH;
1012 if (hdc->hwidth <= 0)
1013 hdc->hwidth = DEFAULT_LCD_HWIDTH;
1014 if (charlcd->height <= 0)
1015 charlcd->height = DEFAULT_LCD_HEIGHT;
1016
1017 if (lcd.proto == LCD_PROTO_SERIAL) { /* SERIAL */
1018 charlcd->ops = &charlcd_serial_ops;
1019 hdc->write_data = lcd_write_data_s;
1022
1023 if (lcd.pins.cl == PIN_NOT_SET)
1024 lcd.pins.cl = DEFAULT_LCD_PIN_SCL;
1025 if (lcd.pins.da == PIN_NOT_SET)
1026 lcd.pins.da = DEFAULT_LCD_PIN_SDA;
1027
1028 } else if (lcd.proto == LCD_PROTO_PARALLEL) { /* PARALLEL */
1029 charlcd->ops = &charlcd_parallel_ops;
1020
1021 if (lcd.pins.cl == PIN_NOT_SET)
1022 lcd.pins.cl = DEFAULT_LCD_PIN_SCL;
1023 if (lcd.pins.da == PIN_NOT_SET)
1024 lcd.pins.da = DEFAULT_LCD_PIN_SDA;
1025
1026 } else if (lcd.proto == LCD_PROTO_PARALLEL) { /* PARALLEL */
1027 charlcd->ops = &charlcd_parallel_ops;
1028 hdc->write_data = lcd_write_data_p8;
1030
1031 if (lcd.pins.e == PIN_NOT_SET)
1032 lcd.pins.e = DEFAULT_LCD_PIN_E;
1033 if (lcd.pins.rs == PIN_NOT_SET)
1034 lcd.pins.rs = DEFAULT_LCD_PIN_RS;
1035 if (lcd.pins.rw == PIN_NOT_SET)
1036 lcd.pins.rw = DEFAULT_LCD_PIN_RW;
1037 } else {
1038 charlcd->ops = &charlcd_tilcd_ops;
1029
1030 if (lcd.pins.e == PIN_NOT_SET)
1031 lcd.pins.e = DEFAULT_LCD_PIN_E;
1032 if (lcd.pins.rs == PIN_NOT_SET)
1033 lcd.pins.rs = DEFAULT_LCD_PIN_RS;
1034 if (lcd.pins.rw == PIN_NOT_SET)
1035 lcd.pins.rw = DEFAULT_LCD_PIN_RW;
1036 } else {
1037 charlcd->ops = &charlcd_tilcd_ops;
1038 hdc->write_data = lcd_write_data_tilcd;
1039 }
1040
1041 if (lcd.pins.bl == PIN_NOT_SET)
1042 lcd.pins.bl = DEFAULT_LCD_PIN_BL;
1043
1044 if (lcd.pins.e == PIN_NOT_SET)
1045 lcd.pins.e = PIN_NONE;
1046 if (lcd.pins.rs == PIN_NOT_SET)

--- 762 unchanged lines hidden ---
1039 }
1040
1041 if (lcd.pins.bl == PIN_NOT_SET)
1042 lcd.pins.bl = DEFAULT_LCD_PIN_BL;
1043
1044 if (lcd.pins.e == PIN_NOT_SET)
1045 lcd.pins.e = PIN_NONE;
1046 if (lcd.pins.rs == PIN_NOT_SET)

--- 762 unchanged lines hidden ---