Linux Samsung SOC development
 help / color / mirror / Atom feed
* [PATCH] ARM: EXYNOS: Use gpio_request_one
@ 2011-12-12  2:36 Jingoo Han
  2011-12-21  4:18 ` Kukjin Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Jingoo Han @ 2011-12-12  2:36 UTC (permalink / raw)
  To: 'Kukjin Kim', linux-samsung-soc; +Cc: 'Jingoo Han'

By using gpio_request_one it is possible to set the direction
and initial value in one shot. Thus, using gpio_request_one can
make the code simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 arch/arm/mach-exynos/mach-nuri.c           |    4 +---
 arch/arm/mach-exynos/mach-smdkv310.c       |    4 +---
 arch/arm/mach-exynos/mach-universal_c210.c |   10 +++-------
 3 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-nuri.c
index 236bbe1..c96de1f 100644
--- a/arch/arm/mach-exynos/mach-nuri.c
+++ b/arch/arm/mach-exynos/mach-nuri.c
@@ -249,9 +249,7 @@ static int nuri_bl_init(struct device *dev)
 {
 	int ret, gpio = EXYNOS4_GPE2(3);
 
-	ret = gpio_request(gpio, "LCD_LDO_EN");
-	if (!ret)
-		gpio_direction_output(gpio, 0);
+	ret = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, "LCD_LD0_EN");
 
 	return ret;
 }
diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-exynos/mach-smdkv310.c
index cec2afa..cbf31bd 100644
--- a/arch/arm/mach-exynos/mach-smdkv310.c
+++ b/arch/arm/mach-exynos/mach-smdkv310.c
@@ -129,9 +129,7 @@ static void lcd_lte480wv_set_power(struct plat_lcd_data *pd,
 		gpio_free(EXYNOS4_GPD0(1));
 #endif
 		/* fire nRESET on power up */
-		gpio_request(EXYNOS4_GPX0(6), "GPX0");
-
-		gpio_direction_output(EXYNOS4_GPX0(6), 1);
+		gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH, "GPX0");
 		mdelay(100);
 
 		gpio_set_value(EXYNOS4_GPX0(6), 0);
diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-exynos/mach-universal_c210.c
index a2a177f..0a04cd6 100644
--- a/arch/arm/mach-exynos/mach-universal_c210.c
+++ b/arch/arm/mach-exynos/mach-universal_c210.c
@@ -608,8 +608,7 @@ static void __init universal_tsp_init(void)
 
 	/* TSP_LDO_ON: XMDMADDR_11 */
 	gpio = EXYNOS4_GPE2(3);
-	gpio_request(gpio, "TSP_LDO_ON");
-	gpio_direction_output(gpio, 1);
+	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "TSP_LDO_ON");
 	gpio_export(gpio, 0);
 
 	/* TSP_INT: XMDMADDR_7 */
@@ -669,8 +668,7 @@ static void __init universal_touchkey_init(void)
 	i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
 
 	gpio = EXYNOS4_GPE3(3);			/* XMDMDATA_3 */
-	gpio_request(gpio, "3_TOUCH_EN");
-	gpio_direction_output(gpio, 1);
+	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "3_TOUCH_EN");
 }
 
 static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
@@ -1000,9 +998,7 @@ static void __init universal_map_io(void)
 void s5p_tv_setup(void)
 {
 	/* direct HPD to HDMI chip */
-	gpio_request(EXYNOS4_GPX3(7), "hpd-plug");
-
-	gpio_direction_input(EXYNOS4_GPX3(7));
+	gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
 	s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
 	s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] ARM: EXYNOS: Use gpio_request_one
  2011-12-12  2:36 [PATCH] ARM: EXYNOS: Use gpio_request_one Jingoo Han
@ 2011-12-21  4:18 ` Kukjin Kim
  2011-12-21  5:26   ` Jingoo Han
  0 siblings, 1 reply; 3+ messages in thread
From: Kukjin Kim @ 2011-12-21  4:18 UTC (permalink / raw)
  To: 'Jingoo Han', linux-samsung-soc

Jingoo Han wrote:
> 
> By using gpio_request_one it is possible to set the direction
> and initial value in one shot. Thus, using gpio_request_one can
> make the code simpler.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
>  arch/arm/mach-exynos/mach-nuri.c           |    4 +---
>  arch/arm/mach-exynos/mach-smdkv310.c       |    4 +---
>  arch/arm/mach-exynos/mach-universal_c210.c |   10 +++-------
>  3 files changed, 5 insertions(+), 13 deletions(-)
> 
> diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-
> nuri.c
> index 236bbe1..c96de1f 100644
> --- a/arch/arm/mach-exynos/mach-nuri.c
> +++ b/arch/arm/mach-exynos/mach-nuri.c
> @@ -249,9 +249,7 @@ static int nuri_bl_init(struct device *dev)
>  {
>  	int ret, gpio = EXYNOS4_GPE2(3);
> 
> -	ret = gpio_request(gpio, "LCD_LDO_EN");
> -	if (!ret)
> -		gpio_direction_output(gpio, 0);
> +	ret = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, "LCD_LD0_EN");
> 
Looks good, but following is better?

 static int nuri_bl_init(struct device *dev)
 {
-       int ret, gpio = EXYNOS4_GPE2(3);
-
-       ret = gpio_request(gpio, "LCD_LDO_EN");
-       if (!ret)
-               gpio_direction_output(gpio, 0);
-
-       return ret;
+       return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW,
"LCD_LDO_EN");
 }

Others, ok to me.
Could you please re-send?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

>  	return ret;
>  }
> diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-
> exynos/mach-smdkv310.c
> index cec2afa..cbf31bd 100644
> --- a/arch/arm/mach-exynos/mach-smdkv310.c
> +++ b/arch/arm/mach-exynos/mach-smdkv310.c
> @@ -129,9 +129,7 @@ static void lcd_lte480wv_set_power(struct
> plat_lcd_data *pd,
>  		gpio_free(EXYNOS4_GPD0(1));
>  #endif
>  		/* fire nRESET on power up */
> -		gpio_request(EXYNOS4_GPX0(6), "GPX0");
> -
> -		gpio_direction_output(EXYNOS4_GPX0(6), 1);
> +		gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH,
> "GPX0");
>  		mdelay(100);
> 
>  		gpio_set_value(EXYNOS4_GPX0(6), 0);
> diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-
> exynos/mach-universal_c210.c
> index a2a177f..0a04cd6 100644
> --- a/arch/arm/mach-exynos/mach-universal_c210.c
> +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> @@ -608,8 +608,7 @@ static void __init universal_tsp_init(void)
> 
>  	/* TSP_LDO_ON: XMDMADDR_11 */
>  	gpio = EXYNOS4_GPE2(3);
> -	gpio_request(gpio, "TSP_LDO_ON");
> -	gpio_direction_output(gpio, 1);
> +	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "TSP_LDO_ON");
>  	gpio_export(gpio, 0);
> 
>  	/* TSP_INT: XMDMADDR_7 */
> @@ -669,8 +668,7 @@ static void __init universal_touchkey_init(void)
>  	i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
> 
>  	gpio = EXYNOS4_GPE3(3);			/* XMDMDATA_3 */
> -	gpio_request(gpio, "3_TOUCH_EN");
> -	gpio_direction_output(gpio, 1);
> +	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "3_TOUCH_EN");
>  }
> 
>  static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
> @@ -1000,9 +998,7 @@ static void __init universal_map_io(void)
>  void s5p_tv_setup(void)
>  {
>  	/* direct HPD to HDMI chip */
> -	gpio_request(EXYNOS4_GPX3(7), "hpd-plug");
> -
> -	gpio_direction_input(EXYNOS4_GPX3(7));
> +	gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
>  	s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
>  	s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
> 
> --
> 1.7.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] ARM: EXYNOS: Use gpio_request_one
  2011-12-21  4:18 ` Kukjin Kim
