Lines Matching refs:sis
298 struct sis7019 *sis = dev; in sis_interrupt() local
299 unsigned long io = sis->ioport; in sis_interrupt()
318 sis_voice_irq(status, sis->voices); in sis_interrupt()
324 sis_voice_irq(status, &sis->voices[32]); in sis_interrupt()
330 voice = &sis->capture_voice; in sis_interrupt()
369 static void __sis_map_silence(struct sis7019 *sis) in __sis_map_silence() argument
372 if (!sis->silence_users) in __sis_map_silence()
373 sis->silence_dma_addr = dma_map_single(&sis->pci->dev, in __sis_map_silence()
374 sis->suspend_state[0], in __sis_map_silence()
376 sis->silence_users++; in __sis_map_silence()
379 static void __sis_unmap_silence(struct sis7019 *sis) in __sis_unmap_silence() argument
382 sis->silence_users--; in __sis_unmap_silence()
383 if (!sis->silence_users) in __sis_unmap_silence()
384 dma_unmap_single(&sis->pci->dev, sis->silence_dma_addr, 4096, in __sis_unmap_silence()
388 static void sis_free_voice(struct sis7019 *sis, struct voice *voice) in sis_free_voice() argument
392 spin_lock_irqsave(&sis->voice_lock, flags); in sis_free_voice()
394 __sis_unmap_silence(sis); in sis_free_voice()
400 spin_unlock_irqrestore(&sis->voice_lock, flags); in sis_free_voice()
403 static struct voice *__sis_alloc_playback_voice(struct sis7019 *sis) in __sis_alloc_playback_voice() argument
410 voice = &sis->voices[i]; in __sis_alloc_playback_voice()
422 static struct voice *sis_alloc_playback_voice(struct sis7019 *sis) in sis_alloc_playback_voice() argument
427 spin_lock_irqsave(&sis->voice_lock, flags); in sis_alloc_playback_voice()
428 voice = __sis_alloc_playback_voice(sis); in sis_alloc_playback_voice()
429 spin_unlock_irqrestore(&sis->voice_lock, flags); in sis_alloc_playback_voice()
437 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_alloc_timing_voice() local
454 spin_lock_irqsave(&sis->voice_lock, flags); in sis_alloc_timing_voice()
455 voice->timing = __sis_alloc_playback_voice(sis); in sis_alloc_timing_voice()
457 __sis_map_silence(sis); in sis_alloc_timing_voice()
458 spin_unlock_irqrestore(&sis->voice_lock, flags); in sis_alloc_timing_voice()
463 sis_free_voice(sis, voice); in sis_alloc_timing_voice()
472 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_playback_open() local
476 voice = sis_alloc_playback_voice(sis); in sis_playback_open()
493 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_substream_close() local
497 sis_free_voice(sis, voice); in sis_substream_close()
569 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_pcm_trigger() local
570 unsigned long io = sis->ioport; in sis_pcm_trigger()
600 if (chip != sis) in sis_pcm_trigger()
649 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_capture_open() local
651 struct voice *voice = &sis->capture_voice; in sis_capture_open()
657 spin_lock_irqsave(&sis->voice_lock, flags); in sis_capture_open()
662 spin_unlock_irqrestore(&sis->voice_lock, flags); in sis_capture_open()
670 runtime->hw.rates = sis->ac97[0]->rates[AC97_RATES_ADC]; in sis_capture_open()
683 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_capture_hw_params() local
686 rc = snd_ac97_set_rate(sis->ac97[0], AC97_PCM_LR_ADC_RATE, in sis_capture_hw_params()
700 struct sis7019 *sis = snd_pcm_substream_chip(substream); in sis_prepare_timing_voice() local
785 writel(sis->silence_dma_addr, play_base + SIS_PLAY_DMA_BASE); in sis_prepare_timing_voice()
862 static int sis_pcm_create(struct sis7019 *sis) in sis_pcm_create() argument
870 rc = snd_pcm_new(sis->card, "SiS7019", 0, 64, 1, &pcm); in sis_pcm_create()
874 pcm->private_data = sis; in sis_pcm_create()
876 sis->pcm = pcm; in sis_pcm_create()
885 &sis->pci->dev, 64*1024, 128*1024); in sis_pcm_create()
890 static unsigned short sis_ac97_rw(struct sis7019 *sis, int codec, u32 cmd) in sis_ac97_rw() argument
892 unsigned long io = sis->ioport; in sis_ac97_rw()
909 mutex_lock(&sis->ac97_mutex); in sis_ac97_rw()
948 mutex_unlock(&sis->ac97_mutex); in sis_ac97_rw()
951 dev_err(&sis->pci->dev, "ac97 codec %d timeout cmd 0x%08x\n", in sis_ac97_rw()
981 static int sis_mixer_create(struct sis7019 *sis) in sis_mixer_create() argument
992 ac97.private_data = sis; in sis_mixer_create()
994 rc = snd_ac97_bus(sis->card, 0, &ops, NULL, &bus); in sis_mixer_create()
995 if (!rc && sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) in sis_mixer_create()
996 rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[0]); in sis_mixer_create()
998 if (!rc && (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT)) in sis_mixer_create()
999 rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[1]); in sis_mixer_create()
1001 if (!rc && (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT)) in sis_mixer_create()
1002 rc = snd_ac97_mixer(bus, &ac97, &sis->ac97[2]); in sis_mixer_create()
1012 struct sis7019 *sis = card->private_data; in sis_chip_free() local
1016 outl(SIS_GCR_SOFTWARE_RESET, sis->ioport + SIS_GCR); in sis_chip_free()
1018 outl(0, sis->ioport + SIS_GCR); in sis_chip_free()
1019 outl(0, sis->ioport + SIS_GIER); in sis_chip_free()
1023 if (sis->irq >= 0) in sis_chip_free()
1024 free_irq(sis->irq, sis); in sis_chip_free()
1027 static int sis_chip_init(struct sis7019 *sis) in sis_chip_init() argument
1029 unsigned long io = sis->ioport; in sis_chip_init()
1030 void __iomem *ioaddr = sis->ioaddr; in sis_chip_init()
1069 sis->codecs_present = 0; in sis_chip_init()
1074 sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; in sis_chip_init()
1076 sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; in sis_chip_init()
1078 sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; in sis_chip_init()
1080 if (sis->codecs_present == codecs) in sis_chip_init()
1088 if (!sis->codecs_present) { in sis_chip_init()
1089 dev_err(&sis->pci->dev, "could not find any codecs\n"); in sis_chip_init()
1093 if (sis->codecs_present != codecs) { in sis_chip_init()
1094 dev_warn(&sis->pci->dev, "missing codecs, found %0x, expected %0x\n", in sis_chip_init()
1095 sis->codecs_present, codecs); in sis_chip_init()
1159 struct sis7019 *sis = card->private_data; in sis_suspend() local
1160 void __iomem *ioaddr = sis->ioaddr; in sis_suspend()
1164 if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) in sis_suspend()
1165 snd_ac97_suspend(sis->ac97[0]); in sis_suspend()
1166 if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT) in sis_suspend()
1167 snd_ac97_suspend(sis->ac97[1]); in sis_suspend()
1168 if (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT) in sis_suspend()
1169 snd_ac97_suspend(sis->ac97[2]); in sis_suspend()
1173 if (sis->irq >= 0) { in sis_suspend()
1174 free_irq(sis->irq, sis); in sis_suspend()
1175 sis->irq = -1; in sis_suspend()
1181 memcpy_fromio(sis->suspend_state[i], ioaddr, 4096); in sis_suspend()
1192 struct sis7019 *sis = card->private_data; in sis_resume() local
1193 void __iomem *ioaddr = sis->ioaddr; in sis_resume()
1196 if (sis_chip_init(sis)) { in sis_resume()
1202 KBUILD_MODNAME, sis)) { in sis_resume()
1211 memcpy_toio(ioaddr, sis->suspend_state[i], 4096); in sis_resume()
1215 memset(sis->suspend_state[0], 0, 4096); in sis_resume()
1217 sis->irq = pci->irq; in sis_resume()
1219 if (sis->codecs_present & SIS_PRIMARY_CODEC_PRESENT) in sis_resume()
1220 snd_ac97_resume(sis->ac97[0]); in sis_resume()
1221 if (sis->codecs_present & SIS_SECONDARY_CODEC_PRESENT) in sis_resume()
1222 snd_ac97_resume(sis->ac97[1]); in sis_resume()
1223 if (sis->codecs_present & SIS_TERTIARY_CODEC_PRESENT) in sis_resume()
1224 snd_ac97_resume(sis->ac97[2]); in sis_resume()
1240 static int sis_alloc_suspend(struct sis7019 *sis) in sis_alloc_suspend() argument
1250 sis->suspend_state[i] = devm_kmalloc(&sis->pci->dev, 4096, in sis_alloc_suspend()
1252 if (!sis->suspend_state[i]) in sis_alloc_suspend()
1255 memset(sis->suspend_state[0], 0, 4096); in sis_alloc_suspend()
1263 struct sis7019 *sis = card->private_data; in sis_chip_create() local
1278 mutex_init(&sis->ac97_mutex); in sis_chip_create()
1279 spin_lock_init(&sis->voice_lock); in sis_chip_create()
1280 sis->card = card; in sis_chip_create()
1281 sis->pci = pci; in sis_chip_create()
1282 sis->irq = -1; in sis_chip_create()
1283 sis->ioport = pci_resource_start(pci, 0); in sis_chip_create()
1291 sis->ioaddr = devm_ioremap(&pci->dev, pci_resource_start(pci, 1), 0x4000); in sis_chip_create()
1292 if (!sis->ioaddr) { in sis_chip_create()
1297 rc = sis_alloc_suspend(sis); in sis_chip_create()
1303 rc = sis_chip_init(sis); in sis_chip_create()
1309 sis); in sis_chip_create()
1311 dev_err(&pci->dev, "unable to allocate irq %d\n", sis->irq); in sis_chip_create()
1315 sis->irq = pci->irq; in sis_chip_create()
1316 card->sync_irq = sis->irq; in sis_chip_create()
1320 voice = &sis->voices[i]; in sis_chip_create()
1322 voice->ctrl_base = SIS_PLAY_DMA_ADDR(sis->ioaddr, i); in sis_chip_create()
1323 voice->wave_base = SIS_WAVE_ADDR(sis->ioaddr, i); in sis_chip_create()
1326 voice = &sis->capture_voice; in sis_chip_create()
1329 voice->ctrl_base = SIS_CAPTURE_DMA_ADDR(sis->ioaddr, voice->num); in sis_chip_create()
1338 struct sis7019 *sis; in __snd_sis7019_probe() local
1356 sizeof(*sis), &card); in __snd_sis7019_probe()
1366 sis = card->private_data; in __snd_sis7019_probe()
1368 rc = sis_mixer_create(sis); in __snd_sis7019_probe()
1372 rc = sis_pcm_create(sis); in __snd_sis7019_probe()
1378 card->shortname, snd_ac97_get_short_name(sis->ac97[0]), in __snd_sis7019_probe()
1379 sis->ioport, sis->irq); in __snd_sis7019_probe()