[ALSA] echoaudio, add TLV support
This patch adds TLV support to the echoaudio driver. All gains are in the range -127dB to +6dB with steps of 1dB, and -128 is mute. VU-meters levels go from -128 to 0dB. The input gain of the Layla20 ranges from -25dB to +25dB in steps of 0.5dB. Signed-off-by: Giuliano Pochini <pochini@shiny.it> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
parent
d1d985f019
commit
048b945077
|
@ -47,6 +47,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -34,6 +34,7 @@ module_param_array(enable, bool, NULL, 0444);
|
||||||
MODULE_PARM_DESC(enable, "Enable " ECHOCARD_NAME " soundcard.");
|
MODULE_PARM_DESC(enable, "Enable " ECHOCARD_NAME " soundcard.");
|
||||||
|
|
||||||
static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999};
|
static unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999};
|
||||||
|
static DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1);
|
||||||
|
|
||||||
static int get_firmware(const struct firmware **fw_entry,
|
static int get_firmware(const struct firmware **fw_entry,
|
||||||
const struct firmware *frm, struct echoaudio *chip)
|
const struct firmware *frm, struct echoaudio *chip)
|
||||||
|
@ -1011,17 +1012,21 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol,
|
||||||
static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = {
|
static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = {
|
||||||
.name = "Line Playback Volume",
|
.name = "Line Playback Volume",
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
||||||
.info = snd_echo_output_gain_info,
|
.info = snd_echo_output_gain_info,
|
||||||
.get = snd_echo_output_gain_get,
|
.get = snd_echo_output_gain_get,
|
||||||
.put = snd_echo_output_gain_put,
|
.put = snd_echo_output_gain_put,
|
||||||
|
.tlv = {.p = db_scale_output_gain},
|
||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = {
|
static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = {
|
||||||
.name = "PCM Playback Volume",
|
.name = "PCM Playback Volume",
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
||||||
.info = snd_echo_output_gain_info,
|
.info = snd_echo_output_gain_info,
|
||||||
.get = snd_echo_output_gain_get,
|
.get = snd_echo_output_gain_get,
|
||||||
.put = snd_echo_output_gain_put,
|
.put = snd_echo_output_gain_put,
|
||||||
|
.tlv = {.p = db_scale_output_gain},
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1080,12 +1085,16 @@ static int snd_echo_input_gain_put(struct snd_kcontrol *kcontrol,
|
||||||
return changed;
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DECLARE_TLV_DB_SCALE(db_scale_input_gain, -2500, 50, 0);
|
||||||
|
|
||||||
static struct snd_kcontrol_new snd_echo_line_input_gain __devinitdata = {
|
static struct snd_kcontrol_new snd_echo_line_input_gain __devinitdata = {
|
||||||
.name = "Line Capture Volume",
|
.name = "Line Capture Volume",
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
||||||
.info = snd_echo_input_gain_info,
|
.info = snd_echo_input_gain_info,
|
||||||
.get = snd_echo_input_gain_get,
|
.get = snd_echo_input_gain_get,
|
||||||
.put = snd_echo_input_gain_put,
|
.put = snd_echo_input_gain_put,
|
||||||
|
.tlv = {.p = db_scale_input_gain},
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ECHOCARD_HAS_INPUT_GAIN */
|
#endif /* ECHOCARD_HAS_INPUT_GAIN */
|
||||||
|
@ -1277,9 +1286,11 @@ static int snd_echo_mixer_put(struct snd_kcontrol *kcontrol,
|
||||||
static struct snd_kcontrol_new snd_echo_monitor_mixer __devinitdata = {
|
static struct snd_kcontrol_new snd_echo_monitor_mixer __devinitdata = {
|
||||||
.name = "Monitor Mixer Volume",
|
.name = "Monitor Mixer Volume",
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
||||||
.info = snd_echo_mixer_info,
|
.info = snd_echo_mixer_info,
|
||||||
.get = snd_echo_mixer_get,
|
.get = snd_echo_mixer_get,
|
||||||
.put = snd_echo_mixer_put,
|
.put = snd_echo_mixer_put,
|
||||||
|
.tlv = {.p = db_scale_output_gain},
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ECHOCARD_HAS_MONITOR */
|
#endif /* ECHOCARD_HAS_MONITOR */
|
||||||
|
@ -1343,9 +1354,11 @@ static int snd_echo_vmixer_put(struct snd_kcontrol *kcontrol,
|
||||||
static struct snd_kcontrol_new snd_echo_vmixer __devinitdata = {
|
static struct snd_kcontrol_new snd_echo_vmixer __devinitdata = {
|
||||||
.name = "VMixer Volume",
|
.name = "VMixer Volume",
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
||||||
.info = snd_echo_vmixer_info,
|
.info = snd_echo_vmixer_info,
|
||||||
.get = snd_echo_vmixer_get,
|
.get = snd_echo_vmixer_get,
|
||||||
.put = snd_echo_vmixer_put,
|
.put = snd_echo_vmixer_put,
|
||||||
|
.tlv = {.p = db_scale_output_gain},
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ECHOCARD_HAS_VMIXER */
|
#endif /* ECHOCARD_HAS_VMIXER */
|
||||||
|
@ -1753,9 +1766,12 @@ static int snd_echo_vumeters_get(struct snd_kcontrol *kcontrol,
|
||||||
static struct snd_kcontrol_new snd_echo_vumeters __devinitdata = {
|
static struct snd_kcontrol_new snd_echo_vumeters __devinitdata = {
|
||||||
.name = "VU-meters",
|
.name = "VU-meters",
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
|
.access = SNDRV_CTL_ELEM_ACCESS_READ |
|
||||||
|
SNDRV_CTL_ELEM_ACCESS_VOLATILE |
|
||||||
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
||||||
.info = snd_echo_vumeters_info,
|
.info = snd_echo_vumeters_info,
|
||||||
.get = snd_echo_vumeters_get,
|
.get = snd_echo_vumeters_get,
|
||||||
|
.tlv = {.p = db_scale_output_gain},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -50,6 +50,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -58,6 +58,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
|
@ -55,6 +55,7 @@
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/info.h>
|
#include <sound/info.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/pcm.h>
|
#include <sound/pcm.h>
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
|
|
Loading…
Reference in New Issue