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