aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/memalloc.c48
-rw-r--r--sound/sparc/amd7930.c85
-rw-r--r--sound/sparc/cs4231.c199
-rw-r--r--sound/sparc/dbri.c89
4 files changed, 145 insertions, 276 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index f5d6d8d12979..3733351a27f2 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -33,9 +33,6 @@
33#include <linux/moduleparam.h> 33#include <linux/moduleparam.h>
34#include <linux/mutex.h> 34#include <linux/mutex.h>
35#include <sound/memalloc.h> 35#include <sound/memalloc.h>
36#ifdef CONFIG_SBUS
37#include <asm/sbus.h>
38#endif
39 36
40 37
41MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>"); 38MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>, Jaroslav Kysela <perex@perex.cz>");
@@ -180,39 +177,6 @@ static void snd_free_dev_pages(struct device *dev, size_t size, void *ptr,
180} 177}
181#endif /* CONFIG_HAS_DMA */ 178#endif /* CONFIG_HAS_DMA */
182 179
183#ifdef CONFIG_SBUS
184
185static void *snd_malloc_sbus_pages(struct device *dev, size_t size,
186 dma_addr_t *dma_addr)
187{
188 struct sbus_dev *sdev = (struct sbus_dev *)dev;
189 int pg;
190 void *res;
191
192 snd_assert(size > 0, return NULL);
193 snd_assert(dma_addr != NULL, return NULL);
194 pg = get_order(size);
195 res = sbus_alloc_consistent(sdev, PAGE_SIZE * (1 << pg), dma_addr);
196 if (res != NULL)
197 inc_snd_pages(pg);
198 return res;
199}
200
201static void snd_free_sbus_pages(struct device *dev, size_t size,
202 void *ptr, dma_addr_t dma_addr)
203{
204 struct sbus_dev *sdev = (struct sbus_dev *)dev;
205 int pg;
206
207 if (ptr == NULL)
208 return;
209 pg = get_order(size);
210 dec_snd_pages(pg);
211 sbus_free_consistent(sdev, PAGE_SIZE * (1 << pg), ptr, dma_addr);
212}
213
214#endif /* CONFIG_SBUS */
215
216/* 180/*
217 * 181 *
218 * ALSA generic memory management 182 * ALSA generic memory management
@@ -247,11 +211,6 @@ int snd_dma_alloc_pages(int type, struct device *device, size_t size,
247 dmab->area = snd_malloc_pages(size, (unsigned long)device); 211 dmab->area = snd_malloc_pages(size, (unsigned long)device);
248 dmab->addr = 0; 212 dmab->addr = 0;
249 break; 213 break;
250#ifdef CONFIG_SBUS
251 case SNDRV_DMA_TYPE_SBUS:
252 dmab->area = snd_malloc_sbus_pages(device, size, &dmab->addr);
253 break;
254#endif
255#ifdef CONFIG_HAS_DMA 214#ifdef CONFIG_HAS_DMA
256 case SNDRV_DMA_TYPE_DEV: 215 case SNDRV_DMA_TYPE_DEV:
257 dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr); 216 dmab->area = snd_malloc_dev_pages(device, size, &dmab->addr);
@@ -320,11 +279,6 @@ void snd_dma_free_pages(struct snd_dma_buffer *dmab)
320 case SNDRV_DMA_TYPE_CONTINUOUS: 279 case SNDRV_DMA_TYPE_CONTINUOUS:
321 snd_free_pages(dmab->area, dmab->bytes); 280 snd_free_pages(dmab->area, dmab->bytes);
322 break; 281 break;
323#ifdef CONFIG_SBUS
324 case SNDRV_DMA_TYPE_SBUS:
325 snd_free_sbus_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
326 break;
327#endif
328#ifdef CONFIG_HAS_DMA 282#ifdef CONFIG_HAS_DMA
329 case SNDRV_DMA_TYPE_DEV: 283 case SNDRV_DMA_TYPE_DEV:
330 snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr); 284 snd_free_dev_pages(dmab->dev.dev, dmab->bytes, dmab->area, dmab->addr);
@@ -431,7 +385,7 @@ static int snd_mem_proc_read(struct seq_file *seq, void *offset)
431 long pages = snd_allocated_pages >> (PAGE_SHIFT-12); 385 long pages = snd_allocated_pages >> (PAGE_SHIFT-12);
432 struct snd_mem_list *mem; 386 struct snd_mem_list *mem;
433 int devno; 387 int devno;
434 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG", "SBUS" }; 388 static char *types[] = { "UNKNOWN", "CONT", "DEV", "DEV-SG" };
435 389
436 mutex_lock(&list_mutex); 390 mutex_lock(&list_mutex);
437 seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n", 391 seq_printf(seq, "pages : %li bytes (%li pages per %likB)\n",
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index 0c63e0585b15..5af5503edadb 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Driver for AMD7930 sound chips found on Sparcs. 2 * Driver for AMD7930 sound chips found on Sparcs.
3 * Copyright (C) 2002 David S. Miller <davem@redhat.com> 3 * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net>
4 * 4 *
5 * Based entirely upon drivers/sbus/audio/amd7930.c which is: 5 * Based entirely upon drivers/sbus/audio/amd7930.c which is:
6 * Copyright (C) 1996,1997 Thomas K. Dyas (tdyas@eden.rutgers.edu) 6 * Copyright (C) 1996,1997 Thomas K. Dyas (tdyas@eden.rutgers.edu)
@@ -35,6 +35,8 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/interrupt.h> 36#include <linux/interrupt.h>
37#include <linux/moduleparam.h> 37#include <linux/moduleparam.h>
38#include <linux/of.h>
39#include <linux/of_device.h>
38 40
39#include <sound/core.h> 41#include <sound/core.h>
40#include <sound/pcm.h> 42#include <sound/pcm.h>
@@ -44,7 +46,6 @@
44 46
45#include <asm/io.h> 47#include <asm/io.h>
46#include <asm/irq.h> 48#include <asm/irq.h>
47#include <asm/sbus.h>
48#include <asm/prom.h> 49#include <asm/prom.h>
49 50
50static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
@@ -335,8 +336,8 @@ struct snd_amd7930 {
335 int pgain; 336 int pgain;
336 int mgain; 337 int mgain;
337 338
339 struct of_device *op;
338 unsigned int irq; 340 unsigned int irq;
339 unsigned int regs_size;
340 struct snd_amd7930 *next; 341 struct snd_amd7930 *next;
341}; 342};
342 343
@@ -920,13 +921,16 @@ static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd)
920 921
921static int snd_amd7930_free(struct snd_amd7930 *amd) 922static int snd_amd7930_free(struct snd_amd7930 *amd)
922{ 923{
924 struct of_device *op = amd->op;
925
923 amd7930_idle(amd); 926 amd7930_idle(amd);
924 927
925 if (amd->irq) 928 if (amd->irq)
926 free_irq(amd->irq, amd); 929 free_irq(amd->irq, amd);
927 930
928 if (amd->regs) 931 if (amd->regs)
929 sbus_iounmap(amd->regs, amd->regs_size); 932 of_iounmap(&op->resource[0], amd->regs,
933 resource_size(&op->resource[0]));
930 934
931 kfree(amd); 935 kfree(amd);
932 936
@@ -945,13 +949,12 @@ static struct snd_device_ops snd_amd7930_dev_ops = {
945}; 949};
946 950
947static int __devinit snd_amd7930_create(struct snd_card *card, 951static int __devinit snd_amd7930_create(struct snd_card *card,
948 struct resource *rp, 952 struct of_device *op,
949 unsigned int reg_size,
950 int irq, int dev, 953 int irq, int dev,
951 struct snd_amd7930 **ramd) 954 struct snd_amd7930 **ramd)
952{ 955{
953 unsigned long flags;
954 struct snd_amd7930 *amd; 956 struct snd_amd7930 *amd;
957 unsigned long flags;
955 int err; 958 int err;
956 959
957 *ramd = NULL; 960 *ramd = NULL;
@@ -961,9 +964,10 @@ static int __devinit snd_amd7930_create(struct snd_card *card,
961 964
962 spin_lock_init(&amd->lock); 965 spin_lock_init(&amd->lock);
963 amd->card = card; 966 amd->card = card;
964 amd->regs_size = reg_size; 967 amd->op = op;
965 968
966 amd->regs = sbus_ioremap(rp, 0, amd->regs_size, "amd7930"); 969 amd->regs = of_ioremap(&op->resource[0], 0,
970 resource_size(&op->resource[0]), "amd7930");
967 if (!amd->regs) { 971 if (!amd->regs) {
968 snd_printk("amd7930-%d: Unable to map chip registers.\n", dev); 972 snd_printk("amd7930-%d: Unable to map chip registers.\n", dev);
969 return -EIO; 973 return -EIO;
@@ -1012,12 +1016,15 @@ static int __devinit snd_amd7930_create(struct snd_card *card,
1012 return 0; 1016 return 0;
1013} 1017}
1014 1018
1015static int __devinit amd7930_attach_common(struct resource *rp, int irq) 1019static int __devinit amd7930_sbus_probe(struct of_device *op, const struct of_device_id *match)
1016{ 1020{
1021 struct resource *rp = &op->resource[0];
1017 static int dev_num; 1022 static int dev_num;
1018 struct snd_card *card; 1023 struct snd_card *card;
1019 struct snd_amd7930 *amd; 1024 struct snd_amd7930 *amd;
1020 int err; 1025 int err, irq;
1026
1027 irq = op->irqs[0];
1021 1028
1022 if (dev_num >= SNDRV_CARDS) 1029 if (dev_num >= SNDRV_CARDS)
1023 return -ENODEV; 1030 return -ENODEV;
@@ -1038,8 +1045,7 @@ static int __devinit amd7930_attach_common(struct resource *rp, int irq)
1038 (unsigned long long)rp->start, 1045 (unsigned long long)rp->start,
1039 irq); 1046 irq);
1040 1047
1041 if ((err = snd_amd7930_create(card, rp, 1048 if ((err = snd_amd7930_create(card, op,
1042 (rp->end - rp->start) + 1,
1043 irq, dev_num, &amd)) < 0) 1049 irq, dev_num, &amd)) < 0)
1044 goto out_err; 1050 goto out_err;
1045 1051
@@ -1064,43 +1070,7 @@ out_err:
1064 return err; 1070 return err;
1065} 1071}
1066 1072
1067static int __devinit amd7930_obio_attach(struct device_node *dp) 1073static const struct of_device_id amd7930_match[] = {
1068{
1069 const struct linux_prom_registers *regs;
1070 const struct linux_prom_irqs *irqp;
1071 struct resource res, *rp;
1072 int len;
1073
1074 irqp = of_get_property(dp, "intr", &len);
1075 if (!irqp) {
1076 snd_printk("%s: Firmware node lacks IRQ property.\n",
1077 dp->full_name);
1078 return -ENODEV;
1079 }
1080
1081 regs = of_get_property(dp, "reg", &len);
1082 if (!regs) {
1083 snd_printk("%s: Firmware node lacks register property.\n",
1084 dp->full_name);
1085 return -ENODEV;
1086 }
1087
1088 rp = &res;
1089 rp->start = regs->phys_addr;
1090 rp->end = rp->start + regs->reg_size - 1;
1091 rp->flags = IORESOURCE_IO | (regs->which_io & 0xff);
1092
1093 return amd7930_attach_common(rp, irqp->pri);
1094}
1095
1096static int __devinit amd7930_sbus_probe(struct of_device *dev, const struct of_device_id *match)
1097{
1098 struct sbus_dev *sdev = to_sbus_device(&dev->dev);
1099
1100 return amd7930_attach_common(&sdev->resource[0], sdev->irqs[0]);
1101}
1102
1103static struct of_device_id amd7930_match[] = {
1104 { 1074 {
1105 .name = "audio", 1075 .name = "audio",
1106 }, 1076 },
@@ -1115,20 +1085,7 @@ static struct of_platform_driver amd7930_sbus_driver = {
1115 1085
1116static int __init amd7930_init(void) 1086static int __init amd7930_init(void)
1117{ 1087{
1118 struct device_node *dp; 1088 return of_register_driver(&amd7930_sbus_driver, &of_bus_type);
1119
1120 /* Try to find the sun4c "audio" node first. */
1121 dp = of_find_node_by_path("/");
1122 dp = dp->child;
1123 while (dp) {
1124 if (!strcmp(dp->name, "audio"))
1125 amd7930_obio_attach(dp);
1126
1127 dp = dp->sibling;
1128 }
1129
1130 /* Probe each SBUS for amd7930 chips. */
1131 return of_register_driver(&amd7930_sbus_driver, &sbus_bus_type);
1132} 1089}
1133 1090
1134static void __exit amd7930_exit(void) 1091static void __exit amd7930_exit(void)
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 1c4797be72ee..727438d276eb 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Driver for CS4231 sound chips found on Sparcs. 2 * Driver for CS4231 sound chips found on Sparcs.
3 * Copyright (C) 2002 David S. Miller <davem@redhat.com> 3 * Copyright (C) 2002, 2008 David S. Miller <davem@davemloft.net>
4 * 4 *
5 * Based entirely upon drivers/sbus/audio/cs4231.c which is: 5 * Based entirely upon drivers/sbus/audio/cs4231.c which is:
6 * Copyright (C) 1996, 1997, 1998 Derrick J Brashear (shadow@andrew.cmu.edu) 6 * Copyright (C) 1996, 1997, 1998 Derrick J Brashear (shadow@andrew.cmu.edu)
@@ -17,7 +17,8 @@
17#include <linux/moduleparam.h> 17#include <linux/moduleparam.h>
18#include <linux/irq.h> 18#include <linux/irq.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20#include <linux/of.h>
21#include <linux/of_device.h>
21 22
22#include <sound/core.h> 23#include <sound/core.h>
23#include <sound/pcm.h> 24#include <sound/pcm.h>
@@ -29,13 +30,12 @@
29 30
30#ifdef CONFIG_SBUS 31#ifdef CONFIG_SBUS
31#define SBUS_SUPPORT 32#define SBUS_SUPPORT
32#include <asm/sbus.h>
33#endif 33#endif
34 34
35#if defined(CONFIG_PCI) && defined(CONFIG_SPARC64) 35#if defined(CONFIG_PCI) && defined(CONFIG_SPARC64)
36#define EBUS_SUPPORT 36#define EBUS_SUPPORT
37#include <linux/pci.h> 37#include <linux/pci.h>
38#include <asm/ebus.h> 38#include <asm/ebus_dma.h>
39#endif 39#endif
40 40
41static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 41static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
@@ -70,8 +70,6 @@ struct cs4231_dma_control {
70 int (*request)(struct cs4231_dma_control *dma_cont, 70 int (*request)(struct cs4231_dma_control *dma_cont,
71 dma_addr_t bus_addr, size_t len); 71 dma_addr_t bus_addr, size_t len);
72 unsigned int (*address)(struct cs4231_dma_control *dma_cont); 72 unsigned int (*address)(struct cs4231_dma_control *dma_cont);
73 void (*preallocate)(struct snd_cs4231 *chip,
74 struct snd_pcm *pcm);
75#ifdef EBUS_SUPPORT 73#ifdef EBUS_SUPPORT
76 struct ebus_dma_info ebus_info; 74 struct ebus_dma_info ebus_info;
77#endif 75#endif
@@ -114,21 +112,12 @@ struct snd_cs4231 {
114 struct mutex mce_mutex; /* mutex for mce register */ 112 struct mutex mce_mutex; /* mutex for mce register */
115 struct mutex open_mutex; /* mutex for ALSA open/close */ 113 struct mutex open_mutex; /* mutex for ALSA open/close */
116 114
117 union { 115 struct of_device *op;
118#ifdef SBUS_SUPPORT
119 struct sbus_dev *sdev;
120#endif
121#ifdef EBUS_SUPPORT
122 struct pci_dev *pdev;
123#endif
124 } dev_u;
125 unsigned int irq[2]; 116 unsigned int irq[2];
126 unsigned int regs_size; 117 unsigned int regs_size;
127 struct snd_cs4231 *next; 118 struct snd_cs4231 *next;
128}; 119};
129 120
130static struct snd_cs4231 *cs4231_list;
131
132/* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for 121/* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for
133 * now.... -DaveM 122 * now.... -DaveM
134 */ 123 */
@@ -267,27 +256,19 @@ static unsigned char snd_cs4231_original_image[32] =
267 256
268static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr) 257static u8 __cs4231_readb(struct snd_cs4231 *cp, void __iomem *reg_addr)
269{ 258{
270#ifdef EBUS_SUPPORT
271 if (cp->flags & CS4231_FLAG_EBUS) 259 if (cp->flags & CS4231_FLAG_EBUS)
272 return readb(reg_addr); 260 return readb(reg_addr);
273 else 261 else
274#endif
275#ifdef SBUS_SUPPORT
276 return sbus_readb(reg_addr); 262 return sbus_readb(reg_addr);
277#endif
278} 263}
279 264
280static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val, 265static void __cs4231_writeb(struct snd_cs4231 *cp, u8 val,
281 void __iomem *reg_addr) 266 void __iomem *reg_addr)
282{ 267{
283#ifdef EBUS_SUPPORT
284 if (cp->flags & CS4231_FLAG_EBUS) 268 if (cp->flags & CS4231_FLAG_EBUS)
285 return writeb(val, reg_addr); 269 return writeb(val, reg_addr);
286 else 270 else
287#endif
288#ifdef SBUS_SUPPORT
289 return sbus_writeb(val, reg_addr); 271 return sbus_writeb(val, reg_addr);
290#endif
291} 272}
292 273
293/* 274/*
@@ -1258,7 +1239,9 @@ static int __init snd_cs4231_pcm(struct snd_card *card)
1258 pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; 1239 pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
1259 strcpy(pcm->name, "CS4231"); 1240 strcpy(pcm->name, "CS4231");
1260 1241
1261 chip->p_dma.preallocate(chip, pcm); 1242 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1243 &chip->op->dev,
1244 64 * 1024, 128 * 1024);
1262 1245
1263 chip->pcm = pcm; 1246 chip->pcm = pcm;
1264 1247
@@ -1626,8 +1609,7 @@ static int __init cs4231_attach_finish(struct snd_card *card)
1626 if (err < 0) 1609 if (err < 0)
1627 goto out_err; 1610 goto out_err;
1628 1611
1629 chip->next = cs4231_list; 1612 dev_set_drvdata(&chip->op->dev, chip);
1630 cs4231_list = chip;
1631 1613
1632 dev++; 1614 dev++;
1633 return 0; 1615 return 0;
@@ -1782,24 +1764,19 @@ static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont)
1782 return sbus_readl(base->regs + base->dir + APCVA); 1764 return sbus_readl(base->regs + base->dir + APCVA);
1783} 1765}
1784 1766
1785static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
1786{
1787 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS,
1788 snd_dma_sbus_data(chip->dev_u.sdev),
1789 64 * 1024, 128 * 1024);
1790}
1791
1792/* 1767/*
1793 * Init and exit routines 1768 * Init and exit routines
1794 */ 1769 */
1795 1770
1796static int snd_cs4231_sbus_free(struct snd_cs4231 *chip) 1771static int snd_cs4231_sbus_free(struct snd_cs4231 *chip)
1797{ 1772{
1773 struct of_device *op = chip->op;
1774
1798 if (chip->irq[0]) 1775 if (chip->irq[0])
1799 free_irq(chip->irq[0], chip); 1776 free_irq(chip->irq[0], chip);
1800 1777
1801 if (chip->port) 1778 if (chip->port)
1802 sbus_iounmap(chip->port, chip->regs_size); 1779 of_iounmap(&op->resource[0], chip->port, chip->regs_size);
1803 1780
1804 return 0; 1781 return 0;
1805} 1782}
@@ -1816,7 +1793,7 @@ static struct snd_device_ops snd_cs4231_sbus_dev_ops = {
1816}; 1793};
1817 1794
1818static int __init snd_cs4231_sbus_create(struct snd_card *card, 1795static int __init snd_cs4231_sbus_create(struct snd_card *card,
1819 struct sbus_dev *sdev, 1796 struct of_device *op,
1820 int dev) 1797 int dev)
1821{ 1798{
1822 struct snd_cs4231 *chip = card->private_data; 1799 struct snd_cs4231 *chip = card->private_data;
@@ -1827,13 +1804,13 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
1827 spin_lock_init(&chip->p_dma.sbus_info.lock); 1804 spin_lock_init(&chip->p_dma.sbus_info.lock);
1828 mutex_init(&chip->mce_mutex); 1805 mutex_init(&chip->mce_mutex);
1829 mutex_init(&chip->open_mutex); 1806 mutex_init(&chip->open_mutex);
1830 chip->dev_u.sdev = sdev; 1807 chip->op = op;
1831 chip->regs_size = sdev->reg_addrs[0].reg_size; 1808 chip->regs_size = resource_size(&op->resource[0]);
1832 memcpy(&chip->image, &snd_cs4231_original_image, 1809 memcpy(&chip->image, &snd_cs4231_original_image,
1833 sizeof(snd_cs4231_original_image)); 1810 sizeof(snd_cs4231_original_image));
1834 1811
1835 chip->port = sbus_ioremap(&sdev->resource[0], 0, 1812 chip->port = of_ioremap(&op->resource[0], 0,
1836 chip->regs_size, "cs4231"); 1813 chip->regs_size, "cs4231");
1837 if (!chip->port) { 1814 if (!chip->port) {
1838 snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev); 1815 snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev);
1839 return -EIO; 1816 return -EIO;
@@ -1848,22 +1825,20 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
1848 chip->p_dma.enable = sbus_dma_enable; 1825 chip->p_dma.enable = sbus_dma_enable;
1849 chip->p_dma.request = sbus_dma_request; 1826 chip->p_dma.request = sbus_dma_request;
1850 chip->p_dma.address = sbus_dma_addr; 1827 chip->p_dma.address = sbus_dma_addr;
1851 chip->p_dma.preallocate = sbus_dma_preallocate;
1852 1828
1853 chip->c_dma.prepare = sbus_dma_prepare; 1829 chip->c_dma.prepare = sbus_dma_prepare;
1854 chip->c_dma.enable = sbus_dma_enable; 1830 chip->c_dma.enable = sbus_dma_enable;
1855 chip->c_dma.request = sbus_dma_request; 1831 chip->c_dma.request = sbus_dma_request;
1856 chip->c_dma.address = sbus_dma_addr; 1832 chip->c_dma.address = sbus_dma_addr;
1857 chip->c_dma.preallocate = sbus_dma_preallocate;
1858 1833
1859 if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt, 1834 if (request_irq(op->irqs[0], snd_cs4231_sbus_interrupt,
1860 IRQF_SHARED, "cs4231", chip)) { 1835 IRQF_SHARED, "cs4231", chip)) {
1861 snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n", 1836 snd_printdd("cs4231-%d: Unable to grab SBUS IRQ %d\n",
1862 dev, sdev->irqs[0]); 1837 dev, op->irqs[0]);
1863 snd_cs4231_sbus_free(chip); 1838 snd_cs4231_sbus_free(chip);
1864 return -EBUSY; 1839 return -EBUSY;
1865 } 1840 }
1866 chip->irq[0] = sdev->irqs[0]; 1841 chip->irq[0] = op->irqs[0];
1867 1842
1868 if (snd_cs4231_probe(chip) < 0) { 1843 if (snd_cs4231_probe(chip) < 0) {
1869 snd_cs4231_sbus_free(chip); 1844 snd_cs4231_sbus_free(chip);
@@ -1880,9 +1855,9 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
1880 return 0; 1855 return 0;
1881} 1856}
1882 1857
1883static int __init cs4231_sbus_attach(struct sbus_dev *sdev) 1858static int __devinit cs4231_sbus_probe(struct of_device *op, const struct of_device_id *match)
1884{ 1859{
1885 struct resource *rp = &sdev->resource[0]; 1860 struct resource *rp = &op->resource[0];
1886 struct snd_card *card; 1861 struct snd_card *card;
1887 int err; 1862 int err;
1888 1863
@@ -1894,9 +1869,9 @@ static int __init cs4231_sbus_attach(struct sbus_dev *sdev)
1894 card->shortname, 1869 card->shortname,
1895 rp->flags & 0xffL, 1870 rp->flags & 0xffL,
1896 (unsigned long long)rp->start, 1871 (unsigned long long)rp->start,
1897 sdev->irqs[0]); 1872 op->irqs[0]);
1898 1873
1899 err = snd_cs4231_sbus_create(card, sdev, dev); 1874 err = snd_cs4231_sbus_create(card, op, dev);
1900 if (err < 0) { 1875 if (err < 0) {
1901 snd_card_free(card); 1876 snd_card_free(card);
1902 return err; 1877 return err;
@@ -1949,30 +1924,25 @@ static unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont)
1949 return ebus_dma_addr(&dma_cont->ebus_info); 1924 return ebus_dma_addr(&dma_cont->ebus_info);
1950} 1925}
1951 1926
1952static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
1953{
1954 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
1955 snd_dma_pci_data(chip->dev_u.pdev),
1956 64*1024, 128*1024);
1957}
1958
1959/* 1927/*
1960 * Init and exit routines 1928 * Init and exit routines
1961 */ 1929 */
1962 1930
1963static int snd_cs4231_ebus_free(struct snd_cs4231 *chip) 1931static int snd_cs4231_ebus_free(struct snd_cs4231 *chip)
1964{ 1932{
1933 struct of_device *op = chip->op;
1934
1965 if (chip->c_dma.ebus_info.regs) { 1935 if (chip->c_dma.ebus_info.regs) {
1966 ebus_dma_unregister(&chip->c_dma.ebus_info); 1936 ebus_dma_unregister(&chip->c_dma.ebus_info);
1967 iounmap(chip->c_dma.ebus_info.regs); 1937 of_iounmap(&op->resource[2], chip->c_dma.ebus_info.regs, 0x10);
1968 } 1938 }
1969 if (chip->p_dma.ebus_info.regs) { 1939 if (chip->p_dma.ebus_info.regs) {
1970 ebus_dma_unregister(&chip->p_dma.ebus_info); 1940 ebus_dma_unregister(&chip->p_dma.ebus_info);
1971 iounmap(chip->p_dma.ebus_info.regs); 1941 of_iounmap(&op->resource[1], chip->p_dma.ebus_info.regs, 0x10);
1972 } 1942 }
1973 1943
1974 if (chip->port) 1944 if (chip->port)
1975 iounmap(chip->port); 1945 of_iounmap(&op->resource[0], chip->port, 0x10);
1976 1946
1977 return 0; 1947 return 0;
1978} 1948}
@@ -1989,7 +1959,7 @@ static struct snd_device_ops snd_cs4231_ebus_dev_ops = {
1989}; 1959};
1990 1960
1991static int __init snd_cs4231_ebus_create(struct snd_card *card, 1961static int __init snd_cs4231_ebus_create(struct snd_card *card,
1992 struct linux_ebus_device *edev, 1962 struct of_device *op,
1993 int dev) 1963 int dev)
1994{ 1964{
1995 struct snd_cs4231 *chip = card->private_data; 1965 struct snd_cs4231 *chip = card->private_data;
@@ -2001,35 +1971,35 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card,
2001 mutex_init(&chip->mce_mutex); 1971 mutex_init(&chip->mce_mutex);
2002 mutex_init(&chip->open_mutex); 1972 mutex_init(&chip->open_mutex);
2003 chip->flags |= CS4231_FLAG_EBUS; 1973 chip->flags |= CS4231_FLAG_EBUS;
2004 chip->dev_u.pdev = edev->bus->self; 1974 chip->op = op;
2005 memcpy(&chip->image, &snd_cs4231_original_image, 1975 memcpy(&chip->image, &snd_cs4231_original_image,
2006 sizeof(snd_cs4231_original_image)); 1976 sizeof(snd_cs4231_original_image));
2007 strcpy(chip->c_dma.ebus_info.name, "cs4231(capture)"); 1977 strcpy(chip->c_dma.ebus_info.name, "cs4231(capture)");
2008 chip->c_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; 1978 chip->c_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER;
2009 chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback; 1979 chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback;
2010 chip->c_dma.ebus_info.client_cookie = chip; 1980 chip->c_dma.ebus_info.client_cookie = chip;
2011 chip->c_dma.ebus_info.irq = edev->irqs[0]; 1981 chip->c_dma.ebus_info.irq = op->irqs[0];
2012 strcpy(chip->p_dma.ebus_info.name, "cs4231(play)"); 1982 strcpy(chip->p_dma.ebus_info.name, "cs4231(play)");
2013 chip->p_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER; 1983 chip->p_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER;
2014 chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback; 1984 chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback;
2015 chip->p_dma.ebus_info.client_cookie = chip; 1985 chip->p_dma.ebus_info.client_cookie = chip;
2016 chip->p_dma.ebus_info.irq = edev->irqs[1]; 1986 chip->p_dma.ebus_info.irq = op->irqs[1];
2017 1987
2018 chip->p_dma.prepare = _ebus_dma_prepare; 1988 chip->p_dma.prepare = _ebus_dma_prepare;
2019 chip->p_dma.enable = _ebus_dma_enable; 1989 chip->p_dma.enable = _ebus_dma_enable;
2020 chip->p_dma.request = _ebus_dma_request; 1990 chip->p_dma.request = _ebus_dma_request;
2021 chip->p_dma.address = _ebus_dma_addr; 1991 chip->p_dma.address = _ebus_dma_addr;
2022 chip->p_dma.preallocate = _ebus_dma_preallocate;
2023 1992
2024 chip->c_dma.prepare = _ebus_dma_prepare; 1993 chip->c_dma.prepare = _ebus_dma_prepare;
2025 chip->c_dma.enable = _ebus_dma_enable; 1994 chip->c_dma.enable = _ebus_dma_enable;
2026 chip->c_dma.request = _ebus_dma_request; 1995 chip->c_dma.request = _ebus_dma_request;
2027 chip->c_dma.address = _ebus_dma_addr; 1996 chip->c_dma.address = _ebus_dma_addr;
2028 chip->c_dma.preallocate = _ebus_dma_preallocate;
2029 1997
2030 chip->port = ioremap(edev->resource[0].start, 0x10); 1998 chip->port = of_ioremap(&op->resource[0], 0, 0x10, "cs4231");
2031 chip->p_dma.ebus_info.regs = ioremap(edev->resource[1].start, 0x10); 1999 chip->p_dma.ebus_info.regs =
2032 chip->c_dma.ebus_info.regs = ioremap(edev->resource[2].start, 0x10); 2000 of_ioremap(&op->resource[1], 0, 0x10, "cs4231_pdma");
2001 chip->c_dma.ebus_info.regs =
2002 of_ioremap(&op->resource[2], 0, 0x10, "cs4231_cdma");
2033 if (!chip->port || !chip->p_dma.ebus_info.regs || 2003 if (!chip->port || !chip->p_dma.ebus_info.regs ||
2034 !chip->c_dma.ebus_info.regs) { 2004 !chip->c_dma.ebus_info.regs) {
2035 snd_cs4231_ebus_free(chip); 2005 snd_cs4231_ebus_free(chip);
@@ -2077,7 +2047,7 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card,
2077 return 0; 2047 return 0;
2078} 2048}
2079 2049
2080static int __init cs4231_ebus_attach(struct linux_ebus_device *edev) 2050static int __devinit cs4231_ebus_probe(struct of_device *op, const struct of_device_id *match)
2081{ 2051{
2082 struct snd_card *card; 2052 struct snd_card *card;
2083 int err; 2053 int err;
@@ -2088,10 +2058,10 @@ static int __init cs4231_ebus_attach(struct linux_ebus_device *edev)
2088 2058
2089 sprintf(card->longname, "%s at 0x%lx, irq %d", 2059 sprintf(card->longname, "%s at 0x%lx, irq %d",
2090 card->shortname, 2060 card->shortname,
2091 edev->resource[0].start, 2061 op->resource[0].start,
2092 edev->irqs[0]); 2062 op->irqs[0]);
2093 2063
2094 err = snd_cs4231_ebus_create(card, edev, dev); 2064 err = snd_cs4231_ebus_create(card, op, dev);
2095 if (err < 0) { 2065 if (err < 0) {
2096 snd_card_free(card); 2066 snd_card_free(card);
2097 return err; 2067 return err;
@@ -2101,68 +2071,57 @@ static int __init cs4231_ebus_attach(struct linux_ebus_device *edev)
2101} 2071}
2102#endif 2072#endif
2103 2073
2104static int __init cs4231_init(void) 2074static int __devinit cs4231_probe(struct of_device *op, const struct of_device_id *match)
2105{ 2075{
2106#ifdef SBUS_SUPPORT
2107 struct sbus_bus *sbus;
2108 struct sbus_dev *sdev;
2109#endif
2110#ifdef EBUS_SUPPORT 2076#ifdef EBUS_SUPPORT
2111 struct linux_ebus *ebus; 2077 if (!strcmp(op->node->parent->name, "ebus"))
2112 struct linux_ebus_device *edev; 2078 return cs4231_ebus_probe(op, match);
2113#endif 2079#endif
2114 int found;
2115
2116 found = 0;
2117
2118#ifdef SBUS_SUPPORT 2080#ifdef SBUS_SUPPORT
2119 for_all_sbusdev(sdev, sbus) { 2081 if (!strcmp(op->node->parent->name, "sbus") ||
2120 if (!strcmp(sdev->prom_name, "SUNW,CS4231")) { 2082 !strcmp(op->node->parent->name, "sbi"))
2121 if (cs4231_sbus_attach(sdev) == 0) 2083 return cs4231_sbus_probe(op, match);
2122 found++;
2123 }
2124 }
2125#endif 2084#endif
2126#ifdef EBUS_SUPPORT 2085 return -ENODEV;
2127 for_each_ebus(ebus) { 2086}
2128 for_each_ebusdev(edev, ebus) {
2129 int match = 0;
2130
2131 if (!strcmp(edev->prom_node->name, "SUNW,CS4231")) {
2132 match = 1;
2133 } else if (!strcmp(edev->prom_node->name, "audio")) {
2134 const char *compat;
2135
2136 compat = of_get_property(edev->prom_node,
2137 "compatible", NULL);
2138 if (compat && !strcmp(compat, "SUNW,CS4231"))
2139 match = 1;
2140 }
2141 2087
2142 if (match && 2088static int __devexit cs4231_remove(struct of_device *op)
2143 cs4231_ebus_attach(edev) == 0) 2089{
2144 found++; 2090 struct snd_cs4231 *chip = dev_get_drvdata(&op->dev);
2145 }
2146 }
2147#endif
2148 2091
2092 snd_card_free(chip->card);
2149 2093
2150 return (found > 0) ? 0 : -EIO; 2094 return 0;
2151} 2095}
2152 2096
2153static void __exit cs4231_exit(void) 2097static const struct of_device_id cs4231_match[] = {
2154{ 2098 {
2155 struct snd_cs4231 *p = cs4231_list; 2099 .name = "SUNW,CS4231",
2100 },
2101 {
2102 .name = "audio",
2103 .compatible = "SUNW,CS4231",
2104 },
2105 {},
2106};
2156 2107
2157 while (p != NULL) { 2108MODULE_DEVICE_TABLE(of, cs4231_match);
2158 struct snd_cs4231 *next = p->next;
2159 2109
2160 snd_card_free(p->card); 2110static struct of_platform_driver cs4231_driver = {
2111 .name = "audio",
2112 .match_table = cs4231_match,
2113 .probe = cs4231_probe,
2114 .remove = __devexit_p(cs4231_remove),
2115};
2161 2116
2162 p = next; 2117static int __init cs4231_init(void)
2163 } 2118{
2119 return of_register_driver(&cs4231_driver, &of_bus_type);
2120}
2164 2121
2165 cs4231_list = NULL; 2122static void __exit cs4231_exit(void)
2123{
2124 of_unregister_driver(&cs4231_driver);
2166} 2125}
2167 2126
2168module_init(cs4231_init); 2127module_init(cs4231_init);
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index ee2e1b4f3551..2edb0ad3de7e 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -57,6 +57,7 @@
57#include <linux/delay.h> 57#include <linux/delay.h>
58#include <linux/irq.h> 58#include <linux/irq.h>
59#include <linux/io.h> 59#include <linux/io.h>
60#include <linux/dma-mapping.h>
60 61
61#include <sound/core.h> 62#include <sound/core.h>
62#include <sound/pcm.h> 63#include <sound/pcm.h>
@@ -66,7 +67,7 @@
66#include <sound/initval.h> 67#include <sound/initval.h>
67 68
68#include <linux/of.h> 69#include <linux/of.h>
69#include <asm/sbus.h> 70#include <linux/of_device.h>
70#include <asm/atomic.h> 71#include <asm/atomic.h>
71 72
72MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets"); 73MODULE_AUTHOR("Rudolf Koenig, Brent Baccala and Martin Habets");
@@ -297,7 +298,7 @@ struct dbri_streaminfo {
297/* This structure holds the information for both chips (DBRI & CS4215) */ 298/* This structure holds the information for both chips (DBRI & CS4215) */
298struct snd_dbri { 299struct snd_dbri {
299 int regs_size, irq; /* Needed for unload */ 300 int regs_size, irq; /* Needed for unload */
300 struct sbus_dev *sdev; /* SBUS device info */ 301 struct of_device *op; /* OF device info */
301 spinlock_t lock; 302 spinlock_t lock;
302 303
303 struct dbri_dma *dma; /* Pointer to our DMA block */ 304 struct dbri_dma *dma; /* Pointer to our DMA block */
@@ -2093,14 +2094,15 @@ static int snd_dbri_hw_params(struct snd_pcm_substream *substream,
2093 */ 2094 */
2094 if (info->dvma_buffer == 0) { 2095 if (info->dvma_buffer == 0) {
2095 if (DBRI_STREAMNO(substream) == DBRI_PLAY) 2096 if (DBRI_STREAMNO(substream) == DBRI_PLAY)
2096 direction = SBUS_DMA_TODEVICE; 2097 direction = DMA_TO_DEVICE;
2097 else 2098 else
2098 direction = SBUS_DMA_FROMDEVICE; 2099 direction = DMA_FROM_DEVICE;
2099 2100
2100 info->dvma_buffer = sbus_map_single(dbri->sdev, 2101 info->dvma_buffer =
2101 runtime->dma_area, 2102 dma_map_single(&dbri->op->dev,
2102 params_buffer_bytes(hw_params), 2103 runtime->dma_area,
2103 direction); 2104 params_buffer_bytes(hw_params),
2105 direction);
2104 } 2106 }
2105 2107
2106 direction = params_buffer_bytes(hw_params); 2108 direction = params_buffer_bytes(hw_params);
@@ -2121,12 +2123,12 @@ static int snd_dbri_hw_free(struct snd_pcm_substream *substream)
2121 */ 2123 */
2122 if (info->dvma_buffer) { 2124 if (info->dvma_buffer) {
2123 if (DBRI_STREAMNO(substream) == DBRI_PLAY) 2125 if (DBRI_STREAMNO(substream) == DBRI_PLAY)
2124 direction = SBUS_DMA_TODEVICE; 2126 direction = DMA_TO_DEVICE;
2125 else 2127 else
2126 direction = SBUS_DMA_FROMDEVICE; 2128 direction = DMA_FROM_DEVICE;
2127 2129
2128 sbus_unmap_single(dbri->sdev, info->dvma_buffer, 2130 dma_unmap_single(&dbri->op->dev, info->dvma_buffer,
2129 substream->runtime->buffer_size, direction); 2131 substream->runtime->buffer_size, direction);
2130 info->dvma_buffer = 0; 2132 info->dvma_buffer = 0;
2131 } 2133 }
2132 if (info->pipe != -1) { 2134 if (info->pipe != -1) {
@@ -2514,31 +2516,32 @@ static void __devinit snd_dbri_proc(struct snd_card *card)
2514static void snd_dbri_free(struct snd_dbri *dbri); 2516static void snd_dbri_free(struct snd_dbri *dbri);
2515 2517
2516static int __devinit snd_dbri_create(struct snd_card *card, 2518static int __devinit snd_dbri_create(struct snd_card *card,
2517 struct sbus_dev *sdev, 2519 struct of_device *op,
2518 int irq, int dev) 2520 int irq, int dev)
2519{ 2521{
2520 struct snd_dbri *dbri = card->private_data; 2522 struct snd_dbri *dbri = card->private_data;
2521 int err; 2523 int err;
2522 2524
2523 spin_lock_init(&dbri->lock); 2525 spin_lock_init(&dbri->lock);
2524 dbri->sdev = sdev; 2526 dbri->op = op;
2525 dbri->irq = irq; 2527 dbri->irq = irq;
2526 2528
2527 dbri->dma = sbus_alloc_consistent(sdev, sizeof(struct dbri_dma), 2529 dbri->dma = dma_alloc_coherent(&op->dev,
2528 &dbri->dma_dvma); 2530 sizeof(struct dbri_dma),
2531 &dbri->dma_dvma, GFP_ATOMIC);
2529 memset((void *)dbri->dma, 0, sizeof(struct dbri_dma)); 2532 memset((void *)dbri->dma, 0, sizeof(struct dbri_dma));
2530 2533
2531 dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n", 2534 dprintk(D_GEN, "DMA Cmd Block 0x%p (0x%08x)\n",
2532 dbri->dma, dbri->dma_dvma); 2535 dbri->dma, dbri->dma_dvma);
2533 2536
2534 /* Map the registers into memory. */ 2537 /* Map the registers into memory. */
2535 dbri->regs_size = sdev->reg_addrs[0].reg_size; 2538 dbri->regs_size = resource_size(&op->resource[0]);
2536 dbri->regs = sbus_ioremap(&sdev->resource[0], 0, 2539 dbri->regs = of_ioremap(&op->resource[0], 0,
2537 dbri->regs_size, "DBRI Registers"); 2540 dbri->regs_size, "DBRI Registers");
2538 if (!dbri->regs) { 2541 if (!dbri->regs) {
2539 printk(KERN_ERR "DBRI: could not allocate registers\n"); 2542 printk(KERN_ERR "DBRI: could not allocate registers\n");
2540 sbus_free_consistent(sdev, sizeof(struct dbri_dma), 2543 dma_free_coherent(&op->dev, sizeof(struct dbri_dma),
2541 (void *)dbri->dma, dbri->dma_dvma); 2544 (void *)dbri->dma, dbri->dma_dvma);
2542 return -EIO; 2545 return -EIO;
2543 } 2546 }
2544 2547
@@ -2546,9 +2549,9 @@ static int __devinit snd_dbri_create(struct snd_card *card,
2546 "DBRI audio", dbri); 2549 "DBRI audio", dbri);
2547 if (err) { 2550 if (err) {
2548 printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq); 2551 printk(KERN_ERR "DBRI: Can't get irq %d\n", dbri->irq);
2549 sbus_iounmap(dbri->regs, dbri->regs_size); 2552 of_iounmap(&op->resource[0], dbri->regs, dbri->regs_size);
2550 sbus_free_consistent(sdev, sizeof(struct dbri_dma), 2553 dma_free_coherent(&op->dev, sizeof(struct dbri_dma),
2551 (void *)dbri->dma, dbri->dma_dvma); 2554 (void *)dbri->dma, dbri->dma_dvma);
2552 return err; 2555 return err;
2553 } 2556 }
2554 2557
@@ -2572,27 +2575,23 @@ static void snd_dbri_free(struct snd_dbri *dbri)
2572 free_irq(dbri->irq, dbri); 2575 free_irq(dbri->irq, dbri);
2573 2576
2574 if (dbri->regs) 2577 if (dbri->regs)
2575 sbus_iounmap(dbri->regs, dbri->regs_size); 2578 of_iounmap(&dbri->op->resource[0], dbri->regs, dbri->regs_size);
2576 2579
2577 if (dbri->dma) 2580 if (dbri->dma)
2578 sbus_free_consistent(dbri->sdev, sizeof(struct dbri_dma), 2581 dma_free_coherent(&dbri->op->dev,
2579 (void *)dbri->dma, dbri->dma_dvma); 2582 sizeof(struct dbri_dma),
2583 (void *)dbri->dma, dbri->dma_dvma);
2580} 2584}
2581 2585
2582static int __devinit dbri_probe(struct of_device *of_dev, 2586static int __devinit dbri_probe(struct of_device *op, const struct of_device_id *match)
2583 const struct of_device_id *match)
2584{ 2587{
2585 struct sbus_dev *sdev = to_sbus_device(&of_dev->dev);
2586 struct snd_dbri *dbri; 2588 struct snd_dbri *dbri;
2587 int irq;
2588 struct resource *rp; 2589 struct resource *rp;
2589 struct snd_card *card; 2590 struct snd_card *card;
2590 static int dev = 0; 2591 static int dev = 0;
2592 int irq;
2591 int err; 2593 int err;
2592 2594
2593 dprintk(D_GEN, "DBRI: Found %s in SBUS slot %d\n",
2594 sdev->prom_name, sdev->slot);
2595
2596 if (dev >= SNDRV_CARDS) 2595 if (dev >= SNDRV_CARDS)
2597 return -ENODEV; 2596 return -ENODEV;
2598 if (!enable[dev]) { 2597 if (!enable[dev]) {
@@ -2600,7 +2599,7 @@ static int __devinit dbri_probe(struct of_device *of_dev,
2600 return -ENOENT; 2599 return -ENOENT;
2601 } 2600 }
2602 2601
2603 irq = sdev->irqs[0]; 2602 irq = op->irqs[0];
2604 if (irq <= 0) { 2603 if (irq <= 0) {
2605 printk(KERN_ERR "DBRI-%d: No IRQ.\n", dev); 2604 printk(KERN_ERR "DBRI-%d: No IRQ.\n", dev);
2606 return -ENODEV; 2605 return -ENODEV;
@@ -2613,12 +2612,12 @@ static int __devinit dbri_probe(struct of_device *of_dev,
2613 2612
2614 strcpy(card->driver, "DBRI"); 2613 strcpy(card->driver, "DBRI");
2615 strcpy(card->shortname, "Sun DBRI"); 2614 strcpy(card->shortname, "Sun DBRI");
2616 rp = &sdev->resource[0]; 2615 rp = &op->resource[0];
2617 sprintf(card->longname, "%s at 0x%02lx:0x%016Lx, irq %d", 2616 sprintf(card->longname, "%s at 0x%02lx:0x%016Lx, irq %d",
2618 card->shortname, 2617 card->shortname,
2619 rp->flags & 0xffL, (unsigned long long)rp->start, irq); 2618 rp->flags & 0xffL, (unsigned long long)rp->start, irq);
2620 2619
2621 err = snd_dbri_create(card, sdev, irq, dev); 2620 err = snd_dbri_create(card, op, irq, dev);
2622 if (err < 0) { 2621 if (err < 0) {
2623 snd_card_free(card); 2622 snd_card_free(card);
2624 return err; 2623 return err;
@@ -2635,7 +2634,7 @@ static int __devinit dbri_probe(struct of_device *of_dev,
2635 2634
2636 /* /proc file handling */ 2635 /* /proc file handling */
2637 snd_dbri_proc(card); 2636 snd_dbri_proc(card);
2638 dev_set_drvdata(&of_dev->dev, card); 2637 dev_set_drvdata(&op->dev, card);
2639 2638
2640 err = snd_card_register(card); 2639 err = snd_card_register(card);
2641 if (err < 0) 2640 if (err < 0)
@@ -2643,7 +2642,7 @@ static int __devinit dbri_probe(struct of_device *of_dev,
2643 2642
2644 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", 2643 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
2645 dev, dbri->regs, 2644 dev, dbri->regs,
2646 dbri->irq, sdev->prom_name[9], dbri->mm.version); 2645 dbri->irq, op->node->name[9], dbri->mm.version);
2647 dev++; 2646 dev++;
2648 2647
2649 return 0; 2648 return 0;
@@ -2654,19 +2653,19 @@ _err:
2654 return err; 2653 return err;
2655} 2654}
2656 2655
2657static int __devexit dbri_remove(struct of_device *dev) 2656static int __devexit dbri_remove(struct of_device *op)
2658{ 2657{
2659 struct snd_card *card = dev_get_drvdata(&dev->dev); 2658 struct snd_card *card = dev_get_drvdata(&op->dev);
2660 2659
2661 snd_dbri_free(card->private_data); 2660 snd_dbri_free(card->private_data);
2662 snd_card_free(card); 2661 snd_card_free(card);
2663 2662
2664 dev_set_drvdata(&dev->dev, NULL); 2663 dev_set_drvdata(&op->dev, NULL);
2665 2664
2666 return 0; 2665 return 0;
2667} 2666}
2668 2667
2669static struct of_device_id dbri_match[] = { 2668static const struct of_device_id dbri_match[] = {
2670 { 2669 {
2671 .name = "SUNW,DBRIe", 2670 .name = "SUNW,DBRIe",
2672 }, 2671 },
@@ -2688,7 +2687,7 @@ static struct of_platform_driver dbri_sbus_driver = {
2688/* Probe for the dbri chip and then attach the driver. */ 2687/* Probe for the dbri chip and then attach the driver. */
2689static int __init dbri_init(void) 2688static int __init dbri_init(void)
2690{ 2689{
2691 return of_register_driver(&dbri_sbus_driver, &sbus_bus_type); 2690 return of_register_driver(&dbri_sbus_driver, &of_bus_type);
2692} 2691}
2693 2692
2694static void __exit dbri_exit(void) 2693static void __exit dbri_exit(void)