diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-04-02 11:22:51 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-04-02 11:22:51 -0400 |
commit | 5550fbaeb3cc88fe2982e9b5351073173d733f30 (patch) | |
tree | 7a6c74369c0faaa6acc144b6731873997ffb58e1 /drivers/input/keyboard | |
parent | 45d09e1e097ea5fc0bcb98a6226d90b412e6923a (diff) |
Input: tosakbd - fix suspend
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/keyboard')
-rw-r--r-- | drivers/input/keyboard/tosakbd.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/input/keyboard/tosakbd.c b/drivers/input/keyboard/tosakbd.c index 3884d1e3f070..a247006757de 100644 --- a/drivers/input/keyboard/tosakbd.c +++ b/drivers/input/keyboard/tosakbd.c | |||
@@ -52,7 +52,7 @@ KEY_X, KEY_F, KEY_SPACE, KEY_APOSTROPHE, TOSA_KEY_MAIL, KEY_LEFT, KEY_DOWN, KEY_ | |||
52 | struct tosakbd { | 52 | struct tosakbd { |
53 | unsigned int keycode[ARRAY_SIZE(tosakbd_keycode)]; | 53 | unsigned int keycode[ARRAY_SIZE(tosakbd_keycode)]; |
54 | struct input_dev *input; | 54 | struct input_dev *input; |
55 | 55 | int suspended; | |
56 | spinlock_t lock; /* protect kbd scanning */ | 56 | spinlock_t lock; /* protect kbd scanning */ |
57 | struct timer_list timer; | 57 | struct timer_list timer; |
58 | }; | 58 | }; |
@@ -133,6 +133,9 @@ static void tosakbd_scankeyboard(struct platform_device *dev) | |||
133 | 133 | ||
134 | spin_lock_irqsave(&tosakbd->lock, flags); | 134 | spin_lock_irqsave(&tosakbd->lock, flags); |
135 | 135 | ||
136 | if (tosakbd->suspended) | ||
137 | goto out; | ||
138 | |||
136 | for (col = 0; col < TOSA_KEY_STROBE_NUM; col++) { | 139 | for (col = 0; col < TOSA_KEY_STROBE_NUM; col++) { |
137 | /* | 140 | /* |
138 | * Discharge the output driver capacitatance | 141 | * Discharge the output driver capacitatance |
@@ -174,6 +177,7 @@ static void tosakbd_scankeyboard(struct platform_device *dev) | |||
174 | if (num_pressed) | 177 | if (num_pressed) |
175 | mod_timer(&tosakbd->timer, jiffies + SCAN_INTERVAL); | 178 | mod_timer(&tosakbd->timer, jiffies + SCAN_INTERVAL); |
176 | 179 | ||
180 | out: | ||
177 | spin_unlock_irqrestore(&tosakbd->lock, flags); | 181 | spin_unlock_irqrestore(&tosakbd->lock, flags); |
178 | } | 182 | } |
179 | 183 | ||
@@ -200,6 +204,7 @@ static irqreturn_t tosakbd_interrupt(int irq, void *__dev) | |||
200 | static void tosakbd_timer_callback(unsigned long __dev) | 204 | static void tosakbd_timer_callback(unsigned long __dev) |
201 | { | 205 | { |
202 | struct platform_device *dev = (struct platform_device *)__dev; | 206 | struct platform_device *dev = (struct platform_device *)__dev; |
207 | |||
203 | tosakbd_scankeyboard(dev); | 208 | tosakbd_scankeyboard(dev); |
204 | } | 209 | } |
205 | 210 | ||
@@ -207,6 +212,13 @@ static void tosakbd_timer_callback(unsigned long __dev) | |||
207 | static int tosakbd_suspend(struct platform_device *dev, pm_message_t state) | 212 | static int tosakbd_suspend(struct platform_device *dev, pm_message_t state) |
208 | { | 213 | { |
209 | struct tosakbd *tosakbd = platform_get_drvdata(dev); | 214 | struct tosakbd *tosakbd = platform_get_drvdata(dev); |
215 | unsigned long flags; | ||
216 | |||
217 | spin_lock_irqsave(&tosakbd->lock, flags); | ||
218 | PGSR1 = (PGSR1 & ~TOSA_GPIO_LOW_STROBE_BIT); | ||
219 | PGSR2 = (PGSR2 & ~TOSA_GPIO_HIGH_STROBE_BIT); | ||
220 | tosakbd->suspended = 1; | ||
221 | spin_unlock_irqrestore(&tosakbd->lock, flags); | ||
210 | 222 | ||
211 | del_timer_sync(&tosakbd->timer); | 223 | del_timer_sync(&tosakbd->timer); |
212 | 224 | ||
@@ -215,6 +227,9 @@ static int tosakbd_suspend(struct platform_device *dev, pm_message_t state) | |||
215 | 227 | ||
216 | static int tosakbd_resume(struct platform_device *dev) | 228 | static int tosakbd_resume(struct platform_device *dev) |
217 | { | 229 | { |
230 | struct tosakbd *tosakbd = platform_get_drvdata(dev); | ||
231 | |||
232 | tosakbd->suspended = 0; | ||
218 | tosakbd_scankeyboard(dev); | 233 | tosakbd_scankeyboard(dev); |
219 | 234 | ||
220 | return 0; | 235 | return 0; |
@@ -365,8 +380,8 @@ fail: | |||
365 | return error; | 380 | return error; |
366 | } | 381 | } |
367 | 382 | ||
368 | static int __devexit tosakbd_remove(struct platform_device *dev) { | 383 | static int __devexit tosakbd_remove(struct platform_device *dev) |
369 | 384 | { | |
370 | int i; | 385 | int i; |
371 | struct tosakbd *tosakbd = platform_get_drvdata(dev); | 386 | struct tosakbd *tosakbd = platform_get_drvdata(dev); |
372 | 387 | ||