23 #include <linux/pci.h>
24 #include <linux/time.h>
25 #include <linux/module.h>
47 #ifdef SUPPORT_JOYSTICK
62 #ifdef SUPPORT_JOYSTICK
81 #ifdef SUPPORT_JOYSTICK
83 int legacy_ctrl,
int legacy_ctrl2)
92 if (chip->
pci->device >= 0x0010) {
102 for (io_port = 0x201; io_port <= 0x205; io_port++) {
103 if (io_port == 0x203)
114 case 0x201: legacy_ctrl2 |= 0 << 6;
break;
115 case 0x202: legacy_ctrl2 |= 1 << 6;
break;
116 case 0x204: legacy_ctrl2 |= 2 << 6;
break;
117 case 0x205: legacy_ctrl2 |= 3 << 6;
break;
125 printk(
KERN_ERR "ymfpci: joystick port %#x is in use.\n", io_port);
129 chip->gameport = gp = gameport_allocate_port();
137 gameport_set_name(gp,
"Yamaha YMF Gameport");
139 gameport_set_dev_parent(gp, &chip->
pci->dev);
141 gameport_set_port_data(gp, r);
143 if (chip->
pci->device >= 0x0010)
149 gameport_register_port(chip->gameport);
156 if (chip->gameport) {
157 struct resource *r = gameport_get_port_data(chip->gameport);
160 chip->gameport =
NULL;
166 static inline int snd_ymfpci_create_gameport(
struct snd_ymfpci *chip,
int dev,
int l,
int l2) {
return -
ENOSYS; }
181 u16 legacy_ctrl, legacy_ctrl2, old_legacy_ctrl;
195 case 0x0004: str =
"YMF724"; model =
"DS-1";
break;
196 case 0x000d: str =
"YMF724F"; model =
"DS-1";
break;
197 case 0x000a: str =
"YMF740"; model =
"DS-1L";
break;
198 case 0x000c: str =
"YMF740C"; model =
"DS-1L";
break;
199 case 0x0010: str =
"YMF744"; model =
"DS-1S";
break;
200 case 0x0012: str =
"YMF754"; model =
"DS-1E";
break;
201 default: model = str =
"???";
break;
205 legacy_ctrl2 = 0x0800;
207 if (pci_id->
device >= 0x0010) {
208 if (fm_port[dev] == 1) {
212 if (fm_port[dev] > 0 &&
217 if (mpu_port[dev] == 1) {
221 if (mpu_port[dev] > 0 &&
227 switch (fm_port[dev]) {
228 case 0x388: legacy_ctrl2 |= 0;
break;
229 case 0x398: legacy_ctrl2 |= 1;
break;
230 case 0x3a0: legacy_ctrl2 |= 2;
break;
231 case 0x3a8: legacy_ctrl2 |= 3;
break;
232 default: fm_port[
dev] = 0;
break;
234 if (fm_port[dev] > 0 &&
241 switch (mpu_port[dev]) {
242 case 0x330: legacy_ctrl2 |= 0 << 4;
break;
243 case 0x300: legacy_ctrl2 |= 1 << 4;
break;
244 case 0x332: legacy_ctrl2 |= 2 << 4;
break;
245 case 0x334: legacy_ctrl2 |= 3 << 4;
break;
246 default: mpu_port[
dev] = 0;
break;
248 if (mpu_port[dev] > 0 &&
316 printk(
KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", mpu_port[dev]);
326 printk(
KERN_WARNING "ymfpci: cannot initialize FM OPL3 at 0x%lx, skipping...\n", fm_port[dev]);
336 snd_ymfpci_create_gameport(chip, dev, legacy_ctrl, legacy_ctrl2);
342 pci_set_drvdata(pci, card);
350 pci_set_drvdata(pci,
NULL);
354 .name = KBUILD_MODNAME,
355 .id_table = snd_ymfpci_ids,
356 .probe = snd_card_ymfpci_probe,
358 #ifdef CONFIG_PM_SLEEP