[alsa-devel] Question about snd_soc_add_controls
Dear very kind guys
I would like to use snd_soc_add_controls for ak4642. But I'm not good at it now, so, for 1st step, I would like to add "Playback Volume".
Playback Volume length of ak4642 chip is -115.0 dB to +12.0 dB step is 0.5 dB. and It can use mute.
So, I created code like this ---------------------------------------------------------------------------- static const DECLARE_TLV_DB_SCALE(out_tlv, -11500, 50, 1); /* 0.5 dB step */
static const struct snd_kcontrol_new ak4642_snd_controls[] = {
SOC_DOUBLE_R_TLV("Playback Volume", L_DVC, R_DVC, 0, 256, 0, out_tlv), }; ----------------------------------------------------------------------------
But I wonder #define DECLARE_TLV_DB_SCALE(name, min, step, mute)
Does this "mute" mean that it can use mute ? But how to ?
#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array)
What is this "xinvert" ?
Can you please teach me about above ? And where is these code used ? It seems very complex for me...
Best regards -- Kuninori Morimoto
On 21 Jun 2010, at 10:19, Kuninori Morimoto wrote:
But I wonder #define DECLARE_TLV_DB_SCALE(name, min, step, mute)
Does this "mute" mean that it can use mute ? But how to ?
In many chips the lowest gain setting is defined as mute rather than a dB value. Setting the mute flag indicates that this is the case for this gain control.
#define SOC_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, xinvert, tlv_array)
What is this "xinvert" ?
It means that instead of the lowest register value being the lowest volume the highest register value is the lowest volume. This is used to ensure the control is mapped properly in userspace so sliders raise the volume when moved upwards.
Can you please teach me about above ? And where is these code used ? It seems very complex for me...
See the functions that are specified in the macro - these values are used to generate ALSA controls for the specified bitfields.
Dear Mark
Thank you for your help !!
In many chips the lowest gain setting is defined as mute rather than a dB value. Setting the mute flag indicates that this is the case for this gain control.
(snip)
It means that instead of the lowest register value being the lowest volume the highest register value is the lowest volume. This is used to ensure the control is mapped properly in userspace so sliders raise the volume when moved upwards.
(snip)
See the functions that are specified in the macro - these values are used to generate ALSA controls for the specified bitfields.
Best regards -- Kuninori Morimoto
participants (2)
-
Kuninori Morimoto
-
Mark Brown