diff mbox

[4/6] ESI W192M : Add TLV support to control volume using dB scale

Message ID 55039da2.6a07c20a.1b00.ffffa601@mx.google.com (mailing list archive)
State New, archived
Headers show

Commit Message

klem.dev@gmail.com March 14, 2015, 2:31 a.m. UTC
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>

Comments

klem.dev@gmail.com March 14, 2015, 4:01 a.m. UTC | #1
Hi,

sorry there is an error on this patch, please ignore it.
I will send the correct one.

Thanks

2015-03-14 3:31 GMT+01:00 <klem.dev@gmail.com>:

> 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..3af9daf 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
> +               .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
>
>
Takashi Iwai March 14, 2015, 8:11 a.m. UTC | #2
At Sat, 14 Mar 2015 05:01:50 +0100,
Clément Guedez wrote:
> 
> Hi,
> 
> sorry there is an error on this patch, please ignore it.
> I will send the correct one.

Could you resend rather a full patchset after the whole corrections?


thanks,

Takashi

> 
> Thanks
> 
> 2015-03-14 3:31 GMT+01:00 <klem.dev@gmail.com>:
> 
> > 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..3af9daf 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
> > +               .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
> >
> >
> [2  <text/html; UTF-8 (quoted-printable)>]
>
diff mbox

Patch

diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c
index 59483b4..3af9daf 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
+		.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 }
 	}
 };