aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc/pmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/ppc/pmac.c')
-rw-r--r--sound/ppc/pmac.c100
1 files changed, 63 insertions, 37 deletions
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 9b2b00fdc1ae..a642e4cfcf45 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -803,21 +803,17 @@ static int snd_pmac_free(struct snd_pmac *chip)
803 iounmap(chip->playback.dma); 803 iounmap(chip->playback.dma);
804 if (chip->capture.dma) 804 if (chip->capture.dma)
805 iounmap(chip->capture.dma); 805 iounmap(chip->capture.dma);
806#ifndef CONFIG_PPC64 806
807 if (chip->node) { 807 if (chip->node) {
808 int i; 808 int i;
809
810 for (i = 0; i < 3; i++) { 809 for (i = 0; i < 3; i++) {
811 if (chip->of_requested & (1 << i)) { 810 if (chip->requested & (1 << i))
812 if (chip->is_k2) 811 release_mem_region(chip->rsrc[i].start,
813 release_OF_resource(chip->node->parent, 812 chip->rsrc[i].end -
814 i); 813 chip->rsrc[i].start + 1);
815 else
816 release_OF_resource(chip->node, i);
817 }
818 } 814 }
819 } 815 }
820#endif /* CONFIG_PPC64 */ 816
821 if (chip->pdev) 817 if (chip->pdev)
822 pci_dev_put(chip->pdev); 818 pci_dev_put(chip->pdev);
823 kfree(chip); 819 kfree(chip);
@@ -991,6 +987,11 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
991 chip->can_byte_swap = 0; /* FIXME: check this */ 987 chip->can_byte_swap = 0; /* FIXME: check this */
992 chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */ 988 chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */
993 break; 989 break;
990 default:
991 printk(KERN_ERR "snd: Unknown layout ID 0x%x\n",
992 layout_id);
993 return -ENODEV;
994
994 } 995 }
995 } 996 }
996 prop = (unsigned int *)get_property(sound, "device-id", NULL); 997 prop = (unsigned int *)get_property(sound, "device-id", NULL);
@@ -1175,46 +1176,69 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1175 } 1176 }
1176 1177
1177 np = chip->node; 1178 np = chip->node;
1179 chip->requested = 0;
1178 if (chip->is_k2) { 1180 if (chip->is_k2) {
1179 if (np->parent->n_addrs < 2 || np->n_intrs < 3) { 1181 static char *rnames[] = {
1182 "Sound Control", "Sound DMA" };
1183 if (np->n_intrs < 3) {
1180 err = -ENODEV; 1184 err = -ENODEV;
1181 goto __error; 1185 goto __error;
1182 } 1186 }
1183 for (i = 0; i < 2; i++) { 1187 for (i = 0; i < 2; i ++) {
1184#ifndef CONFIG_PPC64 1188 if (of_address_to_resource(np->parent, i,
1185 static char *name[2] = { "- Control", "- DMA" }; 1189 &chip->rsrc[i])) {
1186 if (! request_OF_resource(np->parent, i, name[i])) { 1190 printk(KERN_ERR "snd: can't translate rsrc "
1187 snd_printk(KERN_ERR "pmac: can't request resource %d!\n", i); 1191 " %d (%s)\n", i, rnames[i]);
1192 err = -ENODEV;
1193 goto __error;
1194 }
1195 if (request_mem_region(chip->rsrc[i].start,
1196 chip->rsrc[i].end -
1197 chip->rsrc[i].start + 1,
1198 rnames[i]) == NULL) {
1199 printk(KERN_ERR "snd: can't request rsrc "
1200 " %d (%s: 0x%08lx:%08lx)\n",
1201 i, rnames[i], chip->rsrc[i].start,
1202 chip->rsrc[i].end);
1188 err = -ENODEV; 1203 err = -ENODEV;
1189 goto __error; 1204 goto __error;
1190 } 1205 }
1191 chip->of_requested |= (1 << i); 1206 chip->requested |= (1 << i);
1192#endif /* CONFIG_PPC64 */
1193 ctrl_addr = np->parent->addrs[0].address;
1194 txdma_addr = np->parent->addrs[1].address;
1195 rxdma_addr = txdma_addr + 0x100;
1196 } 1207 }
1197 1208 ctrl_addr = chip->rsrc[0].start;
1209 txdma_addr = chip->rsrc[1].start;
1210 rxdma_addr = txdma_addr + 0x100;
1198 } else { 1211 } else {
1199 if (np->n_addrs < 3 || np->n_intrs < 3) { 1212 static char *rnames[] = {
1213 "Sound Control", "Sound Tx DMA", "Sound Rx DMA" };
1214 if (np->n_intrs < 3) {
1200 err = -ENODEV; 1215 err = -ENODEV;
1201 goto __error; 1216 goto __error;
1202 } 1217 }
1203 1218 for (i = 0; i < 3; i ++) {
1204 for (i = 0; i < 3; i++) { 1219 if (of_address_to_resource(np->parent, i,
1205#ifndef CONFIG_PPC64 1220 &chip->rsrc[i])) {
1206 static char *name[3] = { "- Control", "- Tx DMA", "- Rx DMA" }; 1221 printk(KERN_ERR "snd: can't translate rsrc "
1207 if (! request_OF_resource(np, i, name[i])) { 1222 " %d (%s)\n", i, rnames[i]);
1208 snd_printk(KERN_ERR "pmac: can't request resource %d!\n", i); 1223 err = -ENODEV;
1224 goto __error;
1225 }
1226 if (request_mem_region(chip->rsrc[i].start,
1227 chip->rsrc[i].end -
1228 chip->rsrc[i].start + 1,
1229 rnames[i]) == NULL) {
1230 printk(KERN_ERR "snd: can't request rsrc "
1231 " %d (%s: 0x%08lx:%08lx)\n",
1232 i, rnames[i], chip->rsrc[i].start,
1233 chip->rsrc[i].end);
1209 err = -ENODEV; 1234 err = -ENODEV;
1210 goto __error; 1235 goto __error;
1211 } 1236 }
1212 chip->of_requested |= (1 << i); 1237 chip->requested |= (1 << i);
1213#endif /* CONFIG_PPC64 */
1214 ctrl_addr = np->addrs[0].address;
1215 txdma_addr = np->addrs[1].address;
1216 rxdma_addr = np->addrs[2].address;
1217 } 1238 }
1239 ctrl_addr = chip->rsrc[0].start;
1240 txdma_addr = chip->rsrc[1].start;
1241 rxdma_addr = chip->rsrc[2].start;
1218 } 1242 }
1219 1243
1220 chip->awacs = ioremap(ctrl_addr, 0x1000); 1244 chip->awacs = ioremap(ctrl_addr, 0x1000);
@@ -1266,9 +1290,11 @@ int __init snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1266 } else if (chip->is_pbook_G3) { 1290 } else if (chip->is_pbook_G3) {
1267 struct device_node* mio; 1291 struct device_node* mio;
1268 for (mio = chip->node->parent; mio; mio = mio->parent) { 1292 for (mio = chip->node->parent; mio; mio = mio->parent) {
1269 if (strcmp(mio->name, "mac-io") == 0 1293 if (strcmp(mio->name, "mac-io") == 0) {
1270 && mio->n_addrs > 0) { 1294 struct resource r;
1271 chip->macio_base = ioremap(mio->addrs[0].address, 0x40); 1295 if (of_address_to_resource(mio, 0, &r) == 0)
1296 chip->macio_base =
1297 ioremap(r.start, 0x40);
1272 break; 1298 break;
1273 } 1299 }
1274 } 1300 }