aboutsummaryrefslogtreecommitdiffstats
path: root/sound/ppc/pmac.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2005-05-18 10:31:51 -0400
committerJaroslav Kysela <perex@suse.cz>2005-05-29 04:11:14 -0400
commit5218064c885af5c49e380d09d54f3cc86891a580 (patch)
treed4698bad2c3fd7425bb52d1d3cae7c6a8ad48ce8 /sound/ppc/pmac.c
parent9502dcad6c1138a3ce2bae23ccd4be44c718d2a9 (diff)
[ALSA] ppc32: Fix Alsa PowerMac driver on old machines
PPC PMAC driver The g5 support code broke some earlier models unfortunately as those bail out early from the detect function, before the point where I added the code to locate the PCI device for use with DMA allocations. This patch fixes it. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/ppc/pmac.c')
-rw-r--r--sound/ppc/pmac.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index 32d94754acf8..080ef3928465 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -876,7 +876,7 @@ static void __init detect_byte_swap(pmac_t *chip)
876 */ 876 */
877static int __init snd_pmac_detect(pmac_t *chip) 877static int __init snd_pmac_detect(pmac_t *chip)
878{ 878{
879 struct device_node *sound; 879 struct device_node *sound = NULL;
880 unsigned int *prop, l; 880 unsigned int *prop, l;
881 struct macio_chip* macio; 881 struct macio_chip* macio;
882 882
@@ -906,20 +906,22 @@ static int __init snd_pmac_detect(pmac_t *chip)
906 chip->is_pbook_G3 = 1; 906 chip->is_pbook_G3 = 1;
907 chip->node = find_devices("awacs"); 907 chip->node = find_devices("awacs");
908 if (chip->node) 908 if (chip->node)
909 return 0; /* ok */ 909 sound = chip->node;
910 910
911 /* 911 /*
912 * powermac G3 models have a node called "davbus" 912 * powermac G3 models have a node called "davbus"
913 * with a child called "sound". 913 * with a child called "sound".
914 */ 914 */
915 chip->node = find_devices("davbus"); 915 if (!chip->node)
916 chip->node = find_devices("davbus");
916 /* 917 /*
917 * if we didn't find a davbus device, try 'i2s-a' since 918 * if we didn't find a davbus device, try 'i2s-a' since
918 * this seems to be what iBooks have 919 * this seems to be what iBooks have
919 */ 920 */
920 if (! chip->node) { 921 if (! chip->node) {
921 chip->node = find_devices("i2s-a"); 922 chip->node = find_devices("i2s-a");
922 if (chip->node && chip->node->parent && chip->node->parent->parent) { 923 if (chip->node && chip->node->parent &&
924 chip->node->parent->parent) {
923 if (device_is_compatible(chip->node->parent->parent, 925 if (device_is_compatible(chip->node->parent->parent,
924 "K2-Keylargo")) 926 "K2-Keylargo"))
925 chip->is_k2 = 1; 927 chip->is_k2 = 1;
@@ -928,9 +930,11 @@ static int __init snd_pmac_detect(pmac_t *chip)
928 if (! chip->node) 930 if (! chip->node)
929 return -ENODEV; 931 return -ENODEV;
930 932
931 sound = find_devices("sound"); 933 if (!sound) {
932 while (sound && sound->parent != chip->node) 934 sound = find_devices("sound");
933 sound = sound->next; 935 while (sound && sound->parent != chip->node)
936 sound = sound->next;
937 }
934 if (! sound) 938 if (! sound)
935 return -ENODEV; 939 return -ENODEV;
936 prop = (unsigned int *) get_property(sound, "sub-frame", NULL); 940 prop = (unsigned int *) get_property(sound, "sub-frame", NULL);
@@ -1019,7 +1023,8 @@ static int __init snd_pmac_detect(pmac_t *chip)
1019 } 1023 }
1020 } 1024 }
1021 if (chip->pdev == NULL) 1025 if (chip->pdev == NULL)
1022 printk(KERN_WARNING "snd-powermac: can't locate macio PCI device !\n"); 1026 printk(KERN_WARNING "snd-powermac: can't locate macio PCI"
1027 " device !\n");
1023 1028
1024 detect_byte_swap(chip); 1029 detect_byte_swap(chip);
1025 1030
@@ -1027,7 +1032,8 @@ static int __init snd_pmac_detect(pmac_t *chip)
1027 are available */ 1032 are available */
1028 prop = (unsigned int *) get_property(sound, "sample-rates", &l); 1033 prop = (unsigned int *) get_property(sound, "sample-rates", &l);
1029 if (! prop) 1034 if (! prop)
1030 prop = (unsigned int *) get_property(sound, "output-frame-rates", &l); 1035 prop = (unsigned int *) get_property(sound,
1036 "output-frame-rates", &l);
1031 if (prop) { 1037 if (prop) {
1032 int i; 1038 int i;
1033 chip->freqs_ok = 0; 1039 chip->freqs_ok = 0;
@@ -1054,7 +1060,8 @@ static int __init snd_pmac_detect(pmac_t *chip)
1054/* 1060/*
1055 * exported - boolean info callbacks for ease of programming 1061 * exported - boolean info callbacks for ease of programming
1056 */ 1062 */
1057int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1063int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol,
1064 snd_ctl_elem_info_t *uinfo)
1058{ 1065{
1059 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1066 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1060 uinfo->count = 2; 1067 uinfo->count = 2;
@@ -1063,7 +1070,8 @@ int snd_pmac_boolean_stereo_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *
1063 return 0; 1070 return 0;
1064} 1071}
1065 1072
1066int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1073int snd_pmac_boolean_mono_info(snd_kcontrol_t *kcontrol,
1074 snd_ctl_elem_info_t *uinfo)
1067{ 1075{
1068 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1076 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1069 uinfo->count = 1; 1077 uinfo->count = 1;