2002-01-31 18:20:51

by James Simmons

[permalink] [raw]
Subject: [PATCH] Q40 input api support.


This patch ports q40 PS/2 controller support over to the input api. Please
try it out. It is against the latest dave jones tree.

. ---
|o_o |
|:_/ | Give Micro$oft the Bird!!!!
// \ \ Use Linux!!!!
(| | )
/'_ _/`\
___)=(___/

diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/serio/Config.in linux/drivers/input/serio/Config.in
--- linux-2.5.2-dj7/drivers/input/serio/Config.in Tue Jan 29 17:36:39 2002
+++ linux/drivers/input/serio/Config.in Thu Jan 31 11:06:02 2002
@@ -7,6 +7,7 @@
dep_tristate ' i8042 PC Keyboard controller' CONFIG_SERIO_I8042 $CONFIG_SERIO $CONFIG_ISA
dep_tristate ' Serial port line discipline' CONFIG_SERIO_SERPORT $CONFIG_SERIO
dep_tristate ' ct82c710 Aux port controller' CONFIG_SERIO_CT82C710 $CONFIG_SERIO $CONFIG_ISA
+dep_tristate ' Q40 keyboard controller' CONFIG_SERIO_Q40KBD $CONFIG_SERIO
dep_tristate ' Parallel port keyboard adapter' CONFIG_SERIO_PARKBD $CONFIG_SERIO $CONFIG_PARPORT

if [ "$CONFIG_ARCH_ACORN" = "y" ]; then
diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/serio/Makefile linux/drivers/input/serio/Makefile
--- linux-2.5.2-dj7/drivers/input/serio/Makefile Tue Jan 29 17:36:39 2002
+++ linux/drivers/input/serio/Makefile Thu Jan 31 10:49:53 2002
@@ -18,6 +18,7 @@
obj-$(CONFIG_SERIO_SERPORT) += serport.o
obj-$(CONFIG_SERIO_CT82C710) += ct82c710.o
obj-$(CONFIG_SERIO_RPCKBD) += rpckbd.o
+obj-$(CONFIG_SERIO_Q40KBD) += q40kbd.o

# The global Rules.make.

diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/serio/q40kbd.c linux/drivers/input/serio/q40kbd.c
--- linux-2.5.2-dj7/drivers/input/serio/q40kbd.c Wed Dec 31 16:00:00 1969
+++ linux/drivers/input/serio/q40kbd.c Thu Jan 31 10:41:56 2002
@@ -0,0 +1,104 @@
+/*
+ * $Id: q40kbd.c,v 1.9 2002/01/23 06:20:52 jsimmons Exp $
+ *
+ * Copyright (c) 2000-2001 Vojtech Pavlik
+ *
+ * Based on the work of:
+ * unknown author
+ */
+
+/*
+ * Q40 PS/2 keyboard controller driver for Linux/m68k
+ */
+
+/*
+ * 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 <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/serio.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>
+
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Q40 PS/2 keyboard controller driver");
+MODULE_LICENSE("GPL");
+
+static inline void q40kbd_write(unsigned char val)
+{
+ /* FIXME! We need a way how to write to the keyboard! */
+}
+
+static struct serio q40kbd_port =
+{
+ type: SERIO_8042,
+ write: q40kbd_write,
+ name: "Q40 PS/2 kbd port",
+ phys: "isa0060/serio0",
+};
+
+static void q40kbd_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+ unsigned long flags;
+
+ if (IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))
+ if (q40kbd_port.dev)
+ q40kbd_port.dev->interrupt(&q40kbd_port, master_inb(KEYCODE_REG), 0);
+
+ master_outb(-1, KEYBOARD_UNLOCK_REG);
+}
+
+void __init q40kbd_init(void)
+{
+ int maxread = 100;
+
+ /* Get the keyboard controller registers (incomplete decode) */
+ request_region(0x60, 16, "q40kbd");
+
+ /* allocate the IRQ */
+ request_irq(Q40_IRQ_KEYBOARD, keyboard_interrupt, 0, "q40kbd", NULL);
+
+ /* flush any pending input. */
+ while (maxread-- && (IRQ_KEYB_MASK & master_inb(INTERRUPT_REG)))
+ master_inb(KEYCODE_REG);
+
+ /* off we go */
+ master_outb(-1,KEYBOARD_UNLOCK_REG);
+ master_outb(1,KEY_IRQ_ENABLE_REG);
+
+ register_serio_port(&q40kbd_port);
+ printk(KERN_INFO "serio: Q40 PS/2 kbd port irq %d\n", Q40_IRQ_KEYBOARD);
+}
+
+void __exit q40kbd_exit(void)
+{
+ unregister_serio_port(&q40kbd_port);
+ free_irq(Q40_IRQ_KEYBOARD, NULL);
+ release_region(0x60, 16);
+}
+
+module_init(q40kbd_init);
+module_exit(q40kbd_exit);


