chip->node = find_devices("davbus"); 
if (!chip->node) chip->node = find_devices("davbus"); 
static int __init snd_pmac_detect(pmac_t *chip){	struct device_node *sound;	unsigned int *prop, l;	struct macio_chip* macio;	u32 layout_id = 0;	if (_machine != _MACH_Pmac)		return -ENODEV;	chip->subframe = 0;	chip->revision = 0;	chip->freqs_ok = 0xff; /* all ok */	chip->model = PMAC_AWACS;	chip->can_byte_swap = 1;	chip->can_duplex = 1;	chip->can_capture = 1;	chip->num_freqs = ARRAY_SIZE(awacs_freqs);	chip->freq_table = awacs_freqs;	chip->control_mask = MASK_IEPC | MASK_IEE | 0x11; /* default */	/* check machine type */	if (machine_is_compatible("AAPL,3400/2400")	    || machine_is_compatible("AAPL,3500"))		chip->is_pbook_3400 = 1;	else if (machine_is_compatible("PowerBook1,1")		 || machine_is_compatible("AAPL,PowerBook1998"))		chip->is_pbook_G3 = 1;	chip->node = find_devices("awacs");	if (chip->node)		return 0; /* ok */	/*	 * powermac G3 models have a node called "davbus"	 * with a child called "sound".	 */	chip->node = find_devices("davbus");	/*	 * if we didn't find a davbus device, try 'i2s-a' since	 * this seems to be what iBooks have	 */	if (! chip->node) {		chip->node = find_devices("i2s-a");		if (chip->node && chip->node->parent && chip->node->parent->parent) {			if (device_is_compatible(chip->node->parent->parent,						 "K2-Keylargo"))				chip->is_k2 = 1;		}	}	if (! chip->node)		return -ENODEV;	sound = find_devices("sound");	while (sound && sound->parent != chip->node)		sound = sound->next;	if (! sound)		return -ENODEV;	prop = (unsigned int *) get_property(sound, "sub-frame", NULL);	if (prop && *prop < 16)		chip->subframe = *prop;	prop = (unsigned int *) get_property(sound, "layout-id", NULL);	if (prop)		layout_id = *prop;	/* This should be verified on older screamers */	if (device_is_compatible(sound, "screamer")) {		chip->model = PMAC_SCREAMER;		// chip->can_byte_swap = 0; /* FIXME: check this */	}	if (device_is_compatible(sound, "burgundy")) {		chip->model = PMAC_BURGUNDY;		chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */	}	if (device_is_compatible(sound, "daca")) {		chip->model = PMAC_DACA;		chip->can_capture = 0;  /* no capture */		chip->can_duplex = 0;		// chip->can_byte_swap = 0; /* FIXME: check this */		chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */	}	if (device_is_compatible(sound, "tumbler")) {		chip->model = PMAC_TUMBLER;		chip->can_capture = 0;  /* no capture */		chip->can_duplex = 0;		// chip->can_byte_swap = 0; /* FIXME: check this */		chip->num_freqs = ARRAY_SIZE(tumbler_freqs);		chip->freq_table = tumbler_freqs;		chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */	}	if (device_is_compatible(sound, "snapper")) {		chip->model = PMAC_SNAPPER;		// chip->can_byte_swap = 0; /* FIXME: check this */		chip->num_freqs = ARRAY_SIZE(tumbler_freqs);		chip->freq_table = tumbler_freqs;		chip->control_mask = MASK_IEPC | 0x11; /* disable IEE */	}	if (device_is_compatible(sound, "AOAKeylargo") ||	    device_is_compatible(sound, "AOAbase") ||	    device_is_compatible(sound, "AOAK2")) {		/* For now, only support very basic TAS3004 based machines with		 * single frequency until proper i2s control is implemented		 */		switch(layout_id) {		case 0x48:		case 0x46:		case 0x33:		case 0x29:		case 0x24:			chip->num_freqs = ARRAY_SIZE(tumbler_freqs);			chip->model = PMAC_SNAPPER;			chip->can_byte_swap = 0; /* FIXME: check this */			chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */			break;		case 0x3a:			chip->num_freqs = ARRAY_SIZE(tumbler_freqs);			chip->model = PMAC_TOONIE;			chip->can_byte_swap = 0; /* FIXME: check this */			chip->control_mask = MASK_IEPC | 0x11;/* disable IEE */			break;		}	}	prop = (unsigned int *)get_property(sound, "device-id", NULL);	if (prop)		chip->device_id = *prop;	chip->has_iic = (find_devices("perch") != NULL);	/* We need the PCI device for DMA allocations, let's use a crude method	 * for now ...	 */	macio = macio_find(chip->node, macio_unknown);	if (macio == NULL)		printk(KERN_WARNING "snd-powermac: can't locate macio !\n");	else {		struct pci_dev *pdev = NULL;		for_each_pci_dev(pdev) {			struct device_node *np = pci_device_to_OF_node(pdev);			if (np && np == macio->of_node) {				chip->pdev = pdev;				break;			}		}	}	if (chip->pdev == NULL)		printk(KERN_WARNING "snd-powermac: can't locate macio PCI device !\n");	detect_byte_swap(chip);	/* look for a property saying what sample rates	   are available */	prop = (unsigned int *) get_property(sound, "sample-rates", &l);	if (! prop)		prop = (unsigned int *) get_property(sound, "output-frame-rates", &l);	if (prop) {		int i;		chip->freqs_ok = 0;		for (l /= sizeof(int); l > 0; --l) {			unsigned int r = *prop++;			/* Apple 'Fixed' format */			if (r >= 0x10000)				r >>= 16;			for (i = 0; i < chip->num_freqs; ++i) {				if (r == chip->freq_table[i]) {					chip->freqs_ok |= (1 << i);					break;				}			}		}	} else {		/* assume only 44.1khz */		chip->freqs_ok = 1;	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/9ae250d175e1cbff82223ce2c07897c790c5b948/pmac.c/clean/sound/ppc/pmac.c