[alsa-devel] ALSA hda/patch_via -- Error in via_auto_fill_dac_nids

Massimo Del Fedele max at veneto.com
Wed Oct 31 16:54:21 CET 2012


The function should scan all paths from DACs to OUTS, but like it is just takes the first available DAC.
The problem arises here :

		if (dac) {
			spec->private_dac_nids[i] = dac;
			dac_num++;
		}

Which correctly adds DAC to used list, but doesn't update the total number of found DACs
in spec->multiout.num_dacs; following calls to is_empty_dac() will always return true
for already used DACs, making parse_output_path() return always the first one.

Corrected function should be like this :

static int via_auto_fill_dac_nids(struct hda_codec *codec)
{
	struct via_spec *spec = codec->spec;
	const struct auto_pin_cfg *cfg = &spec->autocfg;
	int i;
	hda_nid_t nid;

	spec->multiout.dac_nids = spec->private_dac_nids;
	spec->multiout.num_dacs = 0;
	for (i = 0; i < cfg->line_outs; i++) {
		hda_nid_t dac = 0;
		nid = cfg->line_out_pins[i];
		if (!nid)
			continue;
		if (parse_output_path(codec, nid, 0, 0, &spec->out_path[i]))
			dac = spec->out_path[i].path[0];
		if (!i && parse_output_path(codec, nid, dac, 1,
					    &spec->out_mix_path))
			dac = spec->out_mix_path.path[0];
		if (dac) {
			spec->private_dac_nids[i] = dac;
			spec->multiout.num_dacs++;
		}
	}
	if (!spec->out_path[0].depth && spec->out_mix_path.depth) {
		spec->out_path[0] = spec->out_mix_path;
		spec->out_mix_path.depth = 0;
	}
	return 0;
}

This one (and a few other changes) allows the subwoofer of asus g75 work correctly.
Sorry for not submitting a patch, I'm quite new to alsa; please tell me if/how I should do it.

Ciao
Max



More information about the Alsa-devel mailing list