diff options
author | Eric Miao <eric.miao@marvell.com> | 2008-09-05 10:15:23 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-23 17:04:39 -0400 |
commit | fff147208b48680cb7b627a144113a6585828a0e (patch) | |
tree | b628a27aa4d8baf61a6fdfc8896dc322941e3625 /arch/arm/mach-pxa/spitz.c | |
parent | 60cf711d47d995c3d61e222502fde3c11cedc434 (diff) |
[ARM] pxa/spitz: use generic GPIO API for SCOOP1/SCOOP2 GPIOs
Original patch from Dmitry Baryshkov's inital scoop gpio conversion
work at http://git.infradead.org/users/dbaryshkov/zaurus-2.6.git.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/spitz.c')
-rw-r--r-- | arch/arm/mach-pxa/spitz.c | 66 |
1 files changed, 42 insertions, 24 deletions
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c index 8b06b7a749df..290008296e1b 100644 --- a/arch/arm/mach-pxa/spitz.c +++ b/arch/arm/mach-pxa/spitz.c | |||
@@ -134,10 +134,11 @@ static struct resource spitz_scoop_resources[] = { | |||
134 | }; | 134 | }; |
135 | 135 | ||
136 | static struct scoop_config spitz_scoop_setup = { | 136 | static struct scoop_config spitz_scoop_setup = { |
137 | .io_dir = SPITZ_SCP_IO_DIR, | 137 | .io_dir = SPITZ_SCP_IO_DIR, |
138 | .io_out = SPITZ_SCP_IO_OUT, | 138 | .io_out = SPITZ_SCP_IO_OUT, |
139 | .suspend_clr = SPITZ_SCP_SUS_CLR, | 139 | .suspend_clr = SPITZ_SCP_SUS_CLR, |
140 | .suspend_set = SPITZ_SCP_SUS_SET, | 140 | .suspend_set = SPITZ_SCP_SUS_SET, |
141 | .gpio_base = SPITZ_SCP_GPIO_BASE, | ||
141 | }; | 142 | }; |
142 | 143 | ||
143 | struct platform_device spitzscoop_device = { | 144 | struct platform_device spitzscoop_device = { |
@@ -162,10 +163,11 @@ static struct resource spitz_scoop2_resources[] = { | |||
162 | }; | 163 | }; |
163 | 164 | ||
164 | static struct scoop_config spitz_scoop2_setup = { | 165 | static struct scoop_config spitz_scoop2_setup = { |
165 | .io_dir = SPITZ_SCP2_IO_DIR, | 166 | .io_dir = SPITZ_SCP2_IO_DIR, |
166 | .io_out = SPITZ_SCP2_IO_OUT, | 167 | .io_out = SPITZ_SCP2_IO_OUT, |
167 | .suspend_clr = SPITZ_SCP2_SUS_CLR, | 168 | .suspend_clr = SPITZ_SCP2_SUS_CLR, |
168 | .suspend_set = SPITZ_SCP2_SUS_SET, | 169 | .suspend_set = SPITZ_SCP2_SUS_SET, |
170 | .gpio_base = SPITZ_SCP2_GPIO_BASE, | ||
169 | }; | 171 | }; |
170 | 172 | ||
171 | struct platform_device spitzscoop2_device = { | 173 | struct platform_device spitzscoop2_device = { |
@@ -187,7 +189,7 @@ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) | |||
187 | unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); | 189 | unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); |
188 | 190 | ||
189 | if (new_cpr & 0x0007) { | 191 | if (new_cpr & 0x0007) { |
190 | set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); | 192 | gpio_set_value(SPITZ_GPIO_CF_POWER, 1); |
191 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) | 193 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) |
192 | mdelay(5); | 194 | mdelay(5); |
193 | if (device == SPITZ_PWR_CF) | 195 | if (device == SPITZ_PWR_CF) |
@@ -203,7 +205,7 @@ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr) | |||
203 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) { | 205 | if (!(cpr & 0x0002) && !(cpr & 0x0004)) { |
204 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); | 206 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); |
205 | mdelay(1); | 207 | mdelay(1); |
206 | reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); | 208 | gpio_set_value(SPITZ_GPIO_CF_POWER, 0); |
207 | } else { | 209 | } else { |
208 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); | 210 | write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); |
209 | } | 211 | } |
@@ -283,16 +285,8 @@ static struct pxa2xx_spi_chip spitz_ads7846_chip = { | |||
283 | static void spitz_notify_intensity(int intensity) | 285 | static void spitz_notify_intensity(int intensity) |
284 | { | 286 | { |
285 | if (machine_is_spitz() || machine_is_borzoi()) { | 287 | if (machine_is_spitz() || machine_is_borzoi()) { |
286 | /* Bit 5 is via SCOOP */ | 288 | gpio_set_value(SPITZ_GPIO_BACKLIGHT_CONT, !(intensity & 0x20)); |
287 | if (intensity & 0x0020) | 289 | gpio_set_value(SPITZ_GPIO_BACKLIGHT_ON, intensity); |
288 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | ||
289 | else | ||
290 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT); | ||
291 | |||
292 | if (intensity) | ||
293 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | ||
294 | else | ||
295 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON); | ||
296 | return; | 290 | return; |
297 | } | 291 | } |
298 | 292 | ||
@@ -515,12 +509,34 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = { | |||
515 | /* | 509 | /* |
516 | * Irda | 510 | * Irda |
517 | */ | 511 | */ |
512 | static int spitz_irda_startup(struct device *dev) | ||
513 | { | ||
514 | int rc; | ||
515 | |||
516 | rc = gpio_request(SPITZ_GPIO_IR_ON, "IrDA on"); | ||
517 | if (rc) | ||
518 | goto err; | ||
519 | |||
520 | rc = gpio_direction_output(SPITZ_GPIO_IR_ON, 1); | ||
521 | if (rc) | ||
522 | goto err_dir; | ||
523 | |||
524 | return 0; | ||
525 | |||
526 | err_dir: | ||
527 | gpio_free(SPITZ_GPIO_IR_ON); | ||
528 | err: | ||
529 | return rc; | ||
530 | } | ||
531 | |||
532 | static void spitz_irda_shutdown(struct device *dev) | ||
533 | { | ||
534 | gpio_free(SPITZ_GPIO_IR_ON); | ||
535 | } | ||
536 | |||
518 | static void spitz_irda_transceiver_mode(struct device *dev, int mode) | 537 | static void spitz_irda_transceiver_mode(struct device *dev, int mode) |
519 | { | 538 | { |
520 | if (mode & IR_OFF) | 539 | gpio_set_value(SPITZ_GPIO_IR_ON, mode & IR_OFF); |
521 | set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); | ||
522 | else | ||
523 | reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON); | ||
524 | pxa2xx_transceiver_mode(dev, mode); | 540 | pxa2xx_transceiver_mode(dev, mode); |
525 | } | 541 | } |
526 | 542 | ||
@@ -536,8 +552,10 @@ static void akita_irda_transceiver_mode(struct device *dev, int mode) | |||
536 | #endif | 552 | #endif |
537 | 553 | ||
538 | static struct pxaficp_platform_data spitz_ficp_platform_data = { | 554 | static struct pxaficp_platform_data spitz_ficp_platform_data = { |
539 | .transceiver_cap = IR_SIRMODE | IR_OFF, | 555 | .transceiver_cap = IR_SIRMODE | IR_OFF, |
540 | .transceiver_mode = spitz_irda_transceiver_mode, | 556 | .transceiver_mode = spitz_irda_transceiver_mode, |
557 | .startup = spitz_irda_startup, | ||
558 | .shutdown = spitz_irda_shutdown, | ||
541 | }; | 559 | }; |
542 | 560 | ||
543 | 561 | ||