diff options
author | Magnus Damm <damm@opensource.se> | 2010-01-21 03:02:36 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2010-01-21 03:03:56 -0500 |
commit | 3bf127637e22ddf95e67e10a23c339cee3d52429 (patch) | |
tree | a4877f45aec2a8f709049c5baf57ac0e15692c99 | |
parent | 5a9003db1faa34c0560561f66b263f288d623324 (diff) |
Input: sh_keysc - add mode 4 and mode 5 support
Add Mode 4 and Mode 5 support to the SH_KEYSC driver. These modes allow
slightly larger key pad matrixes.
While at it, make use of resource_size().
Signed-off-by: Magnus Damm <damm@opensource.se>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
-rw-r--r-- | drivers/input/keyboard/sh_keysc.c | 6 | ||||
-rw-r--r-- | include/linux/input/sh_keysc.h | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index 076111fc72d2..25706f802258 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c | |||
@@ -36,6 +36,8 @@ static const struct { | |||
36 | [SH_KEYSC_MODE_1] = { 0, 6, 5 }, | 36 | [SH_KEYSC_MODE_1] = { 0, 6, 5 }, |
37 | [SH_KEYSC_MODE_2] = { 1, 5, 6 }, | 37 | [SH_KEYSC_MODE_2] = { 1, 5, 6 }, |
38 | [SH_KEYSC_MODE_3] = { 2, 4, 7 }, | 38 | [SH_KEYSC_MODE_3] = { 2, 4, 7 }, |
39 | [SH_KEYSC_MODE_4] = { 3, 6, 6 }, | ||
40 | [SH_KEYSC_MODE_5] = { 4, 6, 7 }, | ||
39 | }; | 41 | }; |
40 | 42 | ||
41 | struct sh_keysc_priv { | 43 | struct sh_keysc_priv { |
@@ -122,8 +124,6 @@ static irqreturn_t sh_keysc_isr(int irq, void *dev_id) | |||
122 | return IRQ_HANDLED; | 124 | return IRQ_HANDLED; |
123 | } | 125 | } |
124 | 126 | ||
125 | #define res_size(res) ((res)->end - (res)->start + 1) | ||
126 | |||
127 | static int __devinit sh_keysc_probe(struct platform_device *pdev) | 127 | static int __devinit sh_keysc_probe(struct platform_device *pdev) |
128 | { | 128 | { |
129 | struct sh_keysc_priv *priv; | 129 | struct sh_keysc_priv *priv; |
@@ -164,7 +164,7 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) | |||
164 | memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); | 164 | memcpy(&priv->pdata, pdev->dev.platform_data, sizeof(priv->pdata)); |
165 | pdata = &priv->pdata; | 165 | pdata = &priv->pdata; |
166 | 166 | ||
167 | priv->iomem_base = ioremap_nocache(res->start, res_size(res)); | 167 | priv->iomem_base = ioremap_nocache(res->start, resource_size(res)); |
168 | if (priv->iomem_base == NULL) { | 168 | if (priv->iomem_base == NULL) { |
169 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); | 169 | dev_err(&pdev->dev, "failed to remap I/O memory\n"); |
170 | error = -ENXIO; | 170 | error = -ENXIO; |
diff --git a/include/linux/input/sh_keysc.h b/include/linux/input/sh_keysc.h index c211b5cf08e6..2aff38bcf2ba 100644 --- a/include/linux/input/sh_keysc.h +++ b/include/linux/input/sh_keysc.h | |||
@@ -1,10 +1,11 @@ | |||
1 | #ifndef __SH_KEYSC_H__ | 1 | #ifndef __SH_KEYSC_H__ |
2 | #define __SH_KEYSC_H__ | 2 | #define __SH_KEYSC_H__ |
3 | 3 | ||
4 | #define SH_KEYSC_MAXKEYS 30 | 4 | #define SH_KEYSC_MAXKEYS 42 |
5 | 5 | ||
6 | struct sh_keysc_info { | 6 | struct sh_keysc_info { |
7 | enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode; | 7 | enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3, |
8 | SH_KEYSC_MODE_4, SH_KEYSC_MODE_5 } mode; | ||
8 | int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */ | 9 | int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */ |
9 | int delay; | 10 | int delay; |
10 | int kycr2_delay; | 11 | int kycr2_delay; |