summaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorTorsten Schenk <torsten.schenk@zoho.com>2012-02-22 15:20:54 +0100
committerTakashi Iwai <tiwai@suse.de>2012-02-22 15:50:56 +0100
commit8e247a9c90e65b25b5b064e2159d9c4c2c173a5e (patch)
treea8f58503dc3a5a02e385e27ab99062ff60e310f2 /sound/usb
parentc596758f57aa33e5e89c006867ae66fa2f9c357c (diff)
downloadop-kernel-dev-8e247a9c90e65b25b5b064e2159d9c4c2c173a5e.zip
op-kernel-dev-8e247a9c90e65b25b5b064e2159d9c4c2c173a5e.tar.gz
ALSA: snd-usb-6fire: add tlv to controls
Remove the soft log-conversion and add a dB scale according to the DAC documentation instead. Signed-off-by: Torsten Schenk <torsten.schenk@zoho.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/6fire/control.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/sound/usb/6fire/control.c b/sound/usb/6fire/control.c
index 8111844..b00b8bb 100644
--- a/sound/usb/6fire/control.c
+++ b/sound/usb/6fire/control.c
@@ -15,6 +15,7 @@
#include <linux/interrupt.h>
#include <sound/control.h>
+#include <sound/tlv.h>
#include "control.h"
#include "comm.h"
@@ -24,26 +25,6 @@ static char *opt_coax_texts[2] = { "Optical", "Coax" };
static char *line_phono_texts[2] = { "Line", "Phono" };
/*
- * calculated with $value\[i\] = 128 \cdot sqrt[3]{\frac{i}{128}}$
- * this is done because the linear values cause rapid degredation
- * of volume in the uppermost region.
- */
-static const u8 log_volume_table[128] = {
- 0x00, 0x19, 0x20, 0x24, 0x28, 0x2b, 0x2e, 0x30, 0x32, 0x34,
- 0x36, 0x38, 0x3a, 0x3b, 0x3d, 0x3e, 0x40, 0x41, 0x42, 0x43,
- 0x44, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e,
- 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x53, 0x54, 0x55, 0x56,
- 0x56, 0x57, 0x58, 0x58, 0x59, 0x5a, 0x5b, 0x5b, 0x5c, 0x5c,
- 0x5d, 0x5e, 0x5e, 0x5f, 0x60, 0x60, 0x61, 0x61, 0x62, 0x62,
- 0x63, 0x63, 0x64, 0x65, 0x65, 0x66, 0x66, 0x67, 0x67, 0x68,
- 0x68, 0x69, 0x69, 0x6a, 0x6a, 0x6b, 0x6b, 0x6c, 0x6c, 0x6c,
- 0x6d, 0x6d, 0x6e, 0x6e, 0x6f, 0x6f, 0x70, 0x70, 0x70, 0x71,
- 0x71, 0x72, 0x72, 0x73, 0x73, 0x73, 0x74, 0x74, 0x75, 0x75,
- 0x75, 0x76, 0x76, 0x77, 0x77, 0x77, 0x78, 0x78, 0x78, 0x79,
- 0x79, 0x7a, 0x7a, 0x7a, 0x7b, 0x7b, 0x7b, 0x7c, 0x7c, 0x7c,
- 0x7d, 0x7d, 0x7d, 0x7e, 0x7e, 0x7e, 0x7f, 0x7f };
-
-/*
* data that needs to be sent to device. sets up card internal stuff.
* values dumped from windows driver and filtered by trial'n'error.
*/
@@ -69,6 +50,8 @@ static const int rates_altsetting[] = { 1, 1, 2, 2, 3, 3 };
static const u16 rates_6fire_vl[] = {0x00, 0x01, 0x00, 0x01, 0x00, 0x01};
static const u16 rates_6fire_vh[] = {0x11, 0x11, 0x10, 0x10, 0x00, 0x00};
+static DECLARE_TLV_DB_MINMAX(tlv_output, -9000, 0);
+
enum {
DIGITAL_THRU_ONLY_SAMPLERATE = 3
};
@@ -78,8 +61,7 @@ static void usb6fire_control_master_vol_update(struct control_runtime *rt)
struct comm_runtime *comm_rt = rt->chip->comm;
if (comm_rt) {
/* set volume */
- comm_rt->write8(comm_rt, 0x12, 0x0f, 0x7f -
- log_volume_table[rt->master_vol]);
+ comm_rt->write8(comm_rt, 0x12, 0x0f, 180 - rt->master_vol);
/* unmute */
comm_rt->write8(comm_rt, 0x12, 0x0e, 0x00);
}
@@ -170,7 +152,7 @@ static int usb6fire_control_master_vol_info(struct snd_kcontrol *kcontrol,
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
uinfo->value.integer.min = 0;
- uinfo->value.integer.max = 127;
+ uinfo->value.integer.max = 180;
return 0;
}
@@ -291,10 +273,12 @@ static struct __devinitdata snd_kcontrol_new elements[] = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Volume",
.index = 0,
- .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
+ .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+ SNDRV_CTL_ELEM_ACCESS_TLV_READ,
.info = usb6fire_control_master_vol_info,
.get = usb6fire_control_master_vol_get,
- .put = usb6fire_control_master_vol_put
+ .put = usb6fire_control_master_vol_put,
+ .tlv = { .p = tlv_output }
},
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
OpenPOWER on IntegriCloud