Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
72069dc5
Commit
72069dc5
authored
Apr 07, 2003
by
Alan Cox
Committed by
Linus Torvalds
Apr 07, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] fix modular gus shared lock
parent
8bc47ee1
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
145 additions
and
145 deletions
+145
-145
sound/oss/gus_midi.c
sound/oss/gus_midi.c
+22
-22
sound/oss/gus_wave.c
sound/oss/gus_wave.c
+123
-123
No files found.
sound/oss/gus_midi.c
View file @
72069dc5
...
@@ -26,7 +26,6 @@ static int midi_busy = 0, input_opened = 0;
...
@@ -26,7 +26,6 @@ static int midi_busy = 0, input_opened = 0;
static
int
my_dev
;
static
int
my_dev
;
static
int
output_used
=
0
;
static
int
output_used
=
0
;
static
volatile
unsigned
char
gus_midi_control
;
static
volatile
unsigned
char
gus_midi_control
;
static
spinlock_t
lock
=
SPIN_LOCK_UNLOCKED
;
static
void
(
*
midi_input_intr
)
(
int
dev
,
unsigned
char
data
);
static
void
(
*
midi_input_intr
)
(
int
dev
,
unsigned
char
data
);
static
unsigned
char
tmp_queue
[
256
];
static
unsigned
char
tmp_queue
[
256
];
...
@@ -35,6 +34,7 @@ static volatile int qlen;
...
@@ -35,6 +34,7 @@ static volatile int qlen;
static
volatile
unsigned
char
qhead
,
qtail
;
static
volatile
unsigned
char
qhead
,
qtail
;
extern
int
gus_base
,
gus_irq
,
gus_dma
;
extern
int
gus_base
,
gus_irq
,
gus_dma
;
extern
int
*
gus_osp
;
extern
int
*
gus_osp
;
extern
spinlock_t
gus_lock
;
static
int
GUS_MIDI_STATUS
(
void
)
static
int
GUS_MIDI_STATUS
(
void
)
{
{
...
@@ -76,7 +76,7 @@ static int dump_to_midi(unsigned char midi_byte)
...
@@ -76,7 +76,7 @@ static int dump_to_midi(unsigned char midi_byte)
output_used
=
1
;
output_used
=
1
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
if
(
GUS_MIDI_STATUS
()
&
MIDI_XMIT_EMPTY
)
if
(
GUS_MIDI_STATUS
()
&
MIDI_XMIT_EMPTY
)
{
{
...
@@ -92,7 +92,7 @@ static int dump_to_midi(unsigned char midi_byte)
...
@@ -92,7 +92,7 @@ static int dump_to_midi(unsigned char midi_byte)
outb
((
gus_midi_control
),
u_MidiControl
);
outb
((
gus_midi_control
),
u_MidiControl
);
}
}
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
ok
;
return
ok
;
}
}
...
@@ -113,14 +113,14 @@ static int gus_midi_out(int dev, unsigned char midi_byte)
...
@@ -113,14 +113,14 @@ static int gus_midi_out(int dev, unsigned char midi_byte)
/*
/*
* Drain the local queue first
* Drain the local queue first
*/
*/
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
while
(
qlen
&&
dump_to_midi
(
tmp_queue
[
qhead
]))
while
(
qlen
&&
dump_to_midi
(
tmp_queue
[
qhead
]))
{
{
qlen
--
;
qlen
--
;
qhead
++
;
qhead
++
;
}
}
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
/*
/*
* Output the byte if the local queue is empty.
* Output the byte if the local queue is empty.
...
@@ -140,13 +140,13 @@ static int gus_midi_out(int dev, unsigned char midi_byte)
...
@@ -140,13 +140,13 @@ static int gus_midi_out(int dev, unsigned char midi_byte)
return
0
;
/*
return
0
;
/*
* Local queue full
* Local queue full
*/
*/
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
tmp_queue
[
qtail
]
=
midi_byte
;
tmp_queue
[
qtail
]
=
midi_byte
;
qlen
++
;
qlen
++
;
qtail
++
;
qtail
++
;
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
1
;
return
1
;
}
}
...
@@ -171,14 +171,14 @@ static int gus_midi_buffer_status(int dev)
...
@@ -171,14 +171,14 @@ static int gus_midi_buffer_status(int dev)
if
(
!
output_used
)
if
(
!
output_used
)
return
0
;
return
0
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
if
(
qlen
&&
dump_to_midi
(
tmp_queue
[
qhead
]))
if
(
qlen
&&
dump_to_midi
(
tmp_queue
[
qhead
]))
{
{
qlen
--
;
qlen
--
;
qhead
++
;
qhead
++
;
}
}
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
(
qlen
>
0
)
||
!
(
GUS_MIDI_STATUS
()
&
MIDI_XMIT_EMPTY
);
return
(
qlen
>
0
)
||
!
(
GUS_MIDI_STATUS
()
&
MIDI_XMIT_EMPTY
);
}
}
...
@@ -188,17 +188,17 @@ static int gus_midi_buffer_status(int dev)
...
@@ -188,17 +188,17 @@ static int gus_midi_buffer_status(int dev)
static
struct
midi_operations
gus_midi_operations
=
static
struct
midi_operations
gus_midi_operations
=
{
{
owner:
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
info:
{
"Gravis UltraSound Midi"
,
0
,
0
,
SNDCARD_GUS
},
.
info
=
{
"Gravis UltraSound Midi"
,
0
,
0
,
SNDCARD_GUS
},
converter:
&
std_midi_synth
,
.
converter
=
&
std_midi_synth
,
in_info:
{
0
},
.
in_info
=
{
0
},
open:
gus_midi_open
,
.
open
=
gus_midi_open
,
close:
gus_midi_close
,
.
close
=
gus_midi_close
,
outputc:
gus_midi_out
,
.
outputc
=
gus_midi_out
,
start_read:
gus_midi_start_read
,
.
start_read
=
gus_midi_start_read
,
end_read:
gus_midi_end_read
,
.
end_read
=
gus_midi_end_read
,
kick:
gus_midi_kick
,
.
kick
=
gus_midi_kick
,
buffer_status:
gus_midi_buffer_status
,
.
buffer_status
=
gus_midi_buffer_status
,
};
};
void
__init
gus_midi_init
(
struct
address_info
*
hw_config
)
void
__init
gus_midi_init
(
struct
address_info
*
hw_config
)
...
@@ -224,7 +224,7 @@ void gus_midi_interrupt(int dummy)
...
@@ -224,7 +224,7 @@ void gus_midi_interrupt(int dummy)
volatile
unsigned
char
stat
,
data
;
volatile
unsigned
char
stat
,
data
;
int
timeout
=
10
;
int
timeout
=
10
;
spin_lock
(
&
lock
);
spin_lock
(
&
gus_
lock
);
while
(
timeout
--
>
0
&&
(
stat
=
GUS_MIDI_STATUS
())
&
(
MIDI_RCV_FULL
|
MIDI_XMIT_EMPTY
))
while
(
timeout
--
>
0
&&
(
stat
=
GUS_MIDI_STATUS
())
&
(
MIDI_RCV_FULL
|
MIDI_XMIT_EMPTY
))
{
{
...
@@ -252,5 +252,5 @@ void gus_midi_interrupt(int dummy)
...
@@ -252,5 +252,5 @@ void gus_midi_interrupt(int dummy)
}
}
}
}
}
}
spin_unlock
(
&
lock
);
spin_unlock
(
&
gus_
lock
);
}
}
sound/oss/gus_wave.c
View file @
72069dc5
...
@@ -139,7 +139,7 @@ static int pcm_current_block;
...
@@ -139,7 +139,7 @@ static int pcm_current_block;
static
unsigned
long
pcm_current_buf
;
static
unsigned
long
pcm_current_buf
;
static
int
pcm_current_count
;
static
int
pcm_current_count
;
static
int
pcm_current_intrflag
;
static
int
pcm_current_intrflag
;
s
tatic
spinlock_t
lock
=
SPIN_LOCK_UNLOCKED
;
s
pinlock_t
gus_
lock
=
SPIN_LOCK_UNLOCKED
;
extern
int
*
gus_osp
;
extern
int
*
gus_osp
;
...
@@ -469,7 +469,7 @@ static void gus_voice_init(int voice)
...
@@ -469,7 +469,7 @@ static void gus_voice_init(int voice)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_volume
(
0
);
gus_voice_volume
(
0
);
gus_voice_off
();
gus_voice_off
();
...
@@ -478,7 +478,7 @@ static void gus_voice_init(int voice)
...
@@ -478,7 +478,7 @@ static void gus_voice_init(int voice)
gus_write8
(
0x0d
,
0x03
);
/* Ramping off */
gus_write8
(
0x0d
,
0x03
);
/* Ramping off */
voice_alloc
->
map
[
voice
]
=
0
;
voice_alloc
->
map
[
voice
]
=
0
;
voice_alloc
->
alloc_times
[
voice
]
=
0
;
voice_alloc
->
alloc_times
[
voice
]
=
0
;
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
...
@@ -512,10 +512,10 @@ static void step_envelope(int voice)
...
@@ -512,10 +512,10 @@ static void step_envelope(int voice)
if
(
voices
[
voice
].
mode
&
WAVE_SUSTAIN_ON
&&
voices
[
voice
].
env_phase
==
2
)
if
(
voices
[
voice
].
mode
&
WAVE_SUSTAIN_ON
&&
voices
[
voice
].
env_phase
==
2
)
{
{
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_rampoff
();
gus_rampoff
();
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
;
return
;
/*
/*
* Sustain phase begins. Continue envelope after receiving note off.
* Sustain phase begins. Continue envelope after receiving note off.
...
@@ -533,7 +533,7 @@ static void step_envelope(int voice)
...
@@ -533,7 +533,7 @@ static void step_envelope(int voice)
vol
=
voices
[
voice
].
initial_volume
*
voices
[
voice
].
env_offset
[
phase
]
/
255
;
vol
=
voices
[
voice
].
initial_volume
*
voices
[
voice
].
env_offset
[
phase
]
/
255
;
rate
=
voices
[
voice
].
env_rate
[
phase
];
rate
=
voices
[
voice
].
env_rate
[
phase
];
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_volume
(
prev_vol
);
gus_voice_volume
(
prev_vol
);
...
@@ -545,7 +545,7 @@ static void step_envelope(int voice)
...
@@ -545,7 +545,7 @@ static void step_envelope(int voice)
if
(((
vol
-
prev_vol
)
/
64
)
==
0
)
/* No significant volume change */
if
(((
vol
-
prev_vol
)
/
64
)
==
0
)
/* No significant volume change */
{
{
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
step_envelope
(
voice
);
/* Continue the envelope on the next step */
step_envelope
(
voice
);
/* Continue the envelope on the next step */
return
;
return
;
}
}
...
@@ -564,7 +564,7 @@ static void step_envelope(int voice)
...
@@ -564,7 +564,7 @@ static void step_envelope(int voice)
gus_rampon
(
0x60
);
/* Decreasing volume, with IRQ */
gus_rampon
(
0x60
);
/* Decreasing volume, with IRQ */
}
}
voices
[
voice
].
current_volume
=
vol
;
voices
[
voice
].
current_volume
=
vol
;
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
static
void
init_envelope
(
int
voice
)
static
void
init_envelope
(
int
voice
)
...
@@ -595,14 +595,14 @@ static void gus_voice_fade(int voice)
...
@@ -595,14 +595,14 @@ static void gus_voice_fade(int voice)
int
instr_no
=
sample_map
[
voice
],
is16bits
;
int
instr_no
=
sample_map
[
voice
],
is16bits
;
long
int
flags
;
long
int
flags
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
if
(
instr_no
<
0
||
instr_no
>
MAX_SAMPLE
)
if
(
instr_no
<
0
||
instr_no
>
MAX_SAMPLE
)
{
{
gus_write8
(
0x00
,
0x03
);
/* Hard stop */
gus_write8
(
0x00
,
0x03
);
/* Hard stop */
voice_alloc
->
map
[
voice
]
=
0
;
voice_alloc
->
map
[
voice
]
=
0
;
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
;
return
;
}
}
is16bits
=
(
samples
[
instr_no
].
mode
&
WAVE_16_BITS
)
?
1
:
0
;
/* 8 or 16 bits */
is16bits
=
(
samples
[
instr_no
].
mode
&
WAVE_16_BITS
)
?
1
:
0
;
/* 8 or 16 bits */
...
@@ -610,7 +610,7 @@ static void gus_voice_fade(int voice)
...
@@ -610,7 +610,7 @@ static void gus_voice_fade(int voice)
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
{
{
start_release
(
voice
);
start_release
(
voice
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
;
return
;
}
}
/*
/*
...
@@ -621,14 +621,14 @@ static void gus_voice_fade(int voice)
...
@@ -621,14 +621,14 @@ static void gus_voice_fade(int voice)
gus_voice_off
();
gus_voice_off
();
gus_rampoff
();
gus_rampoff
();
gus_voice_init
(
voice
);
gus_voice_init
(
voice
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
;
return
;
}
}
gus_ramp_range
(
65
,
4030
);
gus_ramp_range
(
65
,
4030
);
gus_ramp_rate
(
2
,
4
);
gus_ramp_rate
(
2
,
4
);
gus_rampon
(
0x40
|
0x20
);
/* Down, once, with IRQ */
gus_rampon
(
0x40
|
0x20
);
/* Down, once, with IRQ */
voices
[
voice
].
volume_irq_mode
=
VMODE_HALT
;
voices
[
voice
].
volume_irq_mode
=
VMODE_HALT
;
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
static
void
gus_reset
(
void
)
static
void
gus_reset
(
void
)
...
@@ -660,7 +660,7 @@ static void gus_initialize(void)
...
@@ -660,7 +660,7 @@ static void gus_initialize(void)
0
,
1
,
0
,
2
,
0
,
3
,
4
,
5
0
,
1
,
0
,
2
,
0
,
3
,
4
,
5
};
};
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_write8
(
0x4c
,
0
);
/* Reset GF1 */
gus_write8
(
0x4c
,
0
);
/* Reset GF1 */
gus_delay
();
gus_delay
();
gus_delay
();
gus_delay
();
...
@@ -799,7 +799,7 @@ static void gus_initialize(void)
...
@@ -799,7 +799,7 @@ static void gus_initialize(void)
if
(
iw_mode
)
if
(
iw_mode
)
gus_write8
(
0x19
,
gus_read8
(
0x19
)
|
0x01
);
gus_write8
(
0x19
,
gus_read8
(
0x19
)
|
0x01
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
...
@@ -1108,16 +1108,16 @@ static int guswave_kill_note(int dev, int voice, int note, int velocity)
...
@@ -1108,16 +1108,16 @@ static int guswave_kill_note(int dev, int voice, int note, int velocity)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
/* voice_alloc->map[voice] = 0xffff; */
/* voice_alloc->map[voice] = 0xffff; */
if
(
voices
[
voice
].
volume_irq_mode
==
VMODE_START_NOTE
)
if
(
voices
[
voice
].
volume_irq_mode
==
VMODE_START_NOTE
)
{
{
voices
[
voice
].
kill_pending
=
1
;
voices
[
voice
].
kill_pending
=
1
;
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
else
else
{
{
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
gus_voice_fade
(
voice
);
gus_voice_fade
(
voice
);
}
}
...
@@ -1175,7 +1175,7 @@ static void compute_and_set_volume(int voice, int volume, int ramp_time)
...
@@ -1175,7 +1175,7 @@ static void compute_and_set_volume(int voice, int volume, int ramp_time)
compute_volume
(
voice
,
volume
);
compute_volume
(
voice
,
volume
);
voices
[
voice
].
current_volume
=
voices
[
voice
].
initial_volume
;
voices
[
voice
].
current_volume
=
voices
[
voice
].
initial_volume
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
/*
/*
* CAUTION! Interrupts disabled. Enable them before returning
* CAUTION! Interrupts disabled. Enable them before returning
*/
*/
...
@@ -1189,7 +1189,7 @@ static void compute_and_set_volume(int voice, int volume, int ramp_time)
...
@@ -1189,7 +1189,7 @@ static void compute_and_set_volume(int voice, int volume, int ramp_time)
{
{
gus_rampoff
();
gus_rampoff
();
gus_voice_volume
(
target
);
gus_voice_volume
(
target
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
;
return
;
}
}
if
(
ramp_time
==
FAST_RAMP
)
if
(
ramp_time
==
FAST_RAMP
)
...
@@ -1202,7 +1202,7 @@ static void compute_and_set_volume(int voice, int volume, int ramp_time)
...
@@ -1202,7 +1202,7 @@ static void compute_and_set_volume(int voice, int volume, int ramp_time)
{
{
gus_rampoff
();
gus_rampoff
();
gus_voice_volume
(
target
);
gus_voice_volume
(
target
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
;
return
;
}
}
if
(
target
>
curr
)
if
(
target
>
curr
)
...
@@ -1220,7 +1220,7 @@ static void compute_and_set_volume(int voice, int volume, int ramp_time)
...
@@ -1220,7 +1220,7 @@ static void compute_and_set_volume(int voice, int volume, int ramp_time)
gus_ramp_range
(
target
,
curr
);
gus_ramp_range
(
target
,
curr
);
gus_rampon
(
0x40
);
/* Ramp down, once, no irq */
gus_rampon
(
0x40
);
/* Ramp down, once, no irq */
}
}
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
static
void
dynamic_volume_change
(
int
voice
)
static
void
dynamic_volume_change
(
int
voice
)
...
@@ -1228,10 +1228,10 @@ static void dynamic_volume_change(int voice)
...
@@ -1228,10 +1228,10 @@ static void dynamic_volume_change(int voice)
unsigned
char
status
;
unsigned
char
status
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
status
=
gus_read8
(
0x00
);
/* Get voice status */
status
=
gus_read8
(
0x00
);
/* Get voice status */
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
if
(
status
&
0x03
)
if
(
status
&
0x03
)
return
;
/* Voice was not running */
return
;
/* Voice was not running */
...
@@ -1246,10 +1246,10 @@ static void dynamic_volume_change(int voice)
...
@@ -1246,10 +1246,10 @@ static void dynamic_volume_change(int voice)
* Voice is running and has envelopes.
* Voice is running and has envelopes.
*/
*/
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
status
=
gus_read8
(
0x0d
);
/* Ramping status */
status
=
gus_read8
(
0x0d
);
/* Ramping status */
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
if
(
status
&
0x03
)
/* Sustain phase? */
if
(
status
&
0x03
)
/* Sustain phase? */
{
{
...
@@ -1281,10 +1281,10 @@ static void guswave_controller(int dev, int voice, int ctrl_num, int value)
...
@@ -1281,10 +1281,10 @@ static void guswave_controller(int dev, int voice, int ctrl_num, int value)
freq
=
compute_finetune
(
voices
[
voice
].
orig_freq
,
value
,
voices
[
voice
].
bender_range
,
0
);
freq
=
compute_finetune
(
voices
[
voice
].
orig_freq
,
value
,
voices
[
voice
].
bender_range
,
0
);
voices
[
voice
].
current_freq
=
freq
;
voices
[
voice
].
current_freq
=
freq
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_freq
(
freq
);
gus_voice_freq
(
freq
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
break
;
break
;
...
@@ -1441,12 +1441,12 @@ static int guswave_start_note2(int dev, int voice, int note_num, int volume)
...
@@ -1441,12 +1441,12 @@ static int guswave_start_note2(int dev, int voice, int note_num, int volume)
((
sample_ptrs
[
sample
]
+
samples
[
sample
].
len
)
/
GUS_BANK_SIZE
))
((
sample_ptrs
[
sample
]
+
samples
[
sample
].
len
)
/
GUS_BANK_SIZE
))
printk
(
KERN_ERR
"GUS: Sample address error
\n
"
);
printk
(
KERN_ERR
"GUS: Sample address error
\n
"
);
}
}
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_off
();
gus_voice_off
();
gus_rampoff
();
gus_rampoff
();
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
{
{
...
@@ -1458,7 +1458,7 @@ static int guswave_start_note2(int dev, int voice, int note_num, int volume)
...
@@ -1458,7 +1458,7 @@ static int guswave_start_note2(int dev, int voice, int note_num, int volume)
compute_and_set_volume
(
voice
,
volume
,
0
);
compute_and_set_volume
(
voice
,
volume
,
0
);
}
}
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
if
(
samples
[
sample
].
mode
&
WAVE_LOOP_BACK
)
if
(
samples
[
sample
].
mode
&
WAVE_LOOP_BACK
)
...
@@ -1498,7 +1498,7 @@ static int guswave_start_note2(int dev, int voice, int note_num, int volume)
...
@@ -1498,7 +1498,7 @@ static int guswave_start_note2(int dev, int voice, int note_num, int volume)
gus_voice_freq
(
freq
);
gus_voice_freq
(
freq
);
gus_voice_balance
(
pan
);
gus_voice_balance
(
pan
);
gus_voice_on
(
mode
);
gus_voice_on
(
mode
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
0
;
return
0
;
}
}
...
@@ -1515,7 +1515,7 @@ static int guswave_start_note(int dev, int voice, int note_num, int volume)
...
@@ -1515,7 +1515,7 @@ static int guswave_start_note(int dev, int voice, int note_num, int volume)
int
mode
;
int
mode
;
int
ret_val
=
0
;
int
ret_val
=
0
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
if
(
note_num
==
255
)
if
(
note_num
==
255
)
{
{
if
(
voices
[
voice
].
volume_irq_mode
==
VMODE_START_NOTE
)
if
(
voices
[
voice
].
volume_irq_mode
==
VMODE_START_NOTE
)
...
@@ -1541,10 +1541,10 @@ static int guswave_start_note(int dev, int voice, int note_num, int volume)
...
@@ -1541,10 +1541,10 @@ static int guswave_start_note(int dev, int voice, int note_num, int volume)
if
(
voices
[
voice
].
sample_pending
>=
0
)
if
(
voices
[
voice
].
sample_pending
>=
0
)
{
{
spin_unlock_irqrestore
(
&
lock
,
flags
);
/* Run temporarily with interrupts enabled */
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
/* Run temporarily with interrupts enabled */
guswave_set_instr
(
voices
[
voice
].
dev_pending
,
voice
,
voices
[
voice
].
sample_pending
);
guswave_set_instr
(
voices
[
voice
].
dev_pending
,
voice
,
voices
[
voice
].
sample_pending
);
voices
[
voice
].
sample_pending
=
-
1
;
voices
[
voice
].
sample_pending
=
-
1
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
/* Reselect the voice (just to be sure) */
gus_select_voice
(
voice
);
/* Reselect the voice (just to be sure) */
}
}
if
((
mode
&
0x01
)
||
(
int
)
((
gus_read16
(
0x09
)
>>
4
)
<
(
unsigned
)
2065
))
if
((
mode
&
0x01
)
||
(
int
)
((
gus_read16
(
0x09
)
>>
4
)
<
(
unsigned
)
2065
))
...
@@ -1564,7 +1564,7 @@ static int guswave_start_note(int dev, int voice, int note_num, int volume)
...
@@ -1564,7 +1564,7 @@ static int guswave_start_note(int dev, int voice, int note_num, int volume)
gus_rampon
(
0x20
|
0x40
);
/* Ramp down, once, irq */
gus_rampon
(
0x20
|
0x40
);
/* Ramp down, once, irq */
}
}
}
}
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
return
ret_val
;
return
ret_val
;
}
}
...
@@ -1807,7 +1807,7 @@ static int guswave_load_patch(int dev, int format, const char *addr,
...
@@ -1807,7 +1807,7 @@ static int guswave_load_patch(int dev, int format, const char *addr,
blk_sz
))
blk_sz
))
return
-
EFAULT
;
return
-
EFAULT
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_write8
(
0x41
,
0
);
/* Disable GF1 DMA */
gus_write8
(
0x41
,
0
);
/* Disable GF1 DMA */
DMAbuf_start_dma
(
gus_devnum
,
audio_devs
[
gus_devnum
]
->
dmap_out
->
raw_buf_phys
,
DMAbuf_start_dma
(
gus_devnum
,
audio_devs
[
gus_devnum
]
->
dmap_out
->
raw_buf_phys
,
blk_sz
,
DMA_MODE_WRITE
);
blk_sz
,
DMA_MODE_WRITE
);
...
@@ -1864,7 +1864,7 @@ static int guswave_load_patch(int dev, int format, const char *addr,
...
@@ -1864,7 +1864,7 @@ static int guswave_load_patch(int dev, int format, const char *addr,
active_device
=
GUS_DEV_WAVE
;
active_device
=
GUS_DEV_WAVE
;
gus_write8
(
0x41
,
dma_command
);
/* Lets go luteet (=bugs) */
gus_write8
(
0x41
,
dma_command
);
/* Lets go luteet (=bugs) */
spin_unlock_irqrestore
(
&
lock
,
flags
);
/* opens a race */
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
/* opens a race */
if
(
!
interruptible_sleep_on_timeout
(
&
dram_sleeper
,
HZ
))
if
(
!
interruptible_sleep_on_timeout
(
&
dram_sleeper
,
HZ
))
printk
(
"GUS: DMA Transfer timed out
\n
"
);
printk
(
"GUS: DMA Transfer timed out
\n
"
);
}
}
...
@@ -1905,10 +1905,10 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
...
@@ -1905,10 +1905,10 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
switch
(
cmd
)
switch
(
cmd
)
{
{
case
_GUS_NUMVOICES
:
case
_GUS_NUMVOICES
:
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_select_max_voices
(
p1
);
gus_select_max_voices
(
p1
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_VOICESAMPLE
:
case
_GUS_VOICESAMPLE
:
...
@@ -1916,18 +1916,18 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
...
@@ -1916,18 +1916,18 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
break
;
break
;
case
_GUS_VOICEON
:
case
_GUS_VOICEON
:
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
p1
&=
~
0x20
;
/* Don't allow interrupts */
p1
&=
~
0x20
;
/* Don't allow interrupts */
gus_voice_on
(
p1
);
gus_voice_on
(
p1
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_VOICEOFF
:
case
_GUS_VOICEOFF
:
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_off
();
gus_voice_off
();
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_VOICEFADE
:
case
_GUS_VOICEFADE
:
...
@@ -1935,32 +1935,32 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
...
@@ -1935,32 +1935,32 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
break
;
break
;
case
_GUS_VOICEMODE
:
case
_GUS_VOICEMODE
:
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
p1
&=
~
0x20
;
/* Don't allow interrupts */
p1
&=
~
0x20
;
/* Don't allow interrupts */
gus_voice_mode
(
p1
);
gus_voice_mode
(
p1
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_VOICEBALA
:
case
_GUS_VOICEBALA
:
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_balance
(
p1
);
gus_voice_balance
(
p1
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_VOICEFREQ
:
case
_GUS_VOICEFREQ
:
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_freq
(
plong
);
gus_voice_freq
(
plong
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_VOICEVOL
:
case
_GUS_VOICEVOL
:
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_volume
(
p1
);
gus_voice_volume
(
p1
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_VOICEVOL2
:
/* Just update the software voice level */
case
_GUS_VOICEVOL2
:
/* Just update the software voice level */
...
@@ -1970,48 +1970,48 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
...
@@ -1970,48 +1970,48 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
case
_GUS_RAMPRANGE
:
case
_GUS_RAMPRANGE
:
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
break
;
/* NO-NO */
break
;
/* NO-NO */
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_ramp_range
(
p1
,
p2
);
gus_ramp_range
(
p1
,
p2
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_RAMPRATE
:
case
_GUS_RAMPRATE
:
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
break
;
/* NJET-NJET */
break
;
/* NJET-NJET */
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_ramp_rate
(
p1
,
p2
);
gus_ramp_rate
(
p1
,
p2
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_RAMPMODE
:
case
_GUS_RAMPMODE
:
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
break
;
/* NO-NO */
break
;
/* NO-NO */
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
p1
&=
~
0x20
;
/* Don't allow interrupts */
p1
&=
~
0x20
;
/* Don't allow interrupts */
gus_ramp_mode
(
p1
);
gus_ramp_mode
(
p1
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_RAMPON
:
case
_GUS_RAMPON
:
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
break
;
/* EI-EI */
break
;
/* EI-EI */
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
p1
&=
~
0x20
;
/* Don't allow interrupts */
p1
&=
~
0x20
;
/* Don't allow interrupts */
gus_rampon
(
p1
);
gus_rampon
(
p1
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_RAMPOFF
:
case
_GUS_RAMPOFF
:
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
if
(
voices
[
voice
].
mode
&
WAVE_ENVELOPES
)
break
;
/* NEJ-NEJ */
break
;
/* NEJ-NEJ */
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_rampoff
();
gus_rampoff
();
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
case
_GUS_VOLUME_SCALE
:
case
_GUS_VOLUME_SCALE
:
...
@@ -2020,10 +2020,10 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
...
@@ -2020,10 +2020,10 @@ static void guswave_hw_control(int dev, unsigned char *event_rec)
break
;
break
;
case
_GUS_VOICE_POS
:
case
_GUS_VOICE_POS
:
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_set_voice_pos
(
voice
,
plong
);
gus_set_voice_pos
(
voice
,
plong
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
break
;
break
;
default:
default:
...
@@ -2214,12 +2214,12 @@ static void gus_audio_update_volume(void)
...
@@ -2214,12 +2214,12 @@ static void gus_audio_update_volume(void)
if
(
pcm_active
&&
pcm_opened
)
if
(
pcm_active
&&
pcm_opened
)
for
(
voice
=
0
;
voice
<
gus_audio_channels
;
voice
++
)
for
(
voice
=
0
;
voice
<
gus_audio_channels
;
voice
++
)
{
{
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_rampoff
();
gus_rampoff
();
gus_voice_volume
(
1530
+
(
25
*
gus_pcm_volume
));
gus_voice_volume
(
1530
+
(
25
*
gus_pcm_volume
));
gus_ramp_range
(
65
,
1530
+
(
25
*
gus_pcm_volume
));
gus_ramp_range
(
65
,
1530
+
(
25
*
gus_pcm_volume
));
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
}
}
...
@@ -2267,7 +2267,7 @@ static void play_next_pcm_block(void)
...
@@ -2267,7 +2267,7 @@ static void play_next_pcm_block(void)
if
(
chn
==
0
)
if
(
chn
==
0
)
ramp_mode
[
chn
]
=
0x04
;
/* Enable rollover bit */
ramp_mode
[
chn
]
=
0x04
;
/* Enable rollover bit */
}
}
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
chn
);
gus_select_voice
(
chn
);
gus_voice_freq
(
speed
);
gus_voice_freq
(
speed
);
...
@@ -2304,17 +2304,17 @@ static void play_next_pcm_block(void)
...
@@ -2304,17 +2304,17 @@ static void play_next_pcm_block(void)
0
,
is16bits
);
/* Loop end location */
0
,
is16bits
);
/* Loop end location */
else
else
mode
[
chn
]
|=
0x08
;
/* Enable looping */
mode
[
chn
]
|=
0x08
;
/* Enable looping */
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
for
(
chn
=
0
;
chn
<
gus_audio_channels
;
chn
++
)
for
(
chn
=
0
;
chn
<
gus_audio_channels
;
chn
++
)
{
{
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
chn
);
gus_select_voice
(
chn
);
gus_write8
(
0x0d
,
ramp_mode
[
chn
]);
gus_write8
(
0x0d
,
ramp_mode
[
chn
]);
if
(
iw_mode
)
if
(
iw_mode
)
gus_write8
(
0x15
,
0x00
);
/* Reset voice deactivate bit of SMSI */
gus_write8
(
0x15
,
0x00
);
/* Reset voice deactivate bit of SMSI */
gus_voice_on
(
mode
[
chn
]);
gus_voice_on
(
mode
[
chn
]);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
pcm_active
=
1
;
pcm_active
=
1
;
}
}
...
@@ -2336,7 +2336,7 @@ static void gus_transfer_output_block(int dev, unsigned long buf,
...
@@ -2336,7 +2336,7 @@ static void gus_transfer_output_block(int dev, unsigned long buf,
unsigned
char
dma_command
;
unsigned
char
dma_command
;
unsigned
long
address
,
hold_address
;
unsigned
long
address
,
hold_address
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
count
=
total_count
/
gus_audio_channels
;
count
=
total_count
/
gus_audio_channels
;
...
@@ -2401,7 +2401,7 @@ static void gus_transfer_output_block(int dev, unsigned long buf,
...
@@ -2401,7 +2401,7 @@ static void gus_transfer_output_block(int dev, unsigned long buf,
active_device
=
GUS_DEV_PCM_CONTINUE
;
active_device
=
GUS_DEV_PCM_CONTINUE
;
}
}
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
static
void
gus_uninterleave8
(
char
*
buf
,
int
l
)
static
void
gus_uninterleave8
(
char
*
buf
,
int
l
)
...
@@ -2463,7 +2463,7 @@ static void gus_audio_start_input(int dev, unsigned long buf, int count,
...
@@ -2463,7 +2463,7 @@ static void gus_audio_start_input(int dev, unsigned long buf, int count,
unsigned
long
flags
;
unsigned
long
flags
;
unsigned
char
mode
;
unsigned
char
mode
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
DMAbuf_start_dma
(
dev
,
buf
,
count
,
DMA_MODE_READ
);
DMAbuf_start_dma
(
dev
,
buf
,
count
,
DMA_MODE_READ
);
mode
=
0xa0
;
/* DMA IRQ enabled, invert MSB */
mode
=
0xa0
;
/* DMA IRQ enabled, invert MSB */
...
@@ -2475,7 +2475,7 @@ static void gus_audio_start_input(int dev, unsigned long buf, int count,
...
@@ -2475,7 +2475,7 @@ static void gus_audio_start_input(int dev, unsigned long buf, int count,
mode
|=
0x01
;
/* DMA enable */
mode
|=
0x01
;
/* DMA enable */
gus_write8
(
0x49
,
mode
);
gus_write8
(
0x49
,
mode
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
static
int
gus_audio_prepare_for_input
(
int
dev
,
int
bsize
,
int
bcount
)
static
int
gus_audio_prepare_for_input
(
int
dev
,
int
bsize
,
int
bcount
)
...
@@ -2535,16 +2535,16 @@ static int gus_local_qlen(int dev)
...
@@ -2535,16 +2535,16 @@ static int gus_local_qlen(int dev)
static
struct
audio_driver
gus_audio_driver
=
static
struct
audio_driver
gus_audio_driver
=
{
{
owner:
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
open:
gus_audio_open
,
.
open
=
gus_audio_open
,
close:
gus_audio_close
,
.
close
=
gus_audio_close
,
output_block:
gus_audio_output_block
,
.
output_block
=
gus_audio_output_block
,
start_input:
gus_audio_start_input
,
.
start_input
=
gus_audio_start_input
,
ioctl:
gus_audio_ioctl
,
.
ioctl
=
gus_audio_ioctl
,
prepare_for_input:
gus_audio_prepare_for_input
,
.
prepare_for_input
=
gus_audio_prepare_for_input
,
prepare_for_output:
gus_audio_prepare_for_output
,
.
prepare_for_output
=
gus_audio_prepare_for_output
,
halt_io:
gus_audio_reset
,
.
halt_io
=
gus_audio_reset
,
local_qlen:
gus_local_qlen
,
.
local_qlen
=
gus_local_qlen
,
};
};
static
void
guswave_setup_voice
(
int
dev
,
int
voice
,
int
chn
)
static
void
guswave_setup_voice
(
int
dev
,
int
voice
,
int
chn
)
...
@@ -2571,10 +2571,10 @@ static void guswave_bender(int dev, int voice, int value)
...
@@ -2571,10 +2571,10 @@ static void guswave_bender(int dev, int voice, int value)
freq
=
compute_finetune
(
voices
[
voice
].
orig_freq
,
value
-
8192
,
voices
[
voice
].
bender_range
,
0
);
freq
=
compute_finetune
(
voices
[
voice
].
orig_freq
,
value
-
8192
,
voices
[
voice
].
bender_range
,
0
);
voices
[
voice
].
current_freq
=
freq
;
voices
[
voice
].
current_freq
=
freq
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
gus_voice_freq
(
freq
);
gus_voice_freq
(
freq
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
static
int
guswave_alloc
(
int
dev
,
int
chn
,
int
note
,
struct
voice_alloc_info
*
alloc
)
static
int
guswave_alloc
(
int
dev
,
int
chn
,
int
note
,
struct
voice_alloc_info
*
alloc
)
...
@@ -2623,28 +2623,28 @@ static int guswave_alloc(int dev, int chn, int note, struct voice_alloc_info *al
...
@@ -2623,28 +2623,28 @@ static int guswave_alloc(int dev, int chn, int note, struct voice_alloc_info *al
static
struct
synth_operations
guswave_operations
=
static
struct
synth_operations
guswave_operations
=
{
{
owner:
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
id:
"GUS"
,
.
id
=
"GUS"
,
info:
&
gus_info
,
.
info
=
&
gus_info
,
midi_dev:
0
,
.
midi_dev
=
0
,
synth_type:
SYNTH_TYPE_SAMPLE
,
.
synth_type
=
SYNTH_TYPE_SAMPLE
,
synth_subtype:
SAMPLE_TYPE_GUS
,
.
synth_subtype
=
SAMPLE_TYPE_GUS
,
open:
guswave_open
,
.
open
=
guswave_open
,
close:
guswave_close
,
.
close
=
guswave_close
,
ioctl:
guswave_ioctl
,
.
ioctl
=
guswave_ioctl
,
kill_note:
guswave_kill_note
,
.
kill_note
=
guswave_kill_note
,
start_note:
guswave_start_note
,
.
start_note
=
guswave_start_note
,
set_instr:
guswave_set_instr
,
.
set_instr
=
guswave_set_instr
,
reset:
guswave_reset
,
.
reset
=
guswave_reset
,
hw_control:
guswave_hw_control
,
.
hw_control
=
guswave_hw_control
,
load_patch:
guswave_load_patch
,
.
load_patch
=
guswave_load_patch
,
aftertouch:
guswave_aftertouch
,
.
aftertouch
=
guswave_aftertouch
,
controller:
guswave_controller
,
.
controller
=
guswave_controller
,
panning:
guswave_panning
,
.
panning
=
guswave_panning
,
volume_method:
guswave_volume_method
,
.
volume_method
=
guswave_volume_method
,
bender:
guswave_bender
,
.
bender
=
guswave_bender
,
alloc_voice:
guswave_alloc
,
.
alloc_voice
=
guswave_alloc
,
setup_voice:
guswave_setup_voice
.
setup_voice
=
guswave_setup_voice
};
};
static
void
set_input_volumes
(
void
)
static
void
set_input_volumes
(
void
)
...
@@ -2655,7 +2655,7 @@ static void set_input_volumes(void)
...
@@ -2655,7 +2655,7 @@ static void set_input_volumes(void)
if
(
have_gus_max
)
/* Don't disturb GUS MAX */
if
(
have_gus_max
)
/* Don't disturb GUS MAX */
return
;
return
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
/*
/*
* Enable channels having vol > 10%
* Enable channels having vol > 10%
...
@@ -2681,7 +2681,7 @@ static void set_input_volumes(void)
...
@@ -2681,7 +2681,7 @@ static void set_input_volumes(void)
mix_image
|=
mask
&
0x07
;
mix_image
|=
mask
&
0x07
;
outb
((
mix_image
),
u_Mixer
);
outb
((
mix_image
),
u_Mixer
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
#define MIX_DEVS (SOUND_MASK_MIC|SOUND_MASK_LINE| \
#define MIX_DEVS (SOUND_MASK_MIC|SOUND_MASK_LINE| \
...
@@ -2815,10 +2815,10 @@ int gus_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
...
@@ -2815,10 +2815,10 @@ int gus_default_mixer_ioctl(int dev, unsigned int cmd, caddr_t arg)
static
struct
mixer_operations
gus_mixer_operations
=
static
struct
mixer_operations
gus_mixer_operations
=
{
{
owner:
THIS_MODULE
,
.
owner
=
THIS_MODULE
,
id:
"GUS"
,
.
id
=
"GUS"
,
name:
"Gravis Ultrasound"
,
.
name
=
"Gravis Ultrasound"
,
ioctl:
gus_default_mixer_ioctl
.
ioctl
=
gus_default_mixer_ioctl
};
};
static
int
__init
gus_default_mixer_init
(
void
)
static
int
__init
gus_default_mixer_init
(
void
)
...
@@ -2890,10 +2890,10 @@ void __init gus_wave_init(struct address_info *hw_config)
...
@@ -2890,10 +2890,10 @@ void __init gus_wave_init(struct address_info *hw_config)
* Versions < 3.6 don't have the digital ASIC. Try to probe it first.
* Versions < 3.6 don't have the digital ASIC. Try to probe it first.
*/
*/
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
outb
((
0x20
),
gus_base
+
0x0f
);
outb
((
0x20
),
gus_base
+
0x0f
);
val
=
inb
(
gus_base
+
0x0f
);
val
=
inb
(
gus_base
+
0x0f
);
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
if
(
gus_pnp_flag
||
(
val
!=
0xff
&&
(
val
&
0x06
)))
/* Should be 0x02?? */
if
(
gus_pnp_flag
||
(
val
!=
0xff
&&
(
val
&
0x06
)))
/* Should be 0x02?? */
{
{
...
@@ -3124,7 +3124,7 @@ static void do_loop_irq(int voice)
...
@@ -3124,7 +3124,7 @@ static void do_loop_irq(int voice)
unsigned
char
tmp
;
unsigned
char
tmp
;
int
mode
,
parm
;
int
mode
,
parm
;
spin_lock
(
&
lock
);
spin_lock
(
&
gus_
lock
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
tmp
=
gus_read8
(
0x00
);
tmp
=
gus_read8
(
0x00
);
...
@@ -3200,7 +3200,7 @@ static void do_loop_irq(int voice)
...
@@ -3200,7 +3200,7 @@ static void do_loop_irq(int voice)
default:
default:
break
;
break
;
}
}
spin_unlock
(
&
lock
);
spin_unlock
(
&
gus_
lock
);
}
}
static
void
do_volume_irq
(
int
voice
)
static
void
do_volume_irq
(
int
voice
)
...
@@ -3209,7 +3209,7 @@ static void do_volume_irq(int voice)
...
@@ -3209,7 +3209,7 @@ static void do_volume_irq(int voice)
int
mode
,
parm
;
int
mode
,
parm
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
lock
,
flags
);
spin_lock_irqsave
(
&
gus_
lock
,
flags
);
gus_select_voice
(
voice
);
gus_select_voice
(
voice
);
tmp
=
gus_read8
(
0x0d
);
tmp
=
gus_read8
(
0x0d
);
...
@@ -3227,18 +3227,18 @@ static void do_volume_irq(int voice)
...
@@ -3227,18 +3227,18 @@ static void do_volume_irq(int voice)
case
VMODE_HALT
:
/* Decay phase finished */
case
VMODE_HALT
:
/* Decay phase finished */
if
(
iw_mode
)
if
(
iw_mode
)
gus_write8
(
0x15
,
0x02
);
/* Set voice deactivate bit of SMSI */
gus_write8
(
0x15
,
0x02
);
/* Set voice deactivate bit of SMSI */
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
gus_voice_init
(
voice
);
gus_voice_init
(
voice
);
break
;
break
;
case
VMODE_ENVELOPE
:
case
VMODE_ENVELOPE
:
gus_rampoff
();
gus_rampoff
();
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
step_envelope
(
voice
);
step_envelope
(
voice
);
break
;
break
;
case
VMODE_START_NOTE
:
case
VMODE_START_NOTE
:
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
guswave_start_note2
(
voices
[
voice
].
dev_pending
,
voice
,
guswave_start_note2
(
voices
[
voice
].
dev_pending
,
voice
,
voices
[
voice
].
note_pending
,
voices
[
voice
].
volume_pending
);
voices
[
voice
].
note_pending
,
voices
[
voice
].
volume_pending
);
if
(
voices
[
voice
].
kill_pending
)
if
(
voices
[
voice
].
kill_pending
)
...
@@ -3254,7 +3254,7 @@ static void do_volume_irq(int voice)
...
@@ -3254,7 +3254,7 @@ static void do_volume_irq(int voice)
break
;
break
;
default:
default:
spin_unlock_irqrestore
(
&
lock
,
flags
);
spin_unlock_irqrestore
(
&
gus_
lock
,
flags
);
}
}
}
}
/* called in irq context */
/* called in irq context */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment