diff options
-rw-r--r-- | drivers/staging/panel/panel.c | 187 |
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 */ | |||
228 | static char lcd_escape[LCD_ESCAPE_LEN + 1]; /* current escape sequence, 0 terminated */ | 228 | static char lcd_escape[LCD_ESCAPE_LEN + 1]; /* current escape sequence, 0 terminated */ |
229 | static int lcd_escape_len = -1; /* not in escape state. >=0 = escape cmd len */ | 229 | static int lcd_escape_len = -1; /* not in escape state. >=0 = escape cmd len */ |
230 | 230 | ||
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 | |||
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]; | |||
431 | static int smartcard_open_cnt; /* #times opened */ | 411 | static int smartcard_open_cnt; /* #times opened */ |
432 | static int keypad_open_cnt; /* #times opened */ | 412 | static int keypad_open_cnt; /* #times opened */ |
433 | static int lcd_open_cnt; /* #times opened */ | 413 | static int lcd_open_cnt; /* #times opened */ |
434 | |||
435 | static int profile = DEFAULT_PROFILE; | ||
436 | static struct pardevice *pprt; | 414 | static 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; | ||
445 | 415 | ||
446 | static int lcd_initialized, keypad_initialized, smartcard_initialized; | 416 | static int lcd_initialized; |
417 | static int keypad_initialized; | ||
418 | static int smartcard_initialized; | ||
447 | 419 | ||
448 | static int light_tempo; | 420 | static int light_tempo; |
449 | 421 | ||
@@ -458,61 +430,103 @@ static void (*lcd_clear_fast) (void); | |||
458 | static DEFINE_SPINLOCK(pprt_lock); | 430 | static DEFINE_SPINLOCK(pprt_lock); |
459 | static struct timer_list scan_timer; | 431 | static struct timer_list scan_timer; |
460 | 432 | ||
461 | #ifdef MODULE | ||
462 | |||
463 | MODULE_DESCRIPTION("Generic parallel port LCD/Keypad/Smartcard driver"); | 433 | MODULE_DESCRIPTION("Generic parallel port LCD/Keypad/Smartcard driver"); |
434 | |||
435 | static int parport = -1; | ||
464 | module_param(parport, int, 0000); | 436 | module_param(parport, int, 0000); |
465 | MODULE_PARM_DESC(parport, "Parallel port index (0=lpt1, 1=lpt2, ...)"); | 437 | MODULE_PARM_DESC(parport, "Parallel port index (0=lpt1, 1=lpt2, ...)"); |
438 | |||
439 | static int lcd_height = -1; | ||
466 | module_param(lcd_height, int, 0000); | 440 | module_param(lcd_height, int, 0000); |
467 | MODULE_PARM_DESC(lcd_height, "Number of lines on the LCD"); | 441 | MODULE_PARM_DESC(lcd_height, "Number of lines on the LCD"); |
442 | |||
443 | static int lcd_width = -1; | ||
468 | module_param(lcd_width, int, 0000); | 444 | module_param(lcd_width, int, 0000); |
469 | MODULE_PARM_DESC(lcd_width, "Number of columns on the LCD"); | 445 | MODULE_PARM_DESC(lcd_width, "Number of columns on the LCD"); |
446 | |||
447 | static int lcd_bwidth = -1; /* internal buffer width (usually 40) */ | ||
470 | module_param(lcd_bwidth, int, 0000); | 448 | module_param(lcd_bwidth, int, 0000); |
471 | MODULE_PARM_DESC(lcd_bwidth, "Internal LCD line width (40)"); | 449 | MODULE_PARM_DESC(lcd_bwidth, "Internal LCD line width (40)"); |
450 | |||
451 | static int lcd_hwidth = -1; /* hardware buffer width (usually 64) */ | ||
472 | module_param(lcd_hwidth, int, 0000); | 452 | module_param(lcd_hwidth, int, 0000); |
473 | MODULE_PARM_DESC(lcd_hwidth, "LCD line hardware address (64)"); | 453 | MODULE_PARM_DESC(lcd_hwidth, "LCD line hardware address (64)"); |
454 | |||
455 | static int lcd_enabled = -1; | ||
474 | module_param(lcd_enabled, int, 0000); | 456 | module_param(lcd_enabled, int, 0000); |
475 | MODULE_PARM_DESC(lcd_enabled, "Deprecated option, use lcd_type instead"); | 457 | MODULE_PARM_DESC(lcd_enabled, "Deprecated option, use lcd_type instead"); |
458 | |||
459 | static int keypad_enabled = -1; | ||
476 | module_param(keypad_enabled, int, 0000); | 460 | module_param(keypad_enabled, int, 0000); |
477 | MODULE_PARM_DESC(keypad_enabled, "Deprecated option, use keypad_type instead"); | 461 | MODULE_PARM_DESC(keypad_enabled, "Deprecated option, use keypad_type instead"); |
462 | |||
463 | static int lcd_type = -1; | ||
478 | module_param(lcd_type, int, 0000); | 464 | module_param(lcd_type, int, 0000); |
479 | MODULE_PARM_DESC(lcd_type, | 465 | MODULE_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 | |||
468 | static int lcd_proto = -1; | ||
481 | module_param(lcd_proto, int, 0000); | 469 | module_param(lcd_proto, int, 0000); |
482 | MODULE_PARM_DESC(lcd_proto, "LCD communication: 0=parallel (//), 1=serial"); | 470 | MODULE_PARM_DESC(lcd_proto, "LCD communication: 0=parallel (//), 1=serial"); |
471 | |||
472 | static int lcd_charset = -1; | ||
483 | module_param(lcd_charset, int, 0000); | 473 | module_param(lcd_charset, int, 0000); |
484 | MODULE_PARM_DESC(lcd_charset, "LCD character set: 0=standard, 1=KS0074"); | 474 | MODULE_PARM_DESC(lcd_charset, "LCD character set: 0=standard, 1=KS0074"); |
475 | |||
476 | static int keypad_type = -1; | ||
485 | module_param(keypad_type, int, 0000); | 477 | module_param(keypad_type, int, 0000); |
486 | MODULE_PARM_DESC(keypad_type, | 478 | MODULE_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 | |||
481 | static int smartcard_enabled = -1; | ||
488 | module_param(smartcard_enabled, int, 0000); | 482 | module_param(smartcard_enabled, int, 0000); |
489 | MODULE_PARM_DESC(smartcard_enabled, | 483 | MODULE_PARM_DESC(smartcard_enabled, |
490 | "Smartcard reader: 0=disabled (default), 1=enabled"); | 484 | "Smartcard reader: 0=disabled (default), 1=enabled"); |
485 | |||
486 | static int profile = DEFAULT_PROFILE; | ||
491 | module_param(profile, int, 0000); | 487 | module_param(profile, int, 0000); |
492 | MODULE_PARM_DESC(profile, | 488 | MODULE_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 | |||
500 | static int lcd_e_pin = PIN_NOT_SET; | ||
495 | module_param(lcd_e_pin, int, 0000); | 501 | module_param(lcd_e_pin, int, 0000); |
496 | MODULE_PARM_DESC(lcd_e_pin, | 502 | MODULE_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 | |||
505 | static int lcd_rs_pin = PIN_NOT_SET; | ||
498 | module_param(lcd_rs_pin, int, 0000); | 506 | module_param(lcd_rs_pin, int, 0000); |
499 | MODULE_PARM_DESC(lcd_rs_pin, | 507 | MODULE_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 | |||
510 | static int lcd_rw_pin = PIN_NOT_SET; | ||
501 | module_param(lcd_rw_pin, int, 0000); | 511 | module_param(lcd_rw_pin, int, 0000); |
502 | MODULE_PARM_DESC(lcd_rw_pin, | 512 | MODULE_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 | |||
515 | static int lcd_bl_pin = PIN_NOT_SET; | ||
504 | module_param(lcd_bl_pin, int, 0000); | 516 | module_param(lcd_bl_pin, int, 0000); |
505 | MODULE_PARM_DESC(lcd_bl_pin, | 517 | MODULE_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 | |||
520 | static int lcd_da_pin = PIN_NOT_SET; | ||
507 | module_param(lcd_da_pin, int, 0000); | 521 | module_param(lcd_da_pin, int, 0000); |
508 | MODULE_PARM_DESC(lcd_da_pin, | 522 | MODULE_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 | |||
525 | static int lcd_cl_pin = PIN_NOT_SET; | ||
510 | module_param(lcd_cl_pin, int, 0000); | 526 | module_param(lcd_cl_pin, int, 0000); |
511 | MODULE_PARM_DESC(lcd_cl_pin, | 527 | MODULE_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 | |||
516 | static unsigned char *lcd_char_conv; | 530 | static 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) | ||
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 | |||
2189 | static int panel_notify_sys(struct notifier_block *this, unsigned long code, | 2108 | static 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)) | 2331 | static int __init panel_init_module(void) |
2413 | INIT_FUNC(void) | ||
2414 | { | 2332 | { |
2415 | return panel_init(); | 2333 | return panel_init(); |
2416 | } | 2334 | } |
2417 | 2335 | ||
2418 | CLEANUP_FUNC(void) | 2336 | static 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) | ||
2446 | module_init(panel_init_module); | 2362 | module_init(panel_init_module); |
2447 | module_exit(panel_cleanup_module); | 2363 | module_exit(panel_cleanup_module); |
2448 | MODULE_AUTHOR("Willy Tarreau"); | 2364 | MODULE_AUTHOR("Willy Tarreau"); |
2449 | MODULE_LICENSE("GPL"); | 2365 | MODULE_LICENSE("GPL"); |
2450 | #endif | ||
2451 | 2366 | ||
2452 | /* | 2367 | /* |
2453 | * Local variables: | 2368 | * Local variables: |