Lines Matching refs:ichdev
351 struct ichdev { struct
394 struct ichdev ichd[6]; argument
677 static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ichdev) in snd_intel8x0_setup_periods() argument
680 __le32 *bdbar = ichdev->bdbar; in snd_intel8x0_setup_periods()
681 unsigned long port = ichdev->reg_offset; in snd_intel8x0_setup_periods()
683 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); in snd_intel8x0_setup_periods()
684 if (ichdev->size == ichdev->fragsize) { in snd_intel8x0_setup_periods()
685 ichdev->ack_reload = ichdev->ack = 2; in snd_intel8x0_setup_periods()
686 ichdev->fragsize1 = ichdev->fragsize >> 1; in snd_intel8x0_setup_periods()
688 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf); in snd_intel8x0_setup_periods()
690 ichdev->fragsize1 >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
691 bdbar[idx + 2] = cpu_to_le32(ichdev->physbuf + (ichdev->size >> 1)); in snd_intel8x0_setup_periods()
693 ichdev->fragsize1 >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
695 ichdev->frags = 2; in snd_intel8x0_setup_periods()
697 ichdev->ack_reload = ichdev->ack = 1; in snd_intel8x0_setup_periods()
698 ichdev->fragsize1 = ichdev->fragsize; in snd_intel8x0_setup_periods()
700 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + in snd_intel8x0_setup_periods()
701 (((idx >> 1) * ichdev->fragsize) % in snd_intel8x0_setup_periods()
702 ichdev->size)); in snd_intel8x0_setup_periods()
704 ichdev->fragsize >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
710 ichdev->frags = ichdev->size / ichdev->fragsize; in snd_intel8x0_setup_periods()
712 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi = ICH_REG_LVI_MASK); in snd_intel8x0_setup_periods()
713 ichdev->civ = 0; in snd_intel8x0_setup_periods()
715 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; in snd_intel8x0_setup_periods()
716 ichdev->position = 0; in snd_intel8x0_setup_periods()
720 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, in snd_intel8x0_setup_periods()
721 ichdev->fragsize1); in snd_intel8x0_setup_periods()
724 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in snd_intel8x0_setup_periods()
750 static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ichdev) in snd_intel8x0_update() argument
752 unsigned long port = ichdev->reg_offset; in snd_intel8x0_update()
758 status = igetbyte(chip, port + ichdev->roff_sr); in snd_intel8x0_update()
762 } else if (civ == ichdev->civ) { in snd_intel8x0_update()
765 ichdev->civ++; in snd_intel8x0_update()
766 ichdev->civ &= ICH_REG_LVI_MASK; in snd_intel8x0_update()
768 step = civ - ichdev->civ; in snd_intel8x0_update()
773 ichdev->civ = civ; in snd_intel8x0_update()
776 ichdev->position += step * ichdev->fragsize1; in snd_intel8x0_update()
778 ichdev->position %= ichdev->size; in snd_intel8x0_update()
779 ichdev->lvi += step; in snd_intel8x0_update()
780 ichdev->lvi &= ICH_REG_LVI_MASK; in snd_intel8x0_update()
781 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); in snd_intel8x0_update()
783 ichdev->lvi_frag++; in snd_intel8x0_update()
784 ichdev->lvi_frag %= ichdev->frags; in snd_intel8x0_update()
785 …ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize… in snd_intel8x0_update()
789 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], in snd_intel8x0_update()
790 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), in snd_intel8x0_update()
793 if (--ichdev->ack == 0) { in snd_intel8x0_update()
794 ichdev->ack = ichdev->ack_reload; in snd_intel8x0_update()
799 if (ack && ichdev->substream) { in snd_intel8x0_update()
800 snd_pcm_period_elapsed(ichdev->substream); in snd_intel8x0_update()
802 iputbyte(chip, port + ichdev->roff_sr, in snd_intel8x0_update()
809 struct ichdev *ichdev; in snd_intel8x0_interrupt() local
828 ichdev = &chip->ichd[i]; in snd_intel8x0_interrupt()
829 if (status & ichdev->int_sta_mask) in snd_intel8x0_interrupt()
830 snd_intel8x0_update(chip, ichdev); in snd_intel8x0_interrupt()
846 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_pcm_trigger() local
848 unsigned long port = ichdev->reg_offset; in snd_intel8x0_pcm_trigger()
852 ichdev->suspended = 0; in snd_intel8x0_pcm_trigger()
857 ichdev->last_pos = ichdev->position; in snd_intel8x0_pcm_trigger()
860 ichdev->suspended = 1; in snd_intel8x0_pcm_trigger()
874 while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH)) ; in snd_intel8x0_pcm_trigger()
884 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_ali_trigger() local
885 unsigned long port = ichdev->reg_offset; in snd_intel8x0_ali_trigger()
894 ichdev->suspended = 0; in snd_intel8x0_ali_trigger()
900 fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]); in snd_intel8x0_ali_trigger()
901 fifo &= ~(0xff << (ichdev->ali_slot % 4)); in snd_intel8x0_ali_trigger()
902 fifo |= 0x83 << (ichdev->ali_slot % 4); in snd_intel8x0_ali_trigger()
903 iputdword(chip, fiforeg[ichdev->ali_slot / 4], fifo); in snd_intel8x0_ali_trigger()
906 val &= ~(1 << (ichdev->ali_slot + 16)); /* clear PAUSE flag */ in snd_intel8x0_ali_trigger()
908 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << ichdev->ali_slot)); in snd_intel8x0_ali_trigger()
911 ichdev->suspended = 1; in snd_intel8x0_ali_trigger()
916 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << (ichdev->ali_slot + 16))); in snd_intel8x0_ali_trigger()
928 igetdword(chip, ICHREG(ALI_INTERRUPTSR)) & ichdev->int_sta_mask); in snd_intel8x0_ali_trigger()
940 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_hw_params() local
945 if (chip->fix_nocache && ichdev->page_attr_changed) { in snd_intel8x0_hw_params()
947 ichdev->page_attr_changed = 0; in snd_intel8x0_hw_params()
953 if (runtime->dma_area && ! ichdev->page_attr_changed) { in snd_intel8x0_hw_params()
955 ichdev->page_attr_changed = 1; in snd_intel8x0_hw_params()
958 if (ichdev->pcm_open_flag) { in snd_intel8x0_hw_params()
959 snd_ac97_pcm_close(ichdev->pcm); in snd_intel8x0_hw_params()
960 ichdev->pcm_open_flag = 0; in snd_intel8x0_hw_params()
962 err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params), in snd_intel8x0_hw_params()
964 ichdev->pcm->r[dbl].slots); in snd_intel8x0_hw_params()
966 ichdev->pcm_open_flag = 1; in snd_intel8x0_hw_params()
968 if (ichdev->ichd == ICHD_PCMOUT && chip->spdif_idx < 0) in snd_intel8x0_hw_params()
969 snd_ac97_set_rate(ichdev->pcm->r[0].codec[0], AC97_SPDIF, in snd_intel8x0_hw_params()
978 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_hw_free() local
980 if (ichdev->pcm_open_flag) { in snd_intel8x0_hw_free()
981 snd_ac97_pcm_close(ichdev->pcm); in snd_intel8x0_hw_free()
982 ichdev->pcm_open_flag = 0; in snd_intel8x0_hw_free()
984 if (chip->fix_nocache && ichdev->page_attr_changed) { in snd_intel8x0_hw_free()
986 ichdev->page_attr_changed = 0; in snd_intel8x0_hw_free()
1050 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_pcm_prepare() local
1052 ichdev->physbuf = runtime->dma_addr; in snd_intel8x0_pcm_prepare()
1053 ichdev->size = snd_pcm_lib_buffer_bytes(substream); in snd_intel8x0_pcm_prepare()
1054 ichdev->fragsize = snd_pcm_lib_period_bytes(substream); in snd_intel8x0_pcm_prepare()
1055 if (ichdev->ichd == ICHD_PCMOUT) { in snd_intel8x0_pcm_prepare()
1058 ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; in snd_intel8x0_pcm_prepare()
1060 snd_intel8x0_setup_periods(chip, ichdev); in snd_intel8x0_pcm_prepare()
1067 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_pcm_pointer() local
1074 civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); in snd_intel8x0_pcm_pointer()
1075 ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); in snd_intel8x0_pcm_pointer()
1076 position = ichdev->position; in snd_intel8x0_pcm_pointer()
1081 if (civ != igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV)) in snd_intel8x0_pcm_pointer()
1092 if (ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) in snd_intel8x0_pcm_pointer()
1095 ptr = ichdev->last_pos; in snd_intel8x0_pcm_pointer()
1097 ptr1 <<= ichdev->pos_shift; in snd_intel8x0_pcm_pointer()
1098 ptr = ichdev->fragsize1 - ptr1; in snd_intel8x0_pcm_pointer()
1100 if (ptr < ichdev->last_pos) { in snd_intel8x0_pcm_pointer()
1102 pos_base = position / ichdev->fragsize1; in snd_intel8x0_pcm_pointer()
1103 last_base = ichdev->last_pos / ichdev->fragsize1; in snd_intel8x0_pcm_pointer()
1108 ptr = ichdev->last_pos; in snd_intel8x0_pcm_pointer()
1111 ichdev->last_pos = ptr; in snd_intel8x0_pcm_pointer()
1113 if (ptr >= ichdev->size) in snd_intel8x0_pcm_pointer()
1169 static int snd_intel8x0_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) in snd_intel8x0_pcm_open() argument
1175 ichdev->substream = substream; in snd_intel8x0_pcm_open()
1177 runtime->hw.rates = ichdev->pcm->rates; in snd_intel8x0_pcm_open()
1185 runtime->private_data = ichdev; in snd_intel8x0_pcm_open()
2663 struct ichdev *ichdev = &chip->ichd[i]; in intel8x0_suspend() local
2664 if (ichdev->substream && ichdev->page_attr_changed) { in intel8x0_suspend()
2665 struct snd_pcm_runtime *runtime = ichdev->substream->runtime; in intel8x0_suspend()
2721 struct ichdev *ichdev = &chip->ichd[i]; in intel8x0_resume() local
2722 if (ichdev->substream && ichdev->page_attr_changed) { in intel8x0_resume()
2723 struct snd_pcm_runtime *runtime = ichdev->substream->runtime; in intel8x0_resume()
2732 struct ichdev *ichdev = &chip->ichd[i]; in intel8x0_resume() local
2733 unsigned long port = ichdev->reg_offset; in intel8x0_resume()
2734 if (! ichdev->substream || ! ichdev->suspended) in intel8x0_resume()
2736 if (ichdev->ichd == ICHD_PCMOUT) in intel8x0_resume()
2737 snd_intel8x0_setup_pcm_out(chip, ichdev->substream->runtime); in intel8x0_resume()
2738 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); in intel8x0_resume()
2739 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); in intel8x0_resume()
2740 iputbyte(chip, port + ICH_REG_OFF_CIV, ichdev->civ); in intel8x0_resume()
2741 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in intel8x0_resume()
2759 struct ichdev *ichdev; in intel8x0_measure_ac97_clock() local
2775 ichdev = &chip->ichd[ICHD_PCMOUT]; in intel8x0_measure_ac97_clock()
2776 ichdev->physbuf = subs->dma_buffer.addr; in intel8x0_measure_ac97_clock()
2777 ichdev->size = ichdev->fragsize = INTEL8X0_TESTBUF_SIZE; in intel8x0_measure_ac97_clock()
2778 ichdev->substream = NULL; /* don't process interrupts */ in intel8x0_measure_ac97_clock()
2786 snd_intel8x0_setup_periods(chip, ichdev); in intel8x0_measure_ac97_clock()
2787 port = ichdev->reg_offset; in intel8x0_measure_ac97_clock()
2795 iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot); in intel8x0_measure_ac97_clock()
2803 civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); in intel8x0_measure_ac97_clock()
2804 pos1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); in intel8x0_measure_ac97_clock()
2809 if (civ == igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV) && in intel8x0_measure_ac97_clock()
2810 pos1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) in intel8x0_measure_ac97_clock()
2816 pos = ichdev->fragsize1; in intel8x0_measure_ac97_clock()
2817 pos -= pos1 << ichdev->pos_shift; in intel8x0_measure_ac97_clock()
2818 pos += ichdev->position; in intel8x0_measure_ac97_clock()
2824 iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16)); in intel8x0_measure_ac97_clock()
2830 while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH)) in intel8x0_measure_ac97_clock()
3000 struct ichdev *ichdev; in snd_intel8x0_create() local
3111 ichdev = &chip->ichd[i]; in snd_intel8x0_create()
3112 ichdev->ichd = i; in snd_intel8x0_create()
3113 ichdev->reg_offset = tbl[i].offset; in snd_intel8x0_create()
3114 ichdev->int_sta_mask = tbl[i].int_sta_mask; in snd_intel8x0_create()
3117 ichdev->roff_sr = ICH_REG_OFF_PICB; in snd_intel8x0_create()
3118 ichdev->roff_picb = ICH_REG_OFF_SR; in snd_intel8x0_create()
3120 ichdev->roff_sr = ICH_REG_OFF_SR; in snd_intel8x0_create()
3121 ichdev->roff_picb = ICH_REG_OFF_PICB; in snd_intel8x0_create()
3124 ichdev->ali_slot = (ichdev->reg_offset - 0x40) / 0x10; in snd_intel8x0_create()
3126 ichdev->pos_shift = (device_type == DEVICE_SIS) ? 0 : 1; in snd_intel8x0_create()
3145 ichdev = &chip->ichd[i]; in snd_intel8x0_create()
3146 ichdev->bdbar = ((__le32 *)chip->bdbars.area) + in snd_intel8x0_create()
3148 ichdev->bdbar_addr = chip->bdbars.addr + in snd_intel8x0_create()
3150 int_sta_masks |= ichdev->int_sta_mask; in snd_intel8x0_create()