alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA
@ 2015-09-09 11:29 Zidan Wang
  2015-09-09 11:29 ` [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA Zidan Wang
  2015-09-09 11:49 ` [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA Charles Keepax
  0 siblings, 2 replies; 11+ messages in thread
From: Zidan Wang @ 2015-09-09 11:29 UTC (permalink / raw)
  To: broonie; +Cc: ckeepax, patches, alsa-devel, Zidan Wang

The min gain is the corresponding gain value when the register value is 0
instead of 1, just correct it.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/codecs/wm8960.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index e3b7d0c..6163474 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -211,11 +211,11 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
 	return wm8960_set_deemph(codec);
 }
 
-static const DECLARE_TLV_DB_SCALE(adc_tlv, -9700, 50, 0);
-static const DECLARE_TLV_DB_SCALE(dac_tlv, -12700, 50, 1);
+static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
+static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
 static const DECLARE_TLV_DB_SCALE(bypass_tlv, -2100, 300, 0);
 static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
-static const DECLARE_TLV_DB_SCALE(boost_tlv, -1200, 300, 1);
+static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);
 
 static const struct snd_kcontrol_new wm8960_snd_controls[] = {
 SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA
  2015-09-09 11:29 [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA Zidan Wang
@ 2015-09-09 11:29 ` Zidan Wang
  2015-09-09 12:02   ` Charles Keepax
  2015-09-10  8:21   ` Charles Keepax
  2015-09-09 11:49 ` [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA Charles Keepax
  1 sibling, 2 replies; 11+ messages in thread
From: Zidan Wang @ 2015-09-09 11:29 UTC (permalink / raw)
  To: broonie; +Cc: ckeepax, patches, alsa-devel, Zidan Wang

The input PGAs have a gain range from -17.25dB to +30dB in 0.75dB steps.

The boost stage can provide additional gain. For line inputs, -12dB to
+6dB gain is available on the boost mixer. For micphone inputs, it can
provide up to +29dB additional gain from the microphone PGA.

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
---
 sound/soc/codecs/wm8960.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 6163474..6975390 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -212,27 +212,37 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
 }
 
 static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
+static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1725, 75, 0);
 static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
 static const DECLARE_TLV_DB_SCALE(bypass_tlv, -2100, 300, 0);
 static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
-static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);
+static const DECLARE_TLV_DB_SCALE(lineinboost_tlv, -1500, 300, 1);
+static const unsigned int micboost_tlv[] = {
+	TLV_DB_RANGE_HEAD(2),
+	0, 1, TLV_DB_SCALE_ITEM(0, 1300, 0),
+	2, 3, TLV_DB_SCALE_ITEM(2000, 900, 0),
+};
 
 static const struct snd_kcontrol_new wm8960_snd_controls[] = {
 SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
-		 0, 63, 0, adc_tlv),
+		 0, 63, 0, inpga_tlv),
 SOC_DOUBLE_R("Capture Volume ZC Switch", WM8960_LINVOL, WM8960_RINVOL,
 	6, 1, 0),
 SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL,
 	7, 1, 0),
 
 SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume",
-	       WM8960_INBMIX1, 4, 7, 0, boost_tlv),
+	       WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv),
 SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT2 Volume",
-	       WM8960_INBMIX1, 1, 7, 0, boost_tlv),
+	       WM8960_INBMIX1, 1, 7, 0, lineinboost_tlv),
 SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT3 Volume",
-	       WM8960_INBMIX2, 4, 7, 0, boost_tlv),
+	       WM8960_INBMIX2, 4, 7, 0, lineinboost_tlv),
 SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT2 Volume",
