Lines Matching +full:ati +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * ALSA driver for ATI IXP 150/200/250/300 AC97 controllers
24 MODULE_DESCRIPTION("ATI IXP AC97 controller");
27 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
32 static int ac97_codec = -1;
35 MODULE_PARM_DESC(index, "Index value for ATI IXP controller.");
37 MODULE_PARM_DESC(id, "ID string for ATI IXP controller.");
45 MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link.");
143 #define ATI_REG_OUT_DMA_SLOT_BIT(x) (1U << ((x) - 3))
169 #define ATI_REG_6CH_REORDER_EN (1U<<0) /* 3,4,7,8,6,9 -> 3,4,6,9,7,8 */
239 int ac97_pcm_type; /* index # of ac97_pcm to access, -1 = not used */
244 * ATI IXP chip
275 { PCI_VDEVICE(ATI, 0x4341), 0 }, /* SB200 */
276 { PCI_VDEVICE(ATI, 0x4361), 0 }, /* SB300 */
277 { PCI_VDEVICE(ATI, 0x4370), 0 }, /* SB400 */
278 { PCI_VDEVICE(ATI, 0x4382), 0 }, /* SB600 */
285 SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0),
301 void __iomem *addr = chip->remap_addr + reg; in snd_atiixp_update_bits()
316 writel(value, chip->remap_addr + ATI_REG_##reg)
318 readl(chip->remap_addr + ATI_REG_##reg)
326 * in a future version, a scatter-gather buffer should be implemented.
351 return -ENOMEM; in atiixp_build_dma_packets()
353 if (dma->desc_buf.area == NULL) { in atiixp_build_dma_packets()
355 &chip->pci->dev, in atiixp_build_dma_packets()
357 &dma->desc_buf) < 0) in atiixp_build_dma_packets()
358 return -ENOMEM; in atiixp_build_dma_packets()
359 dma->period_bytes = dma->periods = 0; /* clear */ in atiixp_build_dma_packets()
362 if (dma->periods == periods && dma->period_bytes == period_bytes) in atiixp_build_dma_packets()
366 spin_lock_irqsave(&chip->reg_lock, flags); in atiixp_build_dma_packets()
367 writel(0, chip->remap_addr + dma->ops->llp_offset); in atiixp_build_dma_packets()
368 dma->ops->enable_dma(chip, 0); in atiixp_build_dma_packets()
369 dma->ops->enable_dma(chip, 1); in atiixp_build_dma_packets()
370 spin_unlock_irqrestore(&chip->reg_lock, flags); in atiixp_build_dma_packets()
373 addr = (u32)substream->runtime->dma_addr; in atiixp_build_dma_packets()
374 desc_addr = (u32)dma->desc_buf.addr; in atiixp_build_dma_packets()
377 desc = &((struct atiixp_dma_desc *)dma->desc_buf.area)[i]; in atiixp_build_dma_packets()
378 desc->addr = cpu_to_le32(addr); in atiixp_build_dma_packets()
379 desc->status = 0; in atiixp_build_dma_packets()
380 desc->size = period_bytes >> 2; /* in dwords */ in atiixp_build_dma_packets()
382 if (i == periods - 1) in atiixp_build_dma_packets()
383 desc->next = cpu_to_le32((u32)dma->desc_buf.addr); in atiixp_build_dma_packets()
385 desc->next = cpu_to_le32(desc_addr); in atiixp_build_dma_packets()
389 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, in atiixp_build_dma_packets()
390 chip->remap_addr + dma->ops->llp_offset); in atiixp_build_dma_packets()
392 dma->period_bytes = period_bytes; in atiixp_build_dma_packets()
393 dma->periods = periods; in atiixp_build_dma_packets()
404 if (dma->desc_buf.area) { in atiixp_clear_dma_packets()
405 writel(0, chip->remap_addr + dma->ops->llp_offset); in atiixp_clear_dma_packets()
406 snd_dma_free_pages(&dma->desc_buf); in atiixp_clear_dma_packets()
407 dma->desc_buf.area = NULL; in atiixp_clear_dma_packets()
419 if (! timeout--) { in snd_atiixp_acquire_codec()
420 dev_warn(chip->card->dev, "codec acquire timeout\n"); in snd_atiixp_acquire_codec()
421 return -EBUSY; in snd_atiixp_acquire_codec()
448 } while (--timeout); in snd_atiixp_codec_read()
451 dev_warn(chip->card->dev, "codec read timeout (reg %x)\n", reg); in snd_atiixp_codec_read()
473 struct atiixp *chip = ac97->private_data; in snd_atiixp_ac97_read()
474 return snd_atiixp_codec_read(chip, ac97->num, reg); in snd_atiixp_ac97_read()
481 struct atiixp *chip = ac97->private_data; in snd_atiixp_ac97_write()
482 snd_atiixp_codec_write(chip, ac97->num, reg, val); in snd_atiixp_ac97_write()
510 if (!--timeout) { in snd_atiixp_aclink_reset()
511 dev_err(chip->card->dev, "codec reset timeout\n"); in snd_atiixp_aclink_reset()
526 // return -EBUSY; in snd_atiixp_aclink_down()
534 * auto-detection of codecs
536 * the IXP chip can generate interrupts for the non-existing codecs.
553 dev_dbg(&pci->dev, "atiixp quirk for %s. Forcing codec %d\n", in ac97_probing_bugs()
554 snd_pci_quirk_name(q), q->value); in ac97_probing_bugs()
555 return q->value; in ac97_probing_bugs()
558 return -1; in ac97_probing_bugs()
565 chip->codec_not_ready_bits = 0; in snd_atiixp_codec_detect()
566 if (ac97_codec == -1) in snd_atiixp_codec_detect()
567 ac97_codec = ac97_probing_bugs(chip->pci); in snd_atiixp_codec_detect()
569 chip->codec_not_ready_bits |= in snd_atiixp_codec_detect()
577 while (timeout-- > 0) { in snd_atiixp_codec_detect()
579 if (chip->codec_not_ready_bits) in snd_atiixp_codec_detect()
584 if ((chip->codec_not_ready_bits & ALL_CODEC_NOT_READY) == ALL_CODEC_NOT_READY) { in snd_atiixp_codec_detect()
585 dev_err(chip->card->dev, "no codec detected!\n"); in snd_atiixp_codec_detect()
586 return -ENXIO; in snd_atiixp_codec_detect()
599 /* set up spdif, enable burst mode */ in snd_atiixp_chip_start()
641 * position. when SG-buffer is implemented, the offset must be calculated
647 struct snd_pcm_runtime *runtime = substream->runtime; in snd_atiixp_pcm_pointer()
648 struct atiixp_dma *dma = runtime->private_data; in snd_atiixp_pcm_pointer()
652 while (timeout--) { in snd_atiixp_pcm_pointer()
653 curptr = readl(chip->remap_addr + dma->ops->dt_cur); in snd_atiixp_pcm_pointer()
654 if (curptr < dma->buf_addr) in snd_atiixp_pcm_pointer()
656 curptr -= dma->buf_addr; in snd_atiixp_pcm_pointer()
657 if (curptr >= dma->buf_bytes) in snd_atiixp_pcm_pointer()
661 dev_dbg(chip->card->dev, "invalid DMA pointer read 0x%x (buf=%x)\n", in snd_atiixp_pcm_pointer()
662 readl(chip->remap_addr + dma->ops->dt_cur), dma->buf_addr); in snd_atiixp_pcm_pointer()
671 if (! dma->substream || ! dma->running) in snd_atiixp_xrun_dma()
673 dev_dbg(chip->card->dev, "XRUN detected (DMA %d)\n", dma->ops->type); in snd_atiixp_xrun_dma()
674 snd_pcm_stop_xrun(dma->substream); in snd_atiixp_xrun_dma()
682 if (! dma->substream || ! dma->running) in snd_atiixp_update_dma()
684 snd_pcm_period_elapsed(dma->substream); in snd_atiixp_update_dma()
707 struct atiixp_dma *dma = substream->runtime->private_data; in snd_atiixp_pcm_trigger()
710 if (snd_BUG_ON(!dma->ops->enable_transfer || in snd_atiixp_pcm_trigger()
711 !dma->ops->flush_dma)) in snd_atiixp_pcm_trigger()
712 return -EINVAL; in snd_atiixp_pcm_trigger()
714 spin_lock(&chip->reg_lock); in snd_atiixp_pcm_trigger()
719 if (dma->running && dma->suspended && in snd_atiixp_pcm_trigger()
721 writel(dma->saved_curptr, chip->remap_addr + in snd_atiixp_pcm_trigger()
722 dma->ops->dt_cur); in snd_atiixp_pcm_trigger()
723 dma->ops->enable_transfer(chip, 1); in snd_atiixp_pcm_trigger()
724 dma->running = 1; in snd_atiixp_pcm_trigger()
725 dma->suspended = 0; in snd_atiixp_pcm_trigger()
730 dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND; in snd_atiixp_pcm_trigger()
731 if (dma->running && dma->suspended) in snd_atiixp_pcm_trigger()
732 dma->saved_curptr = readl(chip->remap_addr + in snd_atiixp_pcm_trigger()
733 dma->ops->dt_cur); in snd_atiixp_pcm_trigger()
734 dma->ops->enable_transfer(chip, 0); in snd_atiixp_pcm_trigger()
735 dma->running = 0; in snd_atiixp_pcm_trigger()
738 err = -EINVAL; in snd_atiixp_pcm_trigger()
744 dma->ops->flush_dma(chip); in snd_atiixp_pcm_trigger()
748 spin_unlock(&chip->reg_lock); in snd_atiixp_pcm_trigger()
756 * every callback is supposed to be called in chip->reg_lock spinlock
852 } while (timeout-- > 0); in atiixp_spdif_flush_dma()
862 spin_lock_irq(&chip->reg_lock); in snd_atiixp_spdif_prepare()
863 if (chip->spdif_over_aclink) { in snd_atiixp_spdif_prepare()
874 substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE ? in snd_atiixp_spdif_prepare()
880 spin_unlock_irq(&chip->reg_lock); in snd_atiixp_spdif_prepare()
890 spin_lock_irq(&chip->reg_lock); in snd_atiixp_playback_prepare()
892 switch (substream->runtime->channels) { in snd_atiixp_playback_prepare()
916 substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE ? in snd_atiixp_playback_prepare()
920 * enable 6 channel re-ordering bit if needed in snd_atiixp_playback_prepare()
923 substream->runtime->channels >= 6 ? ATI_REG_6CH_REORDER_EN: 0); in snd_atiixp_playback_prepare()
925 spin_unlock_irq(&chip->reg_lock); in snd_atiixp_playback_prepare()
934 spin_lock_irq(&chip->reg_lock); in snd_atiixp_capture_prepare()
936 substream->runtime->format == SNDRV_PCM_FORMAT_S16_LE ? in snd_atiixp_capture_prepare()
938 spin_unlock_irq(&chip->reg_lock); in snd_atiixp_capture_prepare()
943 * hw_params - allocate the buffer and set up buffer descriptors
949 struct atiixp_dma *dma = substream->runtime->private_data; in snd_atiixp_pcm_hw_params()
952 dma->buf_addr = substream->runtime->dma_addr; in snd_atiixp_pcm_hw_params()
953 dma->buf_bytes = params_buffer_bytes(hw_params); in snd_atiixp_pcm_hw_params()
961 if (dma->ac97_pcm_type >= 0) { in snd_atiixp_pcm_hw_params()
962 struct ac97_pcm *pcm = chip->pcms[dma->ac97_pcm_type]; in snd_atiixp_pcm_hw_params()
966 if (dma->pcm_open_flag) { in snd_atiixp_pcm_hw_params()
968 dma->pcm_open_flag = 0; in snd_atiixp_pcm_hw_params()
972 pcm->r[0].slots); in snd_atiixp_pcm_hw_params()
974 dma->pcm_open_flag = 1; in snd_atiixp_pcm_hw_params()
983 struct atiixp_dma *dma = substream->runtime->private_data; in snd_atiixp_pcm_hw_free()
985 if (dma->pcm_open_flag) { in snd_atiixp_pcm_hw_free()
986 struct ac97_pcm *pcm = chip->pcms[dma->ac97_pcm_type]; in snd_atiixp_pcm_hw_free()
988 dma->pcm_open_flag = 0; in snd_atiixp_pcm_hw_free()
1022 struct snd_pcm_runtime *runtime = substream->runtime; in snd_atiixp_pcm_open()
1025 if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma)) in snd_atiixp_pcm_open()
1026 return -EINVAL; in snd_atiixp_pcm_open()
1028 if (dma->opened) in snd_atiixp_pcm_open()
1029 return -EBUSY; in snd_atiixp_pcm_open()
1030 dma->substream = substream; in snd_atiixp_pcm_open()
1031 runtime->hw = snd_atiixp_pcm_hw; in snd_atiixp_pcm_open()
1032 dma->ac97_pcm_type = pcm_type; in snd_atiixp_pcm_open()
1034 runtime->hw.rates = chip->pcms[pcm_type]->rates; in snd_atiixp_pcm_open()
1038 runtime->hw.formats = SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE; in snd_atiixp_pcm_open()
1043 runtime->private_data = dma; in snd_atiixp_pcm_open()
1046 spin_lock_irq(&chip->reg_lock); in snd_atiixp_pcm_open()
1047 dma->ops->enable_dma(chip, 1); in snd_atiixp_pcm_open()
1048 spin_unlock_irq(&chip->reg_lock); in snd_atiixp_pcm_open()
1049 dma->opened = 1; in snd_atiixp_pcm_open()
1059 if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma)) in snd_atiixp_pcm_close()
1060 return -EINVAL; in snd_atiixp_pcm_close()
1061 spin_lock_irq(&chip->reg_lock); in snd_atiixp_pcm_close()
1062 dma->ops->enable_dma(chip, 0); in snd_atiixp_pcm_close()
1063 spin_unlock_irq(&chip->reg_lock); in snd_atiixp_pcm_close()
1064 dma->substream = NULL; in snd_atiixp_pcm_close()
1065 dma->opened = 0; in snd_atiixp_pcm_close()
1076 mutex_lock(&chip->open_mutex); in snd_atiixp_playback_open()
1077 err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 0); in snd_atiixp_playback_open()
1078 mutex_unlock(&chip->open_mutex); in snd_atiixp_playback_open()
1081 substream->runtime->hw.channels_max = chip->max_channels; in snd_atiixp_playback_open()
1082 if (chip->max_channels > 2) in snd_atiixp_playback_open()
1084 snd_pcm_hw_constraint_step(substream->runtime, 0, in snd_atiixp_playback_open()
1093 mutex_lock(&chip->open_mutex); in snd_atiixp_playback_close()
1094 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); in snd_atiixp_playback_close()
1095 mutex_unlock(&chip->open_mutex); in snd_atiixp_playback_close()
1102 return snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_CAPTURE], 1); in snd_atiixp_capture_open()
1108 return snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_CAPTURE]); in snd_atiixp_capture_close()
1115 mutex_lock(&chip->open_mutex); in snd_atiixp_spdif_open()
1116 if (chip->spdif_over_aclink) /* share DMA_PLAYBACK */ in snd_atiixp_spdif_open()
1117 err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_PLAYBACK], 2); in snd_atiixp_spdif_open()
1119 err = snd_atiixp_pcm_open(substream, &chip->dmas[ATI_DMA_SPDIF], -1); in snd_atiixp_spdif_open()
1120 mutex_unlock(&chip->open_mutex); in snd_atiixp_spdif_open()
1128 mutex_lock(&chip->open_mutex); in snd_atiixp_spdif_close()
1129 if (chip->spdif_over_aclink) in snd_atiixp_spdif_close()
1130 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_PLAYBACK]); in snd_atiixp_spdif_close()
1132 err = snd_atiixp_pcm_close(substream, &chip->dmas[ATI_DMA_SPDIF]); in snd_atiixp_spdif_close()
1133 mutex_unlock(&chip->open_mutex); in snd_atiixp_spdif_close()
1238 struct snd_ac97_bus *pbus = chip->ac97_bus; in snd_atiixp_pcm_new()
1242 chip->dmas[ATI_DMA_PLAYBACK].ops = &snd_atiixp_playback_dma_ops; in snd_atiixp_pcm_new()
1243 chip->dmas[ATI_DMA_CAPTURE].ops = &snd_atiixp_capture_dma_ops; in snd_atiixp_pcm_new()
1244 if (! chip->spdif_over_aclink) in snd_atiixp_pcm_new()
1245 chip->dmas[ATI_DMA_SPDIF].ops = &snd_atiixp_spdif_dma_ops; in snd_atiixp_pcm_new()
1248 if (chip->spdif_over_aclink) in snd_atiixp_pcm_new()
1256 chip->pcms[i] = &pbus->pcms[i]; in snd_atiixp_pcm_new()
1258 chip->max_channels = 2; in snd_atiixp_pcm_new()
1259 if (pbus->pcms[ATI_PCM_OUT].r[0].slots & (1 << AC97_SLOT_PCM_SLEFT)) { in snd_atiixp_pcm_new()
1260 if (pbus->pcms[ATI_PCM_OUT].r[0].slots & (1 << AC97_SLOT_LFE)) in snd_atiixp_pcm_new()
1261 chip->max_channels = 6; in snd_atiixp_pcm_new()
1263 chip->max_channels = 4; in snd_atiixp_pcm_new()
1267 err = snd_pcm_new(chip->card, "ATI IXP AC97", in snd_atiixp_pcm_new()
1273 pcm->private_data = chip; in snd_atiixp_pcm_new()
1274 strcpy(pcm->name, "ATI IXP AC97"); in snd_atiixp_pcm_new()
1275 chip->pcmdevs[ATI_PCMDEV_ANALOG] = pcm; in snd_atiixp_pcm_new()
1278 &chip->pci->dev, 64*1024, 128*1024); in snd_atiixp_pcm_new()
1281 snd_pcm_alt_chmaps, chip->max_channels, 0, in snd_atiixp_pcm_new()
1285 chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; in snd_atiixp_pcm_new()
1286 chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; in snd_atiixp_pcm_new()
1289 if (chip->pcms[ATI_PCM_SPDIF] && ! chip->pcms[ATI_PCM_SPDIF]->rates) in snd_atiixp_pcm_new()
1292 /* FIXME: non-48k sample rate doesn't work on my test machine with AD1888 */ in snd_atiixp_pcm_new()
1293 if (chip->pcms[ATI_PCM_SPDIF]) in snd_atiixp_pcm_new()
1294 chip->pcms[ATI_PCM_SPDIF]->rates = SNDRV_PCM_RATE_48000; in snd_atiixp_pcm_new()
1297 err = snd_pcm_new(chip->card, "ATI IXP IEC958", in snd_atiixp_pcm_new()
1302 pcm->private_data = chip; in snd_atiixp_pcm_new()
1303 if (chip->spdif_over_aclink) in snd_atiixp_pcm_new()
1304 strcpy(pcm->name, "ATI IXP IEC958 (AC97)"); in snd_atiixp_pcm_new()
1306 strcpy(pcm->name, "ATI IXP IEC958 (Direct)"); in snd_atiixp_pcm_new()
1307 chip->pcmdevs[ATI_PCMDEV_DIGITAL] = pcm; in snd_atiixp_pcm_new()
1310 &chip->pci->dev, 64*1024, 128*1024); in snd_atiixp_pcm_new()
1312 /* pre-select AC97 SPDIF slots 10/11 */ in snd_atiixp_pcm_new()
1314 if (chip->ac97[i]) in snd_atiixp_pcm_new()
1315 snd_ac97_update_bits(chip->ac97[i], in snd_atiixp_pcm_new()
1340 snd_atiixp_xrun_dma(chip, &chip->dmas[ATI_DMA_PLAYBACK]); in snd_atiixp_interrupt()
1342 snd_atiixp_update_dma(chip, &chip->dmas[ATI_DMA_PLAYBACK]); in snd_atiixp_interrupt()
1344 snd_atiixp_xrun_dma(chip, &chip->dmas[ATI_DMA_CAPTURE]); in snd_atiixp_interrupt()
1346 snd_atiixp_update_dma(chip, &chip->dmas[ATI_DMA_CAPTURE]); in snd_atiixp_interrupt()
1347 if (! chip->spdif_over_aclink) { in snd_atiixp_interrupt()
1349 snd_atiixp_xrun_dma(chip, &chip->dmas[ATI_DMA_SPDIF]); in snd_atiixp_interrupt()
1351 snd_atiixp_update_dma(chip, &chip->dmas[ATI_DMA_SPDIF]); in snd_atiixp_interrupt()
1358 spin_lock(&chip->reg_lock); in snd_atiixp_interrupt()
1359 chip->codec_not_ready_bits |= detected; in snd_atiixp_interrupt()
1361 spin_unlock(&chip->reg_lock); in snd_atiixp_interrupt()
1415 return -ENXIO; in snd_atiixp_mixer_new()
1417 err = snd_ac97_bus(chip->card, 0, &ops, chip, &pbus); in snd_atiixp_mixer_new()
1420 pbus->clock = clock; in snd_atiixp_mixer_new()
1421 chip->ac97_bus = pbus; in snd_atiixp_mixer_new()
1425 if (chip->codec_not_ready_bits & codec_skip[i]) in snd_atiixp_mixer_new()
1429 ac97.pci = chip->pci; in snd_atiixp_mixer_new()
1432 if (! chip->spdif_over_aclink) in snd_atiixp_mixer_new()
1434 err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i]); in snd_atiixp_mixer_new()
1436 chip->ac97[i] = NULL; /* to be sure */ in snd_atiixp_mixer_new()
1437 dev_dbg(chip->card->dev, in snd_atiixp_mixer_new()
1445 dev_err(chip->card->dev, "no codec available\n"); in snd_atiixp_mixer_new()
1446 return -ENODEV; in snd_atiixp_mixer_new()
1449 snd_ac97_tune_hardware(chip->ac97[0], ac97_quirks, quirk_override); in snd_atiixp_mixer_new()
1461 struct atiixp *chip = card->private_data; in snd_atiixp_suspend()
1466 snd_ac97_suspend(chip->ac97[i]); in snd_atiixp_suspend()
1475 struct atiixp *chip = card->private_data; in snd_atiixp_resume()
1482 snd_ac97_resume(chip->ac97[i]); in snd_atiixp_resume()
1485 if (chip->pcmdevs[i]) { in snd_atiixp_resume()
1486 struct atiixp_dma *dma = &chip->dmas[i]; in snd_atiixp_resume()
1487 if (dma->substream && dma->suspended) { in snd_atiixp_resume()
1488 dma->ops->enable_dma(chip, 1); in snd_atiixp_resume()
1489 dma->substream->ops->prepare(dma->substream); in snd_atiixp_resume()
1490 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, in snd_atiixp_resume()
1491 chip->remap_addr + dma->ops->llp_offset); in snd_atiixp_resume()
1508 struct atiixp *chip = entry->private_data; in snd_atiixp_proc_read()
1512 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i)); in snd_atiixp_proc_read()
1517 snd_card_ro_proc_new(chip->card, "atiixp", chip, snd_atiixp_proc_read); in snd_atiixp_proc_init()
1527 snd_atiixp_chip_stop(card->private_data); in snd_atiixp_free()
1535 struct atiixp *chip = card->private_data; in snd_atiixp_init()
1542 spin_lock_init(&chip->reg_lock); in snd_atiixp_init()
1543 mutex_init(&chip->open_mutex); in snd_atiixp_init()
1544 chip->card = card; in snd_atiixp_init()
1545 chip->pci = pci; in snd_atiixp_init()
1546 chip->irq = -1; in snd_atiixp_init()
1547 err = pcim_iomap_regions(pci, 1 << 0, "ATI IXP AC97"); in snd_atiixp_init()
1550 chip->addr = pci_resource_start(pci, 0); in snd_atiixp_init()
1551 chip->remap_addr = pcim_iomap_table(pci)[0]; in snd_atiixp_init()
1553 if (devm_request_irq(&pci->dev, pci->irq, snd_atiixp_interrupt, in snd_atiixp_init()
1555 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); in snd_atiixp_init()
1556 return -EBUSY; in snd_atiixp_init()
1558 chip->irq = pci->irq; in snd_atiixp_init()
1559 card->sync_irq = chip->irq; in snd_atiixp_init()
1560 card->private_free = snd_atiixp_free; in snd_atiixp_init()
1574 err = snd_devm_card_new(&pci->dev, index, id, THIS_MODULE, in __snd_atiixp_probe()
1578 chip = card->private_data; in __snd_atiixp_probe()
1580 strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); in __snd_atiixp_probe()
1581 strcpy(card->shortname, "ATI IXP"); in __snd_atiixp_probe()
1590 chip->spdif_over_aclink = spdif_aclink; in __snd_atiixp_probe()
1604 snprintf(card->longname, sizeof(card->longname), in __snd_atiixp_probe()
1605 "%s rev %x with %s at %#lx, irq %i", card->shortname, in __snd_atiixp_probe()
1606 pci->revision, in __snd_atiixp_probe()
1607 chip->ac97[0] ? snd_ac97_get_short_name(chip->ac97[0]) : "?", in __snd_atiixp_probe()
1608 chip->addr, chip->irq); in __snd_atiixp_probe()
1621 return snd_card_free_on_error(&pci->dev, __snd_atiixp_probe(pci, pci_id)); in snd_atiixp_probe()