aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-pxa/tosa.c
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2008-06-12 06:42:07 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-07-07 08:21:59 -0400
commitb032fccca80cbbedaa80e5a72a202a43f08aa97e (patch)
tree1b033c63cb35d2f5018d40a4f328fd257e875405 /arch/arm/mach-pxa/tosa.c
parentdebba222b20c7e98d7875d9c70552b3094038ab2 (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.c58
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
146static unsigned long tosa_pin_irda_off[] = {
147 GPIO46_STUART_RXD,
148 GPIO47_GPIO | MFP_LPM_DRIVE_LOW,
149};
150
151static 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 */
351static 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
344static int tosa_irda_startup(struct device *dev) 363static 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
359static void tosa_irda_shutdown(struct device *dev) 384 return 0;
360{ 385
386err_pwr_dir:
361 gpio_free(TOSA_GPIO_IR_POWERDWN); 387 gpio_free(TOSA_GPIO_IR_POWERDWN);
388err_pwr:
389err_tx_dir:
390 gpio_free(TOSA_GPIO_IRDA_TX);
391err_tx:
392 return ret;
362} 393}
363 394
364static void tosa_irda_transceiver_mode(struct device *dev, int mode) 395static 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
369static struct pxaficp_platform_data tosa_ficp_platform_data = { 402static struct pxaficp_platform_data tosa_ficp_platform_data = {
@@ -501,6 +534,7 @@ static void tosa_restart(char mode)
501static void __init tosa_init(void) 534static 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