2002-01-31 18:49:00

by James Simmons

[permalink] [raw]
Subject: Info on dn_keyb.c


How is in charge of it and where can I get docs on the hardware so I can
port the driver to the input api?

2002-01-31 20:58:32

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.

On Thu, 31 Jan 2002, James Simmons wrote:
> This patch ports q40 PS/2 controller support over to the input api. Please
> try it out. It is against the latest dave jones tree.

> diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/serio/q40kbd.c linux/drivers/input/serio/q40kbd.c
> --- linux-2.5.2-dj7/drivers/input/serio/q40kbd.c Wed Dec 31 16:00:00 1969
> +++ linux/drivers/input/serio/q40kbd.c Thu Jan 31 10:41:56 2002
> @@ -0,0 +1,104 @@
> +/*
> + * $Id: q40kbd.c,v 1.9 2002/01/23 06:20:52 jsimmons Exp $
> + *
> + * Copyright (c) 2000-2001 Vojtech Pavlik
> + *
> + * Based on the work of:
> + * unknown author

Richard Zidlicky <[email protected]>

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2002-01-31 23:14:27

by James Simmons

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.


> > diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/serio/q40kbd.c linux/drivers/input/serio/q40kbd.c
> > --- linux-2.5.2-dj7/drivers/input/serio/q40kbd.c Wed Dec 31 16:00:00 1969
> > +++ linux/drivers/input/serio/q40kbd.c Thu Jan 31 10:41:56 2002
> > @@ -0,0 +1,104 @@
> > +/*
> > + * $Id: q40kbd.c,v 1.9 2002/01/23 06:20:52 jsimmons Exp $
> > + *
> > + * Copyright (c) 2000-2001 Vojtech Pavlik
> > + *
> > + * Based on the work of:
> > + * unknown author
>
> Richard Zidlicky <[email protected]>

Added. Now to have it tested :-)

2002-01-31 23:16:19

by James Simmons

[permalink] [raw]
Subject: Atari keyboard?


Also I need info on these keyboards as well to port them over.

. ---
|o_o |
|:_/ | Give Micro$oft the Bird!!!!
// \ \ Use Linux!!!!
(| | )
/'_ _/`\
___)=(___/


2002-01-31 23:49:47

by James Simmons

[permalink] [raw]
Subject: [PATCH] amiga keyboard input II


Here is the second patch with much improvements I got from this list.
Anyone want to try it out? You need to enable input support and Keyboard
Interface. Then go down and select Amiga keyboard. This is against the
Dave Jones tree.

. ---
|o_o |
|:_/ | Give Micro$oft the Bird!!!!
// \ \ Use Linux!!!!
(| | )
/'_ _/`\
___)=(___/

diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/keyboard/Config.in linux/drivers/input/keyboard/Config.in
--- linux-2.5.2-dj7/drivers/input/keyboard/Config.in Tue Jan 29 17:36:39 2002
+++ linux/drivers/input/keyboard/Config.in Thu Jan 31 16:38:00 2002
@@ -12,3 +12,7 @@
if [ "$CONFIG_SH_DREAMCAST" = "y" ]; then
dep_tristate ' Maple bus keyboard support' CONFIG_KEYBOARD_MAPLE $CONFIG_INPUT $CONFIG_INPUT_KEYBOARD $CONFIG_MAPLE
fi
+
+if [ "$CONFIG_AMIGA" = "y" ]; then
+ dep_tristate ' Amiga keyboard' CONFIG_KEYBOARD_AMIKBD $CONFIG_INPUT $CONFIG_INPUT_KEYBOARD
+fi
diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/keyboard/Makefile linux/drivers/input/keyboard/Makefile
--- linux-2.5.2-dj7/drivers/input/keyboard/Makefile Tue Jan 29 17:36:39 2002
+++ linux/drivers/input/keyboard/Makefile Thu Jan 31 16:38:00 2002
@@ -13,6 +13,7 @@
obj-$(CONFIG_KEYBOARD_PS2SERKBD) += ps2serkbd.o
obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o
obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o
+obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o

# The global Rules.make.

diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/keyboard/amikbd.c linux/drivers/input/keyboard/amikbd.c
--- linux-2.5.2-dj7/drivers/input/keyboard/amikbd.c Wed Dec 31 16:00:00 1969
+++ linux/drivers/input/keyboard/amikbd.c Thu Jan 31 16:38:27 2002
@@ -0,0 +1,140 @@
+/*
+ * $Id: amikbd.c,v 1.11 2002/01/31 23:05:28 jsimmons Exp $
+ *
+ * Copyright (c) 2000-2001 Vojtech Pavlik
+ *
+ * Based on the work of:
+ * Hamish Macdonald
+ */
+
+/*
+ * Amiga keyboard driver for Linux/m68k
+ */
+
+/*
+ * 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 <[email protected]>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
+ */
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/input.h>
+
+#include <asm/amigaints.h>
+#include <asm/amigahw.h>
+#include <asm/irq.h>
+
+MODULE_AUTHOR("Vojtech Pavlik <[email protected]>");
+MODULE_DESCRIPTION("Amiga keyboard driver");
+MODULE_LICENSE("GPL");
+
+static unsigned char amikbd_keycode[0x78] = {
+ 41, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 43, 0, 82,
+ 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 0, 79, 80, 81,
+ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 0, 0, 75, 76, 77,
+ 0, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 0, 83, 71, 72, 73,
+ 57, 14, 15, 96, 28, 1,111, 0, 0, 0, 74, 0,103,108,106,105,
+ 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 98, 55, 78, 87,
+ 42, 54, 58, 29, 56,100
+}
+
+static char *amikbd_messages[] = {
+ KERN_ALERT "amikbd: Ctrl-Amiga-Amiga reset warning!!\n",
+ KERN_WARNING "amikbd: keyboard lost sync\n",
+ KERN_WARNING "amikbd: keyboard buffer overflow\n",
+ KERN_WARNING "amikbd: keyboard controller failure\n",
+ KERN_ERR "amikbd: keyboard selftest failure\n",
+ KERN_INFO "amikbd: initiate power-up key stream\n",
+ KERN_INFO "amikbd: terminate power-up key stream\n",
+ KERN_WARNING "amikbd: keyboard interrupt\n"
+};
+
+static struct input_dev amikbd_dev;
+
+static char *amikbd_name = "Amiga keyboard";
+static char *amikbd_phys = "amikbd/input0";
+
+static void amikbd_interrupt(int irq, void *dummy, struct pt_regs *fp)
+{
+ unsigned char scancode, down;
+
+ scancode = ~ciaa.sdr; /* get and invert scancode (keyboard is active low) */
+ ciaa.cra |= 0x40; /* switch SP pin to output for handshake */
+ udelay(85); /* wait until 85 us have expired */
+ ciaa.cra &= ~0x40; /* switch CIA serial port to input mode */
+
+ scancode = scancode >> 1; /* lowest bit is release bit */
+ down = scancode & 1;
+
+ if (scancode < 0x78) { /* scancodes < 0x78 are keys */
+
+ scancode = amikbd_keycode[scancode];
+
+ if (scancode == KEY_CAPS) { /* CapsLock is a toggle switch key on Amiga */
+ input_report_key(&amikbd_dev, scancode, 1);
+ input_report_key(&amikbd_dev, scancode, 0);
+ return;
+ }
+
+ input_report_key(&amikbd_dev, scancode, down);
+
+ return;
+ }
+
+ printk(amikbd_messages[scancode - 0x78]); /* scancodes >= 0x78 are error codes */
+}
+
+static int __init amikbd_init(void)
+{
+ int i;
+
+ if (!AMIGAHW_PRESENT(AMI_KEYBOARD))
+ return -EIO;
+
+ amikbd_dev.evbit[0] = BIT(EV_KEY) | BIT(EV_REP);
+ amikbd_dev.keycode = amikbd_keycode;
+
+ for (i = 0; i < 0x78; i++)
+ if (amikbd_keycode[i])
+ set_bit(amikbd_keycode[i], amikbd_dev.keybit);
+
+ ciaa.cra &= ~0x41; /* serial data in, turn off TA */
+ request_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt, 0, "amikbd", NULL);
+
+ amikbd_dev.name = amikbd_name;
+ amikbd_dev.phys = amikbd_phys;
+ amikbd_dev.idbus = BUS_AMIGA;
+ amikbd_dev.idvendor = 0x0001;
+ amikbd_dev.idproduct = 0x0001;
+ amikbd_dev.idversion = 0x0100;
+
+ input_register_device(&amikbd_dev);
+
+ printk(KERN_INFO "input: %s\n", amikbd_name);
+
+ return 0;
+}
+
+static void __exit amikbd_exit(void)
+{
+ input_unregister_device(&amikbd_dev);
+ free_irq(IRQ_AMIGA_CIAA_SP, amikbd_interrupt);
+}
+
+module_init(amikbd_init);
+module_exit(amikbd_exit);

