]> err.no Git - linux-2.6/commitdiff
[IrDA]: EP7211 IR driver port to the latest SIR API
authorSamuel Ortiz <samuel@sortiz.org>
Sun, 22 Jul 2007 02:07:33 +0000 (19:07 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Jul 2007 02:07:33 +0000 (19:07 -0700)
The EP7211 SIR driver was the only one left without a new SIR API port.

Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/irda/Kconfig
drivers/net/irda/Makefile
drivers/net/irda/ep7211-sir.c [new file with mode: 0644]
include/linux/irda.h

index 829da9a1d113e01768dd6ae3973a672bc3fd09ed..266ba7d8f3d1842a658b8661e262da6dc38edd2f 100644 (file)
@@ -155,6 +155,15 @@ config KINGSUN_DONGLE
          To compile it as a module, choose M here: the module will be called
          kingsun-sir.
 
+config EP7211_DONGLE
+       tristate "EP7211 I/R support"
+       depends on IRTTY_SIR && ARCH_EP7211 && IRDA && EXPERIMENTAL
+       help
+         Say Y here if you want to build support for the Cirrus logic
+         EP7211 chipset's infrared module.
+
+
+
 comment "Old SIR device drivers"
 
 config IRPORT_SIR
index 233a2f9237307835934ecbde083ec2e82e149ad4..2808ef5c7b79187ac93cdf5a1f00da70c3e2abd0 100644 (file)
@@ -45,6 +45,7 @@ obj-$(CONFIG_MCP2120_DONGLE)  += mcp2120-sir.o
 obj-$(CONFIG_ACT200L_DONGLE)   += act200l-sir.o
 obj-$(CONFIG_MA600_DONGLE)     += ma600-sir.o
 obj-$(CONFIG_TOIM3232_DONGLE)  += toim3232-sir.o
+obj-$(CONFIG_EP7211_DONGLE)    += ep7211-sir.o
 obj-$(CONFIG_KINGSUN_DONGLE)   += kingsun-sir.o
 
 # The SIR helper module
diff --git a/drivers/net/irda/ep7211-sir.c b/drivers/net/irda/ep7211-sir.c
new file mode 100644 (file)
index 0000000..8315724
--- /dev/null
@@ -0,0 +1,89 @@
+/*
+ * IR port driver for the Cirrus Logic EP7211 processor.
+ *
+ * Copyright 2001, Blue Mug Inc.  All rights reserved.
+ * Copyright 2007, Samuel Ortiz <samuel@sortiz.org>
+ */
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/tty.h>
+#include <linux/init.h>
+#include <linux/spinlock.h>
+
+#include <net/irda/irda.h>
+#include <net/irda/irda_device.h>
+
+#include <asm/io.h>
+#include <asm/hardware.h>
+
+#include "sir-dev.h"
+
+#define MIN_DELAY 25      /* 15 us, but wait a little more to be sure */
+#define MAX_DELAY 10000   /* 1 ms */
+
+static int ep7211_open(struct sir_dev *dev);
+static int ep7211_close(struct sir_dev *dev);
+static int ep7211_change_speed(struct sir_dev *dev, unsigned speed);
+static int ep7211_reset(struct sir_dev *dev);
+
+static struct dongle_driver ep7211 = {
+       .owner          = THIS_MODULE,
+       .driver_name    = "EP7211 IR driver",
+       .type           = IRDA_EP7211_DONGLE,
+       .open           = ep7211_open,
+       .close          = ep7211_close,
+       .reset          = ep7211_reset,
+       .set_speed      = ep7211_change_speed,
+};
+
+static int __init ep7211_sir_init(void)
+{
+       return irda_register_dongle(&ep7211);
+}
+
+static void __exit ep7211_sir_cleanup(void)
+{
+       irda_unregister_dongle(&ep7211);
+}
+
+static int ep7211_open(struct sir_dev *dev)
+{
+       unsigned int syscon;
+
+       /* Turn on the SIR encoder. */
+       syscon = clps_readl(SYSCON1);
+       syscon |= SYSCON1_SIREN;
+       clps_writel(syscon, SYSCON1);
+
+       return 0;
+}
+
+static int ep7211_close(struct sir_dev *dev)
+{
+       unsigned int syscon;
+
+       /* Turn off the SIR encoder. */
+       syscon = clps_readl(SYSCON1);
+       syscon &= ~SYSCON1_SIREN;
+       clps_writel(syscon, SYSCON1);
+
+       return 0;
+}
+
+static int ep7211_change_speed(struct sir_dev *dev, unsigned speed)
+{
+       return 0;
+}
+
+static int ep7211_reset(struct sir_dev *dev)
+{
+       return 0;
+}
+
+MODULE_AUTHOR("Samuel Ortiz <samuel@sortiz.org>");
+MODULE_DESCRIPTION("EP7211 IR dongle driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("irda-dongle-13"); /* IRDA_EP7211_DONGLE */
+
+module_init(ep7211_sir_init);
+module_exit(ep7211_sir_cleanup);
index 8e3735714c1c42e1c61145b59f95e40fee23821e..28f88ecba344e1eefe5fbca694b3d56fcca2948d 100644 (file)
@@ -77,6 +77,7 @@ typedef enum {
        IRDA_ACT200L_DONGLE      = 10,
        IRDA_MA600_DONGLE        = 11,
        IRDA_TOIM3232_DONGLE     = 12,
+       IRDA_EP7211_DONGLE       = 13,
 } IRDA_DONGLE;
 
 /* Protocol types to be used for SOCK_DGRAM */