2009-04-19 00:43:57 -06:00
|
|
|
/*
|
|
|
|
* Driver for the Cirrus EP93xx matrix keypad controller.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2008 H Hartley Sweeten <hsweeten@visionengravers.com>
|
|
|
|
*
|
|
|
|
* Based on the pxa27x matrix keypad controller by Rodolfo Giometti.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* NOTE:
|
|
|
|
*
|
|
|
|
* The 3-key reset is triggered by pressing the 3 keys in
|
|
|
|
* Row 0, Columns 2, 4, and 7 at the same time. This action can
|
|
|
|
* be disabled by setting the EP93XX_KEYPAD_DISABLE_3_KEY flag.
|
|
|
|
*
|
|
|
|
* Normal operation for the matrix does not autorepeat the key press.
|
|
|
|
* This action can be enabled by setting the EP93XX_KEYPAD_AUTOREPEAT
|
|
|
|
* flag.
|
|
|
|
*/
|
|
|
|
|
2011-08-21 13:48:08 -06:00
|
|
|
#include <linux/module.h>
|
2009-04-19 00:43:57 -06:00
|
|
|
#include <linux/platform_device.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/clk.h>
|
2009-12-15 09:39:51 -07:00
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/input/matrix_keypad.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 02:04:11 -06:00
|
|
|
#include <linux/slab.h>
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
#include <mach/hardware.h>
|
2012-08-24 07:12:11 -06:00
|
|
|
#include <linux/platform_data/keypad-ep93xx.h>
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Keypad Interface Register offsets
|
|
|
|
*/
|
|
|
|
#define KEY_INIT 0x00 /* Key Scan Initialization register */
|
|
|
|
#define KEY_DIAG 0x04 /* Key Scan Diagnostic register */
|
|
|
|
#define KEY_REG 0x08 /* Key Value Capture register */
|
|
|
|
|
|
|
|
/* Key Scan Initialization Register bit defines */
|
|
|
|
#define KEY_INIT_DBNC_MASK (0x00ff0000)
|
|
|
|
#define KEY_INIT_DBNC_SHIFT (16)
|
|
|
|
#define KEY_INIT_DIS3KY (1<<15)
|
|
|
|
#define KEY_INIT_DIAG (1<<14)
|
|
|
|
#define KEY_INIT_BACK (1<<13)
|
|
|
|
#define KEY_INIT_T2 (1<<12)
|
|
|
|
#define KEY_INIT_PRSCL_MASK (0x000003ff)
|
|
|
|
#define KEY_INIT_PRSCL_SHIFT (0)
|
|
|
|
|
|
|
|
/* Key Scan Diagnostic Register bit defines */
|
|
|
|
#define KEY_DIAG_MASK (0x0000003f)
|
|
|
|
#define KEY_DIAG_SHIFT (0)
|
|
|
|
|
|
|
|
/* Key Value Capture Register bit defines */
|
|
|
|
#define KEY_REG_K (1<<15)
|
|
|
|
#define KEY_REG_INT (1<<14)
|
|
|
|
#define KEY_REG_2KEYS (1<<13)
|
|
|
|
#define KEY_REG_1KEY (1<<12)
|
|
|
|
#define KEY_REG_KEY2_MASK (0x00000fc0)
|
|
|
|
#define KEY_REG_KEY2_SHIFT (6)
|
|
|
|
#define KEY_REG_KEY1_MASK (0x0000003f)
|
|
|
|
#define KEY_REG_KEY1_SHIFT (0)
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
#define EP93XX_MATRIX_SIZE (EP93XX_MATRIX_ROWS * EP93XX_MATRIX_COLS)
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
struct ep93xx_keypad {
|
|
|
|
struct ep93xx_keypad_platform_data *pdata;
|
|
|
|
struct input_dev *input_dev;
|
2009-12-15 09:39:51 -07:00
|
|
|
struct clk *clk;
|
|
|
|
|
2009-04-19 00:43:57 -06:00
|
|
|
void __iomem *mmio_base;
|
|
|
|
|
2010-01-13 01:34:12 -07:00
|
|
|
unsigned short keycodes[EP93XX_MATRIX_SIZE];
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
int key1;
|
|
|
|
int key2;
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
int irq;
|
|
|
|
|
|
|
|
bool enabled;
|
2009-04-19 00:43:57 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id)
|
|
|
|
{
|
|
|
|
struct ep93xx_keypad *keypad = dev_id;
|
|
|
|
struct input_dev *input_dev = keypad->input_dev;
|
2009-12-15 09:39:51 -07:00
|
|
|
unsigned int status;
|
2009-04-19 00:43:57 -06:00
|
|
|
int keycode, key1, key2;
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
status = __raw_readl(keypad->mmio_base + KEY_REG);
|
|
|
|
|
2009-04-19 00:43:57 -06:00
|
|
|
keycode = (status & KEY_REG_KEY1_MASK) >> KEY_REG_KEY1_SHIFT;
|
2010-01-13 01:34:12 -07:00
|
|
|
key1 = keypad->keycodes[keycode];
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
keycode = (status & KEY_REG_KEY2_MASK) >> KEY_REG_KEY2_SHIFT;
|
2010-01-13 01:34:12 -07:00
|
|
|
key2 = keypad->keycodes[keycode];
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
if (status & KEY_REG_2KEYS) {
|
|
|
|
if (keypad->key1 && key1 != keypad->key1 && key2 != keypad->key1)
|
|
|
|
input_report_key(input_dev, keypad->key1, 0);
|
|
|
|
|
|
|
|
if (keypad->key2 && key1 != keypad->key2 && key2 != keypad->key2)
|
|
|
|
input_report_key(input_dev, keypad->key2, 0);
|
|
|
|
|
|
|
|
input_report_key(input_dev, key1, 1);
|
|
|
|
input_report_key(input_dev, key2, 1);
|
|
|
|
|
|
|
|
keypad->key1 = key1;
|
|
|
|
keypad->key2 = key2;
|
|
|
|
|
|
|
|
} else if (status & KEY_REG_1KEY) {
|
|
|
|
if (keypad->key1 && key1 != keypad->key1)
|
|
|
|
input_report_key(input_dev, keypad->key1, 0);
|
|
|
|
|
|
|
|
if (keypad->key2 && key1 != keypad->key2)
|
|
|
|
input_report_key(input_dev, keypad->key2, 0);
|
|
|
|
|
|
|
|
input_report_key(input_dev, key1, 1);
|
|
|
|
|
|
|
|
keypad->key1 = key1;
|
|
|
|
keypad->key2 = 0;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
input_report_key(input_dev, keypad->key1, 0);
|
|
|
|
input_report_key(input_dev, keypad->key2, 0);
|
|
|
|
|
|
|
|
keypad->key1 = keypad->key2 = 0;
|
|
|
|
}
|
|
|
|
input_sync(input_dev);
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ep93xx_keypad_config(struct ep93xx_keypad *keypad)
|
|
|
|
{
|
|
|
|
struct ep93xx_keypad_platform_data *pdata = keypad->pdata;
|
|
|
|
unsigned int val = 0;
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
if (pdata->flags & EP93XX_KEYPAD_KDIV)
|
|
|
|
clk_set_rate(keypad->clk, EP93XX_KEYTCHCLK_DIV4);
|
|
|
|
else
|
|
|
|
clk_set_rate(keypad->clk, EP93XX_KEYTCHCLK_DIV16);
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
if (pdata->flags & EP93XX_KEYPAD_DISABLE_3_KEY)
|
|
|
|
val |= KEY_INIT_DIS3KY;
|
|
|
|
if (pdata->flags & EP93XX_KEYPAD_DIAG_MODE)
|
|
|
|
val |= KEY_INIT_DIAG;
|
|
|
|
if (pdata->flags & EP93XX_KEYPAD_BACK_DRIVE)
|
|
|
|
val |= KEY_INIT_BACK;
|
|
|
|
if (pdata->flags & EP93XX_KEYPAD_TEST_MODE)
|
|
|
|
val |= KEY_INIT_T2;
|
|
|
|
|
|
|
|
val |= ((pdata->debounce << KEY_INIT_DBNC_SHIFT) & KEY_INIT_DBNC_MASK);
|
|
|
|
|
|
|
|
val |= ((pdata->prescale << KEY_INIT_PRSCL_SHIFT) & KEY_INIT_PRSCL_MASK);
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
__raw_writel(val, keypad->mmio_base + KEY_INIT);
|
2009-04-19 00:43:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static int ep93xx_keypad_open(struct input_dev *pdev)
|
|
|
|
{
|
|
|
|
struct ep93xx_keypad *keypad = input_get_drvdata(pdev);
|
|
|
|
|
|
|
|
if (!keypad->enabled) {
|
|
|
|
ep93xx_keypad_config(keypad);
|
|
|
|
clk_enable(keypad->clk);
|
2009-12-15 09:39:51 -07:00
|
|
|
keypad->enabled = true;
|
2009-04-19 00:43:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ep93xx_keypad_close(struct input_dev *pdev)
|
|
|
|
{
|
|
|
|
struct ep93xx_keypad *keypad = input_get_drvdata(pdev);
|
|
|
|
|
|
|
|
if (keypad->enabled) {
|
|
|
|
clk_disable(keypad->clk);
|
2009-12-15 09:39:51 -07:00
|
|
|
keypad->enabled = false;
|
2009-04-19 00:43:57 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-04-11 01:13:50 -06:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
|
|
|
static int ep93xx_keypad_suspend(struct device *dev)
|
2009-04-19 00:43:57 -06:00
|
|
|
{
|
2012-04-11 01:13:50 -06:00
|
|
|
struct platform_device *pdev = to_platform_device(dev);
|
2009-04-19 00:43:57 -06:00
|
|
|
struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
|
|
|
|
struct input_dev *input_dev = keypad->input_dev;
|
|
|
|
|
|
|
|
mutex_lock(&input_dev->mutex);
|
|
|
|
|
|
|
|
if (keypad->enabled) {
|
|
|
|
clk_disable(keypad->clk);
|
2009-12-15 09:39:51 -07:00
|
|
|
keypad->enabled = false;
|
2009-04-19 00:43:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
mutex_unlock(&input_dev->mutex);
|
|
|
|
|
|
|
|
if (device_may_wakeup(&pdev->dev))
|
|
|
|
enable_irq_wake(keypad->irq);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-04-11 01:13:50 -06:00
|
|
|
static int ep93xx_keypad_resume(struct device *dev)
|
2009-04-19 00:43:57 -06:00
|
|
|
{
|
2012-04-11 01:13:50 -06:00
|
|
|
struct platform_device *pdev = to_platform_device(dev);
|
2009-04-19 00:43:57 -06:00
|
|
|
struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
|
|
|
|
struct input_dev *input_dev = keypad->input_dev;
|
|
|
|
|
|
|
|
if (device_may_wakeup(&pdev->dev))
|
|
|
|
disable_irq_wake(keypad->irq);
|
|
|
|
|
|
|
|
mutex_lock(&input_dev->mutex);
|
|
|
|
|
|
|
|
if (input_dev->users) {
|
|
|
|
if (!keypad->enabled) {
|
|
|
|
ep93xx_keypad_config(keypad);
|
|
|
|
clk_enable(keypad->clk);
|
2009-12-15 09:39:51 -07:00
|
|
|
keypad->enabled = true;
|
2009-04-19 00:43:57 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mutex_unlock(&input_dev->mutex);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2012-04-11 01:13:50 -06:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static SIMPLE_DEV_PM_OPS(ep93xx_keypad_pm_ops,
|
|
|
|
ep93xx_keypad_suspend, ep93xx_keypad_resume);
|
2009-04-19 00:43:57 -06:00
|
|
|
|
2012-11-23 22:38:25 -07:00
|
|
|
static int ep93xx_keypad_probe(struct platform_device *pdev)
|
2009-04-19 00:43:57 -06:00
|
|
|
{
|
|
|
|
struct ep93xx_keypad *keypad;
|
2010-01-13 01:34:12 -07:00
|
|
|
const struct matrix_keymap_data *keymap_data;
|
2009-04-19 00:43:57 -06:00
|
|
|
struct input_dev *input_dev;
|
|
|
|
struct resource *res;
|
2009-12-15 09:39:51 -07:00
|
|
|
int err;
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
keypad = kzalloc(sizeof(struct ep93xx_keypad), GFP_KERNEL);
|
2009-12-15 09:39:51 -07:00
|
|
|
if (!keypad)
|
2009-04-19 00:43:57 -06:00
|
|
|
return -ENOMEM;
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
keypad->pdata = pdev->dev.platform_data;
|
|
|
|
if (!keypad->pdata) {
|
|
|
|
err = -EINVAL;
|
|
|
|
goto failed_free;
|
|
|
|
}
|
2009-04-19 00:43:57 -06:00
|
|
|
|
2010-01-13 01:34:12 -07:00
|
|
|
keymap_data = keypad->pdata->keymap_data;
|
|
|
|
if (!keymap_data) {
|
|
|
|
err = -EINVAL;
|
|
|
|
goto failed_free;
|
|
|
|
}
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
keypad->irq = platform_get_irq(pdev, 0);
|
|
|
|
if (!keypad->irq) {
|
2009-04-19 00:43:57 -06:00
|
|
|
err = -ENXIO;
|
|
|
|
goto failed_free;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
|
|
if (!res) {
|
|
|
|
err = -ENXIO;
|
|
|
|
goto failed_free;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = request_mem_region(res->start, resource_size(res), pdev->name);
|
|
|
|
if (!res) {
|
|
|
|
err = -EBUSY;
|
|
|
|
goto failed_free;
|
|
|
|
}
|
|
|
|
|
|
|
|
keypad->mmio_base = ioremap(res->start, resource_size(res));
|
|
|
|
if (keypad->mmio_base == NULL) {
|
|
|
|
err = -ENXIO;
|
|
|
|
goto failed_free_mem;
|
|
|
|
}
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
err = ep93xx_keypad_acquire_gpio(pdev);
|
|
|
|
if (err)
|
|
|
|
goto failed_free_io;
|
2009-04-19 00:43:57 -06:00
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
keypad->clk = clk_get(&pdev->dev, NULL);
|
2009-04-19 00:43:57 -06:00
|
|
|
if (IS_ERR(keypad->clk)) {
|
|
|
|
err = PTR_ERR(keypad->clk);
|
2009-12-15 09:39:51 -07:00
|
|
|
goto failed_free_gpio;
|
2009-04-19 00:43:57 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
input_dev = input_allocate_device();
|
|
|
|
if (!input_dev) {
|
|
|
|
err = -ENOMEM;
|
|
|
|
goto failed_put_clk;
|
|
|
|
}
|
|
|
|
|
|
|
|
keypad->input_dev = input_dev;
|
|
|
|
|
|
|
|
input_dev->name = pdev->name;
|
|
|
|
input_dev->id.bustype = BUS_HOST;
|
|
|
|
input_dev->open = ep93xx_keypad_open;
|
|
|
|
input_dev->close = ep93xx_keypad_close;
|
|
|
|
input_dev->dev.parent = &pdev->dev;
|
|
|
|
|
2012-05-10 23:37:08 -06:00
|
|
|
err = matrix_keypad_build_keymap(keymap_data, NULL,
|
|
|
|
EP93XX_MATRIX_ROWS, EP93XX_MATRIX_COLS,
|
|
|
|
keypad->keycodes, input_dev);
|
|
|
|
if (err)
|
|
|
|
goto failed_free_dev;
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT)
|
2012-05-10 23:37:08 -06:00
|
|
|
__set_bit(EV_REP, input_dev->evbit);
|
|
|
|
input_set_drvdata(input_dev, keypad);
|
2009-04-19 00:43:57 -06:00
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
err = request_irq(keypad->irq, ep93xx_keypad_irq_handler,
|
2011-09-07 15:04:16 -06:00
|
|
|
0, pdev->name, keypad);
|
2009-12-15 09:39:51 -07:00
|
|
|
if (err)
|
2009-04-19 00:43:57 -06:00
|
|
|
goto failed_free_dev;
|
|
|
|
|
|
|
|
err = input_register_device(input_dev);
|
2009-12-15 09:39:51 -07:00
|
|
|
if (err)
|
2009-04-19 00:43:57 -06:00
|
|
|
goto failed_free_irq;
|
|
|
|
|
2012-05-10 23:37:08 -06:00
|
|
|
platform_set_drvdata(pdev, keypad);
|
2009-04-19 00:43:57 -06:00
|
|
|
device_init_wakeup(&pdev->dev, 1);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
failed_free_irq:
|
2013-05-23 10:29:59 -06:00
|
|
|
free_irq(keypad->irq, keypad);
|
2009-04-19 00:43:57 -06:00
|
|
|
failed_free_dev:
|
|
|
|
input_free_device(input_dev);
|
|
|
|
failed_put_clk:
|
|
|
|
clk_put(keypad->clk);
|
2009-12-15 09:39:51 -07:00
|
|
|
failed_free_gpio:
|
|
|
|
ep93xx_keypad_release_gpio(pdev);
|
2009-04-19 00:43:57 -06:00
|
|
|
failed_free_io:
|
|
|
|
iounmap(keypad->mmio_base);
|
|
|
|
failed_free_mem:
|
|
|
|
release_mem_region(res->start, resource_size(res));
|
|
|
|
failed_free:
|
|
|
|
kfree(keypad);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2012-11-23 22:50:47 -07:00
|
|
|
static int ep93xx_keypad_remove(struct platform_device *pdev)
|
2009-04-19 00:43:57 -06:00
|
|
|
{
|
|
|
|
struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
|
|
|
|
struct resource *res;
|
|
|
|
|
2013-05-23 10:29:59 -06:00
|
|
|
free_irq(keypad->irq, keypad);
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
if (keypad->enabled)
|
|
|
|
clk_disable(keypad->clk);
|
|
|
|
clk_put(keypad->clk);
|
|
|
|
|
|
|
|
input_unregister_device(keypad->input_dev);
|
|
|
|
|
2009-12-15 09:39:51 -07:00
|
|
|
ep93xx_keypad_release_gpio(pdev);
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
iounmap(keypad->mmio_base);
|
|
|
|
|
|
|
|
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
|
|
|
release_mem_region(res->start, resource_size(res));
|
|
|
|
|
|
|
|
kfree(keypad);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct platform_driver ep93xx_keypad_driver = {
|
|
|
|
.driver = {
|
|
|
|
.name = "ep93xx-keypad",
|
|
|
|
.owner = THIS_MODULE,
|
2012-04-11 01:13:50 -06:00
|
|
|
.pm = &ep93xx_keypad_pm_ops,
|
2009-04-19 00:43:57 -06:00
|
|
|
},
|
|
|
|
.probe = ep93xx_keypad_probe,
|
2012-11-23 22:27:39 -07:00
|
|
|
.remove = ep93xx_keypad_remove,
|
2009-04-19 00:43:57 -06:00
|
|
|
};
|
2011-11-29 12:08:39 -07:00
|
|
|
module_platform_driver(ep93xx_keypad_driver);
|
2009-04-19 00:43:57 -06:00
|
|
|
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_AUTHOR("H Hartley Sweeten <hsweeten@visionengravers.com>");
|
|
|
|
MODULE_DESCRIPTION("EP93xx Matrix Keypad Controller");
|
|
|
|
MODULE_ALIAS("platform:ep93xx-keypad");
|