Пример #1
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);
	}
}
Пример #2
0
static void codecs_init(u8 *base, u32 codec_mask)
{
	int i;

	/* Can support up to 4 codecs */
	for (i = 3; i >= 0; i--) {
		if (codec_mask & (1 << i))
			hda_codec_init(base, i,
				       cim_verb_data_size,
				       cim_verb_data);
	}

	if (pc_beep_verbs_size)
		hda_codec_write(base, pc_beep_verbs_size, pc_beep_verbs);
}
Пример #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);
		}
	}
}