Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Driver for keys on GPIO lines capable of generating interrupts. |
| 3 | * |
| 4 | * Copyright 2005 Phil Blundell |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/module.h> |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 12 | |
| 13 | #include <linux/init.h> |
| 14 | #include <linux/fs.h> |
| 15 | #include <linux/interrupt.h> |
| 16 | #include <linux/irq.h> |
| 17 | #include <linux/sched.h> |
| 18 | #include <linux/pm.h> |
| 19 | #include <linux/sysctl.h> |
| 20 | #include <linux/proc_fs.h> |
| 21 | #include <linux/delay.h> |
| 22 | #include <linux/platform_device.h> |
| 23 | #include <linux/input.h> |
David Brownell | 49015be | 2007-03-05 00:30:22 -0800 | [diff] [blame] | 24 | #include <linux/gpio_keys.h> |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 25 | #include <linux/workqueue.h> |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 26 | |
Philipp Zabel | 0d98f6b | 2007-02-18 01:40:46 -0500 | [diff] [blame] | 27 | #include <asm/gpio.h> |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 28 | |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 29 | struct gpio_button_data { |
| 30 | struct gpio_keys_button *button; |
| 31 | struct input_dev *input; |
Jani Nikula | ca865a7 | 2009-06-28 22:38:44 -0700 | [diff] [blame] | 32 | struct timer_list timer; |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 33 | struct work_struct work; |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 34 | }; |
| 35 | |
| 36 | struct gpio_keys_drvdata { |
| 37 | struct input_dev *input; |
| 38 | struct gpio_button_data data[0]; |
| 39 | }; |
| 40 | |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 41 | static void gpio_keys_report_event(struct work_struct *work) |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 42 | { |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 43 | struct gpio_button_data *bdata = |
| 44 | container_of(work, struct gpio_button_data, work); |
Uwe Kleine-König | ce25d7e | 2008-08-08 12:14:36 -0400 | [diff] [blame] | 45 | struct gpio_keys_button *button = bdata->button; |
| 46 | struct input_dev *input = bdata->input; |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 47 | unsigned int type = button->type ?: EV_KEY; |
| 48 | int state = (gpio_get_value(button->gpio) ? 1 : 0) ^ button->active_low; |
| 49 | |
| 50 | input_event(input, type, button->code, !!state); |
| 51 | input_sync(input); |
| 52 | } |
| 53 | |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 54 | static void gpio_keys_timer(unsigned long _data) |
Jani Nikula | ca865a7 | 2009-06-28 22:38:44 -0700 | [diff] [blame] | 55 | { |
| 56 | struct gpio_button_data *data = (struct gpio_button_data *)_data; |
| 57 | |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 58 | schedule_work(&data->work); |
Jani Nikula | ca865a7 | 2009-06-28 22:38:44 -0700 | [diff] [blame] | 59 | } |
| 60 | |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 61 | static irqreturn_t gpio_keys_isr(int irq, void *dev_id) |
| 62 | { |
Uwe Kleine-König | 57ffe9d | 2008-08-08 12:14:34 -0400 | [diff] [blame] | 63 | struct gpio_button_data *bdata = dev_id; |
| 64 | struct gpio_keys_button *button = bdata->button; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 65 | |
Uwe Kleine-König | 57ffe9d | 2008-08-08 12:14:34 -0400 | [diff] [blame] | 66 | BUG_ON(irq != gpio_to_irq(button->gpio)); |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 67 | |
Jani Nikula | ca865a7 | 2009-06-28 22:38:44 -0700 | [diff] [blame] | 68 | if (button->debounce_interval) |
| 69 | mod_timer(&bdata->timer, |
| 70 | jiffies + msecs_to_jiffies(button->debounce_interval)); |
| 71 | else |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 72 | schedule_work(&bdata->work); |
Roman Moravcik | 84767d0 | 2007-05-01 00:39:13 -0400 | [diff] [blame] | 73 | |
Uwe Kleine-König | 57ffe9d | 2008-08-08 12:14:34 -0400 | [diff] [blame] | 74 | return IRQ_HANDLED; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 75 | } |
| 76 | |
| 77 | static int __devinit gpio_keys_probe(struct platform_device *pdev) |
| 78 | { |
| 79 | struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 80 | struct gpio_keys_drvdata *ddata; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 81 | struct input_dev *input; |
| 82 | int i, error; |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 83 | int wakeup = 0; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 84 | |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 85 | ddata = kzalloc(sizeof(struct gpio_keys_drvdata) + |
| 86 | pdata->nbuttons * sizeof(struct gpio_button_data), |
| 87 | GFP_KERNEL); |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 88 | input = input_allocate_device(); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 89 | if (!ddata || !input) { |
| 90 | error = -ENOMEM; |
| 91 | goto fail1; |
| 92 | } |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 93 | |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 94 | platform_set_drvdata(pdev, ddata); |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 95 | |
| 96 | input->name = pdev->name; |
| 97 | input->phys = "gpio-keys/input0"; |
Dmitry Torokhov | 469ba4d | 2007-04-12 01:34:58 -0400 | [diff] [blame] | 98 | input->dev.parent = &pdev->dev; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 99 | |
| 100 | input->id.bustype = BUS_HOST; |
| 101 | input->id.vendor = 0x0001; |
| 102 | input->id.product = 0x0001; |
| 103 | input->id.version = 0x0100; |
| 104 | |
Dominic Curran | b67b4b1 | 2008-10-27 22:30:53 -0400 | [diff] [blame] | 105 | /* Enable auto repeat feature of Linux input subsystem */ |
| 106 | if (pdata->rep) |
| 107 | __set_bit(EV_REP, input->evbit); |
| 108 | |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 109 | ddata->input = input; |
| 110 | |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 111 | for (i = 0; i < pdata->nbuttons; i++) { |
Roman Moravcik | 84767d0 | 2007-05-01 00:39:13 -0400 | [diff] [blame] | 112 | struct gpio_keys_button *button = &pdata->buttons[i]; |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 113 | struct gpio_button_data *bdata = &ddata->data[i]; |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 114 | int irq; |
Roman Moravcik | 84767d0 | 2007-05-01 00:39:13 -0400 | [diff] [blame] | 115 | unsigned int type = button->type ?: EV_KEY; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 116 | |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 117 | bdata->input = input; |
Uwe Kleine-König | 74dd439 | 2008-07-30 10:33:43 -0400 | [diff] [blame] | 118 | bdata->button = button; |
Jani Nikula | ca865a7 | 2009-06-28 22:38:44 -0700 | [diff] [blame] | 119 | setup_timer(&bdata->timer, |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 120 | gpio_keys_timer, (unsigned long)bdata); |
| 121 | INIT_WORK(&bdata->work, gpio_keys_report_event); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 122 | |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 123 | error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); |
| 124 | if (error < 0) { |
| 125 | pr_err("gpio-keys: failed to request GPIO %d," |
| 126 | " error %d\n", button->gpio, error); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 127 | goto fail2; |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 128 | } |
| 129 | |
| 130 | error = gpio_direction_input(button->gpio); |
| 131 | if (error < 0) { |
| 132 | pr_err("gpio-keys: failed to configure input" |
| 133 | " direction for GPIO %d, error %d\n", |
| 134 | button->gpio, error); |
| 135 | gpio_free(button->gpio); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 136 | goto fail2; |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | irq = gpio_to_irq(button->gpio); |
Anti Sullin | 006df30 | 2007-09-26 00:01:03 -0400 | [diff] [blame] | 140 | if (irq < 0) { |
| 141 | error = irq; |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 142 | pr_err("gpio-keys: Unable to get irq number" |
| 143 | " for GPIO %d, error %d\n", |
Anti Sullin | 006df30 | 2007-09-26 00:01:03 -0400 | [diff] [blame] | 144 | button->gpio, error); |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 145 | gpio_free(button->gpio); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 146 | goto fail2; |
Anti Sullin | 006df30 | 2007-09-26 00:01:03 -0400 | [diff] [blame] | 147 | } |
| 148 | |
| 149 | error = request_irq(irq, gpio_keys_isr, |
Dmitry Eremin-Solenikov | 558a5e2 | 2009-11-02 22:04:18 -0800 | [diff] [blame] | 150 | IRQF_SHARED | |
Dmitry Torokhov | 64e8563 | 2009-04-18 18:45:17 -0700 | [diff] [blame] | 151 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, |
Anti Sullin | 006df30 | 2007-09-26 00:01:03 -0400 | [diff] [blame] | 152 | button->desc ? button->desc : "gpio_keys", |
Uwe Kleine-König | 57ffe9d | 2008-08-08 12:14:34 -0400 | [diff] [blame] | 153 | bdata); |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 154 | if (error) { |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 155 | pr_err("gpio-keys: Unable to claim irq %d; error %d\n", |
Philipp Zabel | 0d98f6b | 2007-02-18 01:40:46 -0500 | [diff] [blame] | 156 | irq, error); |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 157 | gpio_free(button->gpio); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 158 | goto fail2; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 159 | } |
Roman Moravcik | 84767d0 | 2007-05-01 00:39:13 -0400 | [diff] [blame] | 160 | |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 161 | if (button->wakeup) |
| 162 | wakeup = 1; |
| 163 | |
Roman Moravcik | 84767d0 | 2007-05-01 00:39:13 -0400 | [diff] [blame] | 164 | input_set_capability(input, type, button->code); |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 165 | } |
| 166 | |
| 167 | error = input_register_device(input); |
| 168 | if (error) { |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 169 | pr_err("gpio-keys: Unable to register input device, " |
Anti Sullin | 006df30 | 2007-09-26 00:01:03 -0400 | [diff] [blame] | 170 | "error: %d\n", error); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 171 | goto fail2; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 172 | } |
| 173 | |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 174 | device_init_wakeup(&pdev->dev, wakeup); |
| 175 | |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 176 | return 0; |
| 177 | |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 178 | fail2: |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 179 | while (--i >= 0) { |
Uwe Kleine-König | 57ffe9d | 2008-08-08 12:14:34 -0400 | [diff] [blame] | 180 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); |
Jani Nikula | ca865a7 | 2009-06-28 22:38:44 -0700 | [diff] [blame] | 181 | if (pdata->buttons[i].debounce_interval) |
| 182 | del_timer_sync(&ddata->data[i].timer); |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 183 | cancel_work_sync(&ddata->data[i].work); |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 184 | gpio_free(pdata->buttons[i].gpio); |
| 185 | } |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 186 | |
Anti Sullin | 006df30 | 2007-09-26 00:01:03 -0400 | [diff] [blame] | 187 | platform_set_drvdata(pdev, NULL); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 188 | fail1: |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 189 | input_free_device(input); |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 190 | kfree(ddata); |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 191 | |
| 192 | return error; |
| 193 | } |
| 194 | |
| 195 | static int __devexit gpio_keys_remove(struct platform_device *pdev) |
| 196 | { |
| 197 | struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; |
Dmitry Baryshkov | a33466e | 2008-05-07 16:30:15 -0400 | [diff] [blame] | 198 | struct gpio_keys_drvdata *ddata = platform_get_drvdata(pdev); |
| 199 | struct input_dev *input = ddata->input; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 200 | int i; |
| 201 | |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 202 | device_init_wakeup(&pdev->dev, 0); |
| 203 | |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 204 | for (i = 0; i < pdata->nbuttons; i++) { |
Philipp Zabel | 0d98f6b | 2007-02-18 01:40:46 -0500 | [diff] [blame] | 205 | int irq = gpio_to_irq(pdata->buttons[i].gpio); |
Uwe Kleine-König | 57ffe9d | 2008-08-08 12:14:34 -0400 | [diff] [blame] | 206 | free_irq(irq, &ddata->data[i]); |
Jani Nikula | ca865a7 | 2009-06-28 22:38:44 -0700 | [diff] [blame] | 207 | if (pdata->buttons[i].debounce_interval) |
| 208 | del_timer_sync(&ddata->data[i].timer); |
Jani Nikula | da0d03f | 2009-06-28 22:38:56 -0700 | [diff] [blame] | 209 | cancel_work_sync(&ddata->data[i].work); |
Herbert Valerio Riedel | 6a2e391 | 2007-11-21 14:42:33 -0500 | [diff] [blame] | 210 | gpio_free(pdata->buttons[i].gpio); |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 211 | } |
| 212 | |
| 213 | input_unregister_device(input); |
| 214 | |
| 215 | return 0; |
| 216 | } |
| 217 | |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 218 | |
| 219 | #ifdef CONFIG_PM |
Mike Rapoport | ae78e0e | 2009-07-22 23:02:54 -0700 | [diff] [blame] | 220 | static int gpio_keys_suspend(struct device *dev) |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 221 | { |
Mike Rapoport | ae78e0e | 2009-07-22 23:02:54 -0700 | [diff] [blame] | 222 | struct platform_device *pdev = to_platform_device(dev); |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 223 | struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; |
| 224 | int i; |
| 225 | |
| 226 | if (device_may_wakeup(&pdev->dev)) { |
| 227 | for (i = 0; i < pdata->nbuttons; i++) { |
| 228 | struct gpio_keys_button *button = &pdata->buttons[i]; |
| 229 | if (button->wakeup) { |
| 230 | int irq = gpio_to_irq(button->gpio); |
| 231 | enable_irq_wake(irq); |
| 232 | } |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | return 0; |
| 237 | } |
| 238 | |
Mike Rapoport | ae78e0e | 2009-07-22 23:02:54 -0700 | [diff] [blame] | 239 | static int gpio_keys_resume(struct device *dev) |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 240 | { |
Mike Rapoport | ae78e0e | 2009-07-22 23:02:54 -0700 | [diff] [blame] | 241 | struct platform_device *pdev = to_platform_device(dev); |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 242 | struct gpio_keys_platform_data *pdata = pdev->dev.platform_data; |
| 243 | int i; |
| 244 | |
| 245 | if (device_may_wakeup(&pdev->dev)) { |
| 246 | for (i = 0; i < pdata->nbuttons; i++) { |
| 247 | struct gpio_keys_button *button = &pdata->buttons[i]; |
| 248 | if (button->wakeup) { |
| 249 | int irq = gpio_to_irq(button->gpio); |
| 250 | disable_irq_wake(irq); |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | return 0; |
| 256 | } |
Mike Rapoport | ae78e0e | 2009-07-22 23:02:54 -0700 | [diff] [blame] | 257 | |
| 258 | static const struct dev_pm_ops gpio_keys_pm_ops = { |
| 259 | .suspend = gpio_keys_suspend, |
| 260 | .resume = gpio_keys_resume, |
| 261 | }; |
Anti Sullin | e15b021 | 2007-09-26 00:01:17 -0400 | [diff] [blame] | 262 | #endif |
| 263 | |
Uwe Kleine-König | 9b07044 | 2008-07-30 10:34:02 -0400 | [diff] [blame] | 264 | static struct platform_driver gpio_keys_device_driver = { |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 265 | .probe = gpio_keys_probe, |
| 266 | .remove = __devexit_p(gpio_keys_remove), |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 267 | .driver = { |
| 268 | .name = "gpio-keys", |
Kay Sievers | d7b5247 | 2008-04-18 00:24:42 -0400 | [diff] [blame] | 269 | .owner = THIS_MODULE, |
Mike Rapoport | ae78e0e | 2009-07-22 23:02:54 -0700 | [diff] [blame] | 270 | #ifdef CONFIG_PM |
| 271 | .pm = &gpio_keys_pm_ops, |
| 272 | #endif |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 273 | } |
| 274 | }; |
| 275 | |
| 276 | static int __init gpio_keys_init(void) |
| 277 | { |
| 278 | return platform_driver_register(&gpio_keys_device_driver); |
| 279 | } |
| 280 | |
| 281 | static void __exit gpio_keys_exit(void) |
| 282 | { |
| 283 | platform_driver_unregister(&gpio_keys_device_driver); |
| 284 | } |
| 285 | |
| 286 | module_init(gpio_keys_init); |
| 287 | module_exit(gpio_keys_exit); |
| 288 | |
| 289 | MODULE_LICENSE("GPL"); |
| 290 | MODULE_AUTHOR("Phil Blundell <pb@handhelds.org>"); |
| 291 | MODULE_DESCRIPTION("Keyboard driver for CPU GPIOs"); |
Kay Sievers | d7b5247 | 2008-04-18 00:24:42 -0400 | [diff] [blame] | 292 | MODULE_ALIAS("platform:gpio-keys"); |