Lines Matching refs:chip
118 struct snd_sgio2audio *chip = priv; in read_ad1843_reg() local
122 spin_lock_irqsave(&chip->ad1843_lock, flags); in read_ad1843_reg()
132 spin_unlock_irqrestore(&chip->ad1843_lock, flags); in read_ad1843_reg()
141 struct snd_sgio2audio *chip = priv; in write_ad1843_reg() local
145 spin_lock_irqsave(&chip->ad1843_lock, flags); in write_ad1843_reg()
154 spin_unlock_irqrestore(&chip->ad1843_lock, flags); in write_ad1843_reg()
161 struct snd_sgio2audio *chip = snd_kcontrol_chip(kcontrol); in sgio2audio_gain_info() local
166 uinfo->value.integer.max = ad1843_get_gain_max(&chip->ad1843, in sgio2audio_gain_info()
174 struct snd_sgio2audio *chip = snd_kcontrol_chip(kcontrol); in sgio2audio_gain_get() local
177 vol = ad1843_get_gain(&chip->ad1843, (int)kcontrol->private_value); in sgio2audio_gain_get()
188 struct snd_sgio2audio *chip = snd_kcontrol_chip(kcontrol); in sgio2audio_gain_put() local
191 oldvol = ad1843_get_gain(&chip->ad1843, kcontrol->private_value); in sgio2audio_gain_put()
195 newvol = ad1843_set_gain(&chip->ad1843, kcontrol->private_value, in sgio2audio_gain_put()
213 struct snd_sgio2audio *chip = snd_kcontrol_chip(kcontrol); in sgio2audio_source_get() local
215 ucontrol->value.enumerated.item[0] = ad1843_get_recsrc(&chip->ad1843); in sgio2audio_source_get()
222 struct snd_sgio2audio *chip = snd_kcontrol_chip(kcontrol); in sgio2audio_source_put() local
225 oldsrc = ad1843_get_recsrc(&chip->ad1843); in sgio2audio_source_put()
226 newsrc = ad1843_set_recsrc(&chip->ad1843, in sgio2audio_source_put()
313 static int snd_sgio2audio_new_mixer(struct snd_sgio2audio *chip) in snd_sgio2audio_new_mixer() argument
317 err = snd_ctl_add(chip->card, in snd_sgio2audio_new_mixer()
318 snd_ctl_new1(&sgio2audio_ctrl_pcm0, chip)); in snd_sgio2audio_new_mixer()
322 err = snd_ctl_add(chip->card, in snd_sgio2audio_new_mixer()
323 snd_ctl_new1(&sgio2audio_ctrl_pcm1, chip)); in snd_sgio2audio_new_mixer()
327 err = snd_ctl_add(chip->card, in snd_sgio2audio_new_mixer()
328 snd_ctl_new1(&sgio2audio_ctrl_reclevel, chip)); in snd_sgio2audio_new_mixer()
332 err = snd_ctl_add(chip->card, in snd_sgio2audio_new_mixer()
333 snd_ctl_new1(&sgio2audio_ctrl_recsource, chip)); in snd_sgio2audio_new_mixer()
336 err = snd_ctl_add(chip->card, in snd_sgio2audio_new_mixer()
337 snd_ctl_new1(&sgio2audio_ctrl_line, chip)); in snd_sgio2audio_new_mixer()
341 err = snd_ctl_add(chip->card, in snd_sgio2audio_new_mixer()
342 snd_ctl_new1(&sgio2audio_ctrl_cd, chip)); in snd_sgio2audio_new_mixer()
346 err = snd_ctl_add(chip->card, in snd_sgio2audio_new_mixer()
347 snd_ctl_new1(&sgio2audio_ctrl_mic, chip)); in snd_sgio2audio_new_mixer()
358 static int snd_sgio2audio_dma_pull_frag(struct snd_sgio2audio *chip, in snd_sgio2audio_dma_pull_frag() argument
369 struct snd_pcm_runtime *runtime = chip->channel[ch].substream->runtime; in snd_sgio2audio_dma_pull_frag()
371 spin_lock_irqsave(&chip->channel[ch].lock, flags); in snd_sgio2audio_dma_pull_frag()
373 src_base = (unsigned long) chip->ring_base | (ch << CHANNEL_RING_SHIFT); in snd_sgio2audio_dma_pull_frag()
376 dst_pos = chip->channel[ch].pos; in snd_sgio2audio_dma_pull_frag()
380 chip->channel[ch].size += (count >> 3); /* in frames */ in snd_sgio2audio_dma_pull_frag()
381 ret = chip->channel[ch].size >= runtime->period_size; in snd_sgio2audio_dma_pull_frag()
382 chip->channel[ch].size %= runtime->period_size; in snd_sgio2audio_dma_pull_frag()
398 chip->channel[ch].pos = dst_pos; in snd_sgio2audio_dma_pull_frag()
400 spin_unlock_irqrestore(&chip->channel[ch].lock, flags); in snd_sgio2audio_dma_pull_frag()
406 static int snd_sgio2audio_dma_push_frag(struct snd_sgio2audio *chip, in snd_sgio2audio_dma_push_frag() argument
417 struct snd_pcm_runtime *runtime = chip->channel[ch].substream->runtime; in snd_sgio2audio_dma_push_frag()
419 spin_lock_irqsave(&chip->channel[ch].lock, flags); in snd_sgio2audio_dma_push_frag()
421 dst_base = (unsigned long)chip->ring_base | (ch << CHANNEL_RING_SHIFT); in snd_sgio2audio_dma_push_frag()
424 src_pos = chip->channel[ch].pos; in snd_sgio2audio_dma_push_frag()
428 chip->channel[ch].size += (count >> 3); /* in frames */ in snd_sgio2audio_dma_push_frag()
429 ret = chip->channel[ch].size >= runtime->period_size; in snd_sgio2audio_dma_push_frag()
430 chip->channel[ch].size %= runtime->period_size; in snd_sgio2audio_dma_push_frag()
448 chip->channel[ch].pos = src_pos; in snd_sgio2audio_dma_push_frag()
450 spin_unlock_irqrestore(&chip->channel[ch].lock, flags); in snd_sgio2audio_dma_push_frag()
456 struct snd_sgio2audio *chip = snd_pcm_substream_chip(substream); in snd_sgio2audio_dma_start() local
467 snd_sgio2audio_dma_push_frag(chip, ch, CHANNEL_RING_SIZE - 32); in snd_sgio2audio_dma_start()
487 struct snd_sgio2audio *chip; in snd_sgio2audio_dma_in_isr() local
491 chip = snd_pcm_substream_chip(substream); in snd_sgio2audio_dma_in_isr()
497 if (snd_sgio2audio_dma_pull_frag(chip, ch, count)) in snd_sgio2audio_dma_in_isr()
507 struct snd_sgio2audio *chip; in snd_sgio2audio_dma_out_isr() local
511 chip = snd_pcm_substream_chip(substream); in snd_sgio2audio_dma_out_isr()
516 if (snd_sgio2audio_dma_push_frag(chip, ch, count)) in snd_sgio2audio_dma_out_isr()
556 struct snd_sgio2audio *chip = snd_pcm_substream_chip(substream); in snd_sgio2audio_playback1_open() local
560 runtime->private_data = &chip->channel[1]; in snd_sgio2audio_playback1_open()
566 struct snd_sgio2audio *chip = snd_pcm_substream_chip(substream); in snd_sgio2audio_playback2_open() local
570 runtime->private_data = &chip->channel[2]; in snd_sgio2audio_playback2_open()
577 struct snd_sgio2audio *chip = snd_pcm_substream_chip(substream); in snd_sgio2audio_capture_open() local
581 runtime->private_data = &chip->channel[0]; in snd_sgio2audio_capture_open()
612 struct snd_sgio2audio *chip = snd_pcm_substream_chip(substream); in snd_sgio2audio_pcm_prepare() local
618 spin_lock_irqsave(&chip->channel[ch].lock, flags); in snd_sgio2audio_pcm_prepare()
621 chip->channel[ch].pos = 0; in snd_sgio2audio_pcm_prepare()
622 chip->channel[ch].size = 0; in snd_sgio2audio_pcm_prepare()
623 chip->channel[ch].substream = substream; in snd_sgio2audio_pcm_prepare()
629 ad1843_setup_dac(&chip->ad1843, in snd_sgio2audio_pcm_prepare()
636 ad1843_setup_adc(&chip->ad1843, in snd_sgio2audio_pcm_prepare()
642 spin_unlock_irqrestore(&chip->channel[ch].lock, flags); in snd_sgio2audio_pcm_prepare()
669 struct snd_sgio2audio *chip = snd_pcm_substream_chip(substream); in snd_sgio2audio_pcm_pointer() local
674 chip->channel[chan->idx].pos); in snd_sgio2audio_pcm_pointer()
722 static int snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip) in snd_sgio2audio_new_pcm() argument
728 err = snd_pcm_new(chip->card, "SGI O2 Audio", 0, 1, 1, &pcm); in snd_sgio2audio_new_pcm()
732 pcm->private_data = chip; in snd_sgio2audio_new_pcm()
742 err = snd_pcm_new(chip->card, "SGI O2 Audio", 1, 1, 0, &pcm); in snd_sgio2audio_new_pcm()
746 pcm->private_data = chip; in snd_sgio2audio_new_pcm()
797 static int snd_sgio2audio_free(struct snd_sgio2audio *chip) in snd_sgio2audio_free() argument
809 &chip->channel[snd_sgio2_isr_table[i].idx]); in snd_sgio2audio_free()
812 chip->ring_base, chip->ring_base_dma); in snd_sgio2audio_free()
815 kfree(chip); in snd_sgio2audio_free()
821 struct snd_sgio2audio *chip = device->device_data; in snd_sgio2audio_dev_free() local
823 return snd_sgio2audio_free(chip); in snd_sgio2audio_dev_free()
833 struct snd_sgio2audio *chip; in snd_sgio2audio_create() local
843 chip = kzalloc(sizeof(struct snd_sgio2audio), GFP_KERNEL); in snd_sgio2audio_create()
844 if (chip == NULL) in snd_sgio2audio_create()
847 chip->card = card; in snd_sgio2audio_create()
849 chip->ring_base = dma_alloc_coherent(NULL, MACEISA_RINGBUFFERS_SIZE, in snd_sgio2audio_create()
850 &chip->ring_base_dma, GFP_USER); in snd_sgio2audio_create()
851 if (chip->ring_base == NULL) { in snd_sgio2audio_create()
854 kfree(chip); in snd_sgio2audio_create()
858 spin_lock_init(&chip->ad1843_lock); in snd_sgio2audio_create()
862 spin_lock_init(&chip->channel[i].lock); in snd_sgio2audio_create()
863 chip->channel[i].idx = i; in snd_sgio2audio_create()
872 &chip->channel[snd_sgio2_isr_table[i].idx])) { in snd_sgio2audio_create()
873 snd_sgio2audio_free(chip); in snd_sgio2audio_create()
887 writeq(chip->ring_base_dma, &mace->perif.ctrl.ringbase); in snd_sgio2audio_create()
890 chip->ad1843.read = read_ad1843_reg; in snd_sgio2audio_create()
891 chip->ad1843.write = write_ad1843_reg; in snd_sgio2audio_create()
892 chip->ad1843.chip = chip; in snd_sgio2audio_create()
895 err = ad1843_init(&chip->ad1843); in snd_sgio2audio_create()
897 snd_sgio2audio_free(chip); in snd_sgio2audio_create()
901 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); in snd_sgio2audio_create()
903 snd_sgio2audio_free(chip); in snd_sgio2audio_create()
906 *rchip = chip; in snd_sgio2audio_create()
913 struct snd_sgio2audio *chip; in snd_sgio2audio_probe() local
920 err = snd_sgio2audio_create(card, &chip); in snd_sgio2audio_probe()
926 err = snd_sgio2audio_new_pcm(chip); in snd_sgio2audio_probe()
931 err = snd_sgio2audio_new_mixer(chip); in snd_sgio2audio_probe()