Lines Matching +full:irq +full:- +full:device

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Driver for generic MPU-401 boards (UART mode only)
18 MODULE_DESCRIPTION("MPU-401 UART");
21 static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* exclude the first card */
25 static bool pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
27 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* MPU-401 port number */
28 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* MPU-401 IRQ */ variable
29 static bool uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
32 MODULE_PARM_DESC(index, "Index value for MPU-401 device.");
34 MODULE_PARM_DESC(id, "ID string for MPU-401 device.");
36 MODULE_PARM_DESC(enable, "Enable MPU-401 device.");
39 MODULE_PARM_DESC(pnp, "PnP detection for MPU-401 device.");
42 MODULE_PARM_DESC(port, "Port # for MPU-401 device.");
43 module_param_hw_array(irq, int, irq, NULL, 0444);
44 MODULE_PARM_DESC(irq, "IRQ # for MPU-401 device.");
52 static int snd_mpu401_create(struct device *devptr, int dev, in snd_mpu401_create()
66 strcpy(card->driver, "MPU-401 UART"); in snd_mpu401_create()
67 strcpy(card->shortname, card->driver); in snd_mpu401_create()
68 sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]); in snd_mpu401_create()
69 if (irq[dev] >= 0) { in snd_mpu401_create()
70 sprintf(card->longname + strlen(card->longname), "irq %d", irq[dev]); in snd_mpu401_create()
72 strcat(card->longname, "polled"); in snd_mpu401_create()
76 irq[dev], NULL); in snd_mpu401_create()
88 int dev = devptr->id; in snd_mpu401_probe()
93 dev_err(&devptr->dev, "specify port\n"); in snd_mpu401_probe()
94 return -EINVAL; in snd_mpu401_probe()
96 if (irq[dev] == SNDRV_AUTO_IRQ) { in snd_mpu401_probe()
97 dev_err(&devptr->dev, "specify or disable IRQ\n"); in snd_mpu401_probe()
98 return -EINVAL; in snd_mpu401_probe()
100 err = snd_mpu401_create(&devptr->dev, dev, &card); in snd_mpu401_probe()
131 static int snd_mpu401_pnp(int dev, struct pnp_dev *device, in snd_mpu401_pnp() argument
134 if (!pnp_port_valid(device, 0) || in snd_mpu401_pnp()
135 pnp_port_flags(device, 0) & IORESOURCE_DISABLED) { in snd_mpu401_pnp()
136 dev_err(&device->dev, "no PnP port\n"); in snd_mpu401_pnp()
137 return -ENODEV; in snd_mpu401_pnp()
139 if (pnp_port_len(device, 0) < IO_EXTENT) { in snd_mpu401_pnp()
140 dev_err(&device->dev, "PnP port length is %llu, expected %d\n", in snd_mpu401_pnp()
141 (unsigned long long)pnp_port_len(device, 0), in snd_mpu401_pnp()
143 return -ENODEV; in snd_mpu401_pnp()
145 port[dev] = pnp_port_start(device, 0); in snd_mpu401_pnp()
147 if (!pnp_irq_valid(device, 0) || in snd_mpu401_pnp()
148 pnp_irq_flags(device, 0) & IORESOURCE_DISABLED) { in snd_mpu401_pnp()
149 dev_warn(&device->dev, "no PnP irq, using polling\n"); in snd_mpu401_pnp()
150 irq[dev] = -1; in snd_mpu401_pnp()
152 irq[dev] = pnp_irq(device, 0); in snd_mpu401_pnp()
170 err = snd_mpu401_create(&pnp_dev->dev, dev, &card); in snd_mpu401_pnp_probe()
181 return -ENODEV; in snd_mpu401_pnp_probe()
213 struct platform_device *device; in alsa_card_mpu401_init() local
220 device = platform_device_register_simple(SND_MPU401_DRIVER, in alsa_card_mpu401_init()
222 if (IS_ERR(device)) in alsa_card_mpu401_init()
224 if (!platform_get_drvdata(device)) { in alsa_card_mpu401_init()
225 platform_device_unregister(device); in alsa_card_mpu401_init()
228 platform_devices[i] = device; in alsa_card_mpu401_init()
237 pr_err("MPU-401 device not found or device busy\n"); in alsa_card_mpu401_init()
240 return -ENODEV; in alsa_card_mpu401_init()