diff options
author | Eric Miao <eric.y.miao@gmail.com> | 2010-01-08 00:32:46 -0500 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-05-11 11:25:00 -0400 |
commit | e63f591a8ce5d3b5214a14d6cebaad7b6c1c4b4c (patch) | |
tree | 8f909d696133fa97f306f2fde5eb056c7f3a382d /arch/arm/mach-pxa/corgi_pm.c | |
parent | b6eede112673678f8a7a1680d6ad12245443829d (diff) |
[ARM] pxa/corgi: use generic GPIO API and remove pxa_gpio_mode()
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'arch/arm/mach-pxa/corgi_pm.c')
-rw-r--r-- | arch/arm/mach-pxa/corgi_pm.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c index d4a0733e905b..bb68347d9d70 100644 --- a/arch/arm/mach-pxa/corgi_pm.c +++ b/arch/arm/mach-pxa/corgi_pm.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <linux/gpio.h> | ||
17 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
18 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
19 | #include <linux/apm-emulation.h> | 20 | #include <linux/apm-emulation.h> |
@@ -25,7 +26,8 @@ | |||
25 | #include <mach/sharpsl.h> | 26 | #include <mach/sharpsl.h> |
26 | #include <mach/corgi.h> | 27 | #include <mach/corgi.h> |
27 | #include <mach/pxa2xx-regs.h> | 28 | #include <mach/pxa2xx-regs.h> |
28 | #include <mach/pxa2xx-gpio.h> | 29 | |
30 | #include "generic.h" | ||
29 | #include "sharpsl.h" | 31 | #include "sharpsl.h" |
30 | 32 | ||
31 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ | 33 | #define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */ |
@@ -35,44 +37,42 @@ | |||
35 | #define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */ | 37 | #define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */ |
36 | #define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */ | 38 | #define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */ |
37 | 39 | ||
40 | static struct gpio charger_gpios[] = { | ||
41 | { CORGI_GPIO_ADC_TEMP_ON, GPIOF_OUT_INIT_LOW, "ADC Temp On" }, | ||
42 | { CORGI_GPIO_CHRG_ON, GPIOF_OUT_INIT_LOW, "Charger On" }, | ||
43 | { CORGI_GPIO_CHRG_UKN, GPIOF_OUT_INIT_LOW, "Charger Unknown" }, | ||
44 | { CORGI_GPIO_KEY_INT, GPIOF_IN, "Key Interrupt" }, | ||
45 | }; | ||
46 | |||
38 | static void corgi_charger_init(void) | 47 | static void corgi_charger_init(void) |
39 | { | 48 | { |
40 | pxa_gpio_mode(CORGI_GPIO_ADC_TEMP_ON | GPIO_OUT); | 49 | gpio_request_array(ARRAY_AND_SIZE(charger_gpios)); |
41 | pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT); | ||
42 | pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT); | ||
43 | pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN); | ||
44 | } | 50 | } |
45 | 51 | ||
46 | static void corgi_measure_temp(int on) | 52 | static void corgi_measure_temp(int on) |
47 | { | 53 | { |
48 | if (on) | 54 | gpio_set_value(CORGI_GPIO_ADC_TEMP_ON, on); |
49 | GPSR(CORGI_GPIO_ADC_TEMP_ON) = GPIO_bit(CORGI_GPIO_ADC_TEMP_ON); | ||
50 | else | ||
51 | GPCR(CORGI_GPIO_ADC_TEMP_ON) = GPIO_bit(CORGI_GPIO_ADC_TEMP_ON); | ||
52 | } | 55 | } |
53 | 56 | ||
54 | static void corgi_charge(int on) | 57 | static void corgi_charge(int on) |
55 | { | 58 | { |
56 | if (on) { | 59 | if (on) { |
57 | if (machine_is_corgi() && (sharpsl_pm.flags & SHARPSL_SUSPENDED)) { | 60 | if (machine_is_corgi() && (sharpsl_pm.flags & SHARPSL_SUSPENDED)) { |
58 | GPCR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON); | 61 | gpio_set_value(CORGI_GPIO_CHRG_ON, 0); |
59 | GPSR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN); | 62 | gpio_set_value(CORGI_GPIO_CHRG_UKN, 1); |
60 | } else { | 63 | } else { |
61 | GPSR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON); | 64 | gpio_set_value(CORGI_GPIO_CHRG_ON, 1); |
62 | GPCR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN); | 65 | gpio_set_value(CORGI_GPIO_CHRG_UKN, 0); |
63 | } | 66 | } |
64 | } else { | 67 | } else { |
65 | GPCR(CORGI_GPIO_CHRG_ON) = GPIO_bit(CORGI_GPIO_CHRG_ON); | 68 | gpio_set_value(CORGI_GPIO_CHRG_ON, 0); |
66 | GPCR(CORGI_GPIO_CHRG_UKN) = GPIO_bit(CORGI_GPIO_CHRG_UKN); | 69 | gpio_set_value(CORGI_GPIO_CHRG_UKN, 0); |
67 | } | 70 | } |
68 | } | 71 | } |
69 | 72 | ||
70 | static void corgi_discharge(int on) | 73 | static void corgi_discharge(int on) |
71 | { | 74 | { |
72 | if (on) | 75 | gpio_set_value(CORGI_GPIO_DISCHARGE_ON, on); |
73 | GPSR(CORGI_GPIO_DISCHARGE_ON) = GPIO_bit(CORGI_GPIO_DISCHARGE_ON); | ||
74 | else | ||
75 | GPCR(CORGI_GPIO_DISCHARGE_ON) = GPIO_bit(CORGI_GPIO_DISCHARGE_ON); | ||
76 | } | 76 | } |
77 | 77 | ||
78 | static void corgi_presuspend(void) | 78 | static void corgi_presuspend(void) |