-	       WM8960_INBMIX2, 1, 7, 0, boost_tlv),
+	       WM8960_INBMIX2, 1, 7, 0, lineinboost_tlv),
+SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT1 Volume",
+		WM8960_RINPATH, 4, 4, 0, micboost_tlv),
+SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT1 Volume",
+		WM8960_LINPATH, 4, 4, 0, micboost_tlv),
 
 SOC_DOUBLE_R_TLV("Playback Volume", WM8960_LDAC, WM8960_RDAC,
 		 0, 255, 0, dac_tlv),
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA
  2015-09-09 11:29 [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA Zidan Wang
  2015-09-09 11:29 ` [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA Zidan Wang
@ 2015-09-09 11:49 ` Charles Keepax
  2015-09-10  1:15   ` Zidan Wang
  1 sibling, 1 reply; 11+ messages in thread
From: Charles Keepax @ 2015-09-09 11:49 UTC (permalink / raw)
  To: Zidan Wang; +Cc: alsa-devel, broonie, patches

On Wed, Sep 09, 2015 at 07:29:10PM +0800, Zidan Wang wrote:
> The min gain is the corresponding gain value when the register value is 0
> instead of 1, just correct it.
> 
> Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
> ---
>  sound/soc/codecs/wm8960.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> index e3b7d0c..6163474 100644
> --- a/sound/soc/codecs/wm8960.c
> +++ b/sound/soc/codecs/wm8960.c
> @@ -211,11 +211,11 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
>  	return wm8960_set_deemph(codec);
>  }
>  
> -static const DECLARE_TLV_DB_SCALE(adc_tlv, -9700, 50, 0);
> -static const DECLARE_TLV_DB_SCALE(dac_tlv, -12700, 50, 1);
> +static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> +static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);

The value zero is used for digital mute here. So I don't think it
is really appropriate to extend the TLV to show it as -97.5dB or
-127.5dB.

>  static const DECLARE_TLV_DB_SCALE(bypass_tlv, -2100, 300, 0);
>  static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
> -static const DECLARE_TLV_DB_SCALE(boost_tlv, -1200, 300, 1);
> +static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);

Same here.

>  
>  static const struct snd_kcontrol_new wm8960_snd_controls[] = {
>  SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
> -- 
> 1.9.1

Thanks,
Charles

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA
  2015-09-09 11:29 ` [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA Zidan Wang
@ 2015-09-09 12:02   ` Charles Keepax
  2015-09-10  1:20     ` Zidan Wang
  2015-09-10  8:21   ` Charles Keepax
  1 sibling, 1 reply; 11+ messages in thread
From: Charles Keepax @ 2015-09-09 12:02 UTC (permalink / raw)
  To: Zidan Wang; +Cc: alsa-devel, broonie, patches

On Wed, Sep 09, 2015 at 07:29:11PM +0800, Zidan Wang wrote:
> The input PGAs have a gain range from -17.25dB to +30dB in 0.75dB steps.
> 
> The boost stage can provide additional gain. For line inputs, -12dB to
> +6dB gain is available on the boost mixer. For micphone inputs, it can
> provide up to +29dB additional gain from the microphone PGA.
> 
> Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
> ---
>  sound/soc/codecs/wm8960.c | 22 ++++++++++++++++------
>  1 file changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> index 6163474..6975390 100644
> --- a/sound/soc/codecs/wm8960.c
> +++ b/sound/soc/codecs/wm8960.c
> @@ -212,27 +212,37 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
>  }
>  
>  static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> +static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1725, 75, 0);
>  static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
>  static const DECLARE_TLV_DB_SCALE(bypass_tlv, -2100, 300, 0);
>  static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
> -static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);
> +static const DECLARE_TLV_DB_SCALE(lineinboost_tlv, -1500, 300, 1);
> +static const unsigned int micboost_tlv[] = {
> +	TLV_DB_RANGE_HEAD(2),
> +	0, 1, TLV_DB_SCALE_ITEM(0, 1300, 0),
> +	2, 3, TLV_DB_SCALE_ITEM(2000, 900, 0),
> +};
>  
>  static const struct snd_kcontrol_new wm8960_snd_controls[] = {
>  SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
> -		 0, 63, 0, adc_tlv),
> +		 0, 63, 0, inpga_tlv),

This would make adc_tlv unused so you should probably remove it.

Although looking at this, it does looks a bit to me like the
registers are just specified wrong here and this was intended to
be the ADC volumes rather than the PGA volumes. In which case the
current TLV would be correct, the registers should be correct and
a new control should be added if you need to use the PGA volume.

Thanks,
Charles

>  SOC_DOUBLE_R("Capture Volume ZC Switch", WM8960_LINVOL, WM8960_RINVOL,
>  	6, 1, 0),
>  SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL,
>  	7, 1, 0),
>  
>  SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume",
> -	       WM8960_INBMIX1, 4, 7, 0, boost_tlv),
> +	       WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv),
>  SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT2 Volume",
> -	       WM8960_INBMIX1, 1, 7, 0, boost_tlv),
> +	       WM8960_INBMIX1, 1, 7, 0, lineinboost_tlv),
>  SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT3 Volume",
> -	       WM8960_INBMIX2, 4, 7, 0, boost_tlv),
> +	       WM8960_INBMIX2, 4, 7, 0, lineinboost_tlv),
>  SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT2 Volume",
> -	       WM8960_INBMIX2, 1, 7, 0, boost_tlv),
> +	       WM8960_INBMIX2, 1, 7, 0, lineinboost_tlv),
> +SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT1 Volume",
> +		WM8960_RINPATH, 4, 4, 0, micboost_tlv),
> +SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT1 Volume",
> +		WM8960_LINPATH, 4, 4, 0, micboost_tlv),
>  
>  SOC_DOUBLE_R_TLV("Playback Volume", WM8960_LDAC, WM8960_RDAC,
>  		 0, 255, 0, dac_tlv),
> -- 
> 1.9.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA
  2015-09-09 11:49 ` [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA Charles Keepax
@ 2015-09-10  1:15   ` Zidan Wang
  2015-09-10  8:24     ` Charles Keepax
  0 siblings, 1 reply; 11+ messages in thread
From: Zidan Wang @ 2015-09-10  1:15 UTC (permalink / raw)
  To: Charles Keepax; +Cc: alsa-devel, broonie, patches

On Wed, Sep 09, 2015 at 12:49:54PM +0100, Charles Keepax wrote:
> On Wed, Sep 09, 2015 at 07:29:10PM +0800, Zidan Wang wrote:
> > The min gain is the corresponding gain value when the register value is 0
> > instead of 1, just correct it.
> > 
> > Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
> > ---
> >  sound/soc/codecs/wm8960.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> > index e3b7d0c..6163474 100644
> > --- a/sound/soc/codecs/wm8960.c
> > +++ b/sound/soc/codecs/wm8960.c
> > @@ -211,11 +211,11 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
> >  	return wm8960_set_deemph(codec);
> >  }
> >  
> > -static const DECLARE_TLV_DB_SCALE(adc_tlv, -9700, 50, 0);
> > -static const DECLARE_TLV_DB_SCALE(dac_tlv, -12700, 50, 1);
> > +static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> > +static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
> 
> The value zero is used for digital mute here. So I don't think it
> is really appropriate to extend the TLV to show it as -97.5dB or
> -127.5dB.

I think the min register value will corresponding to the min gain.
So value 0 will also have a gain value, although it's for digital mute.

Refer to wm8962 codec driver, beep gain range is -90db~-6db, step in 6db,
but it define the beep gain like below:
static const DECLARE_TLV_DB_SCALE(beep_tlv, -9600, 600, 1);

Best Regards,
Zidan Wang
> 
> >  static const DECLARE_TLV_DB_SCALE(bypass_tlv, -2100, 300, 0);
> >  static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
> > -static const DECLARE_TLV_DB_SCALE(boost_tlv, -1200, 300, 1);
> > +static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);
> 
> Same here.
> 
> >  
> >  static const struct snd_kcontrol_new wm8960_snd_controls[] = {
> >  SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
> > -- 
> > 1.9.1
> 
> Thanks,
> Charles

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA
  2015-09-09 12:02   ` Charles Keepax
@ 2015-09-10  1:20     ` Zidan Wang
  2015-09-10  8:20       ` Charles Keepax
  0 siblings, 1 reply; 11+ messages in thread
From: Zidan Wang @ 2015-09-10  1:20 UTC (permalink / raw)
  To: Charles Keepax; +Cc: alsa-devel, broonie, patches

On Wed, Sep 09, 2015 at 01:02:06PM +0100, Charles Keepax wrote:
> On Wed, Sep 09, 2015 at 07:29:11PM +0800, Zidan Wang wrote:
> > The input PGAs have a gain range from -17.25dB to +30dB in 0.75dB steps.
> > 
> > The boost stage can provide additional gain. For line inputs, -12dB to
> > +6dB gain is available on the boost mixer. For micphone inputs, it can
> > provide up to +29dB additional gain from the microphone PGA.
> > 
> > Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
> > ---
> >  sound/soc/codecs/wm8960.c | 22 ++++++++++++++++------
> >  1 file changed, 16 insertions(+), 6 deletions(-)
> > 
> > diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> > index 6163474..6975390 100644
> > --- a/sound/soc/codecs/wm8960.c
> > +++ b/sound/soc/codecs/wm8960.c
> > @@ -212,27 +212,37 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
> >  }
> >  
> >  static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> > +static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1725, 75, 0);
> >  static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
> >  static const DECLARE_TLV_DB_SCALE(bypass_tlv, -2100, 300, 0);
> >  static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
> > -static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);
> > +static const DECLARE_TLV_DB_SCALE(lineinboost_tlv, -1500, 300, 1);
> > +static const unsigned int micboost_tlv[] = {
> > +	TLV_DB_RANGE_HEAD(2),
> > +	0, 1, TLV_DB_SCALE_ITEM(0, 1300, 0),
> > +	2, 3, TLV_DB_SCALE_ITEM(2000, 900, 0),
> > +};
> >  
> >  static const struct snd_kcontrol_new wm8960_snd_controls[] = {
> >  SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
> > -		 0, 63, 0, adc_tlv),
> > +		 0, 63, 0, inpga_tlv),
> 
> This would make adc_tlv unused so you should probably remove it.
> 
> Although looking at this, it does looks a bit to me like the
> registers are just specified wrong here and this was intended to
> be the ADC volumes rather than the PGA volumes. In which case the
> current TLV would be correct, the registers should be correct and
> a new control should be added if you need to use the PGA volume.
> 
> Thanks,
> Charles
> 

adc_tlv is used for "ADC PCM Capture Volume", so i can't remove it.
SOC_DOUBLE_R_TLV("ADC PCM Capture Volume", WM8960_LADC, WM8960_RADC,
        0, 255, 0, adc_tlv),

Best Regards,
Zidan Wang
> >  SOC_DOUBLE_R("Capture Volume ZC Switch", WM8960_LINVOL, WM8960_RINVOL,
> >  	6, 1, 0),
> >  SOC_DOUBLE_R("Capture Switch", WM8960_LINVOL, WM8960_RINVOL,
> >  	7, 1, 0),
> >  
> >  SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT3 Volume",
> > -	       WM8960_INBMIX1, 4, 7, 0, boost_tlv),
> > +	       WM8960_INBMIX1, 4, 7, 0, lineinboost_tlv),
> >  SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT2 Volume",
> > -	       WM8960_INBMIX1, 1, 7, 0, boost_tlv),
> > +	       WM8960_INBMIX1, 1, 7, 0, lineinboost_tlv),
> >  SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT3 Volume",
> > -	       WM8960_INBMIX2, 4, 7, 0, boost_tlv),
> > +	       WM8960_INBMIX2, 4, 7, 0, lineinboost_tlv),
> >  SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT2 Volume",
> > -	       WM8960_INBMIX2, 1, 7, 0, boost_tlv),
> > +	       WM8960_INBMIX2, 1, 7, 0, lineinboost_tlv),
> > +SOC_SINGLE_TLV("Right Input Boost Mixer RINPUT1 Volume",
> > +		WM8960_RINPATH, 4, 4, 0, micboost_tlv),
> > +SOC_SINGLE_TLV("Left Input Boost Mixer LINPUT1 Volume",
> > +		WM8960_LINPATH, 4, 4, 0, micboost_tlv),
> >  
> >  SOC_DOUBLE_R_TLV("Playback Volume", WM8960_LDAC, WM8960_RDAC,
> >  		 0, 255, 0, dac_tlv),
> > -- 
> > 1.9.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA
  2015-09-10  1:20     ` Zidan Wang
@ 2015-09-10  8:20       ` Charles Keepax
  0 siblings, 0 replies; 11+ messages in thread
From: Charles Keepax @ 2015-09-10  8:20 UTC (permalink / raw)
  To: Zidan Wang; +Cc: alsa-devel, broonie, patches

On Thu, Sep 10, 2015 at 09:20:26AM +0800, Zidan Wang wrote:
> On Wed, Sep 09, 2015 at 01:02:06PM +0100, Charles Keepax wrote:
> > On Wed, Sep 09, 2015 at 07:29:11PM +0800, Zidan Wang wrote:
> > > The input PGAs have a gain range from -17.25dB to +30dB in 0.75dB steps.
> > > 
> > > The boost stage can provide additional gain. For line inputs, -12dB to
> > > +6dB gain is available on the boost mixer. For micphone inputs, it can
> > > provide up to +29dB additional gain from the microphone PGA.
> > > 
> > > Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
> > > ---
> > >  sound/soc/codecs/wm8960.c | 22 ++++++++++++++++------
> > >  1 file changed, 16 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> > > index 6163474..6975390 100644
> > > --- a/sound/soc/codecs/wm8960.c
> > > +++ b/sound/soc/codecs/wm8960.c
> > > @@ -212,27 +212,37 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
> > >  }
> > >  
> > >  static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> > > +static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1725, 75, 0);
> > >  static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
> > >  static const DECLARE_TLV_DB_SCALE(bypass_tlv, -2100, 300, 0);
> > >  static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
> > > -static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);
> > > +static const DECLARE_TLV_DB_SCALE(lineinboost_tlv, -1500, 300, 1);
> > > +static const unsigned int micboost_tlv[] = {
> > > +	TLV_DB_RANGE_HEAD(2),
> > > +	0, 1, TLV_DB_SCALE_ITEM(0, 1300, 0),
> > > +	2, 3, TLV_DB_SCALE_ITEM(2000, 900, 0),
> > > +};
> > >  
> > >  static const struct snd_kcontrol_new wm8960_snd_controls[] = {
> > >  SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
> > > -		 0, 63, 0, adc_tlv),
> > > +		 0, 63, 0, inpga_tlv),
> > 
> > This would make adc_tlv unused so you should probably remove it.
> > 
> > Although looking at this, it does looks a bit to me like the
> > registers are just specified wrong here and this was intended to
> > be the ADC volumes rather than the PGA volumes. In which case the
> > current TLV would be correct, the registers should be correct and
> > a new control should be added if you need to use the PGA volume.
> > 
> > Thanks,
> > Charles
> > 
> 
> adc_tlv is used for "ADC PCM Capture Volume", so i can't remove it.
> SOC_DOUBLE_R_TLV("ADC PCM Capture Volume", WM8960_LADC, WM8960_RADC,
>         0, 255, 0, adc_tlv),
> 

Oops... some how I missed that control, this patch probably looks
good then.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA
  2015-09-09 11:29 ` [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA Zidan Wang
  2015-09-09 12:02   ` Charles Keepax
@ 2015-09-10  8:21   ` Charles Keepax
  1 sibling, 0 replies; 11+ messages in thread
From: Charles Keepax @ 2015-09-10  8:21 UTC (permalink / raw)
  To: Zidan Wang; +Cc: alsa-devel, broonie, patches

On Wed, Sep 09, 2015 at 07:29:11PM +0800, Zidan Wang wrote:
> The input PGAs have a gain range from -17.25dB to +30dB in 0.75dB steps.
> 
> The boost stage can provide additional gain. For line inputs, -12dB to
> +6dB gain is available on the boost mixer. For micphone inputs, it can
> provide up to +29dB additional gain from the microphone PGA.
> 
> Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA
  2015-09-10  1:15   ` Zidan Wang
@ 2015-09-10  8:24     ` Charles Keepax
  2015-09-10 10:58       ` Mark Brown
  0 siblings, 1 reply; 11+ messages in thread
From: Charles Keepax @ 2015-09-10  8:24 UTC (permalink / raw)
  To: Zidan Wang; +Cc: alsa-devel, broonie, patches

On Thu, Sep 10, 2015 at 09:15:32AM +0800, Zidan Wang wrote:
> On Wed, Sep 09, 2015 at 12:49:54PM +0100, Charles Keepax wrote:
> > On Wed, Sep 09, 2015 at 07:29:10PM +0800, Zidan Wang wrote:
> > > The min gain is the corresponding gain value when the register value is 0
> > > instead of 1, just correct it.
> > > 
> > > Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
> > > ---
> > >  sound/soc/codecs/wm8960.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> > > index e3b7d0c..6163474 100644
> > > --- a/sound/soc/codecs/wm8960.c
> > > +++ b/sound/soc/codecs/wm8960.c
> > > @@ -211,11 +211,11 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
> > >  	return wm8960_set_deemph(codec);
> > >  }
> > >  
> > > -static const DECLARE_TLV_DB_SCALE(adc_tlv, -9700, 50, 0);
> > > -static const DECLARE_TLV_DB_SCALE(dac_tlv, -12700, 50, 1);
> > > +static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> > > +static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
> > 
> > The value zero is used for digital mute here. So I don't think it
> > is really appropriate to extend the TLV to show it as -97.5dB or
> > -127.5dB.
> 
> I think the min register value will corresponding to the min gain.
> So value 0 will also have a gain value, although it's for digital mute.
> 
> Refer to wm8962 codec driver, beep gain range is -90db~-6db, step in 6db,
> but it define the beep gain like below:
> static const DECLARE_TLV_DB_SCALE(beep_tlv, -9600, 600, 1);
> 

I might have to defer to Mark on this one then, if it is normal
to just use an additional gain value for mute in this type of
situation then it is ok with me. But it doesn't seem like that
would be a sensible thing, as you are asking for -97.5dB but
that is not what you are getting which doesn't seem like the
nicest interface.

Thanks,
Charles

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA
  2015-09-10  8:24     ` Charles Keepax
@ 2015-09-10 10:58       ` Mark Brown
  2015-09-10 11:35         ` Charles Keepax
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Brown @ 2015-09-10 10:58 UTC (permalink / raw)
  To: Charles Keepax; +Cc: alsa-devel, patches, Zidan Wang


[-- Attachment #1.1: Type: text/plain, Size: 1086 bytes --]

On Thu, Sep 10, 2015 at 09:24:20AM +0100, Charles Keepax wrote:
> On Thu, Sep 10, 2015 at 09:15:32AM +0800, Zidan Wang wrote:

> > > > +static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> > > > +static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);

> > I think the min register value will corresponding to the min gain.
> > So value 0 will also have a gain value, although it's for digital mute.

> > Refer to wm8962 codec driver, beep gain range is -90db~-6db, step in 6db,
> > but it define the beep gain like below:
> > static const DECLARE_TLV_DB_SCALE(beep_tlv, -9600, 600, 1);

> I might have to defer to Mark on this one then, if it is normal
> to just use an additional gain value for mute in this type of
> situation then it is ok with me. But it doesn't seem like that
> would be a sensible thing, as you are asking for -97.5dB but
> that is not what you are getting which doesn't seem like the
> nicest interface.

The last value in the scale macro is a flag saying if the minimum value
is mute - if it's set to 1 userspace should know this is what's going
on.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA
  2015-09-10 10:58       ` Mark Brown
@ 2015-09-10 11:35         ` Charles Keepax
  0 siblings, 0 replies; 11+ messages in thread
From: Charles Keepax @ 2015-09-10 11:35 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches, Zidan Wang

On Thu, Sep 10, 2015 at 11:58:21AM +0100, Mark Brown wrote:
> On Thu, Sep 10, 2015 at 09:24:20AM +0100, Charles Keepax wrote:
> > On Thu, Sep 10, 2015 at 09:15:32AM +0800, Zidan Wang wrote:
> 
> > > > > +static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> > > > > +static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
> 
> > > I think the min register value will corresponding to the min gain.
> > > So value 0 will also have a gain value, although it's for digital mute.
> 
> > > Refer to wm8962 codec driver, beep gain range is -90db~-6db, step in 6db,
> > > but it define the beep gain like below:
> > > static const DECLARE_TLV_DB_SCALE(beep_tlv, -9600, 600, 1);
> 
> > I might have to defer to Mark on this one then, if it is normal
> > to just use an additional gain value for mute in this type of
> > situation then it is ok with me. But it doesn't seem like that
> > would be a sensible thing, as you are asking for -97.5dB but
> > that is not what you are getting which doesn't seem like the
> > nicest interface.
> 
> The last value in the scale macro is a flag saying if the minimum value
> is mute - if it's set to 1 userspace should know this is what's going
> on.

Ah sorry my bad, thanks.

In that case:

Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-09-10 11:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-09 11:29 [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA Zidan Wang
2015-09-09 11:29 ` [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA Zidan Wang
2015-09-09 12:02   ` Charles Keepax
2015-09-10  1:20     ` Zidan Wang
2015-09-10  8:20       ` Charles Keepax
2015-09-10  8:21   ` Charles Keepax
2015-09-09 11:49 ` [PATCH 1/2] ASoC: wm8960: correct the min gain value of some PGA Charles Keepax
2015-09-10  1:15   ` Zidan Wang
2015-09-10  8:24     ` Charles Keepax
2015-09-10 10:58       ` Mark Brown
2015-09-10 11:35         ` Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).