Commit c4bd0172 authored by Marek Vasut's avatar Marek Vasut Committed by Eric Miao

[ARM] pxa: add gpio_pwdown(_inverted) into pxaficp_ir.c

and convert PXA-based devices to gpio_pwdown where possible.
Signed-off-by: default avatarMarek Vasut <marek.vasut@gmail.com>
Signed-off-by: default avatarEric Miao <eric.y.miao@gmail.com>
parent 2a23ec36
...@@ -447,34 +447,9 @@ static struct pxamci_platform_data corgi_mci_platform_data = { ...@@ -447,34 +447,9 @@ static struct pxamci_platform_data corgi_mci_platform_data = {
/* /*
* Irda * Irda
*/ */
static void corgi_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(CORGI_GPIO_IR_ON, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static int corgi_irda_startup(struct device *dev)
{
int err;
err = gpio_request(CORGI_GPIO_IR_ON, "IR_ON");
if (err)
return err;
gpio_direction_output(CORGI_GPIO_IR_ON, 1);
return 0;
}
static void corgi_irda_shutdown(struct device *dev)
{
gpio_free(CORGI_GPIO_IR_ON);
}
static struct pxaficp_platform_data corgi_ficp_platform_data = { static struct pxaficp_platform_data corgi_ficp_platform_data = {
.gpio_pwdown = CORGI_GPIO_IR_ON,
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = corgi_irda_transceiver_mode,
.startup = corgi_irda_startup,
.shutdown = corgi_irda_shutdown,
}; };
......
...@@ -199,7 +199,6 @@ static void __init e740_init(void) ...@@ -199,7 +199,6 @@ static void __init e740_init(void)
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
pxa_set_udc_info(&e7xx_udc_mach_info); pxa_set_udc_info(&e7xx_udc_mach_info);
pxa_set_ac97_info(NULL); pxa_set_ac97_info(NULL);
e7xx_irda_init();
pxa_set_ficp_info(&e7xx_ficp_platform_data); pxa_set_ficp_info(&e7xx_ficp_platform_data);
} }
......
...@@ -200,7 +200,6 @@ static void __init e750_init(void) ...@@ -200,7 +200,6 @@ static void __init e750_init(void)
platform_add_devices(devices, ARRAY_SIZE(devices)); platform_add_devices(devices, ARRAY_SIZE(devices));
pxa_set_udc_info(&e7xx_udc_mach_info); pxa_set_udc_info(&e7xx_udc_mach_info);
pxa_set_ac97_info(NULL); pxa_set_ac97_info(NULL);
e7xx_irda_init();
pxa_set_ficp_info(&e7xx_ficp_platform_data); pxa_set_ficp_info(&e7xx_ficp_platform_data);
} }
......
...@@ -47,44 +47,9 @@ struct pxa2xx_udc_mach_info e7xx_udc_mach_info = { ...@@ -47,44 +47,9 @@ struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
.gpio_pullup_inverted = 1 .gpio_pullup_inverted = 1
}; };
static void e7xx_irda_transceiver_mode(struct device *dev, int mode)
{
if (mode & IR_OFF) {
gpio_set_value(GPIO_E7XX_IR_OFF, 1);
pxa2xx_transceiver_mode(dev, mode);
} else {
pxa2xx_transceiver_mode(dev, mode);
gpio_set_value(GPIO_E7XX_IR_OFF, 0);
}
}
int e7xx_irda_init(void)
{
int ret;
ret = gpio_request(GPIO_E7XX_IR_OFF, "IrDA power");
if (ret)
goto out;
ret = gpio_direction_output(GPIO_E7XX_IR_OFF, 0);
if (ret)
goto out;
e7xx_irda_transceiver_mode(NULL, IR_SIRMODE | IR_OFF);
out:
return ret;
}
static void e7xx_irda_shutdown(struct device *dev)
{
e7xx_irda_transceiver_mode(dev, IR_SIRMODE | IR_OFF);
gpio_free(GPIO_E7XX_IR_OFF);
}
struct pxaficp_platform_data e7xx_ficp_platform_data = { struct pxaficp_platform_data e7xx_ficp_platform_data = {
.gpio_pwdown = GPIO_E7XX_IR_OFF,
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = e7xx_irda_transceiver_mode,
.shutdown = e7xx_irda_shutdown,
}; };
int eseries_tmio_enable(struct platform_device *dev) int eseries_tmio_enable(struct platform_device *dev)
......
...@@ -175,14 +175,9 @@ static int hx4700_gpio_request(struct gpio_ress *gpios, int size) ...@@ -175,14 +175,9 @@ static int hx4700_gpio_request(struct gpio_ress *gpios, int size)
* IRDA * IRDA
*/ */
static void irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO105_HX4700_nIR_ON, mode & IR_OFF);
}
static struct pxaficp_platform_data ficp_info = { static struct pxaficp_platform_data ficp_info = {
.gpio_pwdown = GPIO105_HX4700_nIR_ON,
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = irda_transceiver_mode,
}; };
/* /*
......
...@@ -12,6 +12,8 @@ struct pxaficp_platform_data { ...@@ -12,6 +12,8 @@ struct pxaficp_platform_data {
void (*transceiver_mode)(struct device *dev, int mode); void (*transceiver_mode)(struct device *dev, int mode);
int (*startup)(struct device *dev); int (*startup)(struct device *dev);
void (*shutdown)(struct device *dev); void (*shutdown)(struct device *dev);
int gpio_pwdown; /* powerdown GPIO for the IrDA chip */
bool gpio_pwdown_inverted; /* gpio_pwdown is inverted */
}; };
extern void pxa_set_ficp_info(struct pxaficp_platform_data *info); extern void pxa_set_ficp_info(struct pxaficp_platform_data *info);
......
...@@ -507,6 +507,7 @@ static void lubbock_irda_transceiver_mode(struct device *dev, int mode) ...@@ -507,6 +507,7 @@ static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
} }
static struct pxaficp_platform_data lubbock_ficp_platform_data = { static struct pxaficp_platform_data lubbock_ficp_platform_data = {
.gpio_pwdown = -1,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE, .transceiver_cap = IR_SIRMODE | IR_FIRMODE,
.transceiver_mode = lubbock_irda_transceiver_mode, .transceiver_mode = lubbock_irda_transceiver_mode,
}; };
......
...@@ -140,15 +140,9 @@ static unsigned long magician_pin_config[] __initdata = { ...@@ -140,15 +140,9 @@ static unsigned long magician_pin_config[] __initdata = {
* IRDA * IRDA
*/ */
static void magician_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO83_MAGICIAN_nIR_EN, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static struct pxaficp_platform_data magician_ficp_info = { static struct pxaficp_platform_data magician_ficp_info = {
.gpio_pwdown = GPIO83_MAGICIAN_nIR_EN,
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = magician_irda_transceiver_mode,
}; };
/* /*
......
...@@ -479,6 +479,7 @@ static void mainstone_irda_transceiver_mode(struct device *dev, int mode) ...@@ -479,6 +479,7 @@ static void mainstone_irda_transceiver_mode(struct device *dev, int mode)
} }
static struct pxaficp_platform_data mainstone_ficp_platform_data = { static struct pxaficp_platform_data mainstone_ficp_platform_data = {
.gpio_pwdown = -1,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = mainstone_irda_transceiver_mode, .transceiver_mode = mainstone_irda_transceiver_mode,
}; };
......
...@@ -304,35 +304,9 @@ static struct platform_device palmld_backlight = { ...@@ -304,35 +304,9 @@ static struct platform_device palmld_backlight = {
/****************************************************************************** /******************************************************************************
* IrDA * IrDA
******************************************************************************/ ******************************************************************************/
static int palmld_irda_startup(struct device *dev)
{
int err;
err = gpio_request(GPIO_NR_PALMLD_IR_DISABLE, "IR DISABLE");
if (err)
goto err;
err = gpio_direction_output(GPIO_NR_PALMLD_IR_DISABLE, 1);
if (err)
gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
err:
return err;
}
static void palmld_irda_shutdown(struct device *dev)
{
gpio_free(GPIO_NR_PALMLD_IR_DISABLE);
}
static void palmld_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO_NR_PALMLD_IR_DISABLE, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static struct pxaficp_platform_data palmld_ficp_platform_data = { static struct pxaficp_platform_data palmld_ficp_platform_data = {
.startup = palmld_irda_startup, .gpio_pwdown = GPIO_NR_PALMLD_IR_DISABLE,
.shutdown = palmld_irda_shutdown, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmld_irda_transceiver_mode,
}; };
/****************************************************************************** /******************************************************************************
......
...@@ -243,35 +243,9 @@ static struct platform_device palmt5_backlight = { ...@@ -243,35 +243,9 @@ static struct platform_device palmt5_backlight = {
/****************************************************************************** /******************************************************************************
* IrDA * IrDA
******************************************************************************/ ******************************************************************************/
static int palmt5_irda_startup(struct device *dev)
{
int err;
err = gpio_request(GPIO_NR_PALMT5_IR_DISABLE, "IR DISABLE");
if (err)
goto err;
err = gpio_direction_output(GPIO_NR_PALMT5_IR_DISABLE, 1);
if (err)
gpio_free(GPIO_NR_PALMT5_IR_DISABLE);
err:
return err;
}
static void palmt5_irda_shutdown(struct device *dev)
{
gpio_free(GPIO_NR_PALMT5_IR_DISABLE);
}
static void palmt5_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO_NR_PALMT5_IR_DISABLE, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static struct pxaficp_platform_data palmt5_ficp_platform_data = { static struct pxaficp_platform_data palmt5_ficp_platform_data = {
.startup = palmt5_irda_startup, .gpio_pwdown = GPIO_NR_PALMT5_IR_DISABLE,
.shutdown = palmt5_irda_shutdown, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmt5_irda_transceiver_mode,
}; };
/****************************************************************************** /******************************************************************************
......
...@@ -218,35 +218,9 @@ static struct platform_device palmtc_backlight = { ...@@ -218,35 +218,9 @@ static struct platform_device palmtc_backlight = {
/****************************************************************************** /******************************************************************************
* IrDA * IrDA
******************************************************************************/ ******************************************************************************/
static int palmtc_irda_startup(struct device *dev)
{
int err;
err = gpio_request(GPIO_NR_PALMTC_IR_DISABLE, "IR DISABLE");
if (err)
goto err;
err = gpio_direction_output(GPIO_NR_PALMTC_IR_DISABLE, 1);
if (err)
gpio_free(GPIO_NR_PALMTC_IR_DISABLE);
err:
return err;
}
static void palmtc_irda_shutdown(struct device *dev)
{
gpio_free(GPIO_NR_PALMTC_IR_DISABLE);
}
static void palmtc_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO_NR_PALMTC_IR_DISABLE, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static struct pxaficp_platform_data palmtc_ficp_platform_data = { static struct pxaficp_platform_data palmtc_ficp_platform_data = {
.startup = palmtc_irda_startup, .gpio_pwdown = GPIO_NR_PALMTC_IR_DISABLE,
.shutdown = palmtc_irda_shutdown, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmtc_irda_transceiver_mode,
}; };
/****************************************************************************** /******************************************************************************
......
...@@ -215,35 +215,9 @@ static struct platform_device palmte2_backlight = { ...@@ -215,35 +215,9 @@ static struct platform_device palmte2_backlight = {
/****************************************************************************** /******************************************************************************
* IrDA * IrDA
******************************************************************************/ ******************************************************************************/
static int palmte2_irda_startup(struct device *dev)
{
int err;
err = gpio_request(GPIO_NR_PALMTE2_IR_DISABLE, "IR DISABLE");
if (err)
goto err;
err = gpio_direction_output(GPIO_NR_PALMTE2_IR_DISABLE, 1);
if (err)
gpio_free(GPIO_NR_PALMTE2_IR_DISABLE);
err:
return err;
}
static void palmte2_irda_shutdown(struct device *dev)
{
gpio_free(GPIO_NR_PALMTE2_IR_DISABLE);
}
static void palmte2_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO_NR_PALMTE2_IR_DISABLE, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static struct pxaficp_platform_data palmte2_ficp_platform_data = { static struct pxaficp_platform_data palmte2_ficp_platform_data = {
.startup = palmte2_irda_startup, .gpio_pwdown = GPIO_NR_PALMTE2_IR_DISABLE,
.shutdown = palmte2_irda_shutdown, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmte2_irda_transceiver_mode,
}; };
/****************************************************************************** /******************************************************************************
......
...@@ -303,35 +303,9 @@ static struct platform_device palmtx_backlight = { ...@@ -303,35 +303,9 @@ static struct platform_device palmtx_backlight = {
/****************************************************************************** /******************************************************************************
* IrDA * IrDA
******************************************************************************/ ******************************************************************************/
static int palmtx_irda_startup(struct device *dev)
{
int err;
err = gpio_request(GPIO_NR_PALMTX_IR_DISABLE, "IR DISABLE");
if (err)
goto err;
err = gpio_direction_output(GPIO_NR_PALMTX_IR_DISABLE, 1);
if (err)
gpio_free(GPIO_NR_PALMTX_IR_DISABLE);
err:
return err;
}
static void palmtx_irda_shutdown(struct device *dev)
{
gpio_free(GPIO_NR_PALMTX_IR_DISABLE);
}
static void palmtx_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO_NR_PALMTX_IR_DISABLE, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static struct pxaficp_platform_data palmtx_ficp_platform_data = { static struct pxaficp_platform_data palmtx_ficp_platform_data = {
.startup = palmtx_irda_startup, .gpio_pwdown = GPIO_NR_PALMTX_IR_DISABLE,
.shutdown = palmtx_irda_shutdown, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmtx_irda_transceiver_mode,
}; };
/****************************************************************************** /******************************************************************************
......
...@@ -230,35 +230,9 @@ static struct platform_device palmz72_backlight = { ...@@ -230,35 +230,9 @@ static struct platform_device palmz72_backlight = {
/****************************************************************************** /******************************************************************************
* IrDA * IrDA
******************************************************************************/ ******************************************************************************/
static int palmz72_irda_startup(struct device *dev)
{
int err;
err = gpio_request(GPIO_NR_PALMZ72_IR_DISABLE, "IR DISABLE");
if (err)
goto err;
err = gpio_direction_output(GPIO_NR_PALMZ72_IR_DISABLE, 1);
if (err)
gpio_free(GPIO_NR_PALMZ72_IR_DISABLE);
err:
return err;
}
static void palmz72_irda_shutdown(struct device *dev)
{
gpio_free(GPIO_NR_PALMZ72_IR_DISABLE);
}
static void palmz72_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO_NR_PALMZ72_IR_DISABLE, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static struct pxaficp_platform_data palmz72_ficp_platform_data = { static struct pxaficp_platform_data palmz72_ficp_platform_data = {
.startup = palmz72_irda_startup, .gpio_pwdown = GPIO_NR_PALMZ72_IR_DISABLE,
.shutdown = palmz72_irda_shutdown,
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = palmz72_irda_transceiver_mode,
}; };
/****************************************************************************** /******************************************************************************
......
...@@ -302,34 +302,9 @@ static struct pxamci_platform_data poodle_mci_platform_data = { ...@@ -302,34 +302,9 @@ static struct pxamci_platform_data poodle_mci_platform_data = {
/* /*
* Irda * Irda
*/ */
static void poodle_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(POODLE_GPIO_IR_ON, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static int poodle_irda_startup(struct device *dev)
{
int err;
err = gpio_request(POODLE_GPIO_IR_ON, "IR_ON");
if (err)
return err;
gpio_direction_output(POODLE_GPIO_IR_ON, 1);
return 0;
}
static void poodle_irda_shutdown(struct device *dev)
{
gpio_free(POODLE_GPIO_IR_ON);
}
static struct pxaficp_platform_data poodle_ficp_platform_data = { static struct pxaficp_platform_data poodle_ficp_platform_data = {
.gpio_pwdown = POODLE_GPIO_IR_ON,
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = poodle_irda_transceiver_mode,
.startup = poodle_irda_startup,
.shutdown = poodle_irda_shutdown,
}; };
......
...@@ -52,3 +52,4 @@ void pxa2xx_transceiver_mode(struct device *dev, int mode) ...@@ -52,3 +52,4 @@ void pxa2xx_transceiver_mode(struct device *dev, int mode)
} else } else
BUG(); BUG();
} }
EXPORT_SYMBOL_GPL(pxa2xx_transceiver_mode);
...@@ -560,50 +560,10 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = { ...@@ -560,50 +560,10 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = {
/* /*
* Irda * Irda
*/ */
static int spitz_irda_startup(struct device *dev)
{
int rc;
rc = gpio_request(SPITZ_GPIO_IR_ON, "IrDA on");
if (rc)
goto err;
rc = gpio_direction_output(SPITZ_GPIO_IR_ON, 1);
if (rc)
goto err_dir;
return 0;
err_dir:
gpio_free(SPITZ_GPIO_IR_ON);
err:
return rc;
}
static void spitz_irda_shutdown(struct device *dev)
{
gpio_free(SPITZ_GPIO_IR_ON);
}
static void spitz_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(SPITZ_GPIO_IR_ON, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
#ifdef CONFIG_MACH_AKITA
static void akita_irda_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(AKITA_GPIO_IR_ON, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
#endif
static struct pxaficp_platform_data spitz_ficp_platform_data = { static struct pxaficp_platform_data spitz_ficp_platform_data = {
/* .gpio_pwdown is set in spitz_init() and akita_init() accordingly */
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = spitz_irda_transceiver_mode,
.startup = spitz_irda_startup,
.shutdown = spitz_irda_shutdown,
}; };
...@@ -782,6 +742,8 @@ static void __init common_init(void) ...@@ -782,6 +742,8 @@ static void __init common_init(void)
#if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI) #if defined(CONFIG_MACH_SPITZ) || defined(CONFIG_MACH_BORZOI)
static void __init spitz_init(void) static void __init spitz_init(void)
{ {
spitz_ficp_platform_data.gpio_pwdown = SPITZ_GPIO_IR_ON;
platform_scoop_config = &spitz_pcmcia_config; platform_scoop_config = &spitz_pcmcia_config;
common_init(); common_init();
...@@ -824,7 +786,7 @@ static struct nand_ecclayout akita_oobinfo = { ...@@ -824,7 +786,7 @@ static struct nand_ecclayout akita_oobinfo = {
static void __init akita_init(void) static void __init akita_init(void)
{ {
spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; spitz_ficp_platform_data.gpio_pwdown = AKITA_GPIO_IR_ON;
sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt; sharpsl_nand_platform_data.badblock_pattern = &sharpsl_akita_bbt;
sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo; sharpsl_nand_platform_data.ecc_layout = &akita_oobinfo;
......
...@@ -337,6 +337,7 @@ static void tosa_irda_shutdown(struct device *dev) ...@@ -337,6 +337,7 @@ static void tosa_irda_shutdown(struct device *dev)
} }
static struct pxaficp_platform_data tosa_ficp_platform_data = { static struct pxaficp_platform_data tosa_ficp_platform_data = {
.gpio_pwdown = -1,
.transceiver_cap = IR_SIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = tosa_irda_transceiver_mode, .transceiver_mode = tosa_irda_transceiver_mode,
.startup = tosa_irda_startup, .startup = tosa_irda_startup,
......
...@@ -295,44 +295,9 @@ static struct platform_device treo680_backlight = { ...@@ -295,44 +295,9 @@ static struct platform_device treo680_backlight = {
/****************************************************************************** /******************************************************************************
* IrDA * IrDA
******************************************************************************/ ******************************************************************************/
static void treo680_transceiver_mode(struct device *dev, int mode)
{
gpio_set_value(GPIO_NR_TREO680_IR_EN, mode & IR_OFF);
pxa2xx_transceiver_mode(dev, mode);
}
static int treo680_irda_startup(struct device *dev)
{
int err;
err = gpio_request(GPIO_NR_TREO680_IR_EN, "Ir port disable");
if (err)
goto err1;
err = gpio_direction_output(GPIO_NR_TREO680_IR_EN, 1);
if (err)
goto err2;
return 0;
err2:
dev_err(dev, "treo680_irda: cannot change IR gpio direction\n");
gpio_free(GPIO_NR_TREO680_IR_EN);
err1:
dev_err(dev, "treo680_irda: cannot allocate IR gpio\n");
return err;
}
static void treo680_irda_shutdown(struct device *dev)
{
gpio_free(GPIO_NR_TREO680_IR_EN);
}
static struct pxaficp_platform_data treo680_ficp_info = { static struct pxaficp_platform_data treo680_ficp_info = {
.transceiver_cap = IR_FIRMODE | IR_SIRMODE | IR_OFF, .gpio_pwdown = GPIO_NR_TREO680_IR_EN,
.startup = treo680_irda_startup, .transceiver_cap = IR_SIRMODE | IR_OFF,
.shutdown = treo680_irda_shutdown,
.transceiver_mode = treo680_transceiver_mode,
}; };
/****************************************************************************** /******************************************************************************
......
...@@ -415,6 +415,7 @@ static void trizeps4_irda_transceiver_mode(struct device *dev, int mode) ...@@ -415,6 +415,7 @@ static void trizeps4_irda_transceiver_mode(struct device *dev, int mode)
} }
static struct pxaficp_platform_data trizeps4_ficp_platform_data = { static struct pxaficp_platform_data trizeps4_ficp_platform_data = {
.gpio_pwdown = -1,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = trizeps4_irda_transceiver_mode, .transceiver_mode = trizeps4_irda_transceiver_mode,
.startup = trizeps4_irda_startup, .startup = trizeps4_irda_startup,
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <linux/etherdevice.h> #include <linux/etherdevice.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/gpio.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irmod.h> #include <net/irda/irmod.h>
...@@ -162,6 +163,22 @@ inline static void pxa_irda_fir_dma_tx_start(struct pxa_irda *si) ...@@ -162,6 +163,22 @@ inline static void pxa_irda_fir_dma_tx_start(struct pxa_irda *si)
DCSR(si->txdma) |= DCSR_RUN; DCSR(si->txdma) |= DCSR_RUN;
} }
/*
* Set the IrDA communications mode.
*/
static void pxa_irda_set_mode(struct pxa_irda *si, int mode)
{
if (si->pdata->transceiver_mode)
si->pdata->transceiver_mode(si->dev, mode);
else {
if (gpio_is_valid(si->pdata->gpio_pwdown))
gpio_set_value(si->pdata->gpio_pwdown,
!(mode & IR_OFF) ^
!si->pdata->gpio_pwdown_inverted);
pxa2xx_transceiver_mode(si->dev, mode);
}
}
/* /*
* Set the IrDA communications speed. * Set the IrDA communications speed.
*/ */
...@@ -188,7 +205,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed) ...@@ -188,7 +205,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
pxa_irda_disable_clk(si); pxa_irda_disable_clk(si);
/* set board transceiver to SIR mode */ /* set board transceiver to SIR mode */
si->pdata->transceiver_mode(si->dev, IR_SIRMODE); pxa_irda_set_mode(si, IR_SIRMODE);
/* enable the STUART clock */ /* enable the STUART clock */
pxa_irda_enable_sirclk(si); pxa_irda_enable_sirclk(si);
...@@ -222,7 +239,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed) ...@@ -222,7 +239,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
ICCR0 = 0; ICCR0 = 0;
/* set board transceiver to FIR mode */ /* set board transceiver to FIR mode */
si->pdata->transceiver_mode(si->dev, IR_FIRMODE); pxa_irda_set_mode(si, IR_FIRMODE);
/* enable the FICP clock */ /* enable the FICP clock */
pxa_irda_enable_firclk(si); pxa_irda_enable_firclk(si);
...@@ -641,7 +658,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si) ...@@ -641,7 +658,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
local_irq_restore(flags); local_irq_restore(flags);
/* power off board transceiver */ /* power off board transceiver */
si->pdata->transceiver_mode(si->dev, IR_OFF); pxa_irda_set_mode(si, IR_OFF);
printk(KERN_DEBUG "pxa_ir: irda shutdown\n"); printk(KERN_DEBUG "pxa_ir: irda shutdown\n");
} }
...@@ -849,10 +866,26 @@ static int pxa_irda_probe(struct platform_device *pdev) ...@@ -849,10 +866,26 @@ static int pxa_irda_probe(struct platform_device *pdev)
if (err) if (err)
goto err_mem_5; goto err_mem_5;
if (si->pdata->startup) if (gpio_is_valid(si->pdata->gpio_pwdown)) {
err = gpio_request(si->pdata->gpio_pwdown, "IrDA switch");
if (err)
goto err_startup;
err = gpio_direction_output(si->pdata->gpio_pwdown,
!si->pdata->gpio_pwdown_inverted);
if (err) {
gpio_free(si->pdata->gpio_pwdown);
goto err_startup;
}
}
if (si->pdata->startup) {
err = si->pdata->startup(si->dev); err = si->pdata->startup(si->dev);
if (err) if (err)
goto err_startup; goto err_startup;
}
if (gpio_is_valid(si->pdata->gpio_pwdown) && si->pdata->startup)
dev_warn(si->dev, "gpio_pwdown and startup() both defined!\n");
dev->netdev_ops = &pxa_irda_netdev_ops; dev->netdev_ops = &pxa_irda_netdev_ops;
...@@ -903,6 +936,8 @@ static int pxa_irda_remove(struct platform_device *_dev) ...@@ -903,6 +936,8 @@ static int pxa_irda_remove(struct platform_device *_dev)
if (dev) { if (dev) {
struct pxa_irda *si = netdev_priv(dev); struct pxa_irda *si = netdev_priv(dev);
unregister_netdev(dev); unregister_netdev(dev);
if (gpio_is_valid(si->pdata->gpio_pwdown))
gpio_free(si->pdata->gpio_pwdown);
if (si->pdata->shutdown) if (si->pdata->shutdown)
si->pdata->shutdown(si->dev); si->pdata->shutdown(si->dev);
kfree(si->tx_buff.head); kfree(si->tx_buff.head);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment