linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: eric.y.miao@gmail.com (Eric Miao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 13/16] [ARM] pxa/spitz: use generic GPIO API and remove pxa_gpio_mode()
Date: Mon, 11 Jan 2010 22:04:21 +0800	[thread overview]
Message-ID: <1263218664-11546-14-git-send-email-eric.y.miao@gmail.com> (raw)
In-Reply-To: <1263218664-11546-1-git-send-email-eric.y.miao@gmail.com>

REVISIT: change to GPIO18 is ugly, need to make sure whether that's
really necessary - GPIO18_RDY as an VLIO input signal - we don't
normally need to do such kind of trick during low power mode.

Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
---
 arch/arm/mach-pxa/spitz.c    |    4 +++-
 arch/arm/mach-pxa/spitz_pm.c |   28 +++++++++++++++++++++-------
 2 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 6d9c472..70b17b6 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -86,6 +86,7 @@ static unsigned long spitz_pin_config[] __initdata = {
 
 	/* GPIOs */
 	GPIO9_GPIO,	/* SPITZ_GPIO_nSD_DETECT */
+	GPIO16_GPIO,	/* SPITZ_GPIO_SYNC */
 	GPIO81_GPIO,	/* SPITZ_GPIO_nSD_WP */
 	GPIO41_GPIO,	/* SPITZ_GPIO_USB_CONNECT */
 	GPIO37_GPIO,	/* SPITZ_GPIO_USB_HOST */
@@ -119,7 +120,8 @@ static unsigned long spitz_pin_config[] __initdata = {
 	GPIO117_I2C_SCL,
 	GPIO118_I2C_SDA,
 
-	GPIO1_GPIO | WAKEUP_ON_EDGE_RISE,
+	GPIO0_GPIO | WAKEUP_ON_EDGE_RISE,	/* SPITZ_GPIO_KEY_INT */
+	GPIO1_GPIO | WAKEUP_ON_EDGE_FALL,	/* SPITZ_GPIO_RESET */
 };
 
 /*
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index fc5a70c..4209ddf 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -24,9 +24,10 @@
 
 #include <mach/sharpsl.h>
 #include <mach/spitz.h>
-#include <mach/pxa2xx-regs.h>
-#include <mach/pxa2xx-gpio.h>
+#include <mach/pxa27x.h>
+
 #include "sharpsl.h"
+#include "generic.h"
 
 #define SHARPSL_CHARGE_ON_VOLT         0x99  /* 2.9V */
 #define SHARPSL_CHARGE_ON_TEMP         0xe0  /* 2.9V */
@@ -37,10 +38,17 @@
 
 static int spitz_last_ac_status;
 
+static struct gpio spitz_charger_gpios[] = {
+	{ SPITZ_GPIO_KEY_INT,	GPIOF_IN, "Keyboard Interrupt" },
+	{ SPITZ_GPIO_SYNC,	GPIOF_IN, "Sync" },
+	{ SPITZ_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" },
+	{ SPITZ_GPIO_JK_B,	  GPIOF_OUT_INIT_LOW, "JK B" },
+	{ SPITZ_GPIO_CHRG_ON,	  GPIOF_OUT_INIT_LOW, "Charger On" },
+};
+
 static void spitz_charger_init(void)
 {
-	pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN);
-	pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN);
+	gpio_request_array(ARRAY_AND_SIZE(spitz_charger_gpios));
 }
 
 static void spitz_measure_temp(int on)
@@ -76,6 +84,11 @@ static void spitz_discharge1(int on)
 	gpio_set_value(SPITZ_GPIO_LED_GREEN, on);
 }
 
+static unsigned long gpio18_config[] = {
+	GPIO18_RDY,
+	GPIO18_GPIO,
+};
+
 static void spitz_presuspend(void)
 {
 	spitz_last_ac_status = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
@@ -97,7 +110,9 @@ static void spitz_presuspend(void)
 	PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
 	PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);
 
-	pxa_gpio_mode(GPIO18_RDY|GPIO_OUT | GPIO_DFLT_HIGH);
+	pxa2xx_mfp_config(&gpio18_config[0], 1);
+	gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown");
+	gpio_free(18);
 
 	PRER = GPIO_bit(SPITZ_GPIO_KEY_INT);
 	PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
@@ -114,8 +129,7 @@ static void spitz_presuspend(void)
 
 static void spitz_postsuspend(void)
 {
-	pxa_gpio_mode(GPIO18_RDY_MD);
-	pxa_gpio_mode(10 | GPIO_IN);
+	pxa2xx_mfp_config(&gpio18_config[1], 1);
 }
 
 static int spitz_should_wakeup(unsigned int resume_on_alarm)
-- 
1.6.3.3

  parent reply	other threads:[~2010-01-11 14:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-11 14:04 [RFC PATCH 00/16] pxa gpio API cleanup Eric Miao
2010-01-11 14:04 ` [PATCH 01/16] [ARM] pxa/tosa: make use of the matrix keypad driver Eric Miao
2010-01-11 14:04 ` [PATCH 02/16] [ARM] pxa: use chip->ack() instead of accessing GEDR directly Eric Miao
2010-01-11 14:04 ` [PATCH 03/16] [ARM] pxa: simplify the LCD pin configuration for pxa25x platforms Eric Miao
2010-01-11 14:04 ` [PATCH 04/16] [ARM] pxa: simplify the LCD pin configuration for pxa27x platforms Eric Miao
2010-01-11 14:04 ` [PATCH 05/16] [ARM] pxa/cm-x270: avoid direct access of GPIO/MFP registers Eric Miao
2010-01-11 15:19   ` Mike Rapoport
2010-01-12  0:19     ` Eric Miao
2010-01-11 14:04 ` [PATCH 06/16] [ARM] pxa: fix the incorrect naming of AC97 reset pin config for pxa26x Eric Miao
2010-01-11 14:04 ` [PATCH 07/16] [ARM] pxa: remove the unnecessary restoring of MFP registers Eric Miao
2010-01-11 14:04 ` [PATCH 08/16] [ARM] pxa: introduce processor specific pxa27x_assert_ac97reset() Eric Miao
2010-01-11 14:04 ` [PATCH 09/16] [ARM] pxa: add the missing AC97 pin configurations Eric Miao
2010-01-11 14:04 ` [PATCH 10/16] [ARM] pxa: remove now unnecessary pxa_gpio_mode() calls in ac97 Eric Miao
2010-01-11 14:04 ` [PATCH 11/16] gpio: introduce gpio_request_one() and friends Eric Miao
2010-01-11 14:04 ` [PATCH 12/16] [ARM] pxa/corgi: use generic GPIO API and remove pxa_gpio_mode() Eric Miao
2010-01-11 14:04 ` Eric Miao [this message]
2010-01-11 14:04 ` [PATCH 14/16] [ARM] pxa: fix irq suspend/resume for pxa25x Eric Miao
2010-01-11 14:04 ` [PATCH 15/16] [ARM] pxa: add MFP_LPM_KEEP_OUTPUT flag to pin config Eric Miao
2010-01-11 14:04 ` [PATCH 16/16] [ARM] pxa/corgi: cleanup GPIO configurations and low power mode settings Eric Miao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263218664-11546-14-git-send-email-eric.y.miao@gmail.com \
    --to=eric.y.miao@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).