panel.c (01be83eea08d6d9f9209843e2e084505fba4053f) | panel.c (32d917e754bdc322e22439f6ce400a1a74bbdc6e) |
---|---|
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. --- 42 unchanged lines hidden (view full) --- 51#include <linux/ctype.h> 52#include <linux/parport.h> 53#include <linux/list.h> 54 55#include <linux/io.h> 56#include <linux/uaccess.h> 57 58#include "charlcd.h" | 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. --- 42 unchanged lines hidden (view full) --- 51#include <linux/ctype.h> 52#include <linux/parport.h> 53#include <linux/list.h> 54 55#include <linux/io.h> 56#include <linux/uaccess.h> 57 58#include "charlcd.h" |
59#include "hd44780_common.h" |
|
59 60#define LCD_MAXBYTES 256 /* max burst write */ 61 62#define KEYPAD_BUFFER 64 63 64/* poll the keyboard this every second */ 65#define INPUT_POLL_TIME (HZ / 50) 66/* a key starts to repeat after this times INPUT_POLL_TIME */ --- 226 unchanged lines hidden (view full) --- 293 * Construct custom config from the kernel's configuration 294 */ 295#define DEFAULT_PARPORT 0 296#define DEFAULT_PROFILE PANEL_PROFILE_LARGE 297#define DEFAULT_KEYPAD_TYPE KEYPAD_TYPE_OLD 298#define DEFAULT_LCD_TYPE LCD_TYPE_OLD 299#define DEFAULT_LCD_HEIGHT 2 300#define DEFAULT_LCD_WIDTH 40 | 60 61#define LCD_MAXBYTES 256 /* max burst write */ 62 63#define KEYPAD_BUFFER 64 64 65/* poll the keyboard this every second */ 66#define INPUT_POLL_TIME (HZ / 50) 67/* a key starts to repeat after this times INPUT_POLL_TIME */ --- 226 unchanged lines hidden (view full) --- 294 * Construct custom config from the kernel's configuration 295 */ 296#define DEFAULT_PARPORT 0 297#define DEFAULT_PROFILE PANEL_PROFILE_LARGE 298#define DEFAULT_KEYPAD_TYPE KEYPAD_TYPE_OLD 299#define DEFAULT_LCD_TYPE LCD_TYPE_OLD 300#define DEFAULT_LCD_HEIGHT 2 301#define DEFAULT_LCD_WIDTH 40 |
301#define DEFAULT_LCD_BWIDTH 40 302#define DEFAULT_LCD_HWIDTH 64 | |
303#define DEFAULT_LCD_CHARSET LCD_CHARSET_NORMAL 304#define DEFAULT_LCD_PROTO LCD_PROTO_PARALLEL 305 306#define DEFAULT_LCD_PIN_E PIN_AUTOLF 307#define DEFAULT_LCD_PIN_RS PIN_SELECP 308#define DEFAULT_LCD_PIN_RW PIN_INITP 309#define DEFAULT_LCD_PIN_SCL PIN_STROBE 310#define DEFAULT_LCD_PIN_SDA PIN_D0 --- 392 unchanged lines hidden (view full) --- 703 set_bit(LCD_BIT_CL, bits); /* CLK high */ 704 panel_set_bits(); 705 udelay(1); /* maintain the strobe during 1 us */ 706 byte >>= 1; 707 } 708} 709 710/* turn the backlight on or off */ | 302#define DEFAULT_LCD_CHARSET LCD_CHARSET_NORMAL 303#define DEFAULT_LCD_PROTO LCD_PROTO_PARALLEL 304 305#define DEFAULT_LCD_PIN_E PIN_AUTOLF 306#define DEFAULT_LCD_PIN_RS PIN_SELECP 307#define DEFAULT_LCD_PIN_RW PIN_INITP 308#define DEFAULT_LCD_PIN_SCL PIN_STROBE 309#define DEFAULT_LCD_PIN_SDA PIN_D0 --- 392 unchanged lines hidden (view full) --- 702 set_bit(LCD_BIT_CL, bits); /* CLK high */ 703 panel_set_bits(); 704 udelay(1); /* maintain the strobe during 1 us */ 705 byte >>= 1; 706 } 707} 708 709/* turn the backlight on or off */ |
711static void lcd_backlight(struct charlcd *charlcd, int on) | 710static void lcd_backlight(struct charlcd *charlcd, enum charlcd_onoff on) |
712{ 713 if (lcd.pins.bl == PIN_NONE) 714 return; 715 716 /* The backlight is activated by setting the AUTOFEED line to +5V */ 717 spin_lock_irq(&pprt_lock); 718 if (on) 719 set_bit(LCD_BIT_BL, bits); 720 else 721 clear_bit(LCD_BIT_BL, bits); 722 panel_set_bits(); 723 spin_unlock_irq(&pprt_lock); 724} 725 726/* send a command to the LCD panel in serial mode */ | 711{ 712 if (lcd.pins.bl == PIN_NONE) 713 return; 714 715 /* The backlight is activated by setting the AUTOFEED line to +5V */ 716 spin_lock_irq(&pprt_lock); 717 if (on) 718 set_bit(LCD_BIT_BL, bits); 719 else 720 clear_bit(LCD_BIT_BL, bits); 721 panel_set_bits(); 722 spin_unlock_irq(&pprt_lock); 723} 724 725/* send a command to the LCD panel in serial mode */ |
727static void lcd_write_cmd_s(struct charlcd *charlcd, int cmd) | 726static void lcd_write_cmd_s(struct hd44780_common *hdc, int cmd) |
728{ 729 spin_lock_irq(&pprt_lock); 730 lcd_send_serial(0x1F); /* R/W=W, RS=0 */ 731 lcd_send_serial(cmd & 0x0F); 732 lcd_send_serial((cmd >> 4) & 0x0F); 733 udelay(40); /* the shortest command takes at least 40 us */ 734 spin_unlock_irq(&pprt_lock); 735} 736 737/* send data to the LCD panel in serial mode */ | 727{ 728 spin_lock_irq(&pprt_lock); 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 */ |
738static void lcd_write_data_s(struct charlcd *charlcd, int data) | 737static void lcd_write_data_s(struct hd44780_common *hdc, int data) |
739{ 740 spin_lock_irq(&pprt_lock); 741 lcd_send_serial(0x5F); /* R/W=W, RS=1 */ 742 lcd_send_serial(data & 0x0F); 743 lcd_send_serial((data >> 4) & 0x0F); 744 udelay(40); /* the shortest data takes at least 40 us */ 745 spin_unlock_irq(&pprt_lock); 746} 747 748/* send a command 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} 746 747/* send a command to the LCD panel in 8 bits parallel mode */ |
749static void lcd_write_cmd_p8(struct charlcd *charlcd, int cmd) | 748static void lcd_write_cmd_p8(struct hd44780_common *hdc, int cmd) |
750{ 751 spin_lock_irq(&pprt_lock); 752 /* present the data to the data port */ 753 w_dtr(pprt, cmd); 754 udelay(20); /* maintain the data during 20 us before the strobe */ 755 756 set_bit(LCD_BIT_E, bits); 757 clear_bit(LCD_BIT_RS, bits); --- 5 unchanged lines hidden (view full) --- 763 clear_bit(LCD_BIT_E, bits); 764 set_ctrl_bits(); 765 766 udelay(120); /* the shortest command takes at least 120 us */ 767 spin_unlock_irq(&pprt_lock); 768} 769 770/* send data to the LCD panel in 8 bits parallel mode */ | 749{ 750 spin_lock_irq(&pprt_lock); 751 /* present the data to the data port */ 752 w_dtr(pprt, cmd); 753 udelay(20); /* maintain the data during 20 us before the strobe */ 754 755 set_bit(LCD_BIT_E, bits); 756 clear_bit(LCD_BIT_RS, bits); --- 5 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 */ |
771static void lcd_write_data_p8(struct charlcd *charlcd, int data) | 770static void lcd_write_data_p8(struct hd44780_common *hdc, int data) |
772{ 773 spin_lock_irq(&pprt_lock); 774 /* present the data to the data port */ 775 w_dtr(pprt, data); 776 udelay(20); /* maintain the data during 20 us before the strobe */ 777 778 set_bit(LCD_BIT_E, bits); 779 set_bit(LCD_BIT_RS, bits); --- 5 unchanged lines hidden (view full) --- 785 clear_bit(LCD_BIT_E, bits); 786 set_ctrl_bits(); 787 788 udelay(45); /* the shortest data takes at least 45 us */ 789 spin_unlock_irq(&pprt_lock); 790} 791 792/* send a command 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); --- 5 unchanged lines hidden (view full) --- 784 clear_bit(LCD_BIT_E, bits); 785 set_ctrl_bits(); 786 787 udelay(45); /* the shortest data takes at least 45 us */ 788 spin_unlock_irq(&pprt_lock); 789} 790 791/* send a command to the TI LCD panel */ |
793static void lcd_write_cmd_tilcd(struct charlcd *charlcd, int cmd) | 792static void lcd_write_cmd_tilcd(struct hd44780_common *hdc, int cmd) |
794{ 795 spin_lock_irq(&pprt_lock); 796 /* present the data to the control port */ 797 w_ctr(pprt, cmd); 798 udelay(60); 799 spin_unlock_irq(&pprt_lock); 800} 801 802/* send data to the TI LCD panel */ | 793{ 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 */ |
803static void lcd_write_data_tilcd(struct charlcd *charlcd, int data) | 802static void lcd_write_data_tilcd(struct hd44780_common *hdc, int data) |
804{ 805 spin_lock_irq(&pprt_lock); 806 /* present the data to the data port */ 807 w_dtr(pprt, data); 808 udelay(60); 809 spin_unlock_irq(&pprt_lock); 810} 811 | 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 |
812/* fills the display with spaces and resets X/Y */ 813static void lcd_clear_fast_s(struct charlcd *charlcd) 814{ 815 int pos; 816 817 spin_lock_irq(&pprt_lock); 818 for (pos = 0; pos < charlcd->height * charlcd->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 */ 829static void lcd_clear_fast_p8(struct charlcd *charlcd) 830{ 831 int pos; 832 833 spin_lock_irq(&pprt_lock); 834 for (pos = 0; pos < charlcd->height * charlcd->hwidth; pos++) { 835 /* present the data to the data port */ 836 w_dtr(pprt, ' '); 837 838 /* maintain the data during 20 us before the strobe */ 839 udelay(20); 840 841 set_bit(LCD_BIT_E, bits); 842 set_bit(LCD_BIT_RS, bits); 843 clear_bit(LCD_BIT_RW, bits); 844 set_ctrl_bits(); 845 846 /* maintain the strobe during 40 us */ 847 udelay(40); 848 849 clear_bit(LCD_BIT_E, bits); 850 set_ctrl_bits(); 851 852 /* the shortest data takes at least 45 us */ 853 udelay(45); 854 } 855 spin_unlock_irq(&pprt_lock); 856} 857 858/* fills the display with spaces and resets X/Y */ 859static void lcd_clear_fast_tilcd(struct charlcd *charlcd) 860{ 861 int pos; 862 863 spin_lock_irq(&pprt_lock); 864 for (pos = 0; pos < charlcd->height * charlcd->hwidth; pos++) { 865 /* present the data to the data port */ 866 w_dtr(pprt, ' '); 867 udelay(60); 868 } 869 870 spin_unlock_irq(&pprt_lock); 871} 872 | |
873static const struct charlcd_ops charlcd_serial_ops = { | 811static const struct charlcd_ops charlcd_serial_ops = { |
874 .write_cmd = lcd_write_cmd_s, 875 .write_data = lcd_write_data_s, 876 .clear_fast = lcd_clear_fast_s, | |
877 .backlight = lcd_backlight, | 812 .backlight = lcd_backlight, |
813 .print = hd44780_common_print, 814 .gotoxy = hd44780_common_gotoxy, 815 .home = hd44780_common_home, 816 .clear_display = hd44780_common_clear_display, 817 .init_display = hd44780_common_init_display, 818 .shift_cursor = hd44780_common_shift_cursor, 819 .shift_display = hd44780_common_shift_display, 820 .display = hd44780_common_display, 821 .cursor = hd44780_common_cursor, 822 .blink = hd44780_common_blink, 823 .fontsize = hd44780_common_fontsize, 824 .lines = hd44780_common_lines, 825 .redefine_char = hd44780_common_redefine_char, |
|
878}; 879 880static const struct charlcd_ops charlcd_parallel_ops = { | 826}; 827 828static const struct charlcd_ops charlcd_parallel_ops = { |
881 .write_cmd = lcd_write_cmd_p8, 882 .write_data = lcd_write_data_p8, 883 .clear_fast = lcd_clear_fast_p8, | |
884 .backlight = lcd_backlight, | 829 .backlight = lcd_backlight, |
830 .print = hd44780_common_print, 831 .gotoxy = hd44780_common_gotoxy, 832 .home = hd44780_common_home, 833 .clear_display = hd44780_common_clear_display, 834 .init_display = hd44780_common_init_display, 835 .shift_cursor = hd44780_common_shift_cursor, 836 .shift_display = hd44780_common_shift_display, 837 .display = hd44780_common_display, 838 .cursor = hd44780_common_cursor, 839 .blink = hd44780_common_blink, 840 .fontsize = hd44780_common_fontsize, 841 .lines = hd44780_common_lines, 842 .redefine_char = hd44780_common_redefine_char, |
|
885}; 886 887static const struct charlcd_ops charlcd_tilcd_ops = { | 843}; 844 845static const struct charlcd_ops charlcd_tilcd_ops = { |
888 .write_cmd = lcd_write_cmd_tilcd, 889 .write_data = lcd_write_data_tilcd, 890 .clear_fast = lcd_clear_fast_tilcd, | |
891 .backlight = lcd_backlight, | 846 .backlight = lcd_backlight, |
847 .print = hd44780_common_print, 848 .gotoxy = hd44780_common_gotoxy, 849 .home = hd44780_common_home, 850 .clear_display = hd44780_common_clear_display, 851 .init_display = hd44780_common_init_display, 852 .shift_cursor = hd44780_common_shift_cursor, 853 .shift_display = hd44780_common_shift_display, 854 .display = hd44780_common_display, 855 .cursor = hd44780_common_cursor, 856 .blink = hd44780_common_blink, 857 .fontsize = hd44780_common_fontsize, 858 .lines = hd44780_common_lines, 859 .redefine_char = hd44780_common_redefine_char, |
|
892}; 893 894/* initialize the LCD driver */ 895static void lcd_init(void) 896{ 897 struct charlcd *charlcd; | 860}; 861 862/* initialize the LCD driver */ 863static void lcd_init(void) 864{ 865 struct charlcd *charlcd; |
866 struct hd44780_common *hdc; |
|
898 | 867 |
899 charlcd = charlcd_alloc(0); 900 if (!charlcd) | 868 hdc = hd44780_common_alloc(); 869 if (!hdc) |
901 return; 902 | 870 return; 871 |
872 charlcd = charlcd_alloc(); 873 if (!charlcd) { 874 kfree(hdc); 875 return; 876 } 877 878 hdc->hd44780 = &lcd; 879 charlcd->drvdata = hdc; 880 |
|
903 /* 904 * Init lcd struct with load-time values to preserve exact 905 * current functionality (at least for now). 906 */ 907 charlcd->height = lcd_height; 908 charlcd->width = lcd_width; | 881 /* 882 * Init lcd struct with load-time values to preserve exact 883 * current functionality (at least for now). 884 */ 885 charlcd->height = lcd_height; 886 charlcd->width = lcd_width; |
909 charlcd->bwidth = lcd_bwidth; 910 charlcd->hwidth = lcd_hwidth; | 887 hdc->bwidth = lcd_bwidth; 888 hdc->hwidth = lcd_hwidth; |
911 912 switch (selected_lcd_type) { 913 case LCD_TYPE_OLD: 914 /* parallel mode, 8 bits */ 915 lcd.proto = LCD_PROTO_PARALLEL; 916 lcd.charset = LCD_CHARSET_NORMAL; 917 lcd.pins.e = PIN_STROBE; 918 lcd.pins.rs = PIN_AUTOLF; 919 920 charlcd->width = 40; | 889 890 switch (selected_lcd_type) { 891 case LCD_TYPE_OLD: 892 /* parallel mode, 8 bits */ 893 lcd.proto = LCD_PROTO_PARALLEL; 894 lcd.charset = LCD_CHARSET_NORMAL; 895 lcd.pins.e = PIN_STROBE; 896 lcd.pins.rs = PIN_AUTOLF; 897 898 charlcd->width = 40; |
921 charlcd->bwidth = 40; 922 charlcd->hwidth = 64; | 899 hdc->bwidth = 40; 900 hdc->hwidth = 64; |
923 charlcd->height = 2; 924 break; 925 case LCD_TYPE_KS0074: 926 /* serial mode, ks0074 */ 927 lcd.proto = LCD_PROTO_SERIAL; 928 lcd.charset = LCD_CHARSET_KS0074; 929 lcd.pins.bl = PIN_AUTOLF; 930 lcd.pins.cl = PIN_STROBE; 931 lcd.pins.da = PIN_D0; 932 933 charlcd->width = 16; | 901 charlcd->height = 2; 902 break; 903 case LCD_TYPE_KS0074: 904 /* serial mode, ks0074 */ 905 lcd.proto = LCD_PROTO_SERIAL; 906 lcd.charset = LCD_CHARSET_KS0074; 907 lcd.pins.bl = PIN_AUTOLF; 908 lcd.pins.cl = PIN_STROBE; 909 lcd.pins.da = PIN_D0; 910 911 charlcd->width = 16; |
934 charlcd->bwidth = 40; 935 charlcd->hwidth = 16; | 912 hdc->bwidth = 40; 913 hdc->hwidth = 16; |
936 charlcd->height = 2; 937 break; 938 case LCD_TYPE_NEXCOM: 939 /* parallel mode, 8 bits, generic */ 940 lcd.proto = LCD_PROTO_PARALLEL; 941 lcd.charset = LCD_CHARSET_NORMAL; 942 lcd.pins.e = PIN_AUTOLF; 943 lcd.pins.rs = PIN_SELECP; 944 lcd.pins.rw = PIN_INITP; 945 946 charlcd->width = 16; | 914 charlcd->height = 2; 915 break; 916 case LCD_TYPE_NEXCOM: 917 /* parallel mode, 8 bits, generic */ 918 lcd.proto = LCD_PROTO_PARALLEL; 919 lcd.charset = LCD_CHARSET_NORMAL; 920 lcd.pins.e = PIN_AUTOLF; 921 lcd.pins.rs = PIN_SELECP; 922 lcd.pins.rw = PIN_INITP; 923 924 charlcd->width = 16; |
947 charlcd->bwidth = 40; 948 charlcd->hwidth = 64; | 925 hdc->bwidth = 40; 926 hdc->hwidth = 64; |
949 charlcd->height = 2; 950 break; 951 case LCD_TYPE_CUSTOM: 952 /* customer-defined */ 953 lcd.proto = DEFAULT_LCD_PROTO; 954 lcd.charset = DEFAULT_LCD_CHARSET; 955 /* default geometry will be set later */ 956 break; 957 case LCD_TYPE_HANTRONIX: 958 /* parallel mode, 8 bits, hantronix-like */ 959 default: 960 lcd.proto = LCD_PROTO_PARALLEL; 961 lcd.charset = LCD_CHARSET_NORMAL; 962 lcd.pins.e = PIN_STROBE; 963 lcd.pins.rs = PIN_SELECP; 964 965 charlcd->width = 16; | 927 charlcd->height = 2; 928 break; 929 case LCD_TYPE_CUSTOM: 930 /* customer-defined */ 931 lcd.proto = DEFAULT_LCD_PROTO; 932 lcd.charset = DEFAULT_LCD_CHARSET; 933 /* default geometry will be set later */ 934 break; 935 case LCD_TYPE_HANTRONIX: 936 /* parallel mode, 8 bits, hantronix-like */ 937 default: 938 lcd.proto = LCD_PROTO_PARALLEL; 939 lcd.charset = LCD_CHARSET_NORMAL; 940 lcd.pins.e = PIN_STROBE; 941 lcd.pins.rs = PIN_SELECP; 942 943 charlcd->width = 16; |
966 charlcd->bwidth = 40; 967 charlcd->hwidth = 64; | 944 hdc->bwidth = 40; 945 hdc->hwidth = 64; |
968 charlcd->height = 2; 969 break; 970 } 971 972 /* Overwrite with module params set on loading */ 973 if (lcd_height != NOT_SET) 974 charlcd->height = lcd_height; 975 if (lcd_width != NOT_SET) 976 charlcd->width = lcd_width; 977 if (lcd_bwidth != NOT_SET) | 946 charlcd->height = 2; 947 break; 948 } 949 950 /* Overwrite with module params set on loading */ 951 if (lcd_height != NOT_SET) 952 charlcd->height = lcd_height; 953 if (lcd_width != NOT_SET) 954 charlcd->width = lcd_width; 955 if (lcd_bwidth != NOT_SET) |
978 charlcd->bwidth = lcd_bwidth; | 956 hdc->bwidth = lcd_bwidth; |
979 if (lcd_hwidth != NOT_SET) | 957 if (lcd_hwidth != NOT_SET) |
980 charlcd->hwidth = lcd_hwidth; | 958 hdc->hwidth = lcd_hwidth; |
981 if (lcd_charset != NOT_SET) 982 lcd.charset = lcd_charset; 983 if (lcd_proto != NOT_SET) 984 lcd.proto = lcd_proto; 985 if (lcd_e_pin != PIN_NOT_SET) 986 lcd.pins.e = lcd_e_pin; 987 if (lcd_rs_pin != PIN_NOT_SET) 988 lcd.pins.rs = lcd_rs_pin; --- 4 unchanged lines hidden (view full) --- 993 if (lcd_da_pin != PIN_NOT_SET) 994 lcd.pins.da = lcd_da_pin; 995 if (lcd_bl_pin != PIN_NOT_SET) 996 lcd.pins.bl = lcd_bl_pin; 997 998 /* this is used to catch wrong and default values */ 999 if (charlcd->width <= 0) 1000 charlcd->width = DEFAULT_LCD_WIDTH; | 959 if (lcd_charset != NOT_SET) 960 lcd.charset = lcd_charset; 961 if (lcd_proto != NOT_SET) 962 lcd.proto = lcd_proto; 963 if (lcd_e_pin != PIN_NOT_SET) 964 lcd.pins.e = lcd_e_pin; 965 if (lcd_rs_pin != PIN_NOT_SET) 966 lcd.pins.rs = lcd_rs_pin; --- 4 unchanged lines hidden (view full) --- 971 if (lcd_da_pin != PIN_NOT_SET) 972 lcd.pins.da = lcd_da_pin; 973 if (lcd_bl_pin != PIN_NOT_SET) 974 lcd.pins.bl = lcd_bl_pin; 975 976 /* this is used to catch wrong and default values */ 977 if (charlcd->width <= 0) 978 charlcd->width = DEFAULT_LCD_WIDTH; |
1001 if (charlcd->bwidth <= 0) 1002 charlcd->bwidth = DEFAULT_LCD_BWIDTH; 1003 if (charlcd->hwidth <= 0) 1004 charlcd->hwidth = DEFAULT_LCD_HWIDTH; | 979 if (hdc->bwidth <= 0) 980 hdc->bwidth = DEFAULT_LCD_BWIDTH; 981 if (hdc->hwidth <= 0) 982 hdc->hwidth = DEFAULT_LCD_HWIDTH; |
1005 if (charlcd->height <= 0) 1006 charlcd->height = DEFAULT_LCD_HEIGHT; 1007 1008 if (lcd.proto == LCD_PROTO_SERIAL) { /* SERIAL */ 1009 charlcd->ops = &charlcd_serial_ops; | 983 if (charlcd->height <= 0) 984 charlcd->height = DEFAULT_LCD_HEIGHT; 985 986 if (lcd.proto == LCD_PROTO_SERIAL) { /* SERIAL */ 987 charlcd->ops = &charlcd_serial_ops; |
988 hdc->write_data = lcd_write_data_s; 989 hdc->write_cmd = lcd_write_cmd_s; |
|
1010 1011 if (lcd.pins.cl == PIN_NOT_SET) 1012 lcd.pins.cl = DEFAULT_LCD_PIN_SCL; 1013 if (lcd.pins.da == PIN_NOT_SET) 1014 lcd.pins.da = DEFAULT_LCD_PIN_SDA; 1015 1016 } else if (lcd.proto == LCD_PROTO_PARALLEL) { /* PARALLEL */ 1017 charlcd->ops = &charlcd_parallel_ops; | 990 991 if (lcd.pins.cl == PIN_NOT_SET) 992 lcd.pins.cl = DEFAULT_LCD_PIN_SCL; 993 if (lcd.pins.da == PIN_NOT_SET) 994 lcd.pins.da = DEFAULT_LCD_PIN_SDA; 995 996 } else if (lcd.proto == LCD_PROTO_PARALLEL) { /* PARALLEL */ 997 charlcd->ops = &charlcd_parallel_ops; |
998 hdc->write_data = lcd_write_data_p8; 999 hdc->write_cmd = lcd_write_cmd_p8; |
|
1018 1019 if (lcd.pins.e == PIN_NOT_SET) 1020 lcd.pins.e = DEFAULT_LCD_PIN_E; 1021 if (lcd.pins.rs == PIN_NOT_SET) 1022 lcd.pins.rs = DEFAULT_LCD_PIN_RS; 1023 if (lcd.pins.rw == PIN_NOT_SET) 1024 lcd.pins.rw = DEFAULT_LCD_PIN_RW; 1025 } else { 1026 charlcd->ops = &charlcd_tilcd_ops; | 1000 1001 if (lcd.pins.e == PIN_NOT_SET) 1002 lcd.pins.e = DEFAULT_LCD_PIN_E; 1003 if (lcd.pins.rs == PIN_NOT_SET) 1004 lcd.pins.rs = DEFAULT_LCD_PIN_RS; 1005 if (lcd.pins.rw == PIN_NOT_SET) 1006 lcd.pins.rw = DEFAULT_LCD_PIN_RW; 1007 } else { 1008 charlcd->ops = &charlcd_tilcd_ops; |
1009 hdc->write_data = lcd_write_data_tilcd; 1010 hdc->write_cmd = lcd_write_cmd_tilcd; |
|
1027 } 1028 1029 if (lcd.pins.bl == PIN_NOT_SET) 1030 lcd.pins.bl = DEFAULT_LCD_PIN_BL; 1031 1032 if (lcd.pins.e == PIN_NOT_SET) 1033 lcd.pins.e = PIN_NONE; 1034 if (lcd.pins.rs == PIN_NOT_SET) --- 580 unchanged lines hidden (view full) --- 1615 return; 1616 1617err_lcd_unreg: 1618 if (scan_timer.function) 1619 del_timer_sync(&scan_timer); 1620 if (lcd.enabled) 1621 charlcd_unregister(lcd.charlcd); 1622err_unreg_device: | 1011 } 1012 1013 if (lcd.pins.bl == PIN_NOT_SET) 1014 lcd.pins.bl = DEFAULT_LCD_PIN_BL; 1015 1016 if (lcd.pins.e == PIN_NOT_SET) 1017 lcd.pins.e = PIN_NONE; 1018 if (lcd.pins.rs == PIN_NOT_SET) --- 580 unchanged lines hidden (view full) --- 1599 return; 1600 1601err_lcd_unreg: 1602 if (scan_timer.function) 1603 del_timer_sync(&scan_timer); 1604 if (lcd.enabled) 1605 charlcd_unregister(lcd.charlcd); 1606err_unreg_device: |
1623 charlcd_free(lcd.charlcd); | 1607 kfree(lcd.charlcd); |
1624 lcd.charlcd = NULL; 1625 parport_unregister_device(pprt); 1626 pprt = NULL; 1627} 1628 1629static void panel_detach(struct parport *port) 1630{ 1631 if (port->number != parport) --- 10 unchanged lines hidden (view full) --- 1642 if (keypad.enabled) { 1643 misc_deregister(&keypad_dev); 1644 keypad_initialized = 0; 1645 } 1646 1647 if (lcd.enabled) { 1648 charlcd_unregister(lcd.charlcd); 1649 lcd.initialized = false; | 1608 lcd.charlcd = NULL; 1609 parport_unregister_device(pprt); 1610 pprt = NULL; 1611} 1612 1613static void panel_detach(struct parport *port) 1614{ 1615 if (port->number != parport) --- 10 unchanged lines hidden (view full) --- 1626 if (keypad.enabled) { 1627 misc_deregister(&keypad_dev); 1628 keypad_initialized = 0; 1629 } 1630 1631 if (lcd.enabled) { 1632 charlcd_unregister(lcd.charlcd); 1633 lcd.initialized = false; |
1650 charlcd_free(lcd.charlcd); | 1634 kfree(lcd.charlcd->drvdata); 1635 kfree(lcd.charlcd); |
1651 lcd.charlcd = NULL; 1652 } 1653 1654 /* TODO: free all input signals */ 1655 parport_release(pprt); 1656 parport_unregister_device(pprt); 1657 pprt = NULL; 1658} --- 137 unchanged lines hidden --- | 1636 lcd.charlcd = NULL; 1637 } 1638 1639 /* TODO: free all input signals */ 1640 parport_release(pprt); 1641 parport_unregister_device(pprt); 1642 pprt = NULL; 1643} --- 137 unchanged lines hidden --- |