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
2641853b
Commit
2641853b
authored
Jul 11, 2003
by
Alan Cox
Committed by
Steve French
Jul 11, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] update nec driver to new ac97
parent
f9e8abe8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
32 deletions
+36
-32
sound/oss/nec_vrc5477.c
sound/oss/nec_vrc5477.c
+36
-32
No files found.
sound/oss/nec_vrc5477.c
View file @
2641853b
...
@@ -194,7 +194,7 @@ struct vrc5477_ac97_state {
...
@@ -194,7 +194,7 @@ struct vrc5477_ac97_state {
struct
proc_dir_entry
*
ac97_ps
;
struct
proc_dir_entry
*
ac97_ps
;
#endif
/* VRC5477_AC97_DEBUG */
#endif
/* VRC5477_AC97_DEBUG */
struct
ac97_codec
codec
;
struct
ac97_codec
*
codec
;
unsigned
dacChannels
,
adcChannels
;
unsigned
dacChannels
,
adcChannels
;
unsigned
short
dacRate
,
adcRate
;
unsigned
short
dacRate
,
adcRate
;
...
@@ -385,7 +385,7 @@ static void vrc5477_ac97_delay(int msec)
...
@@ -385,7 +385,7 @@ static void vrc5477_ac97_delay(int msec)
static
void
set_adc_rate
(
struct
vrc5477_ac97_state
*
s
,
unsigned
rate
)
static
void
set_adc_rate
(
struct
vrc5477_ac97_state
*
s
,
unsigned
rate
)
{
{
wrcodec
(
&
s
->
codec
,
AC97_PCM_LR_ADC_RATE
,
rate
);
wrcodec
(
s
->
codec
,
AC97_PCM_LR_ADC_RATE
,
rate
);
s
->
adcRate
=
rate
;
s
->
adcRate
=
rate
;
}
}
...
@@ -393,8 +393,8 @@ static void set_adc_rate(struct vrc5477_ac97_state *s, unsigned rate)
...
@@ -393,8 +393,8 @@ static void set_adc_rate(struct vrc5477_ac97_state *s, unsigned rate)
static
void
set_dac_rate
(
struct
vrc5477_ac97_state
*
s
,
unsigned
rate
)
static
void
set_dac_rate
(
struct
vrc5477_ac97_state
*
s
,
unsigned
rate
)
{
{
if
(
s
->
extended_status
&
AC97_EXTSTAT_VRA
)
{
if
(
s
->
extended_status
&
AC97_EXTSTAT_VRA
)
{
wrcodec
(
&
s
->
codec
,
AC97_PCM_FRONT_DAC_RATE
,
rate
);
wrcodec
(
s
->
codec
,
AC97_PCM_FRONT_DAC_RATE
,
rate
);
s
->
dacRate
=
rdcodec
(
&
s
->
codec
,
AC97_PCM_FRONT_DAC_RATE
);
s
->
dacRate
=
rdcodec
(
s
->
codec
,
AC97_PCM_FRONT_DAC_RATE
);
}
}
}
}
...
@@ -865,7 +865,7 @@ static int vrc5477_ac97_open_mixdev(struct inode *inode, struct file *file)
...
@@ -865,7 +865,7 @@ static int vrc5477_ac97_open_mixdev(struct inode *inode, struct file *file)
if
(
list
==
&
devs
)
if
(
list
==
&
devs
)
return
-
ENODEV
;
return
-
ENODEV
;
s
=
list_entry
(
list
,
struct
vrc5477_ac97_state
,
devs
);
s
=
list_entry
(
list
,
struct
vrc5477_ac97_state
,
devs
);
if
(
s
->
codec
.
dev_mixer
==
minor
)
if
(
s
->
codec
->
dev_mixer
==
minor
)
break
;
break
;
}
}
file
->
private_data
=
s
;
file
->
private_data
=
s
;
...
@@ -889,7 +889,7 @@ static int vrc5477_ac97_ioctl_mixdev(struct inode *inode, struct file *file,
...
@@ -889,7 +889,7 @@ static int vrc5477_ac97_ioctl_mixdev(struct inode *inode, struct file *file,
{
{
struct
vrc5477_ac97_state
*
s
=
struct
vrc5477_ac97_state
*
s
=
(
struct
vrc5477_ac97_state
*
)
file
->
private_data
;
(
struct
vrc5477_ac97_state
*
)
file
->
private_data
;
struct
ac97_codec
*
codec
=
&
s
->
codec
;
struct
ac97_codec
*
codec
=
s
->
codec
;
return
mixdev_ioctl
(
codec
,
cmd
,
arg
);
return
mixdev_ioctl
(
codec
,
cmd
,
arg
);
}
}
...
@@ -1187,7 +1187,7 @@ copy_dac_from_user(struct vrc5477_ac97_state *s,
...
@@ -1187,7 +1187,7 @@ copy_dac_from_user(struct vrc5477_ac97_state *s,
#endif
#endif
count
-=
copyCount
;
count
-=
copyCount
;
totalCopyCount
=+
copyCount
;
totalCopyCount
+=
copyCount
;
avail
-=
copyFragCount
;
avail
-=
copyFragCount
;
totalCopyFragCount
+=
copyFragCount
;
totalCopyFragCount
+=
copyFragCount
;
...
@@ -1563,7 +1563,7 @@ static int vrc5477_ac97_ioctl(struct inode *inode, struct file *file,
...
@@ -1563,7 +1563,7 @@ static int vrc5477_ac97_ioctl(struct inode *inode, struct file *file,
return
-
EINVAL
;
return
-
EINVAL
;
}
}
return
mixdev_ioctl
(
&
s
->
codec
,
cmd
,
arg
);
return
mixdev_ioctl
(
s
->
codec
,
cmd
,
arg
);
}
}
...
@@ -1789,7 +1789,7 @@ static int proc_vrc5477_ac97_dump (char *buf, char **start, off_t fpos,
...
@@ -1789,7 +1789,7 @@ static int proc_vrc5477_ac97_dump (char *buf, char **start, off_t fpos,
len
+=
sprintf
(
buf
+
len
,
"----------------------
\n
"
);
len
+=
sprintf
(
buf
+
len
,
"----------------------
\n
"
);
for
(
cnt
=
0
;
cnt
<=
0x7e
;
cnt
=
cnt
+
2
)
for
(
cnt
=
0
;
cnt
<=
0x7e
;
cnt
=
cnt
+
2
)
len
+=
sprintf
(
buf
+
len
,
"reg %02x = %04x
\n
"
,
len
+=
sprintf
(
buf
+
len
,
"reg %02x = %04x
\n
"
,
cnt
,
rdcodec
(
&
s
->
codec
,
cnt
));
cnt
,
rdcodec
(
s
->
codec
,
cnt
));
if
(
fpos
>=
len
){
if
(
fpos
>=
len
){
*
start
=
buf
;
*
start
=
buf
;
...
@@ -1843,11 +1843,13 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
...
@@ -1843,11 +1843,13 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
s
->
io
=
pci_resource_start
(
pcidev
,
0
);
s
->
io
=
pci_resource_start
(
pcidev
,
0
);
s
->
irq
=
pcidev
->
irq
;
s
->
irq
=
pcidev
->
irq
;
s
->
codec
.
private_data
=
s
;
s
->
codec
=
ac97_alloc_codec
();
s
->
codec
.
id
=
0
;
s
->
codec
.
codec_read
=
rdcodec
;
s
->
codec
->
private_data
=
s
;
s
->
codec
.
codec_write
=
wrcodec
;
s
->
codec
->
id
=
0
;
s
->
codec
.
codec_wait
=
waitcodec
;
s
->
codec
->
codec_read
=
rdcodec
;
s
->
codec
->
codec_write
=
wrcodec
;
s
->
codec
->
codec_wait
=
waitcodec
;
/* setting some other default values such as
/* setting some other default values such as
* adcChannels, adcRate is done in open() so that
* adcChannels, adcRate is done in open() so that
...
@@ -1855,7 +1857,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
...
@@ -1855,7 +1857,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
*/
*/
/* test if get response from ac97, if not return */
/* test if get response from ac97, if not return */
if
(
ac97_codec_not_present
(
&
(
s
->
codec
)
))
{
if
(
ac97_codec_not_present
(
s
->
codec
))
{
printk
(
KERN_ERR
PFX
"no ac97 codec
\n
"
);
printk
(
KERN_ERR
PFX
"no ac97 codec
\n
"
);
goto
err_region
;
goto
err_region
;
...
@@ -1878,7 +1880,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
...
@@ -1878,7 +1880,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
/* register devices */
/* register devices */
if
((
s
->
dev_audio
=
register_sound_dsp
(
&
vrc5477_ac97_audio_fops
,
-
1
))
<
0
)
if
((
s
->
dev_audio
=
register_sound_dsp
(
&
vrc5477_ac97_audio_fops
,
-
1
))
<
0
)
goto
err_dev1
;
goto
err_dev1
;
if
((
s
->
codec
.
dev_mixer
=
if
((
s
->
codec
->
dev_mixer
=
register_sound_mixer
(
&
vrc5477_ac97_mixer_fops
,
-
1
))
<
0
)
register_sound_mixer
(
&
vrc5477_ac97_mixer_fops
,
-
1
))
<
0
)
goto
err_dev2
;
goto
err_dev2
;
...
@@ -1899,22 +1901,22 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
...
@@ -1899,22 +1901,22 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
while
(
inl
(
s
->
io
+
VRC5477_ACLINK_CTRL
)
&
VRC5477_ACLINK_CTRL_RST_ON
);
while
(
inl
(
s
->
io
+
VRC5477_ACLINK_CTRL
)
&
VRC5477_ACLINK_CTRL_RST_ON
);
/* codec init */
/* codec init */
if
(
!
ac97_probe_codec
(
&
s
->
codec
))
if
(
!
ac97_probe_codec
(
s
->
codec
))
goto
err_dev3
;
goto
err_dev3
;
#ifdef VRC5477_AC97_DEBUG
#ifdef VRC5477_AC97_DEBUG
sprintf
(
proc_str
,
"driver/%s/%d/ac97"
,
sprintf
(
proc_str
,
"driver/%s/%d/ac97"
,
VRC5477_AC97_MODULE_NAME
,
s
->
codec
.
id
);
VRC5477_AC97_MODULE_NAME
,
s
->
codec
->
id
);
s
->
ac97_ps
=
create_proc_read_entry
(
proc_str
,
0
,
NULL
,
s
->
ac97_ps
=
create_proc_read_entry
(
proc_str
,
0
,
NULL
,
ac97_read_proc
,
&
s
->
codec
);
ac97_read_proc
,
s
->
codec
);
/* TODO : why this proc file does not show up? */
/* TODO : why this proc file does not show up? */
#endif
#endif
/* Try to enable variable rate audio mode. */
/* Try to enable variable rate audio mode. */
wrcodec
(
&
s
->
codec
,
AC97_EXTENDED_STATUS
,
wrcodec
(
s
->
codec
,
AC97_EXTENDED_STATUS
,
rdcodec
(
&
s
->
codec
,
AC97_EXTENDED_STATUS
)
|
AC97_EXTSTAT_VRA
);
rdcodec
(
s
->
codec
,
AC97_EXTENDED_STATUS
)
|
AC97_EXTSTAT_VRA
);
/* Did we enable it? */
/* Did we enable it? */
if
(
rdcodec
(
&
s
->
codec
,
AC97_EXTENDED_STATUS
)
&
AC97_EXTSTAT_VRA
)
if
(
rdcodec
(
s
->
codec
,
AC97_EXTENDED_STATUS
)
&
AC97_EXTSTAT_VRA
)
s
->
extended_status
|=
AC97_EXTSTAT_VRA
;
s
->
extended_status
|=
AC97_EXTSTAT_VRA
;
else
{
else
{
s
->
dacRate
=
48000
;
s
->
dacRate
=
48000
;
...
@@ -1923,17 +1925,17 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
...
@@ -1923,17 +1925,17 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
}
}
/* let us get the default volumne louder */
/* let us get the default volumne louder */
wrcodec
(
&
s
->
codec
,
0x2
,
0x1010
);
/* master volume, middle */
wrcodec
(
s
->
codec
,
0x2
,
0x1010
);
/* master volume, middle */
wrcodec
(
&
s
->
codec
,
0xc
,
0x10
);
/* phone volume, middle */
wrcodec
(
s
->
codec
,
0xc
,
0x10
);
/* phone volume, middle */
// wrcodec(
&
s->codec, 0xe, 0x10); /* misc volume, middle */
// wrcodec(s->codec, 0xe, 0x10); /* misc volume, middle */
wrcodec
(
&
s
->
codec
,
0x10
,
0x8000
);
/* line-in 2 line-out disable */
wrcodec
(
s
->
codec
,
0x10
,
0x8000
);
/* line-in 2 line-out disable */
wrcodec
(
&
s
->
codec
,
0x18
,
0x0707
);
/* PCM out (line out) middle */
wrcodec
(
s
->
codec
,
0x18
,
0x0707
);
/* PCM out (line out) middle */
/* by default we select line in the input */
/* by default we select line in the input */
wrcodec
(
&
s
->
codec
,
0x1a
,
0x0404
);
wrcodec
(
s
->
codec
,
0x1a
,
0x0404
);
wrcodec
(
&
s
->
codec
,
0x1c
,
0x0f0f
);
wrcodec
(
s
->
codec
,
0x1c
,
0x0f0f
);
wrcodec
(
&
s
->
codec
,
0x1e
,
0x07
);
wrcodec
(
s
->
codec
,
0x1e
,
0x07
);
/* enable the master interrupt but disable all others */
/* enable the master interrupt but disable all others */
outl
(
VRC5477_INT_MASK_NMASK
,
s
->
io
+
VRC5477_INT_MASK
);
outl
(
VRC5477_INT_MASK_NMASK
,
s
->
io
+
VRC5477_INT_MASK
);
...
@@ -1949,7 +1951,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
...
@@ -1949,7 +1951,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
return
0
;
return
0
;
err_dev3:
err_dev3:
unregister_sound_mixer
(
s
->
codec
.
dev_mixer
);
unregister_sound_mixer
(
s
->
codec
->
dev_mixer
);
err_dev2:
err_dev2:
unregister_sound_dsp
(
s
->
dev_audio
);
unregister_sound_dsp
(
s
->
dev_audio
);
err_dev1:
err_dev1:
...
@@ -1958,6 +1960,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
...
@@ -1958,6 +1960,7 @@ static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
err_irq:
err_irq:
release_region
(
s
->
io
,
pci_resource_len
(
pcidev
,
0
));
release_region
(
s
->
io
,
pci_resource_len
(
pcidev
,
0
));
err_region:
err_region:
ac97_release_codec
(
codec
);
kfree
(
s
);
kfree
(
s
);
return
-
1
;
return
-
1
;
}
}
...
@@ -1979,7 +1982,8 @@ static void __devinit vrc5477_ac97_remove(struct pci_dev *dev)
...
@@ -1979,7 +1982,8 @@ static void __devinit vrc5477_ac97_remove(struct pci_dev *dev)
free_irq
(
s
->
irq
,
s
);
free_irq
(
s
->
irq
,
s
);
release_region
(
s
->
io
,
pci_resource_len
(
dev
,
0
));
release_region
(
s
->
io
,
pci_resource_len
(
dev
,
0
));
unregister_sound_dsp
(
s
->
dev_audio
);
unregister_sound_dsp
(
s
->
dev_audio
);
unregister_sound_mixer
(
s
->
codec
.
dev_mixer
);
unregister_sound_mixer
(
s
->
codec
->
dev_mixer
);
ac97_release_codec
(
s
->
codec
);
kfree
(
s
);
kfree
(
s
);
pci_set_drvdata
(
dev
,
NULL
);
pci_set_drvdata
(
dev
,
NULL
);
}
}
...
...
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