2002-02-01 00:23:47

by Richard Zidlicky

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.

On Thu, Jan 31, 2002 at 10:19:46AM -0800, James Simmons wrote:
>
> This patch ports q40 PS/2 controller support over to the input api. Please
> try it out. It is against the latest dave jones tree.

thanks, I will look at this over the weekend. Where do I get the DJ
tree?

> +static inline void q40kbd_write(unsigned char val)
> +{
> + /* FIXME! We need a way how to write to the keyboard! */
> +}

absolutely no way to write to the keyboard.

> +
> +static struct serio q40kbd_port =
> +{
> + type: SERIO_8042,
> + write: q40kbd_write,
> + name: "Q40 PS/2 kbd port",
> + phys: "isa0060/serio0",
> +};
> +
> +static void q40kbd_interrupt(int irq, void *dev_id, struct pt_regs *regs)
> +{
> + unsigned long flags;
> +
> + if (IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))
> + if (q40kbd_port.dev)
> + q40kbd_port.dev->interrupt(&q40kbd_port, master_inb(KEYCODE_REG), 0);
^^^^^^^^^
where is this defined?

> +void __init q40kbd_init(void)
> +{
> + int maxread = 100;
> +
> + /* Get the keyboard controller registers (incomplete decode) */
> + request_region(0x60, 16, "q40kbd");
> +
> + /* allocate the IRQ */
> + request_irq(Q40_IRQ_KEYBOARD, keyboard_interrupt, 0, "q40kbd", NULL);
^^^^^^^^^^^^^^^^^^
should that be q40kbd_interrupt ?

Bye
Richard

2002-02-01 00:40:17

by James Simmons

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.


> > This patch ports q40 PS/2 controller support over to the input api. Please
> > try it out. It is against the latest dave jones tree.
>
> thanks, I will look at this over the weekend. Where do I get the DJ
> tree?

ftp://ftp.kernel.org/pub/linux/kernel/people/davej/patches/2.5


> > +static inline void q40kbd_write(unsigned char val)
> > +{
> > + /* FIXME! We need a way how to write to the keyboard! */
> > +}
>
> absolutely no way to write to the keyboard.

That solves that.

> > + if (IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))
> > + if (q40kbd_port.dev)
> > + q40kbd_port.dev->interrupt(&q40kbd_port, master_inb(KEYCODE_REG), 0);
> ^^^^^^^^^
> where is this defined?

