Commit 7a017c2b authored by Vojtech Pavlik's avatar Vojtech Pavlik

Merge suse.cz:/home/vojtech/bk/linus into suse.cz:/home/vojtech/bk/input

parents 0bf36f29 368b9617
......@@ -33,7 +33,6 @@
#include <asm/amigaints.h>
#include <asm/irq.h>
#include <asm/rtc.h>
#include <asm/keyboard.h>
#include <asm/machdep.h>
#include <asm/io.h>
......@@ -71,11 +70,6 @@ static char amiga_model_name[13] = "Amiga ";
extern char m68k_debug_device[];
static void amiga_sched_init(void (*handler)(int, void *, struct pt_regs *));
/* amiga specific keyboard functions */
extern int amiga_keyb_init(void);
extern int amiga_kbdrate (struct kbd_repeat *);
extern int amiga_kbd_translate(unsigned char keycode, unsigned char *keycodep,
char raw_mode);
/* amiga specific irq functions */
extern void amiga_init_IRQ (void);
extern void (*amiga_default_handler[]) (int, void *, struct pt_regs *);
......@@ -94,7 +88,6 @@ static unsigned long amiga_gettimeoffset (void);
static int a3000_hwclk (int, struct rtc_time *);
static int a2000_hwclk (int, struct rtc_time *);
static int amiga_set_clock_mmss (unsigned long);
extern void amiga_mksound( unsigned int count, unsigned int ticks );
#ifdef CONFIG_AMIGA_FLOPPY
extern void amiga_floppy_setup(char *, int *);
#endif
......@@ -116,18 +109,6 @@ static struct console amiga_console_driver = {
.index = -1,
};
#ifdef CONFIG_MAGIC_SYSRQ
static char amiga_sysrq_xlate[128] =
"\0001234567890-=\\\000\000" /* 0x00 - 0x0f */
"qwertyuiop[]\000123" /* 0x10 - 0x1f */
"asdfghjkl;'\000\000456" /* 0x20 - 0x2f */
"\000zxcvbnm,./\000+789" /* 0x30 - 0x3f */
" \177\t\r\r\000\177\000\000\000-\000\000\000\000\000" /* 0x40 - 0x4f */
"\000\201\202\203\204\205\206\207\210\211()/*+\000" /* 0x50 - 0x5f */
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000" /* 0x60 - 0x6f */
"\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"; /* 0x70 - 0x7f */
#endif
/*
* Motherboard Resources present in all Amiga models
......@@ -388,11 +369,6 @@ void __init config_amiga(void)
request_resource(&iomem_resource, &((struct resource *)&mb_resources)[i]);
mach_sched_init = amiga_sched_init;
#ifdef CONFIG_VT
mach_keyb_init = amiga_keyb_init;
mach_kbdrate = amiga_kbdrate;
mach_kbd_translate = amiga_kbd_translate;
#endif
mach_init_IRQ = amiga_init_IRQ;
mach_default_handler = &amiga_default_handler;
mach_request_irq = amiga_request_irq;
......@@ -432,16 +408,10 @@ void __init config_amiga(void)
#ifdef CONFIG_DUMMY_CONSOLE
conswitchp = &dummy_con;
#endif
#ifdef CONFIG_VT
kd_mksound = amiga_mksound;
#endif
#ifdef CONFIG_MAGIC_SYSRQ
SYSRQ_KEY = 0xff;
mach_sysrq_key = 0x5f; /* HELP */
mach_sysrq_shift_state = 0x03; /* SHIFT+ALTGR */
mach_sysrq_shift_mask = 0xff; /* all modifiers except CapsLock */
mach_sysrq_xlate = amiga_sysrq_xlate;
#ifdef CONFIG_INPUT_M68K_BEEP
mach_beep = amiga_mksound;
#endif
#ifdef CONFIG_HEARTBEAT
mach_heartbeat = amiga_heartbeat;
#endif
......@@ -709,7 +679,7 @@ static void amiga_reset (void)
unsigned long jmp_addr040 = virt_to_phys(&&jmp_addr_label040);
unsigned long jmp_addr = virt_to_phys(&&jmp_addr_label);
cli();
local_irq_disable();
if (CPU_IS_040_OR_060)
/* Setup transparent translation registers for mapping
* of 16 MB kernel segment before disabling translation
......
/*
* linux/atari/atakeyb.c
*
* Atari Keyboard driver for 680x0 Linux
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
/*
* Atari support by Robert de Vries
* enhanced by Bjoern Brauel and Roman Hodek
*/
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/keyboard.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/kd.h>
#include <linux/random.h>
#include <linux/init.h>
#include <linux/kbd_ll.h>
#include <linux/kbd_kern.h>
#include <asm/atariints.h>
#include <asm/atarihw.h>
#include <asm/atarikb.h>
#include <asm/atari_joystick.h>
#include <asm/irq.h>
static void atakeyb_rep( unsigned long ignore );
extern unsigned int keymap_count;
/* Hook for MIDI serial driver */
void (*atari_MIDI_interrupt_hook) (void);
/* Hook for mouse driver */
void (*atari_mouse_interrupt_hook) (char *);
/* variables for IKBD self test: */
/* state: 0: off; >0: in progress; >1: 0xf1 received */
static volatile int ikbd_self_test;
/* timestamp when last received a char */
static volatile unsigned long self_test_last_rcv;
/* bitmap of keys reported as broken */
static unsigned long broken_keys[128/(sizeof(unsigned long)*8)] = { 0, };
#define BREAK_MASK (0x80)
/*
* ++roman: The following changes were applied manually:
*
* - The Alt (= Meta) key works in combination with Shift and
* Control, e.g. Alt+Shift+a sends Meta-A (0xc1), Alt+Control+A sends
* Meta-Ctrl-A (0x81) ...
*
* - The parentheses on the keypad send '(' and ')' with all
* modifiers (as would do e.g. keypad '+'), but they cannot be used as
* application keys (i.e. sending Esc O c).
*
* - HELP and UNDO are mapped to be F21 and F24, resp, that send the
* codes "\E[M" and "\E[P". (This is better than the old mapping to
* F11 and F12, because these codes are on Shift+F1/2 anyway.) This
* way, applications that allow their own keyboard mappings
* (e.g. tcsh, X Windows) can be configured to use them in the way
* the label suggests (providing help or undoing).
*
* - Console switching is done with Alt+Fx (consoles 1..10) and
* Shift+Alt+Fx (consoles 11..20).
*
* - The misc. special function implemented in the kernel are mapped
* to the following key combinations:
*
* ClrHome -> Home/Find
* Shift + ClrHome -> End/Select
* Shift + Up -> Page Up
* Shift + Down -> Page Down
* Alt + Help -> show system status
* Shift + Help -> show memory info
* Ctrl + Help -> show registers
* Ctrl + Alt + Del -> Reboot
* Alt + Undo -> switch to last console
* Shift + Undo -> send interrupt
* Alt + Insert -> stop/start output (same as ^S/^Q)
* Alt + Up -> Scroll back console (if implemented)
* Alt + Down -> Scroll forward console (if implemented)
* Alt + CapsLock -> NumLock
*
* ++Andreas:
*
* - Help mapped to K_HELP
* - Undo mapped to K_UNDO (= K_F246)
* - Keypad Left/Right Parenthesis mapped to new K_PPAREN[LR]
*/
static u_short ataplain_map[NR_KEYS] __initdata = {
0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf009,
0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73,
0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76,
0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf200,
0xf703, 0xf020, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atashift_map[NR_KEYS] __initdata = {
0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf008, 0xf009,
0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53,
0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56,
0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf200,
0xf703, 0xf020, 0xf207, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf10e,
0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf117,
0xf118, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf119, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf205, 0xf203, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atactrl_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01d, 0xf01e,
0xf01f, 0xf07f, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf200,
0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf201, 0xf702, 0xf001, 0xf013,
0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
0xf007, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016,
0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf07f, 0xf700, 0xf200,
0xf703, 0xf000, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf202, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atashift_ctrl_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf200,
0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
0xf00f, 0xf010, 0xf200, 0xf200, 0xf201, 0xf702, 0xf001, 0xf013,
0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
0xf200, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016,
0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf07f, 0xf700, 0xf200,
0xf703, 0xf200, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf117,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short ataalt_map[NR_KEYS] __initdata = {
0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf808, 0xf809,
0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873,
0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b,
0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876,
0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf200,
0xf703, 0xf820, 0xf208, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504,
0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf200, 0xf200, 0xf114,
0xf20b, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf20a, 0xf200, 0xf209, 0xf87f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf206, 0xf204, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf907,
0xf908, 0xf909, 0xf904, 0xf905, 0xf906, 0xf901, 0xf902, 0xf903,
0xf900, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atashift_alt_map[NR_KEYS] __initdata = {
0xf200, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e,
0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf808, 0xf809,
0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849,
0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf201, 0xf702, 0xf841, 0xf853,
0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a,
0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856,
0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf200,
0xf703, 0xf820, 0xf207, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf50e,
0xf50f, 0xf510, 0xf511, 0xf512, 0xf513, 0xf200, 0xf200, 0xf117,
0xf118, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf119, 0xf200, 0xf115, 0xf87f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atactrl_alt_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf800, 0xf81b, 0xf81c, 0xf81d, 0xf81e,
0xf81f, 0xf87f, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf200,
0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf201, 0xf702, 0xf801, 0xf813,
0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
0xf807, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816,
0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf87f, 0xf700, 0xf200,
0xf703, 0xf800, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf114,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf87f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf202, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short atashift_ctrl_alt_map[NR_KEYS] = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf200,
0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809,
0xf80f, 0xf810, 0xf200, 0xf200, 0xf201, 0xf702, 0xf801, 0xf813,
0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200,
0xf200, 0xf200, 0xf700, 0xf200, 0xf81a, 0xf818, 0xf803, 0xf816,
0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf87f, 0xf700, 0xf200,
0xf703, 0xf200, 0xf207, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104,
0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf200, 0xf200, 0xf117,
0xf603, 0xf200, 0xf30b, 0xf601, 0xf200, 0xf602, 0xf30a, 0xf200,
0xf600, 0xf200, 0xf115, 0xf87f, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf1ff, 0xf11b, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf307,
0xf308, 0xf309, 0xf304, 0xf305, 0xf306, 0xf301, 0xf302, 0xf303,
0xf300, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
typedef enum kb_state_t
{
KEYBOARD, AMOUSE, RMOUSE, JOYSTICK, CLOCK, RESYNC
} KB_STATE_T;
#define IS_SYNC_CODE(sc) ((sc) >= 0x04 && (sc) <= 0xfb)
typedef struct keyboard_state
{
unsigned char buf[6];
int len;
KB_STATE_T state;
} KEYBOARD_STATE;
KEYBOARD_STATE kb_state;
#define DEFAULT_KEYB_REP_DELAY (HZ/4)
#define DEFAULT_KEYB_REP_RATE (HZ/25)
/* These could be settable by some ioctl() in future... */
static unsigned int key_repeat_delay = DEFAULT_KEYB_REP_DELAY;
static unsigned int key_repeat_rate = DEFAULT_KEYB_REP_RATE;
static unsigned char rep_scancode;
static struct timer_list atakeyb_rep_timer = { function: atakeyb_rep };
static void atakeyb_rep( unsigned long ignore )
{
kbd_pt_regs = NULL;
/* Disable keyboard for the time we call handle_scancode(), else a race
* in the keyboard tty queue may happen */
atari_disable_irq( IRQ_MFP_ACIA );
del_timer( &atakeyb_rep_timer );
/* A keyboard int may have come in before we disabled the irq, so
* double-check whether rep_scancode is still != 0 */
if (rep_scancode) {
init_timer(&atakeyb_rep_timer);
atakeyb_rep_timer.expires = jiffies + key_repeat_rate;
add_timer( &atakeyb_rep_timer );
handle_scancode(rep_scancode, 1);
}
atari_enable_irq( IRQ_MFP_ACIA );
}
/* ++roman: If a keyboard overrun happened, we can't tell in general how much
* bytes have been lost and in which state of the packet structure we are now.
* This usually causes keyboards bytes to be interpreted as mouse movements
* and vice versa, which is very annoying. It seems better to throw away some
* bytes (that are usually mouse bytes) than to misinterpret them. Therefor I
* introduced the RESYNC state for IKBD data. In this state, the bytes up to
* one that really looks like a key event (0x04..0xf2) or the start of a mouse
* packet (0xf8..0xfb) are thrown away, but at most 2 bytes. This at least
* speeds up the resynchronization of the event structure, even if maybe a
* mouse movement is lost. However, nothing is perfect. For bytes 0x01..0x03,
* it's really hard to decide whether they're mouse or keyboard bytes. Since
* overruns usually occur when moving the Atari mouse rapidly, they're seen as
* mouse bytes here. If this is wrong, only a make code of the keyboard gets
* lost, which isn't too bad. Loosing a break code would be disastrous,
* because then the keyboard repeat strikes...
*/
static void keyboard_interrupt(int irq, void *dummy, struct pt_regs *fp)
{
u_char acia_stat;
int scancode;
int break_flag;
/* save frame for register dump */
kbd_pt_regs = fp;
repeat:
if (acia.mid_ctrl & ACIA_IRQ)
if (atari_MIDI_interrupt_hook)
atari_MIDI_interrupt_hook();
acia_stat = acia.key_ctrl;
/* check out if the interrupt came from this ACIA */
if (!((acia_stat | acia.mid_ctrl) & ACIA_IRQ))
return;
if (acia_stat & ACIA_OVRN)
{
/* a very fast typist or a slow system, give a warning */
/* ...happens often if interrupts were disabled for too long */
printk( KERN_DEBUG "Keyboard overrun\n" );
scancode = acia.key_data;
/* Turn off autorepeating in case a break code has been lost */
del_timer( &atakeyb_rep_timer );
rep_scancode = 0;
if (ikbd_self_test)
/* During self test, don't do resyncing, just process the code */
goto interpret_scancode;
else if (IS_SYNC_CODE(scancode)) {
/* This code seem already to be the start of a new packet or a
* single scancode */
kb_state.state = KEYBOARD;
goto interpret_scancode;
}
else {
/* Go to RESYNC state and skip this byte */
kb_state.state = RESYNC;
kb_state.len = 1; /* skip max. 1 another byte */
goto repeat;
}
}
if (acia_stat & ACIA_RDRF) /* received a character */
{
scancode = acia.key_data; /* get it or reset the ACIA, I'll get it! */
tasklet_schedule(&keyboard_tasklet);
interpret_scancode:
switch (kb_state.state)
{
case KEYBOARD:
switch (scancode)
{
case 0xF7:
kb_state.state = AMOUSE;
kb_state.len = 0;
break;
case 0xF8:
case 0xF9:
case 0xFA:
case 0xFB:
kb_state.state = RMOUSE;
kb_state.len = 1;
kb_state.buf[0] = scancode;
break;
case 0xFC:
kb_state.state = CLOCK;
kb_state.len = 0;
break;
case 0xFE:
case 0xFF:
kb_state.state = JOYSTICK;
kb_state.len = 1;
kb_state.buf[0] = scancode;
break;
case 0xF1:
/* during self-test, note that 0xf1 received */
if (ikbd_self_test) {
++ikbd_self_test;
self_test_last_rcv = jiffies;
break;
}
/* FALL THROUGH */
default:
break_flag = scancode & BREAK_MASK;
scancode &= ~BREAK_MASK;
if (ikbd_self_test) {
/* Scancodes sent during the self-test stand for broken
* keys (keys being down). The code *should* be a break
* code, but nevertheless some AT keyboard interfaces send
* make codes instead. Therefore, simply ignore
* break_flag...
* */
int keyval = plain_map[scancode], keytyp;
set_bit( scancode, broken_keys );
self_test_last_rcv = jiffies;
keyval = plain_map[scancode];
keytyp = KTYP(keyval) - 0xf0;
keyval = KVAL(keyval);
printk( KERN_WARNING "Key with scancode %d ", scancode );
if (keytyp == KT_LATIN || keytyp == KT_LETTER) {
if (keyval < ' ')
printk( "('^%c') ", keyval + '@' );
else
printk( "('%c') ", keyval );
}
printk( "is broken -- will be ignored.\n" );
break;
}
else if (test_bit( scancode, broken_keys ))
break;
if (break_flag) {
del_timer( &atakeyb_rep_timer );
rep_scancode = 0;
}
else {
del_timer( &atakeyb_rep_timer );
rep_scancode = scancode;
atakeyb_rep_timer.expires = jiffies + key_repeat_delay;
add_timer( &atakeyb_rep_timer );
}
handle_scancode(scancode, !break_flag);
break;
}
break;
case AMOUSE:
kb_state.buf[kb_state.len++] = scancode;
if (kb_state.len == 5)
{
kb_state.state = KEYBOARD;
/* not yet used */
/* wake up someone waiting for this */
}
break;
case RMOUSE:
kb_state.buf[kb_state.len++] = scancode;
if (kb_state.len == 3)
{
kb_state.state = KEYBOARD;
if (atari_mouse_interrupt_hook)
atari_mouse_interrupt_hook(kb_state.buf);
}
break;
case JOYSTICK:
kb_state.buf[1] = scancode;
kb_state.state = KEYBOARD;
atari_joystick_interrupt(kb_state.buf);
break;
case CLOCK:
kb_state.buf[kb_state.len++] = scancode;
if (kb_state.len == 6)
{
kb_state.state = KEYBOARD;
/* wake up someone waiting for this.
But will this ever be used, as Linux keeps its own time.
Perhaps for synchronization purposes? */
/* wake_up_interruptible(&clock_wait); */
}
break;
case RESYNC:
if (kb_state.len <= 0 || IS_SYNC_CODE(scancode)) {
kb_state.state = KEYBOARD;
goto interpret_scancode;
}
kb_state.len--;
break;
}
}
#if 0
if (acia_stat & ACIA_CTS)
/* cannot happen */;
#endif
if (acia_stat & (ACIA_FE | ACIA_PE))
{
printk("Error in keyboard communication\n");
}
/* handle_scancode() can take a lot of time, so check again if
* some character arrived
*/
goto repeat;
}
/*
* I write to the keyboard without using interrupts, I poll instead.
* This takes for the maximum length string allowed (7) at 7812.5 baud
* 8 data 1 start 1 stop bit: 9.0 ms
* If this takes too long for normal operation, interrupt driven writing
* is the solution. (I made a feeble attempt in that direction but I
* kept it simple for now.)
*/
void ikbd_write(const char *str, int len)
{
u_char acia_stat;
if ((len < 1) || (len > 7))
panic("ikbd: maximum string length exceeded");
while (len)
{
acia_stat = acia.key_ctrl;
if (acia_stat & ACIA_TDRE)
{
acia.key_data = *str++;
len--;
}
}
}
/* Reset (without touching the clock) */
void ikbd_reset(void)
{
static const char cmd[2] = { 0x80, 0x01 };
ikbd_write(cmd, 2);
/* if all's well code 0xF1 is returned, else the break codes of
all keys making contact */
}
/* Set mouse button action */
void ikbd_mouse_button_action(int mode)
{
char cmd[2] = { 0x07, mode };
ikbd_write(cmd, 2);
}
/* Set relative mouse position reporting */
void ikbd_mouse_rel_pos(void)
{
static const char cmd[1] = { 0x08 };
ikbd_write(cmd, 1);
}
/* Set absolute mouse position reporting */
void ikbd_mouse_abs_pos(int xmax, int ymax)
{
char cmd[5] = { 0x09, xmax>>8, xmax&0xFF, ymax>>8, ymax&0xFF };
ikbd_write(cmd, 5);
}
/* Set mouse keycode mode */
void ikbd_mouse_kbd_mode(int dx, int dy)
{
char cmd[3] = { 0x0A, dx, dy };
ikbd_write(cmd, 3);
}
/* Set mouse threshold */
void ikbd_mouse_thresh(int x, int y)
{
char cmd[3] = { 0x0B, x, y };
ikbd_write(cmd, 3);
}
/* Set mouse scale */
void ikbd_mouse_scale(int x, int y)
{
char cmd[3] = { 0x0C, x, y };
ikbd_write(cmd, 3);
}
/* Interrogate mouse position */
void ikbd_mouse_pos_get(int *x, int *y)
{
static const char cmd[1] = { 0x0D };
ikbd_write(cmd, 1);
/* wait for returning bytes */
}
/* Load mouse position */
void ikbd_mouse_pos_set(int x, int y)
{
char cmd[6] = { 0x0E, 0x00, x>>8, x&0xFF, y>>8, y&0xFF };
ikbd_write(cmd, 6);
}
/* Set Y=0 at bottom */
void ikbd_mouse_y0_bot(void)
{
static const char cmd[1] = { 0x0F };
ikbd_write(cmd, 1);
}
/* Set Y=0 at top */
void ikbd_mouse_y0_top(void)
{
static const char cmd[1] = { 0x10 };
ikbd_write(cmd, 1);
}
/* Resume */
void ikbd_resume(void)
{
static const char cmd[1] = { 0x11 };
ikbd_write(cmd, 1);
}
/* Disable mouse */
void ikbd_mouse_disable(void)
{
static const char cmd[1] = { 0x12 };
ikbd_write(cmd, 1);
}
/* Pause output */
void ikbd_pause(void)
{
static const char cmd[1] = { 0x13 };
ikbd_write(cmd, 1);
}
/* Set joystick event reporting */
void ikbd_joystick_event_on(void)
{
static const char cmd[1] = { 0x14 };
ikbd_write(cmd, 1);
}
/* Set joystick interrogation mode */
void ikbd_joystick_event_off(void)
{
static const char cmd[1] = { 0x15 };
ikbd_write(cmd, 1);
}
/* Joystick interrogation */
void ikbd_joystick_get_state(void)
{
static const char cmd[1] = { 0x16 };
ikbd_write(cmd, 1);
}
#if 0
/* This disables all other ikbd activities !!!! */
/* Set joystick monitoring */
void ikbd_joystick_monitor(int rate)
{
static const char cmd[2] = { 0x17, rate };
ikbd_write(cmd, 2);
kb_state.state = JOYSTICK_MONITOR;
}
#endif
/* some joystick routines not in yet (0x18-0x19) */
/* Disable joysticks */
void ikbd_joystick_disable(void)
{
static const char cmd[1] = { 0x1A };
ikbd_write(cmd, 1);
}
/* Time-of-day clock set */
void ikbd_clock_set(int year, int month, int day, int hour, int minute, int second)
{
char cmd[7] = { 0x1B, year, month, day, hour, minute, second };
ikbd_write(cmd, 7);
}
/* Interrogate time-of-day clock */
void ikbd_clock_get(int *year, int *month, int *day, int *hour, int *minute, int second)
{
static const char cmd[1] = { 0x1C };
ikbd_write(cmd, 1);
}
/* Memory load */
void ikbd_mem_write(int address, int size, char *data)
{
panic("Attempt to write data into keyboard memory");
}
/* Memory read */
void ikbd_mem_read(int address, char data[6])
{
char cmd[3] = { 0x21, address>>8, address&0xFF };
ikbd_write(cmd, 3);
/* receive data and put it in data */
}
/* Controller execute */
void ikbd_exec(int address)
{
char cmd[3] = { 0x22, address>>8, address&0xFF };
ikbd_write(cmd, 3);
}
/* Status inquiries (0x87-0x9A) not yet implemented */
/* Set the state of the caps lock led. */
void atari_kbd_leds (unsigned int leds)
{
char cmd[6] = {32, 0, 4, 1, 254 + ((leds & 4) != 0), 0};
ikbd_write(cmd, 6);
}
/*
* The original code sometimes left the interrupt line of
* the ACIAs low forever. I hope, it is fixed now.
*
* Martin Rogge, 20 Aug 1995
*/
int __init atari_keyb_init(void)
{
/* setup key map */
memcpy(key_maps[0], ataplain_map, sizeof(plain_map));
memcpy(key_maps[1], atashift_map, sizeof(plain_map));
memcpy(key_maps[4], atactrl_map, sizeof(plain_map));
memcpy(key_maps[5], atashift_ctrl_map, sizeof(plain_map));
memcpy(key_maps[8], ataalt_map, sizeof(plain_map));
/* Atari doesn't have an altgr_map, so we can reuse its memory for
atashift_alt_map */
memcpy(key_maps[2], atashift_alt_map, sizeof(plain_map));
key_maps[9] = key_maps[2];
key_maps[2] = 0; /* ataaltgr_map */
memcpy(key_maps[12], atactrl_alt_map, sizeof(plain_map));
key_maps[13] = atashift_ctrl_alt_map;
keymap_count = 8;
/* say that we don't have an AltGr key */
keyboard_type = KB_84;
kb_state.state = KEYBOARD;
kb_state.len = 0;
request_irq(IRQ_MFP_ACIA, keyboard_interrupt, IRQ_TYPE_SLOW,
"keyboard/mouse/MIDI", keyboard_interrupt);
atari_turnoff_irq(IRQ_MFP_ACIA);
do {
/* reset IKBD ACIA */
acia.key_ctrl = ACIA_RESET |
(atari_switches & ATARI_SWITCH_IKBD) ? ACIA_RHTID : 0;
(void)acia.key_ctrl;
(void)acia.key_data;
/* reset MIDI ACIA */
acia.mid_ctrl = ACIA_RESET |
(atari_switches & ATARI_SWITCH_MIDI) ? ACIA_RHTID : 0;
(void)acia.mid_ctrl;
(void)acia.mid_data;
/* divide 500kHz by 64 gives 7812.5 baud */
/* 8 data no parity 1 start 1 stop bit */
/* receive interrupt enabled */
/* RTS low (except if switch selected), transmit interrupt disabled */
acia.key_ctrl = (ACIA_DIV64|ACIA_D8N1S|ACIA_RIE) |
((atari_switches & ATARI_SWITCH_IKBD) ?
ACIA_RHTID : ACIA_RLTID);
acia.mid_ctrl = ACIA_DIV16 | ACIA_D8N1S |
(atari_switches & ATARI_SWITCH_MIDI) ? ACIA_RHTID : 0;
}
/* make sure the interrupt line is up */
while ((mfp.par_dt_reg & 0x10) == 0);
/* enable ACIA Interrupts */
mfp.active_edge &= ~0x10;
atari_turnon_irq(IRQ_MFP_ACIA);
ikbd_self_test = 1;
ikbd_reset();
/* wait for a period of inactivity (here: 0.25s), then assume the IKBD's
* self-test is finished */
self_test_last_rcv = jiffies;
while (time_before(jiffies, self_test_last_rcv + HZ/4))
barrier();
/* if not incremented: no 0xf1 received */
if (ikbd_self_test == 1)
printk( KERN_ERR "WARNING: keyboard self test failed!\n" );
ikbd_self_test = 0;
ikbd_mouse_disable();
ikbd_joystick_disable();
atari_joystick_init();
return 0;
}
int atari_kbdrate( struct kbd_repeat *k )
{
if (k->delay > 0) {
/* convert from msec to jiffies */
key_repeat_delay = (k->delay * HZ + 500) / 1000;
if (key_repeat_delay < 1)
key_repeat_delay = 1;
}
if (k->rate > 0) {
key_repeat_rate = (k->rate * HZ + 500) / 1000;
if (key_repeat_rate < 1)
key_repeat_rate = 1;
}
k->delay = key_repeat_delay * 1000 / HZ;
k->rate = key_repeat_rate * 1000 / HZ;
return( 0 );
}
int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
{
#ifdef CONFIG_MAGIC_SYSRQ
/* ALT+HELP pressed? */
if ((keycode == 98) && ((shift_state & 0xff) == 8))
*keycodep = 0xff;
else
#endif
*keycodep = keycode;
return 1;
}
......@@ -39,7 +39,6 @@
#include <asm/atariints.h>
#include <asm/atari_stram.h>
#include <asm/system.h>
#include <asm/keyboard.h>
#include <asm/machdep.h>
#include <asm/hwtest.h>
#include <asm/io.h>
......@@ -59,12 +58,6 @@ extern void atari_floppy_setup(char *, int *);
static void atari_get_model(char *model);
static int atari_get_hardware_list(char *buffer);
/* atari specific keyboard functions */
extern int atari_keyb_init(void);
extern int atari_kbdrate (struct kbd_repeat *);
extern int atari_kbd_translate(unsigned char keycode, unsigned char *keycodep,
char raw_mode);
extern void atari_kbd_leds (unsigned int);
/* atari specific irq functions */
extern void atari_init_IRQ (void);
extern int atari_request_irq (unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
......@@ -73,7 +66,6 @@ extern void atari_free_irq (unsigned int irq, void *dev_id);
extern void atari_enable_irq (unsigned int);
extern void atari_disable_irq (unsigned int);
extern int show_atari_interrupts (struct seq_file *, void *);
extern void atari_mksound( unsigned int count, unsigned int ticks );
#ifdef CONFIG_HEARTBEAT
static void atari_heartbeat( int on );
#endif
......@@ -89,18 +81,6 @@ extern int atari_tt_set_clock_mmss (unsigned long);
/* atari specific debug functions (in debug.c) */
extern void atari_debug_init(void);
#ifdef CONFIG_MAGIC_SYSRQ
static char atari_sysrq_xlate[128] =
"\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
"qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
"dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
"bnm,./\000\000\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
"\206\207\210\211\212\000\000\000\000\000-\000\000\000+\000"/* 0x40 - 0x4f */
"\000\000\000\177\000\000\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
"\000\000\000()/*789456123" /* 0x60 - 0x6f */
"0.\r\000\000\000\000\000\000\000\000\000\000\000\000\000"; /* 0x70 - 0x7f */
#endif
/* I've moved hwreg_present() and hwreg_present_bywrite() out into
* mm/hwtest.c, to avoid having multiple copies of the same routine
......@@ -254,12 +234,6 @@ void __init config_atari(void)
to 4GB. */
mach_sched_init = atari_sched_init;
#ifdef CONFIG_VT
mach_keyb_init = atari_keyb_init;
mach_kbdrate = atari_kbdrate;
mach_kbd_translate = atari_kbd_translate;
mach_kbd_leds = atari_kbd_leds;
#endif
mach_init_IRQ = atari_init_IRQ;
mach_request_irq = atari_request_irq;
mach_free_irq = atari_free_irq;
......@@ -277,15 +251,8 @@ void __init config_atari(void)
conswitchp = &dummy_con;
#endif
mach_max_dma_address = 0xffffff;
#ifdef CONFIG_VT
kd_mksound = atari_mksound;
#endif
#ifdef CONFIG_MAGIC_SYSRQ
SYSRQ_KEY = 0xff;
mach_sysrq_key = 98; /* HELP */
mach_sysrq_shift_state = 8; /* Alt */
mach_sysrq_shift_mask = 0xff; /* all modifiers except CapsLock */
mach_sysrq_xlate = atari_sysrq_xlate;
#ifdef CONFIG_INPUT_M68K_BEEP
mach_beep = atari_mksound;
#endif
#ifdef CONFIG_HEARTBEAT
mach_heartbeat = atari_heartbeat;
......
/*
* Atari Joystick Driver for Linux
* by Robert de Vries (robert@and.nl) 19Jul93
*
* 16 Nov 1994 Andreas Schwab
* Support for three button mouse (shamelessly stolen from MiNT)
* third button wired to one of the joystick directions on joystick 1
*/
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/major.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/devfs_fs_kernel.h>
#include <linux/smp_lock.h>
#include <asm/atarikb.h>
#include <asm/atari_joystick.h>
#include <asm/uaccess.h>
#define MAJOR_NR JOYSTICK_MAJOR
#define ANALOG_JOY(n) (!(n & 0x80))
#define DIGITAL_JOY(n) (minor(n) & 0x80)
#define DEVICE_NR(n) (minor(n) & 0x7f)
static struct joystick_status joystick[2];
int atari_mouse_buttons; /* for three-button mouse */
void atari_joystick_interrupt(char *buf)
{
int j;
/* ikbd_joystick_disable(); */
j = buf[0] & 0x1;
joystick[j].dir = buf[1] & 0xF;
joystick[j].fire = (buf[1] & 0x80) >> 7;
joystick[j].ready = 1;
wake_up_interruptible(&joystick[j].wait);
/* For three-button mouse emulation fake a mouse packet */
if (atari_mouse_interrupt_hook &&
j == 1 && (buf[1] & 1) != ((atari_mouse_buttons & 2) >> 1))
{
char faked_packet[3];
atari_mouse_buttons = (atari_mouse_buttons & 5) | ((buf[1] & 1) << 1);
faked_packet[0] = (atari_mouse_buttons & 1) |
(atari_mouse_buttons & 4 ? 2 : 0);
faked_packet[1] = 0;
faked_packet[2] = 0;
atari_mouse_interrupt_hook (faked_packet);
}
/* ikbd_joystick_event_on(); */
}
static int release_joystick(struct inode *inode, struct file *file)
{
int minor = DEVICE_NR(inode->i_rdev);
joystick[minor].active = 0;
joystick[minor].ready = 0;
if ((joystick[0].active == 0) && (joystick[1].active == 0))
ikbd_joystick_disable();
return 0;
}
static int open_joystick(struct inode *inode, struct file *file)
{
int minor = DEVICE_NR(inode->i_rdev);
if (!DIGITAL_JOY(inode->i_rdev) || minor > 1)
return -ENODEV;
if (joystick[minor].active)
return -EBUSY;
joystick[minor].active = 1;
joystick[minor].ready = 0;
ikbd_joystick_event_on();
return 0;
}
static ssize_t write_joystick(struct file *file, const char *buffer,
size_t count, loff_t *ppos)
{
return -EINVAL;
}
static ssize_t read_joystick(struct file *file, char *buffer, size_t count,
loff_t *ppos)
{
struct inode *inode = file->f_dentry->d_inode;
int minor = DEVICE_NR(inode->i_rdev);
if (count < 2)
return -EINVAL;
if (!joystick[minor].ready)
return -EAGAIN;
joystick[minor].ready = 0;
if (put_user(joystick[minor].fire, buffer++) ||
put_user(joystick[minor].dir, buffer++))
return -EFAULT;
if (count > 2)
if (clear_user(buffer, count - 2))
return -EFAULT;
return count;
}
static unsigned int joystick_poll(struct file *file, poll_table *wait)
{
int minor = DEVICE_NR(file->f_dentry->d_inode->i_rdev);
poll_wait(file, &joystick[minor].wait, wait);
if (joystick[minor].ready)
return POLLIN | POLLRDNORM;
return 0;
}
struct file_operations atari_joystick_fops = {
.read = read_joystick,
.write = write_joystick,
.poll = joystick_poll,
.open = open_joystick,
.release = release_joystick,
};
int __init atari_joystick_init(void)
{
joystick[0].active = joystick[1].active = 0;
joystick[0].ready = joystick[1].ready = 0;
init_waitqueue_head(&joystick[0].wait);
init_waitqueue_head(&joystick[1].wait);
if (register_chrdev(MAJOR_NR, "Joystick", &atari_joystick_fops))
printk("unable to get major %d for joystick devices\n", MAJOR_NR);
devfs_register_series (NULL, "joysticks/digital%u", 2, DEVFS_FL_DEFAULT,
MAJOR_NR, 128, S_IFCHR | S_IRUSR | S_IWUSR,
&atari_joystick_fops, NULL);
return 0;
}
......@@ -45,12 +45,9 @@ static void bvme6000_get_model(char *model);
static int bvme6000_get_hardware_list(char *buffer);
extern int bvme6000_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
extern void bvme6000_sched_init(void (*handler)(int, void *, struct pt_regs *));
extern int bvme6000_keyb_init(void);
extern int bvme6000_kbdrate (struct kbd_repeat *);
extern unsigned long bvme6000_gettimeoffset (void);
extern int bvme6000_hwclk (int, struct rtc_time *);
extern int bvme6000_set_clock_mmss (unsigned long);
extern void bvme6000_mksound( unsigned int count, unsigned int ticks );
extern void bvme6000_reset (void);
extern void bvme6000_waitbut(void);
void bvme6000_set_vectors (void);
......@@ -72,15 +69,6 @@ int bvme6000_parse_bootinfo(const struct bi_record *bi)
return 1;
}
int bvme6000_kbdrate (struct kbd_repeat *k)
{
return 0;
}
void bvme6000_mksound( unsigned int count, unsigned int ticks )
{
}
void bvme6000_reset()
{
volatile PitRegsPtr pit = (PitRegsPtr)BVME_PIT_BASE;
......@@ -133,15 +121,10 @@ void __init config_bvme6000(void)
mach_max_dma_address = 0xffffffff;
mach_sched_init = bvme6000_sched_init;
#ifdef CONFIG_VT
mach_keyb_init = bvme6000_keyb_init;
mach_kbdrate = bvme6000_kbdrate;
#endif
mach_init_IRQ = bvme6000_init_IRQ;
mach_gettimeoffset = bvme6000_gettimeoffset;
mach_hwclk = bvme6000_hwclk;
mach_set_clock_mmss = bvme6000_set_clock_mmss;
/* mach_mksound = bvme6000_mksound; */
mach_reset = bvme6000_reset;
mach_free_irq = bvme6000_free_irq;
mach_process_int = bvme6000_process_int;
......@@ -394,8 +377,3 @@ int bvme6000_set_clock_mmss (unsigned long nowtime)
return retval;
}
int bvme6000_keyb_init (void)
{
return 0;
}
......@@ -3,6 +3,7 @@
# see Documentation/kbuild/config-language.txt.
#
define_bool CONFIG_M68K y
define_bool CONFIG_UID16 y
define_bool CONFIG_RWSEM_GENERIC_SPINLOCK y
define_bool CONFIG_RWSEM_XCHGADD_ALGORITHM n
......
......@@ -17,7 +17,6 @@
#include <linux/init.h>
#include <asm/machdep.h>
#include <asm/blinken.h>
#include <asm/io.h> /* readb() and writeb() */
#include <asm/hwtest.h> /* hwreg_present() */
#include "ints.h"
......@@ -27,14 +26,6 @@ extern void hp300_reset(void);
extern void (*hp300_default_handler[])(int, void *, struct pt_regs *);
extern int show_hp300_interrupts(struct seq_file *, void *);
#ifdef CONFIG_VT
extern int hp300_keyb_init(void);
static int hp300_kbdrate(struct kbd_repeat *k)
{
return 0;
}
#endif
#ifdef CONFIG_HEARTBEAT
static void hp300_pulse(int x)
{
......@@ -53,10 +44,6 @@ static void hp300_get_model(char *model)
void __init config_hp300(void)
{
mach_sched_init = hp300_sched_init;
#ifdef CONFIG_VT
mach_keyb_init = hp300_keyb_init;
mach_kbdrate = hp300_kbdrate;
#endif
mach_init_IRQ = hp300_init_IRQ;
mach_request_irq = hp300_request_irq;
mach_free_irq = hp300_free_irq;
......
/*
* linux/arch/m68k/hp300/hil.c
*
* Copyright (C) 1998 Philip Blundell <philb@gnu.org>
*
* HP300 Human Interface Loop driver. This handles the keyboard and mouse.
*/
#include <linux/stddef.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/keyboard.h>
#include <linux/kbd_ll.h>
#include <asm/io.h>
#include <asm/hwtest.h>
#include <asm/ptrace.h>
#include <asm/irq.h>
#include <asm/system.h>
#define HILBASE 0xf0428000
#define HIL_DATA 0x1
#define HIL_CMD 0x3
#define HIL_BUSY 0x02
#define HIL_DATA_RDY 0x01
#define hil_busy() (readb(HILBASE + HIL_CMD) & HIL_BUSY)
#define hil_data_available() (readb(HILBASE + HIL_CMD) & HIL_DATA_RDY)
#define hil_status() (readb(HILBASE + HIL_CMD))
#define hil_command(x) do { writeb((x), HILBASE + HIL_CMD); } while (0)
#define hil_read_data() (readb(HILBASE + HIL_DATA))
#define hil_write_data(x) do { writeb((x), HILBASE + HIL_DATA); } while (0)
#define HIL_SETARD 0xA0 /* set auto-repeat delay */
#define HIL_SETARR 0xA2 /* set auto-repeat rate */
#define HIL_SETTONE 0xA3 /* set tone generator */
#define HIL_CNMT 0xB2 /* clear nmi */
#define HIL_INTON 0x5C /* Turn on interrupts. */
#define HIL_INTOFF 0x5D /* Turn off interrupts. */
#define HIL_TRIGGER 0xC5 /* trigger command */
#define HIL_STARTCMD 0xE0 /* start loop command */
#define HIL_TIMEOUT 0xFE /* timeout */
#define HIL_READTIME 0x13 /* Read real time register */
#define HIL_READBUSY 0x02 /* internal "busy" register */
#define HIL_READKBDLANG 0x12 /* read keyboard language code */
#define HIL_READKBDSADR 0xF9
#define HIL_WRITEKBDSADR 0xE9
#define HIL_READLPSTAT 0xFA
#define HIL_WRITELPSTAT 0xEA
#define HIL_READLPCTRL 0xFB
#define HIL_WRITELPCTRL 0xEB
#define HIL_IRQ 1
#define plain_map hp_plain_map
#define shift_map hp_shift_map
#define altgr_map hp_altgr_map
#define ctrl_map hp_ctrl_map
#define shift_ctrl_map hp_shift_ctrl_map
#define alt_map hp_alt_map
#define ctrl_alt_map hp_ctrl_alt_map
u_short plain_map[NR_KEYS] = {
0xf200, 0xf200, 0xf703, 0xf703, 0xf700, 0xf700, 0xf702, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb62, 0xfb76, 0xfb63, 0xfb78, 0xfb7a, 0xf200, 0xf200, 0xf01b,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb68, 0xfb67, 0xfb66, 0xfb64, 0xfb73, 0xfb61, 0xf200, 0xf207,
0xfb75, 0xfb79, 0xfb74, 0xfb72, 0xfb65, 0xfb77, 0xfb71, 0xf009,
0xf037, 0xf036, 0xf035, 0xf034, 0xf033, 0xf032, 0xf031, 0xf060,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf103, 0xf102, 0xf101, 0xf100, 0xf200, 0xf200, 0xf200,
0xf200, 0xf104, 0xf105, 0xf106, 0xf107, 0xf200, 0xf200, 0xf200,
0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf008, 0xf200, 0xf200,
0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf05c, 0xf200, 0xf200,
0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf201, 0xf200, 0xf200,
0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb6e, 0xf020, 0xf200, 0xf200, 0xf601, 0xf600, 0xf603, 0xf602,
};
u_short shift_map[NR_KEYS] = {
0xf200, 0xf200, 0xf703, 0xf703, 0xf700, 0xf700, 0xf702, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb42, 0xfb56, 0xfb43, 0xfb58, 0xfb5a, 0xf200, 0xf200, 0xf07f,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb48, 0xfb47, 0xfb46, 0xfb44, 0xfb53, 0xfb41, 0xf200, 0xf207,
0xfb55, 0xfb59, 0xfb54, 0xfb52, 0xfb45, 0xfb57, 0xfb51, 0xf009,
0xf026, 0xf05e, 0xf025, 0xf024, 0xf023, 0xf040, 0xf021, 0xf07e,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf103, 0xf102, 0xf101, 0xf100, 0xf200, 0xf200, 0xf200,
0xf200, 0xf104, 0xf105, 0xf106, 0xf107, 0xf200, 0xf200, 0xf200,
0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf200, 0xf200, 0xf200,
0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf07c, 0xf200, 0xf200,
0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf201, 0xf200, 0xf200,
0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb4e, 0xf020, 0xf200, 0xf200, 0xf601, 0xf600, 0xf603, 0xf602,
};
u_short altgr_map[NR_KEYS] = {
0xf200, 0xf200, 0xf703, 0xf703, 0xf700, 0xf700, 0xf702, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb62, 0xfb76, 0xfb63, 0xfb78, 0xfb7a, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb68, 0xfb67, 0xfb66, 0xfb64, 0xfb73, 0xfb61, 0xf200, 0xf207,
0xfb75, 0xfb79, 0xfb74, 0xfb72, 0xfb65, 0xfb77, 0xfb71, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf040, 0xf021, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf103, 0xf102, 0xf101, 0xf100, 0xf200, 0xf200, 0xf200,
0xf200, 0xf104, 0xf105, 0xf106, 0xf107, 0xf200, 0xf200, 0xf200,
0xf02a, 0xf05b, 0xf05d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb69, 0xfb6f, 0xfb70, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb6a, 0xfb6b, 0xfb6c, 0xf200, 0xf200, 0xf201, 0xf200, 0xf200,
0xfb6d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xfb6e, 0xf200, 0xf200, 0xf200, 0xf601, 0xf600, 0xf603, 0xf602,
};
u_short ctrl_map[NR_KEYS] = {
0xf200, 0xf200, 0xf703, 0xf703, 0xf700, 0xf700, 0xf702, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf002, 0xf016, 0xf003, 0xf018, 0xf01a, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf008, 0xf007, 0xf006, 0xf004, 0xf013, 0xf001, 0xf200, 0xf207,
0xf015, 0xf019, 0xf014, 0xf012, 0xf005, 0xf017, 0xf011, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf000,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf503, 0xf502, 0xf501, 0xf500, 0xf200, 0xf200, 0xf200,
0xf200, 0xf504, 0xf505, 0xf506, 0xf507, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf009, 0xf00f, 0xf010, 0xf200, 0xf200, 0xf01c, 0xf200, 0xf200,
0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf007, 0xf201, 0xf200, 0xf200,
0xf00d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf00e, 0xf200, 0xf200, 0xf200, 0xf601, 0xf600, 0xf603, 0xf602,
};
u_short shift_ctrl_map[NR_KEYS] = {
0xf200, 0xf200, 0xf703, 0xf703, 0xf700, 0xf700, 0xf702, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf002, 0xf016, 0xf003, 0xf018, 0xf01a, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf008, 0xf007, 0xf006, 0xf004, 0xf013, 0xf001, 0xf200, 0xf207,
0xf015, 0xf019, 0xf014, 0xf012, 0xf005, 0xf017, 0xf011, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf103, 0xf102, 0xf101, 0xf100, 0xf200, 0xf200, 0xf200,
0xf200, 0xf104, 0xf105, 0xf106, 0xf107, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf009, 0xf00f, 0xf010, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf00a, 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf201, 0xf200, 0xf200,
0xf00d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf00e, 0xf200, 0xf200, 0xf200, 0xf601, 0xf600, 0xf603, 0xf602,
};
u_short alt_map[NR_KEYS] = {
0xf200, 0xf200, 0xf703, 0xf703, 0xf700, 0xf700, 0xf702, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf862, 0xf876, 0xf863, 0xf878, 0xf87a, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf868, 0xf867, 0xf866, 0xf864, 0xf873, 0xf861, 0xf200, 0xf207,
0xf875, 0xf879, 0xf874, 0xf872, 0xf865, 0xf877, 0xf871, 0xf809,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf860,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf103, 0xf102, 0xf101, 0xf100, 0xf200, 0xf200, 0xf200,
0xf200, 0xf104, 0xf105, 0xf106, 0xf107, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf869, 0xf86f, 0xf870, 0xf200, 0xf200, 0xf85c, 0xf200, 0xf200,
0xf86a, 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf201, 0xf200, 0xf200,
0xf86d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf86e, 0xf200, 0xf200, 0xf200, 0xf601, 0xf600, 0xf603, 0xf602,
};
u_short ctrl_alt_map[NR_KEYS] = {
0xf200, 0xf200, 0xf703, 0xf703, 0xf700, 0xf700, 0xf702, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf802, 0xf816, 0xf803, 0xf818, 0xf81a, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf808, 0xf807, 0xf806, 0xf804, 0xf813, 0xf801, 0xf200, 0xf207,
0xf815, 0xf819, 0xf814, 0xf812, 0xf805, 0xf817, 0xf811, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf103, 0xf102, 0xf101, 0xf100, 0xf200, 0xf200, 0xf200,
0xf200, 0xf104, 0xf105, 0xf106, 0xf107, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf809, 0xf80f, 0xf810, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf80a, 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf201, 0xf200, 0xf200,
0xf80d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf80e, 0xf200, 0xf200, 0xf200, 0xf601, 0xf600, 0xf603, 0xf602,
};
#undef plain_map
#undef ctrl_alt_map
#undef shift_map
#undef altgr_map
#undef ctrl_map
#undef shift_ctrl_map
#undef alt_map
struct {
unsigned char s, c;
int valid;
} hil_last;
#define hil_getlast(s,c) do { s = hil_last.s; c = hil_last.c; hil_last.valid = 0; } while (0)
struct {
unsigned char data[16];
unsigned int ptr;
} poll;
unsigned char curdev = 0;
static void poll_finished(void)
{
switch (poll.data[0])
{
case 0x40:
{
int down = (poll.data[1] & 1) == 0;
unsigned char scode = poll.data[1] >> 1;
#if 0
if (down)
printk("[%02x]", scode);
#endif
handle_scancode(scode, down);
}
break;
}
curdev = 0;
}
static inline void handle_status(unsigned char s, unsigned char c)
{
if (c & 0x8) {
/* End of block */
if (c & 0x10)
poll_finished();
} else {
if (c & 0x10) {
if (curdev)
poll_finished(); /* just in case */
curdev = c & 7;
poll.ptr = 0;
}
}
}
static inline void handle_data(unsigned char s, unsigned char c)
{
if (curdev)
poll.data[poll.ptr++] = c;
}
/*
* Handle HIL interrupts.
*/
static void hil_interrupt(int irq, void *handle, struct pt_regs *regs)
{
unsigned char s, c;
s = hil_status(); c = hil_read_data();
switch (s >> 4)
{
case 0x5:
handle_status(s, c);
break;
case 0x6:
handle_data(s, c);
break;
case 0x4:
hil_last.s = s;
hil_last.c = c;
mb();
hil_last.valid = 1;
break;
}
}
/*
* Send a command to the HIL
*/
static void hil_do(unsigned char cmd, unsigned char *data, unsigned int len)
{
unsigned long flags;
save_flags(flags); cli();
while (hil_busy());
hil_command(cmd);
while (len--) {
while (hil_busy());
hil_write_data(*(data++));
}
restore_flags(flags);
}
/*
* Initialise HIL.
*/
int __init hp300_keyb_init(void)
{
unsigned char s, c, kbid;
unsigned int n = 0;
memcpy(key_maps[0], hp_plain_map, sizeof(plain_map));
memcpy(key_maps[1], hp_shift_map, sizeof(plain_map));
memcpy(key_maps[4], hp_ctrl_map, sizeof(plain_map));
if (!hwreg_present((void *)(HILBASE + HIL_DATA)))
return 1; /* maybe this can happen */
request_irq(HIL_IRQ, hil_interrupt, 0, "HIL", NULL);
/* Turn on interrupts */
hil_do(HIL_INTON, NULL, 0);
/* Look for keyboards */
hil_do(HIL_READKBDSADR, NULL, 0);
while (!hil_last.valid) {
if (n++ > 100000) {
printk("HIL: timed out, assuming no keyboard present.\n");
return 1;
}
mb();
}
hil_getlast(s, c);
if (c == 0) {
printk("HIL: no keyboard present.\n");
return 1;
}
for (kbid = 0; (kbid < 8) && ((c & (1<<kbid)) == 0); kbid++);
printk("HIL: keyboard found at id %d\n", kbid);
/* set it to raw mode */
c = 0;
hil_do(HIL_WRITEKBDSADR, &c, 1);
return 0;
}
......@@ -71,13 +71,6 @@ char saved_command_line[CL_SIZE];
char m68k_debug_device[6] = "";
void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *)) __initdata = NULL;
/* machine dependent keyboard functions */
#ifdef CONFIG_VT
int (*mach_keyb_init) (void) __initdata = NULL;
int (*mach_kbdrate) (struct kbd_repeat *) = NULL;
void (*mach_kbd_leds) (unsigned int) = NULL;
int (*mach_kbd_translate)(unsigned char scancode, unsigned char *keycode, char raw_mode) = NULL;
#endif
/* machine dependent irq functions */
void (*mach_init_IRQ) (void) __initdata = NULL;
void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL;
......@@ -89,6 +82,8 @@ void (*mach_process_int) (int, struct pt_regs *) = NULL;
unsigned long (*mach_gettimeoffset) (void);
int (*mach_hwclk) (int, struct rtc_time*) = NULL;
int (*mach_set_clock_mmss) (unsigned long) = NULL;
int (*mach_get_rtc_pll)(struct rtc_pll_info *) = NULL;
int (*mach_set_rtc_pll)(struct rtc_pll_info *) = NULL;
void (*mach_reset)( void );
void (*mach_halt)( void ) = NULL;
void (*mach_power_off)( void ) = NULL;
......@@ -103,15 +98,9 @@ EXPORT_SYMBOL(mach_heartbeat);
#ifdef CONFIG_M68K_L2_CACHE
void (*mach_l2_flush) (int) = NULL;
#endif
#ifdef CONFIG_MAGIC_SYSRQ
unsigned int SYSRQ_KEY;
int mach_sysrq_key = -1;
int mach_sysrq_shift_state = 0;
int mach_sysrq_shift_mask = 0;
char *mach_sysrq_xlate = NULL;
#ifdef CONFIG_INPUT_M68K_BEEP
void (*mach_beep)(unsigned int, unsigned int) = NULL;
#endif
#if defined(CONFIG_ISA) && defined(MULTI_ISA)
int isa_type;
int isa_sex;
......
......@@ -78,27 +78,12 @@ extern void oss_init(void);
extern void psc_init(void);
extern void baboon_init(void);
extern void mac_mksound(unsigned int, unsigned int);
extern void nubus_sweep_video(void);
/* Mac specific debug functions (in debug.c) */
extern void mac_debug_init(void);
extern void mac_debugging_long(int, long);
extern int mackbd_init_hw(void);
extern void mackbd_leds(unsigned int leds);
extern int mackbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode);
extern void mac_hid_init_hw(void);
extern int mac_hid_kbd_translate(unsigned char scancode, unsigned char *keycode, char raw_mode);
#ifdef CONFIG_MAGIC_SYSRQ
extern unsigned char mac_hid_kbd_sysrq_xlate[128];
extern unsigned char pckbd_sysrq_xlate[128];
extern unsigned char mackbd_sysrq_xlate[128];
#endif /* CONFIG_MAGIC_SYSRQ */
static void mac_get_model(char *str);
void mac_bang(int irq, void *vector, struct pt_regs *p)
......@@ -207,33 +192,6 @@ void __init config_mac(void)
printk("ERROR: no Mac, but config_mac() called!! \n");
}
#ifdef CONFIG_VT
#ifdef CONFIG_INPUT_ADBHID
mach_keyb_init = mac_hid_init_hw;
mach_kbd_translate = mac_hid_kbd_translate;
#ifdef CONFIG_MAGIC_SYSRQ
#ifdef CONFIG_MAC_ADBKEYCODES
if (!keyboard_sends_linux_keycodes) {
mach_sysrq_xlate = mac_hid_kbd_sysrq_xlate;
SYSRQ_KEY = 0x69;
} else
#endif /* CONFIG_MAC_ADBKEYCODES */
{
mach_sysrq_xlate = pckbd_sysrq_xlate;
SYSRQ_KEY = 0x54;
}
#endif /* CONFIG_MAGIC_SYSRQ */
#elif defined(CONFIG_ADB_KEYBOARD)
mach_keyb_init = mackbd_init_hw;
mach_kbd_leds = mackbd_leds;
mach_kbd_translate = mackbd_translate;
#ifdef CONFIG_MAGIC_SYSRQ
mach_sysrq_xlate = mackbd_sysrq_xlate;
SYSRQ_KEY = 0x69;
#endif /* CONFIG_MAGIC_SYSRQ */
#endif /* CONFIG_INPUT_ADBHID */
#endif /* CONFIG_VT */
mach_sched_init = mac_sched_init;
mach_init_IRQ = mac_init_IRQ;
mach_request_irq = mac_request_irq;
......@@ -249,9 +207,6 @@ void __init config_mac(void)
mach_hwclk = mac_hwclk;
#endif
mach_set_clock_mmss = mac_set_clock_mmss;
#if 0
mach_mksound = mac_mksound;
#endif
mach_reset = mac_reset;
mach_halt = mac_poweroff;
mach_power_off = mac_poweroff;
......@@ -262,8 +217,8 @@ void __init config_mac(void)
#if 0
mach_debug_init = mac_debug_init;
#endif
#ifdef CONFIG_VT
kd_mksound = mac_mksound;
#ifdef CONFIG_INPUT_M68K_BEEP
mach_beep = mac_mksound;
#endif
#ifdef CONFIG_HEARTBEAT
#if 0
......@@ -287,10 +242,6 @@ void __init config_mac(void)
|| macintosh_config->ident == MAC_MODEL_IIFX) {
mach_l2_flush = mac_cache_card_flush;
}
#ifdef MAC_DEBUG_SOUND
/* goes on forever if timers broken */
mac_mksound(1000,10);
#endif
/*
* Check for machine specific fixups.
......
......@@ -45,8 +45,6 @@ static void mvme147_get_model(char *model);
static int mvme147_get_hardware_list(char *buffer);
extern int mvme147_request_irq (unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
extern void mvme147_sched_init(void (*handler)(int, void *, struct pt_regs *));
extern int mvme147_keyb_init(void);
extern int mvme147_kbdrate (struct kbd_repeat *);
extern unsigned long mvme147_gettimeoffset (void);
extern int mvme147_hwclk (int, struct rtc_time *);
extern int mvme147_set_clock_mmss (unsigned long);
......@@ -70,11 +68,6 @@ int mvme147_parse_bootinfo(const struct bi_record *bi)
return 1;
}
int mvme147_kbdrate (struct kbd_repeat *k)
{
return 0;
}
void mvme147_reset()
{
printk ("\r\n\nCalled mvme147_reset\r\n");
......@@ -102,10 +95,6 @@ void __init config_mvme147(void)
{
mach_max_dma_address = 0x01000000;
mach_sched_init = mvme147_sched_init;
#ifdef CONFIG_VT
mach_keyb_init = mvme147_keyb_init;
mach_kbdrate = mvme147_kbdrate;
#endif
mach_init_IRQ = mvme147_init_IRQ;
mach_gettimeoffset = mvme147_gettimeoffset;
mach_hwclk = mvme147_hwclk;
......
......@@ -49,12 +49,9 @@ static void mvme16x_get_model(char *model);
static int mvme16x_get_hardware_list(char *buffer);
extern int mvme16x_request_irq(unsigned int irq, void (*handler)(int, void *, struct pt_regs *), unsigned long flags, const char *devname, void *dev_id);
extern void mvme16x_sched_init(void (*handler)(int, void *, struct pt_regs *));
extern int mvme16x_keyb_init(void);
extern int mvme16x_kbdrate (struct kbd_repeat *);
extern unsigned long mvme16x_gettimeoffset (void);
extern int mvme16x_hwclk (int, struct rtc_time *);
extern int mvme16x_set_clock_mmss (unsigned long);
extern void mvme16x_mksound( unsigned int count, unsigned int ticks );
extern void mvme16x_reset (void);
extern void mvme16x_waitbut(void);
......@@ -77,15 +74,6 @@ int mvme16x_parse_bootinfo(const struct bi_record *bi)
return 1;
}
int mvme16x_kbdrate (struct kbd_repeat *k)
{
return 0;
}
void mvme16x_mksound( unsigned int count, unsigned int ticks )
{
}
void mvme16x_reset()
{
printk ("\r\n\nCalled mvme16x_reset\r\n"
......@@ -144,17 +132,10 @@ void __init config_mvme16x(void)
mach_max_dma_address = 0xffffffff;
mach_sched_init = mvme16x_sched_init;
#ifdef CONFIG_VT
mach_keyb_init = mvme16x_keyb_init;
mach_kbdrate = mvme16x_kbdrate;
#endif
mach_init_IRQ = mvme16x_init_IRQ;
mach_gettimeoffset = mvme16x_gettimeoffset;
mach_hwclk = mvme16x_hwclk;
mach_set_clock_mmss = mvme16x_set_clock_mmss;
#ifdef CONFIG_VT
/* kd_mksound = mvme16x_mksound; */
#endif
mach_reset = mvme16x_reset;
mach_free_irq = mvme16x_free_irq;
mach_process_int = mvme16x_process_int;
......@@ -301,8 +282,3 @@ int mvme16x_set_clock_mmss (unsigned long nowtime)
return 0;
}
int mvme16x_keyb_init (void)
{
return 0;
}
......@@ -36,12 +36,9 @@
#include <asm/rtc.h>
#include <asm/machdep.h>
#include <asm/q40_master.h>
#include <asm/keyboard.h>
extern void floppy_setup(char *str, int *ints);
extern int q40kbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode);
extern void q40_process_int (int level, struct pt_regs *regs);
extern void (*q40_sys_default_handler[]) (int, void *, struct pt_regs *); /* added just for debugging */
extern void q40_init_IRQ (void);
......@@ -62,8 +59,6 @@ void q40_halt(void);
extern void q40_waitbut(void);
void q40_set_vectors (void);
void q40_mksound(unsigned int /*freq*/, unsigned int /*ticks*/ );
extern char *saved_command_line;
extern char m68k_debug_device[];
static void q40_mem_console_write(struct console *co, const char *b,
......@@ -82,14 +77,6 @@ static struct console q40_console_driver = {
extern char *q40_mem_cptr; /*=(char *)0xff020000;*/
static int _cpleft;
#if 0
int q40_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
{
*keycodep = keycode;
return 1;
}
#endif
static void q40_mem_console_write(struct console *co, const char *s,
unsigned int count)
{
......@@ -117,13 +104,6 @@ void printq40(char *str)
}
#endif
#if 0
int q40_kbdrate (struct kbd_repeat *k)
{
return 0;
}
#endif
static int halted=0;
#ifdef CONFIG_HEARTBEAT
......@@ -185,10 +165,6 @@ void __init config_q40(void)
{
mach_sched_init = q40_sched_init;
#ifdef CONFIG_VT
mach_keyb_init = q40kbd_init_hw;
mach_kbd_translate = q40kbd_translate;
#endif
mach_init_IRQ = q40_init_IRQ;
mach_gettimeoffset = q40_gettimeoffset;
mach_hwclk = q40_hwclk;
......@@ -204,12 +180,9 @@ void __init config_q40(void)
mach_default_handler = &q40_sys_default_handler;
mach_get_model = q40_get_model;
mach_get_hardware_list = q40_get_hardware_list;
#ifdef CONFIG_VT
kd_mksound = q40_mksound;
#endif
#ifdef CONFIG_MAGIC_SYSRQ
mach_sysrq_key = 0x54;
#ifdef CONFIG_INPUT_M68K_BEEP
mach_beep = q40_mksound;
#endif
#ifdef CONFIG_HEARTBEAT
mach_heartbeat = q40_heartbeat;
......
/*
* linux/arch/m68k/amiga/amikeyb.c
*
* Amiga Keyboard driver for Linux/m68k
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file COPYING in the main directory of this archive
* for more details.
*/
/*
* Amiga support by Hamish Macdonald
*/
#include <linux/config.h>
#include <linux/types.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/keyboard.h>
#include <linux/kd.h>
#include <linux/kbd_ll.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/random.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/kbd_kern.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
#include <asm/irq.h>
#define AMIKEY_CAPS (0x62)
#define BREAK_MASK (0x80)
#define RESET_WARNING (0xf0) /* before rotation */
static u_short amiplain_map[NR_KEYS] __initdata = {
0xf060, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037,
0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf05c, 0xf200, 0xf300,
0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69,
0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf200, 0xf301, 0xf302, 0xf303,
0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b,
0xfb6c, 0xf03b, 0xf027, 0xf200, 0xf200, 0xf304, 0xf305, 0xf306,
0xf200, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d,
0xf02c, 0xf02e, 0xf02f, 0xf200, 0xf310, 0xf307, 0xf308, 0xf309,
0xf020, 0xf07f, 0xf009, 0xf30e, 0xf201, 0xf01b, 0xf07f, 0xf200,
0xf200, 0xf200, 0xf30b, 0xf200, 0xf603, 0xf600, 0xf602, 0xf601,
0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107,
0xf108, 0xf109, 0xf312, 0xf313, 0xf30d, 0xf30c, 0xf30a, 0xf11b,
0xf700, 0xf700, 0xf207, 0xf702, 0xf703, 0xf701, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short amishift_map[NR_KEYS] __initdata = {
0xf07e, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026,
0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07c, 0xf200, 0xf300,
0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49,
0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf200, 0xf301, 0xf302, 0xf303,
0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b,
0xfb4c, 0xf03a, 0xf022, 0xf200, 0xf200, 0xf304, 0xf305, 0xf306,
0xf200, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d,
0xf03c, 0xf03e, 0xf03f, 0xf200, 0xf310, 0xf307, 0xf308, 0xf309,
0xf020, 0xf07f, 0xf009, 0xf30e, 0xf201, 0xf01b, 0xf07f, 0xf200,
0xf200, 0xf200, 0xf30b, 0xf200, 0xf603, 0xf600, 0xf602, 0xf601,
0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111,
0xf112, 0xf113, 0xf208, 0xf209, 0xf30d, 0xf30c, 0xf30a, 0xf203,
0xf700, 0xf700, 0xf207, 0xf702, 0xf703, 0xf701, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short amialtgr_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf040, 0xf200, 0xf024, 0xf200, 0xf200, 0xf07b,
0xf05b, 0xf05d, 0xf07d, 0xf05c, 0xf200, 0xf200, 0xf200, 0xf300,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf07e, 0xf200, 0xf301, 0xf302, 0xf303,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf304, 0xf305, 0xf306,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf310, 0xf307, 0xf308, 0xf309,
0xf200, 0xf07f, 0xf200, 0xf30e, 0xf201, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf30b, 0xf200, 0xf603, 0xf600, 0xf602, 0xf601,
0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513,
0xf514, 0xf515, 0xf208, 0xf209, 0xf30d, 0xf30c, 0xf30a, 0xf204,
0xf700, 0xf700, 0xf207, 0xf702, 0xf703, 0xf701, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short amictrl_map[NR_KEYS] __initdata = {
0xf000, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f,
0xf07f, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf01c, 0xf200, 0xf300,
0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009,
0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf200, 0xf301, 0xf302, 0xf303,
0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b,
0xf00c, 0xf200, 0xf007, 0xf200, 0xf200, 0xf304, 0xf305, 0xf306,
0xf200, 0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf00d,
0xf200, 0xf200, 0xf07f, 0xf200, 0xf310, 0xf307, 0xf308, 0xf309,
0xf000, 0xf07f, 0xf200, 0xf30e, 0xf201, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf30b, 0xf200, 0xf603, 0xf600, 0xf602, 0xf601,
0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107,
0xf108, 0xf109, 0xf208, 0xf209, 0xf30d, 0xf30c, 0xf30a, 0xf202,
0xf700, 0xf700, 0xf207, 0xf702, 0xf703, 0xf701, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short amishift_ctrl_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf300,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf301, 0xf302, 0xf303,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf304, 0xf305, 0xf306,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf310, 0xf307, 0xf308, 0xf309,
0xf200, 0xf07f, 0xf200, 0xf30e, 0xf201, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf30b, 0xf200, 0xf603, 0xf600, 0xf602, 0xf601,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf208, 0xf209, 0xf30d, 0xf30c, 0xf30a, 0xf200,
0xf700, 0xf700, 0xf207, 0xf702, 0xf703, 0xf701, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short amialt_map[NR_KEYS] __initdata = {
0xf860, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837,
0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf85c, 0xf200, 0xf900,
0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869,
0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf200, 0xf901, 0xf902, 0xf903,
0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b,
0xf86c, 0xf83b, 0xf827, 0xf200, 0xf200, 0xf904, 0xf905, 0xf906,
0xf200, 0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d,
0xf82c, 0xf82e, 0xf82f, 0xf200, 0xf310, 0xf907, 0xf908, 0xf909,
0xf820, 0xf87f, 0xf809, 0xf30e, 0xf80d, 0xf81b, 0xf87f, 0xf200,
0xf200, 0xf200, 0xf30b, 0xf200, 0xf603, 0xf600, 0xf602, 0xf601,
0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507,
0xf508, 0xf509, 0xf208, 0xf209, 0xf30d, 0xf30c, 0xf30a, 0xf204,
0xf700, 0xf700, 0xf207, 0xf702, 0xf703, 0xf701, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
static u_short amictrl_alt_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf300,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf301, 0xf302, 0xf303,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf304, 0xf305, 0xf306,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf20c, 0xf307, 0xf308, 0xf309,
0xf200, 0xf07f, 0xf200, 0xf30e, 0xf201, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf30b, 0xf200, 0xf603, 0xf600, 0xf602, 0xf601,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf208, 0xf209, 0xf30d, 0xf30c, 0xf30a, 0xf200,
0xf700, 0xf700, 0xf207, 0xf702, 0xf703, 0xf701, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
};
#define DEFAULT_KEYB_REP_DELAY (HZ/4)
#define DEFAULT_KEYB_REP_RATE (HZ/25)
/* These could be settable by some ioctl() in future... */
static unsigned int key_repeat_delay = DEFAULT_KEYB_REP_DELAY;
static unsigned int key_repeat_rate = DEFAULT_KEYB_REP_RATE;
static unsigned char rep_scancode;
static void amikeyb_rep(unsigned long ignore);
static struct timer_list amikeyb_rep_timer = {function: amikeyb_rep};
static void amikeyb_rep(unsigned long ignore)
{
unsigned long flags;
save_flags(flags);
cli();
kbd_pt_regs = NULL;
amikeyb_rep_timer.expires = jiffies + key_repeat_rate;
add_timer(&amikeyb_rep_timer);
handle_scancode(rep_scancode, 1);
restore_flags(flags);
}
static void keyboard_interrupt(int irq, void *dummy, struct pt_regs *fp)
{
unsigned char scancode, break_flag, keycode;
static int reset_warning = 0;
/* save frame for register dump */
kbd_pt_regs = fp;
/* get and invert scancode (keyboard is active low) */
scancode = ~ciaa.sdr;
/* switch SP pin to output for handshake */
ciaa.cra |= 0x40;
#if 0 /* No longer used */
/*
* On receipt of the second RESET_WARNING, we must not pull KDAT high
* again to delay the hard reset as long as possible.
*
* Note that not all keyboards send reset warnings...
*/
if (reset_warning)
if (scancode == RESET_WARNING) {
printk(KERN_ALERT "amikeyb: Ctrl-Amiga-Amiga reset warning!!\n"
"The system will be reset within 10 seconds!!\n");
/* Panic doesn't sync from within an interrupt, so we do nothing */
return;
} else
/* Probably a mistake, cancel the alert */
reset_warning = 0;
#endif
/* wait until 85 us have expired */
udelay(85);
/* switch CIA serial port to input mode */
ciaa.cra &= ~0x40;
tasklet_schedule(&keyboard_tasklet);
/* rotate scan code to get up/down bit in proper position */
scancode = ((scancode >> 1) & 0x7f) | ((scancode << 7) & 0x80);
/*
* Check make/break first
*/
break_flag = scancode & BREAK_MASK;
keycode = scancode & (unsigned char)~BREAK_MASK;
if (keycode == AMIKEY_CAPS) {
/* if the key is CAPS, fake a press/release. */
handle_scancode(AMIKEY_CAPS, 1);
handle_scancode(AMIKEY_CAPS, 0);
} else if (keycode < 0x78) {
/* handle repeat */
if (break_flag) {
del_timer(&amikeyb_rep_timer);
rep_scancode = 0;
} else {
del_timer(&amikeyb_rep_timer);
rep_scancode = keycode;
amikeyb_rep_timer.expires = jiffies + key_repeat_delay;
add_timer(&amikeyb_rep_timer);
}
handle_scancode(keycode, !break_flag);
} else
switch (keycode) {
case 0x78:
reset_warning = 1;
break;
case 0x79:
printk(KERN_WARNING "amikeyb: keyboard lost sync\n");
break;
case 0x7a:
printk(KERN_WARNING "amikeyb: keyboard buffer overflow\n");
break;
#if 0 /* obsolete according to the HRM */
case 0x7b:
printk(KERN_WARNING "amikeyb: keyboard controller failure\n");
break;
#endif
case 0x7c:
printk(KERN_ERR "amikeyb: keyboard selftest failure\n");
break;
case 0x7d:
printk(KERN_INFO "amikeyb: initiate power-up key stream\n");
break;
case 0x7e:
printk(KERN_INFO "amikeyb: terminate power-up key stream\n");
break;
#if 0 /* obsolete according to the HRM */
case 0x7f:
printk(KERN_WARNING "amikeyb: keyboard interrupt\n");
break;
#endif
default:
printk(KERN_WARNING "amikeyb: unknown keyboard communication code 0x%02x\n",
scancode);
break;
}
}
int __init amiga_keyb_init(void)
{
if (!AMIGAHW_PRESENT(AMI_KEYBOARD))
return -EIO;
if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb"))
return -EBUSY;
/* setup key map */
memcpy(key_maps[0], amiplain_map, sizeof(plain_map));
memcpy(key_maps[1], amishift_map, sizeof(plain_map));
memcpy(key_maps[2], amialtgr_map, sizeof(plain_map));
memcpy(key_maps[4], amictrl_map, sizeof(plain_map));
memcpy(key_maps[5], amishift_ctrl_map, sizeof(plain_map));
memcpy(key_maps[8], amialt_map, sizeof(plain_map));
memcpy(key_maps[12], amictrl_alt_map, sizeof(plain_map));
/*
* Initialize serial data direction.
*/
ciaa.cra &= ~0x41; /* serial data in, turn off TA */
/*
* arrange for processing of keyboard interrupt
*/
request_irq(IRQ_AMIGA_CIAA_SP, keyboard_interrupt, 0, "keyboard", NULL);
return 0;
}
int amiga_kbdrate( struct kbd_repeat *k )
{
if (k->delay > 0) {
/* convert from msec to jiffies */
key_repeat_delay = (k->delay * HZ + 500) / 1000;
if (key_repeat_delay < 1)
key_repeat_delay = 1;
}
if (k->rate > 0) {
key_repeat_rate = (k->rate * HZ + 500) / 1000;
if (key_repeat_rate < 1)
key_repeat_rate = 1;
}
k->delay = key_repeat_delay * 1000 / HZ;
k->rate = key_repeat_rate * 1000 / HZ;
return( 0 );
}
int amiga_kbd_translate(unsigned char keycode, unsigned char *keycodep, char raw_mode)
{
#ifdef CONFIG_MAGIC_SYSRQ
/* SHIFT+ALTGR+HELP pressed? */
if ((keycode == 0x5f) && ((shift_state & 0xff) == 3))
*keycodep = 0xff;
else
#endif
*keycodep = keycode;
return 1;
}
/*
* Atari Mouse Driver for Linux
* by Robert de Vries (robert@and.nl) 19Jul93
*
* 16 Nov 1994 Andreas Schwab
* Compatibility with busmouse
* Support for three button mouse (shamelessly stolen from MiNT)
* third button wired to one of the joystick directions on joystick 1
*
* 1996/02/11 Andreas Schwab
* Module support
* Allow multiple open's
*
* Converted to use new generic busmouse code. 5 Apr 1998
* Russell King <rmk@arm.uk.linux.org>
*/
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/errno.h>
#include <linux/miscdevice.h>
#include <linux/mm.h>
#include <linux/random.h>
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/logibusmouse.h>
#include <asm/setup.h>
#include <asm/atarikb.h>
#include <asm/uaccess.h>
#include "busmouse.h"
static int msedev;
static int mouse_threshold[2] = {2,2};
MODULE_PARM(mouse_threshold, "2i");
extern int atari_mouse_buttons;
static void atari_mouse_interrupt(char *buf)
{
int buttons;
/* ikbd_mouse_disable(); */
buttons = ((buf[0] & 1)
| ((buf[0] & 2) << 1)
| (atari_mouse_buttons & 2));
atari_mouse_buttons = buttons;
busmouse_add_movementbuttons(msedev, buf[1], -buf[2], buttons ^ 7);
/* ikbd_mouse_rel_pos(); */
}
static int release_mouse(struct inode *inode, struct file *file)
{
ikbd_mouse_disable();
atari_mouse_interrupt_hook = NULL;
return 0;
}
static int open_mouse(struct inode *inode, struct file *file)
{
atari_mouse_buttons = 0;
ikbd_mouse_y0_top ();
ikbd_mouse_thresh (mouse_threshold[0], mouse_threshold[1]);
ikbd_mouse_rel_pos();
atari_mouse_interrupt_hook = atari_mouse_interrupt;
return 0;
}
static struct busmouse atarimouse = {
ATARIMOUSE_MINOR, "atarimouse", THIS_MODULE, open_mouse, release_mouse, 0
};
static int __init atari_mouse_init(void)
{
if (!MACH_IS_ATARI)
return -ENODEV;
msedev = register_busmouse(&atarimouse);
if (msedev < 0)
printk(KERN_WARNING "Unable to register Atari mouse driver.\n");
else
printk(KERN_INFO "Atari mouse installed.\n");
return msedev < 0 ? msedev : 0;
}
#ifndef MODULE
#define MIN_THRESHOLD 1
#define MAX_THRESHOLD 20 /* more seems not reasonable... */
static int __init atari_mouse_setup( char *str )
{
int ints[8];
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] < 1) {
printk(KERN_ERR "atari_mouse_setup: no arguments!\n" );
return 0;
}
else if (ints[0] > 2) {
printk(KERN_WARNING "atari_mouse_setup: too many arguments\n" );
}
if (ints[1] < MIN_THRESHOLD || ints[1] > MAX_THRESHOLD)
printk(KERN_WARNING "atari_mouse_setup: bad threshold value (ignored)\n" );
else {
mouse_threshold[0] = ints[1];
mouse_threshold[1] = ints[1];
if (ints[0] > 1) {
if (ints[2] < MIN_THRESHOLD || ints[2] > MAX_THRESHOLD)
printk(KERN_WARNING "atari_mouse_setup: bad threshold value (ignored)\n" );
else
mouse_threshold[1] = ints[2];
}
}
return 1;
}
__setup("atarimouse=",atari_mouse_setup);
#endif /* !MODULE */
static void __exit atari_mouse_cleanup (void)
{
unregister_busmouse(msedev);
}
module_init(atari_mouse_init);
module_exit(atari_mouse_cleanup);
MODULE_LICENSE("GPL");
\ No newline at end of file
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/keyboard.h>
#include <linux/delay.h>
#include <linux/timer.h>
#include <linux/kd.h>
#include <linux/kbd_ll.h>
#include <linux/random.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/poll.h>
#include <linux/miscdevice.h>
#include <linux/init.h>
#include <asm/setup.h>
#include <asm/irq.h>
#include <asm/apollohw.h>
#include <asm/uaccess.h>
#include "busmouse.h"
#define DNKEY_CAPS 0x7e
#define BREAK_FLAG 0x80
#define DNKEY_REPEAT_DELAY 50
#define DNKEY_CTRL 0x43
#define DNKEY_LSHIFT 0x5e
#define DNKEY_RSHIFT 0x6a
#define DNKEY_REPT 0x5d
#define DNKEY_REPEAT 0x7f
#define DNKEY_LALT 0x75
#define DNKEY_RALT 0x77
#define APOLLO_KEYB_CMD_ENTRIES 16
#define APOLLO_KBD_MODE_KEYB 0x01
#define APOLLO_KBD_MODE_MOUSE 0x02
#define APOLLO_KBD_MODE_CHANGE 0xff
static u_char keyb_cmds[APOLLO_KEYB_CMD_ENTRIES];
static short keyb_cmd_read=0, keyb_cmd_write=0;
static int keyb_cmd_transmit=0;
static int msedev;
static unsigned int kbd_mode=APOLLO_KBD_MODE_KEYB;
#if 0
static void debug_keyb_timer_handler(unsigned long ignored);
static u_char debug_buf1[4096],debug_buf2[4096],*debug_buf=&debug_buf1[0];
static u_char *shadow_buf=&debug_buf2[0];
static short debug_buf_count=0;
static int debug_buf_overrun=0,debug_timer_running=0;
static unsigned long debug_buffer_updated=0;
static struct timer_list debug_keyb_timer = { function: debug_keyb_timer_handler };
#endif
static u_short dnplain_map[NR_KEYS] __initdata = {
/* ins del del F1 F2 F3 F4
mark line char */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
/* F5 F6 F7 F8 F9 F0 Again Read */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
/* Edit Exit Hold Copy Paste Grow ESC */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01b,
/* 1 2 3 4 5 6 7 8 */
0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038,
/* 9 0 - = ` Back |<--
Space */
0xf039, 0xf030, 0xf02d, 0xf03d, 0xf060, 0xf07f, 0xf200, 0xf200,
/* Shell -->| Tab q w e
Cmd */
0xf200, 0xf200, 0xf200, 0xf200, 0xf009, 0xfb71, 0xfb77, 0xfb65,
/* r t y u i o p [ */
0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b,
/* ] Del 7 8 9 + */
0xf05d, 0xf200, 0xf200, 0xf200, 0xf307, 0xf308, 0xf300, 0xf30a,
/* [<--] Up [-->] Ctrl a s */
0xf200, 0xf600, 0xf200, 0xf702, 0xf200, 0xf200, 0xfb61, 0xfb73,
/* d f g h j k l ; */
0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b,
/* ' Return \ 4 5 6 */
0xf027, 0xf200, 0xf201, 0xf05c, 0xf200, 0xf304, 0xf305, 0xf306,
/* - <-- Next --> Rept Shift
Window */
0xf30b, 0xf601, 0xf200, 0xf602, 0xf200, 0xf200, 0xf700, 0xf200,
/* z x c v b n m , */
0xfb7a, 0xfb78, 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c,
/* . / Shift Pop 1 2 */
0xf02e, 0xf02f, 0xf700, 0xf200, 0xf200, 0xf200, 0xf301, 0xf302,
/* 3 PgUp Down PgDn Alt Space Alt */
0xf303, 0xf200, 0xf118, 0xf603, 0xf119, 0xf703, 0xf020, 0xf701,
/* 0 . Enter */
0xf200, 0xf300, 0xf200, 0xf310, 0xf30e, 0xf200, 0xf700, 0xf200,
};
static u_short dnshift_map[NR_KEYS] __initdata = {
/* ins del del F1 F2 F3 F4
mark line char */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
/* F5 F6 F7 F8 F9 F0 Again Read */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
/* Save Abort Help Cut Undo Grow ESC */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01b,
/* ! @ # $ % ^ & * */
0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a,
/* ( ) _ + ~ Back |<--
Space */
0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07e, 0xf07f, 0xf200, 0xf200,
/* Shell -->| Tab Q W E
Cmd */
0xf200, 0xf200, 0xf200, 0xf200, 0xf009, 0xfb51, 0xfb57, 0xfb45,
/* R T Y U I O P { */
0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b,
/* } Del 7 8 9 + */
0xf07d, 0xf200, 0xf200, 0xf200, 0xf307, 0xf308, 0xf300, 0xf30a,
/* [<--] Up [-->] Ctrl A S */
0xf200, 0xf600, 0xf200, 0xf702, 0xf200, 0xf200, 0xfb41, 0xfb53,
/* D F G H J K L : */
0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a,
/* " Return | 4 5 6 */
0xf022, 0xf200, 0xf201, 0xf07c, 0xf200, 0xf304, 0xf305, 0xf306,
/* - <-- Next --> Rept Shift
Window */
0xf30b, 0xf601, 0xf200, 0xf602, 0xf200, 0xf200, 0xf700, 0xf200,
/* Z X C V B N M < */
0xfb5a, 0xfb58, 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c,
/* > ? Shift Pop 1 2 */
0xf03e, 0xf03f, 0xf700, 0xf200, 0xf200, 0xf200, 0xf301, 0xf302,
/* 3 PgUp Down PgDn Alt Space Alt */
0xf303, 0xf200, 0xf118, 0xf603, 0xf119, 0xf703, 0xf020, 0xf701,
/* 0 . Enter */
0xf200, 0xf300, 0xf200, 0xf310, 0xf30e, 0xf200, 0xf708, 0xf200,
};
static u_short dnctrl_map[NR_KEYS] __initdata = {
/* ins del del F1 F2 F3 F4
mark line char */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
/* F5 F6 F7 F8 F9 F0 Again Read */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
/* Save Abort Help Cut Undo Grow ESC */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01b,
/* ! @ # $ % ^ & * */
0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf07f,
/* ( ) _ + ~ Back |<--
Space */
0xf200, 0xf200, 0xf01f, 0xf200, 0xf01c, 0xf200, 0xf200, 0xf200,
/* Shell -->| Tab Q W E
Cmd */
0xf200, 0xf200, 0xf200, 0xf200, 0xf009, 0xf011, 0xf017, 0xf005,
/* R T Y U I O P { */
0xf012, 0xf014, 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b,
/* } Del 7 8 9 + */
0xf01d, 0xf200, 0xf200, 0xf200, 0xf307, 0xf308, 0xf300, 0xf30a,
/* [<--] Up [-->] Ctrl A S */
0xf200, 0xf600, 0xf200, 0xf702, 0xf200, 0xf200, 0xfb01, 0xfb53,
/* D F G H J K L : */
0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200,
/* " Return | 4 5 6 */
0xf200, 0xf200, 0xf201, 0xf01c, 0xf200, 0xf304, 0xf305, 0xf306,
/* - <-- Next --> Rept Shift
Window */
0xf30b, 0xf601, 0xf200, 0xf602, 0xf200, 0xf200, 0xf704, 0xf200,
/* Z X C V B N M < */
0xf01a, 0xf018, 0xf003, 0xf016, 0xf002, 0xf00e, 0xf01d, 0xf03c,
/* > ? Shift Pop 1 2 */
0xf03e, 0xf03f, 0xf705, 0xf200, 0xf200, 0xf200, 0xf301, 0xf302,
/* 3 PgUp Down PgDn Alt Space Alt */
0xf303, 0xf200, 0xf118, 0xf603, 0xf119, 0xf703, 0xf020, 0xf701,
/* 0 . Enter */
0xf200, 0xf300, 0xf200, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200,
};
static u_short dnalt_map[NR_KEYS] __initdata = {
/* ins del del F1 F2 F3 F4
mark line char */
0xf200, 0xf200, 0xf200, 0xf200, 0xf500, 0xf501, 0xf502, 0xf503,
/* F5 F6 F7 F8 F9 F0 Again Read */
0xf504, 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf200, 0xf200,
/* Edit Exit Hold Copy Paste Grow ESC */
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf01b,
/* 1 2 3 4 5 6 7 8 */
0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838,
/* 9 0 - = ` Back |<--
Space */
0xf839, 0xf830, 0xf82d, 0xf83d, 0xf860, 0xf87f, 0xf200, 0xf200,
/* Shell -->| Tab q w e
Cmd */
0xf200, 0xf200, 0xf200, 0xf200, 0xf809, 0xf871, 0xf877, 0xf865,
/* r t y u i o p [ */
0xf872, 0xf874, 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b,
/* ] Del 7 8 9 + */
0xf05d, 0xf200, 0xf200, 0xf200, 0xf307, 0xf308, 0xf300, 0xf30a,
/* [<--] Up [-->] Ctrl a s */
0xf200, 0xf600, 0xf200, 0xf702, 0xf200, 0xf200, 0xf861, 0xf873,
/* d f g h j k l ; */
0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf03b,
/* ' Return \ 4 5 6 */
0xf027, 0xf200, 0xf201, 0xf05c, 0xf200, 0xf304, 0xf305, 0xf306,
/* - <-- Next --> Rept Shift
Window */
0xf30b, 0xf601, 0xf200, 0xf602, 0xf200, 0xf200, 0xf704, 0xf200,
/* z x c v b n m , */
0xf87a, 0xf878, 0xf863, 0xf876, 0xf862, 0xf86e, 0xf86d, 0xf82c,
/* . / Shift Pop 1 2 */
0xf82e, 0xf82f, 0xf705, 0xf200, 0xf200, 0xf200, 0xf301, 0xf302,
/* 3 PgUp Down PgDn Alt Space Alt */
0xf303, 0xf200, 0xf118, 0xf603, 0xf119, 0xf703, 0xf820, 0xf701,
/* 0 . Enter */
0xf200, 0xf300, 0xf200, 0xf310, 0xf30e, 0xf200, 0xf200, 0xf200,
};
static u_short dnaltgr_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short dnshift_ctrl_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
static u_short dnctrl_alt_map[NR_KEYS] __initdata = {
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200
};
#if 0
static void debug_keyb_timer_handler(unsigned long ignored) {
unsigned long flags;
u_char *swap;
short length,i;
if (time_after(jiffies, debug_buffer_updated + 100)) {
save_flags(flags);
cli();
length=debug_buf_count;
swap=debug_buf;
debug_buf=shadow_buf;
shadow_buf=swap;
debug_buf_count=0;
debug_timer_running=0;
restore_flags(flags);
for(i=1;length;length--,i++)
printk("%02x%c",*(swap++), (i % 25) ? ' ' : '\n');
printk("\n");
}
else {
debug_keyb_timer.expires=jiffies+10;
add_timer(&debug_keyb_timer);
}
}
#endif
static void dn_keyb_process_key_event(unsigned char scancode) {
static unsigned char lastscancode;
unsigned char prev_scancode=lastscancode;
static unsigned int lastkeypress;
lastscancode=scancode;
/* printk("scan: %02x, lastscan: %02X, prev_scancode: %02X\n",scancode,lastscancode,prev_scancode); */
if(prev_scancode==APOLLO_KBD_MODE_CHANGE) {
kbd_mode=scancode;
/* printk("modechange: %d\n",scancode); */
}
else if((scancode & (~BREAK_FLAG)) == DNKEY_CAPS) {
/* printk("handle_scancode: %02x\n",DNKEY_CAPS); */
handle_scancode(DNKEY_CAPS, 1);
/* printk("handle_scancode: %02x\n",BREAK_FLAG | DNKEY_CAPS); */
handle_scancode(DNKEY_CAPS, 0);
}
else if( (scancode == DNKEY_REPEAT) && (prev_scancode < 0x7e) &&
!(prev_scancode==DNKEY_CTRL || prev_scancode==DNKEY_LSHIFT ||
prev_scancode==DNKEY_RSHIFT || prev_scancode==DNKEY_REPT ||
prev_scancode==DNKEY_LALT || prev_scancode==DNKEY_RALT)) {
if (time_after(jiffies, lastkeypress + DNKEY_REPEAT_DELAY)) {
/* printk("handle_scancode: %02x\n",prev_scancode); */
handle_scancode(prev_scancode, 1);
}
lastscancode=prev_scancode;
}
else {
/* printk("handle_scancode: %02x\n",scancode); */
handle_scancode(scancode & ~BREAK_FLAG, !(scancode & BREAK_FLAG));
lastkeypress=jiffies;
}
}
static void dn_keyb_process_mouse_event(unsigned char mouse_data) {
static short mouse_byte_count=0;
static u_char mouse_packet[3];
short buttons;
int dx, dy;
mouse_packet[mouse_byte_count++]=mouse_data;
if(mouse_byte_count==3) {
if(mouse_packet[0]==APOLLO_KBD_MODE_CHANGE) {
kbd_mode=mouse_packet[1];
mouse_byte_count=0;
/* printk("modechange: %d\n",mouse_packet[1]); */
if(kbd_mode==APOLLO_KBD_MODE_KEYB)
dn_keyb_process_key_event(mouse_packet[2]);
}
if((mouse_packet[0] & 0x8f) == 0x80) {
buttons = (mouse_packet[0] >> 4) & 0x7;
dx = mouse_packet[1] == 0xff ? 0 : (signed char)mouse_packet[1];
dy = mouse_packet[2] == 0xff ? 0 : (signed char)mouse_packet[2];
busmouse_add_movementbuttons(msedev, dx, dy, buttons);
mouse_byte_count=0;
/* printk("mouse: %d, %d, %x\n",mouse_x,mouse_y,buttons); */
}
}
}
static void dn_keyb_int(int irq, void *dummy, struct pt_regs *fp) {
unsigned char data;
unsigned long flags;
int scn2681_ints;
do {
scn2681_ints=sio01.isr_imr & 3;
if(scn2681_ints & 2) {
data=sio01.rhra_thra;
#if 0
if(debug_buf_count<4096) {
debug_buf[debug_buf_count++]=data;
debug_buffer_updated=jiffies;
if(!debug_timer_running) {
debug_keyb_timer.expires=jiffies+10;
add_timer(&debug_keyb_timer);
debug_timer_running=1;
}
}
else
debug_buf_overrun=1;
#endif
if(sio01.sra_csra & 0x10) {
printk("whaa overrun !\n");
continue;
}
if(kbd_mode==APOLLO_KBD_MODE_KEYB)
dn_keyb_process_key_event(data);
else
dn_keyb_process_mouse_event(data);
}
if(scn2681_ints & 1) {
save_flags(flags);
cli();
if(keyb_cmd_write!=keyb_cmd_read) {
sio01.rhra_thra=keyb_cmds[keyb_cmd_read++];
if(keyb_cmd_read==APOLLO_KEYB_CMD_ENTRIES)
keyb_cmd_read=0;
keyb_cmd_transmit=1;
}
else {
keyb_cmd_transmit=0;
sio01.BRGtest_cra=9;
}
restore_flags(flags);
}
} while(scn2681_ints) ;
}
void write_keyb_cmd(u_short length, u_char *cmd) {
unsigned long flags;
if((keyb_cmd_write==keyb_cmd_read) && keyb_cmd_transmit)
return;
save_flags(flags);
cli();
for(;length;length--) {
keyb_cmds[keyb_cmd_write++]=*(cmd++);
if(keyb_cmd_write==keyb_cmd_read)
return;
if(keyb_cmd_write==APOLLO_KEYB_CMD_ENTRIES)
keyb_cmd_write=0;
}
if(!keyb_cmd_transmit) {
sio01.BRGtest_cra=5;
}
restore_flags(flags);
}
static struct busmouse apollo_mouse = {
APOLLO_MOUSE_MINOR, "apollomouse", THIS_MODULE, NULL, NULL, 7
};
int __init dn_keyb_init(void){
/* printk("dn_keyb_init\n"); */
memcpy(key_maps[0], dnplain_map, sizeof(plain_map));
memcpy(key_maps[1], dnshift_map, sizeof(plain_map));
memcpy(key_maps[2], dnaltgr_map, sizeof(plain_map));
memcpy(key_maps[4], dnctrl_map, sizeof(plain_map));
memcpy(key_maps[5], dnshift_ctrl_map, sizeof(plain_map));
memcpy(key_maps[8], dnalt_map, sizeof(plain_map));
memcpy(key_maps[12], dnctrl_alt_map, sizeof(plain_map));
msedev=register_busmouse(&apollo_mouse);
if (msedev < 0)
printk(KERN_WARNING "Unable to install Apollo mouse driver.\n");
else
printk(KERN_INFO "Apollo mouse installed.\n");
/* program UpDownMode */
while(!(sio01.sra_csra & 0x4));
sio01.rhra_thra=0xff;
while(!(sio01.sra_csra & 0x4));
sio01.rhra_thra=0x1;
request_irq(1, dn_keyb_int,0,NULL,NULL);
/* enable receive int on DUART */
sio01.isr_imr=3;
return 0;
}
int dn_dummy_kbdrate(struct kbd_repeat *k) {
printk("dn_dummy_kbdrate\n");
return 0;
}
......@@ -917,14 +917,14 @@ static unsigned short x86_keycodes[256] =
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 43, 85, 86, 87, 88,115,119,120,121,375,123, 90,
284,285,309,298,312, 91,327,328,329,331,333,335,336,337,338,339,
367,294,293,286,350, 92,334,512,116,377,109,111,373,347,348,349,
360, 93, 94, 95, 98,376,100,101,357,316,354,304,289,102,351,355,
103,104,105,275,281,272,306,106,274,107,288,364,358,363,362,361,
291,108,381,290,287,292,279,305,280, 99,112,257,258,113,270,114,
367,288,302,304,350, 92,334,512,116,377,109,111,373,347,348,349,
360, 93, 94, 95, 98,376,100,101,321,316,354,286,289,102,351,355,
103,104,105,275,287,279,306,106,274,107,294,364,358,363,362,361,
291,108,381,281,290,272,292,305,280, 99,112,257,258,359,270,114,
118,117,125,374,379,115,112,125,121,123,264,265,266,267,268,269,
271,273,276,277,278,282,283,295,296,297,299,300,301,302,303,307,
308,310,313,314,315,317,318,319,320,321,322,323,324,325,326,330,
332,340,341,342,343,344,345,346,356,359,365,368,369,370,371,372 };
271,273,276,277,278,282,283,295,296,297,299,300,301,293,303,307,
308,310,313,314,315,317,318,319,320,357,322,323,324,325,326,330,
332,340,365,342,343,344,345,346,356,113,341,368,369,370,371,372 };
#ifdef CONFIG_MAC_EMUMOUSEBTN
extern int mac_hid_mouse_emulate_buttons(int, int, int);
......
/*
* linux/drivers/char/q40_keyb.c
*
*/
#include <linux/config.h>
#include <linux/spinlock.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/tty.h>
#include <linux/mm.h>
#include <linux/keyboard.h>
#include <linux/signal.h>
#include <linux/ioport.h>
#include <linux/init.h>
#include <linux/kbd_ll.h>
#include <linux/kbd_kern.h>
#include <linux/delay.h>
#include <linux/sysrq.h>
#include <linux/random.h>
#include <linux/poll.h>
#include <linux/miscdevice.h>
#include <linux/slab.h>
#include <asm/keyboard.h>
#include <asm/bitops.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/q40_master.h>
#include <asm/irq.h>
#include <asm/q40ints.h>
/* Simple translation table for the SysRq keys */
#define SYSRQ_KEY 0x54
#ifdef CONFIG_MAGIC_SYSRQ
unsigned char q40kbd_sysrq_xlate[128] =
"\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
"qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
"dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
"bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
"\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
"230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
"\r\000/"; /* 0x60 - 0x6f */
#endif
/* Q40 uses AT scancodes - no way to change it. so we have to translate ..*/
/* 0x00 means not a valid entry or no conversion known */
unsigned static char q40cl[256] =
{/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
0x00,0x43,0x00,0x3f,0x3d,0x3b,0x3c,0x58,0x00,0x44,0x42,0x40,0x3e,0x0f,0x29,0x00, /* 0x00 - 0x0f */
0x00,0x38,0x2a,0x00,0x1d,0x10,0x02,0x00,0x00,0x00,0x2c,0x1f,0x1e,0x11,0x03,0x00, /* 0x10 - 0x1f */
0x00,0x2e,0x2d,0x20,0x12,0x05,0x04,0x00,0x21,0x39,0x2f,0x21,0x14,0x13,0x06,0x00, /* 0x20 - 0x2f 'f' is at 0x2b, what is 0x28 ???*/
0x00,0x31,0x30,0x23,0x22,0x15,0x07,0x00,0x24,0x00,0x32,0x24,0x16,0x08,0x09,0x00, /* 0x30 - 0x3f */
0x00,0x33,0x25,0x17,0x18,0x0b,0x0a,0x00,0x00,0x34,0x35,0x26,0x27,0x19,0x0c,0x00, /* 0x40 - 0x4f */
0x00,0x00,0x28,0x00,0x1a,0x0d,0x00,0x00,0x3a,0x36,0x1c,0x1b,0x00,0x2b,0x00,0x00, /* 0x50 - 0x5f*/
0x00,0x56,0x00,0x00,0x00,0x00,0x0e,0x00,0x00,0x4f,0x00,0x4b,0x47,0x00,0x00,0x00, /* 0x60 - 0x6f */
0x52,0x53,0x50,0x4c,0x4d,0x48,0x01,0x45,0x57,0x4e,0x51,0x4a,0x37,0x49,0x46,0x00, /* 0x70 - 0x7f */
0x00,0x00,0x00,0x41,0x37,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x80 - 0x8f 0x84/0x37 is SySrq*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x90 - 0x9f */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xa0 - 0xaf */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xb0 - 0xbf */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xc0 - 0xcf */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xd0 - 0xdf */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xe0 - 0xef */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xf0 - 0xff */
};
/* another table, AT 0xe0 codes to PC 0xe0 codes,
0xff special entry for SysRq - DROPPED right now */
static unsigned char q40ecl[]=
{/* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x00 - 0x0f*/
0x00,0x38,0x2a,0x00,0x1d,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x10 - 0x1f */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x20 - 0x2f*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x30 - 0x3f*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x35,0x00,0x00,0x00,0x00,0x00, /* 0x40 - 0x4f*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x1c,0x00,0x00,0x00,0x00,0x00, /* 0x50 - 0x5f*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4f,0x00,0x4b,0x47,0x00,0x00,0x00, /* 0x60 - 0x6f*/
0x52,0x53,0x50,0x00,0x4d,0x48,0x00,0x00,0x00,0x00,0x51,0x00,0x00,0x49,0x00,0x00, /* 0x70 - 0x7f*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x80 - 0x8f*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0x90 - 0x9f*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xa0 - 0xaf*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xb0 - 0xbf*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xc0 - 0xcf*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xd0 - 0xdf*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 0xe0 - 0xef*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 0xf0 - 0xff*/
};
static spinlock_t kbd_controller_lock = SPIN_LOCK_UNLOCKED;
/*
* Translation of escaped scancodes to keycodes.
* This is now user-settable.
* The keycodes 1-88,96-111,119 are fairly standard, and
* should probably not be changed - changing might confuse X.
* X also interprets scancode 0x5d (KEY_Begin).
*
* For 1-88 keycode equals scancode.
*/
#define E0_KPENTER 96
#define E0_RCTRL 97
#define E0_KPSLASH 98
#define E0_PRSCR 99
#define E0_RALT 100
#define E0_BREAK 101 /* (control-pause) */
#define E0_HOME 102
#define E0_UP 103
#define E0_PGUP 104
#define E0_LEFT 105
#define E0_RIGHT 106
#define E0_END 107
#define E0_DOWN 108
#define E0_PGDN 109
#define E0_INS 110
#define E0_DEL 111
#define E1_PAUSE 119
/*
* The keycodes below are randomly located in 89-95,112-118,120-127.
* They could be thrown away (and all occurrences below replaced by 0),
* but that would force many users to use the `setkeycodes' utility, where
* they needed not before. It does not matter that there are duplicates, as
* long as no duplication occurs for any single keyboard.
*/
#define SC_LIM 89
#define FOCUS_PF1 85 /* actual code! */
#define FOCUS_PF2 89
#define FOCUS_PF3 90
#define FOCUS_PF4 91
#define FOCUS_PF5 92
#define FOCUS_PF6 93
#define FOCUS_PF7 94
#define FOCUS_PF8 95
#define FOCUS_PF9 120
#define FOCUS_PF10 121
#define FOCUS_PF11 122
#define FOCUS_PF12 123
#define JAP_86 124
/* tfj@olivia.ping.dk:
* The four keys are located over the numeric keypad, and are
* labelled A1-A4. It's an rc930 keyboard, from
* Regnecentralen/RC International, Now ICL.
* Scancodes: 59, 5a, 5b, 5c.
*/
#define RGN1 124
#define RGN2 125
#define RGN3 126
#define RGN4 127
static unsigned char high_keys[128 - SC_LIM] = {
RGN1, RGN2, RGN3, RGN4, 0, 0, 0, /* 0x59-0x5f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
0, 0, 0, 0, 0, FOCUS_PF11, 0, FOCUS_PF12, /* 0x68-0x6f */
0, 0, 0, FOCUS_PF2, FOCUS_PF9, 0, 0, FOCUS_PF3, /* 0x70-0x77 */
FOCUS_PF4, FOCUS_PF5, FOCUS_PF6, FOCUS_PF7, /* 0x78-0x7b */
FOCUS_PF8, JAP_86, FOCUS_PF10, 0 /* 0x7c-0x7f */
};
/* BTC */
#define E0_MACRO 112
/* LK450 */
#define E0_F13 113
#define E0_F14 114
#define E0_HELP 115
#define E0_DO 116
#define E0_F17 117
#define E0_KPMINPLUS 118
/*
* My OmniKey generates e0 4c for the "OMNI" key and the
* right alt key does nada. [kkoller@nyx10.cs.du.edu]
*/
#define E0_OK 124
/*
* New microsoft keyboard is rumoured to have
* e0 5b (left window button), e0 5c (right window button),
* e0 5d (menu button). [or: LBANNER, RBANNER, RMENU]
* [or: Windows_L, Windows_R, TaskMan]
*/
#define E0_MSLW 125
#define E0_MSRW 126
#define E0_MSTM 127
/* this can be changed using setkeys : */
static unsigned char e0_keys[128] = {
0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x07 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x08-0x0f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */
0, 0, 0, 0, E0_KPENTER, E0_RCTRL, 0, 0, /* 0x18-0x1f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x27 */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */
0, 0, 0, 0, 0, E0_KPSLASH, 0, E0_PRSCR, /* 0x30-0x37 */
E0_RALT, 0, 0, 0, 0, E0_F13, E0_F14, E0_HELP, /* 0x38-0x3f */
E0_DO, E0_F17, 0, 0, 0, 0, E0_BREAK, E0_HOME, /* 0x40-0x47 */
E0_UP, E0_PGUP, 0, E0_LEFT, E0_OK, E0_RIGHT, E0_KPMINPLUS, E0_END,/* 0x48-0x4f */
E0_DOWN, E0_PGDN, E0_INS, E0_DEL, 0, 0, 0, 0, /* 0x50-0x57 */
0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, 0, /* 0x58-0x5f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
0, 0, 0, 0, 0, 0, 0, E0_MACRO, /* 0x68-0x6f */
0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */
0, 0, 0, 0, 0, 0, 0, 0 /* 0x78-0x7f */
};
int q40kbd_setkeycode(unsigned int scancode, unsigned int keycode)
{
if (scancode < SC_LIM || scancode > 255 || keycode > 127)
return -EINVAL;
if (scancode < 128)
high_keys[scancode - SC_LIM] = keycode;
else
e0_keys[scancode - 128] = keycode;
return 0;
}
int q40kbd_getkeycode(unsigned int scancode)
{
return
(scancode < SC_LIM || scancode > 255) ? -EINVAL :
(scancode < 128) ? high_keys[scancode - SC_LIM] :
e0_keys[scancode - 128];
}
#define disable_keyboard()
#define enable_keyboard()
int q40kbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode)
{
static int prev_scancode;
/* special prefix scancodes.. */
if (scancode == 0xe0 || scancode == 0xe1) {
prev_scancode = scancode;
return 0;
}
/* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */
if (scancode == 0x00 || scancode == 0xff) {
prev_scancode = 0;
return 0;
}
scancode &= 0x7f;
if (prev_scancode) {
/*
* usually it will be 0xe0, but a Pause key generates
* e1 1d 45 e1 9d c5 when pressed, and nothing when released
*/
if (prev_scancode != 0xe0) {
if (prev_scancode == 0xe1 && scancode == 0x1d) {
prev_scancode = 0x100;
return 0;
} else if (prev_scancode == 0x100 && scancode == 0x45) {
*keycode = E1_PAUSE;
prev_scancode = 0;
} else {
#ifdef KBD_REPORT_UNKN
if (!raw_mode)
printk(KERN_INFO "keyboard: unknown e1 escape sequence\n");
#endif
prev_scancode = 0;
return 0;
}
} else {
prev_scancode = 0;
/*
* The keyboard maintains its own internal caps lock and
* num lock statuses. In caps lock mode E0 AA precedes make
* code and E0 2A follows break code. In num lock mode,
* E0 2A precedes make code and E0 AA follows break code.
* We do our own book-keeping, so we will just ignore these.
*/
/*
* For my keyboard there is no caps lock mode, but there are
* both Shift-L and Shift-R modes. The former mode generates
* E0 2A / E0 AA pairs, the latter E0 B6 / E0 36 pairs.
* So, we should also ignore the latter. - aeb@cwi.nl
*/
if (scancode == 0x2a || scancode == 0x36)
return 0;
if (e0_keys[scancode])
*keycode = e0_keys[scancode];
else {
#ifdef KBD_REPORT_UNKN
if (!raw_mode)
printk(KERN_INFO "keyboard: unknown scancode e0 %02x\n",
scancode);
#endif
return 0;
}
}
} else if (scancode >= SC_LIM) {
/* This happens with the FOCUS 9000 keyboard
Its keys PF1..PF12 are reported to generate
55 73 77 78 79 7a 7b 7c 74 7e 6d 6f
Moreover, unless repeated, they do not generate
key-down events, so we have to zero up_flag below */
/* Also, Japanese 86/106 keyboards are reported to
generate 0x73 and 0x7d for \ - and \ | respectively. */
/* Also, some Brazilian keyboard is reported to produce
0x73 and 0x7e for \ ? and KP-dot, respectively. */
*keycode = high_keys[scancode - SC_LIM];
if (!*keycode) {
if (!raw_mode) {
#ifdef KBD_REPORT_UNKN
printk(KERN_INFO "keyboard: unrecognized scancode (%02x)"
" - ignored\n", scancode);
#endif
}
return 0;
}
} else
*keycode = scancode;
return 1;
}
char q40kbd_unexpected_up(unsigned char keycode)
{
/* unexpected, but this can happen: maybe this was a key release for a
FOCUS 9000 PF key; if we want to see it, we have to clear up_flag */
if (keycode >= SC_LIM || keycode == 85)
return 0;
else
return 0200;
}
static int keyup=0;
static int qprev=0;
static void keyboard_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
unsigned char status;
spin_lock(&kbd_controller_lock);
kbd_pt_regs = regs;
status = IRQ_KEYB_MASK & master_inb(INTERRUPT_REG);
if (status )
{
unsigned char scancode,qcode;
qcode = master_inb(KEYCODE_REG);
if (qcode != 0xf0)
{
if (qcode == 0xe0)
{
qprev=0xe0;
handle_scancode(qprev , 1);
goto exit;
}
scancode=qprev ? q40ecl[qcode] : q40cl[qcode];
#if 0
/* next line is last resort to hanlde some oddities */
if (qprev && !scancode) scancode=q40cl[qcode];
#endif
qprev=0;
if (!scancode)
{
printk("unknown scancode %x\n",qcode);
goto exit;
}
if (scancode==0xff) /* SySrq */
scancode=SYSRQ_KEY;
handle_scancode(scancode, ! keyup );
keyup=0;
tasklet_schedule(&keyboard_tasklet);
}
else
keyup=1;
}
exit:
spin_unlock(&kbd_controller_lock);
master_outb(-1,KEYBOARD_UNLOCK_REG); /* keyb ints reenabled herewith */
}
#define KBD_NO_DATA (-1) /* No data */
#define KBD_BAD_DATA (-2) /* Parity or other error */
static int __init kbd_read_input(void)
{
int retval = KBD_NO_DATA;
unsigned char status;
status = IRQ_KEYB_MASK & master_inb(INTERRUPT_REG);
if (status) {
unsigned char data = master_inb(KEYCODE_REG);
retval = data;
master_outb(-1,KEYBOARD_UNLOCK_REG);
}
return retval;
}
static void __init kbd_clear_input(void)
{
int maxread = 100; /* Random number */
do {
if (kbd_read_input() == KBD_NO_DATA)
break;
} while (--maxread);
}
int __init q40kbd_init_hw(void)
{
/* Flush any pending input. */
kbd_clear_input();
/* Ok, finally allocate the IRQ, and off we go.. */
request_irq(Q40_IRQ_KEYBOARD, keyboard_interrupt, 0, "keyboard", NULL);
master_outb(-1,KEYBOARD_UNLOCK_REG);
master_outb(1,KEY_IRQ_ENABLE_REG);
return 0;
}
/*
* $Id: evdev.c,v 1.48 2002/05/26 14:28:26 jdeneux Exp $
*
* Copyright (c) 1999-2001 Vojtech Pavlik
*
* Event char devices, giving access to raw input device events.
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* Copyright (c) 1999-2002 Vojtech Pavlik
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#define EVDEV_MINOR_BASE 64
......@@ -38,7 +20,7 @@
#include <linux/smp_lock.h>
#include <linux/device.h>
struct evdev {
struct evdev{
int exist;
int open;
int minor;
......@@ -46,7 +28,7 @@ struct evdev {
struct input_handle handle;
wait_queue_head_t wait;
devfs_handle_t devfs;
struct evdev_list *list;
struct list_head list;
};
struct evdev_list {
......@@ -55,17 +37,17 @@ struct evdev_list {
int tail;
struct fasync_struct *fasync;
struct evdev *evdev;
struct evdev_list *next;
struct list_head node;
};
static struct evdev *evdev_table[EVDEV_MINORS] = { NULL, /* ... */ };
static struct evdev *evdev_table[EVDEV_MINORS];
static void evdev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{
struct evdev *evdev = handle->private;
struct evdev_list *list = evdev->list;
struct evdev_list *list;
while (list) {
list_for_each_entry(list, &evdev->list, node) {
do_gettimeofday(&list->buffer[list->head].time);
list->buffer[list->head].type = type;
......@@ -74,8 +56,6 @@ static void evdev_event(struct input_handle *handle, unsigned int type, unsigned
list->head = (list->head + 1) & (EVDEV_BUFFER_SIZE - 1);
kill_fasync(&list->fasync, SIGIO, POLL_IN);
list = list->next;
}
wake_up_interruptible(&evdev->wait);
......@@ -91,7 +71,7 @@ static int evdev_fasync(int fd, struct file *file, int on)
static int evdev_flush(struct file * file)
{
struct evdev_list *list = (struct evdev_list*)file->private_data;
struct evdev_list *list = file->private_data;
if (!list->evdev->exist) return -ENODEV;
return input_flush_device(&list->evdev->handle, file);
}
......@@ -99,14 +79,9 @@ static int evdev_flush(struct file * file)
static int evdev_release(struct inode * inode, struct file * file)
{
struct evdev_list *list = file->private_data;
struct evdev_list **listptr;
listptr = &list->evdev->list;
evdev_fasync(-1, file, 0);
while (*listptr && (*listptr != list))
listptr = &((*listptr)->next);
*listptr = (*listptr)->next;
list_del(&list->node);
if (!--list->evdev->open) {
if (list->evdev->exist) {
......@@ -132,19 +107,15 @@ static int evdev_open(struct inode * inode, struct file * file)
if (i >= EVDEV_MINORS || !evdev_table[i])
return -ENODEV;
/* Ask the driver if he wishes to accept the open() */
if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file))) {
if ((accept_err = input_accept_process(&(evdev_table[i]->handle), file)))
return accept_err;
}
if (!(list = kmalloc(sizeof(struct evdev_list), GFP_KERNEL)))
return -ENOMEM;
memset(list, 0, sizeof(struct evdev_list));
list->evdev = evdev_table[i];
list->next = evdev_table[i]->list;
evdev_table[i]->list = list;
list_add_tail(&list->node, &evdev_table[i]->list);
file->private_data = list;
if (!list->evdev->open++)
......@@ -175,40 +146,21 @@ static ssize_t evdev_write(struct file * file, const char * buffer, size_t count
static ssize_t evdev_read(struct file * file, char * buffer, size_t count, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
struct evdev_list *list = file->private_data;
int retval = 0;
if (list->head == list->tail) {
add_wait_queue(&list->evdev->wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
while (list->head == list->tail) {
if (!list->evdev->exist) {
retval = -ENODEV;
break;
}
if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
break;
}
if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
int retval;
schedule();
}
if (list->head == list->tail && list->evdev->exist && (file->f_flags & O_NONBLOCK))
return -EAGAIN;
set_current_state(TASK_RUNNING);
remove_wait_queue(&list->evdev->wait, &wait);
}
retval = wait_event_interruptible(list->evdev->wait,
list->head != list->tail && list->evdev->exist);
if (retval)
return retval;
if (!list->evdev->exist)
return -ENODEV;
while (list->head != list->tail && retval + sizeof(struct input_event) <= count) {
if (copy_to_user(buffer + retval, list->buffer + list->tail,
sizeof(struct input_event))) return -EFAULT;
......@@ -433,22 +385,20 @@ static struct input_handle *evdev_connect(struct input_handler *handler, struct
return NULL;
memset(evdev, 0, sizeof(struct evdev));
INIT_LIST_HEAD(&evdev->list);
init_waitqueue_head(&evdev->wait);
evdev->exist = 1;
evdev->minor = minor;
evdev_table[minor] = evdev;
sprintf(evdev->name, "event%d", minor);
evdev->handle.dev = dev;
evdev->handle.name = evdev->name;
evdev->handle.handler = handler;
evdev->handle.private = evdev;
sprintf(evdev->name, "event%d", minor);
evdev_table[minor] = evdev;
evdev->devfs = input_register_minor("event%d", minor, EVDEV_MINOR_BASE);
evdev->exist = 1;
return &evdev->handle;
}
......
......@@ -44,7 +44,6 @@ MODULE_LICENSE("GPL");
struct emu {
struct pci_dev *dev;
struct emu *next;
struct gameport gameport;
int size;
char phys[32];
......
/*
* $Id: gameport.c,v 1.18 2002/01/22 20:41:14 vojtech Exp $
* Generic gameport layer
*
* Copyright (c) 1999-2001 Vojtech Pavlik
* Copyright (c) 1999-2002 Vojtech Pavlik
*/
/*
* Generic gameport layer
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#include <asm/io.h>
......@@ -51,9 +33,8 @@ EXPORT_SYMBOL(gameport_close);
EXPORT_SYMBOL(gameport_rescan);
EXPORT_SYMBOL(gameport_cooked_read);
static struct gameport *gameport_list;
static struct gameport_dev *gameport_dev;
static LIST_HEAD(gameport_list);
static LIST_HEAD(gameport_dev_list);
#ifdef __i386__
......@@ -122,12 +103,13 @@ static int gameport_measure_speed(struct gameport *gameport)
static void gameport_find_dev(struct gameport *gameport)
{
struct gameport_dev *dev = gameport_dev;
struct gameport_dev *dev;
while (dev && !gameport->dev) {
list_for_each_entry(dev, &gameport_dev_list, node) {
if (gameport->dev)
break;
if (dev->connect)
dev->connect(gameport, dev);
dev = dev->next;
}
}
......@@ -139,52 +121,37 @@ void gameport_rescan(struct gameport *gameport)
void gameport_register_port(struct gameport *gameport)
{
gameport->next = gameport_list;
gameport_list = gameport;
list_add_tail(&gameport->node, &gameport_list);
gameport->speed = gameport_measure_speed(gameport);
gameport_find_dev(gameport);
}
void gameport_unregister_port(struct gameport *gameport)
{
struct gameport **gameportptr = &gameport_list;
while (*gameportptr && (*gameportptr != gameport)) gameportptr = &((*gameportptr)->next);
*gameportptr = (*gameportptr)->next;
list_del_init(&gameport->node);
if (gameport->dev && gameport->dev->disconnect)
gameport->dev->disconnect(gameport);
}
void gameport_register_device(struct gameport_dev *dev)
{
struct gameport *gameport = gameport_list;
dev->next = gameport_dev;
gameport_dev = dev;
struct gameport *gameport;
while (gameport) {
list_add_tail(&dev->node, &gameport_dev_list);
list_for_each_entry(gameport, &gameport_list, node)
if (!gameport->dev && dev->connect)
dev->connect(gameport, dev);
gameport = gameport->next;
}
}
void gameport_unregister_device(struct gameport_dev *dev)
{
struct gameport_dev **devptr = &gameport_dev;
struct gameport *gameport = gameport_list;
while (*devptr && (*devptr != dev)) devptr = &((*devptr)->next);
*devptr = (*devptr)->next;
struct gameport *gameport;
while (gameport) {
list_del_init(&dev->node);
list_for_each_entry(gameport, &gameport_list, node) {
if (gameport->dev == dev && dev->disconnect)
dev->disconnect(gameport);
gameport_find_dev(gameport);
gameport = gameport->next;
}
}
......@@ -209,5 +176,6 @@ int gameport_open(struct gameport *gameport, struct gameport_dev *dev, int mode)
void gameport_close(struct gameport *gameport)
{
gameport->dev = NULL;
if (gameport->close) gameport->close(gameport);
if (gameport->close)
gameport->close(gameport);
}
......@@ -53,13 +53,13 @@ struct ns558 {
int type;
int size;
struct pci_dev *dev;
struct ns558 *next;
struct list_head node;
struct gameport gameport;
char phys[32];
char name[32];
};
static struct ns558 *ns558;
static LIST_HEAD(ns558_list);
/*
* ns558_isa_probe() tries to find an isa gameport at the
......@@ -67,7 +67,7 @@ static struct ns558 *ns558;
* A joystick must be attached for this to work.
*/
static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
static void ns558_isa_probe(int io)
{
int i, j, b;
unsigned char c, u, v;
......@@ -78,7 +78,7 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
*/
if (check_region(io, 1))
return next;
return;
/*
* We must not be able to write arbitrary values to the port.
......@@ -89,7 +89,7 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
outb(~c & ~3, io);
if (~(u = v = inb(io)) & 3) {
outb(c, io);
return next;
return;
}
/*
* After a trigger, there must be at least some bits changing.
......@@ -99,7 +99,7 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
if (u == v) {
outb(c, io);
return next;
return;
}
wait_ms(3);
/*
......@@ -110,7 +110,7 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
for (i = 0; i < 1000; i++)
if ((u ^ inb(io)) & 0xf) {
outb(c, io);
return next;
return;
}
/*
* And now find the number of mirrors of the port.
......@@ -134,11 +134,10 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
if (!(port = kmalloc(sizeof(struct ns558), GFP_KERNEL))) {
printk(KERN_ERR "ns558: Memory allocation failed.\n");
return next;
return;
}
memset(port, 0, sizeof(struct ns558));
port->next = next;
port->type = NS558_ISA;
port->size = (1 << i);
port->gameport.io = io & (-1 << i);
......@@ -157,7 +156,7 @@ static struct ns558* ns558_isa_probe(int io, struct ns558 *next)
if (port->size > 1) printk(" size %d", port->size);
printk(" speed %d kHz\n", port->gameport.speed);
return port;
list_add(&port->node, &ns558_list);
}
#ifdef __ISAPNP__
......@@ -194,22 +193,22 @@ static struct isapnp_device_id pnp_devids[] = {
MODULE_DEVICE_TABLE(isapnp, pnp_devids);
static struct ns558* ns558_pnp_probe(struct pci_dev *dev, struct ns558 *next)
static void ns558_pnp_probe(struct pci_dev *dev)
{
int ioport, iolen;
struct ns558 *port;
if (dev->prepare && dev->prepare(dev) < 0)
return next;
return;
if (!(dev->resource[0].flags & IORESOURCE_IO)) {
printk(KERN_WARNING "ns558: No i/o ports on a gameport? Weird\n");
return next;
return;
}
if (dev->activate && dev->activate(dev) < 0) {
printk(KERN_ERR "ns558: PnP resource allocation failed\n");
return next;
return;
}
ioport = pci_resource_start(dev, 0);
......@@ -224,7 +223,6 @@ static struct ns558* ns558_pnp_probe(struct pci_dev *dev, struct ns558 *next)
}
memset(port, 0, sizeof(struct ns558));
port->next = next;
port->type = NS558_PNP;
port->size = iolen;
port->dev = dev;
......@@ -247,12 +245,12 @@ static struct ns558* ns558_pnp_probe(struct pci_dev *dev, struct ns558 *next)
if (iolen > 1) printk(" size %d", iolen);
printk(" speed %d kHz\n", port->gameport.speed);
return port;
list_add_tail(&port->node, &ns558_list);
return;
deactivate:
if (dev->deactivate)
dev->deactivate(dev);
return next;
}
#endif
......@@ -269,28 +267,26 @@ int __init ns558_init(void)
*/
while (ns558_isa_portlist[i])
ns558 = ns558_isa_probe(ns558_isa_portlist[i++], ns558);
ns558_isa_probe(ns558_isa_portlist[i++]);
/*
* Probe for PnP ports.
*/
#ifdef __ISAPNP__
for (devid = pnp_devids; devid->vendor; devid++) {
while ((dev = isapnp_find_dev(NULL, devid->vendor, devid->function, dev))) {
ns558 = ns558_pnp_probe(dev, ns558);
}
}
for (devid = pnp_devids; devid->vendor; devid++)
while ((dev = isapnp_find_dev(NULL, devid->vendor, devid->function, dev)))
ns558_pnp_probe(dev);
#endif
return ns558 ? 0 : -ENODEV;
return list_empty(&ns558_list) ? -ENODEV : 0;
}
void __exit ns558_exit(void)
{
struct ns558 *next, *port = ns558;
struct ns558 *port;
while (port) {
list_for_each_entry(port, &ns558_list, node) {
gameport_unregister_port(&port->gameport);
switch (port->type) {
......@@ -308,10 +304,6 @@ void __exit ns558_exit(void)
default:
break;
}
next = port->next;
kfree(port);
port = next;
}
}
......
......@@ -58,7 +58,7 @@ static int input_devices_state;
void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{
struct list_head * node;
struct input_handle *handle;
if (dev->pm_dev)
pm_access(dev->pm_dev);
......@@ -177,11 +177,9 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
if (type != EV_SYN)
dev->sync = 0;
list_for_each(node,&dev->h_list) {
struct input_handle *handle = to_handle(node);
list_for_each_entry(handle, &dev->h_list, d_node)
if (handle->open)
handle->handler->event(handle, type, code, value);
}
}
static void input_repeat_key(unsigned long data)
......@@ -234,8 +232,8 @@ void input_close_device(struct input_handle *handle)
static void input_link_handle(struct input_handle *handle)
{
list_add_tail(&handle->d_node,&handle->dev->h_list);
list_add_tail(&handle->h_node,&handle->handler->h_list);
list_add_tail(&handle->d_node, &handle->dev->h_list);
list_add_tail(&handle->h_node, &handle->handler->h_list);
}
#define MATCH_BIT(bit, max) \
......@@ -400,8 +398,8 @@ static void input_call_hotplug(char *verb, struct input_dev *dev)
void input_register_device(struct input_dev *dev)
{
struct list_head * node;
struct input_handle *handle;
struct input_handler *handler;
struct input_device_id *id;
set_bit(EV_SYN, dev->evbit);
......@@ -413,14 +411,12 @@ void input_register_device(struct input_dev *dev)
dev->rep[REP_PERIOD] = HZ/33;
INIT_LIST_HEAD(&dev->h_list);
list_add_tail(&dev->node,&input_dev_list);
list_add_tail(&dev->node, &input_dev_list);
list_for_each(node,&input_handler_list) {
struct input_handler *handler = to_handler(node);
list_for_each_entry(handler, &input_handler_list, node)
if ((id = input_match_device(handler->id_table, dev)))
if ((handle = handler->connect(handler, dev, id)))
input_link_handle(handle);
}
#ifdef CONFIG_HOTPLUG
input_call_hotplug("add", dev);
......@@ -443,7 +439,7 @@ void input_unregister_device(struct input_dev *dev)
del_timer_sync(&dev->timer);
list_for_each_safe(node,next,&dev->h_list) {
list_for_each_safe(node, next, &dev->h_list) {
struct input_handle * handle = to_handle(node);
list_del_init(&handle->d_node);
list_del_init(&handle->h_node);
......@@ -464,7 +460,7 @@ void input_unregister_device(struct input_dev *dev)
void input_register_handler(struct input_handler *handler)
{
struct list_head * node;
struct input_dev *dev;
struct input_handle *handle;
struct input_device_id *id;
......@@ -475,14 +471,12 @@ void input_register_handler(struct input_handler *handler)
if (handler->fops != NULL)
input_table[handler->minor >> 5] = handler;
list_add_tail(&handler->node,&input_handler_list);
list_add_tail(&handler->node, &input_handler_list);
list_for_each(node,&input_dev_list) {
struct input_dev *dev = to_dev(node);
list_for_each_entry(dev, &input_dev_list, node)
if ((id = input_match_device(handler->id_table, dev)))
if ((handle = handler->connect(handler, dev, id)))
input_link_handle(handle);
}
#ifdef CONFIG_PROC_FS
input_devices_state++;
......@@ -494,7 +488,7 @@ void input_unregister_handler(struct input_handler *handler)
{
struct list_head * node, * next;
list_for_each_safe(node,next,&handler->h_list) {
list_for_each_safe(node, next, &handler->h_list) {
struct input_handle * handle = to_handle_h(node);
list_del_init(&handle->h_node);
list_del_init(&handle->d_node);
......@@ -591,14 +585,13 @@ static unsigned int input_devices_poll(struct file *file, poll_table *wait)
static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
{
struct list_head * node;
struct input_dev *dev;
struct input_handle *handle;
off_t at = 0;
int i, len, cnt = 0;
list_for_each(node,&input_dev_list) {
struct input_dev * dev = to_dev(node);
struct list_head * hnode;
list_for_each_entry(dev, &input_dev_list, node) {
len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n",
dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);
......@@ -607,10 +600,8 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : "");
len += sprintf(buf + len, "H: Handlers=");
list_for_each(hnode,&dev->h_list) {
struct input_handle * handle = to_handle(hnode);
list_for_each_entry(handle, &dev->h_list, d_node)
len += sprintf(buf + len, "%s ", handle->name);
}
len += sprintf(buf + len, "\n");
......@@ -638,7 +629,7 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
}
}
if (node == &input_dev_list)
if (&dev->node == &input_dev_list)
*eof = 1;
return (count > cnt) ? cnt : count;
......@@ -646,14 +637,13 @@ static int input_devices_read(char *buf, char **start, off_t pos, int count, int
static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data)
{
struct list_head * node;
struct input_handler *handler;
off_t at = 0;
int len = 0, cnt = 0;
int i = 0;
list_for_each(node,&input_handler_list) {
struct input_handler *handler = to_handler(node);
list_for_each_entry(handler, &input_handler_list, node) {
if (handler->fops)
len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n",
......@@ -674,7 +664,7 @@ static int input_handlers_read(char *buf, char **start, off_t pos, int count, in
break;
}
}
if (node == &input_handler_list)
if (&handler->node == &input_handler_list)
*eof = 1;
return (count > cnt) ? cnt : count;
......
/*
* $Id: joydev.c,v 1.43 2002/04/09 23:59:01 jsimmons Exp $
* Joystick device driver for the input driver suite.
*
* Copyright (c) 1999-2001 Vojtech Pavlik
* Copyright (c) 1999-2002 Vojtech Pavlik
* Copyright (c) 1999 Colin Van Dyke
*
* Joystick device driver for the input driver suite.
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
#include <asm/io.h>
......@@ -63,8 +46,7 @@ struct joydev {
struct input_handle handle;
wait_queue_head_t wait;
devfs_handle_t devfs;
struct joydev *next;
struct joydev_list *list;
struct list_head list;
struct js_corr corr[ABS_MAX];
struct JS_DATA_SAVE_TYPE glue;
int nabs;
......@@ -83,7 +65,7 @@ struct joydev_list {
int startup;
struct fasync_struct *fasync;
struct joydev *joydev;
struct joydev_list *next;
struct list_head node;
};
static struct joydev *joydev_table[JOYDEV_MINORS];
......@@ -111,7 +93,7 @@ static int joydev_correct(int value, struct js_corr *corr)
static void joydev_event(struct input_handle *handle, unsigned int type, unsigned int code, int value)
{
struct joydev *joydev = handle->private;
struct joydev_list *list = joydev->list;
struct joydev_list *list;
struct js_event event;
switch (type) {
......@@ -137,7 +119,7 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne
event.time = MSECS(jiffies);
while (list) {
list_for_each_entry(list, &joydev->list, node) {
memcpy(list->buffer + list->head, &event, sizeof(struct js_event));
......@@ -146,8 +128,6 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne
list->startup = 0;
kill_fasync(&list->fasync, SIGIO, POLL_IN);
list = list->next;
}
wake_up_interruptible(&joydev->wait);
......@@ -164,14 +144,10 @@ static int joydev_fasync(int fd, struct file *file, int on)
static int joydev_release(struct inode * inode, struct file * file)
{
struct joydev_list *list = file->private_data;
struct joydev_list **listptr;
listptr = &list->joydev->list;
joydev_fasync(-1, file, 0);
while (*listptr && (*listptr != list))
listptr = &((*listptr)->next);
*listptr = (*listptr)->next;
list_del(&list->node);
if (!--list->joydev->open) {
if (list->joydev->exist) {
......@@ -201,9 +177,7 @@ static int joydev_open(struct inode *inode, struct file *file)
memset(list, 0, sizeof(struct joydev_list));
list->joydev = joydev_table[i];
list->next = joydev_table[i]->list;
joydev_table[i]->list = list;
list_add_tail(&list->node, &joydev_table[i]->list);
file->private_data = list;
if (!list->joydev->open++)
......@@ -220,12 +194,14 @@ static ssize_t joydev_write(struct file * file, const char * buffer, size_t coun
static ssize_t joydev_read(struct file *file, char *buf, size_t count, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
struct joydev_list *list = file->private_data;
struct joydev *joydev = list->joydev;
struct input_dev *input = joydev->handle.dev;
int retval = 0;
if (!list->joydev->exist)
return -ENODEV;
if (count < sizeof(struct js_event))
return -EINVAL;
......@@ -248,36 +224,19 @@ static ssize_t joydev_read(struct file *file, char *buf, size_t count, loff_t *p
return sizeof(struct JS_DATA_TYPE);
}
if (list->head == list->tail && list->startup == joydev->nabs + joydev->nkey) {
add_wait_queue(&list->joydev->wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
if (list->startup == joydev->nabs + joydev->nkey
&& list->head == list->tail && (file->f_flags & O_NONBLOCK))
return -EAGAIN;
while (list->head == list->tail) {
if (!joydev->exist) {
retval = -ENODEV;
break;
}
if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
break;
}
if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&list->joydev->wait, &wait);
}
retval = wait_event_interruptible(list->joydev->wait, list->joydev->exist
&& (list->startup < joydev->nabs + joydev->nkey || list->head != list->tail));
if (retval)
return retval;
if (!list->joydev->exist)
return -ENODEV;
while (list->startup < joydev->nabs + joydev->nkey && retval + sizeof(struct js_event) <= count) {
struct js_event event;
......@@ -431,17 +390,16 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
return NULL;
memset(joydev, 0, sizeof(struct joydev));
INIT_LIST_HEAD(&joydev->list);
init_waitqueue_head(&joydev->wait);
joydev->minor = minor;
joydev_table[minor] = joydev;
sprintf(joydev->name, "js%d", minor);
joydev->exist = 1;
joydev->handle.dev = dev;
joydev->handle.name = joydev->name;
joydev->handle.handler = handler;
joydev->handle.private = joydev;
sprintf(joydev->name, "js%d", minor);
for (i = 0; i < ABS_MAX; i++)
if (test_bit(i, dev->absbit)) {
......@@ -482,10 +440,9 @@ static struct input_handle *joydev_connect(struct input_handler *handler, struct
joydev->abs[i] = joydev_correct(dev->abs[j], joydev->corr + i);
}
joydev_table[minor] = joydev;
joydev->devfs = input_register_minor("js%d", minor, JOYDEV_MINOR_BASE);
joydev->exist = 1;
return &joydev->handle;
}
......
......@@ -300,6 +300,8 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
a3d->length = 33;
init_input_dev(&a3d->dev);
a3d->dev.evbit[0] |= BIT(EV_ABS) | BIT(EV_KEY) | BIT(EV_REL);
a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y);
a3d->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_THROTTLE) | BIT(ABS_RUDDER)
......@@ -328,6 +330,8 @@ static void a3d_connect(struct gameport *gameport, struct gameport_dev *dev)
} else {
a3d->length = 29;
init_input_dev(&a3d->dev);
a3d->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_REL);
a3d->dev.relbit[0] |= BIT(REL_X) | BIT(REL_Y);
a3d->dev.keybit[LONG(BTN_MOUSE)] |= BIT(BTN_RIGHT) | BIT(BTN_LEFT) | BIT(BTN_MIDDLE);
......
......@@ -404,6 +404,8 @@ static void adi_init_input(struct adi *adi, struct adi_port *port, int half)
if (!adi->length) return;
init_input_dev(&adi->dev);
t = adi->id < ADI_ID_MAX ? adi->id : ADI_ID_MAX;
sprintf(buf, adi_names[t], adi->id);
......
......@@ -431,9 +431,10 @@ static void analog_init_device(struct analog_port *port, struct analog *analog,
analog_name(analog);
sprintf(analog->phys, "%s/input%d", port->gameport->phys, index);
analog->buttons = (analog->mask & ANALOG_GAMEPAD) ? analog_pad_btn : analog_joy_btn;
init_input_dev(&analog->dev);
analog->dev.name = analog->name;
analog->dev.phys = analog->phys;
analog->dev.id.bustype = BUS_GAMEPORT;
......
......@@ -290,6 +290,8 @@ static void gf2k_connect(struct gameport *gameport, struct gameport_dev *dev)
gf2k->length = gf2k_lens[gf2k->id];
init_input_dev(&gf2k->dev);
gf2k->dev.private = gf2k;
gf2k->dev.open = gf2k_open;
gf2k->dev.close = gf2k_close;
......
......@@ -169,6 +169,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev)
sprintf(magellan->phys, "%s/input0", serio->phys);
init_input_dev(&magellan->dev);
magellan->dev.private = magellan;
magellan->dev.name = magellan_name;
magellan->dev.phys = magellan->phys;
......@@ -187,6 +188,7 @@ static void magellan_connect(struct serio *serio, struct serio_dev *dev)
input_register_device(&magellan->dev);
printk(KERN_INFO "input: %s on %s\n", magellan_name, serio->phys);
}
/*
......
......@@ -240,6 +240,7 @@ static void spaceball_connect(struct serio *serio, struct serio_dev *dev)
sprintf(spaceball->phys, "%s/input0", serio->phys);
init_input_dev(&spaceball->dev);
spaceball->dev.name = spaceball_names[id];
spaceball->dev.phys = spaceball->phys;
spaceball->dev.id.bustype = BUS_RS232;
......
......@@ -187,6 +187,7 @@ static void spaceorb_connect(struct serio *serio, struct serio_dev *dev)
sprintf(spaceorb->phys, "%s/input0", serio->phys);
init_input_dev(&spaceorb->dev);
spaceorb->dev.name = spaceorb_name;
spaceorb->dev.phys = spaceorb->phys;
spaceorb->dev.id.bustype = BUS_RS232;
......
......@@ -152,6 +152,7 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev)
sprintf(stinger->phys, "%s/serio0", serio->phys);
init_input_dev(&stinger->dev);
stinger->dev.name = stinger_name;
stinger->dev.phys = stinger->phys;
stinger->dev.id.bustype = BUS_RS232;
......@@ -166,7 +167,6 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev)
}
stinger->dev.private = stinger;
serio->private = stinger;
if (serio_open(serio, dev)) {
......@@ -177,6 +177,7 @@ static void stinger_connect(struct serio *serio, struct serio_dev *dev)
input_register_device(&stinger->dev);
printk(KERN_INFO "input: %s on %s\n", stinger_name, serio->phys);
}
/*
......
......@@ -198,6 +198,7 @@ static void twidjoy_connect(struct serio *serio, struct serio_dev *dev)
sprintf(twidjoy->phys, "%s/input0", serio->phys);
init_input_dev(&twidjoy->dev);
twidjoy->dev.name = twidjoy_name;
twidjoy->dev.phys = twidjoy->phys;
twidjoy->dev.id.bustype = BUS_RS232;
......@@ -224,7 +225,6 @@ static void twidjoy_connect(struct serio *serio, struct serio_dev *dev)
}
twidjoy->dev.private = twidjoy;
serio->private = twidjoy;
if (serio_open(serio, dev)) {
......
......@@ -155,6 +155,7 @@ static void warrior_connect(struct serio *serio, struct serio_dev *dev)
sprintf(warrior->phys, "%s/input0", serio->phys);
init_input_dev(&warrior->dev);
warrior->dev.name = warrior_name;
warrior->dev.phys = warrior->phys;
warrior->dev.id.bustype = BUS_RS232;
......
......@@ -112,6 +112,8 @@ static int __init amikbd_init(void)
if (!request_mem_region(CIAA_PHYSADDR-1+0xb00, 0x100, "amikeyb"))
return -EBUSY;
init_input_dev(&amibkd_dev);
amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
amikbd_dev.keycode = amikbd_keycode;
amikbd_dev.keycodesize = sizeof(unsigned char);
......
......@@ -22,9 +22,15 @@
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
MODULE_DESCRIPTION("AT and PS/2 keyboard driver");
MODULE_PARM(atkbd_set, "1i");
MODULE_PARM(atkbd_reset, "1i");
MODULE_LICENSE("GPL");
static int atkbd_set = 2;
#if defined(__i386__) || defined (__x86_64__)
static int atkbd_reset;
#else
static int atkbd_reset = 1;
#endif
/*
* Scancode to keycode tables. These are just the default setting, and
......@@ -49,11 +55,11 @@ static unsigned char atkbd_set2_keycode[512] = {
252,253, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,
0, 0, 92, 90, 85, 0,137, 0, 0, 0, 0, 91, 89,144,115, 0,
136,100,255, 0, 97,149,164, 0,156, 0, 0,140,115, 0, 0,125,
0,150, 0,154,152,163,151,126,112,166, 0,140, 0,147, 0,127,
159,167,139,160,163, 0, 0,116,158, 0,150,165, 0, 0, 0,142,
157, 0,114,166,168, 0, 0, 0,155, 0, 98,113, 0,148, 0,138,
0, 0, 0, 0, 0, 0,153,140, 0,255, 96, 0, 0, 0,143, 0,
217,100,255, 0, 97,165,164, 0,156, 0, 0,140,115, 0, 0,125,
173,114, 0,113,152,163,151,126,128,166, 0,140, 0,147, 0,127,
159,167,115,160,164, 0, 0,116,158, 0,150,166, 0, 0, 0,142,
157, 0,114,166,168, 0, 0, 0,155, 0, 98,113, 0,163, 0,138,
226, 0, 0, 0, 0, 0,153,140, 0,255, 96, 0, 0, 0,143, 0,
133, 0,116, 0,143, 0,174,133, 0,107, 0,105,102, 0, 0,112,
110,111,108,112,106,103, 0,119, 0,118,109, 0, 99,104,119
};
......@@ -67,7 +73,7 @@ static unsigned char atkbd_set3_keycode[512] = {
113,114, 40, 84, 26, 13, 87, 99,100, 54, 28, 27, 43, 84, 88, 70,
108,105,119,103,111,107, 14,110, 0, 79,106, 75, 71,109,102,104,
82, 83, 80, 76, 77, 72, 69, 98, 0, 96, 81, 0, 78, 73, 55, 85,
89, 90, 91, 92, 74, 0, 0, 0, 0, 0, 0,125,126,127,112, 0,
89, 90, 91, 92, 74,185,184,182, 0, 0, 0,125,126,127,112, 0,
0,139,150,163,165,115,152,150,166,140,160,154,113,114,167,168,
148,149,147,140, 0, 0, 0, 0, 0, 0,251, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
......@@ -89,6 +95,7 @@ static unsigned char atkbd_set3_keycode[512] = {
#define ATKBD_CMD_RESEND 0x00fe
#define ATKBD_CMD_EX_ENABLE 0x10ea
#define ATKBD_CMD_EX_SETLEDS 0x20eb
#define ATKBD_CMD_OK_GETID 0x02e8
#define ATKBD_RET_ACK 0xfa
#define ATKBD_RET_NAK 0xfe
......@@ -113,6 +120,7 @@ struct atkbd {
unsigned char cmdbuf[4];
unsigned char cmdcnt;
unsigned char set;
unsigned char oldset;
unsigned char release;
signed char ack;
unsigned char emul;
......@@ -134,7 +142,6 @@ static void atkbd_interrupt(struct serio *serio, unsigned char data, unsigned in
printk(KERN_DEBUG "atkbd.c: Received %02x flags %02x\n", data, flags);
#endif
/* Interface error. Request that the keyboard resend. */
if ((flags & (SERIO_FRAME | SERIO_PARITY)) && (~flags & SERIO_TIMEOUT) && atkbd->write) {
printk("atkbd.c: frame/parity error: %02x\n", flags);
serio_write(serio, ATKBD_CMD_RESEND);
......@@ -205,7 +212,9 @@ static int atkbd_sendbyte(struct atkbd *atkbd, unsigned char byte)
#ifdef ATKBD_DEBUG
printk(KERN_DEBUG "atkbd.c: Sent: %02x\n", byte);
#endif
serio_write(atkbd->serio, byte);
if (serio_write(atkbd->serio, byte))
return -1;
while (!atkbd->ack && timeout--) udelay(10);
return -(atkbd->ack <= 0);
......@@ -289,34 +298,42 @@ static int atkbd_event(struct input_dev *dev, unsigned int type, unsigned int co
static int atkbd_set_3(struct atkbd *atkbd)
{
unsigned char param;
unsigned char param[2];
/*
* Remember original scancode set value, so that we can restore it on exit.
*/
if (atkbd_command(atkbd, &atkbd->oldset, ATKBD_CMD_GSCANSET))
atkbd->oldset = 2;
/*
* For known special keyboards we can go ahead and set the correct set.
* We check for NCD PS/2 Sun, NorthGate OmniKey 101 and IBM RapidAccess
* keyboards.
*/
if (atkbd->id == 0xaca1) {
param = 3;
atkbd_command(atkbd, &param, ATKBD_CMD_SSCANSET);
param[0] = 3;
atkbd_command(atkbd, param, ATKBD_CMD_SSCANSET);
return 3;
}
/*
* We check for the extra keys on an some keyboards that need extra
* command to get enabled. This shouldn't harm any keyboards not
* knowing the command.
*/
if (!atkbd_command(atkbd, param, ATKBD_CMD_OK_GETID)) {
atkbd->id = param[0] << 8 | param[1];
return 2;
}
param = 0x71;
if (!atkbd_command(atkbd, &param, ATKBD_CMD_EX_ENABLE))
param[0] = 0x71;
if (!atkbd_command(atkbd, param, ATKBD_CMD_EX_ENABLE))
return 4;
/*
* Try to set the set we want.
*/
param = atkbd_set;
if (atkbd_command(atkbd, &param, ATKBD_CMD_SSCANSET))
param[0] = atkbd_set;
if (atkbd_command(atkbd, param, ATKBD_CMD_SSCANSET))
return 2;
/*
......@@ -327,8 +344,8 @@ static int atkbd_set_3(struct atkbd *atkbd)
* In that case we time out, and return 2.
*/
param = 0;
if (atkbd_command(atkbd, &param, ATKBD_CMD_GSCANSET))
param[0] = 0;
if (atkbd_command(atkbd, param, ATKBD_CMD_GSCANSET))
return 2;
/*
......@@ -336,7 +353,7 @@ static int atkbd_set_3(struct atkbd *atkbd)
* itself.
*/
return (param == 3) ? 3 : 2;
return (param[0] == 3) ? 3 : 2;
}
/*
......@@ -353,10 +370,9 @@ static int atkbd_probe(struct atkbd *atkbd)
* these systems the BIOS also usually doesn't do it for us.
*/
#ifdef CONFIG_KEYBOARD_ATKBD_RESET
if (atkbd_reset)
if (atkbd_command(atkbd, NULL, ATKBD_CMD_RESET_BAT))
printk(KERN_WARNING "atkbd.c: keyboard reset failed\n");
#endif
/*
* Next we check we can set LEDs on the keyboard. This should work on every
......@@ -405,7 +421,18 @@ static int atkbd_probe(struct atkbd *atkbd)
}
/*
* atkbd_disconnect() cleans up behind us ...
* atkbd_cleanup() restores the keyboard state so that BIOS is happy after a
* reboot.
*/
static void atkbd_cleanup(struct serio *serio)
{
struct atkbd *atkbd = serio->private;
atkbd_command(atkbd, &atkbd->oldset, ATKBD_CMD_SSCANSET);
}
/*
* atkbd_disconnect() closes and frees.
*/
static void atkbd_disconnect(struct serio *serio)
......@@ -447,6 +474,8 @@ static void atkbd_connect(struct serio *serio, struct serio_dev *dev)
atkbd->serio = serio;
init_input_dev(&atkbd->dev);
atkbd->dev.keycode = atkbd->keycode;
atkbd->dev.keycodesize = sizeof(unsigned char);
atkbd->dev.keycodemax = ARRAY_SIZE(atkbd_set2_keycode);
......@@ -508,18 +537,28 @@ static void atkbd_connect(struct serio *serio, struct serio_dev *dev)
static struct serio_dev atkbd_dev = {
.interrupt = atkbd_interrupt,
.connect = atkbd_connect,
.disconnect = atkbd_disconnect
.disconnect = atkbd_disconnect,
.cleanup = atkbd_cleanup,
};
#ifndef MODULE
static int __init atkbd_setup(char *str)
static int __init atkbd_setup_set(char *str)
{
int ints[4];
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] > 0) atkbd_set = ints[1];
return 1;
}
__setup("atkbd_set=", atkbd_setup);
static int __init atkbd_setup_reset(char *str)
{
int ints[4];
str = get_options(str, ARRAY_SIZE(ints), ints);
if (ints[0] > 0) atkbd_reset = ints[1];
return 1;
}
__setup("atkbd_set=", atkbd_setup_set);
__setup("atkbd_reset", atkbd_setup_reset);
#endif
int __init atkbd_init(void)
......
......@@ -93,11 +93,11 @@ void nkbd_connect(struct serio *serio, struct serio_dev *dev)
nkbd->serio = serio;
init_input_dev(&nkbd->dev);
nkbd->dev.keycode = nkbd->keycode;
nkbd->dev.keycodesize = sizeof(unsigned char);
nkbd->dev.keycodemax = ARRAY_SIZE(nkbd_keycode);
nkbd->dev.private = nkbd;
serio->private = nkbd;
if (serio_open(serio, dev)) {
......
......@@ -234,6 +234,8 @@ static void sunkbd_connect(struct serio *serio, struct serio_dev *dev)
memset(sunkbd, 0, sizeof(struct sunkbd));
init_input_dev(&sunkbd->dev);
sunkbd->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_SND) | BIT(EV_REP);
sunkbd->dev.ledbit[0] = BIT(LED_CAPSL) | BIT(LED_COMPOSE) | BIT(LED_SCROLLL) | BIT(LED_NUML);
sunkbd->dev.sndbit[0] = BIT(SND_CLICK) | BIT(SND_BELL);
......
......@@ -100,6 +100,7 @@ void xtkbd_connect(struct serio *serio, struct serio_dev *dev)
xtkbd->serio = serio;
init_input_dev(&xtkbd->dev);
xtkbd->dev.keycode = xtkbd->keycode;
xtkbd->dev.keycodesize = sizeof(unsigned char);
xtkbd->dev.keycodemax = ARRAY_SIZE(xtkbd_keycode);
......
......@@ -8,4 +8,7 @@ dep_tristate ' PC Speaker support' CONFIG_INPUT_PCSPKR $CONFIG_INPUT $CONFIG_IN
if [ "$CONFIG_SPARC32" = "y" -o "$CONFIG_SPARC64" = "y" ]; then
dep_tristate ' SPARC Speaker support' CONFIG_INPUT_SPARCSPKR $CONFIG_INPUT $CONFIG_INPUT_MISC
fi
if [ "$CONFIG_M68K" = "y" ]; then
dep_tristate ' M68k Beeper support' CONFIG_INPUT_M68K_BEEP $CONFIG_INPUT $CONFIG_INPUT_MISC
fi
dep_tristate ' User level driver support' CONFIG_INPUT_UINPUT $CONFIG_INPUT $CONFIG_INPUT_MISC
......@@ -6,6 +6,7 @@
obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o
obj-$(CONFIG_INPUT_PCSPKR) += pcspkr.o
obj-$(CONFIG_INPUT_M68K_BEEP) += m68kspkr.o
obj-$(CONFIG_INPUT_UINPUT) += uinput.o
# The global Rules.make.
......
/*
* m68k beeper driver for Linux
*
* Copyright (c) 2002 Richard Zidlicky
* Copyright (c) 2002 Vojtech Pavlik
* Copyright (c) 1992 Orest Zborowski
*
*/
/*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/input.h>
#include <asm/machdep.h>
#include <asm/io.h>
MODULE_AUTHOR("Richard Zidlicky <rz@linux-m68k.org>");
MODULE_DESCRIPTION("m68k beeper driver");
MODULE_LICENSE("GPL");
static char m68kspkr_name[] = "m68k beeper";
static char m68kspkr_phys[] = "m68k/generic";
static struct input_dev m68kspkr_dev;
static int m68kspkr_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
{
unsigned int count = 0;
if (type != EV_SND)
return -1;
switch (code) {
case SND_BELL: if (value) value = 1000;
case SND_TONE: break;
default: return -1;
}
if (value > 20 && value < 32767)
count = 1193182 / value;
mach_beep(count, -1);
return 0;
}
static int __init m68kspkr_init(void)
{
if (!mach_beep){
printk("%s: no lowlevel beep support\n", m68kspkr_name);
return -1;
}
m68kspkr_dev.evbit[0] = BIT(EV_SND);
m68kspkr_dev.sndbit[0] = BIT(SND_BELL) | BIT(SND_TONE);
m68kspkr_dev.event = m68kspkr_event;
m68kspkr_dev.name = m68kspkr_name;
m68kspkr_dev.phys = m68kspkr_phys;
m68kspkr_dev.id.bustype = BUS_HOST;
m68kspkr_dev.id.vendor = 0x001f;
m68kspkr_dev.id.product = 0x0001;
m68kspkr_dev.id.version = 0x0100;
input_register_device(&m68kspkr_dev);
printk(KERN_INFO "input: %s\n", m68kspkr_name);
return 0;
}
static void __exit m68kspkr_exit(void)
{
input_unregister_device(&m68kspkr_dev);
}
module_init(m68kspkr_init);
module_exit(m68kspkr_exit);
......@@ -115,6 +115,12 @@ static struct input_dev inport_dev = {
.close = inport_close,
.name = INPORT_NAME,
.phys = "isa023c/input0",
.id = {
.bustype = BUS_ISA,
.vendor = INPORT_VENDOR,
.product = 0x0001,
.version = 0x0100,
},
};
static void inport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
......@@ -158,30 +164,27 @@ static int __init inport_init(void)
{
unsigned char a,b,c;
if (check_region(INPORT_BASE, INPORT_EXTENT))
if (!request_region(INPORT_BASE, INPORT_EXTENT, "inport")) {
printk(KERN_ERR "inport.c: Can't allocate ports at %#x\n", INPORT_BASE);
return -EBUSY;
}
a = inb(INPORT_SIGNATURE_PORT);
b = inb(INPORT_SIGNATURE_PORT);
c = inb(INPORT_SIGNATURE_PORT);
if (( a == b ) || ( a != c ))
if (( a == b ) || ( a != c )) {
release_region(INPORT_BASE, INPORT_EXTENT);
printk(KERN_ERR "inport.c: Didn't find InPort mouse at %#x\n", INPORT_BASE);
return -ENODEV;
}
outb(INPORT_RESET, INPORT_CONTROL_PORT);
outb(INPORT_REG_MODE, INPORT_CONTROL_PORT);
outb(INPORT_MODE_BASE, INPORT_DATA_PORT);
request_region(INPORT_BASE, INPORT_EXTENT, "inport");
input_register_device(&inport_dev);
inport_dev.id.bustype =BUS_ISA;
inport_dev.id.vendor =INPORT_VENDOR;
inport_dev.id.product =0x0001;
inport_dev.id.version =0x0100;
printk(KERN_INFO "input: " INPORT_NAME " at %#x irq %d\n",
INPORT_BASE, inport_irq);
printk(KERN_INFO "input: " INPORT_NAME " at %#x irq %d\n", INPORT_BASE, inport_irq);
return 0;
}
......
......@@ -105,6 +105,12 @@ static struct input_dev logibm_dev = {
.close = logibm_close,
.name = "Logitech bus mouse",
.phys = "isa023c/input0",
.id = {
.bustype = BUS_ISA,
.vendor = 0x0003,
.product = 0x0001,
.version = 0x0100,
},
};
static void logibm_interrupt(int irq, void *dev_id, struct pt_regs *regs)
......@@ -165,10 +171,6 @@ static int __init logibm_init(void)
outb(LOGIBM_DISABLE_IRQ, LOGIBM_CONTROL_PORT);
input_register_device(&logibm_dev);
logibm_dev.id.bustype = BUS_ISA;
logibm_dev.id.vendor = 0x0003;
logibm_dev.id.product = 0x0001;
logibm_dev.id.version = 0x0100;
printk(KERN_INFO "input: Logitech bus mouse at %#x irq %d\n", LOGIBM_BASE, logibm_irq);
......
......@@ -20,8 +20,11 @@
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
MODULE_DESCRIPTION("PS/2 mouse driver");
MODULE_PARM(psmouse_noext, "1i");
MODULE_LICENSE("GPL");
static int psmouse_noext;
#define PSMOUSE_CMD_SETSCALE11 0x00e6
#define PSMOUSE_CMD_SETRES 0x10e8
#define PSMOUSE_CMD_GETINFO 0x03e9
......@@ -32,6 +35,7 @@ MODULE_LICENSE("GPL");
#define PSMOUSE_CMD_SETRATE 0x10f3
#define PSMOUSE_CMD_ENABLE 0x00f4
#define PSMOUSE_CMD_RESET_DIS 0x00f6
#define PSMOUSE_CMD_RESET_BAT 0x02ff
#define PSMOUSE_RET_BAT 0xaa
#define PSMOUSE_RET_ACK 0xfa
......@@ -197,7 +201,7 @@ static void psmouse_interrupt(struct serio *serio, unsigned char data, unsigned
psmouse->packet[psmouse->pktcnt++] = data;
if (psmouse->pktcnt == 3 + (psmouse->type >= PSMOUSE_GENPS)) {
if ((psmouse->packet[0] & 0x08) == 0x08) psmouse_process_packet(psmouse);
psmouse_process_packet(psmouse);
psmouse->pktcnt = 0;
return;
}
......@@ -220,7 +224,11 @@ static int psmouse_sendbyte(struct psmouse *psmouse, unsigned char byte)
psmouse->ack = 0;
psmouse->acking = 1;
serio_write(psmouse->serio, byte);
if (serio_write(psmouse->serio, byte)) {
psmouse->acking = 0;
return -1;
}
while (!psmouse->ack && timeout--) udelay(10);
return -(psmouse->ack <= 0);
......@@ -300,6 +308,9 @@ static int psmouse_extensions(struct psmouse *psmouse)
psmouse->name = "Mouse";
psmouse->model = 0;
if (psmouse_noext)
return PSMOUSE_PS2;
/*
* Try Genius NetMouse magic init.
*/
......@@ -336,8 +347,8 @@ static int psmouse_extensions(struct psmouse *psmouse)
if (param[1]) {
int i;
static int logitech_4btn[] = { 12, 40, 41, 42, 43, 73, 80, -1 };
static int logitech_wheel[] = { 75, 76, 80, 81, 83, 88, -1 };
static int logitech_4btn[] = { 12, 40, 41, 42, 43, 52, 73, 80, -1 };
static int logitech_wheel[] = { 52, 75, 76, 80, 81, 83, 88, -1 };
static int logitech_ps2pp[] = { 12, 13, 40, 41, 42, 43, 50, 51, 52, 53, 73, 75,
76, 80, 81, 83, 88, 96, 97, -1 };
psmouse->vendor = "Logitech";
......@@ -527,15 +538,24 @@ static void psmouse_initialize(struct psmouse *psmouse)
* Last, we enable the mouse so that we get reports from it.
*/
if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_ENABLE)) {
if (psmouse_command(psmouse, NULL, PSMOUSE_CMD_ENABLE))
printk(KERN_WARNING "psmouse.c: Failed to enable mouse on %s\n", psmouse->serio->phys);
}
}
/*
* psmouse_disconnect() cleans up after we don't want talk
* to the mouse anymore.
* psmouse_cleanup() resets the mouse into power-on state.
*/
static void psmouse_cleanup(struct serio *serio)
{
struct psmouse *psmouse = serio->private;
unsigned char param[2];
psmouse_command(psmouse, param, PSMOUSE_CMD_RESET_BAT);
}
/*
* psmouse_disconnect() closes and frees.
*/
static void psmouse_disconnect(struct serio *serio)
......@@ -563,6 +583,7 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev)
memset(psmouse, 0, sizeof(struct psmouse));
init_input_dev(&psmouse->dev);
psmouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
psmouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
psmouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
......@@ -605,9 +626,19 @@ static void psmouse_connect(struct serio *serio, struct serio_dev *dev)
static struct serio_dev psmouse_dev = {
.interrupt = psmouse_interrupt,
.connect = psmouse_connect,
.disconnect = psmouse_disconnect
.disconnect = psmouse_disconnect,
.cleanup = psmouse_cleanup,
};
#ifndef MODULE
static int __init psmouse_setup(char *str)
{
psmouse_noext = 1;
return 1;
}
__setup("psmouse_noext", psmouse_setup);
#endif
int __init psmouse_init(void)
{
serio_register_device(&psmouse_dev);
......
......@@ -41,6 +41,12 @@ static struct input_dev rpcmouse_dev = {
.relbit = { BIT(REL_X) | BIT(REL_Y) },
.name = "Acorn RiscPC Mouse",
.phys = "rpcmouse/input0",
.id = {
.bustype = BUS_HOST,
.vendor = 0x0005,
.product = 0x0001,
.version = 0x0100,
},
};
static void rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs)
......@@ -69,6 +75,8 @@ static void rpcmouse_irq(int irq, void *dev_id, struct pt_regs *regs)
static int __init rpcmouse_init(void)
{
init_input_dev(&rpcmouse_dev);
rpcmouse_lastx = (short) iomd_readl(IOMD_MOUSEX);
rpcmouse_lasty = (short) iomd_readl(IOMD_MOUSEY);
......@@ -78,10 +86,6 @@ static int __init rpcmouse_init(void)
}
input_register_device(&rpcmouse_dev);
rpcmouse.id.bustype =BUS_HOST,
rpcmouse.id.vendor =0x0005,
rpcmouse.id.product =0x0001,
rpcmouse.id.version =0x0100,
printk(KERN_INFO "input: Acorn RiscPC mouse irq %d", IRQ_VSYNCPULSE);
......
......@@ -155,7 +155,7 @@ static void sermouse_process_ms(struct sermouse *sermouse, signed char data)
case SERIO_MZ:
input_report_key(dev, BTN_MIDDLE, (data >> 4) & 1);
input_report_rel(dev, REL_WHEEL, (data & 7) - (data & 8));
input_report_rel(dev, REL_WHEEL, (data & 8) - (data & 7));
break;
}
......@@ -204,7 +204,7 @@ static void sermouse_interrupt(struct serio *serio, unsigned char data, unsigned
{
struct sermouse *sermouse = serio->private;
if (time_after(jiffies, sermouse->last + HZ/20)) sermouse->count = 0;
if (time_after(jiffies, sermouse->last + HZ/10)) sermouse->count = 0;
sermouse->last = jiffies;
if (sermouse->type > SERIO_SUN)
......@@ -247,6 +247,7 @@ static void sermouse_connect(struct serio *serio, struct serio_dev *dev)
memset(sermouse, 0, sizeof(struct sermouse));
init_input_dev(&sermouse->dev);
sermouse->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
sermouse->dev.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT);
sermouse->dev.relbit[0] = BIT(REL_X) | BIT(REL_Y);
......
/*
* $Id: mousedev.c,v 1.42 2002/04/09 20:51:26 jdeneux Exp $
*
* Copyright (c) 1999-2001 Vojtech Pavlik
*
* Input driver to ExplorerPS/2 device driver module.
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* Copyright (c) 1999-2002 Vojtech Pavlik
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#define MOUSEDEV_MINOR_BASE 32
......@@ -61,7 +43,7 @@ struct mousedev {
int minor;
char name[16];
wait_queue_head_t wait;
struct mousedev_list *list;
struct list_head list;
struct input_handle handle;
devfs_handle_t devfs;
};
......@@ -69,7 +51,7 @@ struct mousedev {
struct mousedev_list {
struct fasync_struct *fasync;
struct mousedev *mousedev;
struct mousedev_list *next;
struct list_head node;
int dx, dy, dz, oldx, oldy;
signed char ps2[6];
unsigned long buttons;
......@@ -98,9 +80,10 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
int index, size, wake;
while (*mousedev) {
wake = 0;
list = (*mousedev)->list;
while (list) {
list_for_each_entry(list, &(*mousedev)->list, node)
switch (type) {
case EV_ABS:
if (test_bit(BTN_TRIGGER, handle->dev->keybit))
......@@ -116,6 +99,7 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
list->oldx += list->dx;
}
break;
case ABS_Y:
size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
if (size != 0) {
......@@ -170,10 +154,10 @@ static void mousedev_event(struct input_handle *handle, unsigned int type, unsig
break;
}
}
list = list->next;
}
if (wake)
wake_up_interruptible(&((*mousedev)->wait));
mousedev++;
}
}
......@@ -189,21 +173,17 @@ static int mousedev_fasync(int fd, struct file *file, int on)
static int mousedev_release(struct inode * inode, struct file * file)
{
struct mousedev_list *list = file->private_data;
struct mousedev_list **listptr;
struct input_handle *handle;
struct mousedev *mousedev;
listptr = &list->mousedev->list;
mousedev_fasync(-1, file, 0);
while (*listptr && (*listptr != list))
listptr = &((*listptr)->next);
*listptr = (*listptr)->next;
list_del(&list->node);
if (!--list->mousedev->open) {
if (list->mousedev->minor == MOUSEDEV_MIX) {
struct list_head * node;
list_for_each(node,&mousedev_handler.h_list) {
struct input_handle *handle = to_handle_h(node);
struct mousedev *mousedev = handle->private;
list_for_each_entry(handle, &mousedev_handler.h_list, h_node) {
mousedev = handle->private;
if (!mousedev->open) {
if (mousedev->exist) {
input_close_device(&mousedev->handle);
......@@ -235,6 +215,8 @@ static int mousedev_release(struct inode * inode, struct file * file)
static int mousedev_open(struct inode * inode, struct file * file)
{
struct mousedev_list *list;
struct input_handle *handle;
struct mousedev *mousedev;
int i;
#ifdef CONFIG_INPUT_MOUSEDEV_PSAUX
......@@ -252,26 +234,20 @@ static int mousedev_open(struct inode * inode, struct file * file)
memset(list, 0, sizeof(struct mousedev_list));
list->mousedev = mousedev_table[i];
list->next = mousedev_table[i]->list;
mousedev_table[i]->list = list;
list_add_tail(&list->node, &mousedev_table[i]->list);
file->private_data = list;
if (!list->mousedev->open++) {
if (list->mousedev->minor == MOUSEDEV_MIX) {
struct list_head * node;
list_for_each(node,&mousedev_handler.h_list) {
struct input_handle *handle = to_handle_h(node);
struct mousedev *mousedev = handle->private;
if (!mousedev->open)
if (mousedev->exist)
list_for_each_entry(handle, &mousedev_handler.h_list, h_node) {
mousedev = handle->private;
if (!mousedev->open && mousedev->exist)
input_open_device(handle);
}
} else {
if (!mousedev_mix.open)
if (list->mousedev->exist)
} else
if (!mousedev_mix.open && list->mousedev->exist)
input_open_device(&list->mousedev->handle);
}
}
return 0;
}
......@@ -373,35 +349,13 @@ static ssize_t mousedev_write(struct file * file, const char * buffer, size_t co
static ssize_t mousedev_read(struct file * file, char * buffer, size_t count, loff_t *ppos)
{
DECLARE_WAITQUEUE(wait, current);
struct mousedev_list *list = file->private_data;
int retval = 0;
if (!list->ready && !list->buffer) {
add_wait_queue(&list->mousedev->wait, &wait);
if (!list->ready && !list->buffer && (file->f_flags & O_NONBLOCK))
return -EAGAIN;
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
retval = 0;
if (list->ready || list->buffer)
break;
retval = -EAGAIN;
if (file->f_flags & O_NONBLOCK)
break;
retval = -ERESTARTSYS;
if (signal_pending(current))
break;
schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&list->mousedev->wait, &wait);
}
retval = wait_event_interruptible(list->mousedev->wait, list->ready || list->buffer);
if (retval)
return retval;
......@@ -454,23 +408,23 @@ static struct input_handle *mousedev_connect(struct input_handler *handler, stru
if (!(mousedev = kmalloc(sizeof(struct mousedev), GFP_KERNEL)))
return NULL;
memset(mousedev, 0, sizeof(struct mousedev));
INIT_LIST_HEAD(&mousedev->list);
init_waitqueue_head(&mousedev->wait);
mousedev->minor = minor;
mousedev_table[minor] = mousedev;
sprintf(mousedev->name, "mouse%d", minor);
mousedev->exist = 1;
mousedev->handle.dev = dev;
mousedev->handle.name = mousedev->name;
mousedev->handle.handler = handler;
mousedev->handle.private = mousedev;
mousedev->devfs = input_register_minor("mouse%d", minor, MOUSEDEV_MINOR_BASE);
sprintf(mousedev->name, "mouse%d", minor);
if (mousedev_mix.open)
input_open_device(&mousedev->handle);
mousedev->exist = 1;
mousedev_table[minor] = mousedev;
mousedev->devfs = input_register_minor("mouse%d", minor, MOUSEDEV_MINOR_BASE);
return &mousedev->handle;
}
......@@ -539,6 +493,7 @@ static int __init mousedev_init(void)
input_register_handler(&mousedev_handler);
memset(&mousedev_mix, 0, sizeof(struct mousedev));
INIT_LIST_HEAD(&mousedev_mix.list);
init_waitqueue_head(&mousedev_mix.wait);
mousedev_table[MOUSEDEV_MIX] = &mousedev_mix;
mousedev_mix.exist = 1;
......
......@@ -13,6 +13,7 @@
#define I8042_KBD_PHYS_DESC "isa0060/serio0"
#define I8042_AUX_PHYS_DESC "isa0060/serio1"
#define I8042_MUX_PHYS_DESC "isa0060/serio%d"
/*
* IRQs.
......@@ -64,9 +65,13 @@ static inline int i8042_platform_init(void)
*/
#if !defined(__i386__) && !defined(__sh__) && !defined(__alpha__) && !defined(__x86_64__)
if (!request_region(I8042_DATA_REG, 16, "i8042"))
return 0;
return -1;
#endif
#if !defined(__i386__) && !defined(__x86_64__)
i8042_reset = 1;
#endif
return 1;
return 0;
}
static inline void i8042_platform_exit(void)
......
......@@ -14,6 +14,7 @@
#define I8042_KBD_PHYS_DESC "walnutps2/serio0"
#define I8042_AUX_PHYS_DESC "walnutps2/serio1"
#define I8042_MUX_PHYS_DESC "walnutps2/serio%d"
extern void *kb_cs;
extern void *kb_data;
......@@ -34,18 +35,17 @@ static inline int i8042_read_status(void)
static inline void i8042_write_data(int val)
{
writeb(val, kb_data);
return;
}
static inline void i8042_write_command(int val)
{
writeb(val, kb_cs);
return;
}
static inline int i8042_platform_init(void)
{
return 1;
i8042_reset = 1;
return 0;
}
static inline void i8042_platform_exit(void)
......@@ -59,6 +59,7 @@ static inline void i8042_platform_exit(void)
#define I8042_KBD_PHYS_DESC "spruceps2/serio0"
#define I8042_AUX_PHYS_DESC "spruceps2/serio1"
#define I8042_MUX_PHYS_DESC "spruceps2/serio%d"
#define I8042_COMMAND_REG 0xff810000
#define I8042_DATA_REG 0xff810001
......@@ -109,18 +110,17 @@ static inline int i8042_read_status(void)
static inline void i8042_write_data(int val)
{
*((unsigned char *)0xff810000) = (char)val;
return;
}
static inline void i8042_write_command(int val)
{
*((unsigned char *)0xff810001) = (char)val;
return;
}
static inline int i8042_platform_init(void)
{
return 1;
i8042_reset = 1;
return 0;
}
static inline void i8042_platform_exit(void)
......
......@@ -11,6 +11,7 @@ static int i8042_aux_irq = -1;
#define I8042_KBD_PHYS_DESC "sparcps2/serio0"
#define I8042_AUX_PHYS_DESC "sparcps2/serio1"
#define I8042_MUX_PHYS_DESC "sparcps2/serio%d"
static unsigned long kbd_iobase;
......@@ -50,14 +51,14 @@ static int i8042_platform_init(void)
len = prom_getproperty(prom_root_node, "name", prop, sizeof(prop));
if (len < 0) {
printk("i8042: Cannot get name property of root OBP node.\n");
return 0;
return -1;
}
if (strncmp(prop, "SUNW,JavaStation-1", len) == 0) {
/* Hardcoded values for MrCoffee. */
i8042_kbd_irq = i8042_aux_irq = 13 | 0x20;
kbd_iobase = (unsigned long) ioremap(0x71300060, 8);
if (!kbd_iobase)
return 0;
return -1;
} else {
struct linux_ebus *ebus;
struct linux_ebus_device *edev;
......@@ -69,7 +70,7 @@ static int i8042_platform_init(void)
goto edev_found;
}
}
return 0;
return -1;
edev_found:
for_each_edevchild(edev, child) {
......@@ -87,11 +88,13 @@ static int i8042_platform_init(void)
i8042_aux_irq == -1) {
printk("i8042: Error, 8042 device lacks both kbd and "
"mouse nodes.\n");
return 0;
return -1;
}
}
return 1;
i8042_reset = 1;
return 0;
}
static inline void i8042_platform_exit(void)
......
......@@ -19,7 +19,9 @@
#include <linux/reboot.h>
#include <linux/init.h>
#include <linux/serio.h>
#include <linux/sched.h> /* request/free_irq */
#include <linux/sched.h>
#undef DEBUG
#include "i8042.h"
......@@ -31,13 +33,13 @@ MODULE_PARM(i8042_noaux, "1i");
MODULE_PARM(i8042_unlock, "1i");
MODULE_PARM(i8042_reset, "1i");
MODULE_PARM(i8042_direct, "1i");
MODULE_PARM(i8042_restore_ctr, "1i");
MODULE_PARM(i8042_dumbkbd, "1i");
static int i8042_noaux;
static int i8042_unlock;
static int i8042_reset;
static int i8042_direct;
static int i8042_restore_ctr;
static int i8042_dumbkbd;
spinlock_t i8042_lock = SPIN_LOCK_UNLOCKED;
......@@ -46,6 +48,7 @@ struct i8042_values {
unsigned char disable;
unsigned char irqen;
unsigned char exists;
signed char mux;
unsigned char *name;
unsigned char *phys;
};
......@@ -55,15 +58,12 @@ static struct serio i8042_aux_port;
static unsigned char i8042_initial_ctr;
static unsigned char i8042_ctr;
static unsigned char i8042_last_e0;
static unsigned char i8042_mux_open;
struct timer_list i8042_timer;
#ifdef I8042_DEBUG_IO
static unsigned long i8042_start;
#endif
extern struct pt_regs *kbd_pt_regs;
static unsigned long i8042_unxlate_seen[128 / BITS_PER_LONG];
static unsigned long i8042_unxlate_seen[256 / BITS_PER_LONG];
static unsigned char i8042_unxlate_table[128] = {
0,118, 22, 30, 38, 37, 46, 54, 61, 62, 70, 69, 78, 85,102, 13,
21, 29, 36, 45, 44, 53, 60, 67, 68, 77, 84, 91, 90, 20, 28, 27,
......@@ -110,18 +110,16 @@ static int i8042_wait_write(void)
static int i8042_flush(void)
{
unsigned long flags;
unsigned char data;
int i = 0;
spin_lock_irqsave(&i8042_lock, flags);
while ((i8042_read_status() & I8042_STR_OBF) && (i++ < I8042_BUFFER_SIZE))
#ifdef I8042_DEBUG_IO
printk(KERN_DEBUG "i8042.c: %02x <- i8042 (flush, %s) [%d]\n",
i8042_read_data(), i8042_read_status() & I8042_STR_AUXDATA ? "aux" : "kbd",
(int) (jiffies - i8042_start));
#else
i8042_read_data();
#endif
while ((i8042_read_status() & I8042_STR_OBF) && (i++ < I8042_BUFFER_SIZE)) {
data = i8042_read_data();
dbg("%02x <- i8042 (flush, %s)", data,
i8042_read_status() & I8042_STR_AUXDATA ? "aux" : "kbd");
}
spin_unlock_irqrestore(&i8042_lock, flags);
......@@ -145,20 +143,14 @@ static int i8042_command(unsigned char *param, int command)
retval = i8042_wait_write();
if (!retval) {
#ifdef I8042_DEBUG_IO
printk(KERN_DEBUG "i8042.c: %02x -> i8042 (command) [%d]\n",
command & 0xff, (int) (jiffies - i8042_start));
#endif
dbg("%02x -> i8042 (command)", command & 0xff);
i8042_write_command(command & 0xff);
}
if (!retval)
for (i = 0; i < ((command >> 12) & 0xf); i++) {
if ((retval = i8042_wait_write())) break;
#ifdef I8042_DEBUG_IO
printk(KERN_DEBUG "i8042.c: %02x -> i8042 (parameter) [%d]\n",
param[i], (int) (jiffies - i8042_start));
#endif
dbg("%02x -> i8042 (parameter)", param[i]);
i8042_write_data(param[i]);
}
......@@ -169,19 +161,13 @@ static int i8042_command(unsigned char *param, int command)
param[i] = ~i8042_read_data();
else
param[i] = i8042_read_data();
#ifdef I8042_DEBUG_IO
printk(KERN_DEBUG "i8042.c: %02x <- i8042 (return) [%d]\n",
param[i], (int) (jiffies - i8042_start));
#endif
dbg("%02x <- i8042 (return)\n", param[i]);
}
spin_unlock_irqrestore(&i8042_lock, flags);
#ifdef I8042_DEBUG_IO
if (retval)
printk(KERN_DEBUG "i8042.c: -- i8042 (timeout) [%d]\n",
(int) (jiffies - i8042_start));
#endif
dbg(" -- i8042 (timeout)");
return retval;
}
......@@ -198,10 +184,7 @@ static int i8042_kbd_write(struct serio *port, unsigned char c)
spin_lock_irqsave(&i8042_lock, flags);
if(!(retval = i8042_wait_write())) {
#ifdef I8042_DEBUG_IO
printk(KERN_DEBUG "i8042.c: %02x -> i8042 (kbd-data) [%d]\n",
c, (int) (jiffies - i8042_start));
#endif
dbg("%02x -> i8042 (kbd-data)", c);
i8042_write_data(c);
}
......@@ -216,21 +199,17 @@ static int i8042_kbd_write(struct serio *port, unsigned char c)
static int i8042_aux_write(struct serio *port, unsigned char c)
{
struct i8042_values *values = port->driver;
int retval;
/*
* Send the byte out.
*/
if (values->mux == -1)
retval = i8042_command(&c, I8042_CMD_AUX_SEND);
/*
* Here we restore the CTR value if requested. I don't know why, but i8042's in
* half-AT mode tend to trash their CTR when doing the AUX_SEND command.
*/
if (i8042_restore_ctr)
retval |= i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR);
else
retval = i8042_command(&c, I8042_CMD_MUX_SEND + values->mux);
/*
* Make sure the interrupt happens and the character is received even
......@@ -242,6 +221,7 @@ static int i8042_aux_write(struct serio *port, unsigned char c)
return retval;
}
/*
* i8042_open() is called when a port is open by the higher layer.
* It allocates the interrupt and enables in in the chip.
......@@ -253,6 +233,10 @@ static int i8042_open(struct serio *port)
i8042_flush();
if (values->mux != -1)
if (i8042_mux_open++)
return 0;
if (request_irq(values->irq, i8042_interrupt, 0, "i8042", NULL)) {
printk(KERN_ERR "i8042.c: Can't get irq %d for %s, unregistering the port.\n", values->irq, values->name);
values->exists = 0;
......@@ -282,6 +266,10 @@ static void i8042_close(struct serio *port)
{
struct i8042_values *values = port->driver;
if (values->mux != -1)
if (--i8042_mux_open)
return;
i8042_ctr &= ~values->irqen;
if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) {
......@@ -299,11 +287,11 @@ static void i8042_close(struct serio *port)
*/
static struct i8042_values i8042_kbd_values = {
.irq = 0,
.irq = I8042_KBD_IRQ,
.irqen = I8042_CTR_KBDINT,
.disable = I8042_CTR_KBDDIS,
.name = "KBD",
.exists = 0,
.mux = -1,
};
static struct serio i8042_kbd_port =
......@@ -318,11 +306,11 @@ static struct serio i8042_kbd_port =
};
static struct i8042_values i8042_aux_values = {
.irq = 0,
.irq = I8042_AUX_IRQ,
.irqen = I8042_CTR_AUXINT,
.disable = I8042_CTR_AUXDIS,
.name = "AUX",
.exists = 0,
.mux = -1,
};
static struct serio i8042_aux_port =
......@@ -336,6 +324,12 @@ static struct serio i8042_aux_port =
.phys = I8042_AUX_PHYS_DESC,
};
static struct i8042_values i8042_mux_values[4];
static struct serio i8042_mux_port[4];
static char i8042_mux_names[4][16];
static char i8042_mux_short[4][8];
static char i8042_mux_phys[4][32];
/*
* i8042_interrupt() is the most important function in this driver -
* it handles the interrupts from the i8042, and sends incoming bytes
......@@ -373,35 +367,61 @@ static void i8042_interrupt(int irq, void *dev_id, struct pt_regs *regs)
dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) |
((str & I8042_STR_TIMEOUT) ? SERIO_TIMEOUT : 0);
#ifdef I8042_DEBUG_IO
printk(KERN_DEBUG "i8042.c: %02x <- i8042 (interrupt, %s, %d%s%s) [%d]\n",
if (i8042_mux_values[0].exists && (buffer[i].str & I8042_STR_AUXDATA)) {
if (buffer[i].str & I8042_STR_MUXERR) {
switch (buffer[i].data) {
case 0xfd:
case 0xfe: dfl = SERIO_TIMEOUT; break;
case 0xff: dfl = SERIO_PARITY; break;
}
buffer[i].data = 0xfe;
} else dfl = 0;
dbg("%02x <- i8042 (interrupt, aux%d, %d%s%s)",
data, (str >> 6), irq,
dfl & SERIO_PARITY ? ", bad parity" : "",
dfl & SERIO_TIMEOUT ? ", timeout" : "");
if (i8042_mux_values[(str >> 6)].exists)
serio_interrupt(i8042_mux_port + (str >> 6), buffer[i].data, dfl);
continue;
}
dbg("%02x <- i8042 (interrupt, %s, %d%s%s)",
data, (str & I8042_STR_AUXDATA) ? "aux" : "kbd", irq,
dfl & SERIO_PARITY ? ", bad parity" : "",
dfl & SERIO_TIMEOUT ? ", timeout" : "",
(int) (jiffies - i8042_start));
#endif
dfl & SERIO_TIMEOUT ? ", timeout" : "");
if (i8042_aux_values.exists && (buffer[i].str & I8042_STR_AUXDATA)) {
serio_interrupt(&i8042_aux_port, buffer[i].data, dfl);
} else
if (i8042_kbd_values.exists) {
if (!i8042_direct) {
continue;
}
if (!i8042_kbd_values.exists)
continue;
if (i8042_direct) {
serio_interrupt(&i8042_kbd_port, data, dfl);
continue;
}
if (data > 0x7f) {
if (test_and_clear_bit(data & 0x7f, i8042_unxlate_seen)) {
if (test_and_clear_bit((data & 0x7f) | (i8042_last_e0 << 7), i8042_unxlate_seen)) {
serio_interrupt(&i8042_kbd_port, 0xf0, dfl);
if (i8042_last_e0 && (data == 0xaa || data == 0xb6))
set_bit(data & 0x7f, i8042_unxlate_seen);
set_bit((data & 0x7f) | (i8042_last_e0 << 7), i8042_unxlate_seen);
data = i8042_unxlate_table[data & 0x7f];
}
} else {
set_bit(data, i8042_unxlate_seen);
set_bit(data | (i8042_last_e0 << 7), i8042_unxlate_seen);
data = i8042_unxlate_table[data];
}
i8042_last_e0 = (data == 0xe0);
}
serio_interrupt(&i8042_kbd_port, data, dfl);
}
}
}
......@@ -460,17 +480,15 @@ static int __init i8042_controller_init(void)
*/
if (~i8042_read_status() & I8042_STR_KEYLOCK) {
if (i8042_unlock) {
if (i8042_unlock)
i8042_ctr |= I8042_CTR_IGNKEYLOCK;
} else {
else
printk(KERN_WARNING "i8042.c: Warning: Keylock active.\n");
}
}
/*
* If the chip is configured into nontranslated mode by the BIOS, don't
* bother enabling translating and just use that happily.
* bother enabling translating and be happy.
*/
if (~i8042_ctr & I8042_CTR_XLATE)
......@@ -478,10 +496,9 @@ static int __init i8042_controller_init(void)
/*
* Set nontranslated mode for the kbd interface if requested by an option.
* This is vital for a working scancode set 3 support. After this the kbd
* interface becomes a simple serial in/out, like the aux interface is. If
* the user doesn't wish this, the driver tries to untranslate the values
* after the i8042 translates them.
* After this the kbd interface becomes a simple serial in/out, like the aux
* interface is. We don't do this by default, since it can confuse notebook
* BIOSes.
*/
if (i8042_direct)
......@@ -506,9 +523,24 @@ static int __init i8042_controller_init(void)
void i8042_controller_cleanup(void)
{
int i;
i8042_flush();
/*
* Reset anything that is connected to the ports.
*/
if (i8042_kbd_values.exists)
serio_cleanup(&i8042_kbd_port);
if (i8042_aux_values.exists)
serio_cleanup(&i8042_aux_port);
for (i = 0; i < 4; i++)
if (i8042_mux_values[i].exists)
serio_cleanup(i8042_mux_port + i);
/*
* Reset the controller.
*/
......@@ -529,16 +561,72 @@ void i8042_controller_cleanup(void)
if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR))
printk(KERN_WARNING "i8042.c: Can't restore CTR.\n");
}
/*
* Reset anything that is connected to the ports if the ports
* are enabled in the original config.
* i8042_check_mux() checks whether the controller supports the PS/2 Active
* Multiplexing specification by Synaptics, Phoenix, Insyde and
* LCS/Telegraphics.
*/
if (i8042_kbd_values.exists)
i8042_kbd_write(&i8042_kbd_port, 0xff);
static int __init i8042_check_mux(struct i8042_values *values)
{
unsigned char param;
int i;
if (i8042_aux_values.exists)
i8042_aux_write(&i8042_aux_port, 0xff);
/*
* Check if AUX irq is available.
*/
if (request_irq(values->irq, i8042_interrupt, 0, "i8042", NULL))
return -1;
free_irq(values->irq, NULL);
/*
* Get rid of bytes in the queue.
*/
i8042_flush();
/*
* Internal loopback test - send three bytes, they should come back from the
* mouse interface, the last should be version. Note that we negate mouseport
* command responses for the i8042_check_aux() routine.
*/
param = 0xf0;
if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0x0f)
return -1;
param = 0x56;
if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0xa9)
return -1;
param = 0xa4;
if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param == 0x5b)
return -1;
printk(KERN_INFO "i8042.c: Detected active multiplexing controller, rev%d.%d.\n",
~param >> 4, ~param & 0xf);
/*
* Disable all muxed ports by disabling AUX.
*/
i8042_ctr &= I8042_CTR_AUXDIS;
i8042_ctr &= ~I8042_CTR_AUXINT;
if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR))
return -1;
/*
* Enable all muxed ports.
*/
for (i = 0; i < 4; i++) {
i8042_command(&param, I8042_CMD_MUX_PFX + i);
i8042_command(&param, I8042_CMD_AUX_ENABLE);
}
return 0;
}
/*
......@@ -546,7 +634,7 @@ void i8042_controller_cleanup(void)
* the presence of an AUX interface.
*/
static int __init i8042_check_aux(struct i8042_values *values, struct serio *port)
static int __init i8042_check_aux(struct i8042_values *values)
{
unsigned char param;
......@@ -570,18 +658,19 @@ static int __init i8042_check_aux(struct i8042_values *values, struct serio *por
*/
param = 0x5a;
if (i8042_command(&param, I8042_CMD_AUX_LOOP) || param != 0xa5)
return -1;
/*
* External connection test - filters out AT-soldered PS/2 i8042's
* 0x00 - no error, 0x01-0x03 - clock/data stuck, 0xff - general error
* 0xfa - no error on some notebooks which ignore the spec
* We ignore general error, since some chips report it even under normal
* operation.
*/
if (i8042_command(&param, I8042_CMD_AUX_TEST) || (param && param != 0xff))
if (i8042_command(&param, I8042_CMD_AUX_TEST)
|| (param && param != 0xfa && param != 0xff))
return -1;
/*
......@@ -665,9 +754,9 @@ static int __init i8042_setup_direct(char *str)
i8042_direct = 1;
return 1;
}
static int __init i8042_setup_restore_ctr(char *str)
static int __init i8042_setup_dumbkbd(char *str)
{
i8042_restore_ctr = 1;
i8042_dumbkbd = 1;
return 1;
}
......@@ -675,7 +764,7 @@ __setup("i8042_reset", i8042_setup_reset);
__setup("i8042_noaux", i8042_setup_noaux);
__setup("i8042_unlock", i8042_setup_unlock);
__setup("i8042_direct", i8042_setup_direct);
__setup("i8042_restore_ctr", i8042_setup_restore_ctr);
__setup("i8042_dumbkbd", i8042_setup_dumbkbd);
#endif
/*
......@@ -698,26 +787,42 @@ static struct notifier_block i8042_notifier=
0
};
static void __init i8042_init_mux_values(struct i8042_values *values, struct serio *port, int index)
{
memcpy(port, &i8042_aux_port, sizeof(struct serio));
memcpy(values, &i8042_aux_values, sizeof(struct i8042_values));
sprintf(i8042_mux_names[index], "i8042 Aux-%d Port", index);
sprintf(i8042_mux_phys[index], I8042_MUX_PHYS_DESC, index + 1);
sprintf(i8042_mux_short[index], "AUX%d", index);
port->name = i8042_mux_names[index];
port->phys = i8042_mux_phys[index];
values->name = i8042_mux_short[index];
values->mux = index;
}
int __init i8042_init(void)
{
#ifdef I8042_DEBUG_IO
i8042_start = jiffies;
#endif
int i;
#if !defined(__i386__) && !defined(__x86_64__)
i8042_reset = 1;
#endif
dbg_init();
if (!i8042_platform_init())
if (i8042_platform_init())
return -EBUSY;
i8042_kbd_values.irq = I8042_KBD_IRQ;
i8042_aux_values.irq = I8042_AUX_IRQ;
if (i8042_controller_init())
return -ENODEV;
if (!i8042_noaux && !i8042_check_aux(&i8042_aux_values, &i8042_aux_port))
if (i8042_dumbkbd)
i8042_kbd_port.write = NULL;
for (i = 0; i < 4; i++)
i8042_init_mux_values(i8042_mux_values + i, i8042_mux_port + i, i);
if (!i8042_noaux && !i8042_check_mux(&i8042_aux_values))
for (i = 0; i < 4; i++)
i8042_port_register(i8042_mux_values + i, i8042_mux_port + i);
else
if (!i8042_noaux && !i8042_check_aux(&i8042_aux_values))
i8042_port_register(&i8042_aux_values, &i8042_aux_port);
i8042_port_register(&i8042_kbd_values, &i8042_kbd_port);
......@@ -732,22 +837,26 @@ int __init i8042_init(void)
void __exit i8042_exit(void)
{
int i;
unregister_reboot_notifier(&i8042_notifier);
del_timer(&i8042_timer);
i8042_controller_cleanup();
if (i8042_kbd_values.exists)
serio_unregister_port(&i8042_kbd_port);
if (i8042_aux_values.exists)
serio_unregister_port(&i8042_aux_port);
i8042_controller_cleanup();
for (i = 0; i < 4; i++)
if (i8042_mux_values[i].exists)
serio_unregister_port(i8042_mux_port + i);
i8042_platform_exit();
}
module_init(i8042_init);
module_exit(i8042_exit);
......@@ -21,13 +21,6 @@
#include "i8042-io.h"
#endif
/*
* If you want to trace all the i/o the i8042 module does for
* debugging purposes, define this.
*/
#undef I8042_DEBUG_IO
/*
* This is in 50us units, the time we wait for the i8042 to react. This
* has to be long enough for the i8042 itself to timeout on sending a byte
......@@ -54,6 +47,7 @@
#define I8042_STR_AUXDATA 0x20
#define I8042_STR_KEYLOCK 0x10
#define I8042_STR_CMDDAT 0x08
#define I8042_STR_MUXERR 0x04
#define I8042_STR_IBF 0x02
#define I8042_STR_OBF 0x01
......@@ -87,6 +81,9 @@
#define I8042_CMD_AUX_SEND 0x10d4
#define I8042_CMD_AUX_LOOP 0x11d3
#define I8042_CMD_MUX_PFX 0x0090
#define I8042_CMD_MUX_SEND 0x1090
/*
* Return codes.
*/
......@@ -100,4 +97,18 @@
#define I8042_BUFFER_SIZE 32
/*
* Debug.
*/
#ifdef DEBUG
static unsigned long i8042_start;
#define dbg_init() do { i8042_start = jiffies; } while (0);
#define dbg(format, arg...) printk(KERN_DEBUG __FILE__ ": " format "[%d]\n" ,\
## arg, (int) (jiffies - i8042_start))
#else
#define dbg_init() do { } while (0);
#define dbg(format, arg...) do {} while (0)
#endif
#endif /* _I8042_H */
......@@ -37,6 +37,7 @@
#include <linux/sched.h>
#include <linux/smp_lock.h>
#include <linux/suspend.h>
#include <linux/slab.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
MODULE_DESCRIPTION("Serio abstraction core");
......@@ -51,18 +52,26 @@ EXPORT_SYMBOL(serio_open);
EXPORT_SYMBOL(serio_close);
EXPORT_SYMBOL(serio_rescan);
static struct serio *serio_list;
static struct serio_dev *serio_dev;
struct serio_event {
int type;
struct serio *serio;
struct list_head node;
};
static LIST_HEAD(serio_list);
static LIST_HEAD(serio_dev_list);
static LIST_HEAD(serio_event_list);
static int serio_pid;
static void serio_find_dev(struct serio *serio)
{
struct serio_dev *dev = serio_dev;
struct serio_dev *dev;
while (dev && !serio->dev) {
list_for_each_entry(dev, &serio_dev_list, node) {
if (serio->dev)
break;
if (dev->connect)
dev->connect(serio, dev);
dev = dev->next;
}
}
......@@ -73,17 +82,23 @@ static DECLARE_COMPLETION(serio_exited);
void serio_handle_events(void)
{
struct serio *serio = serio_list;
while (serio) {
if (serio->event & SERIO_RESCAN) {
if (serio->dev && serio->dev->disconnect)
serio->dev->disconnect(serio);
serio_find_dev(serio);
struct list_head *node, *next;
struct serio_event *event;
list_for_each_safe(node, next, &serio_event_list) {
event = container_of(node, struct serio_event, node);
switch (event->type) {
case SERIO_RESCAN :
if (event->serio->dev && event->serio->dev->disconnect)
event->serio->dev->disconnect(event->serio);
serio_find_dev(event->serio);
break;
default:
break;
}
serio->event = 0;
serio = serio->next;
list_del_init(node);
kfree(event);
}
}
......@@ -95,7 +110,7 @@ static int serio_thread(void *nothing)
do {
serio_handle_events();
interruptible_sleep_on(&serio_wait);
wait_event_interruptible(serio_wait, !list_empty(&serio_event_list));
if (current->flags & PF_FREEZE)
refrigerator(PF_IOTHREAD);
} while (!signal_pending(current));
......@@ -108,7 +123,15 @@ static int serio_thread(void *nothing)
void serio_rescan(struct serio *serio)
{
serio->event |= SERIO_RESCAN;
struct serio_event *event;
if (!(event = kmalloc(sizeof(struct serio_event), GFP_ATOMIC)))
return;
event->type = SERIO_RESCAN;
event->serio = serio;
list_add_tail(&event->node, &serio_event_list);
wake_up(&serio_wait);
}
......@@ -122,49 +145,36 @@ void serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags
void serio_register_port(struct serio *serio)
{
serio->next = serio_list;
serio_list = serio;
list_add_tail(&serio->node, &serio_list);
serio_find_dev(serio);
}
void serio_unregister_port(struct serio *serio)
{
struct serio **serioptr = &serio_list;
while (*serioptr && (*serioptr != serio)) serioptr = &((*serioptr)->next);
*serioptr = (*serioptr)->next;
list_del_init(&serio->node);
if (serio->dev && serio->dev->disconnect)
serio->dev->disconnect(serio);
}
void serio_register_device(struct serio_dev *dev)
{
struct serio *serio = serio_list;
dev->next = serio_dev;
serio_dev = dev;
while (serio) {
struct serio *serio;
list_add_tail(&dev->node, &serio_dev_list);
list_for_each_entry(serio, &serio_list, node)
if (!serio->dev && dev->connect)
dev->connect(serio, dev);
serio = serio->next;
}
}
void serio_unregister_device(struct serio_dev *dev)
{
struct serio_dev **devptr = &serio_dev;
struct serio *serio = serio_list;
struct serio *serio;
while (*devptr && (*devptr != dev)) devptr = &((*devptr)->next);
*devptr = (*devptr)->next;
list_del_init(&dev->node);
while (serio) {
list_for_each_entry(serio, &serio_list, node) {
if (serio->dev == dev && dev->disconnect)
dev->disconnect(serio);
serio_find_dev(serio);
serio = serio->next;
}
}
......
......@@ -120,6 +120,7 @@ static void gunze_connect(struct serio *serio, struct serio_dev *dev)
memset(gunze, 0, sizeof(struct gunze));
init_input_dev(&gunze->dev);
gunze->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
gunze->dev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y);
gunze->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
......
......@@ -371,6 +371,8 @@ static void h3600ts_connect(struct serio *serio, struct serio_dev *dev)
memset(ts, 0, sizeof(struct h3600_dev));
init_input_dev(&ts->dev);
/* Device specific stuff */
set_GPIO_IRQ_edge( GPIO_BITSY_ACTION_BUTTON, GPIO_BOTH_EDGES );
set_GPIO_IRQ_edge( GPIO_BITSY_NPOWER_BUTTON, GPIO_RISING_EDGE );
......
......@@ -55,7 +55,7 @@ struct tsdev {
int minor;
char name[16];
wait_queue_head_t wait;
struct tsdev_list *list;
struct list_head list;
struct input_handle handle;
devfs_handle_t devfs;
};
......@@ -70,7 +70,7 @@ typedef struct {
struct tsdev_list {
struct fasync_struct *fasync;
struct tsdev_list *next;
struct list_head node;
struct tsdev *tsdev;
int head, tail;
int oldx, oldy, pendown;
......@@ -106,8 +106,7 @@ static int tsdev_open(struct inode *inode, struct file *file)
memset(list, 0, sizeof(struct tsdev_list));
list->tsdev = tsdev_table[i];
list->next = tsdev_table[i]->list;
tsdev_table[i]->list = list;
list_add_tail(&list->node, &tsdev_table[i]->list);
file->private_data = list;
if (!list->tsdev->open++)
......@@ -119,14 +118,9 @@ static int tsdev_open(struct inode *inode, struct file *file)
static int tsdev_release(struct inode *inode, struct file *file)
{
struct tsdev_list *list = file->private_data;
struct tsdev_list **listptr;
listptr = &list->tsdev->list;
tsdev_fasync(-1, file, 0);
while (*listptr && (*listptr != list))
listptr = &((*listptr)->next);
*listptr = (*listptr)->next;
list_del(&list->node);
if (!--list->tsdev->open) {
if (list->tsdev->exist) {
......@@ -144,45 +138,28 @@ static int tsdev_release(struct inode *inode, struct file *file)
static ssize_t tsdev_read(struct file *file, char *buffer, size_t count,
loff_t * ppos)
{
DECLARE_WAITQUEUE(wait, current);
struct tsdev_list *list = file->private_data;
int retval = 0;
if (list->head == list->tail) {
add_wait_queue(&list->tsdev->wait, &wait);
set_current_state(TASK_INTERRUPTIBLE);
if (list->head == list->tail && list->tsdev->exist && (file->f_flags & O_NONBLOCK))
return -EAGAIN;
while (list->head == list->tail) {
if (!list->tsdev->exist) {
retval = -ENODEV;
break;
}
if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
break;
}
if (signal_pending(current)) {
retval = -ERESTARTSYS;
break;
}
schedule();
}
set_current_state(TASK_RUNNING);
remove_wait_queue(&list->tsdev->wait, &wait);
}
retval = wait_event_interruptible(list->tsdev->wait,
(list->head != list->tail) && list->tsdev->exist);
if (retval)
return retval;
while (list->head != list->tail
&& retval + sizeof(TS_EVENT) <= count) {
if (copy_to_user
(buffer + retval, list->event + list->tail,
sizeof(TS_EVENT)))
if (!list->tsdev->exist)
return -ENODEV;
while (list->head != list->tail && retval + sizeof(TS_EVENT) <= count) {
if (copy_to_user (buffer + retval, list->event + list->tail, sizeof(TS_EVENT)))
return -EFAULT;
list->tail = (list->tail + 1) & (TSDEV_BUFFER_SIZE - 1);
retval += sizeof(TS_EVENT);
}
return retval;
}
......@@ -232,54 +209,35 @@ static void tsdev_event(struct input_handle *handle, unsigned int type,
unsigned int code, int value)
{
struct tsdev *tsdev = handle->private;
struct tsdev_list *list = tsdev->list;
struct tsdev_list *list;
struct timeval time;
int size;
while (list) {
list_for_each_entry(list, &tsdev->list, node) {
switch (type) {
case EV_ABS:
switch (code) {
case ABS_X:
if (!list->pendown)
return;
size =
handle->dev->absmax[ABS_X] -
handle->dev->absmin[ABS_X];
size = handle->dev->absmax[ABS_X] - handle->dev->absmin[ABS_X];
if (size > 0)
list->oldx =
((value -
handle->dev->absmin[ABS_X]) *
xres / size);
list->oldx = ((value - handle->dev->absmin[ABS_X]) * xres / size);
else
list->oldx =
((value -
handle->dev->absmin[ABS_X]));
list->oldx = ((value - handle->dev->absmin[ABS_X]));
break;
case ABS_Y:
if (!list->pendown)
return;
size =
handle->dev->absmax[ABS_Y] -
handle->dev->absmin[ABS_Y];
size = handle->dev->absmax[ABS_Y] - handle->dev->absmin[ABS_Y];
if (size > 0)
list->oldy =
((value -
handle->dev->absmin[ABS_Y]) *
yres / size);
list->oldy = ((value - handle->dev->absmin[ABS_Y]) * yres / size);
else
list->oldy =
((value -
handle->dev->absmin[ABS_Y]));
list->oldy = ((value - handle->dev->absmin[ABS_Y]));
break;
case ABS_PRESSURE:
list->pendown =
((value >
handle->dev->
absmin[ABS_PRESSURE])) ? value -
handle->dev->absmin[ABS_PRESSURE] : 0;
list->pendown = ((value > handle->dev-> absmin[ABS_PRESSURE])) ?
value - handle->dev->absmin[ABS_PRESSURE] : 0;
break;
}
break;
......@@ -289,7 +247,6 @@ static void tsdev_event(struct input_handle *handle, unsigned int type,
case REL_X:
if (!list->pendown)
return;
list->oldx += value;
if (list->oldx < 0)
list->oldx = 0;
......@@ -299,7 +256,6 @@ static void tsdev_event(struct input_handle *handle, unsigned int type,
case REL_Y:
if (!list->pendown)
return;
list->oldy += value;
if (list->oldy < 0)
list->oldy = 0;
......@@ -333,7 +289,6 @@ static void tsdev_event(struct input_handle *handle, unsigned int type,
list->event[list->head].y = list->oldy;
list->head = (list->head + 1) & (TSDEV_BUFFER_SIZE - 1);
kill_fasync(&list->fasync, SIGIO, POLL_IN);
list = list->next;
}
wake_up_interruptible(&tsdev->wait);
}
......@@ -356,21 +311,23 @@ static struct input_handle *tsdev_connect(struct input_handler *handler,
if (!(tsdev = kmalloc(sizeof(struct tsdev), GFP_KERNEL)))
return NULL;
memset(tsdev, 0, sizeof(struct tsdev));
INIT_LIST_HEAD(&tsdev->list);
init_waitqueue_head(&tsdev->wait);
tsdev->minor = minor;
tsdev_table[minor] = tsdev;
sprintf(tsdev->name, "ts%d", minor);
tsdev->exist = 1;
tsdev->minor = minor;
tsdev->handle.dev = dev;
tsdev->handle.name = tsdev->name;
tsdev->handle.handler = handler;
tsdev->handle.private = tsdev;
tsdev_table[minor] = tsdev;
tsdev->devfs =
input_register_minor("ts%d", minor, TSDEV_MINOR_BASE);
tsdev->exist = 1;
return &tsdev->handle;
}
......
......@@ -479,6 +479,8 @@ adbhid_input_register(int id, int default_id, int original_handler_id,
memset(adbhid[id], 0, sizeof(struct adbhid));
sprintf(adbhid[id]->phys, "adb%d:%d.%02x/input", id, default_id, original_handler_id);
init_input_dev(&adbhid[id]);
adbhid[id]->id = default_id;
adbhid[id]->original_handler_id = original_handler_id;
adbhid[id]->current_handler_id = current_handler_id;
......
......@@ -91,6 +91,8 @@ static void emumousebtn_input_register(void)
{
emumousebtn.name = "Macintosh mouse button emulation";
init_input_dev(&emumousebtn);
emumousebtn.evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
emumousebtn.keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_MIDDLE) | BIT(BTN_RIGHT);
emumousebtn.relbit[0] = BIT(REL_X) | BIT(REL_Y);
......
......@@ -1284,8 +1284,14 @@ void hid_init_reports(struct hid_device *hid)
}
#define USB_VENDOR_ID_WACOM 0x056a
#define USB_DEVICE_ID_WACOM_PENPARTNER 0x0000
#define USB_DEVICE_ID_WACOM_GRAPHIRE 0x0010
#define USB_DEVICE_ID_WACOM_INTUOS 0x0020
#define USB_DEVICE_ID_WACOM_PL 0x0030
#define USB_DEVICE_ID_WACOM_INTUOS2 0x0040
#define USB_VENDOR_ID_AIPTEK 0x08ca
#define USB_DEVICE_ID_AIPTEK_6000 0x0020
#define USB_VENDOR_ID_GRIFFIN 0x077d
#define USB_DEVICE_ID_POWERMATE 0x0410
......@@ -1306,12 +1312,27 @@ struct hid_blacklist {
__u16 idProduct;
unsigned quirks;
} hid_blacklist[] = {
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PENPARTNER, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 1, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE + 2, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 1, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 2, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 3, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS + 4, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 1, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 2, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 3, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 4, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_PL + 5, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 1, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 2, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 3, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 4, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS2 + 5, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_6000, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_POWERMATE, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_GRIFFIN, USB_DEVICE_ID_SOUNDKNOB, HID_QUIRK_IGNORE },
{ USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_UC100KM, HID_QUIRK_NOGET },
......@@ -1469,6 +1490,8 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
strcat(hid->name, buf);
if (usb_string(dev, dev->descriptor.iProduct, buf, 64) > 0)
snprintf(hid->name, 64, "%s %s", hid->name, buf);
} else if (usb_string(dev, dev->descriptor.iProduct, buf, 128) > 0) {
snprintf(hid->name, 128, "%s", buf);
} else
snprintf(hid->name, 128, "%04x:%04x", dev->descriptor.idVendor, dev->descriptor.idProduct);
......
......@@ -317,6 +317,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
}
init_MUTEX(&pm->lock);
init_input_dev(&pm->input);
/* get a handle to the interrupt data pipe */
pipe = usb_rcvintpipe(udev, endpoint->bEndpointAddress);
......
/*
* $Id: wacom.c,v 1.28 2001/09/25 10:12:07 vojtech Exp $
* USB Wacom Graphire and Wacom Intuos tablet support
*
* Copyright (c) 2000-2001 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2000-2002 Vojtech Pavlik <vojtech@ucw.cz>
* Copyright (c) 2000 Andreas Bach Aaen <abach@stofanet.dk>
* Copyright (c) 2000 Clifford Wolf <clifford@clifford.at>
* Copyright (c) 2000 Sam Mosel <sam.mosel@computer.org>
* Copyright (c) 2000 James E. Blair <corvus@gnu.org>
* Copyright (c) 2000 Daniel Egger <egger@suse.de>
* Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com>
*
* USB Wacom Graphire and Wacom Intuos tablet support
* Copyright (c) 2002 Ping Cheng <pingc@wacom.com>
*
* ChangeLog:
* v0.1 (vp) - Initial release
......@@ -37,6 +36,18 @@
* v1.21 (vp) - Removed protocol descriptions
* - Added MISC_SERIAL for tool serial numbers
* (gb) - Identify version on module load.
* v1.21.1 (fl) - added Graphire2 support
* v1.21.2 (fl) - added Intuos2 support
* - added all the PL ids
* v1.21.3 (fl) - added another eraser id from Neil Okamoto
* - added smooth filter for Graphire from Peri Hankey
* - added PenPartner support from Olaf van Es
* - new tool ids from Ole Martin Bjoerndalen
* v1.29 (pc) - Add support for more tablets
* - Fix pressure reporting
* v1.30 (vp) - Merge 2.4 and 2.5 drivers
* - Since 2.5 now has input_sync(), remove MSC_SERIAL abuse
* - Cleanups here and there
*/
/*
......@@ -44,19 +55,6 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
#include <linux/kernel.h>
......@@ -69,7 +67,7 @@
/*
* Version Information
*/
#define DRIVER_VERSION "v1.21"
#define DRIVER_VERSION "v1.30"
#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
#define DRIVER_DESC "USB Wacom Graphire and Wacom Intuos tablet driver"
#define DRIVER_LICENSE "GPL"
......@@ -87,12 +85,8 @@ struct wacom_features {
int y_max;
int pressure_max;
int distance_max;
int type;
void (*irq)(struct urb *urb);
unsigned long evbit;
unsigned long absbit;
unsigned long relbit;
unsigned long btnbit;
unsigned long digibit;
};
struct wacom {
......@@ -104,7 +98,6 @@ struct wacom {
struct wacom_features *features;
int tool[2];
int open;
int x, y;
__u32 serial[2];
char phys[32];
};
......@@ -114,29 +107,50 @@ static void wacom_pl_irq(struct urb *urb)
struct wacom *wacom = urb->context;
unsigned char *data = wacom->data;
struct input_dev *dev = &wacom->dev;
int prox;
int prox, pressure;
if (urb->status) return;
if (data[0] != 2)
dbg("received unknown report #%d", data[0]);
prox = data[1] & 0x20;
prox = data[1] & 0x40;
input_report_key(dev, BTN_TOOL_PEN, prox);
if (prox) {
int pressure = (data[4] & 0x04) >> 2 | ((__u32)(data[7] & 0x7f) << 1);
input_report_abs(dev, ABS_X, data[3] | ((__u32)data[2] << 8) | ((__u32)(data[1] & 0x03) << 16));
input_report_abs(dev, ABS_Y, data[6] | ((__u32)data[5] << 8) | ((__u32)(data[4] & 0x03) << 8));
input_report_abs(dev, ABS_PRESSURE, (data[7] & 0x80) ? (255 - pressure) : (pressure + 255));
pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
if (wacom->features->pressure_max > 255)
pressure = (pressure << 1) | ((data[4] >> 6) & 1);
pressure += (wacom->features->pressure_max + 1) / 2;
input_report_abs(dev, ABS_X, data[3] | ((__u32)data[2] << 7) | ((__u32)(data[1] & 0x03) << 14));
input_report_abs(dev, ABS_Y, data[6] | ((__u32)data[5] << 7) | ((__u32)(data[4] & 0x03) << 14));
input_report_abs(dev, ABS_PRESSURE, pressure);
input_report_key(dev, BTN_TOUCH, data[4] & 0x08);
input_report_key(dev, BTN_STYLUS, data[4] & 0x10);
input_report_key(dev, BTN_STYLUS2, data[4] & 0x20);
}
input_event(dev, EV_MSC, MSC_SERIAL, 0);
input_sync(dev);
}
static void wacom_penpartner_irq(struct urb *urb)
{
struct wacom *wacom = urb->context;
unsigned char *data = wacom->data;
struct input_dev *dev = &wacom->dev;
if (urb->status) return;
input_report_key(dev, BTN_TOOL_PEN, 1);
input_report_abs(dev, ABS_X, data[2] << 8 | data[1]);
input_report_abs(dev, ABS_Y, data[4] << 8 | data[3]);
input_report_abs(dev, ABS_PRESSURE, (signed char)data[6] + 127);
input_report_key(dev, BTN_TOUCH, ((signed char)data[6] > -80) && !(data[5] & 0x20));
input_report_key(dev, BTN_STYLUS, (data[5] & 0x40));
input_sync(dev);
}
......@@ -176,13 +190,13 @@ static void wacom_graphire_irq(struct urb *urb)
input_report_abs(dev, ABS_X, x);
input_report_abs(dev, ABS_Y, y);
input_event(dev, EV_MSC, MSC_SERIAL, data[1] & 0x01);
input_sync(dev);
return;
}
if (data[1] & 0x80) {
input_report_abs(dev, ABS_X, wacom->x = x);
input_report_abs(dev, ABS_Y, wacom->y = y);
input_report_abs(dev, ABS_X, x);
input_report_abs(dev, ABS_Y, y);
}
input_report_abs(dev, ABS_PRESSURE, data[6] | ((__u32)data[7] << 8));
......@@ -190,8 +204,6 @@ static void wacom_graphire_irq(struct urb *urb)
input_report_key(dev, BTN_STYLUS, data[1] & 0x02);
input_report_key(dev, BTN_STYLUS2, data[1] & 0x04);
input_event(dev, EV_MSC, MSC_SERIAL, data[1] & 0x01);
input_sync(dev);
}
......@@ -221,13 +233,17 @@ static void wacom_intuos_irq(struct urb *urb)
case 0x832:
case 0x012: wacom->tool[idx] = BTN_TOOL_PENCIL; break; /* Inking pen */
case 0x822:
case 0x842:
case 0x852:
case 0x022: wacom->tool[idx] = BTN_TOOL_PEN; break; /* Pen */
case 0x812:
case 0x032: wacom->tool[idx] = BTN_TOOL_BRUSH; break; /* Stroke pen */
case 0x007:
case 0x09c:
case 0x094: wacom->tool[idx] = BTN_TOOL_MOUSE; break; /* Mouse 4D */
case 0x094: wacom->tool[idx] = BTN_TOOL_MOUSE; break; /* Mouse 4D and 2D */
case 0x096: wacom->tool[idx] = BTN_TOOL_LENS; break; /* Lens cursor */
case 0x82a:
case 0x85a:
case 0x91a:
case 0x0fa: wacom->tool[idx] = BTN_TOOL_RUBBER; break; /* Eraser */
case 0x112: wacom->tool[idx] = BTN_TOOL_AIRBRUSH; break; /* Airbrush */
......@@ -236,12 +252,13 @@ static void wacom_intuos_irq(struct urb *urb)
input_report_key(dev, wacom->tool[idx], 1);
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
input_sync(dev);
return;
}
if ((data[1] & 0xfe) == 0x80) { /* Exit report */
input_report_key(dev, wacom->tool[idx], 0);
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
input_sync(dev);
return;
}
......@@ -274,61 +291,85 @@ static void wacom_intuos_irq(struct urb *urb)
} else {
if ((data[1] & 0x10) == 0) { /* 4D mouse packets */
input_report_key(dev, BTN_LEFT, data[8] & 0x01);
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02);
input_report_key(dev, BTN_RIGHT, data[8] & 0x04);
if ((data[1] & 0x10) == 0) { /* 4D mouse packets */
input_report_key(dev, BTN_SIDE, data[8] & 0x20);
input_report_key(dev, BTN_EXTRA, data[8] & 0x10);
input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ?
((__u32)data[6] << 2) | ((data[7] >> 6) & 3) :
-((__u32)data[6] << 2) | ((data[7] >> 6) & 3));
} else { /* Lens cursor packets */
} else {
if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */
input_report_key(dev, BTN_LEFT, data[8] & 0x04);
input_report_key(dev, BTN_MIDDLE, data[8] & 0x08);
input_report_key(dev, BTN_RIGHT, data[8] & 0x10);
input_report_abs(dev, REL_WHEEL,
((__u32)(data[8] & 0x01) - (__u32)((data[8] & 0x02) >> 1)));
}
else { /* Lens cursor packets */
input_report_key(dev, BTN_LEFT, data[8] & 0x01);
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02);
input_report_key(dev, BTN_RIGHT, data[8] & 0x04);
input_report_key(dev, BTN_SIDE, data[8] & 0x10);
input_report_key(dev, BTN_EXTRA, data[8] & 0x08);
}
}
}
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
}
input_sync(dev);
}
#define WACOM_INTUOS_TOOLS (BIT(BTN_TOOL_BRUSH) | BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS))
#define WACOM_INTUOS_BUTTONS (BIT(BTN_SIDE) | BIT(BTN_EXTRA))
#define WACOM_INTUOS_ABS (BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE))
struct wacom_features wacom_features[] = {
{ "Wacom Graphire", 8, 10206, 7422, 511, 32, wacom_graphire_irq,
BIT(EV_REL), 0, BIT(REL_WHEEL), 0 },
{ "Wacom Intuos 4x5", 10, 12700, 10360, 1023, 15, wacom_intuos_irq,
0, WACOM_INTUOS_ABS, 0, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
{ "Wacom Intuos 6x8", 10, 20320, 15040, 1023, 15, wacom_intuos_irq,
0, WACOM_INTUOS_ABS, 0, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
{ "Wacom Intuos 9x12", 10, 30480, 23060, 1023, 15, wacom_intuos_irq,
0, WACOM_INTUOS_ABS, 0, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
{ "Wacom Intuos 12x12", 10, 30480, 30480, 1023, 15, wacom_intuos_irq,
0, WACOM_INTUOS_ABS, 0, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
{ "Wacom Intuos 12x18", 10, 47720, 30480, 1023, 15, wacom_intuos_irq,
0, WACOM_INTUOS_ABS, 0, WACOM_INTUOS_BUTTONS, WACOM_INTUOS_TOOLS },
{ "Wacom PL500", 8, 12328, 9256, 511, 32, wacom_pl_irq,
0, 0, 0, 0 },
{ NULL , 0 }
{ "Wacom Penpartner", 7, 5040, 3780, 255, 32, 0, wacom_penpartner_irq },
{ "Wacom Graphire", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq },
{ "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq },
{ "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq },
{ "Wacom Intuos 4x5", 10, 12700, 10360, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos 6x8", 10, 20600, 16450, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos 9x12", 10, 30670, 24130, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos 12x12", 10, 30670, 31040, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos 12x18", 10, 45860, 31040, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq },
{ "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq },
{ "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq },
{ "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq },
{ "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq },
{ "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq },
{ "Wacom Intuos2 4x5", 10, 12700, 10360, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos2 6x8", 10, 20600, 16450, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos2 9x12", 10, 30670, 24130, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos2 12x12", 10, 30670, 31040, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos2 12x18", 10, 45860, 31040, 1023, 15, 2, wacom_intuos_irq },
{ }
};
struct usb_device_id wacom_ids[] = {
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x10), .driver_info = 0 },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20), .driver_info = 1 },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21), .driver_info = 2 },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22), .driver_info = 3 },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x23), .driver_info = 4 },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x24), .driver_info = 5 },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x31), .driver_info = 6 },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x00) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x10) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x11) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x12) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x20) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x21) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x22) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x23) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x24) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x30) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x31) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x32) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x33) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x34) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x35) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x43) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x44) },
{ USB_DEVICE(USB_VENDOR_ID_WACOM, 0x45) },
{ }
};
......@@ -358,9 +399,10 @@ static void wacom_close(struct input_dev *dev)
static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
{
struct usb_device *dev = interface_to_usbdev (intf);
struct usb_device *dev = interface_to_usbdev(intf);
struct usb_endpoint_descriptor *endpoint;
struct wacom *wacom;
char rep_data[2] = {0x02, 0x02};
char path[64];
if (!(wacom = kmalloc(sizeof(struct wacom), GFP_KERNEL)))
......@@ -380,15 +422,34 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
return -ENOMEM;
}
wacom->features = wacom_features + id->driver_info;
wacom->features = wacom_features + (id - wacom_ids);
wacom->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS);
wacom->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOUCH) | BIT(BTN_STYLUS);
switch (wacom->features->type) {
case 1:
wacom->dev.evbit[0] |= BIT(EV_REL);
wacom->dev.relbit[0] |= BIT(REL_WHEEL);
wacom->dev.absbit[0] |= BIT(ABS_DISTANCE);
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2);
break;
wacom->dev.evbit[0] |= BIT(EV_KEY) | BIT(EV_ABS) | BIT(EV_MSC) | wacom->features->evbit;
wacom->dev.absbit[0] |= BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE) | BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | wacom->features->absbit;
wacom->dev.relbit[0] |= wacom->features->relbit;
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | wacom->features->btnbit;
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_PEN) | BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) |
BIT(BTN_TOUCH) | BIT(BTN_STYLUS) | BIT(BTN_STYLUS2) | wacom->features->digibit;
case 2:
wacom->dev.evbit[0] |= BIT(EV_MSC);
wacom->dev.mscbit[0] |= BIT(MSC_SERIAL);
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA);
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH)
| BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2);
wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE);
break;
case 3:
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2);
break;
}
wacom->dev.absmax[ABS_X] = wacom->features->x_max;
wacom->dev.absmax[ABS_Y] = wacom->features->y_max;
......@@ -435,9 +496,16 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
input_register_device(&wacom->dev);
#if 0 /* Missing usb_set_report() */
usb_set_report(intf, 3, 2, rep_data, 2);
usb_set_report(intf, 3, 5, rep_data, 0);
usb_set_report(intf, 3, 6, rep_data, 0);
#endif
printk(KERN_INFO "input: %s on %s\n", wacom->features->name, path);
dev_set_drvdata(&intf->dev, wacom);
return 0;
}
......
......@@ -4,17 +4,12 @@
#include <linux/seq_file.h>
struct pt_regs;
struct kbd_repeat;
struct mktime;
struct rtc_time;
struct rtc_pll_info;
struct buffer_head;
extern void (*mach_sched_init) (void (*handler)(int, void *, struct pt_regs *));
/* machine dependent keyboard functions */
extern int (*mach_keyb_init) (void);
extern int (*mach_kbdrate) (struct kbd_repeat *);
extern void (*mach_kbd_leds) (unsigned int);
extern int (*mach_kbd_translate)(unsigned char scancode, unsigned char *keycode, char raw_mode);
/* machine dependent irq functions */
extern void (*mach_init_IRQ) (void);
extern void (*(*mach_default_handler)[]) (int, void *, struct pt_regs *);
......@@ -28,6 +23,8 @@ extern void (*mach_process_int) (int irq, struct pt_regs *fp);
/* machine dependent timer functions */
extern unsigned long (*mach_gettimeoffset)(void);
extern int (*mach_hwclk)(int, struct rtc_time*);
extern int (*mach_get_rtc_pll)(struct rtc_pll_info *);
extern int (*mach_set_rtc_pll)(struct rtc_pll_info *);
extern int (*mach_set_clock_mmss)(unsigned long);
extern void (*mach_reset)( void );
extern void (*mach_halt)( void );
......@@ -38,9 +35,6 @@ extern long mach_max_dma_address;
extern void (*mach_floppy_setup)(char *, int *);
extern void (*mach_heartbeat) (int);
extern void (*mach_l2_flush) (int);
extern int mach_sysrq_key;
extern int mach_sysrq_shift_state;
extern int mach_sysrq_shift_mask;
extern char *mach_sysrq_xlate;
extern void (*mach_beep) (unsigned int, unsigned int);
#endif /* _M68K_MACHDEP_H */
/*
* linux/include/asm-m68k/q40_keyboard.h
*
* Q40 specific keyboard definitions
*/
#ifdef __KERNEL__
#include <asm/machdep.h>
extern int q40kbd_setkeycode(unsigned int scancode, unsigned int keycode);
extern int q40kbd_getkeycode(unsigned int scancode);
extern int q40kbd_pretranslate(unsigned char scancode, char raw_mode);
extern int q40kbd_translate(unsigned char scancode, unsigned char *keycode,
char raw_mode);
extern char q40kbd_unexpected_up(unsigned char keycode);
extern void q40kbd_leds(unsigned char leds);
extern int q40kbd_is_sysrq(unsigned char keycode);
extern int q40kbd_init_hw(void);
extern unsigned char q40kbd_sysrq_xlate[128];
#endif /* __KERNEL__ */
......@@ -2,33 +2,16 @@
#define _GAMEPORT_H
/*
* $Id: gameport.h,v 1.20 2002/01/03 08:55:05 vojtech Exp $
* Copyright (c) 1999-2002 Vojtech Pavlik
*
* Copyright (c) 1999-2001 Vojtech Pavlik
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#include <asm/io.h>
#include <linux/input.h>
#include <linux/list.h>
struct gameport;
......@@ -53,7 +36,8 @@ struct gameport {
void (*close)(struct gameport *);
struct gameport_dev *dev;
struct gameport *next;
struct list_head node;
};
struct gameport_dev {
......@@ -64,7 +48,7 @@ struct gameport_dev {
void (*connect)(struct gameport *, struct gameport_dev *dev);
void (*disconnect)(struct gameport *);
struct gameport_dev *next;
struct list_head node;
};
int gameport_open(struct gameport *gameport, struct gameport_dev *dev, int mode);
......
......@@ -2,33 +2,16 @@
#define _INPUT_H
/*
* $Id: input.h,v 1.68 2002/05/31 10:35:49 fsirl Exp $
* Copyright (c) 1999-2002 Vojtech Pavlik
*
* Copyright (c) 1999-2001 Vojtech Pavlik
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#ifdef __KERNEL__
#include <linux/time.h>
#include <linux/list.h>
#else
#include <sys/time.h>
#include <sys/ioctl.h>
......@@ -349,6 +332,7 @@ struct input_absinfo {
#define KEY_CANCEL 223
#define KEY_BRIGHTNESSDOWN 224
#define KEY_BRIGHTNESSUP 225
#define KEY_MEDIA 226
#define KEY_UNKNOWN 240
......@@ -760,6 +744,8 @@ struct ff_effect {
#define INPUT_KEYCODE(dev, scancode) ((dev->keycodesize == 1) ? ((u8*)dev->keycode)[scancode] : \
((dev->keycodesize == 1) ? ((u16*)dev->keycode)[scancode] : (((u32*)dev->keycode)[scancode])))
#define init_input_dev(dev) do { INIT_LIST_HEAD(&((dev)->h_list)); INIT_LIST_HEAD(&((dev)->node)); } while (0)
struct input_dev {
void *private;
......
......@@ -2,6 +2,7 @@
#define __LINUX_KEYBOARD_H
#include <linux/wait.h>
#include <linux/input.h>
#define KG_SHIFT 0
#define KG_CTRL 2
......@@ -15,9 +16,9 @@
#define NR_SHIFT 9
#define NR_KEYS 128
#define NR_KEYS (KEY_MAX+1)
#define MAX_NR_KEYMAPS 256
/* This means 64Kb if all keymaps are allocated. Only the superuser
/* This means 128Kb if all keymaps are allocated. Only the superuser
may increase the number of keymaps beyond MAX_NR_OF_USER_KEYMAPS. */
#define MAX_NR_OF_USER_KEYMAPS 256 /* should be at least 7 */
......
......@@ -2,36 +2,16 @@
#define _SERIO_H
/*
* $Id: serio.h,v 1.21 2001/12/19 05:15:21 skids Exp $
*
* Copyright (C) 1999-2001 Vojtech Pavlik
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
*/
/*
* The serial port set type ioctl.
* Copyright (C) 1999-2002 Vojtech Pavlik
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 as published by
* the Free Software Foundation.
*/
#include <linux/ioctl.h>
#include <linux/list.h>
#define SPIOCSTYPE _IOW('q', 0x01, unsigned long)
struct serio;
......@@ -57,7 +37,8 @@ struct serio {
void (*close)(struct serio *);
struct serio_dev *dev;
struct serio *next;
struct list_head node;
};
struct serio_dev {
......@@ -69,8 +50,9 @@ struct serio_dev {
void (*interrupt)(struct serio *, unsigned char, unsigned int);
void (*connect)(struct serio *, struct serio_dev *dev);
void (*disconnect)(struct serio *);
void (*cleanup)(struct serio *);
struct serio_dev *next;
struct list_head node;
};
int serio_open(struct serio *serio, struct serio_dev *dev);
......@@ -85,7 +67,10 @@ void serio_unregister_device(struct serio_dev *dev);
static __inline__ int serio_write(struct serio *serio, unsigned char data)
{
if (serio->write)
return serio->write(serio, data);
else
return -1;
}
static __inline__ void serio_dev_write_wakeup(struct serio *serio)
......@@ -94,6 +79,12 @@ static __inline__ void serio_dev_write_wakeup(struct serio *serio)
serio->dev->write_wakeup(serio);
}
static __inline__ void serio_cleanup(struct serio *serio)
{
if (serio->dev && serio->dev->cleanup)
serio->dev->cleanup(serio);
}
/*
* bit masks for use in "interrupt" flags (3rd argument)
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment