aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2008-11-22 06:04:19 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-01-06 16:52:30 -0500
commitf6d1fcfe1a6fefd299a87b45ecbe1f9832da44d1 (patch)
tree5fa0e2ddf16bbc2dae8f7721252faf5367c7ae59 /drivers
parent698b1515f03914386ad9cc033d62447e5d43f880 (diff)
Staging: panel: remove ifdefs and code for pre-2.6 kernels
The code began 8 years ago with kernel 2.0 or 2.1, and kernels 2.2 and 2.4 were still supported. These old version need no longer be supported if the code gets merged in mainline. Signed-off-by: Willy Tarreau <w@1wt.eu> Cc: Frank Menne <frank.menne@hsm.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/panel/panel.c187
1 files changed, 51 insertions, 136 deletions
diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
index dcbad349e581..7f8c1b721162 100644
--- a/drivers/staging/panel/panel.c
+++ b/drivers/staging/panel/panel.c
@@ -228,26 +228,6 @@ static unsigned long int lcd_addr_y; /* contains the LCD Y offset */
228static char lcd_escape[LCD_ESCAPE_LEN + 1]; /* current escape sequence, 0 terminated */ 228static char lcd_escape[LCD_ESCAPE_LEN + 1]; /* current escape sequence, 0 terminated */
229static int lcd_escape_len = -1; /* not in escape state. >=0 = escape cmd len */ 229static int lcd_escape_len = -1; /* not in escape state. >=0 = escape cmd len */
230 230
231static int lcd_height = -1;
232static int lcd_width = -1;
233static int lcd_hwidth = -1; /* hardware buffer width (usually 64) */
234static 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 */
244static int lcd_e_pin = PIN_NOT_SET;
245static int lcd_rs_pin = PIN_NOT_SET;
246static int lcd_rw_pin = PIN_NOT_SET;
247static int lcd_bl_pin = PIN_NOT_SET;
248static int lcd_cl_pin = PIN_NOT_SET;
249static int lcd_da_pin = PIN_NOT_SET;
250
251/* 231/*
252 * Bit masks to convert LCD signals to parallel port outputs. 232 * Bit masks to convert LCD signals to parallel port outputs.
253 * _d_ are values for data port, _c_ are for control port. 233 * _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];
431static int smartcard_open_cnt; /* #times opened */ 411static int smartcard_open_cnt; /* #times opened */
432static int keypad_open_cnt; /* #times opened */ 412static int keypad_open_cnt; /* #times opened */
433static int lcd_open_cnt; /* #times opened */ 413static int lcd_open_cnt; /* #times opened */
434
435static int profile = DEFAULT_PROFILE;
436static struct pardevice *pprt; 414static struct pardevice *pprt;
437static int parport = -1;
438static int lcd_enabled = -1;
439static int lcd_type = -1;
440static int lcd_proto = -1;
441static int lcd_charset = -1;
442static int keypad_enabled = -1;
443static int keypad_type = -1;
444static int smartcard_enabled = -1;
445 415
446static int lcd_initialized, keypad_initialized, smartcard_initialized; 416static int lcd_initialized;
417static int keypad_initialized;
418static int smartcard_initialized;
447 419
448static int light_tempo; 420static int light_tempo;
449 421
@@ -458,61 +430,103 @@ static void (*lcd_clear_fast) (void);
458static DEFINE_SPINLOCK(pprt_lock); 430static DEFINE_SPINLOCK(pprt_lock);
459static struct timer_list scan_timer; 431static struct timer_list scan_timer;
460 432
461#ifdef MODULE
462
463MODULE_DESCRIPTION("Generic parallel port LCD/Keypad/Smartcard driver"); 433MODULE_DESCRIPTION("Generic parallel port LCD/Keypad/Smartcard driver");
434
435static int parport = -1;
464module_param(parport, int, 0000); 436module_param(parport, int, 0000);
465MODULE_PARM_DESC(parport, "Parallel port index (0=lpt1, 1=lpt2, ...)"); 437MODULE_PARM_DESC(parport, "Parallel port index (0=lpt1, 1=lpt2, ...)");
438
439static int lcd_height = -1;
466module_param(lcd_height, int, 0000); 440module_param(lcd_height, int, 0000);
467MODULE_PARM_DESC(lcd_height, "Number of lines on the LCD"); 441MODULE_PARM_DESC(lcd_height, "Number of lines on the LCD");
442
443static int lcd_width = -1;
468module_param(lcd_width, int, 0000); 444module_param(lcd_width, int, 0000);
469MODULE_PARM_DESC(lcd_width, "Number of columns on the LCD"); 445MODULE_PARM_DESC(lcd_width, "Number of columns on the LCD");
446
447static int lcd_bwidth = -1; /* internal buffer width (usually 40) */
470module_param(lcd_bwidth, int, 0000); 448module_param(lcd_bwidth, int, 0000);
471MODULE_PARM_DESC(lcd_bwidth, "Internal LCD line width (40)"); 449MODULE_PARM_DESC(lcd_bwidth, "Internal LCD line width (40)");
450
451static int lcd_hwidth = -1; /* hardware buffer width (usually 64) */
472module_param(lcd_hwidth, int, 0000); 452module_param(lcd_hwidth, int, 0000);
473MODULE_PARM_DESC(lcd_hwidth, "LCD line hardware address (64)"); 453MODULE_PARM_DESC(lcd_hwidth, "LCD line hardware address (64)");
454
455static int lcd_enabled = -1;
474module_param(lcd_enabled, int, 0000); 456module_param(lcd_enabled, int, 0000);
475MODULE_PARM_DESC(lcd_enabled, "Deprecated option, use lcd_type instead"); 457MODULE_PARM_DESC(lcd_enabled, "Deprecated option, use lcd_type instead");
458
459static int keypad_enabled = -1;
476module_param(keypad_enabled, int, 0000); 460module_param(keypad_enabled, int, 0000);
477MODULE_PARM_DESC(keypad_enabled, "Deprecated option, use keypad_type instead"); 461MODULE_PARM_DESC(keypad_enabled, "Deprecated option, use keypad_type instead");
462
463static int lcd_type = -1;
478module_param(lcd_type, int, 0000); 464module_param(lcd_type, int, 0000);
479MODULE_PARM_DESC(lcd_type, 465MODULE_PARM_DESC(lcd_type,
480 "LCD type: 0=none, 1=old //, 2=serial ks0074, 3=hantronix //, 4=nexcom //, 5=compiled-in"); 466 "LCD type: 0=none, 1=old //, 2=serial ks0074, 3=hantronix //, 4=nexcom //, 5=compiled-in");
467
468static int lcd_proto = -1;
481module_param(lcd_proto, int, 0000); 469module_param(lcd_proto, int, 0000);
482MODULE_PARM_DESC(lcd_proto, "LCD communication: 0=parallel (//), 1=serial"); 470MODULE_PARM_DESC(lcd_proto, "LCD communication: 0=parallel (//), 1=serial");
471
472static int lcd_charset = -1;
483module_param(lcd_charset, int, 0000); 473module_param(lcd_charset, int, 0000);
484MODULE_PARM_DESC(lcd_charset, "LCD character set: 0=standard, 1=KS0074"); 474MODULE_PARM_DESC(lcd_charset, "LCD character set: 0=standard, 1=KS0074");
475
476static int keypad_type = -1;
485module_param(keypad_type, int, 0000); 477module_param(keypad_type, int, 0000);
486MODULE_PARM_DESC(keypad_type, 478MODULE_PARM_DESC(keypad_type,
487 "Keypad type: 0=none, 1=old 6 keys, 2=new 6+1 keys, 3=nexcom 4 keys"); 479 "Keypad type: 0=none, 1=old 6 keys, 2=new 6+1 keys, 3=nexcom 4 keys");
480
481static int smartcard_enabled = -1;
488module_param(smartcard_enabled, int, 0000); 482module_param(smartcard_enabled, int, 0000);
489MODULE_PARM_DESC(smartcard_enabled, 483MODULE_PARM_DESC(smartcard_enabled,
490 "Smartcard reader: 0=disabled (default), 1=enabled"); 484 "Smartcard reader: 0=disabled (default), 1=enabled");
485
486static int profile = DEFAULT_PROFILE;
491module_param(profile, int, 0000); 487module_param(profile, int, 0000);
492MODULE_PARM_DESC(profile, 488MODULE_PARM_DESC(profile,
493 "1=16x2 old kp; 2=serial 16x2, new kp; 3=16x2 hantronix; 4=16x2 nexcom; default=40x2, old kp"); 489 "1=16x2 old kp; 2=serial 16x2, new kp; 3=16x2 hantronix; 4=16x2 nexcom; default=40x2, old kp");
494 490
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
500static int lcd_e_pin = PIN_NOT_SET;
495module_param(lcd_e_pin, int, 0000); 501module_param(lcd_e_pin, int, 0000);
496MODULE_PARM_DESC(lcd_e_pin, 502MODULE_PARM_DESC(lcd_e_pin,
497 "# of the // port pin connected to LCD 'E' signal, with polarity (-17..17)"); 503 "# of the // port pin connected to LCD 'E' signal, with polarity (-17..17)");
504
505static int lcd_rs_pin = PIN_NOT_SET;
498module_param(lcd_rs_pin, int, 0000); 506module_param(lcd_rs_pin, int, 0000);
499MODULE_PARM_DESC(lcd_rs_pin, 507MODULE_PARM_DESC(lcd_rs_pin,
500 "# of the // port pin connected to LCD 'RS' signal, with polarity (-17..17)"); 508 "# of the // port pin connected to LCD 'RS' signal, with polarity (-17..17)");
509
510static int lcd_rw_pin = PIN_NOT_SET;
501module_param(lcd_rw_pin, int, 0000); 511module_param(lcd_rw_pin, int, 0000);
502MODULE_PARM_DESC(lcd_rw_pin, 512MODULE_PARM_DESC(lcd_rw_pin,
503 "# of the // port pin connected to LCD 'RW' signal, with polarity (-17..17)"); 513 "# of the // port pin connected to LCD 'RW' signal, with polarity (-17..17)");
514
515static int lcd_bl_pin = PIN_NOT_SET;
504module_param(lcd_bl_pin, int, 0000); 516module_param(lcd_bl_pin, int, 0000);
505MODULE_PARM_DESC(lcd_bl_pin, 517MODULE_PARM_DESC(lcd_bl_pin,
506 "# of the // port pin connected to LCD backlight, with polarity (-17..17)"); 518 "# of the // port pin connected to LCD backlight, with polarity (-17..17)");
519
520static int lcd_da_pin = PIN_NOT_SET;
507module_param(lcd_da_pin, int, 0000); 521module_param(lcd_da_pin, int, 0000);
508MODULE_PARM_DESC(lcd_da_pin, 522MODULE_PARM_DESC(lcd_da_pin,
509 "# of the // port pin connected to serial LCD 'SDA' signal, with polarity (-17..17)"); 523 "# of the // port pin connected to serial LCD 'SDA' signal, with polarity (-17..17)");
524
525static int lcd_cl_pin = PIN_NOT_SET;
510module_param(lcd_cl_pin, int, 0000); 526module_param(lcd_cl_pin, int, 0000);
511MODULE_PARM_DESC(lcd_cl_pin, 527MODULE_PARM_DESC(lcd_cl_pin,
512 "# of the // port pin connected to serial LCD 'SCL' signal, with polarity (-17..17)"); 528 "# of the // port pin connected to serial LCD 'SCL' signal, with polarity (-17..17)");
513 529
514#endif
515
516static unsigned char *lcd_char_conv; 530static unsigned char *lcd_char_conv;
517 531
518/* for some LCD drivers (ks0074) we need a charset conversion table. */ 532/* for some LCD drivers (ks0074) we need a charset conversion table. */
@@ -2091,101 +2105,6 @@ static void smartcard_init(void)
2091/* device initialization */ 2105/* device initialization */
2092/**************************************************/ 2106/**************************************************/
2093 2107
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)
2108static 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
2189static int panel_notify_sys(struct notifier_block *this, unsigned long code, 2108static int panel_notify_sys(struct notifier_block *this, unsigned long code,
2190 void *unused) 2109 void *unused)
2191{ 2110{
@@ -2409,13 +2328,12 @@ int panel_init(void)
2409 return 0; 2328 return 0;
2410} 2329}
2411 2330
2412#if defined(MODULE) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)) 2331static int __init panel_init_module(void)
2413INIT_FUNC(void)
2414{ 2332{
2415 return panel_init(); 2333 return panel_init();
2416} 2334}
2417 2335
2418CLEANUP_FUNC(void) 2336static void __exit panel_cleanup_module(void)
2419{ 2337{
2420 unregister_reboot_notifier(&panel_notifier); 2338 unregister_reboot_notifier(&panel_notifier);
2421 2339
@@ -2440,14 +2358,11 @@ CLEANUP_FUNC(void)
2440 parport_unregister_device(pprt); 2358 parport_unregister_device(pprt);
2441 parport_unregister_driver(&panel_driver); 2359 parport_unregister_driver(&panel_driver);
2442} 2360}
2443#endif
2444 2361
2445#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
2446module_init(panel_init_module); 2362module_init(panel_init_module);
2447module_exit(panel_cleanup_module); 2363module_exit(panel_cleanup_module);
2448MODULE_AUTHOR("Willy Tarreau"); 2364MODULE_AUTHOR("Willy Tarreau");
2449MODULE_LICENSE("GPL"); 2365MODULE_LICENSE("GPL");
2450#endif
2451 2366
2452/* 2367/*
2453 * Local variables: 2368 * Local variables: