• Home
  • Raw
  • Download

Lines Matching refs:chip

35 irqreturn_t snd_sb8dsp_midi_interrupt(struct snd_sb *chip)  in snd_sb8dsp_midi_interrupt()  argument
41 if (!chip) in snd_sb8dsp_midi_interrupt()
44 rmidi = chip->rmidi; in snd_sb8dsp_midi_interrupt()
46 inb(SBP(chip, DATA_AVAIL)); /* ack interrupt */ in snd_sb8dsp_midi_interrupt()
50 spin_lock(&chip->midi_input_lock); in snd_sb8dsp_midi_interrupt()
52 if (inb(SBP(chip, DATA_AVAIL)) & 0x80) { in snd_sb8dsp_midi_interrupt()
53 byte = inb(SBP(chip, READ)); in snd_sb8dsp_midi_interrupt()
54 if (chip->open & SB_OPEN_MIDI_INPUT_TRIGGER) { in snd_sb8dsp_midi_interrupt()
55 snd_rawmidi_receive(chip->midi_substream_input, &byte, 1); in snd_sb8dsp_midi_interrupt()
59 spin_unlock(&chip->midi_input_lock); in snd_sb8dsp_midi_interrupt()
66 struct snd_sb *chip; in snd_sb8dsp_midi_input_open() local
69 chip = substream->rmidi->private_data; in snd_sb8dsp_midi_input_open()
70 valid_open_flags = chip->hardware >= SB_HW_20 in snd_sb8dsp_midi_input_open()
72 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8dsp_midi_input_open()
73 if (chip->open & ~valid_open_flags) { in snd_sb8dsp_midi_input_open()
74 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_input_open()
77 chip->open |= SB_OPEN_MIDI_INPUT; in snd_sb8dsp_midi_input_open()
78 chip->midi_substream_input = substream; in snd_sb8dsp_midi_input_open()
79 if (!(chip->open & SB_OPEN_MIDI_OUTPUT)) { in snd_sb8dsp_midi_input_open()
80 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_input_open()
81 snd_sbdsp_reset(chip); /* reset DSP */ in snd_sb8dsp_midi_input_open()
82 if (chip->hardware >= SB_HW_20) in snd_sb8dsp_midi_input_open()
83 snd_sbdsp_command(chip, SB_DSP_MIDI_UART_IRQ); in snd_sb8dsp_midi_input_open()
85 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_input_open()
93 struct snd_sb *chip; in snd_sb8dsp_midi_output_open() local
96 chip = substream->rmidi->private_data; in snd_sb8dsp_midi_output_open()
97 valid_open_flags = chip->hardware >= SB_HW_20 in snd_sb8dsp_midi_output_open()
99 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8dsp_midi_output_open()
100 if (chip->open & ~valid_open_flags) { in snd_sb8dsp_midi_output_open()
101 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_open()
104 chip->open |= SB_OPEN_MIDI_OUTPUT; in snd_sb8dsp_midi_output_open()
105 chip->midi_substream_output = substream; in snd_sb8dsp_midi_output_open()
106 if (!(chip->open & SB_OPEN_MIDI_INPUT)) { in snd_sb8dsp_midi_output_open()
107 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_open()
108 snd_sbdsp_reset(chip); /* reset DSP */ in snd_sb8dsp_midi_output_open()
109 if (chip->hardware >= SB_HW_20) in snd_sb8dsp_midi_output_open()
110 snd_sbdsp_command(chip, SB_DSP_MIDI_UART_IRQ); in snd_sb8dsp_midi_output_open()
112 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_open()
120 struct snd_sb *chip; in snd_sb8dsp_midi_input_close() local
122 chip = substream->rmidi->private_data; in snd_sb8dsp_midi_input_close()
123 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8dsp_midi_input_close()
124 chip->open &= ~(SB_OPEN_MIDI_INPUT | SB_OPEN_MIDI_INPUT_TRIGGER); in snd_sb8dsp_midi_input_close()
125 chip->midi_substream_input = NULL; in snd_sb8dsp_midi_input_close()
126 if (!(chip->open & SB_OPEN_MIDI_OUTPUT)) { in snd_sb8dsp_midi_input_close()
127 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_input_close()
128 snd_sbdsp_reset(chip); /* reset DSP */ in snd_sb8dsp_midi_input_close()
130 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_input_close()
138 struct snd_sb *chip; in snd_sb8dsp_midi_output_close() local
140 chip = substream->rmidi->private_data; in snd_sb8dsp_midi_output_close()
141 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8dsp_midi_output_close()
142 chip->open &= ~(SB_OPEN_MIDI_OUTPUT | SB_OPEN_MIDI_OUTPUT_TRIGGER); in snd_sb8dsp_midi_output_close()
143 chip->midi_substream_output = NULL; in snd_sb8dsp_midi_output_close()
144 if (!(chip->open & SB_OPEN_MIDI_INPUT)) { in snd_sb8dsp_midi_output_close()
145 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_close()
146 snd_sbdsp_reset(chip); /* reset DSP */ in snd_sb8dsp_midi_output_close()
148 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_close()
156 struct snd_sb *chip; in snd_sb8dsp_midi_input_trigger() local
158 chip = substream->rmidi->private_data; in snd_sb8dsp_midi_input_trigger()
159 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8dsp_midi_input_trigger()
161 if (!(chip->open & SB_OPEN_MIDI_INPUT_TRIGGER)) { in snd_sb8dsp_midi_input_trigger()
162 if (chip->hardware < SB_HW_20) in snd_sb8dsp_midi_input_trigger()
163 snd_sbdsp_command(chip, SB_DSP_MIDI_INPUT_IRQ); in snd_sb8dsp_midi_input_trigger()
164 chip->open |= SB_OPEN_MIDI_INPUT_TRIGGER; in snd_sb8dsp_midi_input_trigger()
167 if (chip->open & SB_OPEN_MIDI_INPUT_TRIGGER) { in snd_sb8dsp_midi_input_trigger()
168 if (chip->hardware < SB_HW_20) in snd_sb8dsp_midi_input_trigger()
169 snd_sbdsp_command(chip, SB_DSP_MIDI_INPUT_IRQ); in snd_sb8dsp_midi_input_trigger()
170 chip->open &= ~SB_OPEN_MIDI_INPUT_TRIGGER; in snd_sb8dsp_midi_input_trigger()
173 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_input_trigger()
179 struct snd_sb *chip; in snd_sb8dsp_midi_output_write() local
184 chip = substream->rmidi->private_data; in snd_sb8dsp_midi_output_write()
186 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8dsp_midi_output_write()
188 chip->open &= ~SB_OPEN_MIDI_OUTPUT_TRIGGER; in snd_sb8dsp_midi_output_write()
189 del_timer(&chip->midi_timer); in snd_sb8dsp_midi_output_write()
190 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_write()
193 if (chip->hardware >= SB_HW_20) { in snd_sb8dsp_midi_output_write()
195 while ((inb(SBP(chip, STATUS)) & 0x80) != 0 && --timeout > 0) in snd_sb8dsp_midi_output_write()
199 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_write()
202 outb(byte, SBP(chip, WRITE)); in snd_sb8dsp_midi_output_write()
204 snd_sbdsp_command(chip, SB_DSP_MIDI_OUTPUT); in snd_sb8dsp_midi_output_write()
205 snd_sbdsp_command(chip, byte); in snd_sb8dsp_midi_output_write()
208 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_write()
215 struct snd_sb * chip = substream->rmidi->private_data; in snd_sb8dsp_midi_output_timer() local
218 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8dsp_midi_output_timer()
219 chip->midi_timer.expires = 1 + jiffies; in snd_sb8dsp_midi_output_timer()
220 add_timer(&chip->midi_timer); in snd_sb8dsp_midi_output_timer()
221 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_timer()
228 struct snd_sb *chip; in snd_sb8dsp_midi_output_trigger() local
230 chip = substream->rmidi->private_data; in snd_sb8dsp_midi_output_trigger()
231 spin_lock_irqsave(&chip->open_lock, flags); in snd_sb8dsp_midi_output_trigger()
233 if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) { in snd_sb8dsp_midi_output_trigger()
234 init_timer(&chip->midi_timer); in snd_sb8dsp_midi_output_trigger()
235 chip->midi_timer.function = snd_sb8dsp_midi_output_timer; in snd_sb8dsp_midi_output_trigger()
236 chip->midi_timer.data = (unsigned long) substream; in snd_sb8dsp_midi_output_trigger()
237 chip->midi_timer.expires = 1 + jiffies; in snd_sb8dsp_midi_output_trigger()
238 add_timer(&chip->midi_timer); in snd_sb8dsp_midi_output_trigger()
239 chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER; in snd_sb8dsp_midi_output_trigger()
242 if (chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER) { in snd_sb8dsp_midi_output_trigger()
243 chip->open &= ~SB_OPEN_MIDI_OUTPUT_TRIGGER; in snd_sb8dsp_midi_output_trigger()
246 spin_unlock_irqrestore(&chip->open_lock, flags); in snd_sb8dsp_midi_output_trigger()
266 int snd_sb8dsp_midi(struct snd_sb *chip, int device, struct snd_rawmidi ** rrawmidi) in snd_sb8dsp_midi() argument
273 if ((err = snd_rawmidi_new(chip->card, "SB8 MIDI", device, 1, 1, &rmidi)) < 0) in snd_sb8dsp_midi()
279 if (chip->hardware >= SB_HW_20) in snd_sb8dsp_midi()
281 rmidi->private_data = chip; in snd_sb8dsp_midi()
282 chip->rmidi = rmidi; in snd_sb8dsp_midi()