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.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index c64af55865d4..2bae9c1a2b54 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -816,6 +816,7 @@ static int snd_pmac_free(struct snd_pmac *chip)
816 816
817 if (chip->pdev) 817 if (chip->pdev)
818 pci_dev_put(chip->pdev); 818 pci_dev_put(chip->pdev);
819 of_node_put(chip->node);
819 kfree(chip); 820 kfree(chip);
820 return 0; 821 return 0;
821} 822}
@@ -863,8 +864,10 @@ static void __init detect_byte_swap(struct snd_pmac *chip)
863 */ 864 */
864static int __init snd_pmac_detect(struct snd_pmac *chip) 865static int __init snd_pmac_detect(struct snd_pmac *chip)
865{ 866{
866 struct device_node *sound = NULL; 867 struct device_node *sound;
867 unsigned int *prop, l; 868 struct device_node *dn;
869 const unsigned int *prop;
870 unsigned int l;
868 struct macio_chip* macio; 871 struct macio_chip* macio;
869 872
870 if (!machine_is(powermac)) 873 if (!machine_is(powermac))
@@ -890,22 +893,21 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
890 else if (machine_is_compatible("PowerBook1,1") 893 else if (machine_is_compatible("PowerBook1,1")
891 || machine_is_compatible("AAPL,PowerBook1998")) 894 || machine_is_compatible("AAPL,PowerBook1998"))
892 chip->is_pbook_G3 = 1; 895 chip->is_pbook_G3 = 1;
893 chip->node = find_devices("awacs"); 896 chip->node = of_find_node_by_name(NULL, "awacs");
894 if (chip->node) 897 sound = of_node_get(chip->node);
895 sound = chip->node;
896 898
897 /* 899 /*
898 * powermac G3 models have a node called "davbus" 900 * powermac G3 models have a node called "davbus"
899 * with a child called "sound". 901 * with a child called "sound".
900 */ 902 */
901 if (!chip->node) 903 if (!chip->node)
902 chip->node = find_devices("davbus"); 904 chip->node = of_find_node_by_name(NULL, "davbus");
903 /* 905 /*
904 * if we didn't find a davbus device, try 'i2s-a' since 906 * if we didn't find a davbus device, try 'i2s-a' since
905 * this seems to be what iBooks have 907 * this seems to be what iBooks have
906 */ 908 */
907 if (! chip->node) { 909 if (! chip->node) {
908 chip->node = find_devices("i2s-a"); 910 chip->node = of_find_node_by_name(NULL, "i2s-a");
909 if (chip->node && chip->node->parent && 911 if (chip->node && chip->node->parent &&
910 chip->node->parent->parent) { 912 chip->node->parent->parent) {
911 if (device_is_compatible(chip->node->parent->parent, 913 if (device_is_compatible(chip->node->parent->parent,
@@ -917,22 +919,25 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
917 return -ENODEV; 919 return -ENODEV;
918 920
919 if (!sound) { 921 if (!sound) {
920 sound = find_devices("sound"); 922 sound = of_find_node_by_name(NULL, "sound");
921 while (sound && sound->parent != chip->node) 923 while (sound && sound->parent != chip->node)
922 sound = sound->next; 924 sound = of_find_node_by_name(sound, "sound");
923 } 925 }
924 if (! sound) 926 if (! sound) {
927 of_node_put(chip->node);
925 return -ENODEV; 928 return -ENODEV;
926 prop = (unsigned int *) get_property(sound, "sub-frame", NULL); 929 }
930 prop = of_get_property(sound, "sub-frame", NULL);
927 if (prop && *prop < 16) 931 if (prop && *prop < 16)
928 chip->subframe = *prop; 932 chip->subframe = *prop;
929 prop = (unsigned int *) get_property(sound, "layout-id", NULL); 933 prop = of_get_property(sound, "layout-id", NULL);
930 if (prop) { 934 if (prop) {
931 /* partly deprecate snd-powermac, for those machines 935 /* partly deprecate snd-powermac, for those machines
932 * that have a layout-id property for now */ 936 * that have a layout-id property for now */
933 printk(KERN_INFO "snd-powermac no longer handles any " 937 printk(KERN_INFO "snd-powermac no longer handles any "
934 "machines with a layout-id property " 938 "machines with a layout-id property "
935 "in the device-tree, use snd-aoa.\n"); 939 "in the device-tree, use snd-aoa.\n");
940 of_node_put(chip->node);
936 return -ENODEV; 941 return -ENODEV;
937 } 942 }
938 /* This should be verified on older screamers */ 943 /* This should be verified on older screamers */
@@ -967,10 +972,12 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
967 chip->freq_table = tumbler_freqs; 972 chip->freq_table = tumbler_freqs;
968 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */ 973 chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */
969 } 974 }
970 prop = (unsigned int *)get_property(sound, "device-id", NULL); 975 prop = of_get_property(sound, "device-id", NULL);
971 if (prop) 976 if (prop)
972 chip->device_id = *prop; 977 chip->device_id = *prop;
973 chip->has_iic = (find_devices("perch") != NULL); 978 dn = of_find_node_by_name(NULL, "perch");
979 chip->has_iic = (dn != NULL);
980 of_node_put(dn);
974 981
975 /* We need the PCI device for DMA allocations, let's use a crude method 982 /* We need the PCI device for DMA allocations, let's use a crude method
976 * for now ... 983 * for now ...
@@ -997,10 +1004,9 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
997 1004
998 /* look for a property saying what sample rates 1005 /* look for a property saying what sample rates
999 are available */ 1006 are available */
1000 prop = (unsigned int *) get_property(sound, "sample-rates", &l); 1007 prop = of_get_property(sound, "sample-rates", &l);
1001 if (! prop) 1008 if (! prop)
1002 prop = (unsigned int *) get_property(sound, 1009 prop = of_get_property(sound, "output-frame-rates", &l);
1003 "output-frame-rates", &l);
1004 if (prop) { 1010 if (prop) {
1005 int i; 1011 int i;
1006 chip->freqs_ok = 0; 1012 chip->freqs_ok = 0;
@@ -1021,6 +1027,7 @@ static int __init snd_pmac_detect(struct snd_pmac *chip)
1021 chip->freqs_ok = 1; 1027 chip->freqs_ok = 1;
1022 } 1028 }
1023 1029
1030 of_node_put(sound);
1024 return 0; 1031 return 0;
1025} 1032}
1026 1033