Patchwork [v2] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846

login
register
mail settings
Submitter Dmitry Torokhov
Date Nov. 27, 2012, 9:03 a.m.
Message ID <20121127090356.GA25658@core.coreip.homeip.net>
Download mbox | patch
Permalink /patch/202129/
State New
Headers show

Comments

Dmitry Torokhov - Nov. 27, 2012, 9:03 a.m.
The default implementation matches exactly our custom one so we can switch
to using the default one. As a bonus the driver will take care of setting
GPIO line for us.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---

Adjusted to use IMX_GPIO_NR() macro.

 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
Dmitry Torokhov - Dec. 4, 2012, 9:09 p.m.
On Tue, Nov 27, 2012 at 01:03:56AM -0800, Dmitry Torokhov wrote:
> The default implementation matches exactly our custom one so we can switch
> to using the default one. As a bonus the driver will take care of setting
> GPIO line for us.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Eric, Sascha, could I get a formal ack on this one please ?

> ---
> 
> Adjusted to use IMX_GPIO_NR() macro.
> 
>  arch/arm/mach-imx/eukrea_mbimx27-baseboard.c |   19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
> index 98aef57..f361143 100644
> --- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
> +++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
> @@ -238,24 +238,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
>  	.flags = IMXUART_HAVE_RTSCTS,
>  };
>  
> -#define ADS7846_PENDOWN (GPIO_PORTD | 25)
> -
> -static void __maybe_unused ads7846_dev_init(void)
> -{
> -	if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) {
> -		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
> -		return;
> -	}
> -	gpio_direction_input(ADS7846_PENDOWN);
> -}
> -
> -static int ads7846_get_pendown_state(void)
> -{
> -	return !gpio_get_value(ADS7846_PENDOWN);
> -}
> -
>  static struct ads7846_platform_data ads7846_config __initdata = {
> -	.get_pendown_state	= ads7846_get_pendown_state,
> +	.gpio_pendown		= IMX_GPIO_NR(4, 25),
>  	.keep_vref_on		= 1,
>  };
>  
> @@ -323,7 +307,6 @@ void __init eukrea_mbimx27_baseboard_init(void)
>  	|| defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
>  	/* ADS7846 Touchscreen controller init */
>  	mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN);
> -	ads7846_dev_init();
>  #endif
>  
>  	/* SPI_CS0 init */
Eric Benard - Dec. 4, 2012, 9:32 p.m.
Le Tue, 4 Dec 2012 13:09:22 -0800,
Dmitry Torokhov <dmitry.torokhov@gmail.com> a écrit :

> On Tue, Nov 27, 2012 at 01:03:56AM -0800, Dmitry Torokhov wrote:
> > The default implementation matches exactly our custom one so we can switch
> > to using the default one. As a bonus the driver will take care of setting
> > GPIO line for us.
> > 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> Eric, Sascha, could I get a formal ack on this one please ?
> 
Acked-by: Eric Bénard <eric@eukrea.com>
Sascha Hauer - Dec. 8, 2012, 11:16 a.m.
On Tue, Nov 27, 2012 at 01:03:56AM -0800, Dmitry Torokhov wrote:
> The default implementation matches exactly our custom one so we can switch
> to using the default one. As a bonus the driver will take care of setting
> GPIO line for us.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Applied, thanks

Sascha

> ---
> 
> Adjusted to use IMX_GPIO_NR() macro.
> 
>  arch/arm/mach-imx/eukrea_mbimx27-baseboard.c |   19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
> index 98aef57..f361143 100644
> --- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
> +++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
> @@ -238,24 +238,8 @@ static const struct imxuart_platform_data uart_pdata __initconst = {
>  	.flags = IMXUART_HAVE_RTSCTS,
>  };
>  
> -#define ADS7846_PENDOWN (GPIO_PORTD | 25)
> -
> -static void __maybe_unused ads7846_dev_init(void)
> -{
> -	if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) {
> -		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
> -		return;
> -	}
> -	gpio_direction_input(ADS7846_PENDOWN);
> -}
> -
> -static int ads7846_get_pendown_state(void)
> -{
> -	return !gpio_get_value(ADS7846_PENDOWN);
> -}
> -
>  static struct ads7846_platform_data ads7846_config __initdata = {
> -	.get_pendown_state	= ads7846_get_pendown_state,
> +	.gpio_pendown		= IMX_GPIO_NR(4, 25),
>  	.keep_vref_on		= 1,
>  };
>  
> @@ -323,7 +307,6 @@ void __init eukrea_mbimx27_baseboard_init(void)
>  	|| defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
>  	/* ADS7846 Touchscreen controller init */
>  	mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN);
> -	ads7846_dev_init();
>  #endif
>  
>  	/* SPI_CS0 init */
>
Fabio Estevam - Dec. 8, 2012, 7:45 p.m.
Hi Sascha,

On Sat, Dec 8, 2012 at 9:16 AM, Sascha Hauer <s.hauer@pengutronix.de> wrote:
> On Tue, Nov 27, 2012 at 01:03:56AM -0800, Dmitry Torokhov wrote:
>> The default implementation matches exactly our custom one so we can switch
>> to using the default one. As a bonus the driver will take care of setting
>> GPIO line for us.
>>
>> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
>
> Applied, thanks

Which tree did you apply this against? I cannot see it in git.pengutronix.de.

Regards,

Fabio Estevam

Patch

diff --git a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
index 98aef57..f361143 100644
--- a/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
@@ -238,24 +238,8 @@  static const struct imxuart_platform_data uart_pdata __initconst = {
 	.flags = IMXUART_HAVE_RTSCTS,
 };
 
-#define ADS7846_PENDOWN (GPIO_PORTD | 25)
-
-static void __maybe_unused ads7846_dev_init(void)
-{
-	if (gpio_request(ADS7846_PENDOWN, "ADS7846 pendown") < 0) {
-		printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
-		return;
-	}
-	gpio_direction_input(ADS7846_PENDOWN);
-}
-
-static int ads7846_get_pendown_state(void)
-{
-	return !gpio_get_value(ADS7846_PENDOWN);
-}
-
 static struct ads7846_platform_data ads7846_config __initdata = {
-	.get_pendown_state	= ads7846_get_pendown_state,
+	.gpio_pendown		= IMX_GPIO_NR(4, 25),
 	.keep_vref_on		= 1,
 };
 
@@ -323,7 +307,6 @@  void __init eukrea_mbimx27_baseboard_init(void)
 	|| defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
 	/* ADS7846 Touchscreen controller init */
 	mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN);
-	ads7846_dev_init();
 #endif
 
 	/* SPI_CS0 init */