All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [OMAP] Cleanup Beagleboard DVI reset gpio
@ 2012-05-07 20:00 Russ Dill
  2012-05-08  8:41 ` Igor Grinberg
  0 siblings, 1 reply; 20+ messages in thread
From: Russ Dill @ 2012-05-07 20:00 UTC (permalink / raw)
  To: linux-omap; +Cc: chase.maupin, Russ Dill

This removes several boot warnings from board-omap3beagle.c:

 - gpio_request: gpio--22 (DVI reset) status -22
 - Unable to get DVI reset GPIO

There is a combination of leftover code and revision confusion.
Additionally, xM support is currently a hack.

For original Beagleboard this removes the double initialization of GPIO
170, properly configures it as an output, and wraps the initialization
in an if block so that xM does not attempt to request it.

For Beagleboard xM it removes reference to GPIO 129 which was part
of rev A1 and A2 designs, but never functioned. It then properly assigns
beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
hack of initializing it high.

Unfortunately, there is no way to tell the difference between xM A2 and
A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
problems created by this fix.

Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   35 +++++++++++++++++--------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 3b9647a..fcb7b56 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -86,7 +86,7 @@ static struct {
 } beagle_config = {
 	.mmc1_gpio_wp = -EINVAL,
 	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
-	.reset_gpio = 129,
+	.reset_gpio = -EINVAL,
 	.usr_button_gpio = 4,
 };
 
@@ -238,12 +238,17 @@ static struct omap_dss_board_info beagle_dss_data = {
 
 static void __init beagle_display_init(void)
 {
-	int r;
-
-	r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
-			     "DVI reset");
-	if (r < 0)
-		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
+	if (beagle_config.reset_gpio != -EINVAL) {
+		int r;
+
+		omap_mux_init_gpio(beagle_config.reset_gpio, OMAP_PIN_OUTPUT);
+		r = gpio_request_one(beagle_config.reset_gpio,
+				     GPIOF_OUT_INIT_LOW, "DVI reset");
+		if (r < 0)
+			printk(KERN_ERR "Unable to get DVI reset GPIO\n");
+		else
+			beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
+	}
 }
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -296,11 +301,14 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (r)
 			pr_err("%s: unable to configure nDVI_PWR_EN\n",
 				__func__);
-		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
-				     "DVI_LDO_EN");
+
+		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW,
+				     "DVI_PU");
 		if (r)
-			pr_err("%s: unable to configure DVI_LDO_EN\n",
-				__func__);
+			pr_err("%s: unable to get DVI_PU GPIO\n", __func__);
+		else
+			beagle_dvi_device.reset_gpio = gpio + 2;
+
 	} else {
 		/*
 		 * REVISIT: need ehci-omap hooks for external VBUS
@@ -309,7 +317,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
 			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
 	}
-	beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
 
 	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
 			"nEN_USB_PWR");
@@ -540,10 +547,6 @@ static void __init omap3_beagle_init(void)
 	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
 				  mt46h32m32lf6_sdrc_params);
 
-	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
-	/* REVISIT leave DVI powered down until it's needed ... */
-	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
-
 	usb_musb_init(NULL);
 	usbhs_init(&usbhs_bdata);
 	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
-- 
1.7.9.5


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

* Re: [PATCH] [OMAP] Cleanup Beagleboard DVI reset gpio
  2012-05-07 20:00 [PATCH] [OMAP] Cleanup Beagleboard DVI reset gpio Russ Dill
@ 2012-05-08  8:41 ` Igor Grinberg
  2012-05-08 18:43   ` [PATCH v2] " Russ Dill
  0 siblings, 1 reply; 20+ messages in thread
From: Igor Grinberg @ 2012-05-08  8:41 UTC (permalink / raw)
  To: Russ Dill; +Cc: linux-omap, chase.maupin

Hi Russ,

On 05/07/12 23:00, Russ Dill wrote:
> This removes several boot warnings from board-omap3beagle.c:
> 
>  - gpio_request: gpio--22 (DVI reset) status -22
>  - Unable to get DVI reset GPIO
> 
> There is a combination of leftover code and revision confusion.
> Additionally, xM support is currently a hack.
> 
> For original Beagleboard this removes the double initialization of GPIO
> 170, properly configures it as an output, and wraps the initialization
> in an if block so that xM does not attempt to request it.
> 
> For Beagleboard xM it removes reference to GPIO 129 which was part
> of rev A1 and A2 designs, but never functioned. It then properly assigns
> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
> hack of initializing it high.
> 
> Unfortunately, there is no way to tell the difference between xM A2 and
> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
> problems created by this fix.
> 
> Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.
> 
> Signed-off-by: Russ Dill <Russ.Dill@ti.com>
> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |   35 +++++++++++++++++--------------
>  1 file changed, 19 insertions(+), 16 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index 3b9647a..fcb7b56 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -86,7 +86,7 @@ static struct {
>  } beagle_config = {
>  	.mmc1_gpio_wp = -EINVAL,
>  	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
> -	.reset_gpio = 129,
> +	.reset_gpio = -EINVAL,

While, you are at this one, can you please add a comment
on what device does this gpio reset?

>  	.usr_button_gpio = 4,
>  };
>  
> @@ -238,12 +238,17 @@ static struct omap_dss_board_info beagle_dss_data = {
>  
>  static void __init beagle_display_init(void)
>  {
> -	int r;
> -
> -	r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
> -			     "DVI reset");
> -	if (r < 0)
> -		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
> +	if (beagle_config.reset_gpio != -EINVAL) {

Should this be:
if (gpio_is_valid(beagle_config.reset_gpio)) {
?

> +		int r;
> +
> +		omap_mux_init_gpio(beagle_config.reset_gpio, OMAP_PIN_OUTPUT);
> +		r = gpio_request_one(beagle_config.reset_gpio,
> +				     GPIOF_OUT_INIT_LOW, "DVI reset");
> +		if (r < 0)
> +			printk(KERN_ERR "Unable to get DVI reset GPIO\n");
> +		else
> +			beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
> +	}
>  }
>  
>  #include "sdram-micron-mt46h32m32lf-6.h"
> @@ -296,11 +301,14 @@ static int beagle_twl_gpio_setup(struct device *dev,
>  		if (r)
>  			pr_err("%s: unable to configure nDVI_PWR_EN\n",
>  				__func__);
> -		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
> -				     "DVI_LDO_EN");
> +
> +		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW,
> +				     "DVI_PU");
>  		if (r)
> -			pr_err("%s: unable to configure DVI_LDO_EN\n",
> -				__func__);
> +			pr_err("%s: unable to get DVI_PU GPIO\n", __func__);
> +		else
> +			beagle_dvi_device.reset_gpio = gpio + 2;
> +
>  	} else {
>  		/*
>  		 * REVISIT: need ehci-omap hooks for external VBUS
> @@ -309,7 +317,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
>  		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
>  			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
>  	}
> -	beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
>  
>  	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
>  			"nEN_USB_PWR");
> @@ -540,10 +547,6 @@ static void __init omap3_beagle_init(void)
>  	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
>  				  mt46h32m32lf6_sdrc_params);
>  
> -	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
> -	/* REVISIT leave DVI powered down until it's needed ... */
> -	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
> -
>  	usb_musb_init(NULL);
>  	usbhs_init(&usbhs_bdata);
>  	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,

-- 
Regards,
Igor.

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

* [PATCH v2] [OMAP] Cleanup Beagleboard DVI reset gpio
  2012-05-08  8:41 ` Igor Grinberg
@ 2012-05-08 18:43   ` Russ Dill
  2012-05-08 22:13     ` Kevin Hilman
  0 siblings, 1 reply; 20+ messages in thread
From: Russ Dill @ 2012-05-08 18:43 UTC (permalink / raw)
  To: linux-omap; +Cc: chase.maupin, Igor Grinberg, Russ Dill

This removes several boot warnings from board-omap3beagle.c:

 - gpio_request: gpio--22 (DVI reset) status -22
 - Unable to get DVI reset GPIO

There is a combination of leftover code and revision confusion.
Additionally, xM support is currently a hack.

For original Beagleboard this removes the double initialization of GPIO
170, properly configures it as an output, and wraps the initialization
in an if block so that xM does not attempt to request it.

For Beagleboard xM it removes reference to GPIO 129 which was part
of rev A1 and A2 designs, but never functioned. It then properly assigns
beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
hack of initializing it high. Additionally, it uses
gpio_set_value_cansleep since this GPIO is connected through i2c.

