Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Massimo Del Fedele <max@veneto.com>
To: alsa-devel@alsa-project.org
Subject: ALSA hda/patch_via -- Error in via_auto_fill_dac_nids
Date: Wed, 31 Oct 2012 16:54:21 +0100	[thread overview]
Message-ID: <k6rhjc$u6m$1@ger.gmane.org> (raw)

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

                 reply	other threads:[~2012-10-31 15:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='k6rhjc$u6m$1@ger.gmane.org' \
    --to=max@veneto.com \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox