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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

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?

> +
> +	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@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux