summaryrefslogtreecommitdiffstats
path: root/meta/recipes-kernel/linux/linux-rp-2.6.23/zylonite_keypad-r0.patch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-kernel/linux/linux-rp-2.6.23/zylonite_keypad-r0.patch
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-kernel/linux/linux-rp-2.6.23/zylonite_keypad-r0.patch')
-rw-r--r--meta/recipes-kernel/linux/linux-rp-2.6.23/zylonite_keypad-r0.patch1187
1 files changed, 1187 insertions, 0 deletions
diff --git a/meta/recipes-kernel/linux/linux-rp-2.6.23/zylonite_keypad-r0.patch b/meta/recipes-kernel/linux/linux-rp-2.6.23/zylonite_keypad-r0.patch
new file mode 100644
index 0000000000..1889b3884e
--- /dev/null
+++ b/meta/recipes-kernel/linux/linux-rp-2.6.23/zylonite_keypad-r0.patch
@@ -0,0 +1,1187 @@
1Eric Miao's pxa keypad patchset backport.
2---
3 arch/arm/mach-pxa/devices.h | 1
4 arch/arm/mach-pxa/generic.c | 31 +
5 arch/arm/mach-pxa/pxa27x.c | 2
6 arch/arm/mach-pxa/pxa300.c | 6
7 arch/arm/mach-pxa/pxa3xx.c | 1
8 arch/arm/mach-pxa/zylonite.c | 68 +++
9 drivers/input/keyboard/Kconfig | 8
10 drivers/input/keyboard/Makefile | 2
11 drivers/input/keyboard/pxa27x_keyboard.c | 273 -------------
12 drivers/input/keyboard/pxa27x_keypad.c | 575 +++++++++++++++++++++++++++++
13 include/asm-arm/arch-pxa/irqs.h | 2
14 include/asm-arm/arch-pxa/pxa27x_keyboard.h | 13
15 include/asm-arm/arch-pxa/pxa27x_keypad.h | 58 ++
16 13 files changed, 745 insertions(+), 295 deletions(-)
17
18Index: linux-2.6.23-z-input/drivers/input/keyboard/Kconfig
19===================================================================
20--- linux-2.6.23-z-input.orig/drivers/input/keyboard/Kconfig 2008-02-18 01:43:28.000000000 +0100
21+++ linux-2.6.23-z-input/drivers/input/keyboard/Kconfig 2008-02-18 01:43:28.000000000 +0100
22@@ -218,13 +218,13 @@
23 module will be called omap-keypad.
24
25 config KEYBOARD_PXA27x
26- tristate "PXA27x keyboard support"
27- depends on PXA27x
28+ tristate "PXA27x/PXA3xx keypad support"
29+ depends on PXA27x || PXA3xx
30 help
31- Enable support for PXA27x matrix keyboard controller
32+ Enable support for PXA27x/PXA3xx keypad controller
33
34 To compile this driver as a module, choose M here: the
35- module will be called pxa27x_keyboard.
36+ module will be called pxa27x_keypad.
37
38 config KEYBOARD_AAED2000
39 tristate "AAED-2000 keyboard"
40Index: linux-2.6.23-z-input/drivers/input/keyboard/Makefile
41===================================================================
42--- linux-2.6.23-z-input.orig/drivers/input/keyboard/Makefile 2008-02-18 01:43:28.000000000 +0100
43+++ linux-2.6.23-z-input/drivers/input/keyboard/Makefile 2008-02-18 01:43:28.000000000 +0100
44@@ -18,7 +18,7 @@
45 obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o
46 obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o
47 obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o
48-obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keyboard.o
49+obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o
50 obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o
51 obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o
52 obj-$(CONFIG_KEYBOARD_ASIC3) += asic3_keys.o
53Index: linux-2.6.23-z-input/drivers/input/keyboard/pxa27x_keypad.c
54===================================================================
55--- /dev/null 1970-01-01 00:00:00.000000000 +0000
56+++ linux-2.6.23-z-input/drivers/input/keyboard/pxa27x_keypad.c 2008-02-19 01:40:04.000000000 +0100
57@@ -0,0 +1,575 @@
58+/*
59+ * linux/drivers/input/keyboard/pxa27x_keypad.c
60+ *
61+ * Driver for the pxa27x matrix keyboard controller.
62+ *
63+ * Created: Feb 22, 2007
64+ * Author: Rodolfo Giometti <giometti@linux.it>
65+ *
66+ * Based on a previous implementations by Kevin O'Connor
67+ * <kevin_at_koconnor.net> and Alex Osborne <bobofdoom@gmail.com> and
68+ * on some suggestions by Nicolas Pitre <nico@cam.org>.
69+ *
70+ * This program is free software; you can redistribute it and/or modify
71+ * it under the terms of the GNU General Public License version 2 as
72+ * published by the Free Software Foundation.
73+ */
74+
75+
76+#include <linux/kernel.h>
77+#include <linux/module.h>
78+#include <linux/init.h>
79+#include <linux/interrupt.h>
80+#include <linux/input.h>
81+#include <linux/device.h>
82+#include <linux/platform_device.h>
83+#include <linux/clk.h>
84+#include <linux/err.h>
85+
86+#include <asm/mach-types.h>
87+#include <asm/mach/arch.h>
88+#include <asm/mach/map.h>
89+
90+#include <asm/arch/hardware.h>
91+#include <asm/arch/mfp.h>
92+#include <asm/arch/pxa27x_keypad.h>
93+
94+#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
95+
96+/*
97+ * Keypad Controller registers
98+ */
99+#define KPC 0x0000 /* Keypad Control register */
100+#define KPDK 0x0008 /* Keypad Direct Key register */
101+#define KPREC 0x0010 /* Keypad Rotary Encoder register */
102+#define KPMK 0x0018 /* Keypad Matrix Key register */
103+#define KPAS 0x0020 /* Keypad Automatic Scan register */
104+
105+/* Keypad Automatic Scan Multiple Key Presser register 0-3 */
106+#define KPASMKP0 0x0028
107+#define KPASMKP1 0x0030
108+#define KPASMKP2 0x0038
109+#define KPASMKP3 0x0040
110+#define KPKDI 0x0048
111+
112+/* bit definitions */
113+#define KPC_MKRN(n) ((((n) - 1) & 0x7) << 26) /* matrix key row number */
114+#define KPC_MKCN(n) ((((n) - 1) & 0x7) << 23) /* matrix key column number */
115+#define KPC_DKN(n) ((((n) - 1) & 0x7) << 6) /* direct key number */
116+
117+#define KPC_AS (0x1 << 30) /* Automatic Scan bit */
118+#define KPC_ASACT (0x1 << 29) /* Automatic Scan on Activity */
119+#define KPC_MI (0x1 << 22) /* Matrix interrupt bit */
120+#define KPC_IMKP (0x1 << 21) /* Ignore Multiple Key Press */
121+
122+#define KPC_MS(n) (0x1 << (13 + (n))) /* Matrix scan line 'n' */
123+#define KPC_MS_ALL (0xff << 13)
124+
125+#define KPC_ME (0x1 << 12) /* Matrix Keypad Enable */
126+#define KPC_MIE (0x1 << 11) /* Matrix Interrupt Enable */
127+#define KPC_DK_DEB_SEL (0x1 << 9) /* Direct Keypad Debounce Select */
128+#define KPC_DI (0x1 << 5) /* Direct key interrupt bit */
129+#define KPC_RE_ZERO_DEB (0x1 << 4) /* Rotary Encoder Zero Debounce */
130+#define KPC_REE1 (0x1 << 3) /* Rotary Encoder1 Enable */
131+#define KPC_REE0 (0x1 << 2) /* Rotary Encoder0 Enable */
132+#define KPC_DE (0x1 << 1) /* Direct Keypad Enable */
133+#define KPC_DIE (0x1 << 0) /* Direct Keypad interrupt Enable */
134+
135+#define KPDK_DKP (0x1 << 31)
136+#define KPDK_DK(n) ((n) & 0xff)
137+
138+#define KPREC_OF1 (0x1 << 31)
139+#define kPREC_UF1 (0x1 << 30)
140+#define KPREC_OF0 (0x1 << 15)
141+#define KPREC_UF0 (0x1 << 14)
142+
143+#define KPREC_RECOUNT0(n) ((n) & 0xff)
144+#define KPREC_RECOUNT1(n) (((n) >> 16) & 0xff)
145+
146+#define KPMK_MKP (0x1 << 31)
147+#define KPAS_SO (0x1 << 31)
148+#define KPASMKPx_SO (0x1 << 31)
149+
150+#define KPAS_MUKP(n) (((n) >> 26) & 0x1f)
151+#define KPAS_RP(n) (((n) >> 4) & 0xf)
152+#define KPAS_CP(n) ((n) & 0xf)
153+
154+#define KPASMKP_MKC_MASK (0xff)
155+
156+#define keypad_readl(off) __raw_readl(keypad->mmio_base + (off))
157+#define keypad_writel(off, v) __raw_writel((v), keypad->mmio_base + (off))
158+
159+#define MAX_MATRIX_KEY_NUM (8 * 8)
160+
161+struct pxa27x_keypad {
162+ struct pxa27x_keypad_platform_data *pdata;
163+
164+ struct clk *clk;
165+ struct input_dev *input_dev;
166+ void __iomem *mmio_base;
167+
168+ /* matrix key code map */
169+ unsigned int matrix_keycodes[MAX_MATRIX_KEY_NUM];
170+
171+ /* state row bits of each column scan */
172+ uint32_t matrix_key_state[MAX_MATRIX_KEY_COLS];
173+ uint32_t direct_key_state;
174+
175+ unsigned int direct_key_mask;
176+
177+ int rotary_rel_code[2];
178+ int rotary_up_key[2];
179+ int rotary_down_key[2];
180+};
181+
182+static void pxa27x_keypad_build_keycode(struct pxa27x_keypad *keypad)
183+{
184+ struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
185+ struct input_dev *input_dev = keypad->input_dev;
186+ unsigned int *key;
187+ int i;
188+
189+ key = &pdata->matrix_key_map[0];
190+ for (i = 0; i < pdata->matrix_key_map_size; i++, key++) {
191+ int row = ((*key) >> 28) & 0xf;
192+ int col = ((*key) >> 24) & 0xf;
193+ int code = (*key) & 0xffffff;
194+
195+ keypad->matrix_keycodes[(row << 3) + col] = code;
196+ set_bit(code, input_dev->keybit);
197+ }
198+
199+ keypad->rotary_up_key[0] = pdata->rotary0_up_key;
200+ keypad->rotary_up_key[1] = pdata->rotary1_up_key;
201+ keypad->rotary_down_key[0] = pdata->rotary0_down_key;
202+ keypad->rotary_down_key[1] = pdata->rotary1_down_key;
203+ keypad->rotary_rel_code[0] = pdata->rotary0_rel_code;
204+ keypad->rotary_rel_code[1] = pdata->rotary1_rel_code;
205+
206+ if (pdata->rotary0_up_key && pdata->rotary0_down_key) {
207+ set_bit(pdata->rotary0_up_key, input_dev->keybit);
208+ set_bit(pdata->rotary0_down_key, input_dev->keybit);
209+ } else
210+ set_bit(pdata->rotary0_rel_code, input_dev->relbit);
211+
212+ if (pdata->rotary1_up_key && pdata->rotary1_down_key) {
213+ set_bit(pdata->rotary1_up_key, input_dev->keybit);
214+ set_bit(pdata->rotary1_down_key, input_dev->keybit);
215+ } else
216+ set_bit(pdata->rotary1_rel_code, input_dev->relbit);
217+}
218+
219+static inline unsigned int lookup_matrix_keycode(
220+ struct pxa27x_keypad *keypad, int row, int col)
221+{
222+ return keypad->matrix_keycodes[(row << 3) + col];
223+}
224+
225+static void pxa27x_keypad_scan_matrix(struct pxa27x_keypad *keypad)
226+{
227+ struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
228+ int row, col, num_keys_pressed = 0;
229+ uint32_t new_state[MAX_MATRIX_KEY_COLS];
230+ uint32_t kpas = keypad_readl(KPAS);
231+
232+ num_keys_pressed = KPAS_MUKP(kpas);
233+
234+ memset(new_state, 0, sizeof(new_state));
235+
236+ if (num_keys_pressed == 0)
237+ goto scan;
238+
239+ if (num_keys_pressed == 1) {
240+ col = KPAS_CP(kpas);
241+ row = KPAS_RP(kpas);
242+
243+ /* if invalid row/col, treat as no key pressed */
244+ if (col >= pdata->matrix_key_cols ||
245+ row >= pdata->matrix_key_rows)
246+ goto scan;
247+
248+ new_state[col] = (1 << row);
249+ goto scan;
250+ }
251+
252+ if (num_keys_pressed > 1) {
253+ uint32_t kpasmkp0 = keypad_readl(KPASMKP0);
254+ uint32_t kpasmkp1 = keypad_readl(KPASMKP1);
255+ uint32_t kpasmkp2 = keypad_readl(KPASMKP2);
256+ uint32_t kpasmkp3 = keypad_readl(KPASMKP3);
257+
258+ new_state[0] = kpasmkp0 & KPASMKP_MKC_MASK;
259+ new_state[1] = (kpasmkp0 >> 16) & KPASMKP_MKC_MASK;
260+ new_state[2] = kpasmkp1 & KPASMKP_MKC_MASK;
261+ new_state[3] = (kpasmkp1 >> 16) & KPASMKP_MKC_MASK;
262+ new_state[4] = kpasmkp2 & KPASMKP_MKC_MASK;
263+ new_state[5] = (kpasmkp2 >> 16) & KPASMKP_MKC_MASK;
264+ new_state[6] = kpasmkp3 & KPASMKP_MKC_MASK;
265+ new_state[7] = (kpasmkp3 >> 16) & KPASMKP_MKC_MASK;
266+ }
267+scan:
268+ for (col = 0; col < pdata->matrix_key_cols; col++) {
269+ uint32_t bits_changed;
270+
271+ bits_changed = keypad->matrix_key_state[col] ^ new_state[col];
272+ if (bits_changed == 0)
273+ continue;
274+
275+ for (row = 0; row < pdata->matrix_key_rows; row++) {
276+ if ((bits_changed & (1 << row)) == 0)
277+ continue;
278+
279+ input_report_key(keypad->input_dev,
280+ lookup_matrix_keycode(keypad, row, col),
281+ new_state[col] & (1 << row));
282+ }
283+ }
284+ input_sync(keypad->input_dev);
285+ memcpy(keypad->matrix_key_state, new_state, sizeof(new_state));
286+}
287+
288+#define DEFAULT_KPREC (0x007f007f)
289+
290+static inline int rotary_delta(uint32_t kprec)
291+{
292+ if (kprec & KPREC_OF0)
293+ return (kprec & 0xff) + 0x7f;
294+ else if (kprec & KPREC_UF0)
295+ return (kprec & 0xff) - 0x7f - 0xff;
296+ else
297+ return (kprec & 0xff) - 0x7f;
298+}
299+
300+static void report_rotary_event(struct pxa27x_keypad *keypad, int r, int delta)
301+{
302+ struct input_dev *dev = keypad->input_dev;
303+
304+ if (delta == 0)
305+ return;
306+
307+ if (keypad->rotary_up_key[r] && keypad->rotary_down_key[r]) {
308+ int keycode = (delta > 0) ? keypad->rotary_up_key[r] :
309+ keypad->rotary_down_key[r];
310+
311+ /* simulate a press-n-release */
312+ input_report_key(dev, keycode, 1);
313+ input_sync(dev);
314+ input_report_key(dev, keycode, 0);
315+ input_sync(dev);
316+ } else {
317+ input_report_rel(dev, keypad->rotary_rel_code[r], delta);
318+ input_sync(dev);
319+ }
320+}
321+
322+static void pxa27x_keypad_scan_rotary(struct pxa27x_keypad *keypad)
323+{
324+ struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
325+ uint32_t kprec;
326+
327+ /* read and reset to default count value */
328+ kprec = keypad_readl(KPREC);
329+ keypad_writel(KPREC, DEFAULT_KPREC);
330+
331+ if (pdata->enable_rotary0)
332+ report_rotary_event(keypad, 0, rotary_delta(kprec));
333+
334+ if (pdata->enable_rotary1)
335+ report_rotary_event(keypad, 1, rotary_delta(kprec >> 16));
336+}
337+
338+static void pxa27x_keypad_scan_direct(struct pxa27x_keypad *keypad)
339+{
340+ struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
341+ unsigned int new_state;
342+ uint32_t kpdk, bits_changed;
343+ int i;
344+
345+ kpdk = keypad_readl(KPDK);
346+
347+ if (pdata->enable_rotary0 || pdata->enable_rotary1)
348+ pxa27x_keypad_scan_rotary(keypad);
349+
350+ if (pdata->direct_key_map == NULL)
351+ return;
352+
353+ new_state = KPDK_DK(kpdk) & keypad->direct_key_mask;
354+ bits_changed = keypad->direct_key_state ^ new_state;
355+
356+ if (bits_changed == 0)
357+ return;
358+
359+ for (i = 0; i < pdata->direct_key_num; i++) {
360+ if (bits_changed & (1 << i))
361+ input_report_key(keypad->input_dev,
362+ pdata->direct_key_map[i],
363+ (new_state & (1 << i)));
364+ }
365+ input_sync(keypad->input_dev);
366+ keypad->direct_key_state = new_state;
367+}
368+
369+static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id)
370+{
371+ struct pxa27x_keypad *keypad = dev_id;
372+ unsigned long kpc = keypad_readl(KPC);
373+
374+ if (kpc & KPC_DI)
375+ pxa27x_keypad_scan_direct(keypad);
376+
377+ if (kpc & KPC_MI)
378+ pxa27x_keypad_scan_matrix(keypad);
379+
380+ return IRQ_HANDLED;
381+}
382+
383+static void pxa27x_keypad_config(struct pxa27x_keypad *keypad)
384+{
385+ struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
386+ unsigned int mask = 0, direct_key_num = 0;
387+ unsigned long kpc = 0;
388+
389+ /* enable matrix keys with automatic scan */
390+ if (pdata->matrix_key_rows && pdata->matrix_key_cols) {
391+ kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL;
392+ kpc |= KPC_MKRN(pdata->matrix_key_rows) |
393+ KPC_MKCN(pdata->matrix_key_cols);
394+ }
395+
396+ /* enable rotary key, debounce interval same as direct keys */
397+ if (pdata->enable_rotary0) {
398+ mask |= 0x03;
399+ direct_key_num = 2;
400+ kpc |= KPC_REE0;
401+ }
402+
403+ if (pdata->enable_rotary1) {
404+ mask |= 0x0c;
405+ direct_key_num = 4;
406+ kpc |= KPC_REE1;
407+ }
408+
409+ if (pdata->direct_key_num > direct_key_num)
410+ direct_key_num = pdata->direct_key_num;
411+
412+ keypad->direct_key_mask = ((2 << direct_key_num) - 1) & ~mask;
413+
414+ /* enable direct key */
415+ if (direct_key_num)
416+ kpc |= KPC_DE | KPC_DIE | KPC_DKN(direct_key_num);
417+
418+ keypad_writel(KPC, kpc | KPC_RE_ZERO_DEB);
419+ keypad_writel(KPREC, DEFAULT_KPREC);
420+ keypad_writel(KPKDI, pdata->debounce_interval);
421+}
422+
423+static int pxa27x_keypad_open(struct input_dev *dev)
424+{
425+ struct pxa27x_keypad *keypad = input_get_drvdata(dev);
426+
427+ /* Enable unit clock */
428+ clk_enable(keypad->clk);
429+ pxa27x_keypad_config(keypad);
430+
431+ return 0;
432+}
433+
434+static void pxa27x_keypad_close(struct input_dev *dev)
435+{
436+ struct pxa27x_keypad *keypad = input_get_drvdata(dev);
437+
438+ /* Disable clock unit */
439+ clk_disable(keypad->clk);
440+}
441+
442+#ifdef CONFIG_PM
443+static int pxa27x_keypad_suspend(struct platform_device *pdev, pm_message_t state)
444+{
445+ struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
446+
447+ clk_disable(keypad->clk);
448+ return 0;
449+}
450+
451+static int pxa27x_keypad_resume(struct platform_device *pdev)
452+{
453+ struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
454+ struct input_dev *input_dev = keypad->input_dev;
455+
456+ mutex_lock(&input_dev->mutex);
457+
458+ if (input_dev->users) {
459+ /* Enable unit clock */
460+ clk_enable(keypad->clk);
461+ pxa27x_keypad_config(keypad);
462+ }
463+
464+ mutex_unlock(&input_dev->mutex);
465+
466+ return 0;
467+}
468+#else
469+#define pxa27x_keypad_suspend NULL
470+#define pxa27x_keypad_resume NULL
471+#endif
472+
473+#define res_size(res) ((res)->end - (res)->start + 1)
474+
475+static int __devinit pxa27x_keypad_probe(struct platform_device *pdev)
476+{
477+ struct pxa27x_keypad *keypad;
478+ struct input_dev *input_dev;
479+ struct resource *res;
480+ int irq, error;
481+
482+ keypad = kzalloc(sizeof(struct pxa27x_keypad), GFP_KERNEL);
483+ if (keypad == NULL) {
484+ dev_err(&pdev->dev, "failed to allocate driver data\n");
485+ return -ENOMEM;
486+ }
487+
488+ keypad->pdata = pdev->dev.platform_data;
489+ if (keypad->pdata == NULL) {
490+ dev_err(&pdev->dev, "no platform data defined\n");
491+ error = -EINVAL;
492+ goto failed_free;
493+ }
494+
495+ irq = platform_get_irq(pdev, 0);
496+ if (irq < 0) {
497+ dev_err(&pdev->dev, "failed to get keypad irq\n");
498+ error = -ENXIO;
499+ goto failed_free;
500+ }
501+
502+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
503+ if (res == NULL) {
504+ dev_err(&pdev->dev, "failed to get I/O memory\n");
505+ error = -ENXIO;
506+ goto failed_free;
507+ }
508+
509+ res = request_mem_region(res->start, res_size(res), pdev->name);
510+ if (res == NULL) {
511+ dev_err(&pdev->dev, "failed to request I/O memory\n");
512+ error = -EBUSY;
513+ goto failed_free;
514+ }
515+
516+ keypad->mmio_base = ioremap(res->start, res_size(res));
517+ if (keypad->mmio_base == NULL) {
518+ dev_err(&pdev->dev, "failed to remap I/O memory\n");
519+ error = -ENXIO;
520+ goto failed_free_mem;
521+ }
522+
523+ keypad->clk = clk_get(&pdev->dev, "KBDCLK");
524+ if (IS_ERR(keypad->clk)) {
525+ dev_err(&pdev->dev, "failed to get keypad clock\n");
526+ error = PTR_ERR(keypad->clk);
527+ goto failed_free_io;
528+ }
529+
530+ /* Create and register the input driver. */
531+ input_dev = input_allocate_device();
532+ if (!input_dev) {
533+ dev_err(&pdev->dev, "failed to allocate input device\n");
534+ error = -ENOMEM;
535+ goto failed_put_clk;
536+ }
537+
538+ input_dev->name = pdev->name;
539+ input_dev->id.bustype = BUS_HOST;
540+ input_dev->open = pxa27x_keypad_open;
541+ input_dev->close = pxa27x_keypad_close;
542+ input_dev->dev.parent = &pdev->dev;
543+
544+ keypad->input_dev = input_dev;
545+ input_set_drvdata(input_dev, keypad);
546+
547+ input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) |
548+ BIT_MASK(EV_REL);
549+
550+ pxa27x_keypad_build_keycode(keypad);
551+ platform_set_drvdata(pdev, keypad);
552+
553+ error = request_irq(irq, pxa27x_keypad_irq_handler, IRQF_DISABLED,
554+ pdev->name, keypad);
555+ if (error) {
556+ dev_err(&pdev->dev, "failed to request IRQ\n");
557+ goto failed_free_dev;
558+ }
559+
560+ /* Register the input device */
561+ error = input_register_device(input_dev);
562+ if (error) {
563+ dev_err(&pdev->dev, "failed to register input device\n");
564+ goto failed_free_irq;
565+ }
566+
567+ return 0;
568+
569+failed_free_irq:
570+ free_irq(irq, pdev);
571+ platform_set_drvdata(pdev, NULL);
572+failed_free_dev:
573+ input_free_device(input_dev);
574+failed_put_clk:
575+ clk_put(keypad->clk);
576+failed_free_io:
577+ iounmap(keypad->mmio_base);
578+failed_free_mem:
579+ release_mem_region(res->start, res_size(res));
580+failed_free:
581+ kfree(keypad);
582+ return error;
583+}
584+
585+static int __devexit pxa27x_keypad_remove(struct platform_device *pdev)
586+{
587+ struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
588+ struct resource *res;
589+
590+ free_irq(platform_get_irq(pdev, 0), pdev);
591+
592+ clk_disable(keypad->clk);
593+ clk_put(keypad->clk);
594+
595+ input_unregister_device(keypad->input_dev);
596+ input_free_device(keypad->input_dev);
597+
598+ iounmap(keypad->mmio_base);
599+
600+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
601+ release_mem_region(res->start, res_size(res));
602+
603+ platform_set_drvdata(pdev, NULL);
604+ kfree(keypad);
605+ return 0;
606+}
607+
608+static struct platform_driver pxa27x_keypad_driver = {
609+ .probe = pxa27x_keypad_probe,
610+ .remove = __devexit_p(pxa27x_keypad_remove),
611+ .suspend = pxa27x_keypad_suspend,
612+ .resume = pxa27x_keypad_resume,
613+ .driver = {
614+ .name = "pxa27x-keypad",
615+ },
616+};
617+
618+static int __init pxa27x_keypad_init(void)
619+{
620+ return platform_driver_register(&pxa27x_keypad_driver);
621+}
622+
623+static void __exit pxa27x_keypad_exit(void)
624+{
625+ platform_driver_unregister(&pxa27x_keypad_driver);
626+}
627+
628+module_init(pxa27x_keypad_init);
629+module_exit(pxa27x_keypad_exit);
630+
631+MODULE_DESCRIPTION("PXA27x Keypad Controller Driver");
632+MODULE_LICENSE("GPL");
633Index: linux-2.6.23-z-input/include/asm-arm/arch-pxa/pxa27x_keyboard.h
634===================================================================
635--- linux-2.6.23-z-input.orig/include/asm-arm/arch-pxa/pxa27x_keyboard.h 2007-10-09 22:31:38.000000000 +0200
636+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
637@@ -1,13 +0,0 @@
638-#define PXAKBD_MAXROW 8
639-#define PXAKBD_MAXCOL 8
640-
641-struct pxa27x_keyboard_platform_data {
642- int nr_rows, nr_cols;
643- int keycodes[PXAKBD_MAXROW][PXAKBD_MAXCOL];
644- int gpio_modes[PXAKBD_MAXROW + PXAKBD_MAXCOL];
645-
646-#ifdef CONFIG_PM
647- u32 reg_kpc;
648- u32 reg_kprec;
649-#endif
650-};
651Index: linux-2.6.23-z-input/include/asm-arm/arch-pxa/pxa27x_keypad.h
652===================================================================
653--- /dev/null 1970-01-01 00:00:00.000000000 +0000
654+++ linux-2.6.23-z-input/include/asm-arm/arch-pxa/pxa27x_keypad.h 2008-02-18 01:43:28.000000000 +0100
655@@ -0,0 +1,58 @@
656+#ifndef __ASM_ARCH_PXA27x_KEYPAD_H
657+#define __ASM_ARCH_PXA27x_KEYPAD_H
658+
659+#include <linux/input.h>
660+
661+#define MAX_MATRIX_KEY_ROWS (8)
662+#define MAX_MATRIX_KEY_COLS (8)
663+
664+/* pxa3xx keypad platform specific parameters
665+ *
666+ * NOTE:
667+ * 1. direct_key_num indicates the number of keys in the direct keypad
668+ * _plus_ the number of rotary-encoder sensor inputs, this can be
669+ * left as 0 if only rotary encoders are enabled, the driver will
670+ * automatically calculate this
671+ *
672+ * 2. direct_key_map is the key code map for the direct keys, if rotary
673+ * encoder(s) are enabled, direct key 0/1(2/3) will be ignored
674+ *
675+ * 3. rotary can be either interpreted as a relative input event (e.g.
676+ * REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT)
677+ *
678+ * 4. matrix key and direct key will use the same debounce_interval by
679+ * default, which should be sufficient in most cases
680+ */
681+struct pxa27x_keypad_platform_data {
682+
683+ /* code map for the matrix keys */
684+ unsigned int matrix_key_rows;
685+ unsigned int matrix_key_cols;
686+ unsigned int *matrix_key_map;
687+ int matrix_key_map_size;
688+
689+ /* direct keys */
690+ int direct_key_num;
691+ unsigned int direct_key_map[8];
692+
693+ /* rotary encoders 0 */
694+ int enable_rotary0;
695+ int rotary0_rel_code;
696+ int rotary0_up_key;
697+ int rotary0_down_key;
698+
699+ /* rotary encoders 1 */
700+ int enable_rotary1;
701+ int rotary1_rel_code;
702+ int rotary1_up_key;
703+ int rotary1_down_key;
704+
705+ /* key debounce interval */
706+ unsigned int debounce_interval;
707+};
708+
709+#define KEY(row, col, val) (((row) << 28) | ((col) << 24) | (val))
710+
711+extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
712+
713+#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */
714Index: linux-2.6.23-z-input/drivers/input/keyboard/pxa27x_keyboard.c
715===================================================================
716--- linux-2.6.23-z-input.orig/drivers/input/keyboard/pxa27x_keyboard.c 2008-02-18 01:43:28.000000000 +0100
717+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
718@@ -1,273 +0,0 @@
719-/*
720- * linux/drivers/input/keyboard/pxa27x_keyboard.c
721- *
722- * Driver for the pxa27x matrix keyboard controller.
723- *
724- * Created: Feb 22, 2007
725- * Author: Rodolfo Giometti <giometti@linux.it>
726- *
727- * Based on a previous implementations by Kevin O'Connor
728- * <kevin_at_koconnor.net> and Alex Osborne <bobofdoom@gmail.com> and
729- * on some suggestions by Nicolas Pitre <nico@cam.org>.
730- *
731- * This program is free software; you can redistribute it and/or modify
732- * it under the terms of the GNU General Public License version 2 as
733- * published by the Free Software Foundation.
734- */
735-
736-
737-#include <linux/kernel.h>
738-#include <linux/module.h>
739-#include <linux/init.h>
740-#include <linux/interrupt.h>
741-#include <linux/input.h>
742-#include <linux/device.h>
743-#include <linux/platform_device.h>
744-#include <linux/clk.h>
745-#include <linux/err.h>
746-
747-#include <asm/mach-types.h>
748-#include <asm/mach/arch.h>
749-#include <asm/mach/map.h>
750-
751-#include <asm/arch/hardware.h>
752-#include <asm/arch/pxa-regs.h>
753-#include <asm/arch/irqs.h>
754-#include <asm/arch/pxa27x_keyboard.h>
755-
756-#define DRIVER_NAME "pxa27x-keyboard"
757-
758-#define KPASMKP(col) (col/2 == 0 ? KPASMKP0 : \
759- col/2 == 1 ? KPASMKP1 : \
760- col/2 == 2 ? KPASMKP2 : KPASMKP3)
761-#define KPASMKPx_MKC(row, col) (1 << (row + 16 * (col % 2)))
762-
763-static struct clk *pxakbd_clk;
764-
765-static irqreturn_t pxakbd_irq_handler(int irq, void *dev_id)
766-{
767- struct platform_device *pdev = dev_id;
768- struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
769- struct input_dev *input_dev = platform_get_drvdata(pdev);
770- unsigned long kpc = KPC;
771- int p, row, col, rel;
772-
773- if (kpc & KPC_DI) {
774- unsigned long kpdk = KPDK;
775-
776- if (!(kpdk & KPDK_DKP)) {
777- /* better luck next time */
778- } else if (kpc & KPC_REE0) {
779- unsigned long kprec = KPREC;
780- KPREC = 0x7f;
781-
782- if (kprec & KPREC_OF0)
783- rel = (kprec & 0xff) + 0x7f;
784- else if (kprec & KPREC_UF0)
785- rel = (kprec & 0xff) - 0x7f - 0xff;
786- else
787- rel = (kprec & 0xff) - 0x7f;
788-
789- if (rel) {
790- input_report_rel(input_dev, REL_WHEEL, rel);
791- input_sync(input_dev);
792- }
793- }
794- }
795-
796- if (kpc & KPC_MI) {
797- /* report the status of every button */
798- for (row = 0; row < pdata->nr_rows; row++) {
799- for (col = 0; col < pdata->nr_cols; col++) {
800- p = KPASMKP(col) & KPASMKPx_MKC(row, col) ?
801- 1 : 0;
802- pr_debug("keycode %x - pressed %x\n",
803- pdata->keycodes[row][col], p);
804- input_report_key(input_dev,
805- pdata->keycodes[row][col], p);
806- }
807- }
808- input_sync(input_dev);
809- }
810-
811- return IRQ_HANDLED;
812-}
813-
814-static int pxakbd_open(struct input_dev *dev)
815-{
816- /* Set keypad control register */
817- KPC |= (KPC_ASACT |
818- KPC_MS_ALL |
819- (2 << 6) | KPC_REE0 | KPC_DK_DEB_SEL |
820- KPC_ME | KPC_MIE | KPC_DE | KPC_DIE);
821-
822- KPC &= ~KPC_AS; /* disable automatic scan */
823- KPC &= ~KPC_IMKP; /* do not ignore multiple keypresses */
824-
825- /* Set rotary count to mid-point value */
826- KPREC = 0x7F;
827-
828- /* Enable unit clock */
829- clk_enable(pxakbd_clk);
830-
831- return 0;
832-}
833-
834-static void pxakbd_close(struct input_dev *dev)
835-{
836- /* Disable clock unit */
837- clk_disable(pxakbd_clk);
838-}
839-
840-#ifdef CONFIG_PM
841-static int pxakbd_suspend(struct platform_device *pdev, pm_message_t state)
842-{
843- struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
844-
845- /* Save controller status */
846- pdata->reg_kpc = KPC;
847- pdata->reg_kprec = KPREC;
848-
849- return 0;
850-}
851-
852-static int pxakbd_resume(struct platform_device *pdev)
853-{
854- struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
855- struct input_dev *input_dev = platform_get_drvdata(pdev);
856-
857- mutex_lock(&input_dev->mutex);
858-
859- if (input_dev->users) {
860- /* Restore controller status */
861- KPC = pdata->reg_kpc;
862- KPREC = pdata->reg_kprec;
863-
864- /* Enable unit clock */
865- clk_disable(pxakbd_clk);
866- clk_enable(pxakbd_clk);
867- }
868-
869- mutex_unlock(&input_dev->mutex);
870-
871- return 0;
872-}
873-#else
874-#define pxakbd_suspend NULL
875-#define pxakbd_resume NULL
876-#endif
877-
878-static int __devinit pxakbd_probe(struct platform_device *pdev)
879-{
880- struct pxa27x_keyboard_platform_data *pdata = pdev->dev.platform_data;
881- struct input_dev *input_dev;
882- int i, row, col, error;
883-
884- pxakbd_clk = clk_get(&pdev->dev, "KBDCLK");
885- if (IS_ERR(pxakbd_clk)) {
886- error = PTR_ERR(pxakbd_clk);
887- goto err_clk;
888- }
889-
890- /* Create and register the input driver. */
891- input_dev = input_allocate_device();
892- if (!input_dev) {
893- printk(KERN_ERR "Cannot request keypad device\n");
894- error = -ENOMEM;
895- goto err_alloc;
896- }
897-
898- input_dev->name = DRIVER_NAME;
899- input_dev->id.bustype = BUS_HOST;
900- input_dev->open = pxakbd_open;
901- input_dev->close = pxakbd_close;
902- input_dev->dev.parent = &pdev->dev;
903-
904- input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_REP) | BIT(EV_REL);
905- input_dev->relbit[LONG(REL_WHEEL)] = BIT(REL_WHEEL);
906- for (row = 0; row < pdata->nr_rows; row++) {
907- for (col = 0; col < pdata->nr_cols; col++) {
908- int code = pdata->keycodes[row][col];
909- if (code > 0)
910- set_bit(code, input_dev->keybit);
911- }
912- }
913-
914- error = request_irq(IRQ_KEYPAD, pxakbd_irq_handler, IRQF_DISABLED,
915- DRIVER_NAME, pdev);
916- if (error) {
917- printk(KERN_ERR "Cannot request keypad IRQ\n");
918- goto err_free_dev;
919- }
920-
921- platform_set_drvdata(pdev, input_dev);
922-
923- /* Register the input device */
924- error = input_register_device(input_dev);
925- if (error)
926- goto err_free_irq;
927-
928- /* Setup GPIOs. */
929- for (i = 0; i < pdata->nr_rows + pdata->nr_cols; i++)
930- pxa_gpio_mode(pdata->gpio_modes[i]);
931-
932- /*
933- * Store rows/cols info into keyboard registers.
934- */
935-
936- KPC |= (pdata->nr_rows - 1) << 26;
937- KPC |= (pdata->nr_cols - 1) << 23;
938-
939- for (col = 0; col < pdata->nr_cols; col++)
940- KPC |= KPC_MS0 << col;
941-
942- return 0;
943-
944- err_free_irq:
945- platform_set_drvdata(pdev, NULL);
946- free_irq(IRQ_KEYPAD, pdev);
947- err_free_dev:
948- input_free_device(input_dev);
949- err_alloc:
950- clk_put(pxakbd_clk);
951- err_clk:
952- return error;
953-}
954-
955-static int __devexit pxakbd_remove(struct platform_device *pdev)
956-{
957- struct input_dev *input_dev = platform_get_drvdata(pdev);
958-
959- input_unregister_device(input_dev);
960- free_irq(IRQ_KEYPAD, pdev);
961- clk_put(pxakbd_clk);
962- platform_set_drvdata(pdev, NULL);
963-
964- return 0;
965-}
966-
967-static struct platform_driver pxakbd_driver = {
968- .probe = pxakbd_probe,
969- .remove = __devexit_p(pxakbd_remove),
970- .suspend = pxakbd_suspend,
971- .resume = pxakbd_resume,
972- .driver = {
973- .name = DRIVER_NAME,
974- },
975-};
976-
977-static int __init pxakbd_init(void)
978-{
979- return platform_driver_register(&pxakbd_driver);
980-}
981-
982-static void __exit pxakbd_exit(void)
983-{
984- platform_driver_unregister(&pxakbd_driver);
985-}
986-
987-module_init(pxakbd_init);
988-module_exit(pxakbd_exit);
989-
990-MODULE_DESCRIPTION("PXA27x Matrix Keyboard Driver");
991-MODULE_LICENSE("GPL");
992Index: linux-2.6.23-z-input/arch/arm/mach-pxa/zylonite.c
993===================================================================
994--- linux-2.6.23-z-input.orig/arch/arm/mach-pxa/zylonite.c 2008-02-18 01:43:28.000000000 +0100
995+++ linux-2.6.23-z-input/arch/arm/mach-pxa/zylonite.c 2008-02-19 01:31:33.000000000 +0100
996@@ -25,6 +25,7 @@
997 #include <asm/arch/gpio.h>
998 #include <asm/arch/pxafb.h>
999 #include <asm/arch/zylonite.h>
1000+#include <asm/arch/pxa27x_keypad.h>
1001
1002 #include "generic.h"
1003
1004@@ -173,6 +174,72 @@
1005 static inline void zylonite_init_lcd(void) {}
1006 #endif
1007
1008+#if defined(CONFIG_KEYBOARD_PXA27x) || defined(CONFIG_KEYBOARD_PXA27x_MODULES)
1009+static unsigned int zylonite_matrix_key_map[] = {
1010+ /* KEY(row, col, key_code) */
1011+ KEY(0, 0, KEY_A), KEY(0, 1, KEY_B), KEY(0, 2, KEY_C), KEY(0, 5, KEY_D),
1012+ KEY(1, 0, KEY_E), KEY(1, 1, KEY_F), KEY(1, 2, KEY_G), KEY(1, 5, KEY_H),
1013+ KEY(2, 0, KEY_I), KEY(2, 1, KEY_J), KEY(2, 2, KEY_K), KEY(2, 5, KEY_L),
1014+ KEY(3, 0, KEY_M), KEY(3, 1, KEY_N), KEY(3, 2, KEY_O), KEY(3, 5, KEY_P),
1015+ KEY(5, 0, KEY_Q), KEY(5, 1, KEY_R), KEY(5, 2, KEY_S), KEY(5, 5, KEY_T),
1016+ KEY(6, 0, KEY_U), KEY(6, 1, KEY_V), KEY(6, 2, KEY_W), KEY(6, 5, KEY_X),
1017+ KEY(7, 1, KEY_Y), KEY(7, 2, KEY_Z),
1018+
1019+ KEY(4, 4, KEY_0), KEY(1, 3, KEY_1), KEY(4, 1, KEY_2), KEY(1, 4, KEY_3),
1020+ KEY(2, 3, KEY_4), KEY(4, 2, KEY_5), KEY(2, 4, KEY_6), KEY(3, 3, KEY_7),
1021+ KEY(4, 3, KEY_8), KEY(3, 4, KEY_9),
1022+
1023+ KEY(4, 5, KEY_SPACE),
1024+ KEY(5, 3, KEY_KPASTERISK), /* * */
1025+ KEY(5, 4, KEY_KPDOT), /* #" */
1026+
1027+ KEY(0, 7, KEY_UP),
1028+ KEY(1, 7, KEY_DOWN),
1029+ KEY(2, 7, KEY_LEFT),
1030+ KEY(3, 7, KEY_RIGHT),
1031+ KEY(2, 6, KEY_HOME),
1032+ KEY(3, 6, KEY_END),
1033+ KEY(6, 4, KEY_DELETE),
1034+ KEY(6, 6, KEY_BACK),
1035+ KEY(6, 3, KEY_CAPSLOCK), /* KEY_LEFTSHIFT), */
1036+
1037+ KEY(4, 6, KEY_ENTER), /* scroll push */
1038+ KEY(5, 7, KEY_ENTER), /* keypad action */
1039+
1040+ KEY(0, 4, KEY_EMAIL),
1041+ KEY(5, 6, KEY_SEND),
1042+ KEY(4, 0, KEY_CALENDAR),
1043+ KEY(7, 6, KEY_RECORD),
1044+ KEY(6, 7, KEY_VOLUMEUP),
1045+ KEY(7, 7, KEY_VOLUMEDOWN),
1046+
1047+ KEY(0, 6, KEY_F22), /* soft1 */
1048+ KEY(1, 6, KEY_F23), /* soft2 */
1049+ KEY(0, 3, KEY_AUX), /* contact */
1050+};
1051+
1052+static struct pxa27x_keypad_platform_data zylonite_keypad_info = {
1053+ .matrix_key_rows = 8,
1054+ .matrix_key_cols = 8,
1055+ .matrix_key_map = zylonite_matrix_key_map,
1056+ .matrix_key_map_size = ARRAY_SIZE(zylonite_matrix_key_map),
1057+
1058+ .enable_rotary0 = 1,
1059+ .rotary0_up_key = KEY_UP,
1060+ .rotary0_down_key = KEY_DOWN,
1061+
1062+ .debounce_interval = 30,
1063+};
1064+
1065+static void __init zylonite_init_keypad(void)
1066+{
1067+ pxa_set_keypad_info(&zylonite_keypad_info);
1068+}
1069+#else
1070+static inline void zylonite_init_keypad(void) {}
1071+#endif
1072+
1073+
1074 static void __init zylonite_init(void)
1075 {
1076 /* board-processor specific initialization */
1077@@ -190,6 +257,7 @@
1078 platform_device_register(&touch_device);
1079
1080 zylonite_init_lcd();
1081+ zylonite_init_keypad();
1082 }
1083
1084 MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)")
1085Index: linux-2.6.23-z-input/arch/arm/mach-pxa/devices.h
1086===================================================================
1087--- linux-2.6.23-z-input.orig/arch/arm/mach-pxa/devices.h 2008-02-18 01:43:28.000000000 +0100
1088+++ linux-2.6.23-z-input/arch/arm/mach-pxa/devices.h 2008-02-18 01:43:28.000000000 +0100
1089@@ -12,3 +12,4 @@
1090
1091 extern struct platform_device pxa27x_device_i2c_power;
1092 extern struct platform_device pxa27x_device_ohci;
1093+extern struct platform_device pxa27x_device_keypad;
1094Index: linux-2.6.23-z-input/arch/arm/mach-pxa/generic.c
1095===================================================================
1096--- linux-2.6.23-z-input.orig/arch/arm/mach-pxa/generic.c 2008-02-18 01:43:28.000000000 +0100
1097+++ linux-2.6.23-z-input/arch/arm/mach-pxa/generic.c 2008-02-18 01:43:28.000000000 +0100
1098@@ -450,3 +450,34 @@
1099 .name = "sa1100-rtc",
1100 .id = -1,
1101 };
1102+
1103+static struct resource pxa27x_resource_keypad[] = {
1104+ [0] = {
1105+ .start = 0x41500000,
1106+ .end = 0x4150004c,
1107+ .flags = IORESOURCE_MEM,
1108+ },
1109+ [1] = {
1110+ .start = IRQ_KEYPAD,
1111+ .end = IRQ_KEYPAD,
1112+ .flags = IORESOURCE_IRQ,
1113+ },
1114+};
1115+
1116+struct platform_device pxa27x_device_keypad = {
1117+ .name = "pxa27x-keypad",
1118+ .id = -1,
1119+ .resource = pxa27x_resource_keypad,
1120+ .num_resources = ARRAY_SIZE(pxa27x_resource_keypad),
1121+};
1122+
1123+void __init pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info)
1124+{
1125+ int ret;
1126+
1127+ pxa27x_device_keypad.dev.platform_data = info;
1128+
1129+ ret = platform_device_register(&pxa27x_device_keypad);
1130+ if (ret)
1131+ dev_err(&pxa27x_device_keypad.dev, "unable to register device: %d\n", ret);
1132+}
1133Index: linux-2.6.23-z-input/arch/arm/mach-pxa/pxa27x.c
1134===================================================================
1135--- linux-2.6.23-z-input.orig/arch/arm/mach-pxa/pxa27x.c 2008-02-18 01:43:28.000000000 +0100
1136+++ linux-2.6.23-z-input/arch/arm/mach-pxa/pxa27x.c 2008-02-18 01:43:28.000000000 +0100
1137@@ -148,7 +148,7 @@
1138
1139 INIT_CKEN("USBCLK", USB, 48000000, 0, &pxa27x_device_ohci.dev),
1140 INIT_CKEN("I2CCLK", PWRI2C, 13000000, 0, &pxa27x_device_i2c_power.dev),
1141- INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, NULL),
1142+ INIT_CKEN("KBDCLK", KEYPAD, 32768, 0, &pxa27x_device_keypad.dev),
1143
1144 /*
1145 INIT_CKEN("PWMCLK", PWM0, 13000000, 0, NULL),
1146Index: linux-2.6.23-z-input/arch/arm/mach-pxa/pxa3xx.c
1147===================================================================
1148--- linux-2.6.23-z-input.orig/arch/arm/mach-pxa/pxa3xx.c 2008-02-18 01:43:28.000000000 +0100
1149+++ linux-2.6.23-z-input/arch/arm/mach-pxa/pxa3xx.c 2008-02-19 01:32:40.000000000 +0100
1150@@ -159,6 +159,7 @@
1151 static struct clk pxa3xx_clks[] = {
1152 INIT_CK("LCDCLK", LCD, &clk_pxa3xx_hsio_ops, &pxa_device_fb.dev),
1153 INIT_CK("CAMCLK", CAMERA, &clk_pxa3xx_hsio_ops, NULL),
1154+ INIT_CK("KBDCLK", KEYPAD, &clk_pxa3xx_hsio_ops, &pxa27x_device_keypad.dev),
1155
1156 INIT_CKEN("UARTCLK", FFUART, 14857000, 1, &pxa_device_ffuart.dev),
1157 INIT_CKEN("UARTCLK", BTUART, 14857000, 1, &pxa_device_btuart.dev),
1158Index: linux-2.6.23-z-input/include/asm-arm/arch-pxa/irqs.h
1159===================================================================
1160--- linux-2.6.23-z-input.orig/include/asm-arm/arch-pxa/irqs.h 2008-02-18 01:43:28.000000000 +0100
1161+++ linux-2.6.23-z-input/include/asm-arm/arch-pxa/irqs.h 2008-02-18 01:43:28.000000000 +0100
1162@@ -13,7 +13,7 @@
1163
1164 #define PXA_IRQ(x) (x)
1165
1166-#ifdef CONFIG_PXA27x
1167+#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
1168 #define IRQ_SSP3 PXA_IRQ(0) /* SSP3 service request */
1169 #define IRQ_MSL PXA_IRQ(1) /* MSL Interface interrupt */
1170 #define IRQ_USBH2 PXA_IRQ(2) /* USB Host interrupt 1 (OHCI) */
1171Index: linux-2.6.23-z-input/arch/arm/mach-pxa/pxa300.c
1172===================================================================
1173--- linux-2.6.23-z-input.orig/arch/arm/mach-pxa/pxa300.c 2008-02-19 01:33:58.000000000 +0100
1174+++ linux-2.6.23-z-input/arch/arm/mach-pxa/pxa300.c 2008-02-19 01:34:35.000000000 +0100
1175@@ -23,8 +23,10 @@
1176
1177 MFP_ADDR_X(GPIO0, GPIO2, 0x00b4),
1178 MFP_ADDR_X(GPIO3, GPIO26, 0x027c),
1179- MFP_ADDR_X(GPIO27, GPIO127, 0x0400),
1180- MFP_ADDR_X(GPIO0_2, GPIO6_2, 0x02ec),
1181+ MFP_ADDR_X(GPIO27, GPIO98, 0x0400),
1182+ MFP_ADDR_X(GPIO99, GPIO127, 0x0600),
1183+ MFP_ADDR_X(GPIO0_2, GPIO1_2, 0x0674),
1184+ MFP_ADDR_X(GPIO2_2, GPIO6_2, 0x02dc),
1185
1186 MFP_ADDR(nBE0, 0x0204),
1187 MFP_ADDR(nBE1, 0x0208),