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
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux