Skip to content

Commit

Permalink
[ARM] pxa: add gpio_pwdown(_inverted) into pxaficp_ir.c
Browse files Browse the repository at this point in the history
and convert PXA-based devices to gpio_pwdown where possible.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
  • Loading branch information
Marek Vasut authored and Eric Miao committed Sep 10, 2009
1 parent 2a23ec3 commit c4bd017
Show file tree
Hide file tree
Showing 22 changed files with 81 additions and 366 deletions.
27 changes: 1 addition & 26 deletions arch/arm/mach-pxa/corgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -447,34 +447,9 @@ static struct pxamci_platform_data corgi_mci_platform_data = {
/*
* 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 = {
.gpio_pwdown = CORGI_GPIO_IR_ON,
.transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = corgi_irda_transceiver_mode,
.startup = corgi_irda_startup,
.shutdown = corgi_irda_shutdown,
};


Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-pxa/e740.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ static void __init e740_init(void)
platform_add_devices(devices, ARRAY_SIZE(devices));
pxa_set_udc_info(&e7xx_udc_mach_info);
pxa_set_ac97_info(NULL);
e7xx_irda_init();
pxa_set_ficp_info(&e7xx_ficp_platform_data);
}

Expand Down
1 change: 0 additions & 1 deletion arch/arm/mach-pxa/e750.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ static void __init e750_init(void)
platform_add_devices(devices, ARRAY_SIZE(devices));
pxa_set_udc_info(&e7xx_udc_mach_info);
pxa_set_ac97_info(NULL);
e7xx_irda_init();
pxa_set_ficp_info(&e7xx_ficp_platform_data);
}

Expand Down
39 changes: 2 additions & 37 deletions arch/arm/mach-pxa/eseries.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,44 +47,9 @@ struct pxa2xx_udc_mach_info e7xx_udc_mach_info = {
.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 = {
.transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = e7xx_irda_transceiver_mode,
.shutdown = e7xx_irda_shutdown,
.gpio_pwdown = GPIO_E7XX_IR_OFF,
.transceiver_cap = IR_SIRMODE | IR_OFF,
};

int eseries_tmio_enable(struct platform_device *dev)
Expand Down
9 changes: 2 additions & 7 deletions arch/arm/mach-pxa/hx4700.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,14 +175,9 @@ static int hx4700_gpio_request(struct gpio_ress *gpios, int size)
* 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 = {
.transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = irda_transceiver_mode,
.gpio_pwdown = GPIO105_HX4700_nIR_ON,
.transceiver_cap = IR_SIRMODE | IR_OFF,
};

/*
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-pxa/include/mach/irda.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ struct pxaficp_platform_data {
void (*transceiver_mode)(struct device *dev, int mode);
int (*startup)(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);
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/mach-pxa/lubbock.c
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,9 @@ static void lubbock_irda_transceiver_mode(struct device *dev, int mode)
}

static struct pxaficp_platform_data lubbock_ficp_platform_data = {
.transceiver_cap = IR_SIRMODE | IR_FIRMODE,
.transceiver_mode = lubbock_irda_transceiver_mode,
.gpio_pwdown = -1,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE,
.transceiver_mode = lubbock_irda_transceiver_mode,
};

static void __init lubbock_init(void)
Expand Down
10 changes: 2 additions & 8 deletions arch/arm/mach-pxa/magician.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,9 @@ static unsigned long magician_pin_config[] __initdata = {
* 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 = {
.transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = magician_irda_transceiver_mode,
.gpio_pwdown = GPIO83_MAGICIAN_nIR_EN,
.transceiver_cap = IR_SIRMODE | IR_OFF,
};

/*
Expand Down
5 changes: 3 additions & 2 deletions arch/arm/mach-pxa/mainstone.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,9 @@ static void mainstone_irda_transceiver_mode(struct device *dev, int mode)
}

static struct pxaficp_platform_data mainstone_ficp_platform_data = {
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = mainstone_irda_transceiver_mode,
.gpio_pwdown = -1,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = mainstone_irda_transceiver_mode,
};

static struct gpio_keys_button gpio_keys_button[] = {
Expand Down
30 changes: 2 additions & 28 deletions arch/arm/mach-pxa/palmld.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,35 +304,9 @@ static struct platform_device palmld_backlight = {
/******************************************************************************
* 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 = {
.startup = palmld_irda_startup,
.shutdown = palmld_irda_shutdown,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmld_irda_transceiver_mode,
.gpio_pwdown = GPIO_NR_PALMLD_IR_DISABLE,
.transceiver_cap = IR_SIRMODE | IR_OFF,
};

/******************************************************************************
Expand Down
30 changes: 2 additions & 28 deletions arch/arm/mach-pxa/palmt5.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,35 +243,9 @@ static struct platform_device palmt5_backlight = {
/******************************************************************************
* 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 = {
.startup = palmt5_irda_startup,
.shutdown = palmt5_irda_shutdown,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmt5_irda_transceiver_mode,
.gpio_pwdown = GPIO_NR_PALMT5_IR_DISABLE,
.transceiver_cap = IR_SIRMODE | IR_OFF,
};

/******************************************************************************
Expand Down
30 changes: 2 additions & 28 deletions arch/arm/mach-pxa/palmtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,35 +218,9 @@ static struct platform_device palmtc_backlight = {
/******************************************************************************
* 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 = {
.startup = palmtc_irda_startup,
.shutdown = palmtc_irda_shutdown,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmtc_irda_transceiver_mode,
.gpio_pwdown = GPIO_NR_PALMTC_IR_DISABLE,
.transceiver_cap = IR_SIRMODE | IR_OFF,
};

/******************************************************************************
Expand Down
30 changes: 2 additions & 28 deletions arch/arm/mach-pxa/palmte2.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,35 +215,9 @@ static struct platform_device palmte2_backlight = {
/******************************************************************************
* 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 = {
.startup = palmte2_irda_startup,
.shutdown = palmte2_irda_shutdown,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmte2_irda_transceiver_mode,
.gpio_pwdown = GPIO_NR_PALMTE2_IR_DISABLE,
.transceiver_cap = IR_SIRMODE | IR_OFF,
};

/******************************************************************************
Expand Down
30 changes: 2 additions & 28 deletions arch/arm/mach-pxa/palmtx.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,35 +303,9 @@ static struct platform_device palmtx_backlight = {
/******************************************************************************
* 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 = {
.startup = palmtx_irda_startup,
.shutdown = palmtx_irda_shutdown,
.transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF,
.transceiver_mode = palmtx_irda_transceiver_mode,
.gpio_pwdown = GPIO_NR_PALMTX_IR_DISABLE,
.transceiver_cap = IR_SIRMODE | IR_OFF,
};

/******************************************************************************
Expand Down
28 changes: 1 addition & 27 deletions arch/arm/mach-pxa/palmz72.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,35 +230,9 @@ static struct platform_device palmz72_backlight = {
/******************************************************************************
* 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 = {
.startup = palmz72_irda_startup,
.shutdown = palmz72_irda_shutdown,
.gpio_pwdown = GPIO_NR_PALMZ72_IR_DISABLE,
.transceiver_cap = IR_SIRMODE | IR_OFF,
.transceiver_mode = palmz72_irda_transceiver_mode,
};

/******************************************************************************
Expand Down
Loading

0 comments on commit c4bd017

Please sign in to comment.