Unfortunately, there is no way to tell the difference between xM A2 and
A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
problems created by this fix.

v2
  - Rename reset_gpio to dvi_reset_gpio to self document
  - Use gpio_set_value_cansleep since TWL gpio can sleep
  - Use gpio_is_valid instead of -EINVAL check

Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   41 +++++++++++++++++--------------
 1 file changed, 22 insertions(+), 19 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 495b810..4942be8 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -87,7 +87,7 @@ static struct {
 } beagle_config = {
 	.mmc1_gpio_wp = -EINVAL,
 	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
-	.reset_gpio = 129,
+	.reset_gpio = -EINVAL,
 	.usr_button_gpio = 4,
 	.mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 };
@@ -196,7 +196,7 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
 static int beagle_enable_dvi(struct omap_dss_device *dssdev)
 {
 	if (gpio_is_valid(dssdev->reset_gpio))
-		gpio_set_value(dssdev->reset_gpio, 1);
+		gpio_set_value_cansleep(dssdev->reset_gpio, 1);
 
 	return 0;
 }
@@ -204,7 +204,7 @@ static int beagle_enable_dvi(struct omap_dss_device *dssdev)
 static void beagle_disable_dvi(struct omap_dss_device *dssdev)
 {
 	if (gpio_is_valid(dssdev->reset_gpio))
-		gpio_set_value(dssdev->reset_gpio, 0);
+		gpio_set_value_cansleep(dssdev->reset_gpio, 0);
 }
 
 static struct panel_dvi_platform_data dvi_panel = {
@@ -242,12 +242,17 @@ static struct omap_dss_board_info beagle_dss_data = {
 
 static void __init beagle_display_init(void)
 {
-	int r;
-
-	r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
-			     "DVI reset");
-	if (r < 0)
-		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
+	if (gpio_is_valid(beagle_config.reset_gpio)) {
+		int r;
+
+		omap_mux_init_gpio(beagle_config.reset_gpio, OMAP_PIN_OUTPUT);
+		r = gpio_request_one(beagle_config.reset_gpio,
+				     GPIOF_OUT_INIT_LOW, "DVI reset");
+		if (r < 0)
+			printk(KERN_ERR "Unable to get DVI reset GPIO\n");
+		else
+			beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
+	}
 }
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -299,11 +304,14 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (r)
 			pr_err("%s: unable to configure nDVI_PWR_EN\n",
 				__func__);
-		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
-				     "DVI_LDO_EN");
+
+		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW,
+				     "DVI_PU");
 		if (r)
