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
314c926f
Commit
314c926f
authored
Apr 05, 2009
by
Geert Uytterhoeven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
m68k: amiga - Mouse platform device conversion
Signed-off-by:
Geert Uytterhoeven
<
geert@linux-m68k.org
>
parent
5121c717
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
35 deletions
+66
-35
arch/m68k/amiga/platform.c
arch/m68k/amiga/platform.c
+3
-0
drivers/input/mouse/amimouse.c
drivers/input/mouse/amimouse.c
+63
-35
No files found.
arch/m68k/amiga/platform.c
View file @
314c926f
...
@@ -165,6 +165,9 @@ static int __init amiga_init_devices(void)
...
@@ -165,6 +165,9 @@ static int __init amiga_init_devices(void)
if
(
AMIGAHW_PRESENT
(
AMI_KEYBOARD
))
if
(
AMIGAHW_PRESENT
(
AMI_KEYBOARD
))
platform_device_register_simple
(
"amiga-keyboard"
,
-
1
,
NULL
,
0
);
platform_device_register_simple
(
"amiga-keyboard"
,
-
1
,
NULL
,
0
);
if
(
AMIGAHW_PRESENT
(
AMI_MOUSE
))
platform_device_register_simple
(
"amiga-mouse"
,
-
1
,
NULL
,
0
);
return
0
;
return
0
;
}
}
...
...
drivers/input/mouse/amimouse.c
View file @
314c926f
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/input.h>
#include <linux/input.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <asm/irq.h>
#include <asm/irq.h>
#include <asm/setup.h>
#include <asm/setup.h>
...
@@ -34,10 +35,10 @@ MODULE_DESCRIPTION("Amiga mouse driver");
...
@@ -34,10 +35,10 @@ MODULE_DESCRIPTION("Amiga mouse driver");
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
static
int
amimouse_lastx
,
amimouse_lasty
;
static
int
amimouse_lastx
,
amimouse_lasty
;
static
struct
input_dev
*
amimouse_dev
;
static
irqreturn_t
amimouse_interrupt
(
int
irq
,
void
*
d
ummy
)
static
irqreturn_t
amimouse_interrupt
(
int
irq
,
void
*
d
ata
)
{
{
struct
input_dev
*
dev
=
data
;
unsigned
short
joy0dat
,
potgor
;
unsigned
short
joy0dat
,
potgor
;
int
nx
,
ny
,
dx
,
dy
;
int
nx
,
ny
,
dx
,
dy
;
...
@@ -59,14 +60,14 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy)
...
@@ -59,14 +60,14 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy)
potgor
=
amiga_custom
.
potgor
;
potgor
=
amiga_custom
.
potgor
;
input_report_rel
(
amimouse_
dev
,
REL_X
,
dx
);
input_report_rel
(
dev
,
REL_X
,
dx
);
input_report_rel
(
amimouse_
dev
,
REL_Y
,
dy
);
input_report_rel
(
dev
,
REL_Y
,
dy
);
input_report_key
(
amimouse_
dev
,
BTN_LEFT
,
ciaa
.
pra
&
0x40
);
input_report_key
(
dev
,
BTN_LEFT
,
ciaa
.
pra
&
0x40
);
input_report_key
(
amimouse_
dev
,
BTN_MIDDLE
,
potgor
&
0x0100
);
input_report_key
(
dev
,
BTN_MIDDLE
,
potgor
&
0x0100
);
input_report_key
(
amimouse_
dev
,
BTN_RIGHT
,
potgor
&
0x0400
);
input_report_key
(
dev
,
BTN_RIGHT
,
potgor
&
0x0400
);
input_sync
(
amimouse_
dev
);
input_sync
(
dev
);
return
IRQ_HANDLED
;
return
IRQ_HANDLED
;
}
}
...
@@ -74,63 +75,90 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy)
...
@@ -74,63 +75,90 @@ static irqreturn_t amimouse_interrupt(int irq, void *dummy)
static
int
amimouse_open
(
struct
input_dev
*
dev
)
static
int
amimouse_open
(
struct
input_dev
*
dev
)
{
{
unsigned
short
joy0dat
;
unsigned
short
joy0dat
;
int
error
;
joy0dat
=
amiga_custom
.
joy0dat
;
joy0dat
=
amiga_custom
.
joy0dat
;
amimouse_lastx
=
joy0dat
&
0xff
;
amimouse_lastx
=
joy0dat
&
0xff
;
amimouse_lasty
=
joy0dat
>>
8
;
amimouse_lasty
=
joy0dat
>>
8
;
if
(
request_irq
(
IRQ_AMIGA_VERTB
,
amimouse_interrupt
,
0
,
"amimouse"
,
amimouse_interrupt
))
{
error
=
request_irq
(
IRQ_AMIGA_VERTB
,
amimouse_interrupt
,
0
,
"amimouse"
,
printk
(
KERN_ERR
"amimouse.c: Can't allocate irq %d
\n
"
,
IRQ_AMIGA_VERTB
);
dev
);
return
-
EBUSY
;
if
(
error
)
}
dev_err
(
&
dev
->
dev
,
"Can't allocate irq %d
\n
"
,
IRQ_AMIGA_VERTB
);
return
0
;
return
error
;
}
}
static
void
amimouse_close
(
struct
input_dev
*
dev
)
static
void
amimouse_close
(
struct
input_dev
*
dev
)
{
{
free_irq
(
IRQ_AMIGA_VERTB
,
amimouse_interrupt
);
free_irq
(
IRQ_AMIGA_VERTB
,
dev
);
}
}
static
int
__init
amimouse_
init
(
void
)
static
int
__init
amimouse_
probe
(
struct
platform_device
*
pdev
)
{
{
int
err
;
int
err
;
struct
input_dev
*
dev
;
if
(
!
MACH_IS_AMIGA
||
!
AMIGAHW_PRESENT
(
AMI_MOUSE
))
dev
=
input_allocate_device
();
return
-
ENODEV
;
if
(
!
dev
)
amimouse_dev
=
input_allocate_device
();
if
(
!
amimouse_dev
)
return
-
ENOMEM
;
return
-
ENOMEM
;
amimouse_dev
->
name
=
"Amiga mouse"
;
dev
->
name
=
pdev
->
name
;
amimouse_
dev
->
phys
=
"amimouse/input0"
;
dev
->
phys
=
"amimouse/input0"
;
amimouse_
dev
->
id
.
bustype
=
BUS_AMIGA
;
dev
->
id
.
bustype
=
BUS_AMIGA
;
amimouse_
dev
->
id
.
vendor
=
0x0001
;
dev
->
id
.
vendor
=
0x0001
;
amimouse_
dev
->
id
.
product
=
0x0002
;
dev
->
id
.
product
=
0x0002
;
amimouse_
dev
->
id
.
version
=
0x0100
;
dev
->
id
.
version
=
0x0100
;
amimouse_
dev
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
)
|
BIT_MASK
(
EV_REL
);
dev
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
)
|
BIT_MASK
(
EV_REL
);
amimouse_
dev
->
relbit
[
0
]
=
BIT_MASK
(
REL_X
)
|
BIT_MASK
(
REL_Y
);
dev
->
relbit
[
0
]
=
BIT_MASK
(
REL_X
)
|
BIT_MASK
(
REL_Y
);
amimouse_
dev
->
keybit
[
BIT_WORD
(
BTN_LEFT
)]
=
BIT_MASK
(
BTN_LEFT
)
|
dev
->
keybit
[
BIT_WORD
(
BTN_LEFT
)]
=
BIT_MASK
(
BTN_LEFT
)
|
BIT_MASK
(
BTN_MIDDLE
)
|
BIT_MASK
(
BTN_RIGHT
);
BIT_MASK
(
BTN_MIDDLE
)
|
BIT_MASK
(
BTN_RIGHT
);
amimouse_dev
->
open
=
amimouse_open
;
dev
->
open
=
amimouse_open
;
amimouse_dev
->
close
=
amimouse_close
;
dev
->
close
=
amimouse_close
;
dev
->
dev
.
parent
=
&
pdev
->
dev
;
err
=
input_register_device
(
amimouse_
dev
);
err
=
input_register_device
(
dev
);
if
(
err
)
{
if
(
err
)
{
input_free_device
(
amimouse_
dev
);
input_free_device
(
dev
);
return
err
;
return
err
;
}
}
platform_set_drvdata
(
pdev
,
dev
);
return
0
;
return
0
;
}
}
static
void
__exit
amimouse_exit
(
void
)
static
int
__exit
amimouse_remove
(
struct
platform_device
*
pdev
)
{
{
input_unregister_device
(
amimouse_dev
);
struct
input_dev
*
dev
=
platform_get_drvdata
(
pdev
);
platform_set_drvdata
(
pdev
,
NULL
);
input_unregister_device
(
dev
);
return
0
;
}
static
struct
platform_driver
amimouse_driver
=
{
.
remove
=
__exit_p
(
amimouse_remove
),
.
driver
=
{
.
name
=
"amiga-mouse"
,
.
owner
=
THIS_MODULE
,
},
};
static
int
__init
amimouse_init
(
void
)
{
return
platform_driver_probe
(
&
amimouse_driver
,
amimouse_probe
);
}
}
module_init
(
amimouse_init
);
module_init
(
amimouse_init
);
static
void
__exit
amimouse_exit
(
void
)
{
platform_driver_unregister
(
&
amimouse_driver
);
}
module_exit
(
amimouse_exit
);
module_exit
(
amimouse_exit
);
MODULE_ALIAS
(
"platform:amiga-mouse"
);
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