Example #1
0
static void azalia_init(struct device *dev)
{
	u8 *base;
	struct resource *res;
	u32 codec_mask;
	u32 reg32;

	/* Find base address */
	res = find_resource(dev, PCI_BASE_ADDRESS_0);
	if (!res)
		return;

	base = res2mmio(res, 0, 0);
	printk(BIOS_DEBUG, "Azalia: base = %p\n", base);

	/* Set Bus Master */
	reg32 = pci_read_config32(dev, PCI_COMMAND);
	pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);

	azalia_pch_init(dev, base);

	codec_mask = hda_codec_detect(base);

	if (codec_mask) {
		printk(BIOS_DEBUG, "Azalia: codec_mask = %02x\n", codec_mask);
		codecs_init(base, codec_mask);
	}
}
Example #2
0
static void hda_init(device_t dev)
{
	struct resource *res;
	int codec_mask;
	int i;
	u8 *base;

	reg_script_run_on_dev(dev, init_ops);

	res = find_resource(dev, PCI_BASE_ADDRESS_0);
	if (res == NULL)
		return;

	base = res2mmio(res, 0, 0);
	codec_mask = hda_codec_detect(base);

	printk(BIOS_DEBUG, "codec mask = %x\n", codec_mask);
	if (!codec_mask)
		return;

	for (i = 3; i >= 0; i--) {
		if (!((1 << i) & codec_mask))
			continue;
		hda_codec_init(base, i, sizeof(hdmi_codec_verb_table),
				hdmi_codec_verb_table);
	}
}
Example #3
0
static void minihd_init(struct device *dev)
{
	struct resource *res;
	u8 *base, reg32;
	int codec_mask, i;

	/* Find base address */
	res = find_resource(dev, PCI_BASE_ADDRESS_0);
	if (!res)
		return;

	base = res2mmio(res, 0, 0);
	printk(BIOS_DEBUG, "Mini-HD: base = %p\n", base);

	/* Set Bus Master */
	reg32 = pci_read_config32(dev, PCI_COMMAND);
	pci_write_config32(dev, PCI_COMMAND, reg32 | PCI_COMMAND_MASTER);

	/* Mini-HD configuration */
	reg32 = read32(base + 0x100c);
	reg32 &= 0xfffc0000;
	reg32 |= 0x4;
	write32(base + 0x100c, reg32);

	reg32 = read32(base + 0x1010);
	reg32 &= 0xfffc0000;
	reg32 |= 0x4b;
	write32(base + 0x1010, reg32);

	/* Init the codec and write the verb table */
	codec_mask = hda_codec_detect(base);

	if (codec_mask) {
		for (i = 3; i >= 0; i--) {
			if (codec_mask & (1 << i))
				hda_codec_init(base, i,
					       sizeof(minihd_verb_table),
					       minihd_verb_table);
		}
	}
}