summaryrefslogtreecommitdiffstats
path: root/sound/sparc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/sparc')
-rw-r--r--sound/sparc/amd7930.c144
-rw-r--r--sound/sparc/cs4231.c31
-rw-r--r--sound/sparc/dbri.c16
3 files changed, 102 insertions, 89 deletions
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index 55493340f46..db3e22efd02 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -46,6 +46,7 @@
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/sbus.h>
+#include <asm/prom.h>
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
@@ -335,7 +336,6 @@ struct snd_amd7930 {
int pgain;
int mgain;
- struct sbus_dev *sdev;
unsigned int irq;
unsigned int regs_size;
struct snd_amd7930 *next;
@@ -946,11 +946,9 @@ static struct snd_device_ops snd_amd7930_dev_ops = {
};
static int __init snd_amd7930_create(struct snd_card *card,
- struct sbus_dev *sdev,
struct resource *rp,
unsigned int reg_size,
- struct linux_prom_irqs *irq_prop,
- int dev,
+ int irq, int dev,
struct snd_amd7930 **ramd)
{
unsigned long flags;
@@ -964,7 +962,6 @@ static int __init snd_amd7930_create(struct snd_card *card,
spin_lock_init(&amd->lock);
amd->card = card;
- amd->sdev = sdev;
amd->regs_size = reg_size;
amd->regs = sbus_ioremap(rp, 0, amd->regs_size, "amd7930");
@@ -975,15 +972,14 @@ static int __init snd_amd7930_create(struct snd_card *card,
amd7930_idle(amd);
- if (request_irq(irq_prop->pri, snd_amd7930_interrupt,
- SA_INTERRUPT | SA_SHIRQ, "amd7930", amd)) {
- snd_printk("amd7930-%d: Unable to grab IRQ %s\n",
- dev,
- __irq_itoa(irq_prop->pri));
+ if (request_irq(irq, snd_amd7930_interrupt,
+ IRQF_DISABLED | IRQF_SHARED, "amd7930", amd)) {
+ snd_printk("amd7930-%d: Unable to grab IRQ %d\n",
+ dev, irq);
snd_amd7930_free(amd);
return -EBUSY;
}
- amd->irq = irq_prop->pri;
+ amd->irq = irq;
amd7930_enable_ints(amd);
@@ -1017,60 +1013,35 @@ static int __init snd_amd7930_create(struct snd_card *card,
return 0;
}
-static int __init amd7930_attach(int prom_node, struct sbus_dev *sdev)
+static int __init amd7930_attach_common(struct resource *rp, int irq)
{
- static int dev;
- struct linux_prom_registers reg_prop;
- struct linux_prom_irqs irq_prop;
- struct resource res, *rp;
+ static int dev_num;
struct snd_card *card;
struct snd_amd7930 *amd;
int err;
- if (dev >= SNDRV_CARDS)
+ if (dev_num >= SNDRV_CARDS)
return -ENODEV;
- if (!enable[dev]) {
- dev++;
+ if (!enable[dev_num]) {
+ dev_num++;
return -ENOENT;
}
- err = prom_getproperty(prom_node, "intr",
- (char *) &irq_prop, sizeof(irq_prop));
- if (err < 0) {
- snd_printk("amd7930-%d: Firmware node lacks IRQ property.\n", dev);
- return -ENODEV;
- }
-
- err = prom_getproperty(prom_node, "reg",
- (char *) &reg_prop, sizeof(reg_prop));
- if (err < 0) {
- snd_printk("amd7930-%d: Firmware node lacks register property.\n", dev);
- return -ENODEV;
- }
-
- if (sdev) {
- rp = &sdev->resource[0];
- } else {
- rp = &res;
- rp->start = reg_prop.phys_addr;
- rp->end = rp->start + reg_prop.reg_size - 1;
- rp->flags = IORESOURCE_IO | (reg_prop.which_io & 0xff);
- }
-
- card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+ card = snd_card_new(index[dev_num], id[dev_num], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
strcpy(card->driver, "AMD7930");
strcpy(card->shortname, "Sun AMD7930");
- sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %s",
+ sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %d",
card->shortname,
rp->flags & 0xffL,
rp->start,
- __irq_itoa(irq_prop.pri));
+ irq);
- if ((err = snd_amd7930_create(card, sdev, rp, reg_prop.reg_size,
- &irq_prop, dev, &amd)) < 0)
+ if ((err = snd_amd7930_create(card, rp,
+ (rp->end - rp->start) + 1,
+ irq, dev_num, &amd)) < 0)
goto out_err;
if ((err = snd_amd7930_pcm(amd)) < 0)
@@ -1085,7 +1056,8 @@ static int __init amd7930_attach(int prom_node, struct sbus_dev *sdev)
amd->next = amd7930_list;
amd7930_list = amd;
- dev++;
+ dev_num++;
+
return 0;
out_err:
@@ -1093,29 +1065,71 @@ out_err:
return err;
}
-static int __init amd7930_init(void)
+static int __init amd7930_obio_attach(struct device_node *dp)
+{
+ struct linux_prom_registers *regs;
+ 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_bus *sbus;
- struct sbus_dev *sdev;
- int node, found;
+ struct sbus_dev *sdev = to_sbus_device(&dev->dev);
- found = 0;
+ return amd7930_attach_common(&sdev->resource[0], sdev->irqs[0]);
+}
+
+static struct of_device_id amd7930_match[] = {
+ {
+ .name = "audio",
+ },
+ {},
+};
+
+static struct of_platform_driver amd7930_sbus_driver = {
+ .name = "audio",
+ .match_table = amd7930_match,
+ .probe = amd7930_sbus_probe,
+};
+
+static int __init amd7930_init(void)
+{
+ struct device_node *dp;
/* Try to find the sun4c "audio" node first. */
- node = prom_getchild(prom_root_node);
- node = prom_searchsiblings(node, "audio");
- if (node && amd7930_attach(node, NULL) == 0)
- found++;
+ dp = of_find_node_by_path("/");
+ dp = dp->child;
+ while (dp) {
+ if (!strcmp(dp->name, "audio"))
+ amd7930_obio_attach(dp);
- /* Probe each SBUS for amd7930 chips. */
- for_all_sbusdev(sdev, sbus) {
- if (!strcmp(sdev->prom_name, "audio")) {
- if (amd7930_attach(sdev->prom_node, sdev) == 0)
- found++;
- }
+ dp = dp->sibling;
}
- return (found > 0) ? 0 : -EIO;
+ /* Probe each SBUS for amd7930 chips. */
+ return of_register_driver(&amd7930_sbus_driver, &sbus_bus_type);
}
static void __exit amd7930_exit(void)
@@ -1131,6 +1145,8 @@ static void __exit amd7930_exit(void)
}
amd7930_list = NULL;
+
+ of_unregister_driver(&amd7930_sbus_driver);
}
module_init(amd7930_init);
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 8804f26ddb3..5018fcf41df 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -8,7 +8,6 @@
* Copyright (c) by Jaroslav Kysela <perex@suse.cz>
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@@ -2002,10 +2001,9 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
chip->c_dma.preallocate = sbus_dma_preallocate;
if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt,
- SA_SHIRQ, "cs4231", chip)) {
- snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %s\n",
- dev,
- __irq_itoa(sdev->irqs[0]));
+ IRQF_SHARED, "cs4231", chip)) {
+ snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n",
+ dev, sdev->irqs[0]);
snd_cs4231_sbus_free(chip);
return -EBUSY;
}
@@ -2038,11 +2036,11 @@ static int __init cs4231_sbus_attach(struct sbus_dev *sdev)
if (err)
return err;
- sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %s",
+ sprintf(card->longname, "%s at 0x%02lx:0x%016lx, irq %d",
card->shortname,
rp->flags & 0xffL,
- rp->start,
- __irq_itoa(sdev->irqs[0]));
+ (unsigned long long)rp->start,
+ sdev->irqs[0]);
if ((err = snd_cs4231_sbus_create(card, sdev, dev, &cp)) < 0) {
snd_card_free(card);
@@ -2244,10 +2242,10 @@ static int __init cs4231_ebus_attach(struct linux_ebus_device *edev)
if (err)
return err;
- sprintf(card->longname, "%s at 0x%lx, irq %s",
+ sprintf(card->longname, "%s at 0x%lx, irq %d",
card->shortname,
edev->resource[0].start,
- __irq_itoa(edev->irqs[0]));
+ edev->irqs[0]);
if ((err = snd_cs4231_ebus_create(card, edev, dev, &chip)) < 0) {
snd_card_free(card);
@@ -2285,15 +2283,14 @@ static int __init cs4231_init(void)
for_each_ebusdev(edev, ebus) {
int match = 0;
- if (!strcmp(edev->prom_name, "SUNW,CS4231")) {
+ if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) {
match = 1;
- } else if (!strcmp(edev->prom_name, "audio")) {
- char compat[16];
+ } else if (!strcmp(edev->prom_node->name, "audio")) {
+ char *compat;
- prom_getstring(edev->prom_node, "compatible",
- compat, sizeof(compat));
- compat[15] = '\0';
- if (!strcmp(compat, "SUNW,CS4231"))
+ compat = of_get_property(edev->prom_node,
+ "compatible", NULL);
+ if (compat && !strcmp(compat, "SUNW,CS4231"))
match = 1;
}
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 2164b7d290c..59a02a0d9af 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -46,7 +46,7 @@
*
* I've tried to stick to the following function naming conventions:
* snd_* ALSA stuff
- * cs4215_* CS4215 codec specfic stuff
+ * cs4215_* CS4215 codec specific stuff
* dbri_* DBRI high-level stuff
* other DBRI low-level stuff
*/
@@ -92,7 +92,7 @@ MODULE_PARM_DESC(enable, "Enable Sun DBRI soundcard.");
#define D_USR (1<<4)
#define D_DESC (1<<5)
-static int dbri_debug = 0;
+static int dbri_debug;
module_param(dbri_debug, int, 0644);
MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard.");
@@ -593,7 +593,7 @@ struct snd_dbri {
/* Return a pointer to dbri_streaminfo */
#define DBRI_STREAM(dbri, substream) &dbri->stream_info[DBRI_STREAMNO(substream)]
-static struct snd_dbri *dbri_list = NULL; /* All DBRI devices */
+static struct snd_dbri *dbri_list; /* All DBRI devices */
/*
* Short data pipes transmit LSB first. The CS4215 receives MSB first. Grrr.
@@ -2521,11 +2521,11 @@ void snd_dbri_proc(struct snd_dbri * dbri)
struct snd_info_entry *entry;
if (! snd_card_proc_new(dbri->card, "regs", &entry))
- snd_info_set_text_ops(entry, dbri, 1024, dbri_regs_read);
+ snd_info_set_text_ops(entry, dbri, dbri_regs_read);
#ifdef DBRI_DEBUG
if (! snd_card_proc_new(dbri->card, "debug", &entry)) {
- snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read);
+ snd_info_set_text_ops(entry, dbri, dbri_debug_read);
entry->mode = S_IFREG | S_IRUGO; /* Readable only. */
}
#endif
@@ -2569,7 +2569,7 @@ static int __init snd_dbri_create(struct snd_card *card,
return -EIO;
}
- err = request_irq(dbri->irq, snd_dbri_interrupt, SA_SHIRQ,
+ err = request_irq(dbri->irq, snd_dbri_interrupt, IRQF_SHARED,
"DBRI audio", dbri);
if (err) {
printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq);
@@ -2645,9 +2645,9 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
strcpy(card->driver, "DBRI");
strcpy(card->shortname, "Sun DBRI");
rp = &sdev->resource[0];
- sprintf(card->longname, "%s at 0x%02lx:0x%08lx, irq %s",
+ sprintf(card->longname, "%s at 0x%02lx:0x%016lx, irq %d",
card->shortname,
- rp->flags & 0xffL, rp->start, __irq_itoa(irq.pri));
+ rp->flags & 0xffL, (unsigned long long)rp->start, irq.pri);
if ((err = snd_dbri_create(card, sdev, &irq, dev)) < 0) {
snd_card_free(card);