-			pr_err("%s: unable to configure DVI_LDO_EN\n",
-				__func__);
+			pr_err("%s: unable to get DVI_PU GPIO\n", __func__);
+		else
+			beagle_dvi_device.reset_gpio = gpio + 2;
+
 	} else {
 		/*
 		 * REVISIT: need ehci-omap hooks for external VBUS
@@ -312,7 +320,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
 			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
 	}
-	beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
 
 	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
 			"nEN_USB_PWR");
@@ -524,7 +531,7 @@ static void __init omap3_beagle_init(void)
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap3_beagle_init_rev();
 
-	if (beagle_config.mmc1_gpio_wp != -EINVAL)
+	if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
 		omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
 	mmc[0].caps = beagle_config.mmc_caps;
 	omap_hsmmc_init(mmc);
@@ -540,10 +547,6 @@ static void __init omap3_beagle_init(void)
 	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
 				  mt46h32m32lf6_sdrc_params);
 
-	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
-	/* REVISIT leave DVI powered down until it's needed ... */
-	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
-
 	usb_musb_init(NULL);
 	usbhs_init(&usbhs_bdata);
 	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
-- 
1.7.9.5


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

* Re: [PATCH v2] [OMAP] Cleanup Beagleboard DVI reset gpio
  2012-05-08 18:43   ` [PATCH v2] " Russ Dill
@ 2012-05-08 22:13     ` Kevin Hilman
  2012-05-09  2:49         ` Russ Dill
  0 siblings, 1 reply; 20+ messages in thread
From: Kevin Hilman @ 2012-05-08 22:13 UTC (permalink / raw)
  To: Russ Dill; +Cc: linux-omap, chase.maupin, Igor Grinberg

Hi Russ,

Russ Dill <Russ.Dill@ti.com> writes:

> This removes several boot warnings from board-omap3beagle.c:
>
>  - gpio_request: gpio--22 (DVI reset) status -22
>  - Unable to get DVI reset GPIO

Thanks for your patches and revies on the list!  It's much appreciated.

Some requests for upstream-bound OMAP patches:

1) subject/shortlog prefix should be ARM: OMAP: [subsystem]: ...
   e.g. for this one ARM: OMAP: Beagleboard: cleanup DVI reset GPIO

2) please Cc: linux-arm-kernel@lists.infradead.org as well
 
Thanks,

Kevin

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

* [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
  2012-05-08 22:13     ` Kevin Hilman
@ 2012-05-09  2:49         ` Russ Dill
  0 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-09  2:49 UTC (permalink / raw)
  To: linux-omap; +Cc: chase.maupin, linux-arm-kernel, Igor Grinberg, Russ Dill

This removes several boot warnings from board-omap3beagle.c:

 - gpio_request: gpio--22 (DVI reset) status -22
 - Unable to get DVI reset GPIO

There is a combination of leftover code and revision confusion.
Additionally, xM support is currently a hack.

For original Beagleboard this removes the double initialization of GPIO
170, properly configures it as an output, and wraps the initialization
in an if block so that xM does not attempt to request it.

For Beagleboard xM it removes reference to GPIO 129 which was part
of rev A1 and A2 designs, but never functioned. It then properly assigns
beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
hack of initializing it high. Additionally, it uses
gpio_set_value_cansleep since this GPIO is connected through i2c.

Unfortunately, there is no way to tell the difference between xM A2 and
A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
problems created by this fix.

v3
 - Change patch title to include 'ARM: OMAP:'
 - Actually rename reset_gpio to dvi_reset_gpio

v2
 - Rename reset_gpio to dvi_reset_gpio to self document
 - Use gpio_set_value_cansleep since TWL gpio can sleep
 - Use gpio_is_valid instead of -EINVAL check

Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   49 ++++++++++++++++---------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 495b810..3956c51 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -81,13 +81,13 @@ static u8 omap3_beagle_version;
 static struct {
 	int mmc1_gpio_wp;
 	int usb_pwr_level;
-	int reset_gpio;
+	int dvi_reset_gpio;
 	int usr_button_gpio;
 	int mmc_caps;
 } beagle_config = {
 	.mmc1_gpio_wp = -EINVAL,
 	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
-	.reset_gpio = 129,
+	.dvi_reset_gpio = -EINVAL,
 	.usr_button_gpio = 4,
 	.mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 };
@@ -126,21 +126,21 @@ static void __init omap3_beagle_init_rev(void)
 		printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
 		beagle_config.mmc1_gpio_wp = 29;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_reset_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 6:
 		printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
 		beagle_config.mmc1_gpio_wp = 23;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_reset_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 5:
 		printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
 		beagle_config.mmc1_gpio_wp = 23;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_reset_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 0:
@@ -196,7 +196,7 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
 static int beagle_enable_dvi(struct omap_dss_device *dssdev)
 {
 	if (gpio_is_valid(dssdev->reset_gpio))
-		gpio_set_value(dssdev->reset_gpio, 1);
+		gpio_set_value_cansleep(dssdev->reset_gpio, 1);
 
 	return 0;
 }
@@ -204,7 +204,7 @@ static int beagle_enable_dvi(struct omap_dss_device *dssdev)
 static void beagle_disable_dvi(struct omap_dss_device *dssdev)
 {
 	if (gpio_is_valid(dssdev->reset_gpio))
-		gpio_set_value(dssdev->reset_gpio, 0);
+		gpio_set_value_cansleep(dssdev->reset_gpio, 0);
 }
 
 static struct panel_dvi_platform_data dvi_panel = {
@@ -242,12 +242,17 @@ static struct omap_dss_board_info beagle_dss_data = {
 
 static void __init beagle_display_init(void)
 {
-	int r;
-
-	r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
-			     "DVI reset");
-	if (r < 0)
-		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
+	if (gpio_is_valid(beagle_config.dvi_reset_gpio)) {
+		int r;
+
+		omap_mux_init_gpio(beagle_config.dvi_reset_gpio, OMAP_PIN_OUTPUT);
+		r = gpio_request_one(beagle_config.dvi_reset_gpio,
+				     GPIOF_OUT_INIT_LOW, "DVI reset");
+		if (r < 0)
+			printk(KERN_ERR "Unable to get DVI reset GPIO\n");
+		else
+			beagle_dvi_device.reset_gpio = beagle_config.dvi_reset_gpio;
+	}
 }
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -299,11 +304,14 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (r)
 			pr_err("%s: unable to configure nDVI_PWR_EN\n",
 				__func__);
-		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
-				     "DVI_LDO_EN");
+
+		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW,
+				     "DVI_PU");
 		if (r)
-			pr_err("%s: unable to configure DVI_LDO_EN\n",
-				__func__);
+			pr_err("%s: unable to get DVI_PU GPIO\n", __func__);
+		else
+			beagle_dvi_device.reset_gpio = gpio + 2;
+
 	} else {
 		/*
 		 * REVISIT: need ehci-omap hooks for external VBUS
@@ -312,7 +320,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
 			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
 	}
-	beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
 
 	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
 			"nEN_USB_PWR");
@@ -524,7 +531,7 @@ static void __init omap3_beagle_init(void)
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap3_beagle_init_rev();
 
-	if (beagle_config.mmc1_gpio_wp != -EINVAL)
+	if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
 		omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
 	mmc[0].caps = beagle_config.mmc_caps;
 	omap_hsmmc_init(mmc);
@@ -540,10 +547,6 @@ static void __init omap3_beagle_init(void)
 	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
 				  mt46h32m32lf6_sdrc_params);
 
-	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
-	/* REVISIT leave DVI powered down until it's needed ... */
-	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
-
 	usb_musb_init(NULL);
 	usbhs_init(&usbhs_bdata);
 	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
-- 
1.7.9.5


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

* [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
@ 2012-05-09  2:49         ` Russ Dill
  0 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-09  2:49 UTC (permalink / raw)
  To: linux-arm-kernel

This removes several boot warnings from board-omap3beagle.c:

 - gpio_request: gpio--22 (DVI reset) status -22
 - Unable to get DVI reset GPIO

There is a combination of leftover code and revision confusion.
Additionally, xM support is currently a hack.

For original Beagleboard this removes the double initialization of GPIO
170, properly configures it as an output, and wraps the initialization
in an if block so that xM does not attempt to request it.

For Beagleboard xM it removes reference to GPIO 129 which was part
of rev A1 and A2 designs, but never functioned. It then properly assigns
beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
hack of initializing it high. Additionally, it uses
gpio_set_value_cansleep since this GPIO is connected through i2c.

Unfortunately, there is no way to tell the difference between xM A2 and
A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
problems created by this fix.

v3
 - Change patch title to include 'ARM: OMAP:'
 - Actually rename reset_gpio to dvi_reset_gpio

v2
 - Rename reset_gpio to dvi_reset_gpio to self document
 - Use gpio_set_value_cansleep since TWL gpio can sleep
 - Use gpio_is_valid instead of -EINVAL check

Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   49 ++++++++++++++++---------------
 1 file changed, 26 insertions(+), 23 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 495b810..3956c51 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -81,13 +81,13 @@ static u8 omap3_beagle_version;
 static struct {
 	int mmc1_gpio_wp;
 	int usb_pwr_level;
-	int reset_gpio;
+	int dvi_reset_gpio;
 	int usr_button_gpio;
 	int mmc_caps;
 } beagle_config = {
 	.mmc1_gpio_wp = -EINVAL,
 	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
-	.reset_gpio = 129,
+	.dvi_reset_gpio = -EINVAL,
 	.usr_button_gpio = 4,
 	.mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 };
@@ -126,21 +126,21 @@ static void __init omap3_beagle_init_rev(void)
 		printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
 		beagle_config.mmc1_gpio_wp = 29;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_reset_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 6:
 		printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
 		beagle_config.mmc1_gpio_wp = 23;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_reset_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 5:
 		printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
 		beagle_config.mmc1_gpio_wp = 23;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_reset_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 0:
@@ -196,7 +196,7 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
 static int beagle_enable_dvi(struct omap_dss_device *dssdev)
 {
 	if (gpio_is_valid(dssdev->reset_gpio))
-		gpio_set_value(dssdev->reset_gpio, 1);
+		gpio_set_value_cansleep(dssdev->reset_gpio, 1);
 
 	return 0;
 }
@@ -204,7 +204,7 @@ static int beagle_enable_dvi(struct omap_dss_device *dssdev)
 static void beagle_disable_dvi(struct omap_dss_device *dssdev)
 {
 	if (gpio_is_valid(dssdev->reset_gpio))
-		gpio_set_value(dssdev->reset_gpio, 0);
+		gpio_set_value_cansleep(dssdev->reset_gpio, 0);
 }
 
 static struct panel_dvi_platform_data dvi_panel = {
@@ -242,12 +242,17 @@ static struct omap_dss_board_info beagle_dss_data = {
 
 static void __init beagle_display_init(void)
 {
-	int r;
-
-	r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
-			     "DVI reset");
-	if (r < 0)
-		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
+	if (gpio_is_valid(beagle_config.dvi_reset_gpio)) {
+		int r;
+
+		omap_mux_init_gpio(beagle_config.dvi_reset_gpio, OMAP_PIN_OUTPUT);
+		r = gpio_request_one(beagle_config.dvi_reset_gpio,
+				     GPIOF_OUT_INIT_LOW, "DVI reset");
+		if (r < 0)
+			printk(KERN_ERR "Unable to get DVI reset GPIO\n");
+		else
+			beagle_dvi_device.reset_gpio = beagle_config.dvi_reset_gpio;
+	}
 }
 
 #include "sdram-micron-mt46h32m32lf-6.h"
@@ -299,11 +304,14 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (r)
 			pr_err("%s: unable to configure nDVI_PWR_EN\n",
 				__func__);
-		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
-				     "DVI_LDO_EN");
+
+		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW,
+				     "DVI_PU");
 		if (r)