The way it works with the new input code is that it modularized the
keyboard/mice from the controller chipsets. This file, q40kbd.c is the
file to sets up the controller chip. For the Q40 we have this as for the
ix86 we have i8042.c. As for the mouse and keyboard driver themselves you
pick PS/2 mouse support and AT keyboard support. These drivers are the
same ones as the ix86 drivers for the mice and keyboard. In theory they
should work on both platforms. Note the check for dev. This field is
filled in when we register the keyboard if it is present.

> > + /* allocate the IRQ */
> > + request_irq(Q40_IRQ_KEYBOARD, keyboard_interrupt, 0, "q40kbd", NULL);
> ^^^^^^^^^^^^^^^^^^
> should that be q40kbd_interrupt ?

Yes. Fixed.

2002-02-01 07:16:28

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: Atari keyboard?

On Thu, Jan 31, 2002 at 03:14:15PM -0800, James Simmons wrote:
>
> Also I need info on these keyboards as well to port them over.

See ruby/linux/Documentation/input/atarikbd.txt

--
Vojtech Pavlik
SuSE Labs

2002-02-01 09:09:14

by Emmanuel Fuste

[permalink] [raw]
Subject: RE: Info on dn_keyb.c


>How is in charge of it and where can I get docs on the hardware so I can
>port the driver to the input api?

