aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/irda
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-24 17:06:51 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-24 17:06:51 -0700
commitd9fbd9a2cd5ac1b286a7d7cdb1a180ce1edaee2f (patch)
treec9a0859a8da4bdbf0df37507979a6f4cd94ebc8f /drivers/net/irda
parentf25f60beea574d7cff65680694a909e58c5c81c1 (diff)
parentbaea7b946f00a291b166ccae7fcfed6c01530cc6 (diff)
Merge branch 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (103 commits) ARM: 5719/1: [AT91] Fix AC97 breakage ARM: 5721/1: MMCI enable the use of a regulator ARM: 5720/1: Move MMCI header to amba include dir ARM: 5718/1: Sane busids for RealView board components ARM: 5715/1: Make kprobes unregistration SMP safe ARM: 5711/1: locomo.c: CodingStyle cleanups ARM: 5710/1: at91: add AC97 support to at91sam9rl and at91sam9rlek board ARM: 5709/1: at91: add AC97 support to at91sam9g45 series and at91sam9m10g45ek board ARM: 5621/1: at91/dmaengine: integration of at_hdmac driver in at91sam9g45 series ARM: 5620/1: at91/dmaengine: integration of at_hdmac driver in at91sam9rl ARM: Add support for checking access permissions on prefetch aborts ARM: Separate out access error checking ARM: Ensure correct might_sleep() check in pagefault path ARM: Update page fault handling for new OOM techniques ARM: Provide definitions and helpers for decoding the FSR register ARM: 5712/1: SA1100: initialise spinlock in DMA code ARM: s3c: fix check of index into s3c_gpios[] ARM: spitz: fix touchscreen max presure ARM: STMP3xxx: deallocation with negative index of descriptors[] Thumb-2: Correctly handle undefined instructions in the kernel ...
Diffstat (limited to 'drivers/net/irda')
-rw-r--r--drivers/net/irda/pxaficp_ir.c47
1 files changed, 41 insertions, 6 deletions
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c
index 1445e586519..84db145d2b5 100644
--- a/drivers/net/irda/pxaficp_ir.c
+++ b/drivers/net/irda/pxaficp_ir.c
@@ -17,6 +17,7 @@
#include <linux/etherdevice.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
+#include <linux/gpio.h>
#include <net/irda/irda.h>
#include <net/irda/irmod.h>
@@ -163,6 +164,22 @@ inline static void pxa_irda_fir_dma_tx_start(struct pxa_irda *si)
}
/*
+ * 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.
*/
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);
/* 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 */
pxa_irda_enable_sirclk(si);
@@ -222,7 +239,7 @@ static int pxa_irda_set_speed(struct pxa_irda *si, int speed)
ICCR0 = 0;
/* 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 */
pxa_irda_enable_firclk(si);
@@ -641,7 +658,7 @@ static void pxa_irda_shutdown(struct pxa_irda *si)
local_irq_restore(flags);
/* 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");
}
@@ -849,10 +866,26 @@ static int pxa_irda_probe(struct platform_device *pdev)
if (err)
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);
- if (err)
- goto err_startup;
+ if (err)
+ 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;
@@ -903,6 +936,8 @@ static int pxa_irda_remove(struct platform_device *_dev)
if (dev) {
struct pxa_irda *si = netdev_priv(dev);
unregister_netdev(dev);
+ if (gpio_is_valid(si->pdata->gpio_pwdown))
+ gpio_free(si->pdata->gpio_pwdown);
if (si->pdata->shutdown)
si->pdata->shutdown(si->dev);
kfree(si->tx_buff.head);