-			pr_err("%s: unable to configure DVI_LDO_EN\n",
-				__func__);
+			pr_err("%s: unable to get DVI_PU GPIO\n", __func__);
+		else
+			beagle_dvi_device.reset_gpio = gpio + 2;
+
 	} else {
 		/*
 		 * REVISIT: need ehci-omap hooks for external VBUS
@@ -312,7 +320,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
 			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
 	}
-	beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
 
 	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
 			"nEN_USB_PWR");
@@ -524,7 +531,7 @@ static void __init omap3_beagle_init(void)
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap3_beagle_init_rev();
 
-	if (beagle_config.mmc1_gpio_wp != -EINVAL)
+	if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
 		omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
 	mmc[0].caps = beagle_config.mmc_caps;
 	omap_hsmmc_init(mmc);
@@ -540,10 +547,6 @@ static void __init omap3_beagle_init(void)
 	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
 				  mt46h32m32lf6_sdrc_params);
 
-	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
-	/* REVISIT leave DVI powered down until it's needed ... */
-	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
-
 	usb_musb_init(NULL);
 	usbhs_init(&usbhs_bdata);
 	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
-- 
1.7.9.5

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

* Re: [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
  2012-05-09  2:49         ` Russ Dill
@ 2012-05-09 15:55           ` Tony Lindgren
  -1 siblings, 0 replies; 20+ messages in thread
From: Tony Lindgren @ 2012-05-09 15:55 UTC (permalink / raw)
  To: Russ Dill
  Cc: linux-omap, chase.maupin, linux-arm-kernel, Igor Grinberg,
	Tomi Valkeinen

Hi Tomi,

* Russ Dill <Russ.Dill@ti.com> [120508 19:52]:
> This removes several boot warnings from board-omap3beagle.c:
> 
>  - gpio_request: gpio--22 (DVI reset) status -22
>  - Unable to get DVI reset GPIO
> 
> There is a combination of leftover code and revision confusion.
> Additionally, xM support is currently a hack.
> 
> For original Beagleboard this removes the double initialization of GPIO
> 170, properly configures it as an output, and wraps the initialization
> in an if block so that xM does not attempt to request it.
> 
> For Beagleboard xM it removes reference to GPIO 129 which was part
> of rev A1 and A2 designs, but never functioned. It then properly assigns
> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
> hack of initializing it high. Additionally, it uses
> gpio_set_value_cansleep since this GPIO is connected through i2c.
> 
> Unfortunately, there is no way to tell the difference between xM A2 and
> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
> problems created by this fix.

Can you check if this needs updates for your clean up patches?

Regards,

Tony


 
> v3
>  - Change patch title to include 'ARM: OMAP:'
>  - Actually rename reset_gpio to dvi_reset_gpio
> 
> v2
>  - Rename reset_gpio to dvi_reset_gpio to self document
>  - Use gpio_set_value_cansleep since TWL gpio can sleep
>  - Use gpio_is_valid instead of -EINVAL check
> 
> Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.
> 
> Signed-off-by: Russ Dill <Russ.Dill@ti.com>
> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |   49 ++++++++++++++++---------------
>  1 file changed, 26 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index 495b810..3956c51 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -81,13 +81,13 @@ static u8 omap3_beagle_version;
>  static struct {
>  	int mmc1_gpio_wp;
>  	int usb_pwr_level;
> -	int reset_gpio;
> +	int dvi_reset_gpio;
>  	int usr_button_gpio;
>  	int mmc_caps;
>  } beagle_config = {
>  	.mmc1_gpio_wp = -EINVAL,
>  	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
> -	.reset_gpio = 129,
> +	.dvi_reset_gpio = -EINVAL,
>  	.usr_button_gpio = 4,
>  	.mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
>  };
> @@ -126,21 +126,21 @@ static void __init omap3_beagle_init_rev(void)
>  		printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
>  		omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
>  		beagle_config.mmc1_gpio_wp = 29;
> -		beagle_config.reset_gpio = 170;
> +		beagle_config.dvi_reset_gpio = 170;
>  		beagle_config.usr_button_gpio = 7;
>  		break;
>  	case 6:
>  		printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
>  		omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
>  		beagle_config.mmc1_gpio_wp = 23;
> -		beagle_config.reset_gpio = 170;
> +		beagle_config.dvi_reset_gpio = 170;
>  		beagle_config.usr_button_gpio = 7;
>  		break;
>  	case 5:
>  		printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
>  		omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
>  		beagle_config.mmc1_gpio_wp = 23;
> -		beagle_config.reset_gpio = 170;
> +		beagle_config.dvi_reset_gpio = 170;
>  		beagle_config.usr_button_gpio = 7;
>  		break;
>  	case 0:
> @@ -196,7 +196,7 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
>  static int beagle_enable_dvi(struct omap_dss_device *dssdev)
>  {
>  	if (gpio_is_valid(dssdev->reset_gpio))
> -		gpio_set_value(dssdev->reset_gpio, 1);
> +		gpio_set_value_cansleep(dssdev->reset_gpio, 1);
>  
>  	return 0;
>  }
> @@ -204,7 +204,7 @@ static int beagle_enable_dvi(struct omap_dss_device *dssdev)
>  static void beagle_disable_dvi(struct omap_dss_device *dssdev)
>  {
>  	if (gpio_is_valid(dssdev->reset_gpio))
> -		gpio_set_value(dssdev->reset_gpio, 0);
> +		gpio_set_value_cansleep(dssdev->reset_gpio, 0);
>  }
>  
>  static struct panel_dvi_platform_data dvi_panel = {
> @@ -242,12 +242,17 @@ static struct omap_dss_board_info beagle_dss_data = {
>  
>  static void __init beagle_display_init(void)
>  {
> -	int r;
> -
> -	r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
> -			     "DVI reset");
> -	if (r < 0)
> -		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
> +	if (gpio_is_valid(beagle_config.dvi_reset_gpio)) {
> +		int r;
> +
> +		omap_mux_init_gpio(beagle_config.dvi_reset_gpio, OMAP_PIN_OUTPUT);
> +		r = gpio_request_one(beagle_config.dvi_reset_gpio,
> +				     GPIOF_OUT_INIT_LOW, "DVI reset");
> +		if (r < 0)
> +			printk(KERN_ERR "Unable to get DVI reset GPIO\n");
> +		else
> +			beagle_dvi_device.reset_gpio = beagle_config.dvi_reset_gpio;
> +	}
>  }
>  
>  #include "sdram-micron-mt46h32m32lf-6.h"
> @@ -299,11 +304,14 @@ static int beagle_twl_gpio_setup(struct device *dev,
>  		if (r)
>  			pr_err("%s: unable to configure nDVI_PWR_EN\n",
>  				__func__);
> -		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
> -				     "DVI_LDO_EN");
> +
> +		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW,
> +				     "DVI_PU");
>  		if (r)
> -			pr_err("%s: unable to configure DVI_LDO_EN\n",
> -				__func__);
> +			pr_err("%s: unable to get DVI_PU GPIO\n", __func__);
> +		else
> +			beagle_dvi_device.reset_gpio = gpio + 2;
> +
>  	} else {
>  		/*
>  		 * REVISIT: need ehci-omap hooks for external VBUS
> @@ -312,7 +320,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
>  		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
>  			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
>  	}
> -	beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
>  
>  	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
>  			"nEN_USB_PWR");
> @@ -524,7 +531,7 @@ static void __init omap3_beagle_init(void)
>  	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
>  	omap3_beagle_init_rev();
>  
> -	if (beagle_config.mmc1_gpio_wp != -EINVAL)
> +	if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
>  		omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
>  	mmc[0].caps = beagle_config.mmc_caps;
>  	omap_hsmmc_init(mmc);
> @@ -540,10 +547,6 @@ static void __init omap3_beagle_init(void)
>  	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
>  				  mt46h32m32lf6_sdrc_params);
>  
> -	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
> -	/* REVISIT leave DVI powered down until it's needed ... */
> -	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
> -
>  	usb_musb_init(NULL);
>  	usbhs_init(&usbhs_bdata);
>  	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
@ 2012-05-09 15:55           ` Tony Lindgren
  0 siblings, 0 replies; 20+ messages in thread
From: Tony Lindgren @ 2012-05-09 15:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Tomi,

* Russ Dill <Russ.Dill@ti.com> [120508 19:52]:
> This removes several boot warnings from board-omap3beagle.c:
> 
>  - gpio_request: gpio--22 (DVI reset) status -22
>  - Unable to get DVI reset GPIO
> 
> There is a combination of leftover code and revision confusion.
> Additionally, xM support is currently a hack.
> 
> For original Beagleboard this removes the double initialization of GPIO
> 170, properly configures it as an output, and wraps the initialization
> in an if block so that xM does not attempt to request it.
> 
> For Beagleboard xM it removes reference to GPIO 129 which was part
> of rev A1 and A2 designs, but never functioned. It then properly assigns
> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
> hack of initializing it high. Additionally, it uses
> gpio_set_value_cansleep since this GPIO is connected through i2c.
> 
> Unfortunately, there is no way to tell the difference between xM A2 and
> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
> problems created by this fix.

Can you check if this needs updates for your clean up patches?

Regards,

Tony


 
> v3
>  - Change patch title to include 'ARM: OMAP:'
>  - Actually rename reset_gpio to dvi_reset_gpio
> 
> v2
>  - Rename reset_gpio to dvi_reset_gpio to self document
>  - Use gpio_set_value_cansleep since TWL gpio can sleep
>  - Use gpio_is_valid instead of -EINVAL check
> 
> Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.
> 
> Signed-off-by: Russ Dill <Russ.Dill@ti.com>
> ---
>  arch/arm/mach-omap2/board-omap3beagle.c |   49 ++++++++++++++++---------------
>  1 file changed, 26 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
> index 495b810..3956c51 100644
> --- a/arch/arm/mach-omap2/board-omap3beagle.c
> +++ b/arch/arm/mach-omap2/board-omap3beagle.c
> @@ -81,13 +81,13 @@ static u8 omap3_beagle_version;
>  static struct {
>  	int mmc1_gpio_wp;
>  	int usb_pwr_level;
> -	int reset_gpio;
> +	int dvi_reset_gpio;
>  	int usr_button_gpio;
>  	int mmc_caps;
>  } beagle_config = {
>  	.mmc1_gpio_wp = -EINVAL,
>  	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
> -	.reset_gpio = 129,
> +	.dvi_reset_gpio = -EINVAL,
>  	.usr_button_gpio = 4,
>  	.mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
>  };
> @@ -126,21 +126,21 @@ static void __init omap3_beagle_init_rev(void)
>  		printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
>  		omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
>  		beagle_config.mmc1_gpio_wp = 29;
> -		beagle_config.reset_gpio = 170;
> +		beagle_config.dvi_reset_gpio = 170;
>  		beagle_config.usr_button_gpio = 7;
>  		break;
>  	case 6:
>  		printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
>  		omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
>  		beagle_config.mmc1_gpio_wp = 23;
> -		beagle_config.reset_gpio = 170;
> +		beagle_config.dvi_reset_gpio = 170;
>  		beagle_config.usr_button_gpio = 7;
>  		break;
>  	case 5:
>  		printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
>  		omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
>  		beagle_config.mmc1_gpio_wp = 23;
> -		beagle_config.reset_gpio = 170;
> +		beagle_config.dvi_reset_gpio = 170;
>  		beagle_config.usr_button_gpio = 7;
>  		break;
>  	case 0:
> @@ -196,7 +196,7 @@ static struct mtd_partition omap3beagle_nand_partitions[] = {
>  static int beagle_enable_dvi(struct omap_dss_device *dssdev)
>  {
>  	if (gpio_is_valid(dssdev->reset_gpio))
> -		gpio_set_value(dssdev->reset_gpio, 1);
> +		gpio_set_value_cansleep(dssdev->reset_gpio, 1);
>  
>  	return 0;
>  }
> @@ -204,7 +204,7 @@ static int beagle_enable_dvi(struct omap_dss_device *dssdev)
>  static void beagle_disable_dvi(struct omap_dss_device *dssdev)
>  {
>  	if (gpio_is_valid(dssdev->reset_gpio))
> -		gpio_set_value(dssdev->reset_gpio, 0);
> +		gpio_set_value_cansleep(dssdev->reset_gpio, 0);
>  }
>  
>  static struct panel_dvi_platform_data dvi_panel = {
> @@ -242,12 +242,17 @@ static struct omap_dss_board_info beagle_dss_data = {
>  
>  static void __init beagle_display_init(void)
>  {
> -	int r;
> -
> -	r = gpio_request_one(beagle_dvi_device.reset_gpio, GPIOF_OUT_INIT_LOW,
> -			     "DVI reset");
> -	if (r < 0)
> -		printk(KERN_ERR "Unable to get DVI reset GPIO\n");
> +	if (gpio_is_valid(beagle_config.dvi_reset_gpio)) {
> +		int r;
> +
> +		omap_mux_init_gpio(beagle_config.dvi_reset_gpio, OMAP_PIN_OUTPUT);
> +		r = gpio_request_one(beagle_config.dvi_reset_gpio,
> +				     GPIOF_OUT_INIT_LOW, "DVI reset");
> +		if (r < 0)
> +			printk(KERN_ERR "Unable to get DVI reset GPIO\n");
> +		else
> +			beagle_dvi_device.reset_gpio = beagle_config.dvi_reset_gpio;
> +	}
>  }
>  
>  #include "sdram-micron-mt46h32m32lf-6.h"
> @@ -299,11 +304,14 @@ static int beagle_twl_gpio_setup(struct device *dev,
>  		if (r)
>  			pr_err("%s: unable to configure nDVI_PWR_EN\n",
>  				__func__);
> -		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
> -				     "DVI_LDO_EN");
> +
> +		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_LOW,
> +				     "DVI_PU");
>  		if (r)
> -			pr_err("%s: unable to configure DVI_LDO_EN\n",
> -				__func__);
> +			pr_err("%s: unable to get DVI_PU GPIO\n", __func__);
> +		else
> +			beagle_dvi_device.reset_gpio = gpio + 2;
> +
>  	} else {
>  		/*
>  		 * REVISIT: need ehci-omap hooks for external VBUS
> @@ -312,7 +320,6 @@ static int beagle_twl_gpio_setup(struct device *dev,
>  		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
>  			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
>  	}
> -	beagle_dvi_device.reset_gpio = beagle_config.reset_gpio;
>  
>  	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
>  			"nEN_USB_PWR");
> @@ -524,7 +531,7 @@ static void __init omap3_beagle_init(void)
>  	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
>  	omap3_beagle_init_rev();
>  
> -	if (beagle_config.mmc1_gpio_wp != -EINVAL)
> +	if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
>  		omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
>  	mmc[0].caps = beagle_config.mmc_caps;
>  	omap_hsmmc_init(mmc);
> @@ -540,10 +547,6 @@ static void __init omap3_beagle_init(void)
>  	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
>  				  mt46h32m32lf6_sdrc_params);
>  
> -	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
> -	/* REVISIT leave DVI powered down until it's needed ... */
> -	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
> -
>  	usb_musb_init(NULL);
>  	usbhs_init(&usbhs_bdata);
>  	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
> -- 
> 1.7.9.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
  2012-05-09 15:55           ` Tony Lindgren
@ 2012-05-09 16:26             ` Russ Dill
  -1 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-09 16:26 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-omap, chase.maupin, linux-arm-kernel, Igor Grinberg,
	Tomi Valkeinen

On Wed, May 9, 2012 at 8:55 AM, Tony Lindgren <tony@atomide.com> wrote:
> Hi Tomi,
>
> * Russ Dill <Russ.Dill@ti.com> [120508 19:52]:
>> This removes several boot warnings from board-omap3beagle.c:
>>
>>  - gpio_request: gpio--22 (DVI reset) status -22
>>  - Unable to get DVI reset GPIO
>>
>> There is a combination of leftover code and revision confusion.
>> Additionally, xM support is currently a hack.
>>
>> For original Beagleboard this removes the double initialization of GPIO
>> 170, properly configures it as an output, and wraps the initialization
>> in an if block so that xM does not attempt to request it.
>>
>> For Beagleboard xM it removes reference to GPIO 129 which was part
>> of rev A1 and A2 designs, but never functioned. It then properly assigns
>> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
>> hack of initializing it high. Additionally, it uses
>> gpio_set_value_cansleep since this GPIO is connected through i2c.
>>
>> Unfortunately, there is no way to tell the difference between xM A2 and
>> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
>> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
>> problems created by this fix.
>
> Can you check if this needs updates for your clean up patches?

I'm not sure what you mean, can you be more specific?
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
@ 2012-05-09 16:26             ` Russ Dill
  0 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-09 16:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 9, 2012 at 8:55 AM, Tony Lindgren <tony@atomide.com> wrote:
> Hi Tomi,
>
> * Russ Dill <Russ.Dill@ti.com> [120508 19:52]:
>> This removes several boot warnings from board-omap3beagle.c:
>>
>> ?- gpio_request: gpio--22 (DVI reset) status -22
>> ?- Unable to get DVI reset GPIO
>>
>> There is a combination of leftover code and revision confusion.
>> Additionally, xM support is currently a hack.
>>
>> For original Beagleboard this removes the double initialization of GPIO
>> 170, properly configures it as an output, and wraps the initialization
>> in an if block so that xM does not attempt to request it.
>>
>> For Beagleboard xM it removes reference to GPIO 129 which was part
>> of rev A1 and A2 designs, but never functioned. It then properly assigns
>> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
>> hack of initializing it high. Additionally, it uses
>> gpio_set_value_cansleep since this GPIO is connected through i2c.
>>
>> Unfortunately, there is no way to tell the difference between xM A2 and
>> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
>> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
>> problems created by this fix.
>
> Can you check if this needs updates for your clean up patches?

I'm not sure what you mean, can you be more specific?

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

* Re: [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
  2012-05-09 16:26             ` Russ Dill
@ 2012-05-09 16:36               ` Tony Lindgren
  -1 siblings, 0 replies; 20+ messages in thread
From: Tony Lindgren @ 2012-05-09 16:36 UTC (permalink / raw)
  To: Russ Dill
  Cc: linux-omap, chase.maupin, linux-arm-kernel, Igor Grinberg,
	Tomi Valkeinen

* Russ Dill <Russ.Dill@ti.com> [120509 09:29]:
> On Wed, May 9, 2012 at 8:55 AM, Tony Lindgren <tony@atomide.com> wrote:
> > Hi Tomi,
> >
> > * Russ Dill <Russ.Dill@ti.com> [120508 19:52]:
> >> This removes several boot warnings from board-omap3beagle.c:
> >>
> >>  - gpio_request: gpio--22 (DVI reset) status -22
> >>  - Unable to get DVI reset GPIO
> >>
> >> There is a combination of leftover code and revision confusion.
> >> Additionally, xM support is currently a hack.
> >>
> >> For original Beagleboard this removes the double initialization of GPIO
> >> 170, properly configures it as an output, and wraps the initialization
> >> in an if block so that xM does not attempt to request it.
> >>
> >> For Beagleboard xM it removes reference to GPIO 129 which was part
> >> of rev A1 and A2 designs, but never functioned. It then properly assigns
> >> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
> >> hack of initializing it high. Additionally, it uses
> >> gpio_set_value_cansleep since this GPIO is connected through i2c.
> >>
> >> Unfortunately, there is no way to tell the difference between xM A2 and
> >> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
> >> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
> >> problems created by this fix.
> >
> > Can you check if this needs updates for your clean up patches?
> 
> I'm not sure what you mean, can you be more specific?

Tomi has a DSS clean-up series posted that affects the board-*.c
files.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
@ 2012-05-09 16:36               ` Tony Lindgren
  0 siblings, 0 replies; 20+ messages in thread
From: Tony Lindgren @ 2012-05-09 16:36 UTC (permalink / raw)
  To: linux-arm-kernel

* Russ Dill <Russ.Dill@ti.com> [120509 09:29]:
> On Wed, May 9, 2012 at 8:55 AM, Tony Lindgren <tony@atomide.com> wrote:
> > Hi Tomi,
> >
> > * Russ Dill <Russ.Dill@ti.com> [120508 19:52]:
> >> This removes several boot warnings from board-omap3beagle.c:
> >>
> >> ?- gpio_request: gpio--22 (DVI reset) status -22
> >> ?- Unable to get DVI reset GPIO
> >>
> >> There is a combination of leftover code and revision confusion.
> >> Additionally, xM support is currently a hack.
> >>
> >> For original Beagleboard this removes the double initialization of GPIO
> >> 170, properly configures it as an output, and wraps the initialization
> >> in an if block so that xM does not attempt to request it.
> >>
> >> For Beagleboard xM it removes reference to GPIO 129 which was part
> >> of rev A1 and A2 designs, but never functioned. It then properly assigns
> >> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
> >> hack of initializing it high. Additionally, it uses
> >> gpio_set_value_cansleep since this GPIO is connected through i2c.
> >>
> >> Unfortunately, there is no way to tell the difference between xM A2 and
> >> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
> >> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
> >> problems created by this fix.
> >
> > Can you check if this needs updates for your clean up patches?
> 
> I'm not sure what you mean, can you be more specific?

Tomi has a DSS clean-up series posted that affects the board-*.c
files.

Regards,

Tony

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

* Re: [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
  2012-05-09 16:36               ` Tony Lindgren
@ 2012-05-09 16:58                 ` Russ Dill
  -1 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-09 16:58 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-omap, chase.maupin, linux-arm-kernel, Igor Grinberg,
	Tomi Valkeinen

On Wed, May 9, 2012 at 9:36 AM, Tony Lindgren <tony@atomide.com> wrote:
> * Russ Dill <Russ.Dill@ti.com> [120509 09:29]:
>> On Wed, May 9, 2012 at 8:55 AM, Tony Lindgren <tony@atomide.com> wrote:
>> > Hi Tomi,
>> >
>> > * Russ Dill <Russ.Dill@ti.com> [120508 19:52]:
>> >> This removes several boot warnings from board-omap3beagle.c:
>> >>
>> >>  - gpio_request: gpio--22 (DVI reset) status -22
>> >>  - Unable to get DVI reset GPIO
>> >>
>> >> There is a combination of leftover code and revision confusion.
>> >> Additionally, xM support is currently a hack.
>> >>
>> >> For original Beagleboard this removes the double initialization of GPIO
>> >> 170, properly configures it as an output, and wraps the initialization
>> >> in an if block so that xM does not attempt to request it.
>> >>
>> >> For Beagleboard xM it removes reference to GPIO 129 which was part
>> >> of rev A1 and A2 designs, but never functioned. It then properly assigns
>> >> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
>> >> hack of initializing it high. Additionally, it uses
>> >> gpio_set_value_cansleep since this GPIO is connected through i2c.
>> >>
>> >> Unfortunately, there is no way to tell the difference between xM A2 and
>> >> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
>> >> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
>> >> problems created by this fix.
>> >
>> > Can you check if this needs updates for your clean up patches?
>>
>> I'm not sure what you mean, can you be more specific?
>
> Tomi has a DSS clean-up series posted that affects the board-*.c
> files.

Yes, it conflicts pretty bad but, it's fairly straightforward to
fixup. Additionally, the 'OMAPDSS: panel-dvi: add PD gpio handling'
needs to be changed to use gpio_set_value_cansleep (replied to patch
in separate email).
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
@ 2012-05-09 16:58                 ` Russ Dill
  0 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-09 16:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 9, 2012 at 9:36 AM, Tony Lindgren <tony@atomide.com> wrote:
> * Russ Dill <Russ.Dill@ti.com> [120509 09:29]:
>> On Wed, May 9, 2012 at 8:55 AM, Tony Lindgren <tony@atomide.com> wrote:
>> > Hi Tomi,
>> >
>> > * Russ Dill <Russ.Dill@ti.com> [120508 19:52]:
>> >> This removes several boot warnings from board-omap3beagle.c:
>> >>
>> >> ?- gpio_request: gpio--22 (DVI reset) status -22
>> >> ?- Unable to get DVI reset GPIO
>> >>
>> >> There is a combination of leftover code and revision confusion.
>> >> Additionally, xM support is currently a hack.
>> >>
>> >> For original Beagleboard this removes the double initialization of GPIO
>> >> 170, properly configures it as an output, and wraps the initialization
>> >> in an if block so that xM does not attempt to request it.
>> >>
>> >> For Beagleboard xM it removes reference to GPIO 129 which was part
>> >> of rev A1 and A2 designs, but never functioned. It then properly assigns
>> >> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
>> >> hack of initializing it high. Additionally, it uses
>> >> gpio_set_value_cansleep since this GPIO is connected through i2c.
>> >>
>> >> Unfortunately, there is no way to tell the difference between xM A2 and
>> >> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
>> >> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
>> >> problems created by this fix.
>> >
>> > Can you check if this needs updates for your clean up patches?
>>
>> I'm not sure what you mean, can you be more specific?
>
> Tomi has a DSS clean-up series posted that affects the board-*.c
> files.

Yes, it conflicts pretty bad but, it's fairly straightforward to
fixup. Additionally, the 'OMAPDSS: panel-dvi: add PD gpio handling'
needs to be changed to use gpio_set_value_cansleep (replied to patch
in separate email).

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

* [PATCH v4] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
  2012-05-09 16:36               ` Tony Lindgren
@ 2012-05-09 22:15                 ` Russ Dill
  -1 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-09 22:15 UTC (permalink / raw)
  To: linux-omap
  Cc: chase.maupin, linux-arm-kernel, Igor Grinberg, Tony Lindgren, Russ Dill

This removes several boot warnings from board-omap3beagle.c:

 - gpio_request: gpio--22 (DVI reset) status -22
 - Unable to get DVI reset GPIO

There is a combination of leftover code and revision confusion.
Additionally, xM support is currently a hack.

For original Beagleboard this removes the double initialization of GPIO
170, properly configures it as an output, and wraps the initialization
in an if block so that xM does not attempt to request it.

For Beagleboard xM it removes reference to GPIO 129 which was part
of rev A1 and A2 designs, but never functioned. It then properly assigns
beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
hack of initializing it high. Additionally, it uses
gpio_set_value_cansleep since this GPIO is connected through i2c.

Unfortunately, there is no way to tell the difference between xM A2 and
A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
problems created by this fix.

v4
 - Rebase onto git://gitorious.org/linux-omap-dss2/linux.git for-l-o-3.5
 - Use dvi_pd_gpio instead of reset_gpio to match with new naming

v3
 - Change patch title to include 'ARM: OMAP:'
 - Actually rename reset_gpio to dvi_reset_gpio

v2
 - Rename reset_gpio to dvi_reset_gpio to self document
 - Use gpio_set_value_cansleep since TWL gpio can sleep
 - Use gpio_is_valid instead of -EINVAL check

Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 5a66e7e..2f4906e 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -81,13 +81,13 @@ static u8 omap3_beagle_version;
 static struct {
 	int mmc1_gpio_wp;
 	int usb_pwr_level;
-	int reset_gpio;
+	int dvi_pd_gpio;
 	int usr_button_gpio;
 	int mmc_caps;
 } beagle_config = {
 	.mmc1_gpio_wp = -EINVAL,
 	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
-	.reset_gpio = 129,
+	.dvi_pd_gpio = -EINVAL,
 	.usr_button_gpio = 4,
 	.mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 };
@@ -126,21 +126,21 @@ static void __init omap3_beagle_init_rev(void)
 		printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
 		beagle_config.mmc1_gpio_wp = 29;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_pd_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 6:
 		printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
 		beagle_config.mmc1_gpio_wp = 23;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_pd_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 5:
 		printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
 		beagle_config.mmc1_gpio_wp = 23;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_pd_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 0:
@@ -273,11 +273,9 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (r)
 			pr_err("%s: unable to configure nDVI_PWR_EN\n",
 				__func__);
-		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
-				     "DVI_LDO_EN");
-		if (r)
-			pr_err("%s: unable to configure DVI_LDO_EN\n",
-				__func__);
+
+		beagle_config.dvi_pd_gpio = gpio + 2;
+
 	} else {
 		/*
 		 * REVISIT: need ehci-omap hooks for external VBUS
@@ -286,7 +284,7 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
 			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
 	}
-	dvi_panel.power_down_gpio = beagle_config.reset_gpio;
+	dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio;
 
 	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
 			"nEN_USB_PWR");
@@ -498,7 +496,7 @@ static void __init omap3_beagle_init(void)
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap3_beagle_init_rev();
 
-	if (beagle_config.mmc1_gpio_wp != -EINVAL)
+	if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
 		omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
 	mmc[0].caps = beagle_config.mmc_caps;
 	omap_hsmmc_init(mmc);
@@ -509,15 +507,13 @@ static void __init omap3_beagle_init(void)
 
 	platform_add_devices(omap3_beagle_devices,
 			ARRAY_SIZE(omap3_beagle_devices));
+	if (gpio_is_valid(beagle_config.dvi_pd_gpio))
+		omap_mux_init_gpio(beagle_config.dvi_pd_gpio, OMAP_PIN_OUTPUT);
 	omap_display_init(&beagle_dss_data);
 	omap_serial_init();
 	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
 				  mt46h32m32lf6_sdrc_params);
 
-	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
-	/* REVISIT leave DVI powered down until it's needed ... */
-	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
-
 	usb_musb_init(NULL);
 	usbhs_init(&usbhs_bdata);
 	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
-- 
1.7.10


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

* [PATCH v4] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
@ 2012-05-09 22:15                 ` Russ Dill
  0 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-09 22:15 UTC (permalink / raw)
  To: linux-arm-kernel

This removes several boot warnings from board-omap3beagle.c:

 - gpio_request: gpio--22 (DVI reset) status -22
 - Unable to get DVI reset GPIO

There is a combination of leftover code and revision confusion.
Additionally, xM support is currently a hack.

For original Beagleboard this removes the double initialization of GPIO
170, properly configures it as an output, and wraps the initialization
in an if block so that xM does not attempt to request it.

For Beagleboard xM it removes reference to GPIO 129 which was part
of rev A1 and A2 designs, but never functioned. It then properly assigns
beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
hack of initializing it high. Additionally, it uses
gpio_set_value_cansleep since this GPIO is connected through i2c.

Unfortunately, there is no way to tell the difference between xM A2 and
A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
problems created by this fix.

v4
 - Rebase onto git://gitorious.org/linux-omap-dss2/linux.git for-l-o-3.5
 - Use dvi_pd_gpio instead of reset_gpio to match with new naming

v3
 - Change patch title to include 'ARM: OMAP:'
 - Actually rename reset_gpio to dvi_reset_gpio

v2
 - Rename reset_gpio to dvi_reset_gpio to self document
 - Use gpio_set_value_cansleep since TWL gpio can sleep
 - Use gpio_is_valid instead of -EINVAL check

Tested on Beagleboard-xM Rev C1 and Beagleboard Rev B4.

Signed-off-by: Russ Dill <Russ.Dill@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle.c |   28 ++++++++++++----------------
 1 file changed, 12 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 5a66e7e..2f4906e 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -81,13 +81,13 @@ static u8 omap3_beagle_version;
 static struct {
 	int mmc1_gpio_wp;
 	int usb_pwr_level;
-	int reset_gpio;
+	int dvi_pd_gpio;
 	int usr_button_gpio;
 	int mmc_caps;
 } beagle_config = {
 	.mmc1_gpio_wp = -EINVAL,
 	.usb_pwr_level = GPIOF_OUT_INIT_LOW,
-	.reset_gpio = 129,
+	.dvi_pd_gpio = -EINVAL,
 	.usr_button_gpio = 4,
 	.mmc_caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
 };
@@ -126,21 +126,21 @@ static void __init omap3_beagle_init_rev(void)
 		printk(KERN_INFO "OMAP3 Beagle Rev: Ax/Bx\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_AXBX;
 		beagle_config.mmc1_gpio_wp = 29;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_pd_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 6:
 		printk(KERN_INFO "OMAP3 Beagle Rev: C1/C2/C3\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C1_3;
 		beagle_config.mmc1_gpio_wp = 23;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_pd_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 5:
 		printk(KERN_INFO "OMAP3 Beagle Rev: C4\n");
 		omap3_beagle_version = OMAP3BEAGLE_BOARD_C4;
 		beagle_config.mmc1_gpio_wp = 23;
-		beagle_config.reset_gpio = 170;
+		beagle_config.dvi_pd_gpio = 170;
 		beagle_config.usr_button_gpio = 7;
 		break;
 	case 0:
@@ -273,11 +273,9 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (r)
 			pr_err("%s: unable to configure nDVI_PWR_EN\n",
 				__func__);
-		r = gpio_request_one(gpio + 2, GPIOF_OUT_INIT_HIGH,
-				     "DVI_LDO_EN");
-		if (r)
-			pr_err("%s: unable to configure DVI_LDO_EN\n",
-				__func__);
+
+		beagle_config.dvi_pd_gpio = gpio + 2;
+
 	} else {
 		/*
 		 * REVISIT: need ehci-omap hooks for external VBUS
@@ -286,7 +284,7 @@ static int beagle_twl_gpio_setup(struct device *dev,
 		if (gpio_request_one(gpio + 1, GPIOF_IN, "EHCI_nOC"))
 			pr_err("%s: unable to configure EHCI_nOC\n", __func__);
 	}
-	dvi_panel.power_down_gpio = beagle_config.reset_gpio;
+	dvi_panel.power_down_gpio = beagle_config.dvi_pd_gpio;
 
 	gpio_request_one(gpio + TWL4030_GPIO_MAX, beagle_config.usb_pwr_level,
 			"nEN_USB_PWR");
@@ -498,7 +496,7 @@ static void __init omap3_beagle_init(void)
 	omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
 	omap3_beagle_init_rev();
 
-	if (beagle_config.mmc1_gpio_wp != -EINVAL)
+	if (gpio_is_valid(beagle_config.mmc1_gpio_wp))
 		omap_mux_init_gpio(beagle_config.mmc1_gpio_wp, OMAP_PIN_INPUT);
 	mmc[0].caps = beagle_config.mmc_caps;
 	omap_hsmmc_init(mmc);
@@ -509,15 +507,13 @@ static void __init omap3_beagle_init(void)
 
 	platform_add_devices(omap3_beagle_devices,
 			ARRAY_SIZE(omap3_beagle_devices));
+	if (gpio_is_valid(beagle_config.dvi_pd_gpio))
+		omap_mux_init_gpio(beagle_config.dvi_pd_gpio, OMAP_PIN_OUTPUT);
 	omap_display_init(&beagle_dss_data);
 	omap_serial_init();
 	omap_sdrc_init(mt46h32m32lf6_sdrc_params,
 				  mt46h32m32lf6_sdrc_params);
 
-	omap_mux_init_gpio(170, OMAP_PIN_INPUT);
-	/* REVISIT leave DVI powered down until it's needed ... */
-	gpio_request_one(170, GPIOF_OUT_INIT_HIGH, "DVI_nPD");
-
 	usb_musb_init(NULL);
 	usbhs_init(&usbhs_bdata);
 	omap_nand_flash_init(NAND_BUSWIDTH_16, omap3beagle_nand_partitions,
-- 
1.7.10

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

* Re: [PATCH v4] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
  2012-05-09 22:15                 ` Russ Dill
@ 2012-05-21 16:07                   ` Tomi Valkeinen
  -1 siblings, 0 replies; 20+ messages in thread
From: Tomi Valkeinen @ 2012-05-21 16:07 UTC (permalink / raw)
  To: Russ Dill
  Cc: linux-omap, chase.maupin, linux-arm-kernel, Igor Grinberg, Tony Lindgren

[-- Attachment #1: Type: text/plain, Size: 1389 bytes --]

On Wed, 2012-05-09 at 15:15 -0700, Russ Dill wrote:
> This removes several boot warnings from board-omap3beagle.c:
> 
>  - gpio_request: gpio--22 (DVI reset) status -22
>  - Unable to get DVI reset GPIO
> 
> There is a combination of leftover code and revision confusion.
> Additionally, xM support is currently a hack.
> 
> For original Beagleboard this removes the double initialization of GPIO
> 170, properly configures it as an output, and wraps the initialization
> in an if block so that xM does not attempt to request it.
> 
> For Beagleboard xM it removes reference to GPIO 129 which was part
> of rev A1 and A2 designs, but never functioned. It then properly assigns
> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
> hack of initializing it high. Additionally, it uses
> gpio_set_value_cansleep since this GPIO is connected through i2c.
> 
> Unfortunately, there is no way to tell the difference between xM A2 and
> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
> problems created by this fix.
> 
> v4
>  - Rebase onto git://gitorious.org/linux-omap-dss2/linux.git for-l-o-3.5
>  - Use dvi_pd_gpio instead of reset_gpio to match with new naming

Hmm, was this rebased correctly? It doesn't apply to for-l-o-3.5 branch.

 Tomi


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* [PATCH v4] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
@ 2012-05-21 16:07                   ` Tomi Valkeinen
  0 siblings, 0 replies; 20+ messages in thread
From: Tomi Valkeinen @ 2012-05-21 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2012-05-09 at 15:15 -0700, Russ Dill wrote:
> This removes several boot warnings from board-omap3beagle.c:
> 
>  - gpio_request: gpio--22 (DVI reset) status -22
>  - Unable to get DVI reset GPIO
> 
> There is a combination of leftover code and revision confusion.
> Additionally, xM support is currently a hack.
> 
> For original Beagleboard this removes the double initialization of GPIO
> 170, properly configures it as an output, and wraps the initialization
> in an if block so that xM does not attempt to request it.
> 
> For Beagleboard xM it removes reference to GPIO 129 which was part
> of rev A1 and A2 designs, but never functioned. It then properly assigns
> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
> hack of initializing it high. Additionally, it uses
> gpio_set_value_cansleep since this GPIO is connected through i2c.
> 
> Unfortunately, there is no way to tell the difference between xM A2 and
> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
> problems created by this fix.
> 
> v4
>  - Rebase onto git://gitorious.org/linux-omap-dss2/linux.git for-l-o-3.5
>  - Use dvi_pd_gpio instead of reset_gpio to match with new naming

Hmm, was this rebased correctly? It doesn't apply to for-l-o-3.5 branch.

 Tomi

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120521/dd8eec00/attachment.sig>

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

* Re: [PATCH v4] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
  2012-05-21 16:07                   ` Tomi Valkeinen
@ 2012-05-21 16:12                     ` Russ Dill
  -1 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-21 16:12 UTC (permalink / raw)
  To: Tomi Valkeinen
  Cc: linux-omap, chase.maupin, linux-arm-kernel, Igor Grinberg, Tony Lindgren

On Mon, May 21, 2012 at 9:07 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> On Wed, 2012-05-09 at 15:15 -0700, Russ Dill wrote:
>> This removes several boot warnings from board-omap3beagle.c:
>>
>>  - gpio_request: gpio--22 (DVI reset) status -22
>>  - Unable to get DVI reset GPIO
>>
>> There is a combination of leftover code and revision confusion.
>> Additionally, xM support is currently a hack.
>>
>> For original Beagleboard this removes the double initialization of GPIO
>> 170, properly configures it as an output, and wraps the initialization
>> in an if block so that xM does not attempt to request it.
>>
>> For Beagleboard xM it removes reference to GPIO 129 which was part
>> of rev A1 and A2 designs, but never functioned. It then properly assigns
>> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
>> hack of initializing it high. Additionally, it uses
>> gpio_set_value_cansleep since this GPIO is connected through i2c.
>>
>> Unfortunately, there is no way to tell the difference between xM A2 and
>> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
>> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
>> problems created by this fix.
>>
>> v4
>>  - Rebase onto git://gitorious.org/linux-omap-dss2/linux.git for-l-o-3.5
>>  - Use dvi_pd_gpio instead of reset_gpio to match with new naming
>
> Hmm, was this rebased correctly? It doesn't apply to for-l-o-3.5 branch.

It sits on top of for-l-o-3.5 and '[OMAP] Mark Beagleboard-xM MMC bus
as 4-bit'. You can cherry-pick 1afb82e4 before applying, or I can drop
that patch from the series and resend.
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v4] ARM: OMAP: Cleanup Beagleboard DVI reset gpio
@ 2012-05-21 16:12                     ` Russ Dill
  0 siblings, 0 replies; 20+ messages in thread
From: Russ Dill @ 2012-05-21 16:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, May 21, 2012 at 9:07 AM, Tomi Valkeinen <tomi.valkeinen@ti.com> wrote:
> On Wed, 2012-05-09 at 15:15 -0700, Russ Dill wrote:
>> This removes several boot warnings from board-omap3beagle.c:
>>
>> ?- gpio_request: gpio--22 (DVI reset) status -22
>> ?- Unable to get DVI reset GPIO
>>
>> There is a combination of leftover code and revision confusion.
>> Additionally, xM support is currently a hack.
>>
>> For original Beagleboard this removes the double initialization of GPIO
>> 170, properly configures it as an output, and wraps the initialization
>> in an if block so that xM does not attempt to request it.
>>
>> For Beagleboard xM it removes reference to GPIO 129 which was part
>> of rev A1 and A2 designs, but never functioned. It then properly assigns
>> beagle_dvi_device.reset_gpio in beagle_twl_gpio_setup and removes the
>> hack of initializing it high. Additionally, it uses
>> gpio_set_value_cansleep since this GPIO is connected through i2c.
>>
>> Unfortunately, there is no way to tell the difference between xM A2 and
>> A3. However, GPIO 129 does not function on rev A1 and A2, and the TWL
>> GPIO used on A3 and beyond is not used on rev A1 and A2, there are no
>> problems created by this fix.
>>
>> v4
>> ?- Rebase onto git://gitorious.org/linux-omap-dss2/linux.git for-l-o-3.5
>> ?- Use dvi_pd_gpio instead of reset_gpio to match with new naming
>
> Hmm, was this rebased correctly? It doesn't apply to for-l-o-3.5 branch.

It sits on top of for-l-o-3.5 and '[OMAP] Mark Beagleboard-xM MMC bus
as 4-bit'. You can cherry-pick 1afb82e4 before applying, or I can drop
that patch from the series and resend.

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

end of thread, other threads:[~2012-05-21 16:12 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-07 20:00 [PATCH] [OMAP] Cleanup Beagleboard DVI reset gpio Russ Dill
2012-05-08  8:41 ` Igor Grinberg
2012-05-08 18:43   ` [PATCH v2] " Russ Dill
2012-05-08 22:13     ` Kevin Hilman
2012-05-09  2:49       ` [PATCH] ARM: OMAP: " Russ Dill
2012-05-09  2:49         ` Russ Dill
2012-05-09 15:55         ` Tony Lindgren
2012-05-09 15:55           ` Tony Lindgren
2012-05-09 16:26           ` Russ Dill
2012-05-09 16:26             ` Russ Dill
2012-05-09 16:36             ` Tony Lindgren
2012-05-09 16:36               ` Tony Lindgren
2012-05-09 16:58               ` Russ Dill
2012-05-09 16:58                 ` Russ Dill
2012-05-09 22:15               ` [PATCH v4] " Russ Dill
2012-05-09 22:15                 ` Russ Dill
2012-05-21 16:07                 ` Tomi Valkeinen
2012-05-21 16:07                   ` Tomi Valkeinen
2012-05-21 16:12                   ` Russ Dill
2012-05-21 16:12                     ` Russ Dill

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.