[alsa-devel] [PATCH] ALSA: hda: Conexant: Allow different output types to share DAC

David Henningsson david.henningsson at canonical.com
Thu Aug 25 15:01:32 CEST 2011


On 2011-08-25 14:03, Takashi Iwai wrote:
> At Thu, 25 Aug 2011 13:26:26 +0200,
> David Henningsson wrote:
>>
>> > From 95ca8a0cd32ad781c54a349c5ce84a9119668f9c Mon Sep 17 00:00:00 2001
>> From: David Henningsson<david.henningsson at canonical.com>
>> Date: Thu, 25 Aug 2011 13:16:02 +0200
>> Subject: [PATCH] ALSA: hda: Conexant: Allow different output types to share DAC
>>
>> Headphones has stopped working for the original reported (a regression
>> compared to 2.6.38). This is because Speaker and Headphones share the
>> same DAC, in which case no Headphones volume control was created.
>> This patch fixes so that both Speaker and Headphones volume
>> controls are created in such scenario.
>>
>> Buglink: http://bugs.launchpad.net/bugs/817943
>> Signed-off-by: David Henningsson<david.henningsson at canonical.com>
>> ---
>>   sound/pci/hda/patch_conexant.c |   40 ++++++++++++++++++++++------------------
>>   1 files changed, 22 insertions(+), 18 deletions(-)
>>
>> diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
>> index 197ad93..a29b88d 100644
>> --- a/sound/pci/hda/patch_conexant.c
>> +++ b/sound/pci/hda/patch_conexant.c
>> @@ -3327,22 +3327,23 @@ static int fill_cx_auto_dacs(struct hda_codec *codec, hda_nid_t *dacs)
>>   }
>>
>>   /* fill pin_dac_pair list from the pin and dac list */
>> -static int fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
>> +static void fill_dacs_for_pins(struct hda_codec *codec, hda_nid_t *pins,
>>   			      int num_pins, hda_nid_t *dacs, int *rest,
>> -			      struct pin_dac_pair *filled, int type)
>> +			      struct pin_dac_pair *filled, int *saved_nums,
>> +			      int type)
>>   {
>>   	int i, nums;
>>
>> -	nums = 0;
>> +	nums = *saved_nums;
>>   	for (i = 0; i<  num_pins; i++) {
>>   		filled[nums].pin = pins[i];
>>   		filled[nums].type = type;
>>   		filled[nums].dac = get_unassigned_dac(codec, pins[i], dacs, rest);
>> -		if (!filled[nums].dac&&  i>  0&&  filled[0].dac)
>> +		if (!filled[nums].dac&&  filled[0].dac)
>>   			filled[nums].dac = filled[0].dac | DAC_SLAVE_FLAG;
>
> It should try the first DAC of the same type at first, not always
> to filled[0].

Ok, fair point. I'm attaching a revised patch that also checks that the 
DAC is actually reachable, which should be even better.

>> @@ -4155,7 +4159,7 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
>>   		const char *label;
>>   		int idx, type;
>>   		hda_nid_t dac = spec->dac_info[i].dac;
>> -		if (!dac || (dac&  DAC_SLAVE_FLAG))
>> +		if (!dac)
>>   			continue;
>
> With the fix like the above, the whole NULL-dac check should be
> skipped, too.

Since NULL-dac is essentially an error, this is more a matter of taste IMO.

> How about the revised patch below?

Took some of it into the attached version of the patch.

-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-ALSA-hda-Conexant-Allow-different-output-types-to-sh.patch
Type: text/x-patch
Size: 0 bytes
Desc: not available
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20110825/be3eb1de/attachment.patch 


More information about the Alsa-devel mailing list