1
2
3
4
5
6
7
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/module.h>
11#include <linux/dma-mapping.h>
12#include <linux/delay.h>
13#include <linux/interrupt.h>
14#include <linux/slab.h>
15#include <linux/pci.h>
16#include <sound/core.h>
17#include <sound/control.h>
18#include <sound/pcm.h>
19#include <sound/initval.h>
20#include "lola.h"
21
22
23static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
24static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
25static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
26
27module_param_array(index, int, NULL, 0444);
28MODULE_PARM_DESC(index, "Index value for Digigram Lola driver.");
29module_param_array(id, charp, NULL, 0444);
30MODULE_PARM_DESC(id, "ID string for Digigram Lola driver.");
31module_param_array(enable, bool, NULL, 0444);
32MODULE_PARM_DESC(enable, "Enable Digigram Lola driver.");
33
34
35
36
37
38
39static int granularity[SNDRV_CARDS] = {
40 [0 ... (SNDRV_CARDS - 1)] = LOLA_GRANULARITY_MAX
41};
42
43
44static int sample_rate_min[SNDRV_CARDS] = {
45 [0 ... (SNDRV_CARDS - 1) ] = 16000
46};
47
48module_param_array(granularity, int, NULL, 0444);
49MODULE_PARM_DESC(granularity, "Granularity value");
50module_param_array(sample_rate_min, int, NULL, 0444);
51MODULE_PARM_DESC(sample_rate_min, "Minimal sample rate");
52
53
54
55
56MODULE_LICENSE("GPL");
57MODULE_SUPPORTED_DEVICE("{{Digigram, Lola}}");
58MODULE_DESCRIPTION("Digigram Lola driver");
59MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
60
61#ifdef CONFIG_SND_DEBUG_VERBOSE
62static int debug;
63module_param(debug, int, 0644);
64#define verbose_debug(fmt, args...) \
65 do { if (debug > 1) pr_debug(SFX fmt, ##args); } while (0)
66#else
67#define verbose_debug(fmt, args...)
68#endif
69
70
71
72
73
74static int corb_send_verb(struct lola *chip, unsigned int nid,
75 unsigned int verb, unsigned int data,
76 unsigned int extdata)
77{
78 unsigned long flags;
79 int ret = -EIO;
80
81 chip->last_cmd_nid = nid;
82 chip->last_verb = verb;
83 chip->last_data = data;
84 chip->last_extdata = extdata;
85 data |= (nid << 20) | (verb << 8);
86
87 spin_lock_irqsave(&chip->reg_lock, flags);
88 if (chip->rirb.cmds < LOLA_CORB_ENTRIES - 1) {
89 unsigned int wp = chip->corb.wp + 1;
90 wp %= LOLA_CORB_ENTRIES;
91 chip->corb.wp = wp;
92 chip->corb.buf[wp * 2] = cpu_to_le32(data);
93 chip->corb.buf[wp * 2 + 1] = cpu_to_le32(extdata);
94 lola_writew(chip, BAR0, CORBWP, wp);
95 chip->rirb.cmds++;
96 smp_wmb();
97 ret = 0;
98 }
99 spin_unlock_irqrestore(&chip->reg_lock, flags);
100 return ret;
101}
102
103static void lola_queue_unsol_event(struct lola *chip, unsigned int res,
104 unsigned int res_ex)
105{
106 lola_update_ext_clock_freq(chip, res);
107}
108
109
110static void lola_update_rirb(struct lola *chip)
111{
112 unsigned int rp, wp;
113 u32 res, res_ex;
114
115 wp = lola_readw(chip, BAR0, RIRBWP);
116 if (wp == chip->rirb.wp)
117 return;
118 chip->rirb.wp = wp;
119
120 while (chip->rirb.rp != wp) {
121 chip->rirb.rp++;
122 chip->rirb.rp %= LOLA_CORB_ENTRIES;
123
124 rp = chip->rirb.rp << 1;
125 res_ex = le32_to_cpu(chip->rirb.buf[rp + 1]);
126 res = le32_to_cpu(chip->rirb.buf[rp]);
127 if (res_ex & LOLA_RIRB_EX_UNSOL_EV)
128 lola_queue_unsol_event(chip, res, res_ex);
129 else if (chip->rirb.cmds) {
130 chip->res = res;
131 chip->res_ex = res_ex;
132 smp_wmb();
133 chip->rirb.cmds--;
134 }
135 }
136}
137
138static int rirb_get_response(struct lola *chip, unsigned int *val,
139 unsigned int *extval)
140{
141 unsigned long timeout;
142
143 again:
144 timeout = jiffies + msecs_to_jiffies(1000);
145 for (;;) {
146 if (chip->polling_mode) {
147 spin_lock_irq(&chip->reg_lock);
148 lola_update_rirb(chip);
149 spin_unlock_irq(&chip->reg_lock);
150 }
151 if (!chip->rirb.cmds) {
152 *val = chip->res;
153 if (extval)
154 *extval = chip->res_ex;
155 verbose_debug("get_response: %x, %x\n",
156 chip->res, chip->res_ex);
157 if (chip->res_ex & LOLA_RIRB_EX_ERROR) {
158 dev_warn(chip->card->dev, "RIRB ERROR: "
159 "NID=%x, verb=%x, data=%x, ext=%x\n",
160 chip->last_cmd_nid,
161 chip->last_verb, chip->last_data,
162 chip->last_extdata);
163 return -EIO;
164 }
165 return 0;
166 }
167 if (time_after(jiffies, timeout))
168 break;
169 udelay(20);
170 cond_resched();
171 }
172 dev_warn(chip->card->dev, "RIRB response error\n");
173 if (!chip->polling_mode) {
174 dev_warn(chip->card->dev, "switching to polling mode\n");
175 chip->polling_mode = 1;
176 goto again;
177 }
178 return -EIO;
179}
180
181
182int lola_codec_write(struct lola *chip, unsigned int nid, unsigned int verb,
183 unsigned int data, unsigned int extdata)
184{
185 verbose_debug("codec_write NID=%x, verb=%x, data=%x, ext=%x\n",
186 nid, verb, data, extdata);
187 return corb_send_verb(chip, nid, verb, data, extdata);
188}
189
190
191int lola_codec_read(struct lola *chip, unsigned int nid, unsigned int verb,
192 unsigned int data, unsigned int extdata,
193 unsigned int *val, unsigned int *extval)
194{
195 int err;
196
197 verbose_debug("codec_read NID=%x, verb=%x, data=%x, ext=%x\n",
198 nid, verb, data, extdata);
199 err = corb_send_verb(chip, nid, verb, data, extdata);
200 if (err < 0)
201 return err;
202 err = rirb_get_response(chip, val, extval);
203 return err;
204}
205
206
207int lola_codec_flush(struct lola *chip)
208{
209 unsigned int tmp;
210 return rirb_get_response(chip, &tmp, NULL);
211}
212
213
214
215
216static irqreturn_t lola_interrupt(int irq, void *dev_id)
217{
218 struct lola *chip = dev_id;
219 unsigned int notify_ins, notify_outs, error_ins, error_outs;
220 int handled = 0;
221 int i;
222
223 notify_ins = notify_outs = error_ins = error_outs = 0;
224 spin_lock(&chip->reg_lock);
225 for (;;) {
226 unsigned int status, in_sts, out_sts;
227 unsigned int reg;
228
229 status = lola_readl(chip, BAR1, DINTSTS);
230 if (!status || status == -1)
231 break;
232
233 in_sts = lola_readl(chip, BAR1, DIINTSTS);
234 out_sts = lola_readl(chip, BAR1, DOINTSTS);
235
236
237 for (i = 0; in_sts && i < chip->pcm[CAPT].num_streams; i++) {
238 if (!(in_sts & (1 << i)))
239 continue;
240 in_sts &= ~(1 << i);
241 reg = lola_dsd_read(chip, i, STS);
242 if (reg & LOLA_DSD_STS_DESE)
243 error_ins |= (1 << i);
244 if (reg & LOLA_DSD_STS_BCIS)
245 notify_ins |= (1 << i);
246
247 lola_dsd_write(chip, i, STS, reg);
248 }
249
250
251 for (i = 0; out_sts && i < chip->pcm[PLAY].num_streams; i++) {
252 if (!(out_sts & (1 << i)))
253 continue;
254 out_sts &= ~(1 << i);
255 reg = lola_dsd_read(chip, i + MAX_STREAM_IN_COUNT, STS);
256 if (reg & LOLA_DSD_STS_DESE)
257 error_outs |= (1 << i);
258 if (reg & LOLA_DSD_STS_BCIS)
259 notify_outs |= (1 << i);
260 lola_dsd_write(chip, i + MAX_STREAM_IN_COUNT, STS, reg);
261 }
262
263 if (status & LOLA_DINT_CTRL) {
264 unsigned char rbsts;
265 rbsts = lola_readb(chip, BAR0, RIRBSTS);
266 rbsts &= LOLA_RIRB_INT_MASK;
267 if (rbsts)
268 lola_writeb(chip, BAR0, RIRBSTS, rbsts);
269 rbsts = lola_readb(chip, BAR0, CORBSTS);
270 rbsts &= LOLA_CORB_INT_MASK;
271 if (rbsts)
272 lola_writeb(chip, BAR0, CORBSTS, rbsts);
273
274 lola_update_rirb(chip);
275 }
276
277 if (status & (LOLA_DINT_FIFOERR | LOLA_DINT_MUERR)) {
278
279 lola_writel(chip, BAR1, DINTSTS,
280 (status & (LOLA_DINT_FIFOERR | LOLA_DINT_MUERR)));
281 }
282 handled = 1;
283 }
284 spin_unlock(&chip->reg_lock);
285
286 lola_pcm_update(chip, &chip->pcm[CAPT], notify_ins);
287 lola_pcm_update(chip, &chip->pcm[PLAY], notify_outs);
288
289 return IRQ_RETVAL(handled);
290}
291
292
293
294
295
296static int reset_controller(struct lola *chip)
297{
298 unsigned int gctl = lola_readl(chip, BAR0, GCTL);
299 unsigned long end_time;
300
301 if (gctl) {
302
303 lola_writel(chip, BAR1, BOARD_MODE, 0);
304 return 0;
305 }
306
307 chip->cold_reset = 1;
308 lola_writel(chip, BAR0, GCTL, LOLA_GCTL_RESET);
309 end_time = jiffies + msecs_to_jiffies(200);
310 do {
311 msleep(1);
312 gctl = lola_readl(chip, BAR0, GCTL);
313 if (gctl)
314 break;
315 } while (time_before(jiffies, end_time));
316 if (!gctl) {
317 dev_err(chip->card->dev, "cannot reset controller\n");
318 return -EIO;
319 }
320 return 0;
321}
322
323static void lola_irq_enable(struct lola *chip)
324{
325 unsigned int val;
326
327
328 val = (1 << chip->pcm[PLAY].num_streams) - 1;
329 lola_writel(chip, BAR1, DOINTCTL, val);
330 val = (1 << chip->pcm[CAPT].num_streams) - 1;
331 lola_writel(chip, BAR1, DIINTCTL, val);
332
333
334 val = LOLA_DINT_GLOBAL | LOLA_DINT_CTRL | LOLA_DINT_FIFOERR |
335 LOLA_DINT_MUERR;
336 lola_writel(chip, BAR1, DINTCTL, val);
337}
338
339static void lola_irq_disable(struct lola *chip)
340{
341 lola_writel(chip, BAR1, DINTCTL, 0);
342 lola_writel(chip, BAR1, DIINTCTL, 0);
343 lola_writel(chip, BAR1, DOINTCTL, 0);
344}
345
346static int setup_corb_rirb(struct lola *chip)
347{
348 int err;
349 unsigned char tmp;
350 unsigned long end_time;
351
352 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
353 &chip->pci->dev,
354 PAGE_SIZE, &chip->rb);
355 if (err < 0)
356 return err;
357
358 chip->corb.addr = chip->rb.addr;
359 chip->corb.buf = (__le32 *)chip->rb.area;
360 chip->rirb.addr = chip->rb.addr + 2048;
361 chip->rirb.buf = (__le32 *)(chip->rb.area + 2048);
362
363
364 lola_writeb(chip, BAR0, RIRBCTL, 0);
365 lola_writeb(chip, BAR0, CORBCTL, 0);
366
367 end_time = jiffies + msecs_to_jiffies(200);
368 do {
369 if (!lola_readb(chip, BAR0, RIRBCTL) &&
370 !lola_readb(chip, BAR0, CORBCTL))
371 break;
372 msleep(1);
373 } while (time_before(jiffies, end_time));
374
375
376 lola_writel(chip, BAR0, CORBLBASE, (u32)chip->corb.addr);
377 lola_writel(chip, BAR0, CORBUBASE, upper_32_bits(chip->corb.addr));
378
379 lola_writeb(chip, BAR0, CORBSIZE, 0x02);
380
381 lola_writew(chip, BAR0, CORBWP, 0);
382
383 lola_writew(chip, BAR0, CORBRP, LOLA_RBRWP_CLR);
384
385 lola_writeb(chip, BAR0, CORBCTL, LOLA_RBCTL_DMA_EN);
386
387 tmp = lola_readb(chip, BAR0, CORBSTS) & LOLA_CORB_INT_MASK;
388 if (tmp)
389 lola_writeb(chip, BAR0, CORBSTS, tmp);
390 chip->corb.wp = 0;
391
392
393 lola_writel(chip, BAR0, RIRBLBASE, (u32)chip->rirb.addr);
394 lola_writel(chip, BAR0, RIRBUBASE, upper_32_bits(chip->rirb.addr));
395
396 lola_writeb(chip, BAR0, RIRBSIZE, 0x02);
397
398 lola_writew(chip, BAR0, RIRBWP, LOLA_RBRWP_CLR);
399
400 lola_writew(chip, BAR0, RINTCNT, 1);
401
402 lola_writeb(chip, BAR0, RIRBCTL, LOLA_RBCTL_DMA_EN | LOLA_RBCTL_IRQ_EN);
403
404 tmp = lola_readb(chip, BAR0, RIRBSTS) & LOLA_RIRB_INT_MASK;
405 if (tmp)
406 lola_writeb(chip, BAR0, RIRBSTS, tmp);
407 chip->rirb.rp = chip->rirb.cmds = 0;
408
409 return 0;
410}
411
412static void stop_corb_rirb(struct lola *chip)
413{
414
415 lola_writeb(chip, BAR0, RIRBCTL, 0);
416 lola_writeb(chip, BAR0, CORBCTL, 0);
417}
418
419static void lola_reset_setups(struct lola *chip)
420{
421
422 lola_set_granularity(chip, chip->granularity, true);
423
424 lola_set_clock_index(chip, chip->clock.cur_index);
425
426 lola_enable_clock_events(chip);
427
428 lola_setup_all_analog_gains(chip, CAPT, false);
429
430 lola_set_src_config(chip, chip->input_src_mask, false);
431
432 lola_setup_all_analog_gains(chip, PLAY, false);
433}
434
435static int lola_parse_tree(struct lola *chip)
436{
437 unsigned int val;
438 int nid, err;
439
440 err = lola_read_param(chip, 0, LOLA_PAR_VENDOR_ID, &val);
441 if (err < 0) {
442 dev_err(chip->card->dev, "Can't read VENDOR_ID\n");
443 return err;
444 }
445 val >>= 16;
446 if (val != 0x1369) {
447 dev_err(chip->card->dev, "Unknown codec vendor 0x%x\n", val);
448 return -EINVAL;
449 }
450
451 err = lola_read_param(chip, 1, LOLA_PAR_FUNCTION_TYPE, &val);
452 if (err < 0) {
453 dev_err(chip->card->dev, "Can't read FUNCTION_TYPE\n");
454 return err;
455 }
456 if (val != 1) {
457 dev_err(chip->card->dev, "Unknown function type %d\n", val);
458 return -EINVAL;
459 }
460
461 err = lola_read_param(chip, 1, LOLA_PAR_SPECIFIC_CAPS, &val);
462 if (err < 0) {
463 dev_err(chip->card->dev, "Can't read SPECCAPS\n");
464 return err;
465 }
466 chip->lola_caps = val;
467 chip->pin[CAPT].num_pins = LOLA_AFG_INPUT_PIN_COUNT(chip->lola_caps);
468 chip->pin[PLAY].num_pins = LOLA_AFG_OUTPUT_PIN_COUNT(chip->lola_caps);
469 dev_dbg(chip->card->dev, "speccaps=0x%x, pins in=%d, out=%d\n",
470 chip->lola_caps,
471 chip->pin[CAPT].num_pins, chip->pin[PLAY].num_pins);
472
473 if (chip->pin[CAPT].num_pins > MAX_AUDIO_INOUT_COUNT ||
474 chip->pin[PLAY].num_pins > MAX_AUDIO_INOUT_COUNT) {
475 dev_err(chip->card->dev, "Invalid Lola-spec caps 0x%x\n", val);
476 return -EINVAL;
477 }
478
479 nid = 0x02;
480 err = lola_init_pcm(chip, CAPT, &nid);
481 if (err < 0)
482 return err;
483 err = lola_init_pcm(chip, PLAY, &nid);
484 if (err < 0)
485 return err;
486
487 err = lola_init_pins(chip, CAPT, &nid);
488 if (err < 0)
489 return err;
490 err = lola_init_pins(chip, PLAY, &nid);
491 if (err < 0)
492 return err;
493
494 if (LOLA_AFG_CLOCK_WIDGET_PRESENT(chip->lola_caps)) {
495 err = lola_init_clock_widget(chip, nid);
496 if (err < 0)
497 return err;
498 nid++;
499 }
500 if (LOLA_AFG_MIXER_WIDGET_PRESENT(chip->lola_caps)) {
501 err = lola_init_mixer_widget(chip, nid);
502 if (err < 0)
503 return err;
504 nid++;
505 }
506
507
508 err = lola_enable_clock_events(chip);
509 if (err < 0)
510 return err;
511
512
513
514
515 if (!chip->cold_reset) {
516 lola_reset_setups(chip);
517 chip->cold_reset = 1;
518 } else {
519
520 if (chip->granularity != LOLA_GRANULARITY_MIN)
521 lola_set_granularity(chip, chip->granularity, true);
522 }
523
524 return 0;
525}
526
527static void lola_stop_hw(struct lola *chip)
528{
529 stop_corb_rirb(chip);
530 lola_irq_disable(chip);
531}
532
533static void lola_free(struct lola *chip)
534{
535 if (chip->initialized)
536 lola_stop_hw(chip);
537 lola_free_pcm(chip);
538 lola_free_mixer(chip);
539 if (chip->irq >= 0)
540 free_irq(chip->irq, (void *)chip);
541 iounmap(chip->bar[0].remap_addr);
542 iounmap(chip->bar[1].remap_addr);
543 if (chip->rb.area)
544 snd_dma_free_pages(&chip->rb);
545 pci_release_regions(chip->pci);
546 pci_disable_device(chip->pci);
547 kfree(chip);
548}
549
550static int lola_dev_free(struct snd_device *device)
551{
552 lola_free(device->device_data);
553 return 0;
554}
555
556static int lola_create(struct snd_card *card, struct pci_dev *pci,
557 int dev, struct lola **rchip)
558{
559 struct lola *chip;
560 int err;
561 unsigned int dever;
562 static const struct snd_device_ops ops = {
563 .dev_free = lola_dev_free,
564 };
565
566 *rchip = NULL;
567
568 err = pci_enable_device(pci);
569 if (err < 0)
570 return err;
571
572 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
573 if (!chip) {
574 pci_disable_device(pci);
575 return -ENOMEM;
576 }
577
578 spin_lock_init(&chip->reg_lock);
579 mutex_init(&chip->open_mutex);
580 chip->card = card;
581 chip->pci = pci;
582 chip->irq = -1;
583
584 chip->granularity = granularity[dev];
585 switch (chip->granularity) {
586 case 8:
587 chip->sample_rate_max = 48000;
588 break;
589 case 16:
590 chip->sample_rate_max = 96000;
591 break;
592 case 32:
593 chip->sample_rate_max = 192000;
594 break;
595 default:
596 dev_warn(chip->card->dev,
597 "Invalid granularity %d, reset to %d\n",
598 chip->granularity, LOLA_GRANULARITY_MAX);
599 chip->granularity = LOLA_GRANULARITY_MAX;
600 chip->sample_rate_max = 192000;
601 break;
602 }
603 chip->sample_rate_min = sample_rate_min[dev];
604 if (chip->sample_rate_min > chip->sample_rate_max) {
605 dev_warn(chip->card->dev,
606 "Invalid sample_rate_min %d, reset to 16000\n",
607 chip->sample_rate_min);
608 chip->sample_rate_min = 16000;
609 }
610
611 err = pci_request_regions(pci, DRVNAME);
612 if (err < 0) {
613 kfree(chip);
614 pci_disable_device(pci);
615 return err;
616 }
617
618 chip->bar[0].addr = pci_resource_start(pci, 0);
619 chip->bar[0].remap_addr = pci_ioremap_bar(pci, 0);
620 chip->bar[1].addr = pci_resource_start(pci, 2);
621 chip->bar[1].remap_addr = pci_ioremap_bar(pci, 2);
622 if (!chip->bar[0].remap_addr || !chip->bar[1].remap_addr) {
623 dev_err(chip->card->dev, "ioremap error\n");
624 err = -ENXIO;
625 goto errout;
626 }
627
628 pci_set_master(pci);
629
630 err = reset_controller(chip);
631 if (err < 0)
632 goto errout;
633
634 if (request_irq(pci->irq, lola_interrupt, IRQF_SHARED,
635 KBUILD_MODNAME, chip)) {
636 dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
637 err = -EBUSY;
638 goto errout;
639 }
640 chip->irq = pci->irq;
641 card->sync_irq = chip->irq;
642
643 dever = lola_readl(chip, BAR1, DEVER);
644 chip->pcm[CAPT].num_streams = (dever >> 0) & 0x3ff;
645 chip->pcm[PLAY].num_streams = (dever >> 10) & 0x3ff;
646 chip->version = (dever >> 24) & 0xff;
647 dev_dbg(chip->card->dev, "streams in=%d, out=%d, version=0x%x\n",
648 chip->pcm[CAPT].num_streams, chip->pcm[PLAY].num_streams,
649 chip->version);
650
651
652 if (chip->pcm[CAPT].num_streams > MAX_STREAM_IN_COUNT ||
653 chip->pcm[PLAY].num_streams > MAX_STREAM_OUT_COUNT ||
654 (!chip->pcm[CAPT].num_streams &&
655 !chip->pcm[PLAY].num_streams)) {
656 dev_err(chip->card->dev, "invalid DEVER = %x\n", dever);
657 err = -EINVAL;
658 goto errout;
659 }
660
661 err = setup_corb_rirb(chip);
662 if (err < 0)
663 goto errout;
664
665 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
666 if (err < 0) {
667 dev_err(chip->card->dev, "Error creating device [card]!\n");
668 goto errout;
669 }
670
671 strcpy(card->driver, "Lola");
672 strlcpy(card->shortname, "Digigram Lola", sizeof(card->shortname));
673 snprintf(card->longname, sizeof(card->longname),
674 "%s at 0x%lx irq %i",
675 card->shortname, chip->bar[0].addr, chip->irq);
676 strcpy(card->mixername, card->shortname);
677
678 lola_irq_enable(chip);
679
680 chip->initialized = 1;
681 *rchip = chip;
682 return 0;
683
684 errout:
685 lola_free(chip);
686 return err;
687}
688
689static int lola_probe(struct pci_dev *pci,
690 const struct pci_device_id *pci_id)
691{
692 static int dev;
693 struct snd_card *card;
694 struct lola *chip;
695 int err;
696
697 if (dev >= SNDRV_CARDS)
698 return -ENODEV;
699 if (!enable[dev]) {
700 dev++;
701 return -ENOENT;
702 }
703
704 err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
705 0, &card);
706 if (err < 0) {
707 dev_err(&pci->dev, "Error creating card!\n");
708 return err;
709 }
710
711 err = lola_create(card, pci, dev, &chip);
712 if (err < 0)
713 goto out_free;
714 card->private_data = chip;
715
716 err = lola_parse_tree(chip);
717 if (err < 0)
718 goto out_free;
719
720 err = lola_create_pcm(chip);
721 if (err < 0)
722 goto out_free;
723
724 err = lola_create_mixer(chip);
725 if (err < 0)
726 goto out_free;
727
728 lola_proc_debug_new(chip);
729
730 err = snd_card_register(card);
731 if (err < 0)
732 goto out_free;
733
734 pci_set_drvdata(pci, card);
735 dev++;
736 return err;
737out_free:
738 snd_card_free(card);
739 return err;
740}
741
742static void lola_remove(struct pci_dev *pci)
743{
744 snd_card_free(pci_get_drvdata(pci));
745}
746
747
748static const struct pci_device_id lola_ids[] = {
749 { PCI_VDEVICE(DIGIGRAM, 0x0001) },
750 { 0, }
751};
752MODULE_DEVICE_TABLE(pci, lola_ids);
753
754
755static struct pci_driver lola_driver = {
756 .name = KBUILD_MODNAME,
757 .id_table = lola_ids,
758 .probe = lola_probe,
759 .remove = lola_remove,
760};
761
762module_pci_driver(lola_driver);
763