• Home
  • Raw
  • Download

Lines Matching +full:en +full:- +full:modem

1 // SPDX-License-Identifier: GPL-2.0-or-later
30 MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH},"
31 "{Intel,82901AB-ICH0},"
32 "{Intel,82801BA-ICH2},"
33 "{Intel,82801CA-ICH3},"
34 "{Intel,82801DB-ICH4},"
54 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
59 static int buggy_irq = -1; /* auto-check */
61 static int spdif_aclink = -1;
62 static int inside_vm = -1;
69 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = allowlist + auto-detect, 1 = force autodetect)…
79 MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link.");
98 ICH_REG_##name##_BDBAR = base + 0x0, /* dword - buffer descriptor list base address */ \
99 ICH_REG_##name##_CIV = base + 0x04, /* byte - current index value */ \
100 ICH_REG_##name##_LVI = base + 0x05, /* byte - last valid index */ \
101 ICH_REG_##name##_SR = base + 0x06, /* byte - status register */ \
102 ICH_REG_##name##_PICB = base + 0x08, /* word - position in current buffer */ \
103 ICH_REG_##name##_PIV = base + 0x0a, /* byte - prefetched index value */ \
104 ICH_REG_##name##_CR = base + 0x0b, /* byte - control register */ \
142 #define ICH_REG_GLOB_CNT 0x2c /* dword - global control */
144 #define ICH_PCM_SPDIF_NONE 0x00000000 /* reserved - undefined */
148 #define ICH_PCM_20BIT 0x00400000 /* 20-bit samples (ICH4) */
165 #define ICH_REG_GLOB_STA 0x30 /* dword - global status */
170 #define ICH_P2INT 0x02000000 /* ICH4: PCM2-In interrupt */
171 #define ICH_M2INT 0x01000000 /* ICH4: Mic2-In interrupt */
173 #define ICH_SAMPLE_16_20 0x00400000 /* ICH4: 16- and 20-bit samples */
174 #define ICH_MULTICHAN_CAP 0x00300000 /* ICH4: multi-channel capability bits (RO) */
177 #define ICH_MD3 0x00020000 /* modem power down semaphore */
191 #define ICH_MOINT 0x00000004 /* modem playback interrupt */
192 #define ICH_MIINT 0x00000002 /* modem capture interrupt */
194 #define ICH_REG_ACC_SEMA 0x34 /* byte - codec write semaphore */
294 #define ICH_ALI_IF_SPDF_SRC (3<<12) /* 00 = PCM, 01 = AC97-in, 10 = spdif-in, 11 = i2s */
295 #define ICH_ALI_IF_AC97_OUT (3<<8) /* 00 = PCM, 10 = spdif-in, 11 = i2s */
329 #define get_ichdev(substream) (substream->runtime->private_data)
390 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */
439 * Lowlevel I/O - busmaster
444 return ioread8(chip->bmaddr + offset); in igetbyte()
449 return ioread16(chip->bmaddr + offset); in igetword()
454 return ioread32(chip->bmaddr + offset); in igetdword()
459 iowrite8(val, chip->bmaddr + offset); in iputbyte()
464 iowrite16(val, chip->bmaddr + offset); in iputword()
469 iowrite32(val, chip->bmaddr + offset); in iputdword()
473 * Lowlevel I/O - AC'97 registers
478 return ioread16(chip->addr + offset); in iagetword()
483 iowrite16(val, chip->addr + offset); in iaputword()
499 return -EIO; in snd_intel8x0_codec_semaphore()
500 if (chip->in_sdin_init) { in snd_intel8x0_codec_semaphore()
503 codec = chip->codec_isr_bits; in snd_intel8x0_codec_semaphore()
505 codec = chip->codec_bit[chip->ac97_sdin[codec]]; in snd_intel8x0_codec_semaphore()
510 return -EIO; in snd_intel8x0_codec_semaphore()
512 if (chip->buggy_semaphore) in snd_intel8x0_codec_semaphore()
521 } while (time--); in snd_intel8x0_codec_semaphore()
526 dev_err(chip->card->dev, in snd_intel8x0_codec_semaphore()
531 return -EBUSY; in snd_intel8x0_codec_semaphore()
538 struct intel8x0 *chip = ac97->private_data; in snd_intel8x0_codec_write()
540 if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { in snd_intel8x0_codec_write()
541 if (! chip->in_ac97_init) in snd_intel8x0_codec_write()
542 dev_err(chip->card->dev, in snd_intel8x0_codec_write()
544 ac97->num, reg); in snd_intel8x0_codec_write()
546 iaputword(chip, reg + ac97->num * 0x80, val); in snd_intel8x0_codec_write()
552 struct intel8x0 *chip = ac97->private_data; in snd_intel8x0_codec_read()
556 if (snd_intel8x0_codec_semaphore(chip, ac97->num) < 0) { in snd_intel8x0_codec_read()
557 if (! chip->in_ac97_init) in snd_intel8x0_codec_read()
558 dev_err(chip->card->dev, in snd_intel8x0_codec_read()
560 ac97->num, reg); in snd_intel8x0_codec_read()
563 res = iagetword(chip, reg + ac97->num * 0x80); in snd_intel8x0_codec_read()
567 ~(chip->codec_ready_bits | ICH_GSCI)); in snd_intel8x0_codec_read()
568 if (! chip->in_ac97_init) in snd_intel8x0_codec_read()
569 dev_err(chip->card->dev, in snd_intel8x0_codec_read()
571 ac97->num, reg); in snd_intel8x0_codec_read()
588 ~(chip->codec_ready_bits | ICH_GSCI)); in snd_intel8x0_codec_read_test()
604 if (! chip->in_ac97_init) in snd_intel8x0_ali_codec_ready()
605 dev_warn(chip->card->dev, "AC97 codec ready timeout.\n"); in snd_intel8x0_ali_codec_ready()
606 return -EBUSY; in snd_intel8x0_ali_codec_ready()
612 if (chip->buggy_semaphore) in snd_intel8x0_ali_codec_semaphore()
614 while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) in snd_intel8x0_ali_codec_semaphore()
616 if (! time && ! chip->in_ac97_init) in snd_intel8x0_ali_codec_semaphore()
617 dev_warn(chip->card->dev, "ali_codec_semaphore timeout\n"); in snd_intel8x0_ali_codec_semaphore()
623 struct intel8x0 *chip = ac97->private_data; in snd_intel8x0_ali_codec_read()
629 if (ac97->num) in snd_intel8x0_ali_codec_read()
642 struct intel8x0 *chip = ac97->private_data; in snd_intel8x0_ali_codec_write()
647 if (ac97->num) in snd_intel8x0_ali_codec_write()
660 __le32 *bdbar = ichdev->bdbar; in snd_intel8x0_setup_periods()
661 unsigned long port = ichdev->reg_offset; in snd_intel8x0_setup_periods()
663 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); in snd_intel8x0_setup_periods()
664 if (ichdev->size == ichdev->fragsize) { in snd_intel8x0_setup_periods()
665 ichdev->ack_reload = ichdev->ack = 2; in snd_intel8x0_setup_periods()
666 ichdev->fragsize1 = ichdev->fragsize >> 1; in snd_intel8x0_setup_periods()
668 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf); in snd_intel8x0_setup_periods()
670 ichdev->fragsize1 >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
671 bdbar[idx + 2] = cpu_to_le32(ichdev->physbuf + (ichdev->size >> 1)); in snd_intel8x0_setup_periods()
673 ichdev->fragsize1 >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
675 ichdev->frags = 2; in snd_intel8x0_setup_periods()
677 ichdev->ack_reload = ichdev->ack = 1; in snd_intel8x0_setup_periods()
678 ichdev->fragsize1 = ichdev->fragsize; in snd_intel8x0_setup_periods()
680 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + in snd_intel8x0_setup_periods()
681 (((idx >> 1) * ichdev->fragsize) % in snd_intel8x0_setup_periods()
682 ichdev->size)); in snd_intel8x0_setup_periods()
684 ichdev->fragsize >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
686 dev_dbg(chip->card->dev, "bdbar[%i] = 0x%x [0x%x]\n", in snd_intel8x0_setup_periods()
690 ichdev->frags = ichdev->size / ichdev->fragsize; in snd_intel8x0_setup_periods()
692 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi = ICH_REG_LVI_MASK); in snd_intel8x0_setup_periods()
693 ichdev->civ = 0; in snd_intel8x0_setup_periods()
695 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; in snd_intel8x0_setup_periods()
696 ichdev->position = 0; in snd_intel8x0_setup_periods()
698 dev_dbg(chip->card->dev, in snd_intel8x0_setup_periods()
700 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, in snd_intel8x0_setup_periods()
701 ichdev->fragsize1); in snd_intel8x0_setup_periods()
704 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in snd_intel8x0_setup_periods()
713 unsigned long port = ichdev->reg_offset; in snd_intel8x0_update()
718 if (!(ichdev->prepared || chip->in_measurement) || ichdev->suspended) in snd_intel8x0_update()
721 spin_lock_irqsave(&chip->reg_lock, flags); in snd_intel8x0_update()
722 status = igetbyte(chip, port + ichdev->roff_sr); in snd_intel8x0_update()
726 } else if (civ == ichdev->civ) { in snd_intel8x0_update()
729 ichdev->civ++; in snd_intel8x0_update()
730 ichdev->civ &= ICH_REG_LVI_MASK; in snd_intel8x0_update()
732 step = civ - ichdev->civ; in snd_intel8x0_update()
736 // snd_printd("step = %d, %d -> %d\n", step, ichdev->civ, civ); in snd_intel8x0_update()
737 ichdev->civ = civ; in snd_intel8x0_update()
740 ichdev->position += step * ichdev->fragsize1; in snd_intel8x0_update()
741 if (! chip->in_measurement) in snd_intel8x0_update()
742 ichdev->position %= ichdev->size; in snd_intel8x0_update()
743 ichdev->lvi += step; in snd_intel8x0_update()
744 ichdev->lvi &= ICH_REG_LVI_MASK; in snd_intel8x0_update()
745 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); in snd_intel8x0_update()
747 ichdev->lvi_frag++; in snd_intel8x0_update()
748 ichdev->lvi_frag %= ichdev->frags; in snd_intel8x0_update()
749 …ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize… in snd_intel8x0_update()
751 dev_dbg(chip->card->dev, in snd_intel8x0_update()
753 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], in snd_intel8x0_update()
754 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), in snd_intel8x0_update()
757 if (--ichdev->ack == 0) { in snd_intel8x0_update()
758 ichdev->ack = ichdev->ack_reload; in snd_intel8x0_update()
762 spin_unlock_irqrestore(&chip->reg_lock, flags); in snd_intel8x0_update()
763 if (ack && ichdev->substream) { in snd_intel8x0_update()
764 snd_pcm_period_elapsed(ichdev->substream); in snd_intel8x0_update()
766 iputbyte(chip, port + ichdev->roff_sr, in snd_intel8x0_update()
777 status = igetdword(chip, chip->int_sta_reg); in snd_intel8x0_interrupt()
781 if ((status & chip->int_sta_mask) == 0) { in snd_intel8x0_interrupt()
784 iputdword(chip, chip->int_sta_reg, status); in snd_intel8x0_interrupt()
785 if (! chip->buggy_irq) in snd_intel8x0_interrupt()
791 for (i = 0; i < chip->bdbars_count; i++) { in snd_intel8x0_interrupt()
792 ichdev = &chip->ichd[i]; in snd_intel8x0_interrupt()
793 if (status & ichdev->int_sta_mask) in snd_intel8x0_interrupt()
798 iputdword(chip, chip->int_sta_reg, status & chip->int_sta_mask); in snd_intel8x0_interrupt()
812 unsigned long port = ichdev->reg_offset; in snd_intel8x0_pcm_trigger()
816 ichdev->suspended = 0; in snd_intel8x0_pcm_trigger()
821 ichdev->last_pos = ichdev->position; in snd_intel8x0_pcm_trigger()
824 ichdev->suspended = 1; in snd_intel8x0_pcm_trigger()
833 return -EINVAL; in snd_intel8x0_pcm_trigger()
838 while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH)) ; in snd_intel8x0_pcm_trigger()
849 unsigned long port = ichdev->reg_offset; in snd_intel8x0_ali_trigger()
858 ichdev->suspended = 0; in snd_intel8x0_ali_trigger()
862 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { in snd_intel8x0_ali_trigger()
864 fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]); in snd_intel8x0_ali_trigger()
865 fifo &= ~(0xff << (ichdev->ali_slot % 4)); in snd_intel8x0_ali_trigger()
866 fifo |= 0x83 << (ichdev->ali_slot % 4); in snd_intel8x0_ali_trigger()
867 iputdword(chip, fiforeg[ichdev->ali_slot / 4], fifo); in snd_intel8x0_ali_trigger()
870 val &= ~(1 << (ichdev->ali_slot + 16)); /* clear PAUSE flag */ in snd_intel8x0_ali_trigger()
872 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << ichdev->ali_slot)); in snd_intel8x0_ali_trigger()
875 ichdev->suspended = 1; in snd_intel8x0_ali_trigger()
880 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << (ichdev->ali_slot + 16))); in snd_intel8x0_ali_trigger()
892 igetdword(chip, ICHREG(ALI_INTERRUPTSR)) & ichdev->int_sta_mask); in snd_intel8x0_ali_trigger()
895 return -EINVAL; in snd_intel8x0_ali_trigger()
908 if (ichdev->pcm_open_flag) { in snd_intel8x0_hw_params()
909 snd_ac97_pcm_close(ichdev->pcm); in snd_intel8x0_hw_params()
910 ichdev->pcm_open_flag = 0; in snd_intel8x0_hw_params()
911 ichdev->prepared = 0; in snd_intel8x0_hw_params()
913 err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params), in snd_intel8x0_hw_params()
915 ichdev->pcm->r[dbl].slots); in snd_intel8x0_hw_params()
917 ichdev->pcm_open_flag = 1; in snd_intel8x0_hw_params()
919 if (ichdev->ichd == ICHD_PCMOUT && chip->spdif_idx < 0) in snd_intel8x0_hw_params()
920 snd_ac97_set_rate(ichdev->pcm->r[0].codec[0], AC97_SPDIF, in snd_intel8x0_hw_params()
930 if (ichdev->pcm_open_flag) { in snd_intel8x0_hw_free()
931 snd_ac97_pcm_close(ichdev->pcm); in snd_intel8x0_hw_free()
932 ichdev->pcm_open_flag = 0; in snd_intel8x0_hw_free()
933 ichdev->prepared = 0; in snd_intel8x0_hw_free()
942 int dbl = runtime->rate > 48000; in snd_intel8x0_setup_pcm_out()
944 spin_lock_irq(&chip->reg_lock); in snd_intel8x0_setup_pcm_out()
945 switch (chip->device_type) { in snd_intel8x0_setup_pcm_out()
949 if (runtime->channels == 4 || dbl) in snd_intel8x0_setup_pcm_out()
951 else if (runtime->channels == 6) in snd_intel8x0_setup_pcm_out()
958 if (runtime->channels == 4 || dbl) in snd_intel8x0_setup_pcm_out()
960 else if (runtime->channels == 6) in snd_intel8x0_setup_pcm_out()
967 if (runtime->channels == 4 || dbl) in snd_intel8x0_setup_pcm_out()
969 else if (runtime->channels == 6) in snd_intel8x0_setup_pcm_out()
971 else if (runtime->channels == 8) in snd_intel8x0_setup_pcm_out()
973 if (chip->device_type == DEVICE_NFORCE) { in snd_intel8x0_setup_pcm_out()
979 spin_unlock_irq(&chip->reg_lock); in snd_intel8x0_setup_pcm_out()
981 spin_lock_irq(&chip->reg_lock); in snd_intel8x0_setup_pcm_out()
983 } else if (chip->device_type == DEVICE_INTEL_ICH4) { in snd_intel8x0_setup_pcm_out()
984 if (runtime->sample_bits > 16) in snd_intel8x0_setup_pcm_out()
990 spin_unlock_irq(&chip->reg_lock); in snd_intel8x0_setup_pcm_out()
996 struct snd_pcm_runtime *runtime = substream->runtime; in snd_intel8x0_pcm_prepare()
999 ichdev->physbuf = runtime->dma_addr; in snd_intel8x0_pcm_prepare()
1000 ichdev->size = snd_pcm_lib_buffer_bytes(substream); in snd_intel8x0_pcm_prepare()
1001 ichdev->fragsize = snd_pcm_lib_period_bytes(substream); in snd_intel8x0_pcm_prepare()
1002 if (ichdev->ichd == ICHD_PCMOUT) { in snd_intel8x0_pcm_prepare()
1004 if (chip->device_type == DEVICE_INTEL_ICH4) in snd_intel8x0_pcm_prepare()
1005 ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; in snd_intel8x0_pcm_prepare()
1008 ichdev->prepared = 1; in snd_intel8x0_pcm_prepare()
1020 spin_lock(&chip->reg_lock); in snd_intel8x0_pcm_pointer()
1022 civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); in snd_intel8x0_pcm_pointer()
1023 ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); in snd_intel8x0_pcm_pointer()
1024 position = ichdev->position; in snd_intel8x0_pcm_pointer()
1029 if (civ != igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV)) in snd_intel8x0_pcm_pointer()
1038 if (chip->inside_vm) in snd_intel8x0_pcm_pointer()
1040 if (ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) in snd_intel8x0_pcm_pointer()
1042 } while (timeout--); in snd_intel8x0_pcm_pointer()
1043 ptr = ichdev->last_pos; in snd_intel8x0_pcm_pointer()
1045 ptr1 <<= ichdev->pos_shift; in snd_intel8x0_pcm_pointer()
1046 ptr = ichdev->fragsize1 - ptr1; in snd_intel8x0_pcm_pointer()
1048 if (ptr < ichdev->last_pos) { in snd_intel8x0_pcm_pointer()
1050 pos_base = position / ichdev->fragsize1; in snd_intel8x0_pcm_pointer()
1051 last_base = ichdev->last_pos / ichdev->fragsize1; in snd_intel8x0_pcm_pointer()
1056 ptr = ichdev->last_pos; in snd_intel8x0_pcm_pointer()
1059 ichdev->last_pos = ptr; in snd_intel8x0_pcm_pointer()
1060 spin_unlock(&chip->reg_lock); in snd_intel8x0_pcm_pointer()
1061 if (ptr >= ichdev->size) in snd_intel8x0_pcm_pointer()
1063 return bytes_to_frames(substream->runtime, ptr); in snd_intel8x0_pcm_pointer()
1120 struct snd_pcm_runtime *runtime = substream->runtime; in snd_intel8x0_pcm_open()
1123 ichdev->substream = substream; in snd_intel8x0_pcm_open()
1124 runtime->hw = snd_intel8x0_stream; in snd_intel8x0_pcm_open()
1125 runtime->hw.rates = ichdev->pcm->rates; in snd_intel8x0_pcm_open()
1127 if (chip->device_type == DEVICE_SIS) { in snd_intel8x0_pcm_open()
1128 runtime->hw.buffer_bytes_max = 64*1024; in snd_intel8x0_pcm_open()
1129 runtime->hw.period_bytes_max = 64*1024; in snd_intel8x0_pcm_open()
1133 runtime->private_data = ichdev; in snd_intel8x0_pcm_open()
1140 struct snd_pcm_runtime *runtime = substream->runtime; in snd_intel8x0_playback_open()
1143 err = snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_PCMOUT]); in snd_intel8x0_playback_open()
1147 if (chip->multi8) { in snd_intel8x0_playback_open()
1148 runtime->hw.channels_max = 8; in snd_intel8x0_playback_open()
1152 } else if (chip->multi6) { in snd_intel8x0_playback_open()
1153 runtime->hw.channels_max = 6; in snd_intel8x0_playback_open()
1156 } else if (chip->multi4) { in snd_intel8x0_playback_open()
1157 runtime->hw.channels_max = 4; in snd_intel8x0_playback_open()
1161 if (chip->dra) { in snd_intel8x0_playback_open()
1164 if (chip->smp20bit) { in snd_intel8x0_playback_open()
1165 runtime->hw.formats |= SNDRV_PCM_FMTBIT_S32_LE; in snd_intel8x0_playback_open()
1175 chip->ichd[ICHD_PCMOUT].substream = NULL; in snd_intel8x0_playback_close()
1183 return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_PCMIN]); in snd_intel8x0_capture_open()
1190 chip->ichd[ICHD_PCMIN].substream = NULL; in snd_intel8x0_capture_close()
1198 return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_MIC]); in snd_intel8x0_mic_open()
1205 chip->ichd[ICHD_MIC].substream = NULL; in snd_intel8x0_mic_close()
1213 return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_MIC2]); in snd_intel8x0_mic2_open()
1220 chip->ichd[ICHD_MIC2].substream = NULL; in snd_intel8x0_mic2_close()
1228 return snd_intel8x0_pcm_open(substream, &chip->ichd[ICHD_PCM2IN]); in snd_intel8x0_capture2_open()
1235 chip->ichd[ICHD_PCM2IN].substream = NULL; in snd_intel8x0_capture2_close()
1242 int idx = chip->device_type == DEVICE_NFORCE ? NVD_SPBAR : ICHD_SPBAR; in snd_intel8x0_spdif_open()
1244 return snd_intel8x0_pcm_open(substream, &chip->ichd[idx]); in snd_intel8x0_spdif_open()
1250 int idx = chip->device_type == DEVICE_NFORCE ? NVD_SPBAR : ICHD_SPBAR; in snd_intel8x0_spdif_close()
1252 chip->ichd[idx].substream = NULL; in snd_intel8x0_spdif_close()
1261 spin_lock_irq(&chip->reg_lock); in snd_intel8x0_ali_ac97spdifout_open()
1266 spin_unlock_irq(&chip->reg_lock); in snd_intel8x0_ali_ac97spdifout_open()
1268 return snd_intel8x0_pcm_open(substream, &chip->ichd[ALID_AC97SPDIFOUT]); in snd_intel8x0_ali_ac97spdifout_open()
1276 chip->ichd[ALID_AC97SPDIFOUT].substream = NULL; in snd_intel8x0_ali_ac97spdifout_close()
1277 spin_lock_irq(&chip->reg_lock); in snd_intel8x0_ali_ac97spdifout_close()
1281 spin_unlock_irq(&chip->reg_lock); in snd_intel8x0_ali_ac97spdifout_close()
1291 return snd_intel8x0_pcm_open(substream, &chip->ichd[ALID_SPDIFIN]);
1298 chip->ichd[ALID_SPDIFIN].substream = NULL;
1306 return snd_intel8x0_pcm_open(substream, &chip->ichd[ALID_SPDIFOUT]);
1313 chip->ichd[ALID_SPDIFOUT].substream = NULL;
1450 ((chip)->fix_nocache ? SNDRV_DMA_TYPE_DEV_UC : SNDRV_DMA_TYPE_DEV)
1459 if (rec->suffix) in snd_intel8x0_pcm1()
1460 sprintf(name, "Intel ICH - %s", rec->suffix); in snd_intel8x0_pcm1()
1463 err = snd_pcm_new(chip->card, name, device, in snd_intel8x0_pcm1()
1464 rec->playback_ops ? 1 : 0, in snd_intel8x0_pcm1()
1465 rec->capture_ops ? 1 : 0, &pcm); in snd_intel8x0_pcm1()
1469 if (rec->playback_ops) in snd_intel8x0_pcm1()
1470 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, rec->playback_ops); in snd_intel8x0_pcm1()
1471 if (rec->capture_ops) in snd_intel8x0_pcm1()
1472 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, rec->capture_ops); in snd_intel8x0_pcm1()
1474 pcm->private_data = chip; in snd_intel8x0_pcm1()
1475 pcm->info_flags = 0; in snd_intel8x0_pcm1()
1476 if (rec->suffix) in snd_intel8x0_pcm1()
1477 sprintf(pcm->name, "%s - %s", chip->card->shortname, rec->suffix); in snd_intel8x0_pcm1()
1479 strcpy(pcm->name, chip->card->shortname); in snd_intel8x0_pcm1()
1480 chip->pcm[device] = pcm; in snd_intel8x0_pcm1()
1483 &chip->pci->dev, in snd_intel8x0_pcm1()
1484 rec->prealloc_size, rec->prealloc_max_size); in snd_intel8x0_pcm1()
1486 if (rec->playback_ops && in snd_intel8x0_pcm1()
1487 rec->playback_ops->open == snd_intel8x0_playback_open) { in snd_intel8x0_pcm1()
1490 if (chip->multi8) in snd_intel8x0_pcm1()
1492 else if (chip->multi6) in snd_intel8x0_pcm1()
1494 else if (chip->multi4) in snd_intel8x0_pcm1()
1501 chmap->channel_mask = SND_PCM_CHMAP_MASK_2468; in snd_intel8x0_pcm1()
1502 chip->ac97[0]->chmaps[SNDRV_PCM_STREAM_PLAYBACK] = chmap; in snd_intel8x0_pcm1()
1605 switch (chip->device_type) { in snd_intel8x0_pcm()
1610 tblsize--; in snd_intel8x0_pcm()
1616 tblsize--; in snd_intel8x0_pcm()
1631 if (i > 0 && rec->ac97_idx) { in snd_intel8x0_pcm()
1633 if (! chip->ichd[rec->ac97_idx].pcm) in snd_intel8x0_pcm()
1642 chip->pcm_devs = device; in snd_intel8x0_pcm()
1653 struct intel8x0 *chip = bus->private_data; in snd_intel8x0_mixer_free_ac97_bus()
1654 chip->ac97_bus = NULL; in snd_intel8x0_mixer_free_ac97_bus()
1659 struct intel8x0 *chip = ac97->private_data; in snd_intel8x0_mixer_free_ac97()
1660 chip->ac97[ac97->num] = NULL; in snd_intel8x0_mixer_free_ac97()
1737 .name = "Compaq Deskpro EN", /* AD1885 */
1767 .name = "MS-9128",
1965 .name = "Sony VAIO VGN-T350P", /*AD1981B*/
1971 .name = "Sony VAIO VGN-B1VP", /*AD1981B*/
1983 .name = "Fujitsu-Siemens E4010",
1989 .name = "Fujitsu-Siemens T3010",
2013 .name = "Fujitsu-Siemens 4010",
2019 .name = "Fujitsu-Siemens Celsius H320",
2025 .name = "Fujitsu-Siemens Celsius", /* AD1981? */
2043 .name = "Panasonic CF-R4",
2049 .name = "Fujitsu-Siemens Scenic", /* AD1981? */
2079 .name = "Fujitsu-Siemens D1522", /* AD1981 */
2158 chip->spdif_idx = -1; /* use PCMOUT (or disabled) */ in snd_intel8x0_mixer()
2160 switch (chip->device_type) { in snd_intel8x0_mixer()
2162 chip->spdif_idx = NVD_SPBAR; in snd_intel8x0_mixer()
2165 chip->spdif_idx = ALID_AC97SPDIFOUT; in snd_intel8x0_mixer()
2168 chip->spdif_idx = ICHD_SPBAR; in snd_intel8x0_mixer()
2173 chip->in_ac97_init = 1; in snd_intel8x0_mixer()
2179 if (chip->xbox) in snd_intel8x0_mixer()
2181 if (chip->device_type != DEVICE_ALI) { in snd_intel8x0_mixer()
2184 chip->in_sdin_init = 1; in snd_intel8x0_mixer()
2186 for (i = 0; i < chip->max_codecs; i++) { in snd_intel8x0_mixer()
2187 if (! (glob_sta & chip->codec_bit[i])) in snd_intel8x0_mixer()
2189 if (chip->device_type == DEVICE_INTEL_ICH4) { in snd_intel8x0_mixer()
2191 chip->ac97_sdin[codecs] = in snd_intel8x0_mixer()
2193 if (snd_BUG_ON(chip->ac97_sdin[codecs] >= 3)) in snd_intel8x0_mixer()
2194 chip->ac97_sdin[codecs] = 0; in snd_intel8x0_mixer()
2196 chip->ac97_sdin[codecs] = i; in snd_intel8x0_mixer()
2199 chip->in_sdin_init = 0; in snd_intel8x0_mixer()
2216 if ((err = snd_ac97_bus(chip->card, 0, ops, chip, &pbus)) < 0) in snd_intel8x0_mixer()
2218 pbus->private_free = snd_intel8x0_mixer_free_ac97_bus; in snd_intel8x0_mixer()
2220 pbus->clock = ac97_clock; in snd_intel8x0_mixer()
2222 if (chip->device_type == DEVICE_ALI) in snd_intel8x0_mixer()
2223 pbus->no_vra = 1; in snd_intel8x0_mixer()
2225 pbus->dra = 1; in snd_intel8x0_mixer()
2226 chip->ac97_bus = pbus; in snd_intel8x0_mixer()
2227 chip->ncodecs = codecs; in snd_intel8x0_mixer()
2229 ac97.pci = chip->pci; in snd_intel8x0_mixer()
2232 if ((err = snd_ac97_mixer(pbus, &ac97, &chip->ac97[i])) < 0) { in snd_intel8x0_mixer()
2233 if (err != -EACCES) in snd_intel8x0_mixer()
2234 dev_err(chip->card->dev, in snd_intel8x0_mixer()
2241 snd_ac97_tune_hardware(chip->ac97[0], ac97_quirks, quirk_override); in snd_intel8x0_mixer()
2243 if (chip->device_type == DEVICE_INTEL_ICH4) in snd_intel8x0_mixer()
2244 pbus->isdin = 1; in snd_intel8x0_mixer()
2247 if (chip->device_type != DEVICE_INTEL_ICH4) in snd_intel8x0_mixer()
2248 i -= 2; /* do not allocate PCM2IN and MIC2 */ in snd_intel8x0_mixer()
2249 if (chip->spdif_idx < 0) in snd_intel8x0_mixer()
2250 i--; /* do not allocate S/PDIF */ in snd_intel8x0_mixer()
2254 chip->ichd[ICHD_PCMOUT].pcm = &pbus->pcms[0]; in snd_intel8x0_mixer()
2255 chip->ichd[ICHD_PCMIN].pcm = &pbus->pcms[1]; in snd_intel8x0_mixer()
2256 chip->ichd[ICHD_MIC].pcm = &pbus->pcms[2]; in snd_intel8x0_mixer()
2257 if (chip->spdif_idx >= 0) in snd_intel8x0_mixer()
2258 chip->ichd[chip->spdif_idx].pcm = &pbus->pcms[3]; in snd_intel8x0_mixer()
2259 if (chip->device_type == DEVICE_INTEL_ICH4) { in snd_intel8x0_mixer()
2260 chip->ichd[ICHD_PCM2IN].pcm = &pbus->pcms[4]; in snd_intel8x0_mixer()
2261 chip->ichd[ICHD_MIC2].pcm = &pbus->pcms[5]; in snd_intel8x0_mixer()
2264 if (chip->device_type == DEVICE_INTEL_ICH4) { in snd_intel8x0_mixer()
2265 struct ac97_pcm *pcm = chip->ichd[ICHD_PCM2IN].pcm; in snd_intel8x0_mixer()
2270 tmp |= chip->ac97_sdin[0] << ICH_DI1L_SHIFT; in snd_intel8x0_mixer()
2272 if (pcm->r[0].codec[i]) { in snd_intel8x0_mixer()
2273 tmp |= chip->ac97_sdin[pcm->r[0].codec[1]->num] << ICH_DI2L_SHIFT; in snd_intel8x0_mixer()
2282 if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_PCM_SLEFT)) { in snd_intel8x0_mixer()
2283 chip->multi4 = 1; in snd_intel8x0_mixer()
2284 if (pbus->pcms[0].r[0].slots & (1 << AC97_SLOT_LFE)) { in snd_intel8x0_mixer()
2285 chip->multi6 = 1; in snd_intel8x0_mixer()
2286 if (chip->ac97[0]->flags & AC97_HAS_8CH) in snd_intel8x0_mixer()
2287 chip->multi8 = 1; in snd_intel8x0_mixer()
2290 if (pbus->pcms[0].r[1].rslots[0]) { in snd_intel8x0_mixer()
2291 chip->dra = 1; in snd_intel8x0_mixer()
2293 if (chip->device_type == DEVICE_INTEL_ICH4) { in snd_intel8x0_mixer()
2295 chip->smp20bit = 1; in snd_intel8x0_mixer()
2297 if (chip->device_type == DEVICE_NFORCE && !spdif_aclink) { in snd_intel8x0_mixer()
2299 chip->ichd[chip->spdif_idx].pcm->rates = SNDRV_PCM_RATE_48000; in snd_intel8x0_mixer()
2301 if (chip->device_type == DEVICE_INTEL_ICH4 && !spdif_aclink) { in snd_intel8x0_mixer()
2307 snd_ac97_update_bits(chip->ac97[0], AC97_EXTENDED_STATUS, 0x03 << 4, 0x03 << 4); in snd_intel8x0_mixer()
2309 chip->in_ac97_init = 0; in snd_intel8x0_mixer()
2313 /* clear the cold-reset bit for the next chance */ in snd_intel8x0_mixer()
2314 if (chip->device_type != DEVICE_ALI) in snd_intel8x0_mixer()
2348 if (snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode)) in snd_intel8x0_ich_chip_cold_reset()
2349 return -EIO; in snd_intel8x0_ich_chip_cold_reset()
2354 /* do cold reset - the full ac97 powerdown may leave the controller in snd_intel8x0_ich_chip_cold_reset()
2365 (!snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode))
2387 dev_err(chip->card->dev, "AC'97 warm reset still in progress? [0x%x]\n", in snd_intel8x0_ich_chip_reset()
2389 return -EIO; in snd_intel8x0_ich_chip_reset()
2402 if (chip->device_type == DEVICE_NFORCE) in snd_intel8x0_ich_chip_init()
2422 chip->codec_isr_bits; in snd_intel8x0_ich_chip_init()
2429 dev_err(chip->card->dev, in snd_intel8x0_ich_chip_init()
2432 return -EIO; in snd_intel8x0_ich_chip_init()
2437 while (status != chip->codec_isr_bits && in snd_intel8x0_ich_chip_init()
2441 chip->codec_isr_bits; in snd_intel8x0_ich_chip_init()
2448 for (i = 0; i < chip->ncodecs; i++) in snd_intel8x0_ich_chip_init()
2449 if (chip->ac97[i]) in snd_intel8x0_ich_chip_init()
2450 status |= chip->codec_bit[chip->ac97_sdin[i]]; in snd_intel8x0_ich_chip_init()
2455 chip->codec_isr_bits; in snd_intel8x0_ich_chip_init()
2462 if (chip->device_type == DEVICE_SIS) { in snd_intel8x0_ich_chip_init()
2466 if (chip->device_type == DEVICE_NFORCE && !spdif_aclink) { in snd_intel8x0_ich_chip_init()
2469 pci_read_config_dword(chip->pci, 0x4c, &val); in snd_intel8x0_ich_chip_init()
2471 pci_write_config_dword(chip->pci, 0x4c, val); in snd_intel8x0_ich_chip_init()
2494 dev_err(chip->card->dev, "AC'97 reset failed.\n"); in snd_intel8x0_ali_chip_init()
2496 return -EIO; in snd_intel8x0_ali_chip_init()
2516 if (chip->device_type != DEVICE_ALI) { in snd_intel8x0_chip_init()
2526 for (i = 0; i < chip->bdbars_count; i++) in snd_intel8x0_chip_init()
2527 iputbyte(chip, ICH_REG_OFF_CR + chip->ichd[i].reg_offset, 0x00); in snd_intel8x0_chip_init()
2529 for (i = 0; i < chip->bdbars_count; i++) in snd_intel8x0_chip_init()
2530 iputbyte(chip, ICH_REG_OFF_CR + chip->ichd[i].reg_offset, ICH_RESETREGS); in snd_intel8x0_chip_init()
2531 for (i = 0; i < chip->bdbars_count; i++) { in snd_intel8x0_chip_init()
2533 while (--timeout != 0) { in snd_intel8x0_chip_init()
2534 if ((igetbyte(chip, ICH_REG_OFF_CR + chip->ichd[i].reg_offset) & ICH_RESETREGS) == 0) in snd_intel8x0_chip_init()
2538 dev_err(chip->card->dev, "reset of registers failed?\n"); in snd_intel8x0_chip_init()
2541 for (i = 0; i < chip->bdbars_count; i++) in snd_intel8x0_chip_init()
2542 iputdword(chip, ICH_REG_OFF_BDBAR + chip->ichd[i].reg_offset, in snd_intel8x0_chip_init()
2543 chip->ichd[i].bdbar_addr); in snd_intel8x0_chip_init()
2551 if (chip->irq < 0) in snd_intel8x0_free()
2554 for (i = 0; i < chip->bdbars_count; i++) in snd_intel8x0_free()
2555 iputbyte(chip, ICH_REG_OFF_CR + chip->ichd[i].reg_offset, 0x00); in snd_intel8x0_free()
2557 for (i = 0; i < chip->bdbars_count; i++) in snd_intel8x0_free()
2558 iputbyte(chip, ICH_REG_OFF_CR + chip->ichd[i].reg_offset, ICH_RESETREGS); in snd_intel8x0_free()
2559 if (chip->device_type == DEVICE_NFORCE && !spdif_aclink) { in snd_intel8x0_free()
2562 pci_read_config_dword(chip->pci, 0x4c, &val); in snd_intel8x0_free()
2564 pci_write_config_dword(chip->pci, 0x4c, val); in snd_intel8x0_free()
2566 /* --- */ in snd_intel8x0_free()
2569 if (chip->irq >= 0) in snd_intel8x0_free()
2570 free_irq(chip->irq, chip); in snd_intel8x0_free()
2571 if (chip->bdbars.area) in snd_intel8x0_free()
2572 snd_dma_free_pages(&chip->bdbars); in snd_intel8x0_free()
2573 if (chip->addr) in snd_intel8x0_free()
2574 pci_iounmap(chip->pci, chip->addr); in snd_intel8x0_free()
2575 if (chip->bmaddr) in snd_intel8x0_free()
2576 pci_iounmap(chip->pci, chip->bmaddr); in snd_intel8x0_free()
2577 pci_release_regions(chip->pci); in snd_intel8x0_free()
2578 pci_disable_device(chip->pci); in snd_intel8x0_free()
2590 struct intel8x0 *chip = card->private_data; in intel8x0_suspend()
2594 for (i = 0; i < chip->ncodecs; i++) in intel8x0_suspend()
2595 snd_ac97_suspend(chip->ac97[i]); in intel8x0_suspend()
2596 if (chip->device_type == DEVICE_INTEL_ICH4) in intel8x0_suspend()
2597 chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); in intel8x0_suspend()
2599 if (chip->irq >= 0) { in intel8x0_suspend()
2600 free_irq(chip->irq, chip); in intel8x0_suspend()
2601 chip->irq = -1; in intel8x0_suspend()
2602 card->sync_irq = -1; in intel8x0_suspend()
2611 struct intel8x0 *chip = card->private_data; in intel8x0_resume()
2615 if (request_irq(pci->irq, snd_intel8x0_interrupt, in intel8x0_resume()
2618 pci->irq); in intel8x0_resume()
2620 return -EIO; in intel8x0_resume()
2622 chip->irq = pci->irq; in intel8x0_resume()
2623 card->sync_irq = chip->irq; in intel8x0_resume()
2625 /* re-initialize mixer stuff */ in intel8x0_resume()
2626 if (chip->device_type == DEVICE_INTEL_ICH4 && !spdif_aclink) { in intel8x0_resume()
2628 iputbyte(chip, ICHREG(SDM), chip->sdm_saved); in intel8x0_resume()
2635 for (i = 0; i < chip->ncodecs; i++) in intel8x0_resume()
2636 snd_ac97_resume(chip->ac97[i]); in intel8x0_resume()
2639 for (i = 0; i < chip->bdbars_count; i++) { in intel8x0_resume()
2640 struct ichdev *ichdev = &chip->ichd[i]; in intel8x0_resume()
2641 unsigned long port = ichdev->reg_offset; in intel8x0_resume()
2642 if (! ichdev->substream || ! ichdev->suspended) in intel8x0_resume()
2644 if (ichdev->ichd == ICHD_PCMOUT) in intel8x0_resume()
2645 snd_intel8x0_setup_pcm_out(chip, ichdev->substream->runtime); in intel8x0_resume()
2646 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); in intel8x0_resume()
2647 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); in intel8x0_resume()
2648 iputbyte(chip, port + ICH_REG_OFF_CIV, ichdev->civ); in intel8x0_resume()
2649 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in intel8x0_resume()
2673 if (chip->ac97_bus->clock != 48000) in intel8x0_measure_ac97_clock()
2677 subs = chip->pcm[0]->streams[0].substream; in intel8x0_measure_ac97_clock()
2678 if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { in intel8x0_measure_ac97_clock()
2679 dev_warn(chip->card->dev, in intel8x0_measure_ac97_clock()
2680 "no playback buffer allocated - aborting measure ac97 clock\n"); in intel8x0_measure_ac97_clock()
2683 ichdev = &chip->ichd[ICHD_PCMOUT]; in intel8x0_measure_ac97_clock()
2684 ichdev->physbuf = subs->dma_buffer.addr; in intel8x0_measure_ac97_clock()
2685 ichdev->size = ichdev->fragsize = INTEL8X0_TESTBUF_SIZE; in intel8x0_measure_ac97_clock()
2686 ichdev->substream = NULL; /* don't process interrupts */ in intel8x0_measure_ac97_clock()
2689 if (snd_ac97_set_rate(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 48000) < 0) { in intel8x0_measure_ac97_clock()
2690 dev_err(chip->card->dev, "cannot set ac97 rate: clock = %d\n", in intel8x0_measure_ac97_clock()
2691 chip->ac97_bus->clock); in intel8x0_measure_ac97_clock()
2695 port = ichdev->reg_offset; in intel8x0_measure_ac97_clock()
2696 spin_lock_irq(&chip->reg_lock); in intel8x0_measure_ac97_clock()
2697 chip->in_measurement = 1; in intel8x0_measure_ac97_clock()
2699 if (chip->device_type != DEVICE_ALI) in intel8x0_measure_ac97_clock()
2703 iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot); in intel8x0_measure_ac97_clock()
2706 spin_unlock_irq(&chip->reg_lock); in intel8x0_measure_ac97_clock()
2708 spin_lock_irq(&chip->reg_lock); in intel8x0_measure_ac97_clock()
2711 civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); in intel8x0_measure_ac97_clock()
2712 pos1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); in intel8x0_measure_ac97_clock()
2717 if (civ == igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV) && in intel8x0_measure_ac97_clock()
2718 pos1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) in intel8x0_measure_ac97_clock()
2720 } while (timeout--); in intel8x0_measure_ac97_clock()
2724 pos = ichdev->fragsize1; in intel8x0_measure_ac97_clock()
2725 pos -= pos1 << ichdev->pos_shift; in intel8x0_measure_ac97_clock()
2726 pos += ichdev->position; in intel8x0_measure_ac97_clock()
2728 chip->in_measurement = 0; in intel8x0_measure_ac97_clock()
2731 if (chip->device_type == DEVICE_ALI) { in intel8x0_measure_ac97_clock()
2732 iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16)); in intel8x0_measure_ac97_clock()
2738 while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH)) in intel8x0_measure_ac97_clock()
2742 spin_unlock_irq(&chip->reg_lock); in intel8x0_measure_ac97_clock()
2745 dev_err(chip->card->dev, in intel8x0_measure_ac97_clock()
2746 "measure - unreliable DMA position..\n"); in intel8x0_measure_ac97_clock()
2758 dev_info(chip->card->dev, in intel8x0_measure_ac97_clock()
2761 dev_err(chip->card->dev, "?? calculation error..\n"); in intel8x0_measure_ac97_clock()
2768 dev_info(chip->card->dev, "measured clock %ld rejected\n", pos); in intel8x0_measure_ac97_clock()
2771 /* first exception - 41000Hz reference clock */ in intel8x0_measure_ac97_clock()
2772 chip->ac97_bus->clock = 41000; in intel8x0_measure_ac97_clock()
2774 /* second exception - 44100HZ reference clock */ in intel8x0_measure_ac97_clock()
2775 chip->ac97_bus->clock = 44100; in intel8x0_measure_ac97_clock()
2778 chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos; in intel8x0_measure_ac97_clock()
2780 dev_info(chip->card->dev, "clocking to %d\n", chip->ac97_bus->clock); in intel8x0_measure_ac97_clock()
2781 snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0); in intel8x0_measure_ac97_clock()
2796 struct pci_dev *pci = chip->pci; in intel8x0_in_clock_list()
2802 dev_info(chip->card->dev, "allow list rate for %04x:%04x is %i\n", in intel8x0_in_clock_list()
2803 pci->subsystem_vendor, pci->subsystem_device, wl->value); in intel8x0_in_clock_list()
2804 chip->ac97_bus->clock = wl->value; in intel8x0_in_clock_list()
2811 struct intel8x0 *chip = entry->private_data; in snd_intel8x0_proc_read()
2815 if (chip->device_type == DEVICE_ALI) in snd_intel8x0_proc_read()
2820 if (chip->device_type == DEVICE_INTEL_ICH4) in snd_intel8x0_proc_read()
2823 if (tmp & chip->codec_isr_bits) { in snd_intel8x0_proc_read()
2828 for (i = 0; i < chip->max_codecs; i++) in snd_intel8x0_proc_read()
2829 if (tmp & chip->codec_bit[i]) in snd_intel8x0_proc_read()
2834 if (chip->device_type == DEVICE_INTEL_ICH4 || in snd_intel8x0_proc_read()
2835 chip->device_type == DEVICE_SIS) in snd_intel8x0_proc_read()
2837 chip->ac97_sdin[0], in snd_intel8x0_proc_read()
2838 chip->ac97_sdin[1], in snd_intel8x0_proc_read()
2839 chip->ac97_sdin[2]); in snd_intel8x0_proc_read()
2844 snd_card_ro_proc_new(chip->card, "intel8x0", chip, in snd_intel8x0_proc_init()
2850 struct intel8x0 *chip = device->device_data; in snd_intel8x0_dev_free()
2879 if (pci->subsystem_vendor == PCI_SUBVENDOR_ID_REDHAT_QUMRANET && in snd_intel8x0_inside_vm()
2880 pci->subsystem_device == PCI_SUBDEVICE_ID_QEMU) { in snd_intel8x0_inside_vm()
2884 } else if (pci->subsystem_vendor == 0x1ab8) { in snd_intel8x0_inside_vm()
2892 dev_info(&pci->dev, "%s optimization\n", msg); in snd_intel8x0_inside_vm()
2950 return -ENOMEM; in snd_intel8x0_create()
2952 spin_lock_init(&chip->reg_lock); in snd_intel8x0_create()
2953 chip->device_type = device_type; in snd_intel8x0_create()
2954 chip->card = card; in snd_intel8x0_create()
2955 chip->pci = pci; in snd_intel8x0_create()
2956 chip->irq = -1; in snd_intel8x0_create()
2959 chip->buggy_irq = buggy_irq; in snd_intel8x0_create()
2960 chip->buggy_semaphore = buggy_semaphore; in snd_intel8x0_create()
2962 chip->xbox = 1; in snd_intel8x0_create()
2964 chip->inside_vm = snd_intel8x0_inside_vm(pci); in snd_intel8x0_create()
2969 * is to set the pages as non-cached. For details, see the errata in in snd_intel8x0_create()
2972 if (pci->vendor == PCI_VENDOR_ID_INTEL && in snd_intel8x0_create()
2973 pci->device == PCI_DEVICE_ID_INTEL_440MX) in snd_intel8x0_create()
2974 chip->fix_nocache = 1; /* enable workaround */ in snd_intel8x0_create()
2976 if ((err = pci_request_regions(pci, card->shortname)) < 0) { in snd_intel8x0_create()
2984 chip->bmaddr = pci_iomap(pci, 0, 0); in snd_intel8x0_create()
2989 chip->addr = pci_iomap(pci, 2, 0); in snd_intel8x0_create()
2991 chip->addr = pci_iomap(pci, 0, 0); in snd_intel8x0_create()
2992 if (!chip->addr) { in snd_intel8x0_create()
2993 dev_err(card->dev, "AC'97 space ioremap problem\n"); in snd_intel8x0_create()
2995 return -EIO; in snd_intel8x0_create()
2998 chip->bmaddr = pci_iomap(pci, 3, 0); in snd_intel8x0_create()
3000 chip->bmaddr = pci_iomap(pci, 1, 0); in snd_intel8x0_create()
3003 if (!chip->bmaddr) { in snd_intel8x0_create()
3004 dev_err(card->dev, "Controller space ioremap problem\n"); in snd_intel8x0_create()
3006 return -EIO; in snd_intel8x0_create()
3008 chip->bdbars_count = bdbars[device_type]; in snd_intel8x0_create()
3022 for (i = 0; i < chip->bdbars_count; i++) { in snd_intel8x0_create()
3023 ichdev = &chip->ichd[i]; in snd_intel8x0_create()
3024 ichdev->ichd = i; in snd_intel8x0_create()
3025 ichdev->reg_offset = tbl[i].offset; in snd_intel8x0_create()
3026 ichdev->int_sta_mask = tbl[i].int_sta_mask; in snd_intel8x0_create()
3029 ichdev->roff_sr = ICH_REG_OFF_PICB; in snd_intel8x0_create()
3030 ichdev->roff_picb = ICH_REG_OFF_SR; in snd_intel8x0_create()
3032 ichdev->roff_sr = ICH_REG_OFF_SR; in snd_intel8x0_create()
3033 ichdev->roff_picb = ICH_REG_OFF_PICB; in snd_intel8x0_create()
3036 ichdev->ali_slot = (ichdev->reg_offset - 0x40) / 0x10; in snd_intel8x0_create()
3038 ichdev->pos_shift = (device_type == DEVICE_SIS) ? 0 : 1; in snd_intel8x0_create()
3043 if (snd_dma_alloc_pages(intel8x0_dma_type(chip), &pci->dev, in snd_intel8x0_create()
3044 chip->bdbars_count * sizeof(u32) * ICH_MAX_FRAGS * 2, in snd_intel8x0_create()
3045 &chip->bdbars) < 0) { in snd_intel8x0_create()
3047 dev_err(card->dev, "cannot allocate buffer descriptors\n"); in snd_intel8x0_create()
3048 return -ENOMEM; in snd_intel8x0_create()
3053 for (i = 0; i < chip->bdbars_count; i++) { in snd_intel8x0_create()
3054 ichdev = &chip->ichd[i]; in snd_intel8x0_create()
3055 ichdev->bdbar = ((__le32 *)chip->bdbars.area) + in snd_intel8x0_create()
3057 ichdev->bdbar_addr = chip->bdbars.addr + in snd_intel8x0_create()
3059 int_sta_masks |= ichdev->int_sta_mask; in snd_intel8x0_create()
3061 chip->int_sta_reg = device_type == DEVICE_ALI ? in snd_intel8x0_create()
3063 chip->int_sta_mask = int_sta_masks; in snd_intel8x0_create()
3067 switch(chip->device_type) { in snd_intel8x0_create()
3070 chip->max_codecs = 3; in snd_intel8x0_create()
3071 chip->codec_bit = ich_codec_bits; in snd_intel8x0_create()
3072 chip->codec_ready_bits = ICH_PRI | ICH_SRI | ICH_TRI; in snd_intel8x0_create()
3076 chip->max_codecs = 3; in snd_intel8x0_create()
3077 chip->codec_bit = sis_codec_bits; in snd_intel8x0_create()
3078 chip->codec_ready_bits = ICH_PRI | ICH_SRI | ICH_SIS_TRI; in snd_intel8x0_create()
3082 chip->max_codecs = 2; in snd_intel8x0_create()
3083 chip->codec_bit = ich_codec_bits; in snd_intel8x0_create()
3084 chip->codec_ready_bits = ICH_PRI | ICH_SRI; in snd_intel8x0_create()
3087 for (i = 0; i < chip->max_codecs; i++) in snd_intel8x0_create()
3088 chip->codec_isr_bits |= chip->codec_bit[i]; in snd_intel8x0_create()
3096 if (request_irq(pci->irq, snd_intel8x0_interrupt, in snd_intel8x0_create()
3098 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); in snd_intel8x0_create()
3100 return -EBUSY; in snd_intel8x0_create()
3102 chip->irq = pci->irq; in snd_intel8x0_create()
3103 card->sync_irq = chip->irq; in snd_intel8x0_create()
3118 { PCI_DEVICE_ID_INTEL_82801AA_5, "Intel 82801AA-ICH" },
3119 { PCI_DEVICE_ID_INTEL_82801AB_5, "Intel 82901AB-ICH0" },
3120 { PCI_DEVICE_ID_INTEL_82801BA_4, "Intel 82801BA-ICH2" },
3122 { PCI_DEVICE_ID_INTEL_82801CA_5, "Intel 82801CA-ICH3" },
3123 { PCI_DEVICE_ID_INTEL_82801DB_5, "Intel 82801DB-ICH4" },
3148 /* look up allow/deny list for SPDIF over ac-link */
3155 if (w->value) in check_default_spdif_aclink()
3156 dev_dbg(&pci->dev, in check_default_spdif_aclink()
3157 "Using SPDIF over AC-Link for %s\n", in check_default_spdif_aclink()
3160 dev_dbg(&pci->dev, in check_default_spdif_aclink()
3163 return w->value; in check_default_spdif_aclink()
3176 err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card); in snd_intel8x0_probe()
3183 strcpy(card->driver, "ICH"); in snd_intel8x0_probe()
3185 switch (pci_id->driver_data) { in snd_intel8x0_probe()
3187 strcpy(card->driver, "NFORCE"); in snd_intel8x0_probe()
3190 strcpy(card->driver, "ICH4"); in snd_intel8x0_probe()
3194 strcpy(card->shortname, "Intel ICH"); in snd_intel8x0_probe()
3195 for (name = shortnames; name->id; name++) { in snd_intel8x0_probe()
3196 if (pci->device == name->id) { in snd_intel8x0_probe()
3197 strcpy(card->shortname, name->s); in snd_intel8x0_probe()
3206 if (pci_id->driver_data == DEVICE_NFORCE) in snd_intel8x0_probe()
3212 if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, in snd_intel8x0_probe()
3217 card->private_data = chip; in snd_intel8x0_probe()
3230 snprintf(card->longname, sizeof(card->longname), in snd_intel8x0_probe()
3231 "%s with %s at irq %i", card->shortname, in snd_intel8x0_probe()
3232 snd_ac97_get_short_name(chip->ac97[0]), chip->irq); in snd_intel8x0_probe()