Commit b6eede11 authored by Eric Miao's avatar Eric Miao

[ARM] pxa/spitz: use generic GPIO API and remove pxa_gpio_mode()

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: default avatarEric Miao <eric.y.miao@gmail.com>
parent 1fe8c2bc
...@@ -86,6 +86,7 @@ static unsigned long spitz_pin_config[] __initdata = { ...@@ -86,6 +86,7 @@ static unsigned long spitz_pin_config[] __initdata = {
/* GPIOs */ /* GPIOs */
GPIO9_GPIO, /* SPITZ_GPIO_nSD_DETECT */ GPIO9_GPIO, /* SPITZ_GPIO_nSD_DETECT */
GPIO16_GPIO, /* SPITZ_GPIO_SYNC */
GPIO81_GPIO, /* SPITZ_GPIO_nSD_WP */ GPIO81_GPIO, /* SPITZ_GPIO_nSD_WP */
GPIO41_GPIO, /* SPITZ_GPIO_USB_CONNECT */ GPIO41_GPIO, /* SPITZ_GPIO_USB_CONNECT */
GPIO37_GPIO, /* SPITZ_GPIO_USB_HOST */ GPIO37_GPIO, /* SPITZ_GPIO_USB_HOST */
...@@ -119,7 +120,8 @@ static unsigned long spitz_pin_config[] __initdata = { ...@@ -119,7 +120,8 @@ static unsigned long spitz_pin_config[] __initdata = {
GPIO117_I2C_SCL, GPIO117_I2C_SCL,
GPIO118_I2C_SDA, 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 */
}; };
/* /*
......
...@@ -24,9 +24,10 @@ ...@@ -24,9 +24,10 @@
#include <mach/sharpsl.h> #include <mach/sharpsl.h>
#include <mach/spitz.h> #include <mach/spitz.h>
#include <mach/pxa2xx-regs.h> #include <mach/pxa27x.h>
#include <mach/pxa2xx-gpio.h>
#include "sharpsl.h" #include "sharpsl.h"
#include "generic.h"
#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
#define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */ #define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */
...@@ -37,10 +38,17 @@ ...@@ -37,10 +38,17 @@
static int spitz_last_ac_status; 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) static void spitz_charger_init(void)
{ {
pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN); gpio_request_array(ARRAY_AND_SIZE(spitz_charger_gpios));
pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN);
} }
static void spitz_measure_temp(int on) static void spitz_measure_temp(int on)
...@@ -76,6 +84,11 @@ static void spitz_discharge1(int on) ...@@ -76,6 +84,11 @@ static void spitz_discharge1(int on)
gpio_set_value(SPITZ_GPIO_LED_GREEN, on); gpio_set_value(SPITZ_GPIO_LED_GREEN, on);
} }
static unsigned long gpio18_config[] = {
GPIO18_RDY,
GPIO18_GPIO,
};
static void spitz_presuspend(void) static void spitz_presuspend(void)
{ {
spitz_last_ac_status = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN); spitz_last_ac_status = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
...@@ -97,7 +110,9 @@ static void spitz_presuspend(void) ...@@ -97,7 +110,9 @@ static void spitz_presuspend(void)
PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT; PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0); 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); PRER = GPIO_bit(SPITZ_GPIO_KEY_INT);
PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET); PFER = GPIO_bit(SPITZ_GPIO_KEY_INT) | GPIO_bit(SPITZ_GPIO_RESET);
...@@ -114,8 +129,7 @@ static void spitz_presuspend(void) ...@@ -114,8 +129,7 @@ static void spitz_presuspend(void)
static void spitz_postsuspend(void) static void spitz_postsuspend(void)
{ {
pxa_gpio_mode(GPIO18_RDY_MD); pxa2xx_mfp_config(&gpio18_config[1], 1);
pxa_gpio_mode(10 | GPIO_IN);
} }
static int spitz_should_wakeup(unsigned int resume_on_alarm) static int spitz_should_wakeup(unsigned int resume_on_alarm)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment