Skip to contentSkip to conversation

ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846

PATCH Superseded Dmitry Torokhov 4 participants 8 messages Nov 24, 2012 – Dec 8, 2012

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846

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.

---

Not tested - no hardware, but should be fine.

 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +1 -18
index 98aef57..b20fc55 100644
@@ -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 */
Signature · 5 lines
1.7.11.7


-- 
Dmitry
maintainer
#1 lore raw
Quoted 29 lines · Dmitry Torokhov

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.

---

Not tested - no hardware, but should be fine.

 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +0 -9
index 98aef57..b20fc55 100644
@@ -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);

arch/arm/mach-imx/eukrea_mbimx27-baseboard.c static const struct imxuart_platform_data uart_pdata __initconst = { · line 242

Quoted 10 lines
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +1 -8
-}
-
-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

Signature · 4 lines
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 |
#2 lore raw

Le Tue, 27 Nov 2012 08:42:09 +0100,
Sascha Hauer <[email protected]> a ?crit :

Quoted 43 lines · Dmitry Torokhov
Quoted 29 lines

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.

---

Not tested - no hardware, but should be fine.

 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c | 19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +0 -9
index 98aef57..b20fc55 100644
@@ -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);

arch/arm/mach-imx/eukrea_mbimx27-baseboard.c static const struct imxuart_platform_data uart_pdata __initconst = { · line 242

Quoted 10 lines
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +1 -8
-}
-
-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.

Quoted 2 lines

Eric, ok with you?

seems fine.

Eric

#3 lore raw

PATCH v2 1/1 ARM: eukrea_mbimx27-baseboard - use stock get_pendown_state() in ads7846

In reply to Sascha Hauer

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.

---

Adjusted to use IMX_GPIO_NR() macro.

 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +1 -18
index 98aef57..f361143 100644
@@ -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 */
#4 lore raw
Quoted 5 lines · Dmitry Torokhov

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.

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

Quoted 45 lines

---

Adjusted to use IMX_GPIO_NR() macro.

 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +1 -18
index 98aef57..f361143 100644
@@ -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 */
Signature · 1 line
Dmitry
Acked-by
#5 lore raw

Le Tue, 4 Dec 2012 13:09:22 -0800,
Dmitry Torokhov <[email protected]> a ?crit :

Quoted 9 lines · Dmitry Torokhov
Quoted 5 lines

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.

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

maintainer Applied
#6 lore raw
In reply to Dmitry Torokhov
Quoted 5 lines · Dmitry Torokhov

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.

Applied, thanks

Sascha

Quoted 46 lines

---

Adjusted to use IMX_GPIO_NR() macro.

 arch/arm/mach-imx/eukrea_mbimx27-baseboard.c |   19 +------------------
 1 file changed, 1 insertion(+), 18 deletions(-)
arch/arm/mach-imx/eukrea_mbimx27-baseboard.c +1 -18
index 98aef57..f361143 100644
@@ -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 */
Signature · 4 lines
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 |
reviewer
#7 lore raw

Hi Sascha,

Quoted 8 lines · Sascha Hauer
Quoted 5 lines · Dmitry Torokhov

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.

Applied, thanks

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

Regards,

Fabio Estevam