/*
- The all defines and part of code (such as cs461x_*) are
- contributed from ALSA 0.5.8 sources.
+ The all defines and part of code (such as cs461x_*) are
+ contributed from ALSA 0.5.8 sources.
See http://www.alsa-project.org/ for sources
-
+
Tested on Linux 686 2.4.0-test9, ALSA 0.5.8a and CS4610
*/
#define JSIO_BXOE 0x00000040
#define JSIO_BYOE 0x00000080
-/*
- The card initialization code is obfuscated; the module cs461x
+/*
+ The card initialization code is obfuscated; the module cs461x
need to be loaded after ALSA modules initialized and something
played on the CS 4610 chip (see sources for details of CS4610
initialization code from ALSA)
#define BA1_DWORD_SIZE (13 * 1024 + 512)
#define BA1_MEMORY_COUNT 3
-/*
+/*
Only one CS461x card is still suppoted; the code requires
redesign to avoid this limitatuion.
*/
static unsigned long ba0_addr;
-static unsigned int *ba0;
+static unsigned int __iomem *ba0;
static char phys[32];
static char name[] = "CS416x Gameport";
static unsigned long ba1_addr;
static union ba1_t {
struct {
- unsigned int *data0;
- unsigned int *data1;
- unsigned int *pmem;
- unsigned int *reg;
+ unsigned int __iomem *data0;
+ unsigned int __iomem *data1;
+ unsigned int __iomem *pmem;
+ unsigned int __iomem *reg;
} name;
- unsigned int *idx[4];
+ unsigned int __iomem *idx[4];
} ba1;
static void cs461x_poke(unsigned long reg, unsigned int val)
{
- ba1.idx[(reg >> 16) & 3][(reg >> 2) & 0x3fff] = val;
+ writel(val, &ba1.idx[(reg >> 16) & 3][(reg >> 2) & 0x3fff]);
}
static unsigned int cs461x_peek(unsigned long reg)
{
- return ba1.idx[(reg >> 16) & 3][(reg >> 2) & 0x3fff];
+ return readl(&ba1.idx[(reg >> 16) & 3][(reg >> 2) & 0x3fff]);
}
#endif
static void cs461x_pokeBA0(unsigned long reg, unsigned int val)
{
- ba0[reg >> 2] = val;
+ writel(val, &ba0[reg >> 2]);
}
static unsigned int cs461x_peekBA0(unsigned long reg)
{
- return ba0[reg >> 2];
+ return readl(&ba0[reg >> 2]);
}
static int cs461x_free(struct pci_dev *pdev)
if(port){
gameport_unregister_port(port);
kfree(port);
- }
+ }
if (ba0) iounmap(ba0);
#ifdef CS461X_FULL_MAP
if (ba1.name.data0) iounmap(ba1.name.data0);
static int cs461x_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
{
unsigned js1, js2, jst;
-
+
js1 = cs461x_peekBA0(BA0_JSC1);
js2 = cs461x_peekBA0(BA0_JSC2);
jst = cs461x_peekBA0(BA0_JSPT);
-
- *buttons = (~jst >> 4) & 0x0F;
-
+
+ *buttons = (~jst >> 4) & 0x0F;
+
axes[0] = ((js1 & JSC1_Y1V_MASK) >> JSC1_Y1V_SHIFT) & 0xFFFF;
axes[1] = ((js1 & JSC1_X1V_MASK) >> JSC1_X1V_SHIFT) & 0xFFFF;
axes[2] = ((js2 & JSC2_Y2V_MASK) >> JSC2_Y2V_SHIFT) & 0xFFFF;
{
int rc;
struct gameport* port;
-
+
rc = pci_enable_device(pdev);
if (rc) {
printk(KERN_ERR "cs461x: Cannot enable PCI gameport (bus %d, devfn %d) error=%d\n",
#ifdef CS461X_FULL_MAP
ba1_addr = pci_resource_start(pdev, 1);
#endif
- if (ba0_addr == 0 || ba0_addr == ~0
+ if (ba0_addr == 0 || ba0_addr == ~0
#ifdef CS461X_FULL_MAP
|| ba1_addr == 0 || ba1_addr == ~0
#endif
memset(port, 0, sizeof(struct gameport));
pci_set_drvdata(pdev, port);
-
+
port->open = cs461x_gameport_open;
port->trigger = cs461x_gameport_trigger;
port->read = cs461x_gameport_read;
{
cs461x_free(pdev);
}
-
+
static struct pci_driver cs461x_pci_driver = {
- .name = "CS461x Gameport",
+ .name = "CS461x_gameport",
.id_table = cs461x_pci_tbl,
.probe = cs461x_pci_probe,
.remove = __devexit_p(cs461x_pci_remove),