1 /*
2  *  linux/include/asm-ppc/keyboard.h
3  *
4  *  Created 3 Nov 1996 by Geert Uytterhoeven
5  *  Modified for Power Macintosh by Paul Mackerras
6  */
7 
8 /*
9  * This file contains the ppc architecture specific keyboard definitions -
10  * like the intel pc for prep systems, different for power macs.
11  */
12 
13 #ifndef __ASMPPC_KEYBOARD_H
14 #define __ASMPPC_KEYBOARD_H
15 
16 #ifdef __KERNEL__
17 
18 #include <linux/adb.h>
19 #include <asm/machdep.h>
20 
21 #include <linux/kernel.h>
22 #include <linux/ioport.h>
23 #include <linux/kd.h>
24 #include <asm/io.h>
25 /* IBM Spruce platform is different. */
26 #ifdef CONFIG_SPRUCE
27 #include <platforms/spruce.h>
28 #endif
29 
30 #ifndef KEYBOARD_IRQ
31 #define KEYBOARD_IRQ			1
32 #endif
33 #define DISABLE_KBD_DURING_INTERRUPTS	0
34 #define INIT_KBD
35 
kbd_setkeycode(unsigned int scancode,unsigned int keycode)36 static inline int kbd_setkeycode(unsigned int scancode, unsigned int keycode)
37 {
38 	if ( ppc_md.kbd_setkeycode )
39 		return ppc_md.kbd_setkeycode(scancode, keycode);
40 	else
41 		return 0;
42 }
43 
kbd_getkeycode(unsigned int scancode)44 static inline int kbd_getkeycode(unsigned int scancode)
45 {
46 	if ( ppc_md.kbd_getkeycode )
47 		return ppc_md.kbd_getkeycode(scancode);
48 	else
49 		return 0;
50 }
51 
kbd_translate(unsigned char keycode,unsigned char * keycodep,char raw_mode)52 static inline int kbd_translate(unsigned char keycode, unsigned char *keycodep,
53 				char raw_mode)
54 {
55 	if ( ppc_md.kbd_translate )
56 		return ppc_md.kbd_translate(keycode, keycodep, raw_mode);
57 	else
58 		return 0;
59 }
60 
kbd_unexpected_up(unsigned char keycode)61 static inline int kbd_unexpected_up(unsigned char keycode)
62 {
63 	if ( ppc_md.kbd_unexpected_up )
64 		return ppc_md.kbd_unexpected_up(keycode);
65 	else
66 		return 0;
67 }
68 
kbd_leds(unsigned char leds)69 static inline void kbd_leds(unsigned char leds)
70 {
71 	if ( ppc_md.kbd_leds )
72 		ppc_md.kbd_leds(leds);
73 }
74 
kbd_init_hw(void)75 static inline void kbd_init_hw(void)
76 {
77 	if ( ppc_md.kbd_init_hw )
78 		ppc_md.kbd_init_hw();
79 }
80 
81 #define kbd_sysrq_xlate	(ppc_md.ppc_kbd_sysrq_xlate)
82 
83 extern unsigned long SYSRQ_KEY;
84 
85 /* resource allocation */
86 #define kbd_request_region()
87 #define kbd_request_irq(handler) request_irq(KEYBOARD_IRQ, handler, 0, \
88                                              "keyboard", NULL)
89 
90 /* How to access the keyboard macros on this platform.  */
91 #ifndef kbd_read_input
92 #define kbd_read_input() inb(KBD_DATA_REG)
93 #define kbd_read_status() inb(KBD_STATUS_REG)
94 #define kbd_write_output(val) outb(val, KBD_DATA_REG)
95 #define kbd_write_command(val) outb(val, KBD_CNTL_REG)
96 #endif
97 
98 /* Some stoneage hardware needs delays after some operations.  */
99 #define kbd_pause() do { } while(0)
100 
101 /*
102  * Machine specific bits for the PS/2 driver
103  */
104 #ifndef AUX_IRQ
105 #define AUX_IRQ 12
106 #endif
107 
108 #define aux_request_irq(hand, dev_id)					\
109 	request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id)
110 
111 #define aux_free_irq(dev_id) free_irq(AUX_IRQ, dev_id)
112 
113 #endif /* __KERNEL__ */
114 #endif /* __ASMPPC_KEYBOARD_H */
115