[alsa-devel] [PATCHv3 2/2] ASoC: OMAP-McBSP: ASoC interface for McBSP sidetone

Ilkka Koskinen ikoskine at nokia.com
Thu Feb 18 18:16:06 CET 2010



On Thu, 18 Feb 2010, Ujfalusi Peter (Nokia-D/Tampere) wrote:
> On Thursday 18 February 2010 14:37:15 Koskinen Ilkka (Nokia-D/Tampere) wrote:
>
> ...
>
>> +static int omap_mcbsp_set_st_channel_vol(struct snd_kcontrol *kcontrol,
>> +                                     struct snd_ctl_elem_value *ucontrol,
>> +                                     int id, int channel)
>> +{
>> +     struct soc_mixer_control *mc =
>> +             (struct soc_mixer_control *)kcontrol->private_value;
>> +     int max = mc->max;
>> +     int min = mc->min;
>> +     int val = ucontrol->value.integer.value[0];
>> +
>> +     if (val < min || val > max)
>> +             return -EINVAL;
>> +
>> +     return omap_st_set_chgain((id)-1, val, 0, channel);
>
> So how do you actually set the ch1 gain to other than 0?
>
> int omap_st_set_chgain(unsigned int id, s16 ch0gain, s16 ch1gain, int channels);
>
> So in any cases you are calling with ch1gain = 0, and depending on the 
> selected channel you put that to ch0gain. All in all, with this code you 
> are only able to update ch0, and never the ch1.

Damn, it seems that I have messed up my trees :( That's obviously from the 
time I was just experimenting it, and I fixed it some time ago already.

> Should than the omap_st_set_chgain have only one parameter for the gain, and the
> channel parameter tells the code to which channel to put the gain?
>
>> +}
>> +
>> +static int omap_mcbsp_get_st_channel_vol(struct snd_kcontrol *kcontrol,
>> +                                     struct snd_ctl_elem_value *ucontrol,
>> +                                     int id, int channel)
>> +{
>> +     s16 ch0gain, ch1gain;
>> +
>> +     if (omap_st_get_chgain((id)-1, &ch0gain, &ch1gain))
>> +             return -EAGAIN;
>
> Than probably the omap_st_get_chgain should only retrieve the gain for one
> channel also?

Yes, indeed.


Sorry for the confusion. I'll send the fixed patches soon.

Cheers, Ilkka

>> +
>> +     if (channel == OMAP_MCBSP_ST_CHANNEL_0)
>> +             ucontrol->value.integer.value[0] = ch0gain;
>> +     else if (channel == OMAP_MCBSP_ST_CHANNEL_1)
>> +             ucontrol->value.integer.value[0] = ch1gain;
>> +
>> +     return 0;
>> +}
>> +
>
> --
> Péter
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>


More information about the Alsa-devel mailing list