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
dc8aa2e9
Commit
dc8aa2e9
authored
Aug 27, 2008
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amd7930: Convert to pure OF driver.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
5dc2536b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
63 deletions
+20
-63
sound/sparc/amd7930.c
sound/sparc/amd7930.c
+20
-63
No files found.
sound/sparc/amd7930.c
View file @
dc8aa2e9
/*
/*
* Driver for AMD7930 sound chips found on Sparcs.
* Driver for AMD7930 sound chips found on Sparcs.
* Copyright (C) 2002
David S. Miller <davem@redhat.com
>
* Copyright (C) 2002
, 2008 David S. Miller <davem@davemloft.net
>
*
*
* Based entirely upon drivers/sbus/audio/amd7930.c which is:
* Based entirely upon drivers/sbus/audio/amd7930.c which is:
* Copyright (C) 1996,1997 Thomas K. Dyas (tdyas@eden.rutgers.edu)
* Copyright (C) 1996,1997 Thomas K. Dyas (tdyas@eden.rutgers.edu)
...
@@ -35,6 +35,8 @@
...
@@ -35,6 +35,8 @@
#include <linux/init.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/moduleparam.h>
#include <linux/moduleparam.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <sound/core.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm.h>
...
@@ -44,7 +46,6 @@
...
@@ -44,7 +46,6 @@
#include <asm/io.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/irq.h>
#include <asm/sbus.h>
#include <asm/prom.h>
#include <asm/prom.h>
static
int
index
[
SNDRV_CARDS
]
=
SNDRV_DEFAULT_IDX
;
/* Index 0-MAX */
static
int
index
[
SNDRV_CARDS
]
=
SNDRV_DEFAULT_IDX
;
/* Index 0-MAX */
...
@@ -335,8 +336,8 @@ struct snd_amd7930 {
...
@@ -335,8 +336,8 @@ struct snd_amd7930 {
int
pgain
;
int
pgain
;
int
mgain
;
int
mgain
;
struct
of_device
*
op
;
unsigned
int
irq
;
unsigned
int
irq
;
unsigned
int
regs_size
;
struct
snd_amd7930
*
next
;
struct
snd_amd7930
*
next
;
};
};
...
@@ -920,13 +921,16 @@ static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd)
...
@@ -920,13 +921,16 @@ static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd)
static
int
snd_amd7930_free
(
struct
snd_amd7930
*
amd
)
static
int
snd_amd7930_free
(
struct
snd_amd7930
*
amd
)
{
{
struct
of_device
*
op
=
amd
->
op
;
amd7930_idle
(
amd
);
amd7930_idle
(
amd
);
if
(
amd
->
irq
)
if
(
amd
->
irq
)
free_irq
(
amd
->
irq
,
amd
);
free_irq
(
amd
->
irq
,
amd
);
if
(
amd
->
regs
)
if
(
amd
->
regs
)
sbus_iounmap
(
amd
->
regs
,
amd
->
regs_size
);
of_iounmap
(
&
op
->
resource
[
0
],
amd
->
regs
,
resource_size
(
&
op
->
resource
[
0
]));
kfree
(
amd
);
kfree
(
amd
);
...
@@ -945,13 +949,12 @@ static struct snd_device_ops snd_amd7930_dev_ops = {
...
@@ -945,13 +949,12 @@ static struct snd_device_ops snd_amd7930_dev_ops = {
};
};
static
int
__devinit
snd_amd7930_create
(
struct
snd_card
*
card
,
static
int
__devinit
snd_amd7930_create
(
struct
snd_card
*
card
,
struct
resource
*
rp
,
struct
of_device
*
op
,
unsigned
int
reg_size
,
int
irq
,
int
dev
,
int
irq
,
int
dev
,
struct
snd_amd7930
**
ramd
)
struct
snd_amd7930
**
ramd
)
{
{
unsigned
long
flags
;
struct
snd_amd7930
*
amd
;
struct
snd_amd7930
*
amd
;
unsigned
long
flags
;
int
err
;
int
err
;
*
ramd
=
NULL
;
*
ramd
=
NULL
;
...
@@ -961,9 +964,10 @@ static int __devinit snd_amd7930_create(struct snd_card *card,
...
@@ -961,9 +964,10 @@ static int __devinit snd_amd7930_create(struct snd_card *card,
spin_lock_init
(
&
amd
->
lock
);
spin_lock_init
(
&
amd
->
lock
);
amd
->
card
=
card
;
amd
->
card
=
card
;
amd
->
regs_size
=
reg_size
;
amd
->
op
=
op
;
amd
->
regs
=
sbus_ioremap
(
rp
,
0
,
amd
->
regs_size
,
"amd7930"
);
amd
->
regs
=
of_ioremap
(
&
op
->
resource
[
0
],
0
,
resource_size
(
&
op
->
resource
[
0
]),
"amd7930"
);
if
(
!
amd
->
regs
)
{
if
(
!
amd
->
regs
)
{
snd_printk
(
"amd7930-%d: Unable to map chip registers.
\n
"
,
dev
);
snd_printk
(
"amd7930-%d: Unable to map chip registers.
\n
"
,
dev
);
return
-
EIO
;
return
-
EIO
;
...
@@ -1012,12 +1016,15 @@ static int __devinit snd_amd7930_create(struct snd_card *card,
...
@@ -1012,12 +1016,15 @@ static int __devinit snd_amd7930_create(struct snd_card *card,
return
0
;
return
0
;
}
}
static
int
__devinit
amd7930_
attach_common
(
struct
resource
*
rp
,
int
irq
)
static
int
__devinit
amd7930_
sbus_probe
(
struct
of_device
*
op
,
const
struct
of_device_id
*
match
)
{
{
struct
resource
*
rp
=
&
op
->
resource
[
0
];
static
int
dev_num
;
static
int
dev_num
;
struct
snd_card
*
card
;
struct
snd_card
*
card
;
struct
snd_amd7930
*
amd
;
struct
snd_amd7930
*
amd
;
int
err
;
int
err
,
irq
;
irq
=
op
->
irqs
[
0
];
if
(
dev_num
>=
SNDRV_CARDS
)
if
(
dev_num
>=
SNDRV_CARDS
)
return
-
ENODEV
;
return
-
ENODEV
;
...
@@ -1038,8 +1045,7 @@ static int __devinit amd7930_attach_common(struct resource *rp, int irq)
...
@@ -1038,8 +1045,7 @@ static int __devinit amd7930_attach_common(struct resource *rp, int irq)
(
unsigned
long
long
)
rp
->
start
,
(
unsigned
long
long
)
rp
->
start
,
irq
);
irq
);
if
((
err
=
snd_amd7930_create
(
card
,
rp
,
if
((
err
=
snd_amd7930_create
(
card
,
op
,
(
rp
->
end
-
rp
->
start
)
+
1
,
irq
,
dev_num
,
&
amd
))
<
0
)
irq
,
dev_num
,
&
amd
))
<
0
)
goto
out_err
;
goto
out_err
;
...
@@ -1064,42 +1070,6 @@ static int __devinit amd7930_attach_common(struct resource *rp, int irq)
...
@@ -1064,42 +1070,6 @@ static int __devinit amd7930_attach_common(struct resource *rp, int irq)
return
err
;
return
err
;
}
}
static
int
__devinit
amd7930_obio_attach
(
struct
device_node
*
dp
)
{
const
struct
linux_prom_registers
*
regs
;
const
struct
linux_prom_irqs
*
irqp
;
struct
resource
res
,
*
rp
;
int
len
;
irqp
=
of_get_property
(
dp
,
"intr"
,
&
len
);
if
(
!
irqp
)
{
snd_printk
(
"%s: Firmware node lacks IRQ property.
\n
"
,
dp
->
full_name
);
return
-
ENODEV
;
}
regs
=
of_get_property
(
dp
,
"reg"
,
&
len
);
if
(
!
regs
)
{
snd_printk
(
"%s: Firmware node lacks register property.
\n
"
,
dp
->
full_name
);
return
-
ENODEV
;
}
rp
=
&
res
;
rp
->
start
=
regs
->
phys_addr
;
rp
->
end
=
rp
->
start
+
regs
->
reg_size
-
1
;
rp
->
flags
=
IORESOURCE_IO
|
(
regs
->
which_io
&
0xff
);
return
amd7930_attach_common
(
rp
,
irqp
->
pri
);
}
static
int
__devinit
amd7930_sbus_probe
(
struct
of_device
*
dev
,
const
struct
of_device_id
*
match
)
{
struct
sbus_dev
*
sdev
=
to_sbus_device
(
&
dev
->
dev
);
return
amd7930_attach_common
(
&
sdev
->
resource
[
0
],
sdev
->
irqs
[
0
]);
}
static
struct
of_device_id
amd7930_match
[]
=
{
static
struct
of_device_id
amd7930_match
[]
=
{
{
{
.
name
=
"audio"
,
.
name
=
"audio"
,
...
@@ -1115,20 +1085,7 @@ static struct of_platform_driver amd7930_sbus_driver = {
...
@@ -1115,20 +1085,7 @@ static struct of_platform_driver amd7930_sbus_driver = {
static
int
__init
amd7930_init
(
void
)
static
int
__init
amd7930_init
(
void
)
{
{
struct
device_node
*
dp
;
return
of_register_driver
(
&
amd7930_sbus_driver
,
&
of_bus_type
);
/* Try to find the sun4c "audio" node first. */
dp
=
of_find_node_by_path
(
"/"
);
dp
=
dp
->
child
;
while
(
dp
)
{
if
(
!
strcmp
(
dp
->
name
,
"audio"
))
amd7930_obio_attach
(
dp
);
dp
=
dp
->
sibling
;
}
/* Probe each SBUS for amd7930 chips. */
return
of_register_driver
(
&
amd7930_sbus_driver
,
&
sbus_bus_type
);
}
}
static
void
__exit
amd7930_exit
(
void
)
static
void
__exit
amd7930_exit
(
void
)
...
...
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