It was Peter De Schrijver who made the M68K Apollo DN port.
I have the hardware docs on paper. I could try to send you the relevant parts
or help you to port it.
I no longuer have Apollo DN hardware on hand but if someone in France who read
LKML want to made a donation, he can contact me.

Manu.

2002-02-01 09:14:34

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH] amiga keyboard input II

On Thu, 31 Jan 2002, James Simmons wrote:
> Here is the second patch with much improvements I got from this list.
> Anyone want to try it out? You need to enable input support and Keyboard
> Interface. Then go down and select Amiga keyboard. This is against the
> Dave Jones tree.

> diff -urN -X /home/jsimmons/dontdiff linux-2.5.2-dj7/drivers/input/keyboard/amikbd.c linux/drivers/input/keyboard/amikbd.c
> --- linux-2.5.2-dj7/drivers/input/keyboard/amikbd.c Wed Dec 31 16:00:00 1969
> +++ linux/drivers/input/keyboard/amikbd.c Thu Jan 31 16:38:27 2002

> + scancode = scancode >> 1; /* lowest bit is release bit */
> + down = scancode & 1;

Still to be reordered

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2002-02-01 11:51:43

by Michael Schmitz

[permalink] [raw]
Subject: Re: Atari keyboard?

> Also I need info on these keyboards as well to port them over.

