Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: klem.dev@gmail.com
To: patch@alsa-project.org
Cc: "Clément Guedez" <klem.dev@gmail.com>, alsa-devel@alsa-project.org
Subject: [PATCH 4/6] ESI W192M : Add TLV support for control value in dB scale
Date: Mon, 16 Mar 2015 01:20:53 +0100	[thread overview]
Message-ID: <550621f2.28eec20a.543a.fffffbe5@mx.google.com> (raw)
In-Reply-To: <1426465255-19005-1-git-send-email-me>

From: Clément Guedez <klem.dev@gmail.com>

Add TLV support to control volume using dB scale for input and ouput on ESI W192M.

Signed-off-by: Clément Guedez <klem.dev@gmail.com>

diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c
index 59483b4..c7ffafa 100644
--- a/sound/pci/ice1712/wtm.c
+++ b/sound/pci/ice1712/wtm.c
@@ -29,6 +29,7 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <sound/core.h>
+#include <sound/tlv.h>
 
 #include "ice1712.h"
 #include "envy24ht.h"
@@ -380,17 +381,25 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol,
 	return change;
 }
 
+
+/*Limits value in dB for fader*/
+static const DECLARE_TLV_DB_SCALE(db_scale_dac, -19125, 75, 0);
+static const DECLARE_TLV_DB_SCALE(db_scale_adc, 0, 150, 0);
+
 /*
  * Control tabs
  */
 static struct snd_kcontrol_new stac9640_controls[] = {
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+			    SNDRV_CTL_ELEM_ACCESS_TLV_READ),
 		.name = "Master Playback Switch",
 		.info = stac9460_dac_mute_info,
 		.get = stac9460_dac_mute_get,
 		.put = stac9460_dac_mute_put,
-		.private_value = 1
+		.private_value = 1,
+		.tlv = { .p = db_scale_dac }
 	},
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -419,11 +428,15 @@ static struct snd_kcontrol_new stac9640_controls[] = {
 	},
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+			    SNDRV_CTL_ELEM_ACCESS_TLV_READ),
+
 		.name = "DAC Volume",
 		.count = 8,
 		.info = stac9460_dac_vol_info,
 		.get = stac9460_dac_vol_get,
 		.put = stac9460_dac_vol_put,
+		.tlv = { .p = db_scale_dac }
 	},
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -435,12 +448,15 @@ static struct snd_kcontrol_new stac9640_controls[] = {
 	},
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
+			    SNDRV_CTL_ELEM_ACCESS_TLV_READ),
+
 		.name = "ADC Volume",
 		.count = 2,
 		.info = stac9460_adc_vol_info,
 		.get = stac9460_adc_vol_get,
 		.put = stac9460_adc_vol_put,
-
+		.tlv = { .p = db_scale_adc }
 	}
 };
 
-- 
2.1.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2015-03-16  0:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1426465255-19005-1-git-send-email-me>
2015-03-16  0:20 ` [PATCH 2/6] ESI W192M : Update eeprom structure to C99 standard klem.dev
2015-03-16  0:20 ` [PATCH 3/6] ESI W192M : Enable midi i/o of port envy24 chip as available klem.dev
2015-03-16  0:20 ` klem.dev [this message]
2015-03-16  0:20 ` [PATCH 5/6] ESI W192M : Add text Line in/Mic for selecting input gain state klem.dev
2015-03-16  7:51   ` Takashi Iwai
2015-03-16 14:54     ` Clément Guedez
2015-03-16 14:55       ` Takashi Iwai
2015-03-16  0:20 ` [PATCH 6/6] ESI W192M : Add sampling rate control of the ADC/DAC klem.dev
     [not found] <1426641991-3694-1-git-send-email-me>
2015-03-18  1:26 ` [PATCH 4/6] ESI W192M : Add TLV support for control value in dB scale klem.dev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=550621f2.28eec20a.543a.fffffbe5@mx.google.com \
    --to=klem.dev@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=patch@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox