[PATCHv3,8/9] WM8971 adds kcontrol functions

Message ID 1409628470-13059-8-git-send-email-xavier.hsu@linaro.org
State New
Headers show

Commit Message

Xavier Hsu Sept. 2, 2014, 3:27 a.m.
This patch improves WM8971.
We add kcontrol functions on WM8971.

Any comments about improving the patch are welcome.
Thanks.

Signed-off-by: Xavier Hsu <xavier.hsu@linaro.org>
Signed-off-by: Andy Green <andy.green@linaro.org>
---
 sound/soc/codecs/wm8971.c |    6 ++++++
 1 file changed, 6 insertions(+)

Comments

Charles Keepax Sept. 2, 2014, 12:41 p.m. | #1
On Tue, Sep 02, 2014 at 11:27:49AM +0800, Xavier Hsu wrote:
> This patch improves WM8971.
> We add kcontrol functions on WM8971.
> 
> Any comments about improving the patch are welcome.
> Thanks.
> 
> Signed-off-by: Xavier Hsu <xavier.hsu@linaro.org>
> Signed-off-by: Andy Green <andy.green@linaro.org>
> ---
>  sound/soc/codecs/wm8971.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
> index 95e7c39..6d34565 100755
> --- a/sound/soc/codecs/wm8971.c
> +++ b/sound/soc/codecs/wm8971.c
> @@ -284,6 +284,12 @@ static const struct snd_kcontrol_new wm8971_snd_controls[] = {
>  
>  	SOC_DOUBLE_R_TLV("ADC Volume", WM8971_LADC, WM8971_RADC,
>  			 0, 255, 0, adc_vol),
> +
> +	SOC_SINGLE("Analogue Bias", WM8971_ADCTL1, 6, 3, 0),

Given this relates to the AVDD voltage feels it is very unlikely
to change at runtime. Do we expect it to? Otherwise it might be
better added as a DT entry.

> +	SOC_SINGLE("Right Speaker Playback Invert Switch", WM8971_ADCTL2,
> +		   4, 1, 0),
> +	SOC_SINGLE("Headphone Switch POL", WM8971_ADCTL2, 5, 1, 0),

Again the polarity of the headphone detect is not going to change
at runtime so this should probably be a DT entry.

> +	SOC_SINGLE("Headphone Switch EN", WM8971_ADCTL2, 6, 1, 0),

I am less clear on whether or not this should be a control or a
DT entry, so as long as you are happy this is consistent with the
usage.

>  };
>  
>  /*
> -- 

Thanks,
Charles
Xavier Hsu Sept. 11, 2014, 3:35 a.m. | #2
Hi Charles :
Thanks for your feedback.
I will set these registers through DT.

BR,
Xavier

2014-09-02 20:41 GMT+08:00 Charles Keepax <
ckeepax@opensource.wolfsonmicro.com>:

> On Tue, Sep 02, 2014 at 11:27:49AM +0800, Xavier Hsu wrote:
> > This patch improves WM8971.
> > We add kcontrol functions on WM8971.
> >
> > Any comments about improving the patch are welcome.
> > Thanks.
> >
> > Signed-off-by: Xavier Hsu <xavier.hsu@linaro.org>
> > Signed-off-by: Andy Green <andy.green@linaro.org>
> > ---
> >  sound/soc/codecs/wm8971.c |    6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
> > index 95e7c39..6d34565 100755
> > --- a/sound/soc/codecs/wm8971.c
> > +++ b/sound/soc/codecs/wm8971.c
> > @@ -284,6 +284,12 @@ static const struct snd_kcontrol_new
> wm8971_snd_controls[] = {
> >
> >       SOC_DOUBLE_R_TLV("ADC Volume", WM8971_LADC, WM8971_RADC,
> >                        0, 255, 0, adc_vol),
> > +
> > +     SOC_SINGLE("Analogue Bias", WM8971_ADCTL1, 6, 3, 0),
>
> Given this relates to the AVDD voltage feels it is very unlikely
> to change at runtime. Do we expect it to? Otherwise it might be
> better added as a DT entry.
>
> > +     SOC_SINGLE("Right Speaker Playback Invert Switch", WM8971_ADCTL2,
> > +                4, 1, 0),
> > +     SOC_SINGLE("Headphone Switch POL", WM8971_ADCTL2, 5, 1, 0),
>
> Again the polarity of the headphone detect is not going to change
> at runtime so this should probably be a DT entry.
>
> > +     SOC_SINGLE("Headphone Switch EN", WM8971_ADCTL2, 6, 1, 0),
>
> I am less clear on whether or not this should be a control or a
> DT entry, so as long as you are happy this is consistent with the
> usage.
>
> >  };
> >
> >  /*
> > --
>
> Thanks,
> Charles
>

Patch

diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index 95e7c39..6d34565 100755
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -284,6 +284,12 @@  static const struct snd_kcontrol_new wm8971_snd_controls[] = {
 
 	SOC_DOUBLE_R_TLV("ADC Volume", WM8971_LADC, WM8971_RADC,
 			 0, 255, 0, adc_vol),
+
+	SOC_SINGLE("Analogue Bias", WM8971_ADCTL1, 6, 3, 0),
+	SOC_SINGLE("Right Speaker Playback Invert Switch", WM8971_ADCTL2,
+		   4, 1, 0),
+	SOC_SINGLE("Headphone Switch POL", WM8971_ADCTL2, 5, 1, 0),
+	SOC_SINGLE("Headphone Switch EN", WM8971_ADCTL2, 6, 1, 0),
 };
 
 /*