diff options
author | Dmitry Baryshkov <dbaryshkov@gmail.com> | 2008-06-12 06:42:07 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-07 08:21:59 -0400 |
commit | b032fccca80cbbedaa80e5a72a202a43f08aa97e (patch) | |
tree | 1b033c63cb35d2f5018d40a4f328fd257e875405 /arch/arm/mach-pxa/tosa.c | |
parent | debba222b20c7e98d7875d9c70552b3094038ab2 (diff) |
[ARM] 5083/2: Tosa: fix IrDA transciver powerup.
On tosa the tranciver LED isn't powered down if
the GPIO47 (STUART_TX) isn't configured as low-level.
Power it down if IrDA is off to save a bit of power.
Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa/tosa.c')
-rw-r--r-- | arch/arm/mach-pxa/tosa.c | 58 |
1 files changed, 46 insertions, 12 deletions
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c index 9892464d7abc..7a89f764acf3 100644 --- a/arch/arm/mach-pxa/tosa.c +++ b/arch/arm/mach-pxa/tosa.c | |||
@@ -117,10 +117,6 @@ static unsigned long tosa_pin_config[] = { | |||
117 | GPIO44_BTUART_CTS, | 117 | GPIO44_BTUART_CTS, |
118 | GPIO45_BTUART_RTS, | 118 | GPIO45_BTUART_RTS, |
119 | 119 | ||
120 | /* IrDA */ | ||
121 | GPIO46_STUART_RXD, | ||
122 | GPIO47_STUART_TXD, | ||
123 | |||
124 | /* Keybd */ | 120 | /* Keybd */ |
125 | GPIO58_GPIO | MFP_LPM_DRIVE_LOW, | 121 | GPIO58_GPIO | MFP_LPM_DRIVE_LOW, |
126 | GPIO59_GPIO | MFP_LPM_DRIVE_LOW, | 122 | GPIO59_GPIO | MFP_LPM_DRIVE_LOW, |
@@ -147,6 +143,17 @@ static unsigned long tosa_pin_config[] = { | |||
147 | GPIO83_SSP2_TXD, | 143 | GPIO83_SSP2_TXD, |
148 | }; | 144 | }; |
149 | 145 | ||
146 | static unsigned long tosa_pin_irda_off[] = { | ||
147 | GPIO46_STUART_RXD, | ||
148 | GPIO47_GPIO | MFP_LPM_DRIVE_LOW, | ||
149 | }; | ||
150 | |||
151 | static unsigned long tosa_pin_irda_on[] = { | ||
152 | GPIO46_STUART_RXD, | ||
153 | GPIO47_STUART_TXD, | ||
154 | }; | ||
155 | |||
156 | |||
150 | /* | 157 | /* |
151 | * SCOOP Device | 158 | * SCOOP Device |
152 | */ | 159 | */ |
@@ -341,29 +348,55 @@ static struct pxamci_platform_data tosa_mci_platform_data = { | |||
341 | /* | 348 | /* |
342 | * Irda | 349 | * Irda |
343 | */ | 350 | */ |
351 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) | ||
352 | { | ||
353 | if (mode & IR_OFF) { | ||
354 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0); | ||
355 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_off)); | ||
356 | gpio_direction_output(TOSA_GPIO_IRDA_TX, 0); | ||
357 | } else { | ||
358 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_on)); | ||
359 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1); | ||
360 | } | ||
361 | } | ||
362 | |||
344 | static int tosa_irda_startup(struct device *dev) | 363 | static int tosa_irda_startup(struct device *dev) |
345 | { | 364 | { |
346 | int ret; | 365 | int ret; |
347 | 366 | ||
367 | ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX"); | ||
368 | if (ret) | ||
369 | goto err_tx; | ||
370 | ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0); | ||
371 | if (ret) | ||
372 | goto err_tx_dir; | ||
373 | |||
348 | ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); | 374 | ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); |
349 | if (ret) | 375 | if (ret) |
350 | return ret; | 376 | goto err_pwr; |
351 | 377 | ||
352 | ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); | 378 | ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); |
353 | if (ret) | 379 | if (ret) |
354 | gpio_free(TOSA_GPIO_IR_POWERDWN); | 380 | goto err_pwr_dir; |
355 | 381 | ||
356 | return ret; | 382 | tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); |
357 | } | ||
358 | 383 | ||
359 | static void tosa_irda_shutdown(struct device *dev) | 384 | return 0; |
360 | { | 385 | |
386 | err_pwr_dir: | ||
361 | gpio_free(TOSA_GPIO_IR_POWERDWN); | 387 | gpio_free(TOSA_GPIO_IR_POWERDWN); |
388 | err_pwr: | ||
389 | err_tx_dir: | ||
390 | gpio_free(TOSA_GPIO_IRDA_TX); | ||
391 | err_tx: | ||
392 | return ret; | ||
362 | } | 393 | } |
363 | 394 | ||
364 | static void tosa_irda_transceiver_mode(struct device *dev, int mode) | 395 | static void tosa_irda_shutdown(struct device *dev) |
365 | { | 396 | { |
366 | gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF)); | 397 | tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF); |
398 | gpio_free(TOSA_GPIO_IR_POWERDWN); | ||
399 | gpio_free(TOSA_GPIO_IRDA_TX); | ||
367 | } | 400 | } |
368 | 401 | ||
369 | static struct pxaficp_platform_data tosa_ficp_platform_data = { | 402 | static struct pxaficp_platform_data tosa_ficp_platform_data = { |
@@ -501,6 +534,7 @@ static void tosa_restart(char mode) | |||
501 | static void __init tosa_init(void) | 534 | static void __init tosa_init(void) |
502 | { | 535 | { |
503 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); | 536 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); |
537 | pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_off)); | ||
504 | gpio_set_wake(MFP_PIN_GPIO1, 1); | 538 | gpio_set_wake(MFP_PIN_GPIO1, 1); |
505 | /* We can't pass to gpio-keys since it will drop the Reset altfunc */ | 539 | /* We can't pass to gpio-keys since it will drop the Reset altfunc */ |
506 | 540 | ||