提交 b032fccc 编写于 作者: D Dmitry Baryshkov 提交者: Russell King

[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: NDmitry Baryshkov <dbaryshkov@gmail.com>
Signed-off-by: NRussell King <rmk+kernel@arm.linux.org.uk>
上级 debba222
...@@ -117,10 +117,6 @@ static unsigned long tosa_pin_config[] = { ...@@ -117,10 +117,6 @@ static unsigned long tosa_pin_config[] = {
GPIO44_BTUART_CTS, GPIO44_BTUART_CTS,
GPIO45_BTUART_RTS, GPIO45_BTUART_RTS,
/* IrDA */
GPIO46_STUART_RXD,
GPIO47_STUART_TXD,
/* Keybd */ /* Keybd */
GPIO58_GPIO | MFP_LPM_DRIVE_LOW, GPIO58_GPIO | MFP_LPM_DRIVE_LOW,
GPIO59_GPIO | MFP_LPM_DRIVE_LOW, GPIO59_GPIO | MFP_LPM_DRIVE_LOW,
...@@ -147,6 +143,17 @@ static unsigned long tosa_pin_config[] = { ...@@ -147,6 +143,17 @@ static unsigned long tosa_pin_config[] = {
GPIO83_SSP2_TXD, GPIO83_SSP2_TXD,
}; };
static unsigned long tosa_pin_irda_off[] = {
GPIO46_STUART_RXD,
GPIO47_GPIO | MFP_LPM_DRIVE_LOW,
};
static unsigned long tosa_pin_irda_on[] = {
GPIO46_STUART_RXD,
GPIO47_STUART_TXD,
};
/* /*
* SCOOP Device * SCOOP Device
*/ */
...@@ -341,29 +348,55 @@ static struct pxamci_platform_data tosa_mci_platform_data = { ...@@ -341,29 +348,55 @@ static struct pxamci_platform_data tosa_mci_platform_data = {
/* /*
* Irda * Irda
*/ */
static void tosa_irda_transceiver_mode(struct device *dev, int mode)
{
if (mode & IR_OFF) {
gpio_set_value(TOSA_GPIO_IR_POWERDWN, 0);
pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_off));
gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
} else {
pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_on));
gpio_set_value(TOSA_GPIO_IR_POWERDWN, 1);
}
}
static int tosa_irda_startup(struct device *dev) static int tosa_irda_startup(struct device *dev)
{ {
int ret; int ret;
ret = gpio_request(TOSA_GPIO_IRDA_TX, "IrDA TX");
if (ret)
goto err_tx;
ret = gpio_direction_output(TOSA_GPIO_IRDA_TX, 0);
if (ret)
goto err_tx_dir;
ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown"); ret = gpio_request(TOSA_GPIO_IR_POWERDWN, "IrDA powerdown");
if (ret) if (ret)
return ret; goto err_pwr;
ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0); ret = gpio_direction_output(TOSA_GPIO_IR_POWERDWN, 0);
if (ret) if (ret)
gpio_free(TOSA_GPIO_IR_POWERDWN); goto err_pwr_dir;
return ret; tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
}
static void tosa_irda_shutdown(struct device *dev) return 0;
{
err_pwr_dir:
gpio_free(TOSA_GPIO_IR_POWERDWN); gpio_free(TOSA_GPIO_IR_POWERDWN);
err_pwr:
err_tx_dir:
gpio_free(TOSA_GPIO_IRDA_TX);
err_tx:
return ret;
} }
static void tosa_irda_transceiver_mode(struct device *dev, int mode) static void tosa_irda_shutdown(struct device *dev)
{ {
gpio_set_value(TOSA_GPIO_IR_POWERDWN, !(mode & IR_OFF)); tosa_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
gpio_free(TOSA_GPIO_IR_POWERDWN);
gpio_free(TOSA_GPIO_IRDA_TX);
} }
static struct pxaficp_platform_data tosa_ficp_platform_data = { static struct pxaficp_platform_data tosa_ficp_platform_data = {
...@@ -501,6 +534,7 @@ static void tosa_restart(char mode) ...@@ -501,6 +534,7 @@ static void tosa_restart(char mode)
static void __init tosa_init(void) static void __init tosa_init(void)
{ {
pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config)); pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_config));
pxa2xx_mfp_config(ARRAY_AND_SIZE(tosa_pin_irda_off));
gpio_set_wake(MFP_PIN_GPIO1, 1); gpio_set_wake(MFP_PIN_GPIO1, 1);
/* We can't pass to gpio-keys since it will drop the Reset altfunc */ /* We can't pass to gpio-keys since it will drop the Reset altfunc */
......
...@@ -99,6 +99,7 @@ ...@@ -99,6 +99,7 @@
#define TOSA_GPIO_TP_INT (32) /* Touch Panel pen down interrupt */ #define TOSA_GPIO_TP_INT (32) /* Touch Panel pen down interrupt */
#define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */ #define TOSA_GPIO_JC_CF_IRQ (36) /* CF slot1 Ready */
#define TOSA_GPIO_BAT_LOCKED (38) /* Battery locked */ #define TOSA_GPIO_BAT_LOCKED (38) /* Battery locked */
#define TOSA_GPIO_IRDA_TX (47)
#define TOSA_GPIO_TG_SPI_SCLK (81) #define TOSA_GPIO_TG_SPI_SCLK (81)
#define TOSA_GPIO_TG_SPI_CS (82) #define TOSA_GPIO_TG_SPI_CS (82)
#define TOSA_GPIO_TG_SPI_MOSI (83) #define TOSA_GPIO_TG_SPI_MOSI (83)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册