Skip to contentSkip to conversation

Add support gpio function for keypad device

PATCH New 양진성 3 participants 5 messages Sep 5, 2009 – Sep 7, 2009

Subsystems (2)
lore
Share & tools
lore

양진성

author
#0 lore raw

PATCH 12/12 Add support gpio function for keypad device

This patch includes machine specific gpio function for keypad device which can be changed by platform hardware. The gpio function is related with keypad platform info such as rows and columns of those matrix.

---
 arch/arm/mach-s3c6410/mach-smdk6410.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/mach-s3c6410/mach-smdk6410.c +23 -0
index 95e130d..f297c26 100644
@@ -347,6 +347,28 @@ static struct s3c_platform_keypad keypad_data __initdata = {
 	.delay = 50,
 };
 
+static void s3c_keypad_cfg_gpio(int rows, int columns)
+{
+	unsigned int gpio;
+	unsigned int end;
+
+	end = S3C64XX_GPK(8 + rows);
+
+	/* Set all the necessary GPK pins to special-function 0 */
+	for (gpio = S3C64XX_GPK(8); gpio < end; gpio++) {
+		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+	}
+
+	end = S3C64XX_GPL(0 + columns);
+
+	/* Set all the necessary GPK pins to special-function 0 */
+	for (gpio = S3C64XX_GPL(0); gpio < end; gpio++) {
+		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+	}
+}
+
 static void __init smdk6410_map_io(void)
 {
 	u32 tmp;
@@ -382,6 +404,7 @@ static void __init smdk6410_machine_init(void)
 	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
 
 	s3c_keypad_set_platdata(&keypad_data);
+	s3c_keypad_cfg_gpio(keypad_data.nr_rows, keypad_data.nr_cols);
 
 	platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
 }
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 12/12 Add support gpio function for keypad device

Hi,
I'm sorry for using a little non-English word (my name) when sending 12 patches.
That caused by wrong e-mail client setting, already fixed now :)

Best Regards
--
Jinsung, Yang <[email protected]>
AP Development Team
System LSI, Semiconductor Business
SAMSUNG Electronics Co., LTD

Quoted 73 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of ???
Sent: Saturday, September 05, 2009 10:31 PM
To: ben-linux at fluff.org
Cc: ???/AP???(SYS.LSI)/E3(??)/????; linux-arm-
kernel at lists.infradead.org
Subject: [PATCH 12/12] [ARM][S3C6410] Add support gpio function for keypad device

This patch includes machine specific gpio function for keypad device which can be changed by platform hardware. The gpio function is related with keypad platform info such as rows and columns of those matrix.

---
 arch/arm/mach-s3c6410/mach-smdk6410.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-s3c6410/mach-smdk6410.c +0 -0

s3c6410/mach-smdk6410.c
index 95e130d..f297c26 100644

arch/arm/mach-s3c6410/mach-smdk6410.c +22 -0
@@ -347,6 +347,28 @@ static struct s3c_platform_keypad keypad_data
 __initdata = {
 	.delay = 50,
 };
 
+static void s3c_keypad_cfg_gpio(int rows, int columns)
+{
+	unsigned int gpio;
+	unsigned int end;
+
+	end = S3C64XX_GPK(8 + rows);
+
+	/* Set all the necessary GPK pins to special-function 0 */
+	for (gpio = S3C64XX_GPK(8); gpio < end; gpio++) {
+		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+	}
+
+	end = S3C64XX_GPL(0 + columns);
+
+	/* Set all the necessary GPK pins to special-function 0 */
+	for (gpio = S3C64XX_GPL(0); gpio < end; gpio++) {
+		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+	}
+}
+
 static void __init smdk6410_map_io(void)
 {
arch/arm/mach-s3c6410/mach-smdk6410.c +1 -0
 	u32 tmp;
@@ -382,6 +404,7 @@ static void __init smdk6410_machine_init(void)
 	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
 
 	s3c_keypad_set_platdata(&keypad_data);
+	s3c_keypad_cfg_gpio(keypad_data.nr_rows, keypad_data.nr_cols);
 
 	platform_add_devices(smdk6410_devices,
 ARRAY_SIZE(smdk6410_devices));

}
--
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

#2 lore raw

PATCH 12/12 Add support gpio function for keypad device

Quoted 4 lines · Jinsung Yang

Hi,
I'm sorry for using a little non-English word (my name) when sending 12 patches.
That caused by wrong e-mail client setting, already fixed now :)

Ok, please wait for first pass review before reposting.

Quoted 87 lines

Best Regards
--
Jinsung, Yang <[email protected]>
AP Development Team
System LSI, Semiconductor Business
SAMSUNG Electronics Co., LTD

Quoted 69 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of ???
Sent: Saturday, September 05, 2009 10:31 PM
To: ben-linux at fluff.org
Cc: ???/AP???(SYS.LSI)/E3(??)/????; linux-arm-
kernel at lists.infradead.org
Subject: [PATCH 12/12] [ARM][S3C6410] Add support gpio function for keypad device

This patch includes machine specific gpio function for keypad device which can be changed by platform hardware. The gpio function is related with keypad platform info such as rows and columns of those matrix.

---
 arch/arm/mach-s3c6410/mach-smdk6410.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
arch/arm/mach- renamed from arch/arm/mach-s3c6410/mach-smdk6410.c +0 -0

