linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846
@ 2012-11-24  8:25 Dmitry Torokhov
  2012-11-27  7:42 ` Sascha Hauer
  0 siblings, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2012-11-24  8:25 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Russell King, linux-arm-kernel, linux-kernel

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

Not tested - no hardware, but should be fine.

 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..b20fc55 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		= (GPIO_PORTD | 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 */
-- 
1.7.11.7


-- 
Dmitry

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

* Re: [PATCH] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846
  2012-11-24  8:25 [PATCH] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846 Dmitry Torokhov
@ 2012-11-27  7:42 ` Sascha Hauer
  2012-11-27  8:00   ` Eric Bénard
  2012-11-27  9:03   ` [PATCH v2] " Dmitry Torokhov
  0 siblings, 2 replies; 8+ messages in thread
From: Sascha Hauer @ 2012-11-27  7:42 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Sascha Hauer, Russell King, linux-arm-kernel, linux-kernel,
	Eric Bénard

On Sat, Nov 24, 2012 at 12:25:30AM -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>
> ---
> 
> Not tested - no hardware, but should be fine.
> 
>  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..b20fc55 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		= (GPIO_PORTD | 25),

Please use IMX_GPIO_NR(4, 25) instead. Otherwise this looks ok.

Eric, ok with you?

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846
  2012-11-27  7:42 ` Sascha Hauer
@ 2012-11-27  8:00   ` Eric Bénard
  2012-11-27  9:03   ` [PATCH v2] " Dmitry Torokhov
  1 sibling, 0 replies; 8+ messages in thread
From: Eric Bénard @ 2012-11-27  8:00 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Dmitry Torokhov, Sascha Hauer, Russell King, linux-arm-kernel,
	linux-kernel

Le Tue, 27 Nov 2012 08:42:09 +0100,
Sascha Hauer <s.hauer@pengutronix.de> a écrit :

> On Sat, Nov 24, 2012 at 12:25:30AM -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>
> > ---
> > 
> > Not tested - no hardware, but should be fine.
> > 
> >  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..b20fc55 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		= (GPIO_PORTD | 25),
> 
> Please use IMX_GPIO_NR(4, 25) instead. Otherwise this looks ok.
> 
> Eric, ok with you?
> 
seems fine.

Eric


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

* [PATCH v2] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846
  2012-11-27  7:42 ` Sascha Hauer
  2012-11-27  8:00   ` Eric Bénard
@ 2012-11-27  9:03   ` Dmitry Torokhov
  2012-12-04 21:09     ` Dmitry Torokhov
  2012-12-08 11:16     ` Sascha Hauer
  1 sibling, 2 replies; 8+ messages in thread
From: Dmitry Torokhov @ 2012-11-27  9:03 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Sascha Hauer, Russell King, linux-arm-kernel, linux-kernel,
	Eric Bénard

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(-)

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 */

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

* Re: [PATCH v2] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846
  2012-11-27  9:03   ` [PATCH v2] " Dmitry Torokhov
@ 2012-12-04 21:09     ` Dmitry Torokhov
  2012-12-04 21:32       ` Eric Bénard
  2012-12-08 11:16     ` Sascha Hauer
  1 sibling, 1 reply; 8+ messages in thread
From: Dmitry Torokhov @ 2012-12-04 21:09 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Sascha Hauer, Russell King, linux-arm-kernel, linux-kernel,
	Eric Bénard

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 */

-- 
Dmitry

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

* Re: [PATCH v2] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846
  2012-12-04 21:09     ` Dmitry Torokhov
@ 2012-12-04 21:32       ` Eric Bénard
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Bénard @ 2012-12-04 21:32 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Sascha Hauer, Sascha Hauer, Russell King, linux-arm-kernel, linux-kernel

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>

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

* Re: [PATCH v2] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846
  2012-11-27  9:03   ` [PATCH v2] " Dmitry Torokhov
  2012-12-04 21:09     ` Dmitry Torokhov
@ 2012-12-08 11:16     ` Sascha Hauer
  2012-12-08 19:45       ` Fabio Estevam
  1 sibling, 1 reply; 8+ messages in thread
From: Sascha Hauer @ 2012-12-08 11:16 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Sascha Hauer, Russell King, linux-arm-kernel, linux-kernel,
	Eric Bénard

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 */
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH v2] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846
  2012-12-08 11:16     ` Sascha Hauer
@ 2012-12-08 19:45       ` Fabio Estevam
  0 siblings, 0 replies; 8+ messages in thread
From: Fabio Estevam @ 2012-12-08 19:45 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: Dmitry Torokhov, Eric Bénard, Russell King,
	linux-arm-kernel, Sascha Hauer, linux-kernel

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

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

end of thread, other threads:[~2012-12-08 19:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-24  8:25 [PATCH] ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846 Dmitry Torokhov
2012-11-27  7:42 ` Sascha Hauer
2012-11-27  8:00   ` Eric Bénard
2012-11-27  9:03   ` [PATCH v2] " Dmitry Torokhov
2012-12-04 21:09     ` Dmitry Torokhov
2012-12-04 21:32       ` Eric Bénard
2012-12-08 11:16     ` Sascha Hauer
2012-12-08 19:45       ` Fabio Estevam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).