I'd ask Andreas Schwab if there's any questions left after reading the
docs Vojtech mentioned. I'll be happy to test as soon as you have a patch
(and I've rebuilt my test system from the latest disaster),

Michael

2002-02-01 15:56:03

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.

On Fri, Feb 01, 2002 at 01:15:43AM +0100, Richard Zidlicky wrote:
> On Thu, Jan 31, 2002 at 10:19:46AM -0800, James Simmons wrote:
> >
> > This patch ports q40 PS/2 controller support over to the input api. Please
> > try it out. It is against the latest dave jones tree.
>
> thanks, I will look at this over the weekend. Where do I get the DJ
> tree?
>
> > +static inline void q40kbd_write(unsigned char val)
> > +{
> > + /* FIXME! We need a way how to write to the keyboard! */
> > +}
>
> absolutely no way to write to the keyboard.

Really? Too bad. So no way to set LEDs, no way to detect the keyboard,
no way to set it to "Scancode Set 3"?

We'll need to modify the atkbd driver then ...

> > +static void q40kbd_interrupt(int irq, void *dev_id, struct pt_regs *regs)
> > +{
> > + unsigned long flags;
> > +
> > + if (IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))
> > + if (q40kbd_port.dev)
> > + q40kbd_port.dev->interrupt(&q40kbd_port, master_inb(KEYCODE_REG), 0);
> ^^^^^^^^^
> where is this defined?

include/linux/serio.h: struct serio_dev

> > +void __init q40kbd_init(void)
> > +{
> > + int maxread = 100;
> > +
> > + /* Get the keyboard controller registers (incomplete decode) */
> > + request_region(0x60, 16, "q40kbd");
> > +
> > + /* allocate the IRQ */
> > + request_irq(Q40_IRQ_KEYBOARD, keyboard_interrupt, 0, "q40kbd", NULL);
> ^^^^^^^^^^^^^^^^^^
> should that be q40kbd_interrupt ?

Yes, it should.

--
Vojtech Pavlik
SuSE Labs

2002-02-01 15:57:23

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.

On Thu, Jan 31, 2002 at 04:39:11PM -0800, James Simmons wrote:

> > > This patch ports q40 PS/2 controller support over to the input api. Please
> > > try it out. It is against the latest dave jones tree.
> >
> > thanks, I will look at this over the weekend. Where do I get the DJ
> > tree?
>
> ftp://ftp.kernel.org/pub/linux/kernel/people/davej/patches/2.5
>
>
> > > +static inline void q40kbd_write(unsigned char val)
> > > +{
> > > + /* FIXME! We need a way how to write to the keyboard! */
> > > +}
> >
> > absolutely no way to write to the keyboard.
>
> That solves that.

It doesn't. atkbd.c won't detect the keyboard if it can't talk to it.

> > > + if (IRQ_KEYB_MASK & master_inb(INTERRUPT_REG))
> > > + if (q40kbd_port.dev)
> > > + q40kbd_port.dev->interrupt(&q40kbd_port, master_inb(KEYCODE_REG), 0);
> > ^^^^^^^^^
> > where is this defined?
>
> The way it works with the new input code is that it modularized the
> keyboard/mice from the controller chipsets. This file, q40kbd.c is the
> file to sets up the controller chip. For the Q40 we have this as for the
> ix86 we have i8042.c. As for the mouse and keyboard driver themselves you
> pick PS/2 mouse support and AT keyboard support. These drivers are the
> same ones as the ix86 drivers for the mice and keyboard. In theory they
> should work on both platforms. Note the check for dev. This field is
> filled in when we register the keyboard if it is present.
>
> > > + /* allocate the IRQ */
> > > + request_irq(Q40_IRQ_KEYBOARD, keyboard_interrupt, 0, "q40kbd", NULL);
> > ^^^^^^^^^^^^^^^^^^
> > should that be q40kbd_interrupt ?
>
> Yes. Fixed.

--
Vojtech Pavlik
SuSE Labs

2002-02-01 19:46:52

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.

On Fri, Feb 01, 2002 at 08:43:04PM +0100, Richard Zidlicky wrote:

>
> > > > +static inline void q40kbd_write(unsigned char val)
> > > > +{
> > > > + /* FIXME! We need a way how to write to the keyboard! */
> > > > +}
> > >
> > > absolutely no way to write to the keyboard.
> >
> > Really? Too bad. So no way to set LEDs, no way to detect the keyboard,
> > no way to set it to "Scancode Set 3"?
>
> no way to control LED's, keyboard is assumed present, scancode set
> is AT

Ok, in that case we'll need to pass a flag to atkbd.c (via the serio
layer) telling it not to try any detection / initialization of the
keyboard.

--
Vojtech Pavlik
SuSE Labs

2002-02-01 19:43:31

by Richard Zidlicky

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.


> > > +static inline void q40kbd_write(unsigned char val)
> > > +{
> > > + /* FIXME! We need a way how to write to the keyboard! */
> > > +}
> >
> > absolutely no way to write to the keyboard.
>
> Really? Too bad. So no way to set LEDs, no way to detect the keyboard,
> no way to set it to "Scancode Set 3"?

no way to control LED's, keyboard is assumed present, scancode set
is AT

Richard

2002-02-01 20:24:04

by Richard Zidlicky

[permalink] [raw]
Subject: Re: [PATCH] Q40 input api support.

>
> On Fri, Feb 01, 2002 at 08:43:04PM +0100, Richard Zidlicky wrote:
>
> >
> > > > > +static inline void q40kbd_write(unsigned char val)
> > > > > +{
> > > > > + /* FIXME! We need a way how to write to the keyboard! */
> > > > > +}
> > > >
> > > > absolutely no way to write to the keyboard.
> > >
> > > Really? Too bad. So no way to set LEDs, no way to detect the keyboard,
> > > no way to set it to "Scancode Set 3"?
> >
> > no way to control LED's, keyboard is assumed present, scancode set
> > is AT
>
> Ok, in that case we'll need to pass a flag to atkbd.c (via the serio
> layer) telling it not to try any detection / initialization of the
> keyboard.