s3c6410/mach-smdk6410.c
index 95e130d..f297c26 100644

arch/arm/mach-s3c6410/mach-smdk6410.c +22 -0
@@ -347,6 +347,28 @@ static struct s3c_platform_keypad keypad_data
 __initdata = {
 	.delay = 50,
 };
 
+static void s3c_keypad_cfg_gpio(int rows, int columns)
+{
+	unsigned int gpio;
+	unsigned int end;
+
+	end = S3C64XX_GPK(8 + rows);
+
+	/* Set all the necessary GPK pins to special-function 0 */
+	for (gpio = S3C64XX_GPK(8); gpio < end; gpio++) {
+		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+	}
+
+	end = S3C64XX_GPL(0 + columns);
+
+	/* Set all the necessary GPK pins to special-function 0 */
+	for (gpio = S3C64XX_GPL(0); gpio < end; gpio++) {
+		s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+		s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+	}
+}
+
 static void __init smdk6410_map_io(void)
 {
arch/arm/mach-s3c6410/mach-smdk6410.c +1 -0
 	u32 tmp;
@@ -382,6 +404,7 @@ static void __init smdk6410_machine_init(void)
 	i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
 
 	s3c_keypad_set_platdata(&keypad_data);
+	s3c_keypad_cfg_gpio(keypad_data.nr_rows, keypad_data.nr_cols);
 
 	platform_add_devices(smdk6410_devices,
 ARRAY_SIZE(smdk6410_devices));

}
--
1.6.2.5

Quoted 4 lines

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 5 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#3 lore raw

PATCH 12/12 Add support gpio function for keypad device

In reply to 양진성

2009/9/5 ??? <[email protected]>:

Quoted 16 lines

This patch includes machine specific gpio function for keypad device which can be changed by platform hardware. The gpio function is related with keypad platform info such as rows and columns of those matrix.

---
?arch/arm/mach-s3c6410/mach-smdk6410.c | ? 23 +++++++++++++++++++++++ ?1 files changed, 23 insertions(+), 0 deletions(-)

arch/arm/mach-s3c6410/mach-smdk6410.c +0 -0
index 95e130d..f297c26 100644

arch/arm/mach-s3c6410/mach-smdk6410.c static struct s3c_platform_keypad keypad_data __initdata = { · line 348

Quoted 2 lines
arch/arm/mach-s3c6410/mach-smdk6410.c +0 -0
@@ -347,6 +347,28 @@ static struct s3c_platform_keypad keypad_data __initdata = {
 ? ? ? ?.delay = 50,
 ?};

I thinks it's not a good idea to place s3c6410 generic function to board file. please move it platform or mach-s3c6410.

arch/arm/mach-s3c6410/mach-smdk6410.c static struct s3c_platform_keypad keypad_data __initdata = {

Quoted 9 lines
arch/arm/mach-s3c6410/mach-smdk6410.c +8 -0
+static void s3c_keypad_cfg_gpio(int rows, int columns)
+{
+ ? ? ? unsigned int gpio;
+ ? ? ? unsigned int end;
+
+ ? ? ? end = S3C64XX_GPK(8 + rows);
+
+ ? ? ? /* Set all the necessary GPK pins to special-function 0 */

special-function 3?

arch/arm/mach-s3c6410/mach-smdk6410.c static struct s3c_platform_keypad keypad_data __initdata = { · line 364

Quoted 8 lines
arch/arm/mach-s3c6410/mach-smdk6410.c +8 -0
+ ? ? ? for (gpio = S3C64XX_GPK(8); gpio < end; gpio++) {
+ ? ? ? ? ? ? ? s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+ ? ? ? ? ? ? ? s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ ? ? ? }
+
+ ? ? ? end = S3C64XX_GPL(0 + columns);
+
+ ? ? ? /* Set all the necessary GPK pins to special-function 0 */

ditto

Quoted 26 lines
arch/arm/mach-s3c6410/mach-smdk6410.c +7 -1
+ ? ? ? for (gpio = S3C64XX_GPL(0); gpio < end; gpio++) {
+ ? ? ? ? ? ? ? s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+ ? ? ? ? ? ? ? s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+ ? ? ? }
+}
+
 ?static void __init smdk6410_map_io(void)
 ?{
 ? ? ? ?u32 tmp;
@@ -382,6 +404,7 @@ static void __init smdk6410_machine_init(void)
 ? ? ? ?i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
 
 ? ? ? ?s3c_keypad_set_platdata(&keypad_data);
+ ? ? ? s3c_keypad_cfg_gpio(keypad_data.nr_rows, keypad_data.nr_cols);
 
 ? ? ? ?platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
 ?}
--

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

#4 lore raw

PATCH 12/12 Add support gpio function for keypad device

Hi,

Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+
+       /* Set all the necessary GPK pins to special-function 0 */

special-function 3?

Sorry, my mistake

Quoted 11 lines

arch/arm/mach-s3c6410/mach-smdk6410.c static struct s3c_platform_keypad keypad_data __initdata = { · line 365

Quoted 9 lines
arch/arm/mach-s3c6410/mach-smdk6410.c +8 -0
+       for (gpio = S3C64XX_GPK(8); gpio < end; gpio++) {
+               s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(3));
+               s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
+       }
+
+       end = S3C64XX_GPL(0 + columns);
+
+       /* Set all the necessary GPK pins to special-function 0 */

ditto

Also mistake