diff options
author | Ingo Molnar <mingo@kernel.org> | 2012-04-13 03:57:10 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-04-13 03:57:10 -0400 |
commit | a385ec4f11bdcf81af094c03e2444ee9b7fad2e5 (patch) | |
tree | a2c186cb828e3713c2ec48a4d7191166fb798b3d /drivers/input/serio | |
parent | 659c36fcda403013a01b85da07cf2d9711e6d6c7 (diff) | |
parent | 0034102808e0dbbf3a2394b82b1bb40b5778de9e (diff) |
Merge tag 'v3.4-rc2' into perf/core
Merge Linux 3.4-rc2: we were on v3.3, update the base.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'drivers/input/serio')
-rw-r--r-- | drivers/input/serio/ams_delta_serio.c | 56 | ||||
-rw-r--r-- | drivers/input/serio/hp_sdc.c | 1 | ||||
-rw-r--r-- | drivers/input/serio/maceps2.c | 1 | ||||
-rw-r--r-- | drivers/input/serio/rpckbd.c | 45 | ||||
-rw-r--r-- | drivers/input/serio/sa1111ps2.c | 60 |
5 files changed, 114 insertions, 49 deletions
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c index d4d08bd9205b..f5fbdf94de3b 100644 --- a/drivers/input/serio/ams_delta_serio.c +++ b/drivers/input/serio/ams_delta_serio.c | |||
@@ -92,8 +92,7 @@ static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id) | |||
92 | static int ams_delta_serio_open(struct serio *serio) | 92 | static int ams_delta_serio_open(struct serio *serio) |
93 | { | 93 | { |
94 | /* enable keyboard */ | 94 | /* enable keyboard */ |
95 | ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, | 95 | gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1); |
96 | AMD_DELTA_LATCH2_KEYBRD_PWR); | ||
97 | 96 | ||
98 | return 0; | 97 | return 0; |
99 | } | 98 | } |
@@ -101,9 +100,32 @@ static int ams_delta_serio_open(struct serio *serio) | |||
101 | static void ams_delta_serio_close(struct serio *serio) | 100 | static void ams_delta_serio_close(struct serio *serio) |
102 | { | 101 | { |
103 | /* disable keyboard */ | 102 | /* disable keyboard */ |
104 | ams_delta_latch2_write(AMD_DELTA_LATCH2_KEYBRD_PWR, 0); | 103 | gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0); |
105 | } | 104 | } |
106 | 105 | ||
106 | static const struct gpio ams_delta_gpios[] __initconst_or_module = { | ||
107 | { | ||
108 | .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA, | ||
109 | .flags = GPIOF_DIR_IN, | ||
110 | .label = "serio-data", | ||
111 | }, | ||
112 | { | ||
113 | .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK, | ||
114 | .flags = GPIOF_DIR_IN, | ||
115 | .label = "serio-clock", | ||
116 | }, | ||
117 | { | ||
118 | .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR, | ||
119 | .flags = GPIOF_OUT_INIT_LOW, | ||
120 | .label = "serio-power", | ||
121 | }, | ||
122 | { | ||
123 | .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT, | ||
124 | .flags = GPIOF_OUT_INIT_LOW, | ||
125 | .label = "serio-dataout", | ||
126 | }, | ||
127 | }; | ||
128 | |||
107 | static int __init ams_delta_serio_init(void) | 129 | static int __init ams_delta_serio_init(void) |
108 | { | 130 | { |
109 | int err; | 131 | int err; |
@@ -123,19 +145,12 @@ static int __init ams_delta_serio_init(void) | |||
123 | strlcpy(ams_delta_serio->phys, "GPIO/serio0", | 145 | strlcpy(ams_delta_serio->phys, "GPIO/serio0", |
124 | sizeof(ams_delta_serio->phys)); | 146 | sizeof(ams_delta_serio->phys)); |
125 | 147 | ||
126 | err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_DATA, "serio-data"); | 148 | err = gpio_request_array(ams_delta_gpios, |
149 | ARRAY_SIZE(ams_delta_gpios)); | ||
127 | if (err) { | 150 | if (err) { |
128 | pr_err("ams_delta_serio: Couldn't request gpio pin for data\n"); | 151 | pr_err("ams_delta_serio: Couldn't request gpio pins\n"); |
129 | goto serio; | 152 | goto serio; |
130 | } | 153 | } |
131 | gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_DATA); | ||
132 | |||
133 | err = gpio_request(AMS_DELTA_GPIO_PIN_KEYBRD_CLK, "serio-clock"); | ||
134 | if (err) { | ||
135 | pr_err("ams_delta_serio: couldn't request gpio pin for clock\n"); | ||
136 | goto gpio_data; | ||
137 | } | ||
138 | gpio_direction_input(AMS_DELTA_GPIO_PIN_KEYBRD_CLK); | ||
139 | 154 | ||
140 | err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), | 155 | err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), |
141 | ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING, | 156 | ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING, |
@@ -143,7 +158,7 @@ static int __init ams_delta_serio_init(void) | |||
143 | if (err < 0) { | 158 | if (err < 0) { |
144 | pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n", | 159 | pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n", |
145 | gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); | 160 | gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK)); |
146 | goto gpio_clk; | 161 | goto gpio; |
147 | } | 162 | } |
148 | /* | 163 | /* |
149 | * Since GPIO register handling for keyboard clock pin is performed | 164 | * Since GPIO register handling for keyboard clock pin is performed |
@@ -157,10 +172,9 @@ static int __init ams_delta_serio_init(void) | |||
157 | dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name); | 172 | dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name); |
158 | 173 | ||
159 | return 0; | 174 | return 0; |
160 | gpio_clk: | 175 | gpio: |
161 | gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK); | 176 | gpio_free_array(ams_delta_gpios, |
162 | gpio_data: | 177 | ARRAY_SIZE(ams_delta_gpios)); |
163 | gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA); | ||
164 | serio: | 178 | serio: |
165 | kfree(ams_delta_serio); | 179 | kfree(ams_delta_serio); |
166 | return err; | 180 | return err; |
@@ -170,8 +184,8 @@ module_init(ams_delta_serio_init); | |||
170 | static void __exit ams_delta_serio_exit(void) | 184 | static void __exit ams_delta_serio_exit(void) |
171 | { | 185 | { |
172 | serio_unregister_port(ams_delta_serio); | 186 | serio_unregister_port(ams_delta_serio); |
173 | free_irq(OMAP_GPIO_IRQ(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0); | 187 | free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0); |
174 | gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_CLK); | 188 | gpio_free_array(ams_delta_gpios, |
175 | gpio_free(AMS_DELTA_GPIO_PIN_KEYBRD_DATA); | 189 | ARRAY_SIZE(ams_delta_gpios)); |
176 | } | 190 | } |
177 | module_exit(ams_delta_serio_exit); | 191 | module_exit(ams_delta_serio_exit); |
diff --git a/drivers/input/serio/hp_sdc.c b/drivers/input/serio/hp_sdc.c index be3316073ae7..09a089996ded 100644 --- a/drivers/input/serio/hp_sdc.c +++ b/drivers/input/serio/hp_sdc.c | |||
@@ -71,7 +71,6 @@ | |||
71 | #include <linux/slab.h> | 71 | #include <linux/slab.h> |
72 | #include <linux/hil.h> | 72 | #include <linux/hil.h> |
73 | #include <asm/io.h> | 73 | #include <asm/io.h> |
74 | #include <asm/system.h> | ||
75 | 74 | ||
76 | /* Machine-specific abstraction */ | 75 | /* Machine-specific abstraction */ |
77 | 76 | ||
diff --git a/drivers/input/serio/maceps2.c b/drivers/input/serio/maceps2.c index 558200e96d0f..61da763b1209 100644 --- a/drivers/input/serio/maceps2.c +++ b/drivers/input/serio/maceps2.c | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <asm/irq.h> | 23 | #include <asm/irq.h> |
24 | #include <asm/system.h> | ||
25 | #include <asm/ip32/mace.h> | 24 | #include <asm/ip32/mace.h> |
26 | #include <asm/ip32/ip32_ints.h> | 25 | #include <asm/ip32/ip32_ints.h> |
27 | 26 | ||
diff --git a/drivers/input/serio/rpckbd.c b/drivers/input/serio/rpckbd.c index 8b44ddc8041c..2af5df6a8fba 100644 --- a/drivers/input/serio/rpckbd.c +++ b/drivers/input/serio/rpckbd.c | |||
@@ -36,16 +36,19 @@ | |||
36 | #include <linux/io.h> | 36 | #include <linux/io.h> |
37 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
38 | 38 | ||
39 | #include <asm/irq.h> | ||
40 | #include <mach/hardware.h> | 39 | #include <mach/hardware.h> |
41 | #include <asm/hardware/iomd.h> | 40 | #include <asm/hardware/iomd.h> |
42 | #include <asm/system.h> | ||
43 | 41 | ||
44 | MODULE_AUTHOR("Vojtech Pavlik, Russell King"); | 42 | MODULE_AUTHOR("Vojtech Pavlik, Russell King"); |
45 | MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver"); | 43 | MODULE_DESCRIPTION("Acorn RiscPC PS/2 keyboard controller driver"); |
46 | MODULE_LICENSE("GPL"); | 44 | MODULE_LICENSE("GPL"); |
47 | MODULE_ALIAS("platform:kart"); | 45 | MODULE_ALIAS("platform:kart"); |
48 | 46 | ||
47 | struct rpckbd_data { | ||
48 | int tx_irq; | ||
49 | int rx_irq; | ||
50 | }; | ||
51 | |||
49 | static int rpckbd_write(struct serio *port, unsigned char val) | 52 | static int rpckbd_write(struct serio *port, unsigned char val) |
50 | { | 53 | { |
51 | while (!(iomd_readb(IOMD_KCTRL) & (1 << 7))) | 54 | while (!(iomd_readb(IOMD_KCTRL) & (1 << 7))) |
@@ -78,19 +81,21 @@ static irqreturn_t rpckbd_tx(int irq, void *dev_id) | |||
78 | 81 | ||
79 | static int rpckbd_open(struct serio *port) | 82 | static int rpckbd_open(struct serio *port) |
80 | { | 83 | { |
84 | struct rpckbd_data *rpckbd = port->port_data; | ||
85 | |||
81 | /* Reset the keyboard state machine. */ | 86 | /* Reset the keyboard state machine. */ |
82 | iomd_writeb(0, IOMD_KCTRL); | 87 | iomd_writeb(0, IOMD_KCTRL); |
83 | iomd_writeb(8, IOMD_KCTRL); | 88 | iomd_writeb(8, IOMD_KCTRL); |
84 | iomd_readb(IOMD_KARTRX); | 89 | iomd_readb(IOMD_KARTRX); |
85 | 90 | ||
86 | if (request_irq(IRQ_KEYBOARDRX, rpckbd_rx, 0, "rpckbd", port) != 0) { | 91 | if (request_irq(rpckbd->rx_irq, rpckbd_rx, 0, "rpckbd", port) != 0) { |
87 | printk(KERN_ERR "rpckbd.c: Could not allocate keyboard receive IRQ\n"); | 92 | printk(KERN_ERR "rpckbd.c: Could not allocate keyboard receive IRQ\n"); |
88 | return -EBUSY; | 93 | return -EBUSY; |
89 | } | 94 | } |
90 | 95 | ||
91 | if (request_irq(IRQ_KEYBOARDTX, rpckbd_tx, 0, "rpckbd", port) != 0) { | 96 | if (request_irq(rpckbd->tx_irq, rpckbd_tx, 0, "rpckbd", port) != 0) { |
92 | printk(KERN_ERR "rpckbd.c: Could not allocate keyboard transmit IRQ\n"); | 97 | printk(KERN_ERR "rpckbd.c: Could not allocate keyboard transmit IRQ\n"); |
93 | free_irq(IRQ_KEYBOARDRX, port); | 98 | free_irq(rpckbd->rx_irq, port); |
94 | return -EBUSY; | 99 | return -EBUSY; |
95 | } | 100 | } |
96 | 101 | ||
@@ -99,8 +104,10 @@ static int rpckbd_open(struct serio *port) | |||
99 | 104 | ||
100 | static void rpckbd_close(struct serio *port) | 105 | static void rpckbd_close(struct serio *port) |
101 | { | 106 | { |
102 | free_irq(IRQ_KEYBOARDRX, port); | 107 | struct rpckbd_data *rpckbd = port->port_data; |
103 | free_irq(IRQ_KEYBOARDTX, port); | 108 | |
109 | free_irq(rpckbd->rx_irq, port); | ||
110 | free_irq(rpckbd->tx_irq, port); | ||
104 | } | 111 | } |
105 | 112 | ||
106 | /* | 113 | /* |
@@ -109,17 +116,35 @@ static void rpckbd_close(struct serio *port) | |||
109 | */ | 116 | */ |
110 | static int __devinit rpckbd_probe(struct platform_device *dev) | 117 | static int __devinit rpckbd_probe(struct platform_device *dev) |
111 | { | 118 | { |
119 | struct rpckbd_data *rpckbd; | ||
112 | struct serio *serio; | 120 | struct serio *serio; |
121 | int tx_irq, rx_irq; | ||
122 | |||
123 | rx_irq = platform_get_irq(dev, 0); | ||
124 | if (rx_irq <= 0) | ||
125 | return rx_irq < 0 ? rx_irq : -ENXIO; | ||
126 | |||
127 | tx_irq = platform_get_irq(dev, 1); | ||
128 | if (tx_irq <= 0) | ||
129 | return tx_irq < 0 ? tx_irq : -ENXIO; | ||
113 | 130 | ||
114 | serio = kzalloc(sizeof(struct serio), GFP_KERNEL); | 131 | serio = kzalloc(sizeof(struct serio), GFP_KERNEL); |
115 | if (!serio) | 132 | rpckbd = kzalloc(sizeof(*rpckbd), GFP_KERNEL); |
133 | if (!serio || !rpckbd) { | ||
134 | kfree(rpckbd); | ||
135 | kfree(serio); | ||
116 | return -ENOMEM; | 136 | return -ENOMEM; |
137 | } | ||
138 | |||
139 | rpckbd->rx_irq = rx_irq; | ||
140 | rpckbd->tx_irq = tx_irq; | ||
117 | 141 | ||
118 | serio->id.type = SERIO_8042; | 142 | serio->id.type = SERIO_8042; |
119 | serio->write = rpckbd_write; | 143 | serio->write = rpckbd_write; |
120 | serio->open = rpckbd_open; | 144 | serio->open = rpckbd_open; |
121 | serio->close = rpckbd_close; | 145 | serio->close = rpckbd_close; |
122 | serio->dev.parent = &dev->dev; | 146 | serio->dev.parent = &dev->dev; |
147 | serio->port_data = rpckbd; | ||
123 | strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); | 148 | strlcpy(serio->name, "RiscPC PS/2 kbd port", sizeof(serio->name)); |
124 | strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); | 149 | strlcpy(serio->phys, "rpckbd/serio0", sizeof(serio->phys)); |
125 | 150 | ||
@@ -131,7 +156,11 @@ static int __devinit rpckbd_probe(struct platform_device *dev) | |||
131 | static int __devexit rpckbd_remove(struct platform_device *dev) | 156 | static int __devexit rpckbd_remove(struct platform_device *dev) |
132 | { | 157 | { |
133 | struct serio *serio = platform_get_drvdata(dev); | 158 | struct serio *serio = platform_get_drvdata(dev); |
159 | struct rpckbd_data *rpckbd = serio->port_data; | ||
160 | |||
134 | serio_unregister_port(serio); | 161 | serio_unregister_port(serio); |
162 | kfree(rpckbd); | ||
163 | |||
135 | return 0; | 164 | return 0; |
136 | } | 165 | } |
137 | 166 | ||
diff --git a/drivers/input/serio/sa1111ps2.c b/drivers/input/serio/sa1111ps2.c index 44fc8b4bcd81..389766707534 100644 --- a/drivers/input/serio/sa1111ps2.c +++ b/drivers/input/serio/sa1111ps2.c | |||
@@ -20,10 +20,29 @@ | |||
20 | #include <linux/spinlock.h> | 20 | #include <linux/spinlock.h> |
21 | 21 | ||
22 | #include <asm/io.h> | 22 | #include <asm/io.h> |
23 | #include <asm/system.h> | ||
24 | 23 | ||
25 | #include <asm/hardware/sa1111.h> | 24 | #include <asm/hardware/sa1111.h> |
26 | 25 | ||
26 | #define PS2CR 0x0000 | ||
27 | #define PS2STAT 0x0004 | ||
28 | #define PS2DATA 0x0008 | ||
29 | #define PS2CLKDIV 0x000c | ||
30 | #define PS2PRECNT 0x0010 | ||
31 | |||
32 | #define PS2CR_ENA 0x08 | ||
33 | #define PS2CR_FKD 0x02 | ||
34 | #define PS2CR_FKC 0x01 | ||
35 | |||
36 | #define PS2STAT_STP 0x0100 | ||
37 | #define PS2STAT_TXE 0x0080 | ||
38 | #define PS2STAT_TXB 0x0040 | ||
39 | #define PS2STAT_RXF 0x0020 | ||
40 | #define PS2STAT_RXB 0x0010 | ||
41 | #define PS2STAT_ENA 0x0008 | ||
42 | #define PS2STAT_RXP 0x0004 | ||
43 | #define PS2STAT_KBD 0x0002 | ||
44 | #define PS2STAT_KBC 0x0001 | ||
45 | |||
27 | struct ps2if { | 46 | struct ps2if { |
28 | struct serio *io; | 47 | struct serio *io; |
29 | struct sa1111_dev *dev; | 48 | struct sa1111_dev *dev; |
@@ -45,22 +64,22 @@ static irqreturn_t ps2_rxint(int irq, void *dev_id) | |||
45 | struct ps2if *ps2if = dev_id; | 64 | struct ps2if *ps2if = dev_id; |
46 | unsigned int scancode, flag, status; | 65 | unsigned int scancode, flag, status; |
47 | 66 | ||
48 | status = sa1111_readl(ps2if->base + SA1111_PS2STAT); | 67 | status = sa1111_readl(ps2if->base + PS2STAT); |
49 | while (status & PS2STAT_RXF) { | 68 | while (status & PS2STAT_RXF) { |
50 | if (status & PS2STAT_STP) | 69 | if (status & PS2STAT_STP) |
51 | sa1111_writel(PS2STAT_STP, ps2if->base + SA1111_PS2STAT); | 70 | sa1111_writel(PS2STAT_STP, ps2if->base + PS2STAT); |
52 | 71 | ||
53 | flag = (status & PS2STAT_STP ? SERIO_FRAME : 0) | | 72 | flag = (status & PS2STAT_STP ? SERIO_FRAME : 0) | |
54 | (status & PS2STAT_RXP ? 0 : SERIO_PARITY); | 73 | (status & PS2STAT_RXP ? 0 : SERIO_PARITY); |
55 | 74 | ||
56 | scancode = sa1111_readl(ps2if->base + SA1111_PS2DATA) & 0xff; | 75 | scancode = sa1111_readl(ps2if->base + PS2DATA) & 0xff; |
57 | 76 | ||
58 | if (hweight8(scancode) & 1) | 77 | if (hweight8(scancode) & 1) |
59 | flag ^= SERIO_PARITY; | 78 | flag ^= SERIO_PARITY; |
60 | 79 | ||
61 | serio_interrupt(ps2if->io, scancode, flag); | 80 | serio_interrupt(ps2if->io, scancode, flag); |
62 | 81 | ||
63 | status = sa1111_readl(ps2if->base + SA1111_PS2STAT); | 82 | status = sa1111_readl(ps2if->base + PS2STAT); |
64 | } | 83 | } |
65 | 84 | ||
66 | return IRQ_HANDLED; | 85 | return IRQ_HANDLED; |
@@ -75,12 +94,12 @@ static irqreturn_t ps2_txint(int irq, void *dev_id) | |||
75 | unsigned int status; | 94 | unsigned int status; |
76 | 95 | ||
77 | spin_lock(&ps2if->lock); | 96 | spin_lock(&ps2if->lock); |
78 | status = sa1111_readl(ps2if->base + SA1111_PS2STAT); | 97 | status = sa1111_readl(ps2if->base + PS2STAT); |
79 | if (ps2if->head == ps2if->tail) { | 98 | if (ps2if->head == ps2if->tail) { |
80 | disable_irq_nosync(irq); | 99 | disable_irq_nosync(irq); |
81 | /* done */ | 100 | /* done */ |
82 | } else if (status & PS2STAT_TXE) { | 101 | } else if (status & PS2STAT_TXE) { |
83 | sa1111_writel(ps2if->buf[ps2if->tail], ps2if->base + SA1111_PS2DATA); | 102 | sa1111_writel(ps2if->buf[ps2if->tail], ps2if->base + PS2DATA); |
84 | ps2if->tail = (ps2if->tail + 1) & (sizeof(ps2if->buf) - 1); | 103 | ps2if->tail = (ps2if->tail + 1) & (sizeof(ps2if->buf) - 1); |
85 | } | 104 | } |
86 | spin_unlock(&ps2if->lock); | 105 | spin_unlock(&ps2if->lock); |
@@ -103,8 +122,8 @@ static int ps2_write(struct serio *io, unsigned char val) | |||
103 | /* | 122 | /* |
104 | * If the TX register is empty, we can go straight out. | 123 | * If the TX register is empty, we can go straight out. |
105 | */ | 124 | */ |
106 | if (sa1111_readl(ps2if->base + SA1111_PS2STAT) & PS2STAT_TXE) { | 125 | if (sa1111_readl(ps2if->base + PS2STAT) & PS2STAT_TXE) { |
107 | sa1111_writel(val, ps2if->base + SA1111_PS2DATA); | 126 | sa1111_writel(val, ps2if->base + PS2DATA); |
108 | } else { | 127 | } else { |
109 | if (ps2if->head == ps2if->tail) | 128 | if (ps2if->head == ps2if->tail) |
110 | enable_irq(ps2if->dev->irq[1]); | 129 | enable_irq(ps2if->dev->irq[1]); |
@@ -124,13 +143,16 @@ static int ps2_open(struct serio *io) | |||
124 | struct ps2if *ps2if = io->port_data; | 143 | struct ps2if *ps2if = io->port_data; |
125 | int ret; | 144 | int ret; |
126 | 145 | ||
127 | sa1111_enable_device(ps2if->dev); | 146 | ret = sa1111_enable_device(ps2if->dev); |
147 | if (ret) | ||
148 | return ret; | ||
128 | 149 | ||
129 | ret = request_irq(ps2if->dev->irq[0], ps2_rxint, 0, | 150 | ret = request_irq(ps2if->dev->irq[0], ps2_rxint, 0, |
130 | SA1111_DRIVER_NAME(ps2if->dev), ps2if); | 151 | SA1111_DRIVER_NAME(ps2if->dev), ps2if); |
131 | if (ret) { | 152 | if (ret) { |
132 | printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n", | 153 | printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n", |
133 | ps2if->dev->irq[0], ret); | 154 | ps2if->dev->irq[0], ret); |
155 | sa1111_disable_device(ps2if->dev); | ||
134 | return ret; | 156 | return ret; |
135 | } | 157 | } |
136 | 158 | ||
@@ -140,6 +162,7 @@ static int ps2_open(struct serio *io) | |||
140 | printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n", | 162 | printk(KERN_ERR "sa1111ps2: could not allocate IRQ%d: %d\n", |
141 | ps2if->dev->irq[1], ret); | 163 | ps2if->dev->irq[1], ret); |
142 | free_irq(ps2if->dev->irq[0], ps2if); | 164 | free_irq(ps2if->dev->irq[0], ps2if); |
165 | sa1111_disable_device(ps2if->dev); | ||
143 | return ret; | 166 | return ret; |
144 | } | 167 | } |
145 | 168 | ||
@@ -147,7 +170,7 @@ static int ps2_open(struct serio *io) | |||
147 | 170 | ||
148 | enable_irq_wake(ps2if->dev->irq[0]); | 171 | enable_irq_wake(ps2if->dev->irq[0]); |
149 | 172 | ||
150 | sa1111_writel(PS2CR_ENA, ps2if->base + SA1111_PS2CR); | 173 | sa1111_writel(PS2CR_ENA, ps2if->base + PS2CR); |
151 | return 0; | 174 | return 0; |
152 | } | 175 | } |
153 | 176 | ||
@@ -155,7 +178,7 @@ static void ps2_close(struct serio *io) | |||
155 | { | 178 | { |
156 | struct ps2if *ps2if = io->port_data; | 179 | struct ps2if *ps2if = io->port_data; |
157 | 180 | ||
158 | sa1111_writel(0, ps2if->base + SA1111_PS2CR); | 181 | sa1111_writel(0, ps2if->base + PS2CR); |
159 | 182 | ||
160 | disable_irq_wake(ps2if->dev->irq[0]); | 183 | disable_irq_wake(ps2if->dev->irq[0]); |
161 | 184 | ||
@@ -175,7 +198,7 @@ static void __devinit ps2_clear_input(struct ps2if *ps2if) | |||
175 | int maxread = 100; | 198 | int maxread = 100; |
176 | 199 | ||
177 | while (maxread--) { | 200 | while (maxread--) { |
178 | if ((sa1111_readl(ps2if->base + SA1111_PS2DATA) & 0xff) == 0xff) | 201 | if ((sa1111_readl(ps2if->base + PS2DATA) & 0xff) == 0xff) |
179 | break; | 202 | break; |
180 | } | 203 | } |
181 | } | 204 | } |
@@ -185,11 +208,11 @@ static unsigned int __devinit ps2_test_one(struct ps2if *ps2if, | |||
185 | { | 208 | { |
186 | unsigned int val; | 209 | unsigned int val; |
187 | 210 | ||
188 | sa1111_writel(PS2CR_ENA | mask, ps2if->base + SA1111_PS2CR); | 211 | sa1111_writel(PS2CR_ENA | mask, ps2if->base + PS2CR); |
189 | 212 | ||
190 | udelay(2); | 213 | udelay(2); |
191 | 214 | ||
192 | val = sa1111_readl(ps2if->base + SA1111_PS2STAT); | 215 | val = sa1111_readl(ps2if->base + PS2STAT); |
193 | return val & (PS2STAT_KBC | PS2STAT_KBD); | 216 | return val & (PS2STAT_KBC | PS2STAT_KBD); |
194 | } | 217 | } |
195 | 218 | ||
@@ -220,7 +243,7 @@ static int __devinit ps2_test(struct ps2if *ps2if) | |||
220 | ret = -ENODEV; | 243 | ret = -ENODEV; |
221 | } | 244 | } |
222 | 245 | ||
223 | sa1111_writel(0, ps2if->base + SA1111_PS2CR); | 246 | sa1111_writel(0, ps2if->base + PS2CR); |
224 | 247 | ||
225 | return ret; | 248 | return ret; |
226 | } | 249 | } |
@@ -274,8 +297,8 @@ static int __devinit ps2_probe(struct sa1111_dev *dev) | |||
274 | sa1111_enable_device(ps2if->dev); | 297 | sa1111_enable_device(ps2if->dev); |
275 | 298 | ||
276 | /* Incoming clock is 8MHz */ | 299 | /* Incoming clock is 8MHz */ |
277 | sa1111_writel(0, ps2if->base + SA1111_PS2CLKDIV); | 300 | sa1111_writel(0, ps2if->base + PS2CLKDIV); |
278 | sa1111_writel(127, ps2if->base + SA1111_PS2PRECNT); | 301 | sa1111_writel(127, ps2if->base + PS2PRECNT); |
279 | 302 | ||
280 | /* | 303 | /* |
281 | * Flush any pending input. | 304 | * Flush any pending input. |
@@ -330,6 +353,7 @@ static int __devexit ps2_remove(struct sa1111_dev *dev) | |||
330 | static struct sa1111_driver ps2_driver = { | 353 | static struct sa1111_driver ps2_driver = { |
331 | .drv = { | 354 | .drv = { |
332 | .name = "sa1111-ps2", | 355 | .name = "sa1111-ps2", |
356 | .owner = THIS_MODULE, | ||
333 | }, | 357 | }, |
334 | .devid = SA1111_DEVID_PS2, | 358 | .devid = SA1111_DEVID_PS2, |
335 | .probe = ps2_probe, | 359 | .probe = ps2_probe, |