@@ -228,26 +228,6 @@ static unsigned long int lcd_addr_y; /* contains the LCD Y offset */
228228static char lcd_escape [LCD_ESCAPE_LEN + 1 ]; /* current escape sequence, 0 terminated */
229229static int lcd_escape_len = -1 ; /* not in escape state. >=0 = escape cmd len */
230230
231- static int lcd_height = -1 ;
232- static int lcd_width = -1 ;
233- static int lcd_hwidth = -1 ; /* hardware buffer width (usually 64) */
234- static int lcd_bwidth = -1 ; /* internal buffer width (usually 40) */
235-
236- /*
237- * These are the parallel port pins the LCD control signals are connected to.
238- * Set this to 0 if the signal is not used. Set it to its opposite value
239- * (negative) if the signal is negated. -MAXINT is used to indicate that the
240- * pin has not been explicitly specified.
241- *
242- * WARNING! no check will be performed about collisions with keypad/smartcard !
243- */
244- static int lcd_e_pin = PIN_NOT_SET ;
245- static int lcd_rs_pin = PIN_NOT_SET ;
246- static int lcd_rw_pin = PIN_NOT_SET ;
247- static int lcd_bl_pin = PIN_NOT_SET ;
248- static int lcd_cl_pin = PIN_NOT_SET ;
249- static int lcd_da_pin = PIN_NOT_SET ;
250-
251231/*
252232 * Bit masks to convert LCD signals to parallel port outputs.
253233 * _d_ are values for data port, _c_ are for control port.
@@ -431,19 +411,11 @@ static unsigned char lcd_bits[LCD_PORTS][LCD_BITS][BIT_STATES];
431411static int smartcard_open_cnt ; /* #times opened */
432412static int keypad_open_cnt ; /* #times opened */
433413static int lcd_open_cnt ; /* #times opened */
434-
435- static int profile = DEFAULT_PROFILE ;
436414static struct pardevice * pprt ;
437- static int parport = -1 ;
438- static int lcd_enabled = -1 ;
439- static int lcd_type = -1 ;
440- static int lcd_proto = -1 ;
441- static int lcd_charset = -1 ;
442- static int keypad_enabled = -1 ;
443- static int keypad_type = -1 ;
444- static int smartcard_enabled = -1 ;
445415
446- static int lcd_initialized , keypad_initialized , smartcard_initialized ;
416+ static int lcd_initialized ;
417+ static int keypad_initialized ;
418+ static int smartcard_initialized ;
447419
448420static int light_tempo ;
449421
@@ -458,61 +430,103 @@ static void (*lcd_clear_fast) (void);
458430static DEFINE_SPINLOCK (pprt_lock );
459431static struct timer_list scan_timer ;
460432
461- #ifdef MODULE
462-
463433MODULE_DESCRIPTION ("Generic parallel port LCD/Keypad/Smartcard driver" );
434+
435+ static int parport = -1 ;
464436module_param (parport , int , 0000 );
465437MODULE_PARM_DESC (parport , "Parallel port index (0=lpt1, 1=lpt2, ...)" );
438+
439+ static int lcd_height = -1 ;
466440module_param (lcd_height , int , 0000 );
467441MODULE_PARM_DESC (lcd_height , "Number of lines on the LCD" );
442+
443+ static int lcd_width = -1 ;
468444module_param (lcd_width , int , 0000 );
469445MODULE_PARM_DESC (lcd_width , "Number of columns on the LCD" );
446+
447+ static int lcd_bwidth = -1 ; /* internal buffer width (usually 40) */
470448module_param (lcd_bwidth , int , 0000 );
471449MODULE_PARM_DESC (lcd_bwidth , "Internal LCD line width (40)" );
450+
451+ static int lcd_hwidth = -1 ; /* hardware buffer width (usually 64) */
472452module_param (lcd_hwidth , int , 0000 );
473453MODULE_PARM_DESC (lcd_hwidth , "LCD line hardware address (64)" );
454+
455+ static int lcd_enabled = -1 ;
474456module_param (lcd_enabled , int , 0000 );
475457MODULE_PARM_DESC (lcd_enabled , "Deprecated option, use lcd_type instead" );
458+
459+ static int keypad_enabled = -1 ;
476460module_param (keypad_enabled , int , 0000 );
477461MODULE_PARM_DESC (keypad_enabled , "Deprecated option, use keypad_type instead" );
462+
463+ static int lcd_type = -1 ;
478464module_param (lcd_type , int , 0000 );
479465MODULE_PARM_DESC (lcd_type ,
480466 "LCD type: 0=none, 1=old //, 2=serial ks0074, 3=hantronix //, 4=nexcom //, 5=compiled-in" );
467+
468+ static int lcd_proto = -1 ;
481469module_param (lcd_proto , int , 0000 );
482470MODULE_PARM_DESC (lcd_proto , "LCD communication: 0=parallel (//), 1=serial" );
471+
472+ static int lcd_charset = -1 ;
483473module_param (lcd_charset , int , 0000 );
484474MODULE_PARM_DESC (lcd_charset , "LCD character set: 0=standard, 1=KS0074" );
475+
476+ static int keypad_type = -1 ;
485477module_param (keypad_type , int , 0000 );
486478MODULE_PARM_DESC (keypad_type ,
487479 "Keypad type: 0=none, 1=old 6 keys, 2=new 6+1 keys, 3=nexcom 4 keys" );
480+
481+ static int smartcard_enabled = -1 ;
488482module_param (smartcard_enabled , int , 0000 );
489483MODULE_PARM_DESC (smartcard_enabled ,
490484 "Smartcard reader: 0=disabled (default), 1=enabled" );
485+
486+ static int profile = DEFAULT_PROFILE ;
491487module_param (profile , int , 0000 );
492488MODULE_PARM_DESC (profile ,
493489 "1=16x2 old kp; 2=serial 16x2, new kp; 3=16x2 hantronix; 4=16x2 nexcom; default=40x2, old kp" );
494490
491+ /*
492+ * These are the parallel port pins the LCD control signals are connected to.
493+ * Set this to 0 if the signal is not used. Set it to its opposite value
494+ * (negative) if the signal is negated. -MAXINT is used to indicate that the
495+ * pin has not been explicitly specified.
496+ *
497+ * WARNING! no check will be performed about collisions with keypad/smartcard !
498+ */
499+
500+ static int lcd_e_pin = PIN_NOT_SET ;
495501module_param (lcd_e_pin , int , 0000 );
496502MODULE_PARM_DESC (lcd_e_pin ,
497503 "# of the // port pin connected to LCD 'E' signal, with polarity (-17..17)" );
504+
505+ static int lcd_rs_pin = PIN_NOT_SET ;
498506module_param (lcd_rs_pin , int , 0000 );
499507MODULE_PARM_DESC (lcd_rs_pin ,
500508 "# of the // port pin connected to LCD 'RS' signal, with polarity (-17..17)" );
509+
510+ static int lcd_rw_pin = PIN_NOT_SET ;
501511module_param (lcd_rw_pin , int , 0000 );
502512MODULE_PARM_DESC (lcd_rw_pin ,
503513 "# of the // port pin connected to LCD 'RW' signal, with polarity (-17..17)" );
514+
515+ static int lcd_bl_pin = PIN_NOT_SET ;
504516module_param (lcd_bl_pin , int , 0000 );
505517MODULE_PARM_DESC (lcd_bl_pin ,
506518 "# of the // port pin connected to LCD backlight, with polarity (-17..17)" );
519+
520+ static int lcd_da_pin = PIN_NOT_SET ;
507521module_param (lcd_da_pin , int , 0000 );
508522MODULE_PARM_DESC (lcd_da_pin ,
509523 "# of the // port pin connected to serial LCD 'SDA' signal, with polarity (-17..17)" );
524+
525+ static int lcd_cl_pin = PIN_NOT_SET ;
510526module_param (lcd_cl_pin , int , 0000 );
511527MODULE_PARM_DESC (lcd_cl_pin ,
512528 "# of the // port pin connected to serial LCD 'SCL' signal, with polarity (-17..17)" );
513529
514- #endif
515-
516530static unsigned char * lcd_char_conv ;
517531
518532/* for some LCD drivers (ks0074) we need a charset conversion table. */
@@ -2091,101 +2105,6 @@ static void smartcard_init(void)
20912105/* device initialization */
20922106/**************************************************/
20932107
2094- #if LINUX_VERSION_CODE >= KERNEL_VERSION (2 ,6 ,0 )
2095- #define INIT_FUNC static int __init panel_init_module
2096- #define CLEANUP_FUNC static void __exit panel_cleanup_module
2097- #elif LINUX_VERSION_CODE >= KERNEL_VERSION (2 ,4 ,0 )
2098- #define INIT_FUNC static int __init panel_init_module
2099- #define CLEANUP_FUNC static void panel_cleanup_module
2100- #else
2101- #define INIT_FUNC int init_module
2102- #define CLEANUP_FUNC int cleanup_module
2103- #endif
2104-
2105- #ifndef MODULE
2106- /* called when compiled into the kernel */
2107- #if LINUX_VERSION_CODE >= KERNEL_VERSION (2 ,4 ,0 )
2108- static int __init panel_setup (char * str )
2109- #else
2110- __initfunc (void panel_setup (char * str , int * ints ))
2111- #endif
2112- {
2113- int dummy ;
2114- int * where ;
2115- int helpdisplayed = 0 ;
2116-
2117- if (!str )
2118- return 0 ;
2119-
2120- while (* str ) {
2121- where = NULL ;
2122-
2123- /* let's parse each of the command line parameters of the following form :
2124- panel=[parport:x],[lcd_height:x],[lcd_width:x],[lcd_bwidth:x],[lcd_hwidth:x]
2125- */
2126- if (!strncmp (str , "parport:" , 8 )) {
2127- str += 8 ;
2128- where = & parport ;
2129- } else if (!strncmp (str , "disabled" , 8 )) {
2130- return 0 ;
2131- } else if (!strncmp (str , "lcd_height:" , 11 )) {
2132- str += 11 ;
2133- where = & lcd_height ;
2134- } else if (!strncmp (str , "lcd_width:" , 10 )) {
2135- str += 10 ;
2136- where = & lcd_width ;
2137- } else if (!strncmp (str , "lcd_bwidth:" , 11 )) {
2138- str += 11 ;
2139- where = & lcd_bwidth ;
2140- } else if (!strncmp (str , "lcd_hwidth:" , 11 )) {
2141- str += 11 ;
2142- where = & lcd_hwidth ;
2143- } else if (!strncmp (str , "lcd_enabled:" , 12 )) {
2144- str += 12 ;
2145- where = & lcd_enabled ;
2146- } else if (!strncmp (str , "keypad_enabled:" , 15 )) {
2147- str += 15 ;
2148- where = & keypad_enabled ;
2149- } else if (!strncmp (str , "smartcard_enabled:" , 18 )) {
2150- str += 18 ;
2151- where = & smartcard_enabled ;
2152- } else if (!strncmp (str , "profile:" , 8 )) {
2153- str += 8 ;
2154- where = & profile ;
2155- } else if (!helpdisplayed ) {
2156- helpdisplayed = 1 ;
2157- printk (KERN_ERR "Panel version " PANEL_VERSION
2158- ": invalid argument. Known arguments are :\n"
2159- " parport:, lcd_{height,width,bwidth,enabled}:, keypad_enabled:\n" );
2160- }
2161-
2162- /* see if we need to read a number */
2163- if (where != NULL ) {
2164- dummy = 0 ;
2165- while (isdigit (* str )) {
2166- dummy = (dummy * 10 ) + (* str - '0' );
2167- str ++ ;
2168- }
2169- * where = dummy ;
2170- }
2171-
2172- /* look for next arg */
2173- while (* str && (* str != ',' ))
2174- str ++ ;
2175- while (* str == ',' )
2176- str ++ ;
2177- }
2178- return 1 ;
2179- }
2180-
2181- #if LINUX_VERSION_CODE >= KERNEL_VERSION (2 ,4 ,0 )
2182- __setup ("panel=" , panel_setup );
2183- #else
2184- __setup ("panel" , panel_setup );
2185- #endif
2186-
2187- #endif /* !MODULE */
2188-
21892108static int panel_notify_sys (struct notifier_block * this , unsigned long code ,
21902109 void * unused )
21912110{
@@ -2409,13 +2328,12 @@ int panel_init(void)
24092328 return 0 ;
24102329}
24112330
2412- #if defined(MODULE ) || (LINUX_VERSION_CODE >= KERNEL_VERSION (2 ,4 ,0 ))
2413- INIT_FUNC (void )
2331+ static int __init panel_init_module (void )
24142332{
24152333 return panel_init ();
24162334}
24172335
2418- CLEANUP_FUNC (void )
2336+ static void __exit panel_cleanup_module (void )
24192337{
24202338 unregister_reboot_notifier (& panel_notifier );
24212339
@@ -2440,14 +2358,11 @@ CLEANUP_FUNC(void)
24402358 parport_unregister_device (pprt );
24412359 parport_unregister_driver (& panel_driver );
24422360}
2443- #endif
24442361
2445- #if LINUX_VERSION_CODE >= KERNEL_VERSION (2 ,4 ,0 )
24462362module_init (panel_init_module );
24472363module_exit (panel_cleanup_module );
24482364MODULE_AUTHOR ("Willy Tarreau" );
24492365MODULE_LICENSE ("GPL" );
2450- #endif
24512366
24522367/*
24532368 * Local variables:
0 commit comments