that looks fine.

Richard

2002-07-10 22:47:41

by James Simmons

[permalink] [raw]
Subject: RE: Info on dn_keyb.c


> >How is in charge of it and where can I get docs on the hardware so I can
> >port the driver to the input api?
>
> It was Peter De Schrijver who made the M68K Apollo DN port.
> I have the hardware docs on paper. I could try to send you the relevant parts
> or help you to port it.

Could you send me the docs. Its time to port the keyboard driver over to
the input api.

> I no longuer have Apollo DN hardware on hand but if someone in France who
> read LKML want to made a donation, he can contact me.

Did someone send you anything.


2002-07-11 06:28:46

by Geert Uytterhoeven

[permalink] [raw]
Subject: RE: Info on dn_keyb.c

On Wed, 10 Jul 2002, James Simmons wrote:
> > >How is in charge of it and where can I get docs on the hardware so I can
> > >port the driver to the input api?
> >
> > It was Peter De Schrijver who made the M68K Apollo DN port.
> > I have the hardware docs on paper. I could try to send you the relevant parts
> > or help you to port it.
>
> Could you send me the docs. Its time to port the keyboard driver over to
> the input api.

FYI, you need the following patch (from Linux/m68k CVS) to make the current
dn_keyb.c compile:

--- linux-2.5.25/drivers/char/dn_keyb.c Fri Jul 14 21:20:22 2000
+++ linux-m68k-2.5.25/drivers/char/dn_keyb.c Mon Jun 17 11:39:09 2002
@@ -5,6 +5,7 @@
#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>
@@ -19,8 +20,6 @@

#include "busmouse.h"

-/* extern void handle_scancode(unsigned char,int ); */
-
#define DNKEY_CAPS 0x7e
#define BREAK_FLAG 0x80
#define DNKEY_REPEAT_DELAY 50
@@ -336,7 +335,8 @@

static short mouse_byte_count=0;
static u_char mouse_packet[3];
- short mouse_buttons;
+ short buttons;
+ int dx, dy;

mouse_packet[mouse_byte_count++]=mouse_data;

@@ -347,24 +347,12 @@
/* 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) {
- if(mouse_update_allowed) {
- mouse_ready=1;
- mouse_buttons=(mouse_packet[0] >> 4) & 0x7;
- mouse_dx+=mouse_packet[1] == 0xff ? 0 : (signed char)mouse_packet[1];
- mouse_dy+=mouse_packet[2] == 0xff ? 0 : (signed char)mouse_packet[2];
- wake_up_interruptible(&mouse_wait);
- if (mouse_dx < -2048)
- mouse_dx = -2048;
- else if (mouse_dx > 2048)
- mouse_dx = 2048;
- if (mouse_dy < -2048)
- mouse_dy = -2048;
- else if (mouse_dy > 2048)
- mouse_dy = 2048;
- kill_fasync(&mouse_fasyncptr, SIGIO, POLL_IN);
- }
+ 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); */
}

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2002-07-11 13:08:14

by Richard Zidlicky

[permalink] [raw]
Subject: m68k and input api

Hi,

isn't it time to simply drop in all of the input layer into
our 2.5 CVS branch and fix it later? I certainly won't mind if
my keyboard doesn't work for a while and I am sure that fixing
it will be actually *much* easier than hunting together all
the input-api pieces.

Richard

2002-07-11 21:37:31

by James Simmons

[permalink] [raw]
Subject: Re: m68k and input api


> isn't it time to simply drop in all of the input layer into
> our 2.5 CVS branch and fix it later? I certainly won't mind if
> my keyboard doesn't work for a while and I am sure that fixing
> it will be actually *much* easier than hunting together all
> the input-api pieces.

Great!!! The stuff I sent was the latest stuff that will be going in soon.