Searched refs:hal2 (Results 1 - 2 of 2) sorted by relevance

/linux-4.1.27/sound/mips/
H A DMakefile7 snd-sgi-hal2-objs := hal2.o
12 obj-$(CONFIG_SND_SGI_HAL2) += snd-sgi-hal2.o
H A Dhal2.c40 #include "hal2.h"
116 static u32 hal2_i_read32(struct snd_hal2 *hal2, u16 addr) hal2_i_read32() argument
119 struct hal2_ctl_regs *regs = hal2->ctl_regs; hal2_i_read32()
130 static void hal2_i_write16(struct snd_hal2 *hal2, u16 addr, u16 val) hal2_i_write16() argument
132 struct hal2_ctl_regs *regs = hal2->ctl_regs; hal2_i_write16()
142 static void hal2_i_write32(struct snd_hal2 *hal2, u16 addr, u32 val) hal2_i_write32() argument
144 struct hal2_ctl_regs *regs = hal2->ctl_regs; hal2_i_write32()
154 static void hal2_i_setbit16(struct snd_hal2 *hal2, u16 addr, u16 bit) hal2_i_setbit16() argument
156 struct hal2_ctl_regs *regs = hal2->ctl_regs; hal2_i_setbit16()
168 static void hal2_i_clearbit16(struct snd_hal2 *hal2, u16 addr, u16 bit) hal2_i_clearbit16() argument
170 struct hal2_ctl_regs *regs = hal2->ctl_regs; hal2_i_clearbit16()
202 struct snd_hal2 *hal2 = snd_kcontrol_chip(kcontrol); hal2_gain_get() local
208 tmp = hal2_i_read32(hal2, H2I_DAC_C2); hal2_gain_get()
218 tmp = hal2_i_read32(hal2, H2I_ADC_C2); hal2_gain_get()
232 struct snd_hal2 *hal2 = snd_kcontrol_chip(kcontrol); hal2_gain_put() local
241 old = hal2_i_read32(hal2, H2I_DAC_C2); hal2_gain_put()
250 hal2_i_write32(hal2, H2I_DAC_C2, new); hal2_gain_put()
253 old = hal2_i_read32(hal2, H2I_ADC_C2); hal2_gain_put()
257 hal2_i_write32(hal2, H2I_ADC_C2, new); hal2_gain_put()
283 static int hal2_mixer_create(struct snd_hal2 *hal2) hal2_mixer_create() argument
288 hal2_i_write32(hal2, H2I_DAC_C2, hal2_mixer_create()
291 hal2_i_write32(hal2, H2I_ADC_C2, 0); hal2_mixer_create()
293 err = snd_ctl_add(hal2->card, hal2_mixer_create()
294 snd_ctl_new1(&hal2_ctrl_headphone, hal2)); hal2_mixer_create()
298 err = snd_ctl_add(hal2->card, hal2_mixer_create()
299 snd_ctl_new1(&hal2_ctrl_mic, hal2)); hal2_mixer_create()
308 struct snd_hal2 *hal2 = dev_id; hal2_interrupt() local
312 if (hal2->dac.pbus.pbus->pbdma_ctrl & HPC3_PDMACTRL_INT) { hal2_interrupt()
313 snd_pcm_period_elapsed(hal2->dac.substream); hal2_interrupt()
316 if (hal2->adc.pbus.pbus->pbdma_ctrl & HPC3_PDMACTRL_INT) { hal2_interrupt()
317 snd_pcm_period_elapsed(hal2->adc.substream); hal2_interrupt()
342 static void hal2_set_dac_rate(struct snd_hal2 *hal2) hal2_set_dac_rate() argument
344 unsigned int master = hal2->dac.master; hal2_set_dac_rate()
345 int inc = hal2->dac.inc; hal2_set_dac_rate()
346 int mod = hal2->dac.mod; hal2_set_dac_rate()
348 hal2_i_write16(hal2, H2I_BRES1_C1, (master == 44100) ? 1 : 0); hal2_set_dac_rate()
349 hal2_i_write32(hal2, H2I_BRES1_C2, hal2_set_dac_rate()
353 static void hal2_set_adc_rate(struct snd_hal2 *hal2) hal2_set_adc_rate() argument
355 unsigned int master = hal2->adc.master; hal2_set_adc_rate()
356 int inc = hal2->adc.inc; hal2_set_adc_rate()
357 int mod = hal2->adc.mod; hal2_set_adc_rate()
359 hal2_i_write16(hal2, H2I_BRES2_C1, (master == 44100) ? 1 : 0); hal2_set_adc_rate()
360 hal2_i_write32(hal2, H2I_BRES2_C2, hal2_set_adc_rate()
364 static void hal2_setup_dac(struct snd_hal2 *hal2) hal2_setup_dac() argument
367 struct hal2_pbus *pbus = &hal2->dac.pbus; hal2_setup_dac()
374 sample_size = 2 * hal2->dac.voices; hal2_setup_dac()
384 hal2_i_clearbit16(hal2, H2I_DMA_PORT_EN, H2I_DMA_PORT_EN_CODECTX); hal2_setup_dac()
386 hal2_set_dac_rate(hal2); hal2_setup_dac()
388 hal2_i_clearbit16(hal2, H2I_DMA_END, H2I_DMA_END_CODECTX); hal2_setup_dac()
390 hal2_i_setbit16(hal2, H2I_DMA_DRV, (1 << pbus->pbusnr)); hal2_setup_dac()
392 hal2_i_write16(hal2, H2I_DAC_C1, (pbus->pbusnr << H2I_C1_DMA_SHIFT) hal2_setup_dac()
394 | (hal2->dac.voices << H2I_C1_DATAT_SHIFT)); hal2_setup_dac()
397 static void hal2_setup_adc(struct snd_hal2 *hal2) hal2_setup_adc() argument
400 struct hal2_pbus *pbus = &hal2->adc.pbus; hal2_setup_adc()
402 sample_size = 2 * hal2->adc.voices; hal2_setup_adc()
409 hal2_i_clearbit16(hal2, H2I_DMA_PORT_EN, H2I_DMA_PORT_EN_CODECR); hal2_setup_adc()
411 hal2_set_adc_rate(hal2); hal2_setup_adc()
413 hal2_i_clearbit16(hal2, H2I_DMA_END, H2I_DMA_END_CODECR); hal2_setup_adc()
415 hal2_i_setbit16(hal2, H2I_DMA_DRV, (1 << pbus->pbusnr)); hal2_setup_adc()
417 hal2_i_write16(hal2, H2I_ADC_C1, (pbus->pbusnr << H2I_C1_DMA_SHIFT) hal2_setup_adc()
419 | (hal2->adc.voices << H2I_C1_DATAT_SHIFT)); hal2_setup_adc()
422 static void hal2_start_dac(struct snd_hal2 *hal2) hal2_start_dac() argument
424 struct hal2_pbus *pbus = &hal2->dac.pbus; hal2_start_dac()
426 pbus->pbus->pbdma_dptr = hal2->dac.desc_dma; hal2_start_dac()
429 hal2_i_setbit16(hal2, H2I_DMA_PORT_EN, H2I_DMA_PORT_EN_CODECTX); hal2_start_dac()
432 static void hal2_start_adc(struct snd_hal2 *hal2) hal2_start_adc() argument
434 struct hal2_pbus *pbus = &hal2->adc.pbus; hal2_start_adc()
436 pbus->pbus->pbdma_dptr = hal2->adc.desc_dma; hal2_start_adc()
439 hal2_i_setbit16(hal2, H2I_DMA_PORT_EN, H2I_DMA_PORT_EN_CODECR); hal2_start_adc()
442 static inline void hal2_stop_dac(struct snd_hal2 *hal2) hal2_stop_dac() argument
444 hal2->dac.pbus.pbus->pbdma_ctrl = HPC3_PDMACTRL_LD; hal2_stop_dac()
448 static inline void hal2_stop_adc(struct snd_hal2 *hal2) hal2_stop_adc() argument
450 hal2->adc.pbus.pbus->pbdma_ctrl = HPC3_PDMACTRL_LD; hal2_stop_adc()
533 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_playback_open() local
538 err = hal2_alloc_dmabuf(&hal2->dac); hal2_playback_open()
546 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_playback_close() local
548 hal2_free_dmabuf(&hal2->dac); hal2_playback_close()
554 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_playback_prepare() local
556 struct hal2_codec *dac = &hal2->dac; hal2_playback_prepare()
564 hal2_setup_dac(hal2); hal2_playback_prepare()
570 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_playback_trigger() local
574 hal2->dac.pcm_indirect.hw_io = hal2->dac.buffer_dma; hal2_playback_trigger()
575 hal2->dac.pcm_indirect.hw_data = 0; hal2_playback_trigger()
577 hal2_start_dac(hal2); hal2_playback_trigger()
580 hal2_stop_dac(hal2); hal2_playback_trigger()
591 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_playback_pointer() local
592 struct hal2_codec *dac = &hal2->dac; hal2_playback_pointer()
601 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_playback_transfer() local
602 unsigned char *buf = hal2->dac.buffer + rec->hw_data; hal2_playback_transfer()
611 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_playback_ack() local
612 struct hal2_codec *dac = &hal2->dac; hal2_playback_ack()
624 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_capture_open() local
625 struct hal2_codec *adc = &hal2->adc; hal2_capture_open()
638 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_capture_close() local
640 hal2_free_dmabuf(&hal2->adc); hal2_capture_close()
646 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_capture_prepare() local
648 struct hal2_codec *adc = &hal2->adc; hal2_capture_prepare()
657 hal2_setup_adc(hal2); hal2_capture_prepare()
663 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_capture_trigger() local
667 hal2->adc.pcm_indirect.hw_io = hal2->adc.buffer_dma; hal2_capture_trigger()
668 hal2->adc.pcm_indirect.hw_data = 0; hal2_capture_trigger()
669 printk(KERN_DEBUG "buffer_dma %x\n", hal2->adc.buffer_dma); hal2_capture_trigger()
670 hal2_start_adc(hal2); hal2_capture_trigger()
673 hal2_stop_adc(hal2); hal2_capture_trigger()
684 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_capture_pointer() local
685 struct hal2_codec *adc = &hal2->adc; hal2_capture_pointer()
694 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_capture_transfer() local
695 unsigned char *buf = hal2->adc.buffer + rec->hw_data; hal2_capture_transfer()
703 struct snd_hal2 *hal2 = snd_pcm_substream_chip(substream); hal2_capture_ack() local
704 struct hal2_codec *adc = &hal2->adc; hal2_capture_ack()
736 static int hal2_pcm_create(struct snd_hal2 *hal2) hal2_pcm_create() argument
742 err = snd_pcm_new(hal2->card, "SGI HAL2 Audio", 0, 1, 1, &pcm); hal2_pcm_create()
746 pcm->private_data = hal2; hal2_pcm_create()
763 struct snd_hal2 *hal2 = device->device_data; hal2_dev_free() local
765 free_irq(SGI_HPCDMA_IRQ, hal2); hal2_dev_free()
766 kfree(hal2); hal2_dev_free()
781 static int hal2_detect(struct snd_hal2 *hal2) hal2_detect() argument
787 hal2_write(0, &hal2->ctl_regs->isr); hal2_detect()
791 &hal2->ctl_regs->isr); hal2_detect()
794 hal2_i_write16(hal2, H2I_RELAY_C, H2I_RELAY_C_STATE); hal2_detect()
795 rev = hal2_read(&hal2->ctl_regs->rev); hal2_detect()
811 struct snd_hal2 *hal2; hal2_create() local
815 hal2 = kzalloc(sizeof(struct snd_hal2), GFP_KERNEL); hal2_create()
816 if (!hal2) hal2_create()
819 hal2->card = card; hal2_create()
822 "SGI HAL2", hal2)) { hal2_create()
824 kfree(hal2); hal2_create()
828 hal2->ctl_regs = (struct hal2_ctl_regs *)hpc3->pbus_extregs[0]; hal2_create()
829 hal2->aes_regs = (struct hal2_aes_regs *)hpc3->pbus_extregs[1]; hal2_create()
830 hal2->vol_regs = (struct hal2_vol_regs *)hpc3->pbus_extregs[2]; hal2_create()
831 hal2->syn_regs = (struct hal2_syn_regs *)hpc3->pbus_extregs[3]; hal2_create()
833 if (hal2_detect(hal2) < 0) { hal2_create()
834 kfree(hal2); hal2_create()
838 hal2_init_codec(&hal2->dac, hpc3, 0); hal2_create()
839 hal2_init_codec(&hal2->adc, hpc3, 1); hal2_create()
864 hpc3->pbus_dmacfg[hal2->dac.pbus.pbusnr][0] = 0x8208844; hal2_create()
865 hpc3->pbus_dmacfg[hal2->adc.pbus.pbusnr][0] = 0x8208844; hal2_create()
867 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, hal2, &hal2_ops); hal2_create()
869 free_irq(SGI_HPCDMA_IRQ, hal2); hal2_create()
870 kfree(hal2); hal2_create()
873 *rchip = hal2; hal2_create()

Completed in 164 milliseconds