[Hardy LPIA LUM]: RealTek hda-intel volume remapping for non-linear volume scales

Tim Gardner tim.gardner at canonical.com
Tue Apr 21 16:09:40 UTC 2009


Colin Ian King wrote:
> Hi Tim,
> 
> On Tue, 2009-04-21 at 09:33 -0600, Tim Gardner wrote: 
>> Colin Ian King wrote:
>>> LP#249233 - sound volume too low.
>>>
>>> for Hardy LPIA LUM.
>>>
> [ Text deleted ]
> 
>> Is this really doing what you expect?
>>
>>  static int slave_get_val(struct link_slave *slave,
>>                          struct snd_ctl_elem_value *ucontrol)
>>  {
>> @@ -305,8 +360,15 @@ static int master_put(struct snd_kcontrol *kcontrol,
>>                 master->val = old_val;
>>                 uval->id = slave->slave.id;
>>                 slave_get_val(slave, uval);
>> -               master->val = ucontrol->value.integer.value[0];
>> +
>> +               /* Put to slaves a remapped volume */
>> +               master->val = vol_remap(master->info.min_val,
>> +                                       master->info.max_val,
>> +                                       ucontrol->value.integer.value[0]);
>>                 slave_put_val(slave, uval);
>> +               /* And actually save the original unremapped volume
>> +                  for master_get() */
>> +               master->val = ucontrol->value.integer.value[0];
>>         }
>>         kfree(uval);
>>         return 1;
>>
>> I looks like master-val is simply set twice (unless there are side
>> effects happening in slave_put_val()).
> 
> It's good to know your eye is keen... 
> 
> The fact is that slave_put_val() requires a master->val to be set for
> the volume to be set correctly (this case a remapped version). However
> master->val can be interrogated later for the master volume setting, and
> we need to return the expected value and not the remapped value else we
> get ALSA confused. Without a major rewrite of slave_put_xval() I cannot
> see around this.
> 
> Colin

In that case ACK (but also ick!)

-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list