Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5121c717
Commit
5121c717
authored
Apr 05, 2009
by
Geert Uytterhoeven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m68k: amiga - Keyboard platform device conversion
Signed-off-by:
Geert Uytterhoeven
<
geert@linux-m68k.org
>
parent
9aed2302
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
39 deletions
+63
-39
arch/m68k/amiga/platform.c
arch/m68k/amiga/platform.c
+5
-0
drivers/input/keyboard/amikbd.c
drivers/input/keyboard/amikbd.c
+58
-39
No files found.
arch/m68k/amiga/platform.c
View file @
5121c717
...
...
@@ -160,6 +160,11 @@ static int __init amiga_init_devices(void)
sizeof
(
a4000_ide_pdata
));
}
/* other I/O hardware */
if
(
AMIGAHW_PRESENT
(
AMI_KEYBOARD
))
platform_device_register_simple
(
"amiga-keyboard"
,
-
1
,
NULL
,
0
);
return
0
;
}
...
...
drivers/input/keyboard/amikbd.c
View file @
5121c717
...
...
@@ -35,6 +35,7 @@
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/keyboard.h>
#include <linux/platform_device.h>
#include <asm/amigaints.h>
#include <asm/amigahw.h>
...
...
@@ -154,10 +155,9 @@ static const char *amikbd_messages[8] = {
[
7
]
=
KERN_WARNING
"amikbd: keyboard interrupt
\n
"
};
static
struct
input_dev
*
amikbd_dev
;
static
irqreturn_t
amikbd_interrupt
(
int
irq
,
void
*
dummy
)
static
irqreturn_t
amikbd_interrupt
(
int
irq
,
void
*
data
)
{
struct
input_dev
*
dev
=
data
;
unsigned
char
scancode
,
down
;
scancode
=
~
ciaa
.
sdr
;
/* get and invert scancode (keyboard is active low) */
...
...
@@ -170,47 +170,42 @@ static irqreturn_t amikbd_interrupt(int irq, void *dummy)
if
(
scancode
<
0x78
)
{
/* scancodes < 0x78 are keys */
if
(
scancode
==
98
)
{
/* CapsLock is a toggle switch key on Amiga */
input_report_key
(
amikbd_
dev
,
scancode
,
1
);
input_report_key
(
amikbd_
dev
,
scancode
,
0
);
input_report_key
(
dev
,
scancode
,
1
);
input_report_key
(
dev
,
scancode
,
0
);
}
else
{
input_report_key
(
amikbd_
dev
,
scancode
,
down
);
input_report_key
(
dev
,
scancode
,
down
);
}
input_sync
(
amikbd_
dev
);
input_sync
(
dev
);
}
else
/* scancodes >= 0x78 are error codes */
printk
(
amikbd_messages
[
scancode
-
0x78
]);
return
IRQ_HANDLED
;
}
static
int
__init
amikbd_
init
(
void
)
static
int
__init
amikbd_
probe
(
struct
platform_device
*
pdev
)
{
struct
input_dev
*
dev
;
int
i
,
j
,
err
;
if
(
!
AMIGAHW_PRESENT
(
AMI_KEYBOARD
))
return
-
ENODEV
;
if
(
!
request_mem_region
(
CIAA_PHYSADDR
-
1
+
0xb00
,
0x100
,
"amikeyb"
))
return
-
EBUSY
;
amikbd_dev
=
input_allocate_device
();
if
(
!
amikbd_dev
)
{
printk
(
KERN_ERR
"amikbd: not enough memory for input device
\n
"
);
err
=
-
ENOMEM
;
goto
fail1
;
dev
=
input_allocate_device
();
if
(
!
dev
)
{
dev_err
(
&
pdev
->
dev
,
"Not enough memory for input device
\n
"
);
return
-
ENOMEM
;
}
amikbd_dev
->
name
=
"Amiga Keyboard"
;
amikbd_dev
->
phys
=
"amikbd/input0"
;
amikbd_dev
->
id
.
bustype
=
BUS_AMIGA
;
amikbd_dev
->
id
.
vendor
=
0x0001
;
amikbd_dev
->
id
.
product
=
0x0001
;
amikbd_dev
->
id
.
version
=
0x0100
;
dev
->
name
=
pdev
->
name
;
dev
->
phys
=
"amikbd/input0"
;
dev
->
id
.
bustype
=
BUS_AMIGA
;
dev
->
id
.
vendor
=
0x0001
;
dev
->
id
.
product
=
0x0001
;
dev
->
id
.
version
=
0x0100
;
dev
->
dev
.
parent
=
&
pdev
->
dev
;
amikbd_
dev
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
)
|
BIT_MASK
(
EV_REP
);
dev
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
)
|
BIT_MASK
(
EV_REP
);
for
(
i
=
0
;
i
<
0x78
;
i
++
)
set_bit
(
i
,
amikbd_
dev
->
keybit
);
set_bit
(
i
,
dev
->
keybit
);
for
(
i
=
0
;
i
<
MAX_NR_KEYMAPS
;
i
++
)
{
static
u_short
temp_map
[
NR_KEYS
]
__initdata
;
...
...
@@ -229,30 +224,54 @@ static int __init amikbd_init(void)
memcpy
(
key_maps
[
i
],
temp_map
,
sizeof
(
temp_map
));
}
ciaa
.
cra
&=
~
0x41
;
/* serial data in, turn off TA */
if
(
request_irq
(
IRQ_AMIGA_CIAA_SP
,
amikbd_interrupt
,
0
,
"amikbd"
,
amikbd_interrupt
))
{
err
=
-
EBUSY
;
err
=
request_irq
(
IRQ_AMIGA_CIAA_SP
,
amikbd_interrupt
,
0
,
"amikbd"
,
dev
);
if
(
err
)
goto
fail2
;
}
err
=
input_register_device
(
amikbd_
dev
);
err
=
input_register_device
(
dev
);
if
(
err
)
goto
fail3
;
platform_set_drvdata
(
pdev
,
dev
);
return
0
;
fail3:
free_irq
(
IRQ_AMIGA_CIAA_SP
,
amikbd_interrupt
);
fail2:
input_free_device
(
amikbd_dev
);
fail1:
release_mem_region
(
CIAA_PHYSADDR
-
1
+
0xb00
,
0x100
);
fail3:
free_irq
(
IRQ_AMIGA_CIAA_SP
,
dev
);
fail2:
input_free_device
(
dev
);
return
err
;
}
static
void
__exit
amikbd_exit
(
void
)
static
int
__exit
amikbd_remove
(
struct
platform_device
*
pdev
)
{
struct
input_dev
*
dev
=
platform_get_drvdata
(
pdev
);
platform_set_drvdata
(
pdev
,
NULL
);
free_irq
(
IRQ_AMIGA_CIAA_SP
,
dev
);
input_unregister_device
(
dev
);
return
0
;
}
static
struct
platform_driver
amikbd_driver
=
{
.
remove
=
__exit_p
(
amikbd_remove
),
.
driver
=
{
.
name
=
"amiga-keyboard"
,
.
owner
=
THIS_MODULE
,
},
};
static
int
__init
amikbd_init
(
void
)
{
free_irq
(
IRQ_AMIGA_CIAA_SP
,
amikbd_interrupt
);
input_unregister_device
(
amikbd_dev
);
release_mem_region
(
CIAA_PHYSADDR
-
1
+
0xb00
,
0x100
);
return
platform_driver_probe
(
&
amikbd_driver
,
amikbd_probe
);
}
module_init
(
amikbd_init
);
static
void
__exit
amikbd_exit
(
void
)
{
platform_driver_unregister
(
&
amikbd_driver
);
}
module_exit
(
amikbd_exit
);
MODULE_ALIAS
(
"platform:amiga-keyboard"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment