linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] pxa/hx4700: Fix basic suspend/resume
@ 2012-03-09 16:36 Paul Parsons
  2012-03-09 17:34 ` Philipp Zabel
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Parsons @ 2012-03-09 16:36 UTC (permalink / raw)
  To: linux-arm-kernel

Basic suspend/resume is fixed by ensuring that the PGSR registers are set
correctly before sleep mode is entered. In particular four of the active low
resets need to be driven high while in sleep mode, otherwise the unit resets
itself instead of suspending. Another problem was that the PCFR_GPROD bit is set
by the HTC bootloader; this caused GPIO reset (i.e. the reset button) to fail
immediately after returning from sleep mode.

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
---

V2:
Removed comment about mmc driver not resuming properly: 10 months later it does.
Stopped using the verboten MFP_CFG_OUT().
Changed GPIO88, GPIO72, GPIO96 from KEEP_OUTPUT to DRIVE_HIGH.
Added GPIO61, GPIO81, GPIO116 to global_gpios[].
Assign to PCFR instead of masking it, per manual: "Write 0b0 to reserved bits".
Rebased to linux-3.2-rc6.

diff -uprN clean-3.3-rc6/arch/arm/mach-pxa/hx4700.c linux-3.3-rc6/arch/arm/mach-pxa/hx4700.c
--- clean-3.3-rc6/arch/arm/mach-pxa/hx4700.c	2012-03-04 01:08:09.000000000 +0000
+++ linux-3.3-rc6/arch/arm/mach-pxa/hx4700.c	2012-03-09 16:06:31.121359005 +0000
@@ -121,7 +121,11 @@ static unsigned long hx4700_pin_config[]
 	GPIO19_SSP2_SCLK,
 	GPIO86_SSP2_RXD,
 	GPIO87_SSP2_TXD,
-	GPIO88_GPIO,
+	GPIO88_GPIO | MFP_LPM_DRIVE_HIGH,	/* TSC2046_CS */
+
+	/* BQ24022 Regulator */
+	GPIO72_GPIO | MFP_LPM_DRIVE_HIGH,	/* BQ24022_nCHARGE_EN */
+	GPIO96_GPIO | MFP_LPM_DRIVE_HIGH,	/* BQ24022_ISET2 */
 
 	/* HX4700 specific input GPIOs */
 	GPIO12_GPIO,	/* ASIC3_IRQ */
@@ -134,6 +138,11 @@ static unsigned long hx4700_pin_config[]
 	GPIO108_GPIO,	/* GSM_READY */
 	GPIO58_GPIO,	/* TSC2046_nPENIRQ */
 	GPIO66_GPIO,	/* nSDIO_IRQ */
+
+	GPIO61_GPIO | MFP_LPM_DRIVE_HIGH,	/* W3220_nRESET */
+	GPIO71_GPIO | MFP_LPM_DRIVE_HIGH,	/* ASIC3_nRESET */
+	GPIO81_GPIO | MFP_LPM_DRIVE_HIGH,	/* CPU_GP_nRESET */
+	GPIO116_GPIO | MFP_LPM_DRIVE_HIGH,	/* CPU_HW_nRESET */
 };
 
 /*
@@ -828,15 +837,20 @@ static struct gpio global_gpios[] = {
 	{ GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
 	{ GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
 	{ GPIO32_HX4700_RS232_ON,         GPIOF_OUT_INIT_HIGH, "RS232_ON" },
+	{ GPIO61_HX4700_W3220_nRESET,     GPIOF_OUT_INIT_HIGH, "W3220_nRESET" },
 	{ GPIO71_HX4700_ASIC3_nRESET,     GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
+	{ GPIO81_HX4700_CPU_GP_nRESET,    GPIOF_OUT_INIT_HIGH, "CPU_GP_nRESET" },
 	{ GPIO82_HX4700_EUART_RESET,      GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
 	{ GPIO105_HX4700_nIR_ON,          GPIOF_OUT_INIT_HIGH, "nIR_EN" },
+	{ GPIO116_HX4700_CPU_HW_nRESET,   GPIOF_OUT_INIT_HIGH, "CPU_HW_nRESET" },
 };
 
 static void __init hx4700_init(void)
 {
 	int ret;
 
+	PCFR = PCFR_GPR_EN | PCFR_OPDE;
+
 	pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
 	ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
 	if (ret)

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

* [PATCH v2] pxa/hx4700: Fix basic suspend/resume
  2012-03-09 16:36 [PATCH v2] pxa/hx4700: Fix basic suspend/resume Paul Parsons
@ 2012-03-09 17:34 ` Philipp Zabel
  2012-03-10 15:11   ` Paul Parsons
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Zabel @ 2012-03-09 17:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Paul,

On Fri, Mar 9, 2012 at 5:36 PM, Paul Parsons <lost.distance@yahoo.com> wrote:
> Basic suspend/resume is fixed by ensuring that the PGSR registers are set
> correctly before sleep mode is entered. In particular four of the active low
> resets need to be driven high while in sleep mode, otherwise the unit resets
> itself instead of suspending. Another problem was that the PCFR_GPROD bit is set
> by the HTC bootloader; this caused GPIO reset (i.e. the reset button) to fail
> immediately after returning from sleep mode.
>
> Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
> ---
>
> V2:
> Removed comment about mmc driver not resuming properly: 10 months later it does.
> Stopped using the verboten MFP_CFG_OUT().

thanks for the update.

> Changed GPIO88, GPIO72, GPIO96 from KEEP_OUTPUT to DRIVE_HIGH.

The bq24022 GPIOs (72 and 96) should stay KEEP_OUTPUT to allow
charging from the AC adapter while suspended.

> Added GPIO61, GPIO81, GPIO116 to global_gpios[].
> Assign to PCFR instead of masking it, per manual: "Write 0b0 to reserved bits".
> Rebased to linux-3.2-rc6.
>
> diff -uprN clean-3.3-rc6/arch/arm/mach-pxa/hx4700.c linux-3.3-rc6/arch/arm/mach-pxa/hx4700.c
> --- clean-3.3-rc6/arch/arm/mach-pxa/hx4700.c ? ?2012-03-04 01:08:09.000000000 +0000
> +++ linux-3.3-rc6/arch/arm/mach-pxa/hx4700.c ? ?2012-03-09 16:06:31.121359005 +0000
> @@ -121,7 +121,11 @@ static unsigned long hx4700_pin_config[]
> ? ? ? ?GPIO19_SSP2_SCLK,
> ? ? ? ?GPIO86_SSP2_RXD,
> ? ? ? ?GPIO87_SSP2_TXD,
> - ? ? ? GPIO88_GPIO,
> + ? ? ? GPIO88_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* TSC2046_CS */
> +
> + ? ? ? /* BQ24022 Regulator */
> + ? ? ? GPIO72_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* BQ24022_nCHARGE_EN */
> + ? ? ? GPIO96_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* BQ24022_ISET2 */

GPIO72_GPIO | MFP_LPM_KEEP_OUTPUT,
GPIO96_GPIO | MFP_LPM_KEEP_OUTPUT,

> ? ? ? ?/* HX4700 specific input GPIOs */
> ? ? ? ?GPIO12_GPIO, ? ?/* ASIC3_IRQ */
> @@ -134,6 +138,11 @@ static unsigned long hx4700_pin_config[]
> ? ? ? ?GPIO108_GPIO, ? /* GSM_READY */
> ? ? ? ?GPIO58_GPIO, ? ?/* TSC2046_nPENIRQ */
> ? ? ? ?GPIO66_GPIO, ? ?/* nSDIO_IRQ */
> +
> + ? ? ? GPIO61_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* W3220_nRESET */
> + ? ? ? GPIO71_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* ASIC3_nRESET */
> + ? ? ? GPIO81_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ? /* CPU_GP_nRESET */
> + ? ? ? GPIO116_GPIO | MFP_LPM_DRIVE_HIGH, ? ? ?/* CPU_HW_nRESET */
> ?};
>
> ?/*
> @@ -828,15 +837,20 @@ static struct gpio global_gpios[] = {
> ? ? ? ?{ GPIO110_HX4700_LCD_LVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_LVDD" },
> ? ? ? ?{ GPIO111_HX4700_LCD_AVDD_3V3_ON, GPIOF_OUT_INIT_HIGH, "LCD_AVDD" },
> ? ? ? ?{ GPIO32_HX4700_RS232_ON, ? ? ? ? GPIOF_OUT_INIT_HIGH, "RS232_ON" },
> + ? ? ? { GPIO61_HX4700_W3220_nRESET, ? ? GPIOF_OUT_INIT_HIGH, "W3220_nRESET" },
> ? ? ? ?{ GPIO71_HX4700_ASIC3_nRESET, ? ? GPIOF_OUT_INIT_HIGH, "ASIC3_nRESET" },
> + ? ? ? { GPIO81_HX4700_CPU_GP_nRESET, ? ?GPIOF_OUT_INIT_HIGH, "CPU_GP_nRESET" },
> ? ? ? ?{ GPIO82_HX4700_EUART_RESET, ? ? ?GPIOF_OUT_INIT_HIGH, "EUART_RESET" },
> ? ? ? ?{ GPIO105_HX4700_nIR_ON, ? ? ? ? ?GPIOF_OUT_INIT_HIGH, "nIR_EN" },
> + ? ? ? { GPIO116_HX4700_CPU_HW_nRESET, ? GPIOF_OUT_INIT_HIGH, "CPU_HW_nRESET" },
> ?};
>
> ?static void __init hx4700_init(void)
> ?{
> ? ? ? ?int ret;
>
> + ? ? ? PCFR = PCFR_GPR_EN | PCFR_OPDE;
> +
> ? ? ? ?pxa2xx_mfp_config(ARRAY_AND_SIZE(hx4700_pin_config));
> ? ? ? ?ret = gpio_request_array(ARRAY_AND_SIZE(global_gpios));
> ? ? ? ?if (ret)

regards
Philipp

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

* [PATCH v2] pxa/hx4700: Fix basic suspend/resume
  2012-03-09 17:34 ` Philipp Zabel
@ 2012-03-10 15:11   ` Paul Parsons
  0 siblings, 0 replies; 3+ messages in thread
From: Paul Parsons @ 2012-03-10 15:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Philipp,

--- On Fri, 9/3/12, Philipp Zabel <philipp.zabel@gmail.com> wrote:
> > Changed GPIO88, GPIO72, GPIO96 from KEEP_OUTPUT to
> DRIVE_HIGH.
> 
> The bq24022 GPIOs (72 and 96) should stay KEEP_OUTPUT to
> allow
> charging from the AC adapter while suspended.

I think I disabled this because I was wary of uncontrolled charging while
suspended. The SDG bootloader does have specific code to control charging
and the LEDs while suspended, but AFAIK it is not currently working.

Nonetheless, I've modified the patch.

Interestingly, the SDG bootloader seems to use LED interrupts to
periodically wake up during suspend. At last, that would explain why the
LED GPIOs are inputs, not outputs.

Paul

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

end of thread, other threads:[~2012-03-10 15:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-09 16:36 [PATCH v2] pxa/hx4700: Fix basic suspend/resume Paul Parsons
2012-03-09 17:34 ` Philipp Zabel
2012-03-10 15:11   ` Paul Parsons

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