aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-samsung
diff options
context:
space:
mode:
authorJoonyoung Shim <jy0922.shim@samsung.com>2010-08-06 06:26:10 -0400
committerKukjin Kim <kgene.kim@samsung.com>2010-08-06 08:27:50 -0400
commit995c48adde09e04298036501df9dac87661fa66c (patch)
tree6c5bf7939dac0c6a5f233c6095ad2d68760606ca /arch/arm/plat-samsung
parent929343ef840051b102b67ad1bc8748dbe7c7ce13 (diff)
ARM: SAMSUNG: Add keypad device support
This patch adds Samsung keypad device definition for Samsung SoCs. Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
Diffstat (limited to 'arch/arm/plat-samsung')
-rw-r--r--arch/arm/plat-samsung/Kconfig5
-rw-r--r--arch/arm/plat-samsung/Makefile1
-rw-r--r--arch/arm/plat-samsung/dev-keypad.c50
-rw-r--r--arch/arm/plat-samsung/include/plat/devs.h2
-rw-r--r--arch/arm/plat-samsung/include/plat/keypad.h13
5 files changed, 71 insertions, 0 deletions
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index 15ef1e4026cf..4529dd6232bc 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -237,6 +237,11 @@ config SAMSUNG_DEV_TS
237 help 237 help
238 Common in platform device definitions for touchscreen device 238 Common in platform device definitions for touchscreen device
239 239
240config SAMSUNG_DEV_KEYPAD
241 bool
242 help
243 Compile in platform device definitions for keypad
244
240# DMA 245# DMA
241 246
242config S3C_DMA 247config S3C_DMA
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 75b91b43db49..8594fe73b6d1 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -52,6 +52,7 @@ obj-$(CONFIG_S3C_DEV_RTC) += dev-rtc.o
52obj-$(CONFIG_SAMSUNG_DEV_ADC) += dev-adc.o 52obj-$(CONFIG_SAMSUNG_DEV_ADC) += dev-adc.o
53obj-$(CONFIG_SAMSUNG_DEV_IDE) += dev-ide.o 53obj-$(CONFIG_SAMSUNG_DEV_IDE) += dev-ide.o
54obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o 54obj-$(CONFIG_SAMSUNG_DEV_TS) += dev-ts.o
55obj-$(CONFIG_SAMSUNG_DEV_KEYPAD) += dev-keypad.o
55 56
56# DMA support 57# DMA support
57 58
diff --git a/arch/arm/plat-samsung/dev-keypad.c b/arch/arm/plat-samsung/dev-keypad.c
new file mode 100644
index 000000000000..677c2d731b65
--- /dev/null
+++ b/arch/arm/plat-samsung/dev-keypad.c
@@ -0,0 +1,50 @@
1/*
2 * linux/arch/arm/plat-samsung/dev-keypad.c
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#include <linux/platform_device.h>
15#include <mach/irqs.h>
16#include <mach/map.h>
17#include <plat/cpu.h>
18#include <plat/devs.h>
19#include <plat/keypad.h>
20
21static struct resource samsung_keypad_resources[] = {
22 [0] = {
23 .start = SAMSUNG_PA_KEYPAD,
24 .end = SAMSUNG_PA_KEYPAD + 0x20 - 1,
25 .flags = IORESOURCE_MEM,
26 },
27 [1] = {
28 .start = IRQ_KEYPAD,
29 .end = IRQ_KEYPAD,
30 .flags = IORESOURCE_IRQ,
31 },
32};
33
34struct platform_device samsung_device_keypad = {
35 .name = "samsung-keypad",
36 .id = -1,
37 .num_resources = ARRAY_SIZE(samsung_keypad_resources),
38 .resource = samsung_keypad_resources,
39};
40
41void __init samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd)
42{
43 struct samsung_keypad_platdata *npd;
44
45 npd = s3c_set_platdata(pd, sizeof(struct samsung_keypad_platdata),
46 &samsung_device_keypad);
47
48 if (!npd->cfg_gpio)
49 npd->cfg_gpio = samsung_keypad_cfg_gpio;
50}
diff --git a/arch/arm/plat-samsung/include/plat/devs.h b/arch/arm/plat-samsung/include/plat/devs.h
index 097d0e458ab9..4c31d328669b 100644
--- a/arch/arm/plat-samsung/include/plat/devs.h
+++ b/arch/arm/plat-samsung/include/plat/devs.h
@@ -102,6 +102,8 @@ extern struct platform_device s5pc100_device_iis0;
102extern struct platform_device s5pc100_device_iis1; 102extern struct platform_device s5pc100_device_iis1;
103extern struct platform_device s5pc100_device_iis2; 103extern struct platform_device s5pc100_device_iis2;
104 104
105extern struct platform_device samsung_device_keypad;
106
105/* s3c2440 specific devices */ 107/* s3c2440 specific devices */
106 108
107#ifdef CONFIG_CPU_S3C2440 109#ifdef CONFIG_CPU_S3C2440
diff --git a/arch/arm/plat-samsung/include/plat/keypad.h b/arch/arm/plat-samsung/include/plat/keypad.h
index 3a70c125fe51..b59a6483cd8a 100644
--- a/arch/arm/plat-samsung/include/plat/keypad.h
+++ b/arch/arm/plat-samsung/include/plat/keypad.h
@@ -40,4 +40,17 @@ struct samsung_keypad_platdata {
40 void (*cfg_gpio)(unsigned int rows, unsigned int cols); 40 void (*cfg_gpio)(unsigned int rows, unsigned int cols);
41}; 41};
42 42
43/**
44 * samsung_keypad_set_platdata - Set platform data for Samsung Keypad device.
45 * @pd: Platform data to register to device.
46 *
47 * Register the given platform data for use with Samsung Keypad device.
48 * The call will copy the platform data, so the board definitions can
49 * make the structure itself __initdata.
50 */
51extern void samsung_keypad_set_platdata(struct samsung_keypad_platdata *pd);
52
53/* defined by architecture to configure gpio. */
54extern void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols);
55
43#endif /* __PLAT_SAMSUNG_KEYPAD_H */ 56#endif /* __PLAT_SAMSUNG_KEYPAD_H */