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
701fa1ec
Commit
701fa1ec
authored
Apr 03, 2003
by
Adam Belay
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALSA DT019X PnP Updates
Converts this driver to the pnp api.
parent
8faa56b9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
146 deletions
+105
-146
sound/isa/dt019x.c
sound/isa/dt019x.c
+105
-146
No files found.
sound/isa/dt019x.c
View file @
701fa1ec
...
@@ -25,11 +25,7 @@
...
@@ -25,11 +25,7 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/sched.h>
#include <linux/sched.h>
#include <linux/wait.h>
#include <linux/wait.h>
#ifndef LINUX_ISAPNP_H
#include <linux/pnp.h>
#include <linux/isapnp.h>
#define isapnp_card pci_bus
#define isapnp_dev pci_dev
#endif
#include <sound/core.h>
#include <sound/core.h>
#define SNDRV_GET_ID
#define SNDRV_GET_ID
#include <sound/initval.h>
#include <sound/initval.h>
...
@@ -87,159 +83,124 @@ MODULE_PARM_DESC(dma8, "8-bit DMA # for dt019x driver.");
...
@@ -87,159 +83,124 @@ MODULE_PARM_DESC(dma8, "8-bit DMA # for dt019x driver.");
MODULE_PARM_SYNTAX
(
dma8
,
SNDRV_DMA8_DESC
);
MODULE_PARM_SYNTAX
(
dma8
,
SNDRV_DMA8_DESC
);
struct
snd_card_dt019x
{
struct
snd_card_dt019x
{
#ifdef __ISAPNP__
struct
pnp_dev
*
dev
;
struct
isapnp_dev
*
dev
;
struct
pnp_dev
*
devmpu
;
struct
isapnp_dev
*
devmpu
;
struct
pnp_dev
*
devopl
;
struct
isapnp_dev
*
devopl
;
#endif
/* __ISAPNP__ */
};
};
static
snd_card_t
*
snd_dt019x_cards
[
SNDRV_CARDS
]
=
SNDRV_DEFAULT_PTR
;
static
struct
pnp_card_device_id
snd_dt019x_pnpids
[]
__devinitdata
=
{
#ifdef __ISAPNP__
static
struct
isapnp_card
*
snd_dt019x_isapnp_cards
[
SNDRV_CARDS
]
__devinitdata
=
SNDRV_DEFAULT_PTR
;
static
const
struct
isapnp_card_id
*
snd_dt019x_isapnp_id
[
SNDRV_CARDS
]
__devinitdata
=
SNDRV_DEFAULT_PTR
;
static
struct
isapnp_card_id
snd_dt019x_pnpids
[]
__devinitdata
=
{
/* DT197A30 */
/* DT197A30 */
{
{
.
id
=
"RWB1688"
,
.
devs
=
{
{
"@@@0001"
},
{
"@X@0001"
},
{
"@H@0001"
},
}
},
ISAPNP_CARD_ID
(
'R'
,
'W'
,
'B'
,
0x1688
),
.
devs
=
{
ISAPNP_DEVICE_ID
(
'@'
,
'@'
,
'@'
,
0x0001
),
ISAPNP_DEVICE_ID
(
'@'
,
'X'
,
'@'
,
0x0001
),
ISAPNP_DEVICE_ID
(
'@'
,
'H'
,
'@'
,
0x0001
)
}
},
/* DT0196 / ALS-007 */
/* DT0196 / ALS-007 */
{
{
.
id
=
"ALS0007"
,
.
devs
=
{
{
"@@@0001"
},
{
"@X@0001"
},
{
"@H@0001"
},
}
},
ISAPNP_CARD_ID
(
'A'
,
'L'
,
'S'
,
0x0007
),
{
.
id
=
""
,
}
.
devs
=
{
ISAPNP_DEVICE_ID
(
'@'
,
'@'
,
'@'
,
0x0001
),
ISAPNP_DEVICE_ID
(
'@'
,
'X'
,
'@'
,
0x0001
),
ISAPNP_DEVICE_ID
(
'@'
,
'H'
,
'@'
,
0x0001
)
}
},
{
ISAPNP_CARD_END
,
}
};
};
ISAPNP_CARD_TABLE
(
snd_dt019x_pnpids
);
MODULE_DEVICE_TABLE
(
pnp_card
,
snd_dt019x_pnpids
);
#endif
/* __ISAPNP__ */
#define DRIVER_NAME "snd-card-dt019x"
#define DRIVER_NAME "snd-card-dt019x"
#ifdef __ISAPNP__
static
int
__init
snd_card_dt019x_isapnp
(
int
dev
,
struct
snd_card_dt019x
*
acard
,
static
int
__init
snd_card_dt019x_isapnp
(
int
dev
,
struct
snd_card_dt019x
*
acard
)
struct
pnp_card_link
*
card
,
const
struct
pnp_card_device_id
*
pid
)
{
{
const
struct
isapnp_card_id
*
id
=
snd_dt019x_isapnp_id
[
dev
];
struct
pnp_dev
*
pdev
;
struct
isapnp_card
*
card
=
snd_dt019x_isapnp_cards
[
dev
];
struct
pnp_resource_table
*
cfg
=
kmalloc
(
sizeof
(
struct
pnp_resource_table
),
GFP_KERNEL
);
struct
isapnp_dev
*
pdev
;
int
err
;
acard
->
dev
=
isapnp_find_dev
(
card
,
id
->
devs
[
0
].
vendor
,
id
->
devs
[
0
].
function
,
NULL
);
if
(
!
cfg
)
if
(
acard
->
dev
->
active
)
{
return
-
ENOMEM
;
acard
->
dev
=
NULL
;
return
-
EBUSY
;
acard
->
dev
=
pnp_request_card_device
(
card
,
pid
->
devs
[
0
].
id
,
NULL
);
}
if
(
acard
->
dev
==
NULL
)
{
acard
->
devmpu
=
isapnp_find_dev
(
card
,
id
->
devs
[
1
].
vendor
,
id
->
devs
[
1
].
function
,
NULL
);
kfree
(
cfg
);
if
(
acard
->
devmpu
->
active
)
{
return
-
ENODEV
;
acard
->
dev
=
acard
->
devmpu
=
NULL
;
return
-
EBUSY
;
}
acard
->
devopl
=
isapnp_find_dev
(
card
,
id
->
devs
[
2
].
vendor
,
id
->
devs
[
2
].
function
,
NULL
);
if
(
acard
->
devopl
->
active
)
{
acard
->
dev
=
acard
->
devmpu
=
acard
->
devopl
=
NULL
;
return
-
EBUSY
;
}
}
acard
->
devmpu
=
pnp_request_card_device
(
card
,
pid
->
devs
[
1
].
id
,
NULL
);
acard
->
devopl
=
pnp_request_card_device
(
card
,
pid
->
devs
[
2
].
id
,
NULL
);
pdev
=
acard
->
dev
;
pdev
=
acard
->
dev
;
if
(
!
pdev
||
pdev
->
prepare
(
pdev
)
<
0
)
pnp_init_resource_table
(
cfg
);
return
-
EAGAIN
;
if
(
port
[
dev
]
!=
SNDRV_AUTO_PORT
)
if
(
port
[
dev
]
!=
SNDRV_AUTO_PORT
)
isapnp_resource_change
(
&
pdev
->
resource
[
0
],
port
[
dev
],
16
);
pnp_resource_change
(
&
cfg
->
port_
resource
[
0
],
port
[
dev
],
16
);
if
(
dma8
[
dev
]
!=
SNDRV_AUTO_DMA
)
if
(
dma8
[
dev
]
!=
SNDRV_AUTO_DMA
)
isapnp_resource_change
(
&
pdev
->
dma_resource
[
0
],
dma8
[
dev
],
pnp_resource_change
(
&
cfg
->
dma_resource
[
0
],
dma8
[
dev
],
1
);
1
);
if
(
irq
[
dev
]
!=
SNDRV_AUTO_IRQ
)
if
(
irq
[
dev
]
!=
SNDRV_AUTO_IRQ
)
isapnp_resource_change
(
&
pdev
->
irq_resource
[
0
],
irq
[
dev
],
1
);
pnp_resource_change
(
&
cfg
->
irq_resource
[
0
],
irq
[
dev
],
1
);
if
(
pdev
->
activate
(
pdev
)
<
0
)
{
if
((
pnp_manual_config_dev
(
pdev
,
cfg
,
0
))
<
0
)
printk
(
KERN_ERR
PFX
"DT-019X AUDIO isapnp configure failure
\n
"
);
printk
(
KERN_ERR
PFX
"DT-019X AUDIO the requested resources are invalid, using auto config
\n
"
);
return
-
EBUSY
;
err
=
pnp_activate_dev
(
pdev
);
if
(
err
<
0
)
{
printk
(
KERN_ERR
PFX
"DT-019X AUDIO pnp configure failure
\n
"
);
kfree
(
cfg
);
return
err
;
}
}
port
[
dev
]
=
pdev
->
resource
[
0
].
start
;
dma8
[
dev
]
=
pdev
->
dma_resource
[
0
].
start
;
port
[
dev
]
=
pnp_port_start
(
pdev
,
0
);
irq
[
dev
]
=
pdev
->
irq_resource
[
0
].
start
;
dma8
[
dev
]
=
pnp_dma
(
pdev
,
0
);
irq
[
dev
]
=
pnp_irq
(
pdev
,
0
);
snd_printdd
(
"dt019x: found audio interface: port=0x%lx, irq=0x%lx, dma=0x%lx
\n
"
,
snd_printdd
(
"dt019x: found audio interface: port=0x%lx, irq=0x%lx, dma=0x%lx
\n
"
,
port
[
dev
],
irq
[
dev
],
dma8
[
dev
]);
port
[
dev
],
irq
[
dev
],
dma8
[
dev
]);
pdev
=
acard
->
devmpu
;
pdev
=
acard
->
devmpu
;
if
(
!
pdev
||
pdev
->
prepare
(
pdev
)
<
0
)
return
0
;
if
(
pdev
!=
NULL
)
{
pnp_init_resource_table
(
cfg
);
if
(
mpu_port
[
dev
]
!=
SNDRV_AUTO_PORT
)
if
(
mpu_port
[
dev
]
!=
SNDRV_AUTO_PORT
)
isapnp_resource_change
(
&
pdev
->
resource
[
0
],
mpu_port
[
dev
],
pnp_resource_change
(
&
cfg
->
port_resource
[
0
],
mpu_port
[
dev
],
2
);
2
);
if
(
mpu_irq
[
dev
]
!=
SNDRV_AUTO_IRQ
)
if
(
mpu_irq
[
dev
]
!=
SNDRV_AUTO_IRQ
)
isapnp_resource_change
(
&
pdev
->
irq_resource
[
0
],
mpu_irq
[
dev
],
pnp_resource_change
(
&
cfg
->
irq_resource
[
0
],
mpu_irq
[
dev
],
1
);
1
);
if
((
pnp_manual_config_dev
(
pdev
,
cfg
,
0
))
<
0
)
printk
(
KERN_ERR
PFX
"DT-019X MPU401 the requested resources are invalid, using auto config
\n
"
);
if
(
pdev
->
activate
(
pdev
)
<
0
)
{
err
=
pnp_activate_dev
(
pdev
);
printk
(
KERN_ERR
PFX
"DT-019X MPU-401 isapnp configure failure
\n
"
);
if
(
err
<
0
)
mpu_port
[
dev
]
=
-
1
;
goto
__mpu_error
;
acard
->
devmpu
=
NULL
;
mpu_port
[
dev
]
=
pnp_port_start
(
pdev
,
0
);
}
else
{
mpu_irq
[
dev
]
=
pnp_irq
(
pdev
,
0
);
mpu_port
[
dev
]
=
pdev
->
resource
[
0
].
start
;
mpu_irq
[
dev
]
=
pdev
->
irq_resource
[
0
].
start
;
snd_printdd
(
"dt019x: found MPU-401: port=0x%lx, irq=0x%lx
\n
"
,
snd_printdd
(
"dt019x: found MPU-401: port=0x%lx, irq=0x%lx
\n
"
,
mpu_port
[
dev
],
mpu_irq
[
dev
]);
mpu_port
[
dev
],
mpu_irq
[
dev
]);
}
else
{
__mpu_error:
if
(
pdev
)
{
pnp_release_card_device
(
pdev
);
printk
(
KERN_ERR
PFX
"DT-019X MPU401 pnp configure failure, skipping
\n
"
);
}
acard
->
devmpu
=
NULL
;
mpu_port
[
dev
]
=
-
1
;
}
}
pdev
=
acard
->
devopl
;
pdev
=
acard
->
devopl
;
if
(
!
pdev
||
pdev
->
prepare
(
pdev
)
<
0
)
if
(
pdev
!=
NULL
)
{
return
0
;
pnp_init_resource_table
(
cfg
);
if
(
fm_port
[
dev
]
!=
SNDRV_AUTO_PORT
)
if
(
fm_port
[
dev
]
!=
SNDRV_AUTO_PORT
)
isapnp_resource_change
(
&
pdev
->
resource
[
0
],
fm_port
[
dev
],
4
);
pnp_resource_change
(
&
cfg
->
port_resource
[
0
],
fm_port
[
dev
],
4
);
if
((
pnp_manual_config_dev
(
pdev
,
cfg
,
0
))
<
0
)
if
(
pdev
->
activate
(
pdev
)
<
0
)
{
printk
(
KERN_ERR
PFX
"DT-019X OPL3 the requested resources are invalid, using auto config
\n
"
);
printk
(
KERN_ERR
PFX
"DT-019X OPL3 isapnp configure failure
\n
"
);
err
=
pnp_activate_dev
(
pdev
);
fm_port
[
dev
]
=
-
1
;
if
(
err
<
0
)
acard
->
devopl
=
NULL
;
goto
__fm_error
;
}
else
{
fm_port
[
dev
]
=
pnp_port_start
(
pdev
,
0
);
fm_port
[
dev
]
=
pdev
->
resource
[
0
].
start
;
snd_printdd
(
"dt019x: found OPL3 synth: port=0x%lx
\n
"
,
fm_port
[
dev
]);
snd_printdd
(
"dt019x: found OPL3 synth: port=0x%lx
\n
"
,
fm_port
[
dev
]);
}
else
{
__fm_error:
if
(
pdev
)
{
pnp_release_card_device
(
pdev
);
printk
(
KERN_ERR
PFX
"DT-019X OPL3 pnp configure failure, skipping
\n
"
);
}
}
return
0
;
}
static
void
snd_card_dt019x_deactivate
(
struct
snd_card_dt019x
*
acard
)
{
if
(
acard
->
dev
)
{
acard
->
dev
->
deactivate
(
acard
->
dev
);
acard
->
dev
=
NULL
;
}
if
(
acard
->
devmpu
)
{
acard
->
devmpu
->
deactivate
(
acard
->
devmpu
);
acard
->
devmpu
=
NULL
;
}
if
(
acard
->
devopl
)
{
acard
->
devopl
->
deactivate
(
acard
->
devopl
);
acard
->
devopl
=
NULL
;
acard
->
devopl
=
NULL
;
fm_port
[
dev
]
=
-
1
;
}
}
}
#endif
/* __ISAPNP__ */
static
void
snd_card_dt019x_free
(
snd_card_t
*
card
)
kfree
(
cfg
);
{
return
0
;
struct
snd_card_dt019x
*
acard
=
(
struct
snd_card_dt019x
*
)
card
->
private_data
;
if
(
acard
!=
NULL
)
{
#ifdef __ISAPNP__
snd_card_dt019x_deactivate
(
acard
);
#endif
/* __ISAPNP__ */
}
}
}
static
int
__init
snd_card_dt019x_probe
(
int
dev
)
static
int
__init
snd_card_dt019x_probe
(
int
dev
,
struct
pnp_card_link
*
pcard
,
const
struct
pnp_card_device_id
*
pid
)
{
{
int
error
;
int
error
;
sb_t
*
chip
;
sb_t
*
chip
;
...
@@ -251,18 +212,11 @@ static int __init snd_card_dt019x_probe(int dev)
...
@@ -251,18 +212,11 @@ static int __init snd_card_dt019x_probe(int dev)
sizeof
(
struct
snd_card_dt019x
)))
==
NULL
)
sizeof
(
struct
snd_card_dt019x
)))
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
acard
=
(
struct
snd_card_dt019x
*
)
card
->
private_data
;
acard
=
(
struct
snd_card_dt019x
*
)
card
->
private_data
;
card
->
private_free
=
snd_card_dt019x_free
;
#ifdef __ISAPNP__
if
((
error
=
snd_card_dt019x_isapnp
(
dev
,
acard
,
pcard
,
pid
)))
{
if
((
error
=
snd_card_dt019x_isapnp
(
dev
,
acard
)))
{
snd_card_free
(
card
);
snd_card_free
(
card
);
return
error
;
return
error
;
}
}
#else
printk
(
KERN_ERR
PFX
"you have to enable PnP support ...
\n
"
);
snd_card_free
(
card
);
return
-
ENOSYS
;
#endif
/* __ISAPNP__ */
if
((
error
=
snd_sbdsp_create
(
card
,
port
[
dev
],
if
((
error
=
snd_sbdsp_create
(
card
,
port
[
dev
],
irq
[
dev
],
irq
[
dev
],
...
@@ -324,13 +278,12 @@ static int __init snd_card_dt019x_probe(int dev)
...
@@ -324,13 +278,12 @@ static int __init snd_card_dt019x_probe(int dev)
snd_card_free
(
card
);
snd_card_free
(
card
);
return
error
;
return
error
;
}
}
snd_dt019x_cards
[
dev
]
=
card
;
pnp_set_card_drvdata
(
pcard
,
card
)
;
return
0
;
return
0
;
}
}
#ifdef __ISAPNP__
static
int
__init
snd_dt019x_pnp_probe
(
struct
pnp_card_link
*
card
,
static
int
__init
snd_dt019x_isapnp_detect
(
struct
isapnp_card
*
card
,
const
struct
pnp_card_device_id
*
pid
)
const
struct
isapnp_card_id
*
id
)
{
{
static
int
dev
;
static
int
dev
;
int
res
;
int
res
;
...
@@ -338,9 +291,7 @@ static int __init snd_dt019x_isapnp_detect(struct isapnp_card *card,
...
@@ -338,9 +291,7 @@ static int __init snd_dt019x_isapnp_detect(struct isapnp_card *card,
for
(
;
dev
<
SNDRV_CARDS
;
dev
++
)
{
for
(
;
dev
<
SNDRV_CARDS
;
dev
++
)
{
if
(
!
enable
[
dev
])
if
(
!
enable
[
dev
])
continue
;
continue
;
snd_dt019x_isapnp_cards
[
dev
]
=
card
;
res
=
snd_card_dt019x_probe
(
dev
,
card
,
pid
);
snd_dt019x_isapnp_id
[
dev
]
=
id
;
res
=
snd_card_dt019x_probe
(
dev
);
if
(
res
<
0
)
if
(
res
<
0
)
return
res
;
return
res
;
dev
++
;
dev
++
;
...
@@ -348,17 +299,28 @@ static int __init snd_dt019x_isapnp_detect(struct isapnp_card *card,
...
@@ -348,17 +299,28 @@ static int __init snd_dt019x_isapnp_detect(struct isapnp_card *card,
}
}
return
-
ENODEV
;
return
-
ENODEV
;
}
}
#endif
/* __ISAPNP__ */
static
void
__devexit
snd_dt019x_pnp_remove
(
struct
pnp_card_link
*
pcard
)
{
snd_card_t
*
card
=
(
snd_card_t
*
)
pnp_get_card_drvdata
(
pcard
);
snd_card_disconnect
(
card
);
snd_card_free_in_thread
(
card
);
}
static
struct
pnp_card_driver
dt019x_pnpc_driver
=
{
.
flags
=
PNP_DRIVER_RES_DISABLE
,
.
name
=
"dt019x"
,
.
id_table
=
snd_dt019x_pnpids
,
.
probe
=
snd_dt019x_pnp_probe
,
.
remove
=
__devexit_p
(
snd_dt019x_pnp_remove
),
};
static
int
__init
alsa_card_dt019x_init
(
void
)
static
int
__init
alsa_card_dt019x_init
(
void
)
{
{
int
cards
=
0
;
int
cards
=
0
;
#ifdef __ISAPNP__
cards
+=
pnp_register_card_driver
(
&
dt019x_pnpc_driver
);
cards
+=
isapnp_probe_cards
(
snd_dt019x_pnpids
,
snd_dt019x_isapnp_detect
);
#else
printk
(
KERN_ERR
PFX
"you have to enable ISA PnP support.
\n
"
);
#endif
#ifdef MODULE
#ifdef MODULE
if
(
!
cards
)
if
(
!
cards
)
printk
(
KERN_ERR
"no DT-019X / ALS-007 based soundcards found
\n
"
);
printk
(
KERN_ERR
"no DT-019X / ALS-007 based soundcards found
\n
"
);
...
@@ -368,10 +330,7 @@ static int __init alsa_card_dt019x_init(void)
...
@@ -368,10 +330,7 @@ static int __init alsa_card_dt019x_init(void)
static
void
__exit
alsa_card_dt019x_exit
(
void
)
static
void
__exit
alsa_card_dt019x_exit
(
void
)
{
{
int
dev
;
pnp_unregister_card_driver
(
&
dt019x_pnpc_driver
);
for
(
dev
=
0
;
dev
<
SNDRV_CARDS
;
dev
++
)
snd_card_free
(
snd_dt019x_cards
[
dev
]);
}
}
module_init
(
alsa_card_dt019x_init
)
module_init
(
alsa_card_dt019x_init
)
...
...
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