• Home
  • Raw
  • Download

Lines Matching refs:ichdev

355 struct ichdev {  struct
398 struct ichdev ichd[6]; argument
681 static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ichdev) in snd_intel8x0_setup_periods() argument
684 u32 *bdbar = ichdev->bdbar; in snd_intel8x0_setup_periods()
685 unsigned long port = ichdev->reg_offset; in snd_intel8x0_setup_periods()
687 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); in snd_intel8x0_setup_periods()
688 if (ichdev->size == ichdev->fragsize) { in snd_intel8x0_setup_periods()
689 ichdev->ack_reload = ichdev->ack = 2; in snd_intel8x0_setup_periods()
690 ichdev->fragsize1 = ichdev->fragsize >> 1; in snd_intel8x0_setup_periods()
692 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf); in snd_intel8x0_setup_periods()
694 ichdev->fragsize1 >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
695 bdbar[idx + 2] = cpu_to_le32(ichdev->physbuf + (ichdev->size >> 1)); in snd_intel8x0_setup_periods()
697 ichdev->fragsize1 >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
699 ichdev->frags = 2; in snd_intel8x0_setup_periods()
701 ichdev->ack_reload = ichdev->ack = 1; in snd_intel8x0_setup_periods()
702 ichdev->fragsize1 = ichdev->fragsize; in snd_intel8x0_setup_periods()
704 bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + in snd_intel8x0_setup_periods()
705 (((idx >> 1) * ichdev->fragsize) % in snd_intel8x0_setup_periods()
706 ichdev->size)); in snd_intel8x0_setup_periods()
708 ichdev->fragsize >> ichdev->pos_shift); in snd_intel8x0_setup_periods()
714 ichdev->frags = ichdev->size / ichdev->fragsize; in snd_intel8x0_setup_periods()
716 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi = ICH_REG_LVI_MASK); in snd_intel8x0_setup_periods()
717 ichdev->civ = 0; in snd_intel8x0_setup_periods()
719 ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; in snd_intel8x0_setup_periods()
720 ichdev->position = 0; in snd_intel8x0_setup_periods()
724 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, in snd_intel8x0_setup_periods()
725 ichdev->fragsize1); in snd_intel8x0_setup_periods()
728 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in snd_intel8x0_setup_periods()
754 static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ichdev) in snd_intel8x0_update() argument
756 unsigned long port = ichdev->reg_offset; in snd_intel8x0_update()
762 status = igetbyte(chip, port + ichdev->roff_sr); in snd_intel8x0_update()
766 } else if (civ == ichdev->civ) { in snd_intel8x0_update()
769 ichdev->civ++; in snd_intel8x0_update()
770 ichdev->civ &= ICH_REG_LVI_MASK; in snd_intel8x0_update()
772 step = civ - ichdev->civ; in snd_intel8x0_update()
777 ichdev->civ = civ; in snd_intel8x0_update()
780 ichdev->position += step * ichdev->fragsize1; in snd_intel8x0_update()
782 ichdev->position %= ichdev->size; in snd_intel8x0_update()
783 ichdev->lvi += step; in snd_intel8x0_update()
784 ichdev->lvi &= ICH_REG_LVI_MASK; in snd_intel8x0_update()
785 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); in snd_intel8x0_update()
787 ichdev->lvi_frag++; in snd_intel8x0_update()
788 ichdev->lvi_frag %= ichdev->frags; in snd_intel8x0_update()
789ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize… in snd_intel8x0_update()
793 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], in snd_intel8x0_update()
794 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), in snd_intel8x0_update()
797 if (--ichdev->ack == 0) { in snd_intel8x0_update()
798 ichdev->ack = ichdev->ack_reload; in snd_intel8x0_update()
803 if (ack && ichdev->substream) { in snd_intel8x0_update()
804 snd_pcm_period_elapsed(ichdev->substream); in snd_intel8x0_update()
806 iputbyte(chip, port + ichdev->roff_sr, in snd_intel8x0_update()
813 struct ichdev *ichdev; in snd_intel8x0_interrupt() local
832 ichdev = &chip->ichd[i]; in snd_intel8x0_interrupt()
833 if (status & ichdev->int_sta_mask) in snd_intel8x0_interrupt()
834 snd_intel8x0_update(chip, ichdev); in snd_intel8x0_interrupt()
850 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_pcm_trigger() local
852 unsigned long port = ichdev->reg_offset; in snd_intel8x0_pcm_trigger()
856 ichdev->suspended = 0; in snd_intel8x0_pcm_trigger()
861 ichdev->last_pos = ichdev->position; in snd_intel8x0_pcm_trigger()
864 ichdev->suspended = 1; in snd_intel8x0_pcm_trigger()
878 while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH)) ; in snd_intel8x0_pcm_trigger()
888 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_ali_trigger() local
889 unsigned long port = ichdev->reg_offset; in snd_intel8x0_ali_trigger()
898 ichdev->suspended = 0; in snd_intel8x0_ali_trigger()
904 fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]); in snd_intel8x0_ali_trigger()
905 fifo &= ~(0xff << (ichdev->ali_slot % 4)); in snd_intel8x0_ali_trigger()
906 fifo |= 0x83 << (ichdev->ali_slot % 4); in snd_intel8x0_ali_trigger()
907 iputdword(chip, fiforeg[ichdev->ali_slot / 4], fifo); in snd_intel8x0_ali_trigger()
910 val &= ~(1 << (ichdev->ali_slot + 16)); /* clear PAUSE flag */ in snd_intel8x0_ali_trigger()
912 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << ichdev->ali_slot)); in snd_intel8x0_ali_trigger()
915 ichdev->suspended = 1; in snd_intel8x0_ali_trigger()
920 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << (ichdev->ali_slot + 16))); in snd_intel8x0_ali_trigger()
932 igetdword(chip, ICHREG(ALI_INTERRUPTSR)) & ichdev->int_sta_mask); in snd_intel8x0_ali_trigger()
944 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_hw_params() local
949 if (chip->fix_nocache && ichdev->page_attr_changed) { in snd_intel8x0_hw_params()
951 ichdev->page_attr_changed = 0; in snd_intel8x0_hw_params()
957 if (runtime->dma_area && ! ichdev->page_attr_changed) { in snd_intel8x0_hw_params()
959 ichdev->page_attr_changed = 1; in snd_intel8x0_hw_params()
962 if (ichdev->pcm_open_flag) { in snd_intel8x0_hw_params()
963 snd_ac97_pcm_close(ichdev->pcm); in snd_intel8x0_hw_params()
964 ichdev->pcm_open_flag = 0; in snd_intel8x0_hw_params()
966 err = snd_ac97_pcm_open(ichdev->pcm, params_rate(hw_params), in snd_intel8x0_hw_params()
968 ichdev->pcm->r[dbl].slots); in snd_intel8x0_hw_params()
970 ichdev->pcm_open_flag = 1; in snd_intel8x0_hw_params()
972 if (ichdev->ichd == ICHD_PCMOUT && chip->spdif_idx < 0) in snd_intel8x0_hw_params()
973 snd_ac97_set_rate(ichdev->pcm->r[0].codec[0], AC97_SPDIF, in snd_intel8x0_hw_params()
982 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_hw_free() local
984 if (ichdev->pcm_open_flag) { in snd_intel8x0_hw_free()
985 snd_ac97_pcm_close(ichdev->pcm); in snd_intel8x0_hw_free()
986 ichdev->pcm_open_flag = 0; in snd_intel8x0_hw_free()
988 if (chip->fix_nocache && ichdev->page_attr_changed) { in snd_intel8x0_hw_free()
990 ichdev->page_attr_changed = 0; in snd_intel8x0_hw_free()
1054 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_pcm_prepare() local
1056 ichdev->physbuf = runtime->dma_addr; in snd_intel8x0_pcm_prepare()
1057 ichdev->size = snd_pcm_lib_buffer_bytes(substream); in snd_intel8x0_pcm_prepare()
1058 ichdev->fragsize = snd_pcm_lib_period_bytes(substream); in snd_intel8x0_pcm_prepare()
1059 if (ichdev->ichd == ICHD_PCMOUT) { in snd_intel8x0_pcm_prepare()
1062 ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; in snd_intel8x0_pcm_prepare()
1064 snd_intel8x0_setup_periods(chip, ichdev); in snd_intel8x0_pcm_prepare()
1071 struct ichdev *ichdev = get_ichdev(substream); in snd_intel8x0_pcm_pointer() local
1078 civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); in snd_intel8x0_pcm_pointer()
1079 ptr1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); in snd_intel8x0_pcm_pointer()
1080 position = ichdev->position; in snd_intel8x0_pcm_pointer()
1085 if (civ != igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV)) in snd_intel8x0_pcm_pointer()
1096 if (ptr1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) in snd_intel8x0_pcm_pointer()
1099 ptr = ichdev->last_pos; in snd_intel8x0_pcm_pointer()
1101 ptr1 <<= ichdev->pos_shift; in snd_intel8x0_pcm_pointer()
1102 ptr = ichdev->fragsize1 - ptr1; in snd_intel8x0_pcm_pointer()
1104 if (ptr < ichdev->last_pos) { in snd_intel8x0_pcm_pointer()
1106 pos_base = position / ichdev->fragsize1; in snd_intel8x0_pcm_pointer()
1107 last_base = ichdev->last_pos / ichdev->fragsize1; in snd_intel8x0_pcm_pointer()
1112 ptr = ichdev->last_pos; in snd_intel8x0_pcm_pointer()
1115 ichdev->last_pos = ptr; in snd_intel8x0_pcm_pointer()
1117 if (ptr >= ichdev->size) in snd_intel8x0_pcm_pointer()
1173 static int snd_intel8x0_pcm_open(struct snd_pcm_substream *substream, struct ichdev *ichdev) in snd_intel8x0_pcm_open() argument
1179 ichdev->substream = substream; in snd_intel8x0_pcm_open()
1181 runtime->hw.rates = ichdev->pcm->rates; in snd_intel8x0_pcm_open()
1189 runtime->private_data = ichdev; in snd_intel8x0_pcm_open()
2667 struct ichdev *ichdev = &chip->ichd[i]; in intel8x0_suspend() local
2668 if (ichdev->substream && ichdev->page_attr_changed) { in intel8x0_suspend()
2669 struct snd_pcm_runtime *runtime = ichdev->substream->runtime; in intel8x0_suspend()
2725 struct ichdev *ichdev = &chip->ichd[i]; in intel8x0_resume() local
2726 if (ichdev->substream && ichdev->page_attr_changed) { in intel8x0_resume()
2727 struct snd_pcm_runtime *runtime = ichdev->substream->runtime; in intel8x0_resume()
2736 struct ichdev *ichdev = &chip->ichd[i]; in intel8x0_resume() local
2737 unsigned long port = ichdev->reg_offset; in intel8x0_resume()
2738 if (! ichdev->substream || ! ichdev->suspended) in intel8x0_resume()
2740 if (ichdev->ichd == ICHD_PCMOUT) in intel8x0_resume()
2741 snd_intel8x0_setup_pcm_out(chip, ichdev->substream->runtime); in intel8x0_resume()
2742 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr); in intel8x0_resume()
2743 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi); in intel8x0_resume()
2744 iputbyte(chip, port + ICH_REG_OFF_CIV, ichdev->civ); in intel8x0_resume()
2745 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); in intel8x0_resume()
2763 struct ichdev *ichdev; in intel8x0_measure_ac97_clock() local
2779 ichdev = &chip->ichd[ICHD_PCMOUT]; in intel8x0_measure_ac97_clock()
2780 ichdev->physbuf = subs->dma_buffer.addr; in intel8x0_measure_ac97_clock()
2781 ichdev->size = ichdev->fragsize = INTEL8X0_TESTBUF_SIZE; in intel8x0_measure_ac97_clock()
2782 ichdev->substream = NULL; /* don't process interrupts */ in intel8x0_measure_ac97_clock()
2790 snd_intel8x0_setup_periods(chip, ichdev); in intel8x0_measure_ac97_clock()
2791 port = ichdev->reg_offset; in intel8x0_measure_ac97_clock()
2799 iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot); in intel8x0_measure_ac97_clock()
2807 civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); in intel8x0_measure_ac97_clock()
2808 pos1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); in intel8x0_measure_ac97_clock()
2813 if (civ == igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV) && in intel8x0_measure_ac97_clock()
2814 pos1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) in intel8x0_measure_ac97_clock()
2820 pos = ichdev->fragsize1; in intel8x0_measure_ac97_clock()
2821 pos -= pos1 << ichdev->pos_shift; in intel8x0_measure_ac97_clock()
2822 pos += ichdev->position; in intel8x0_measure_ac97_clock()
2828 iputdword(chip, ICHREG(ALI_DMACR), 1 << (ichdev->ali_slot + 16)); in intel8x0_measure_ac97_clock()
2834 while (!(igetbyte(chip, port + ichdev->roff_sr) & ICH_DCH)) in intel8x0_measure_ac97_clock()
3012 struct ichdev *ichdev; in snd_intel8x0_create() local
3123 ichdev = &chip->ichd[i]; in snd_intel8x0_create()
3124 ichdev->ichd = i; in snd_intel8x0_create()
3125 ichdev->reg_offset = tbl[i].offset; in snd_intel8x0_create()
3126 ichdev->int_sta_mask = tbl[i].int_sta_mask; in snd_intel8x0_create()
3129 ichdev->roff_sr = ICH_REG_OFF_PICB; in snd_intel8x0_create()
3130 ichdev->roff_picb = ICH_REG_OFF_SR; in snd_intel8x0_create()
3132 ichdev->roff_sr = ICH_REG_OFF_SR; in snd_intel8x0_create()
3133 ichdev->roff_picb = ICH_REG_OFF_PICB; in snd_intel8x0_create()
3136 ichdev->ali_slot = (ichdev->reg_offset - 0x40) / 0x10; in snd_intel8x0_create()
3138 ichdev->pos_shift = (device_type == DEVICE_SIS) ? 0 : 1; in snd_intel8x0_create()
3157 ichdev = &chip->ichd[i]; in snd_intel8x0_create()
3158 ichdev->bdbar = ((u32 *)chip->bdbars.area) + in snd_intel8x0_create()
3160 ichdev->bdbar_addr = chip->bdbars.addr + in snd_intel8x0_create()
3162 int_sta_masks |= ichdev->int_sta_mask; in snd_intel8x0_create()