summaryrefslogtreecommitdiffstats
path: root/kernel/drivers/input/gameport/emu10k1-gp.c
diff options
context:
space:
mode:
authorYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 12:17:53 -0700
committerYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 15:44:42 -0700
commit9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch)
tree1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/drivers/input/gameport/emu10k1-gp.c
parent98260f3884f4a202f9ca5eabed40b1354c489b29 (diff)
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/drivers/input/gameport/emu10k1-gp.c')
-rw-r--r--kernel/drivers/input/gameport/emu10k1-gp.c127
1 files changed, 127 insertions, 0 deletions
diff --git a/kernel/drivers/input/gameport/emu10k1-gp.c b/kernel/drivers/input/gameport/emu10k1-gp.c
new file mode 100644
index 000000000..2909e9561
--- /dev/null
+++ b/kernel/drivers/input/gameport/emu10k1-gp.c
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2001 Vojtech Pavlik
+ */
+
+/*
+ * EMU10k1 - SB Live / Audigy - gameport driver for Linux
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Should you need to contact me, the author, you can do so either by
+ * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
+ * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
+ */
+
+#include <asm/io.h>
+
+#include <linux/module.h>
+#include <linux/ioport.h>
+#include <linux/gameport.h>
+#include <linux/slab.h>
+#include <linux/pci.h>
+
+MODULE_AUTHOR("Vojtech Pavlik <vojtech@ucw.cz>");
+MODULE_DESCRIPTION("EMU10k1 gameport driver");
+MODULE_LICENSE("GPL");
+
+struct emu {
+ struct pci_dev *dev;
+ struct gameport *gameport;
+ int io;
+ int size;
+};
+
+static const struct pci_device_id emu_tbl[] = {
+
+ { 0x1102, 0x7002, PCI_ANY_ID, PCI_ANY_ID }, /* SB Live gameport */
+ { 0x1102, 0x7003, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy gameport */
+ { 0x1102, 0x7004, PCI_ANY_ID, PCI_ANY_ID }, /* Dell SB Live */
+ { 0x1102, 0x7005, PCI_ANY_ID, PCI_ANY_ID }, /* Audigy LS gameport */
+ { 0, }
+};
+
+MODULE_DEVICE_TABLE(pci, emu_tbl);
+
+static int emu_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
+{
+ struct emu *emu;
+ struct gameport *port;
+ int error;
+
+ emu = kzalloc(sizeof(struct emu), GFP_KERNEL);
+ port = gameport_allocate_port();
+ if (!emu || !port) {
+ printk(KERN_ERR "emu10k1-gp: Memory allocation failed\n");
+ error = -ENOMEM;
+ goto err_out_free;
+ }
+
+ error = pci_enable_device(pdev);
+ if (error)
+ goto err_out_free;
+
+ emu->io = pci_resource_start(pdev, 0);
+ emu->size = pci_resource_len(pdev, 0);
+
+ emu->dev = pdev;
+ emu->gameport = port;
+
+ gameport_set_name(port, "EMU10K1");
+ gameport_set_phys(port, "pci%s/gameport0", pci_name(pdev));
+ port->dev.parent = &pdev->dev;
+ port->io = emu->io;
+
+ if (!request_region(emu->io, emu->size, "emu10k1-gp")) {
+ printk(KERN_ERR "emu10k1-gp: unable to grab region 0x%x-0x%x\n",
+ emu->io, emu->io + emu->size - 1);
+ error = -EBUSY;
+ goto err_out_disable_dev;
+ }
+
+ pci_set_drvdata(pdev, emu);
+
+ gameport_register_port(port);
+
+ return 0;
+
+ err_out_disable_dev:
+ pci_disable_device(pdev);
+ err_out_free:
+ gameport_free_port(port);
+ kfree(emu);
+ return error;
+}
+
+static void emu_remove(struct pci_dev *pdev)
+{
+ struct emu *emu = pci_get_drvdata(pdev);
+
+ gameport_unregister_port(emu->gameport);
+ release_region(emu->io, emu->size);
+ kfree(emu);
+
+ pci_disable_device(pdev);
+}
+
+static struct pci_driver emu_driver = {
+ .name = "Emu10k1_gameport",
+ .id_table = emu_tbl,
+ .probe = emu_probe,
+ .remove = emu_remove,
+};
+
+module_pci_driver(emu_driver);