Lines Matching +full:- +full:chn +full:- +full:disabled
1 // SPDX-License-Identifier: GPL-2.0-or-later
4 * Lee Revell <rlrevell@joe-job.com>
5 * James Courtier-Dutton <James@superbug.co.uk>
23 if (snd_BUG_ON(reg & (emu->audigy ? (0xffff0000 & ~A_PTR_ADDRESS_MASK) in check_ptr_reg()
31 unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, unsigned int chn) in snd_emu10k1_ptr_read() argument
37 regptr = (reg << 16) | chn; in snd_emu10k1_ptr_read()
41 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_ptr_read()
42 outl(regptr, emu->port + PTR); in snd_emu10k1_ptr_read()
43 val = inl(emu->port + DATA); in snd_emu10k1_ptr_read()
44 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_ptr_read()
51 mask = (1 << size) - 1; in snd_emu10k1_ptr_read()
61 void snd_emu10k1_ptr_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned in… in snd_emu10k1_ptr_write() argument
67 regptr = (reg << 16) | chn; in snd_emu10k1_ptr_write()
76 mask = (1 << size) - 1; in snd_emu10k1_ptr_write()
82 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_ptr_write()
83 outl(regptr, emu->port + PTR); in snd_emu10k1_ptr_write()
84 data |= inl(emu->port + DATA) & ~mask; in snd_emu10k1_ptr_write()
86 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_ptr_write()
87 outl(regptr, emu->port + PTR); in snd_emu10k1_ptr_write()
89 outl(data, emu->port + DATA); in snd_emu10k1_ptr_write()
90 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_ptr_write()
95 void snd_emu10k1_ptr_write_multiple(struct snd_emu10k1 *emu, unsigned int chn, ...) in snd_emu10k1_ptr_write_multiple() argument
103 if (snd_BUG_ON(chn & ~PTR_CHANNELNUM_MASK)) in snd_emu10k1_ptr_write_multiple()
105 addr_mask = ~((emu->audigy ? A_PTR_ADDRESS_MASK : PTR_ADDRESS_MASK) >> 16); in snd_emu10k1_ptr_write_multiple()
107 va_start(va, chn); in snd_emu10k1_ptr_write_multiple()
108 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_ptr_write_multiple()
117 outl((reg << 16) | chn, emu->port + PTR); in snd_emu10k1_ptr_write_multiple()
118 outl(data, emu->port + DATA); in snd_emu10k1_ptr_write_multiple()
120 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_ptr_write_multiple()
128 unsigned int chn) in snd_emu10k1_ptr20_read() argument
133 regptr = (reg << 16) | chn; in snd_emu10k1_ptr20_read()
135 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_ptr20_read()
136 outl(regptr, emu->port + PTR2); in snd_emu10k1_ptr20_read()
137 val = inl(emu->port + DATA2); in snd_emu10k1_ptr20_read()
138 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_ptr20_read()
144 unsigned int chn, in snd_emu10k1_ptr20_write() argument
150 regptr = (reg << 16) | chn; in snd_emu10k1_ptr20_write()
152 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_ptr20_write()
153 outl(regptr, emu->port + PTR2); in snd_emu10k1_ptr20_write()
154 outl(data, emu->port + DATA2); in snd_emu10k1_ptr20_write()
155 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_ptr20_write()
166 /* This function is not re-entrant, so protect against it. */ in snd_emu10k1_spi_write()
167 spin_lock(&emu->spi_lock); in snd_emu10k1_spi_write()
168 if (emu->card_capabilities->ca0108_chip) in snd_emu10k1_spi_write()
207 spin_unlock(&emu->spi_lock); in snd_emu10k1_spi_write()
223 dev_err(emu->card->dev, "i2c_write: invalid values.\n"); in snd_emu10k1_i2c_write()
224 return -EINVAL; in snd_emu10k1_i2c_write()
227 /* This function is not re-entrant, so protect against it. */ in snd_emu10k1_i2c_write()
228 spin_lock(&emu->i2c_lock); in snd_emu10k1_i2c_write()
251 dev_warn(emu->card->dev, in snd_emu10k1_i2c_write()
263 dev_err(emu->card->dev, "Writing to ADC failed!\n"); in snd_emu10k1_i2c_write()
264 dev_err(emu->card->dev, "status=0x%x, reg=%d, value=%d\n", in snd_emu10k1_i2c_write()
267 err = -EINVAL; in snd_emu10k1_i2c_write()
270 spin_unlock(&emu->i2c_lock); in snd_emu10k1_i2c_write()
281 outw(reg, emu->port + A_GPIO); in snd_emu1010_fpga_write_locked()
283 outw(reg | 0x80, emu->port + A_GPIO); /* High bit clocks the value into the fpga. */ in snd_emu1010_fpga_write_locked()
285 outw(value, emu->port + A_GPIO); in snd_emu1010_fpga_write_locked()
287 outw(value | 0x80 , emu->port + A_GPIO); /* High bit clocks the value into the fpga. */ in snd_emu1010_fpga_write_locked()
295 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu1010_fpga_write()
297 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu1010_fpga_write()
306 u32 mask = emu->card_capabilities->ca0108_chip ? 0x1f : 0x7f; in snd_emu1010_fpga_read_locked()
310 outw(reg, emu->port + A_GPIO); in snd_emu1010_fpga_read_locked()
312 outw(reg | 0x80, emu->port + A_GPIO); /* High bit clocks the value into the fpga. */ in snd_emu1010_fpga_read_locked()
314 *value = ((inw(emu->port + A_GPIO) >> 8) & mask); in snd_emu1010_fpga_read_locked()
321 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu1010_fpga_read()
323 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu1010_fpga_read()
337 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu1010_fpga_link_dst_src_write()
342 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu1010_fpga_link_dst_src_write()
352 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu1010_fpga_link_dst_src_read()
357 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu1010_fpga_link_dst_src_read()
399 switch (emu->emu1010.wclock) { in snd_emu1010_update_clock()
410 emu, emu->emu1010.wclock & EMU_HANA_WCLOCK_SRC_MASK); in snd_emu1010_update_clock()
424 emu->emu1010.word_clock = clock; in snd_emu1010_update_clock()
438 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_intr_enable()
439 enable = inl(emu->port + INTE) | intrenb; in snd_emu10k1_intr_enable()
440 outl(enable, emu->port + INTE); in snd_emu10k1_intr_enable()
441 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_intr_enable()
449 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_intr_disable()
450 enable = inl(emu->port + INTE) & ~intrenb; in snd_emu10k1_intr_disable()
451 outl(enable, emu->port + INTE); in snd_emu10k1_intr_disable()
452 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_intr_disable()
460 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_intr_enable()
462 outl(CLIEH << 16, emu->port + PTR); in snd_emu10k1_voice_intr_enable()
463 val = inl(emu->port + DATA); in snd_emu10k1_voice_intr_enable()
464 val |= 1 << (voicenum - 32); in snd_emu10k1_voice_intr_enable()
466 outl(CLIEL << 16, emu->port + PTR); in snd_emu10k1_voice_intr_enable()
467 val = inl(emu->port + DATA); in snd_emu10k1_voice_intr_enable()
470 outl(val, emu->port + DATA); in snd_emu10k1_voice_intr_enable()
471 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_intr_enable()
479 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_intr_disable()
481 outl(CLIEH << 16, emu->port + PTR); in snd_emu10k1_voice_intr_disable()
482 val = inl(emu->port + DATA); in snd_emu10k1_voice_intr_disable()
483 val &= ~(1 << (voicenum - 32)); in snd_emu10k1_voice_intr_disable()
485 outl(CLIEL << 16, emu->port + PTR); in snd_emu10k1_voice_intr_disable()
486 val = inl(emu->port + DATA); in snd_emu10k1_voice_intr_disable()
489 outl(val, emu->port + DATA); in snd_emu10k1_voice_intr_disable()
490 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_intr_disable()
497 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_intr_ack()
499 outl(CLIPH << 16, emu->port + PTR); in snd_emu10k1_voice_intr_ack()
500 voicenum = 1 << (voicenum - 32); in snd_emu10k1_voice_intr_ack()
502 outl(CLIPL << 16, emu->port + PTR); in snd_emu10k1_voice_intr_ack()
505 outl(voicenum, emu->port + DATA); in snd_emu10k1_voice_intr_ack()
506 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_intr_ack()
514 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_half_loop_intr_enable()
516 outl(HLIEH << 16, emu->port + PTR); in snd_emu10k1_voice_half_loop_intr_enable()
517 val = inl(emu->port + DATA); in snd_emu10k1_voice_half_loop_intr_enable()
518 val |= 1 << (voicenum - 32); in snd_emu10k1_voice_half_loop_intr_enable()
520 outl(HLIEL << 16, emu->port + PTR); in snd_emu10k1_voice_half_loop_intr_enable()
521 val = inl(emu->port + DATA); in snd_emu10k1_voice_half_loop_intr_enable()
524 outl(val, emu->port + DATA); in snd_emu10k1_voice_half_loop_intr_enable()
525 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_half_loop_intr_enable()
533 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_half_loop_intr_disable()
535 outl(HLIEH << 16, emu->port + PTR); in snd_emu10k1_voice_half_loop_intr_disable()
536 val = inl(emu->port + DATA); in snd_emu10k1_voice_half_loop_intr_disable()
537 val &= ~(1 << (voicenum - 32)); in snd_emu10k1_voice_half_loop_intr_disable()
539 outl(HLIEL << 16, emu->port + PTR); in snd_emu10k1_voice_half_loop_intr_disable()
540 val = inl(emu->port + DATA); in snd_emu10k1_voice_half_loop_intr_disable()
543 outl(val, emu->port + DATA); in snd_emu10k1_voice_half_loop_intr_disable()
544 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_half_loop_intr_disable()
551 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_half_loop_intr_ack()
553 outl(HLIPH << 16, emu->port + PTR); in snd_emu10k1_voice_half_loop_intr_ack()
554 voicenum = 1 << (voicenum - 32); in snd_emu10k1_voice_half_loop_intr_ack()
556 outl(HLIPL << 16, emu->port + PTR); in snd_emu10k1_voice_half_loop_intr_ack()
559 outl(voicenum, emu->port + DATA); in snd_emu10k1_voice_half_loop_intr_ack()
560 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_half_loop_intr_ack()
569 spin_lock_irqsave(&emu->emu_lock, flags);
571 outl(SOLEH << 16, emu->port + PTR);
572 sol = inl(emu->port + DATA);
573 sol |= 1 << (voicenum - 32);
575 outl(SOLEL << 16, emu->port + PTR);
576 sol = inl(emu->port + DATA);
579 outl(sol, emu->port + DATA);
580 spin_unlock_irqrestore(&emu->emu_lock, flags);
588 spin_lock_irqsave(&emu->emu_lock, flags);
590 outl(SOLEH << 16, emu->port + PTR);
591 sol = inl(emu->port + DATA);
592 sol &= ~(1 << (voicenum - 32));
594 outl(SOLEL << 16, emu->port + PTR);
595 sol = inl(emu->port + DATA);
598 outl(sol, emu->port + DATA);
599 spin_unlock_irqrestore(&emu->emu_lock, flags);
607 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_set_loop_stop_multiple()
608 outl(SOLEL << 16, emu->port + PTR); in snd_emu10k1_voice_set_loop_stop_multiple()
609 outl(inl(emu->port + DATA) | (u32)voices, emu->port + DATA); in snd_emu10k1_voice_set_loop_stop_multiple()
610 outl(SOLEH << 16, emu->port + PTR); in snd_emu10k1_voice_set_loop_stop_multiple()
611 outl(inl(emu->port + DATA) | (u32)(voices >> 32), emu->port + DATA); in snd_emu10k1_voice_set_loop_stop_multiple()
612 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_set_loop_stop_multiple()
619 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_clear_loop_stop_multiple()
620 outl(SOLEL << 16, emu->port + PTR); in snd_emu10k1_voice_clear_loop_stop_multiple()
621 outl(inl(emu->port + DATA) & (u32)~voices, emu->port + DATA); in snd_emu10k1_voice_clear_loop_stop_multiple()
622 outl(SOLEH << 16, emu->port + PTR); in snd_emu10k1_voice_clear_loop_stop_multiple()
623 outl(inl(emu->port + DATA) & (u32)(~voices >> 32), emu->port + DATA); in snd_emu10k1_voice_clear_loop_stop_multiple()
624 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_clear_loop_stop_multiple()
631 int ret = -EIO; in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
633 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
635 outl(SOLEL << 16, emu->port + PTR); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
636 soll = inl(emu->port + DATA); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
637 outl(SOLEH << 16, emu->port + PTR); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
638 solh = inl(emu->port + DATA); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
644 const u32 quart = 1U << (REG_SIZE(WC_CURRENTCHANNEL) - 2); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
646 u32 wc = inl(emu->port + WC); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
650 outl(SOLEL << 16, emu->port + PTR); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
651 outl(soll, emu->port + DATA); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
654 cc = REG_VAL_GET(WC_CURRENTCHANNEL, inl(emu->port + WC)); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
657 // We will block for 10+ us with interrupts disabled. This is in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
664 outl(SOLEH << 16, emu->port + PTR); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
665 outl(solh, emu->port + DATA); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
667 if (REG_VAL_GET(WC_SAMPLECOUNTER, inl(emu->port + WC)) == in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
671 ret = -EAGAIN; in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
676 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
678 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
681 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_voice_clear_loop_stop_multiple_atomic()
690 curtime = inl(emu->port + WC) >> 6; in snd_emu10k1_wait()
691 while (wait-- > 0) { in snd_emu10k1_wait()
694 newtime = inl(emu->port + WC) >> 6; in snd_emu10k1_wait()
706 struct snd_emu10k1 *emu = ac97->private_data; in snd_emu10k1_ac97_read()
710 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_ac97_read()
711 outb(reg, emu->port + AC97ADDRESS); in snd_emu10k1_ac97_read()
712 val = inw(emu->port + AC97DATA); in snd_emu10k1_ac97_read()
713 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_ac97_read()
719 struct snd_emu10k1 *emu = ac97->private_data; in snd_emu10k1_ac97_write()
722 spin_lock_irqsave(&emu->emu_lock, flags); in snd_emu10k1_ac97_write()
723 outb(reg, emu->port + AC97ADDRESS); in snd_emu10k1_ac97_write()
724 outw(data, emu->port + AC97DATA); in snd_emu10k1_ac97_write()
725 spin_unlock_irqrestore(&emu->emu_lock, flags); in snd_emu10k1_ac97_write()