@ 2011-12-21  5:26   ` Jingoo Han
  0 siblings, 0 replies; 3+ messages in thread
From: Jingoo Han @ 2011-12-21  5:26 UTC (permalink / raw)
  To: 'Kukjin Kim', linux-samsung-soc; +Cc: 'Jingoo Han'

Kukjin Kim wrote:
> -----Original Message-----
> Subject: RE: [PATCH] ARM: EXYNOS: Use gpio_request_one
> 
> Jingoo Han wrote:
> >
> > By using gpio_request_one it is possible to set the direction
> > and initial value in one shot. Thus, using gpio_request_one can
> > make the code simpler.
> >
> > Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> > ---
> >  arch/arm/mach-exynos/mach-nuri.c           |    4 +---
> >  arch/arm/mach-exynos/mach-smdkv310.c       |    4 +---
> >  arch/arm/mach-exynos/mach-universal_c210.c |   10 +++-------
> >  3 files changed, 5 insertions(+), 13 deletions(-)
> >
> > diff --git a/arch/arm/mach-exynos/mach-nuri.c b/arch/arm/mach-exynos/mach-
> > nuri.c
> > index 236bbe1..c96de1f 100644
> > --- a/arch/arm/mach-exynos/mach-nuri.c
> > +++ b/arch/arm/mach-exynos/mach-nuri.c
> > @@ -249,9 +249,7 @@ static int nuri_bl_init(struct device *dev)
> >  {
> >  	int ret, gpio = EXYNOS4_GPE2(3);
> >
> > -	ret = gpio_request(gpio, "LCD_LDO_EN");
> > -	if (!ret)
> > -		gpio_direction_output(gpio, 0);
> > +	ret = gpio_request_one(gpio, GPIOF_OUT_INIT_LOW, "LCD_LD0_EN");
> >
> Looks good, but following is better?
> 
>  static int nuri_bl_init(struct device *dev)
>  {
> -       int ret, gpio = EXYNOS4_GPE2(3);
> -
> -       ret = gpio_request(gpio, "LCD_LDO_EN");
> -       if (!ret)
> -               gpio_direction_output(gpio, 0);
> -
> -       return ret;
> +       return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW,
> "LCD_LDO_EN");
>  }
> 
> Others, ok to me.
> Could you please re-send?
OK, I will send you v2 patch.
Thank you.
> 
> Thanks.
> 
> Best regards,
> Kgene.
> --
> Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
> SW Solution Development Team, Samsung Electronics Co., Ltd.
> 
> >  	return ret;
> >  }
> > diff --git a/arch/arm/mach-exynos/mach-smdkv310.c b/arch/arm/mach-
> > exynos/mach-smdkv310.c
> > index cec2afa..cbf31bd 100644
> > --- a/arch/arm/mach-exynos/mach-smdkv310.c
> > +++ b/arch/arm/mach-exynos/mach-smdkv310.c
> > @@ -129,9 +129,7 @@ static void lcd_lte480wv_set_power(struct
> > plat_lcd_data *pd,
> >  		gpio_free(EXYNOS4_GPD0(1));
> >  #endif
> >  		/* fire nRESET on power up */
> > -		gpio_request(EXYNOS4_GPX0(6), "GPX0");
> > -
> > -		gpio_direction_output(EXYNOS4_GPX0(6), 1);
> > +		gpio_request_one(EXYNOS4_GPX0(6), GPIOF_OUT_INIT_HIGH,
> > "GPX0");
> >  		mdelay(100);
> >
> >  		gpio_set_value(EXYNOS4_GPX0(6), 0);
> > diff --git a/arch/arm/mach-exynos/mach-universal_c210.c b/arch/arm/mach-
> > exynos/mach-universal_c210.c
> > index a2a177f..0a04cd6 100644
> > --- a/arch/arm/mach-exynos/mach-universal_c210.c
> > +++ b/arch/arm/mach-exynos/mach-universal_c210.c
> > @@ -608,8 +608,7 @@ static void __init universal_tsp_init(void)
> >
> >  	/* TSP_LDO_ON: XMDMADDR_11 */
> >  	gpio = EXYNOS4_GPE2(3);
> > -	gpio_request(gpio, "TSP_LDO_ON");
> > -	gpio_direction_output(gpio, 1);
> > +	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "TSP_LDO_ON");
> >  	gpio_export(gpio, 0);
> >
> >  	/* TSP_INT: XMDMADDR_7 */
> > @@ -669,8 +668,7 @@ static void __init universal_touchkey_init(void)
> >  	i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
> >
> >  	gpio = EXYNOS4_GPE3(3);			/* XMDMDATA_3 */
> > -	gpio_request(gpio, "3_TOUCH_EN");
> > -	gpio_direction_output(gpio, 1);
> > +	gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "3_TOUCH_EN");
> >  }
> >
> >  static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
> > @@ -1000,9 +998,7 @@ static void __init universal_map_io(void)
> >  void s5p_tv_setup(void)
> >  {
> >  	/* direct HPD to HDMI chip */
> > -	gpio_request(EXYNOS4_GPX3(7), "hpd-plug");
> > -
> > -	gpio_direction_input(EXYNOS4_GPX3(7));
> > +	gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
> >  	s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
> >  	s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
> >
> > --
> > 1.7.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-12-21  5:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12  2:36 [PATCH] ARM: EXYNOS: Use gpio_request_one Jingoo Han
2011-12-21  4:18 ` Kukjin Kim
2011-12-21  5:26   ` Jingoo Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox