[ALSA] Add dB scale information to vxpocket and vx222 drivers
Added the dB scale information to vxpocket and vx222 drivers. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
This commit is contained in:
committed by
Jaroslav Kysela
parent
c6ff77f71f
commit
1186ed8c7d
@@ -128,6 +128,7 @@ struct snd_vx_hardware {
|
|||||||
unsigned int num_ins;
|
unsigned int num_ins;
|
||||||
unsigned int num_outs;
|
unsigned int num_outs;
|
||||||
unsigned int output_level_max;
|
unsigned int output_level_max;
|
||||||
|
unsigned int *output_level_db_scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* hwdep id string */
|
/* hwdep id string */
|
||||||
|
@@ -23,6 +23,7 @@
|
|||||||
#include <sound/driver.h>
|
#include <sound/driver.h>
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <sound/vx_core.h>
|
#include <sound/vx_core.h>
|
||||||
#include "vx_cmd.h"
|
#include "vx_cmd.h"
|
||||||
|
|
||||||
@@ -455,10 +456,13 @@ static int vx_output_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_ele
|
|||||||
|
|
||||||
static struct snd_kcontrol_new vx_control_output_level = {
|
static struct snd_kcontrol_new vx_control_output_level = {
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
|
||||||
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
|
||||||
.name = "Master Playback Volume",
|
.name = "Master Playback Volume",
|
||||||
.info = vx_output_level_info,
|
.info = vx_output_level_info,
|
||||||
.get = vx_output_level_get,
|
.get = vx_output_level_get,
|
||||||
.put = vx_output_level_put,
|
.put = vx_output_level_put,
|
||||||
|
/* tlv will be filled later */
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -712,12 +716,17 @@ static int vx_monitor_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DECLARE_TLV_DB_SCALE(db_scale_audio_gain, -10975, 25, 0);
|
||||||
|
|
||||||
static struct snd_kcontrol_new vx_control_audio_gain = {
|
static struct snd_kcontrol_new vx_control_audio_gain = {
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
|
||||||
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
|
||||||
/* name will be filled later */
|
/* name will be filled later */
|
||||||
.info = vx_audio_gain_info,
|
.info = vx_audio_gain_info,
|
||||||
.get = vx_audio_gain_get,
|
.get = vx_audio_gain_get,
|
||||||
.put = vx_audio_gain_put
|
.put = vx_audio_gain_put,
|
||||||
|
.tlv = { .p = db_scale_audio_gain },
|
||||||
};
|
};
|
||||||
static struct snd_kcontrol_new vx_control_output_switch = {
|
static struct snd_kcontrol_new vx_control_output_switch = {
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
@@ -729,9 +738,12 @@ static struct snd_kcontrol_new vx_control_output_switch = {
|
|||||||
static struct snd_kcontrol_new vx_control_monitor_gain = {
|
static struct snd_kcontrol_new vx_control_monitor_gain = {
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
.name = "Monitoring Volume",
|
.name = "Monitoring Volume",
|
||||||
|
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
|
||||||
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
|
||||||
.info = vx_audio_gain_info, /* shared */
|
.info = vx_audio_gain_info, /* shared */
|
||||||
.get = vx_audio_monitor_get,
|
.get = vx_audio_monitor_get,
|
||||||
.put = vx_audio_monitor_put
|
.put = vx_audio_monitor_put,
|
||||||
|
.tlv = { .p = db_scale_audio_gain },
|
||||||
};
|
};
|
||||||
static struct snd_kcontrol_new vx_control_monitor_switch = {
|
static struct snd_kcontrol_new vx_control_monitor_switch = {
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
@@ -918,6 +930,7 @@ int snd_vx_mixer_new(struct vx_core *chip)
|
|||||||
for (i = 0; i < chip->hw->num_outs; i++) {
|
for (i = 0; i < chip->hw->num_outs; i++) {
|
||||||
temp = vx_control_output_level;
|
temp = vx_control_output_level;
|
||||||
temp.index = i;
|
temp.index = i;
|
||||||
|
temp.tlv.p = chip->hw->output_level_db_scale;
|
||||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&temp, chip))) < 0)
|
if ((err = snd_ctl_add(card, snd_ctl_new1(&temp, chip))) < 0)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include <linux/moduleparam.h>
|
#include <linux/moduleparam.h>
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/initval.h>
|
#include <sound/initval.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include "vx222.h"
|
#include "vx222.h"
|
||||||
|
|
||||||
#define CARD_NAME "VX222"
|
#define CARD_NAME "VX222"
|
||||||
@@ -72,6 +73,9 @@ MODULE_DEVICE_TABLE(pci, snd_vx222_ids);
|
|||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static DECLARE_TLV_DB_SCALE(db_scale_old_vol, -11350, 50, 0);
|
||||||
|
static DECLARE_TLV_DB_SCALE(db_scale_akm, -7350, 50, 0);
|
||||||
|
|
||||||
static struct snd_vx_hardware vx222_old_hw = {
|
static struct snd_vx_hardware vx222_old_hw = {
|
||||||
|
|
||||||
.name = "VX222/Old",
|
.name = "VX222/Old",
|
||||||
@@ -81,6 +85,7 @@ static struct snd_vx_hardware vx222_old_hw = {
|
|||||||
.num_ins = 1,
|
.num_ins = 1,
|
||||||
.num_outs = 1,
|
.num_outs = 1,
|
||||||
.output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
|
.output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
|
||||||
|
.output_level_db_scale = db_scale_old_vol,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_vx_hardware vx222_v2_hw = {
|
static struct snd_vx_hardware vx222_v2_hw = {
|
||||||
@@ -92,6 +97,7 @@ static struct snd_vx_hardware vx222_v2_hw = {
|
|||||||
.num_ins = 1,
|
.num_ins = 1,
|
||||||
.num_outs = 1,
|
.num_outs = 1,
|
||||||
.output_level_max = VX2_AKM_LEVEL_MAX,
|
.output_level_max = VX2_AKM_LEVEL_MAX,
|
||||||
|
.output_level_db_scale = db_scale_akm,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_vx_hardware vx222_mic_hw = {
|
static struct snd_vx_hardware vx222_mic_hw = {
|
||||||
@@ -103,6 +109,7 @@ static struct snd_vx_hardware vx222_mic_hw = {
|
|||||||
.num_ins = 1,
|
.num_ins = 1,
|
||||||
.num_outs = 1,
|
.num_outs = 1,
|
||||||
.output_level_max = VX2_AKM_LEVEL_MAX,
|
.output_level_max = VX2_AKM_LEVEL_MAX,
|
||||||
|
.output_level_db_scale = db_scale_akm,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include <sound/core.h>
|
#include <sound/core.h>
|
||||||
#include <sound/control.h>
|
#include <sound/control.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
#include "vx222.h"
|
#include "vx222.h"
|
||||||
|
|
||||||
@@ -845,6 +846,8 @@ static void vx2_set_input_level(struct snd_vx222 *chip)
|
|||||||
|
|
||||||
#define MIC_LEVEL_MAX 0xff
|
#define MIC_LEVEL_MAX 0xff
|
||||||
|
|
||||||
|
static DECLARE_TLV_DB_SCALE(db_scale_mic, -6450, 50, 0);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* controls API for input levels
|
* controls API for input levels
|
||||||
*/
|
*/
|
||||||
@@ -922,18 +925,24 @@ static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
|
|||||||
|
|
||||||
static struct snd_kcontrol_new vx_control_input_level = {
|
static struct snd_kcontrol_new vx_control_input_level = {
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
|
||||||
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
|
||||||
.name = "Capture Volume",
|
.name = "Capture Volume",
|
||||||
.info = vx_input_level_info,
|
.info = vx_input_level_info,
|
||||||
.get = vx_input_level_get,
|
.get = vx_input_level_get,
|
||||||
.put = vx_input_level_put,
|
.put = vx_input_level_put,
|
||||||
|
.tlv = { .p = db_scale_mic },
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_kcontrol_new vx_control_mic_level = {
|
static struct snd_kcontrol_new vx_control_mic_level = {
|
||||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||||
|
.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
|
||||||
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ),
|
||||||
.name = "Mic Capture Volume",
|
.name = "Mic Capture Volume",
|
||||||
.info = vx_mic_level_info,
|
.info = vx_mic_level_info,
|
||||||
.get = vx_mic_level_get,
|
.get = vx_mic_level_get,
|
||||||
.put = vx_mic_level_put,
|
.put = vx_mic_level_put,
|
||||||
|
.tlv = { .p = db_scale_mic },
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -27,6 +27,7 @@
|
|||||||
#include <pcmcia/ciscode.h>
|
#include <pcmcia/ciscode.h>
|
||||||
#include <pcmcia/cisreg.h>
|
#include <pcmcia/cisreg.h>
|
||||||
#include <sound/initval.h>
|
#include <sound/initval.h>
|
||||||
|
#include <sound/tlv.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*/
|
*/
|
||||||
@@ -90,6 +91,8 @@ static int snd_vxpocket_dev_free(struct snd_device *device)
|
|||||||
* Only output levels can be modified
|
* Only output levels can be modified
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static DECLARE_TLV_DB_SCALE(db_scale_old_vol, -11350, 50, 0);
|
||||||
|
|
||||||
static struct snd_vx_hardware vxpocket_hw = {
|
static struct snd_vx_hardware vxpocket_hw = {
|
||||||
.name = "VXPocket",
|
.name = "VXPocket",
|
||||||
.type = VX_TYPE_VXPOCKET,
|
.type = VX_TYPE_VXPOCKET,
|
||||||
@@ -99,6 +102,7 @@ static struct snd_vx_hardware vxpocket_hw = {
|
|||||||
.num_ins = 1,
|
.num_ins = 1,
|
||||||
.num_outs = 1,
|
.num_outs = 1,
|
||||||
.output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
|
.output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
|
||||||
|
.output_level_db_scale = db_scale_old_vol,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* VX-pocket 440
|
/* VX-pocket 440
|
||||||
@@ -120,6 +124,7 @@ static struct snd_vx_hardware vxp440_hw = {
|
|||||||
.num_ins = 2,
|
.num_ins = 2,
|
||||||
.num_outs = 2,
|
.num_outs = 2,
|
||||||
.output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
|
.output_level_max = VX_ANALOG_OUT_LEVEL_MAX,
|
||||||
|
.output_level_db_scale = db_scale_old_vol,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user