Add platform device support for keypad driver
Subsystems (2)
PATCH 8/12 Add platform device support for keypad driver
This patch includes platform device information and resources support for s3c keypad driver.
--- arch/arm/plat-s3c/dev-keypad.c | 66 ++++++++++++++++++++++++++++++++++++++++ 1 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 arch/arm/plat-s3c/dev-keypad.c
arch/arm/plat-s3c/dev-keypad.c new file +66 -0
@@ -0,0 +1,66 @@ +/* linux/arch/arm/plat-s3c/dev-keypad.c +* +* Base S3C Keypad resource and device definitions +* +* 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. +* +*/ + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/list.h> +#include <linux/platform_device.h> + +#include <asm/mach/arch.h> +#include <asm/mach/irq.h> +#include <mach/hardware.h> +#include <mach/map.h> + +#include <plat/keypad.h> + +static struct resource s3c_keypad_resource[] = { + [0 ] = { + .start =S3C_PA_KEYPAD , + .end =S3C_PA_KEYPAD +S3C_SZ_KEYPAD -1 , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .start =IRQ_KEYPAD , + .end =IRQ_KEYPAD , + .flags =IORESOURCE_IRQ , + } +}; + +struct platform_device s3c_device_keypad = { + .name ="s3c-keypad" , + .id =-1 , + .num_resources =ARRAY_SIZE (s3c_keypad_resource), + .resource = s3c_keypad_resource, +}; +EXPORT_SYMBOL (s3c_device_keypad); + +static struct s3c_platform_keypad default_keypad_data__initdata = { + .nr_rows =8 , + .nr_cols =8 , + .max_keys =64 , + .max_masks =32 , + .delay =50 , +}; + +void __init s3c_keypad_set_platdata (struct s3c_platform_keypad *pd) +{ +struct s3c_platform_keypad *npd; + +if (!pd) + pd = &default_keypad_data; + + npd =kmemdup (pd,sizeof (struct s3c_platform_keypad ),GFP_KERNEL ); +if (!npd) +printk (KERN_ERR "%s: no memory for platform data\n" , __func__); + + s3c_device_keypad.dev.platform_data = npd; +} +
Signature · 1 line
1.6.2.5
PATCH 8/12 Add platform device support for keypad driver
2009/9/5 ??? <[email protected]>:
Quoted 16 lines
This patch includes platform device information and resources support for s3c keypad driver.
Signed-off-by Jinsung Yang <[email protected]>Signed-off-by Kyeongil Kim <[email protected]>---
?arch/arm/plat-s3c/dev-keypad.c | ? 66 ++++++++++++++++++++++++++++++++++++++++ ?1 files changed, 66 insertions(+), 0 deletions(-)
?create mode 100644arch/arm/plat-s3c/dev-keypad.carch/arm/plat-s3c/dev-keypad.c new file +0
-0
arch/arm/plat-s3c/dev-keypad.c line 1
Quoted 1 line
arch/arm/plat-s3c/dev-keypad.c new file +1
-0@@ -0,0 +1,66 @@ +/* linux/arch/arm/plat-s3c/dev-keypad.c
Where's the copyright? Don't forget to add copyright
Quoted 47 lines
arch/arm/plat-s3c/dev-keypad.c new file +47
-0+* +* Base S3C Keypad resource and device definitions +* +* 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. +* +*/ + +#include <linux/kernel.h> +#include <linux/types.h> +#include <linux/interrupt.h> +#include <linux/list.h> +#include <linux/platform_device.h> + +#include <asm/mach/arch.h> +#include <asm/mach/irq.h> +#include <mach/hardware.h> +#include <mach/map.h> + +#include <plat/keypad.h> + +static struct resource s3c_keypad_resource[] = { + ? ? ? [0] = { + ? ? ? ? ? ? ? .start = S3C_PA_KEYPAD, + ? ? ? ? ? ? ? .end ? = S3C_PA_KEYPAD + S3C_SZ_KEYPAD - 1, + ? ? ? ? ? ? ? .flags = IORESOURCE_MEM, + ? ? ? }, + ? ? ? [1] = { + ? ? ? ? ? ? ? .start = IRQ_KEYPAD, + ? ? ? ? ? ? ? .end ? = IRQ_KEYPAD, + ? ? ? ? ? ? ? .flags = IORESOURCE_IRQ, + ? ? ? } +}; + +struct platform_device s3c_device_keypad = { + ? ? ? .name ? ? ? ? ? = "s3c-keypad", + ? ? ? .id ? ? ? ? ? ? = -1, + ? ? ? .num_resources ?= ARRAY_SIZE(s3c_keypad_resource), + ? ? ? .resource ? ? ? = s3c_keypad_resource, +}; +EXPORT_SYMBOL (s3c_device_keypad); + +static struct s3c_platform_keypad default_keypad_data__initdata = { + ? ? ? .nr_rows = 8, + ? ? ? .nr_cols = 8, + ? ? ? .max_keys = 64,
arch/arm/plat-s3c/dev-keypad.c
Quoted 10 lines
arch/arm/plat-s3c/dev-keypad.c new file +10
-0+ ? ? ? .max_masks = 32, + ? ? ? .delay = 50, +}; + +void __init s3c_keypad_set_platdata (struct s3c_platform_keypad *pd) +{ + ? ? ? struct s3c_platform_keypad *npd; + + ? ? ? if (!pd) + ? ? ? ? ? ? ? pd = &default_keypad_data;
If you want to set the default it. just assign it at platform_device directly. No need to check pd at here.
Thank you,
Kyungmin Park
Quoted 17 lines
arch/arm/plat-s3c/dev-keypad.c new file +8
-1+ + ? ? ? npd = kmemdup(pd, sizeof(struct s3c_platform_keypad), GFP_KERNEL); + ? ? ? if (!npd) + ? ? ? ? ? ? ? printk(KERN_ERR "%s: no memory for platform data\n", __func__); + + ? ? ? s3c_device_keypad.dev.platform_data = npd; +} + --1.6.2.5
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH 8/12 Add platform device support for keypad driver
Hi
Quoted 1 line
Where's the copyright? Don't forget to add copyright
Sorry, I'll add it.
Quoted 10 lines
arch/arm/plat-s3c/dev-keypad.c line 58
Quoted 6 lines
arch/arm/plat-s3c/dev-keypad.c new file +6
-0+void __init s3c_keypad_set_platdata (struct s3c_platform_keypad *pd) +{ +struct s3c_platform_keypad *npd; + +if (!pd) + pd = &default_keypad_data;If you want to set the default it. just assign it at
platform_devicedirectly. No need to check pd at here.
Ok, got it. I will modify with following your comments.
Best Regards
--
Jinsung, Yang <[email protected]>
AP Development Team
System LSI, Semiconductor Business
SAMSUNG Electronics Co., LTD