Lines Matching refs:sis
311 struct sis7019 *sis = dev; in sis_interrupt() local
312 unsigned long io = sis->ioport; in sis_interrupt()
331 sis_voice_irq(status, sis->voices); in sis_interrupt()
337 sis_voice_irq(status, &sis->voices[32]); in sis_interrupt()
343 voice = &sis->capture_voice; in sis_interrupt()
382 static void __sis_map_silence(struct sis7019 *sis) in __sis_map_silence() argument
385 if (!sis->silence_users) in __sis_map_silence()
386 sis->silence_dma_addr = dma_map_single(&sis->pci->dev, in __sis_map_silence()
387 sis->suspend_state[0], in __sis_map_silence()
389 sis->silence_users++; in __sis_map_silence()
392 static void __sis_unmap_silence(struct sis7019 *sis) in __sis_unmap_silence() argument
395 sis->silence_users--; in __sis_unmap_silence()
396 if (!sis->silence_users) in __sis_unmap_silence()
397 dma_unmap_single(&sis->pci->dev, sis->silence_dma_addr, 4096, in __sis_unmap_silence()
401 static void sis_free_voice(struct sis7019 *sis, struct voice *voice) in sis_free_voice() argument
405 spin_lock_irqsave(&sis->voice_lock, flags); in sis_free_voice()
407 __sis_unmap_silence(sis); in sis_free_voice()
413 spin_unlock_irqrestore(&sis->voice_lock, flags); in sis_free_voice()
416 static struct voice *__sis_alloc_playback_voice(struct sis7019 *sis) in __sis_alloc_playback_voice() argument
423 voice = &sis->voices[i]; in __sis_alloc_playback_voice()
435 static struct voice *sis_alloc_playback_voice(struct sis7019 *sis) in sis_alloc_playback_voice() argument
440 spin_lock_irqsave(&sis->voice_lock, flags); in sis_alloc_playback_voice()
441 voice = __sis_alloc_playback_voice(sis); in sis_alloc_playback_voice()
442 spin_unlock_irqrestore(&sis->voice_lock, flags); in sis_alloc_playback_voice()
450 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_alloc_timing_voice() local
467 spin_lock_irqsave(&sis->voice_lock, flags); in sis_alloc_timing_voice()
468 voice->timing = __sis_alloc_playback_voice(sis); in sis_alloc_timing_voice()
470 __sis_map_silence(sis); in sis_alloc_timing_voice()
471 spin_unlock_irqrestore(&sis->voice_lock, flags); in sis_alloc_timing_voice()
476 sis_free_voice(sis, voice); in sis_alloc_timing_voice()
485 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_playback_open() local
489 voice = sis_alloc_playback_voice(sis); in sis_playback_open()
506 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_substream_close() local
510 sis_free_voice(sis, voice); in sis_substream_close()
594 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_pcm_trigger() local
595 unsigned long io = sis->ioport; in sis_pcm_trigger()
625 if (chip != sis) in sis_pcm_trigger()
674 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_capture_open() local
676 struct voice *voice = &sis->capture_voice; in sis_capture_open()
682 spin_lock_irqsave(&sis->voice_lock, flags); in sis_capture_open()
687 spin_unlock_irqrestore(&sis->voice_lock, flags); in sis_capture_open()
695 runtime->hw.rates = sis->ac97[0]->rates[AC97_RATES_ADC]; in sis_capture_open()
708 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_capture_hw_params() local
711 rc = snd_ac97_set_rate(sis->ac97[0], AC97_PCM_LR_ADC_RATE, in sis_capture_hw_params()
730 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_prepare_timing_voice() local
815 writel(sis->silence_dma_addr, play_base + SIS_PLAY_DMA_BASE); in sis_prepare_timing_voice()
897 static int sis_pcm_create(struct sis7019 *sis) in sis_pcm_create() argument
905 rc = snd_pcm_new(sis->card, "SiS7019", 0, 64, 1, &pcm); in sis_pcm_create()
909 pcm->private_data = sis; in sis_pcm_create()
911 sis->pcm = pcm; in sis_pcm_create()
920 snd_dma_pci_data(sis->pci), 64*1024, 128*1024); in sis_pcm_create()
925 static unsigned short sis_ac97_rw(struct sis7019 *sis, int codec, u32 cmd) in sis_ac97_rw() argument
927 unsigned long io = sis->ioport; in sis_ac97_rw()
944 mutex_lock(&sis->ac97_mutex); in sis_ac97_rw()
983 mutex_unlock(&sis->ac97_mutex); in sis_ac97_rw()
986 dev_err(&sis->pci->dev, "ac97 codec %d timeout cmd 0x%08x\n", in sis_ac97_rw()
1016 static int sis_mixer_create(struct sis7019 *sis) in sis_mixer_create() argument
1027 ac97.private_data = sis; in sis_mixer_create()
1029 rc = snd_ac97_bus(sis->card, 0, &ops, NULL, &bus); in sis_mixer_create()
1030 if (!rc && sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) in sis_mixer_create()
1031 rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[0]); in sis_mixer_create()
1033 if (!rc && (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT)) in sis_mixer_create()
1034 rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[1]); in sis_mixer_create()
1036 if (!rc && (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT)) in sis_mixer_create()
1037 rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[2]); in sis_mixer_create()
1045 static void sis_free_suspend(struct sis7019 *sis) in sis_free_suspend() argument
1050 kfree(sis->suspend_state[i]); in sis_free_suspend()
1053 static int sis_chip_free(struct sis7019 *sis) in sis_chip_free() argument
1057 outl(SIS_GCR_SOFTWARE_RESET, sis->ioport + SIS_GCR); in sis_chip_free()
1059 outl(0, sis->ioport + SIS_GCR); in sis_chip_free()
1060 outl(0, sis->ioport + SIS_GIER); in sis_chip_free()
1064 if (sis->irq >= 0) in sis_chip_free()
1065 free_irq(sis->irq, sis); in sis_chip_free()
1067 iounmap(sis->ioaddr); in sis_chip_free()
1068 pci_release_regions(sis->pci); in sis_chip_free()
1069 pci_disable_device(sis->pci); in sis_chip_free()
1070 sis_free_suspend(sis); in sis_chip_free()
1076 struct sis7019 *sis = dev->device_data; in sis_dev_free() local
1077 return sis_chip_free(sis); in sis_dev_free()
1080 static int sis_chip_init(struct sis7019 *sis) in sis_chip_init() argument
1082 unsigned long io = sis->ioport; in sis_chip_init()
1083 void __iomem *ioaddr = sis->ioaddr; in sis_chip_init()
1122 sis->codecs_present = 0; in sis_chip_init()
1127 sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; in sis_chip_init()
1129 sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; in sis_chip_init()
1131 sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; in sis_chip_init()
1133 if (sis->codecs_present == codecs) in sis_chip_init()
1141 if (!sis->codecs_present) { in sis_chip_init()
1142 dev_err(&sis->pci->dev, "could not find any codecs\n"); in sis_chip_init()
1146 if (sis->codecs_present != codecs) { in sis_chip_init()
1147 dev_warn(&sis->pci->dev, "missing codecs, found %0x, expected %0x\n", in sis_chip_init()
1148 sis->codecs_present, codecs); in sis_chip_init()
1212 struct sis7019 *sis = card->private_data; in sis_suspend() local
1213 void __iomem *ioaddr = sis->ioaddr; in sis_suspend()
1217 snd_pcm_suspend_all(sis->pcm); in sis_suspend()
1218 if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) in sis_suspend()
1219 snd_ac97_suspend(sis->ac97[0]); in sis_suspend()
1220 if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT) in sis_suspend()
1221 snd_ac97_suspend(sis->ac97[1]); in sis_suspend()
1222 if (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT) in sis_suspend()
1223 snd_ac97_suspend(sis->ac97[2]); in sis_suspend()
1227 if (sis->irq >= 0) { in sis_suspend()
1228 free_irq(sis->irq, sis); in sis_suspend()
1229 sis->irq = -1; in sis_suspend()
1235 memcpy_fromio(sis->suspend_state[i], ioaddr, 4096); in sis_suspend()
1246 struct sis7019 *sis = card->private_data; in sis_resume() local
1247 void __iomem *ioaddr = sis->ioaddr; in sis_resume()
1250 if (sis_chip_init(sis)) { in sis_resume()
1256 KBUILD_MODNAME, sis)) { in sis_resume()
1265 memcpy_toio(ioaddr, sis->suspend_state[i], 4096); in sis_resume()
1269 memset(sis->suspend_state[0], 0, 4096); in sis_resume()
1271 sis->irq = pci->irq; in sis_resume()
1273 if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) in sis_resume()
1274 snd_ac97_resume(sis->ac97[0]); in sis_resume()
1275 if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT) in sis_resume()
1276 snd_ac97_resume(sis->ac97[1]); in sis_resume()
1277 if (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT) in sis_resume()
1278 snd_ac97_resume(sis->ac97[2]); in sis_resume()
1294 static int sis_alloc_suspend(struct sis7019 *sis) in sis_alloc_suspend() argument
1304 sis->suspend_state[i] = kmalloc(4096, GFP_KERNEL); in sis_alloc_suspend()
1305 if (!sis->suspend_state[i]) in sis_alloc_suspend()
1308 memset(sis->suspend_state[0], 0, 4096); in sis_alloc_suspend()
1316 struct sis7019 *sis = card->private_data; in sis_chip_create() local
1334 memset(sis, 0, sizeof(*sis)); in sis_chip_create()
1335 mutex_init(&sis->ac97_mutex); in sis_chip_create()
1336 spin_lock_init(&sis->voice_lock); in sis_chip_create()
1337 sis->card = card; in sis_chip_create()
1338 sis->pci = pci; in sis_chip_create()
1339 sis->irq = -1; in sis_chip_create()
1340 sis->ioport = pci_resource_start(pci, 0); in sis_chip_create()
1349 sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000); in sis_chip_create()
1350 if (!sis->ioaddr) { in sis_chip_create()
1355 rc = sis_alloc_suspend(sis); in sis_chip_create()
1361 rc = sis_chip_init(sis); in sis_chip_create()
1366 sis); in sis_chip_create()
1368 dev_err(&pci->dev, "unable to allocate irq %d\n", sis->irq); in sis_chip_create()
1372 sis->irq = pci->irq; in sis_chip_create()
1376 voice = &sis->voices[i]; in sis_chip_create()
1378 voice->ctrl_base = SIS_PLAY_DMA_ADDR(sis->ioaddr, i); in sis_chip_create()
1379 voice->wave_base = SIS_WAVE_ADDR(sis->ioaddr, i); in sis_chip_create()
1382 voice = &sis->capture_voice; in sis_chip_create()
1385 voice->ctrl_base = SIS_CAPTURE_DMA_ADDR(sis->ioaddr, voice->num); in sis_chip_create()
1387 rc = snd_device_new(card, SNDRV_DEV_LOWLEVEL, sis, &ops); in sis_chip_create()
1394 sis_chip_free(sis); in sis_chip_create()
1407 struct sis7019 *sis; in snd_sis7019_probe() local
1426 sizeof(*sis), &card); in snd_sis7019_probe()
1436 sis = card->private_data; in snd_sis7019_probe()
1438 rc = sis_mixer_create(sis); in snd_sis7019_probe()
1442 rc = sis_pcm_create(sis); in snd_sis7019_probe()
1448 card->shortname, snd_ac97_get_short_name(sis->ac97[0]), in snd_sis7019_probe()
1449 sis->ioport, sis->irq); in snd_sis7019_probe()