alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: mc13783: add mixer controls
@ 2013-10-09 15:01 Steffen Trumtrar
  2013-10-09 15:13 ` Mark Brown
  2013-10-09 15:21 ` Lars-Peter Clausen
  0 siblings, 2 replies; 6+ messages in thread
From: Steffen Trumtrar @ 2013-10-09 15:01 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Steffen Trumtrar, Liam Girdwood

Add more kcontrols for the alsa mixer infrastructure.

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 sound/soc/codecs/mc13783.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index eedbf05..fafe999 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -534,6 +534,30 @@ static struct snd_soc_dapm_route mc13783_routes[] = {
 static const char * const mc13783_3d_mixer[] = {"Stereo", "Phase Mix",
 						"Mono", "Mono Mix"};
 
+static const char * const mc13783_alsp[] = {"Off", "Codec", "Right"};
+
+static const char * const mc13783_ahs[] = {"Codec", "Mixer"};
+
+static const struct soc_enum mc13783_enum_asp =
+	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 4, ARRAY_SIZE(mc13783_alsp),
+			mc13783_alsp);
+
+static const struct soc_enum mc13783_enum_alsp =
+	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 7, ARRAY_SIZE(mc13783_alsp),
+			mc13783_alsp);
+
+static const struct soc_enum mc13783_enum_ahs =
+	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 11, ARRAY_SIZE(mc13783_ahs),
+			mc13783_ahs);
+
+static const struct soc_enum mc13783_enum_arxout =
+	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 17, ARRAY_SIZE(mc13783_ahs),
+			mc13783_ahs);
+
+static const struct soc_enum mc13783_enum_codec =
+	SOC_ENUM_SINGLE(MC13783_AUDIO_RX1, 4, ARRAY_SIZE(mc13783_alsp),
+			mc13783_alsp);
+
 static const struct soc_enum mc13783_enum_3d_mixer =
 	SOC_ENUM_SINGLE(MC13783_AUDIO_RX1, 16, ARRAY_SIZE(mc13783_3d_mixer),
 			mc13783_3d_mixer);
@@ -541,8 +565,32 @@ static const struct soc_enum mc13783_enum_3d_mixer =
 static struct snd_kcontrol_new mc13783_control_list[] = {
 	SOC_SINGLE("Loudspeaker enable", MC13783_AUDIO_RX0, 5, 1, 0),
 	SOC_SINGLE("PCM Playback Volume", MC13783_AUDIO_RX1, 6, 15, 0),
+	SOC_SINGLE("PCM Playback Switch", MC13783_AUDIO_RX1, 5, 1, 0),
 	SOC_DOUBLE("PCM Capture Volume", MC13783_AUDIO_TX, 19, 14, 31, 0),
 	SOC_ENUM("3D Control", mc13783_enum_3d_mixer),
+	SOC_ENUM("Earpiece Switch", mc13783_enum_asp),
+	SOC_ENUM("Loudspeaker Switch", mc13783_enum_alsp),
+
+	SOC_ENUM("Headset Switch", mc13783_enum_ahs),
+	SOC_SINGLE("Headset Amp Right Switch", MC13783_AUDIO_RX0, 9, 1, 0),
+	SOC_SINGLE("Headset Amp Left Switch", MC13783_AUDIO_RX0, 10, 1, 0),
+
+	SOC_ENUM("Line out Amp Switch", mc13783_enum_arxout),
+	SOC_SINGLE("Line out Amp Right Switch", MC13783_AUDIO_RX0, 15, 1, 0),
+	SOC_SINGLE("Line out Amp Left Switch", MC13783_AUDIO_RX0, 16, 1, 0),
+
+	SOC_SINGLE("Codec Capture Mix Switch", MC13783_AUDIO_RX0, 21, 1, 0),
+	SOC_SINGLE("PCM Capture Mix Switch", MC13783_AUDIO_RX0, 22, 1, 0),
+	SOC_SINGLE("Line in Capture Mix Switch", MC13783_AUDIO_RX0, 23, 1, 0),
+
+	SOC_SINGLE("Codec Capture Volume", MC13783_AUDIO_RX1, 1, 15, 0),
+	SOC_SINGLE("Codec Capture Switch", MC13783_AUDIO_RX1, 0, 1, 0),
+
+	SOC_SINGLE("PGA Capture Volume", MC13783_AUDIO_RX1, 12, 15, 0),
+	SOC_SINGLE("PGA Capture Switch", MC13783_AUDIO_RX1, 10, 1, 0),
+
+	SOC_SINGLE("MC1 Capture Bias Switch", MC13783_AUDIO_TX, 0, 1, 0),
+	SOC_SINGLE("MC2 Capture Bias Switch", MC13783_AUDIO_TX, 1, 1, 0),
 };
 
 static int mc13783_probe(struct snd_soc_codec *codec)
-- 
1.8.4.rc3

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

* Re: [PATCH] ASoC: mc13783: add mixer controls
  2013-10-09 15:01 [PATCH] ASoC: mc13783: add mixer controls Steffen Trumtrar
@ 2013-10-09 15:13 ` Mark Brown
  2013-10-10  7:34   ` Steffen Trumtrar
  2013-10-09 15:21 ` Lars-Peter Clausen
  1 sibling, 1 reply; 6+ messages in thread
From: Mark Brown @ 2013-10-09 15:13 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: alsa-devel, Liam Girdwood


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

On Wed, Oct 09, 2013 at 05:01:44PM +0200, Steffen Trumtrar wrote:

> +static const char * const mc13783_alsp[] = {"Off", "Codec", "Right"};
> +
> +static const char * const mc13783_ahs[] = {"Codec", "Mixer"};

What are these - these look like they might be DAPM rather than regular
controls?

> +	SOC_SINGLE("Headset Amp Right Switch", MC13783_AUDIO_RX0, 9, 1, 0),
> +	SOC_SINGLE("Headset Amp Left Switch", MC13783_AUDIO_RX0, 10, 1, 0),

I would expect these to be stereo controls rather than two mono
controls?

> +	SOC_ENUM("Line out Amp Switch", mc13783_enum_arxout),

Switches shouldn't be enums.

> +	SOC_SINGLE("Codec Capture Mix Switch", MC13783_AUDIO_RX0, 21, 1, 0),

CODEC and Codec seem to be getting mixed in the file.

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

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



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

* Re: [PATCH] ASoC: mc13783: add mixer controls
  2013-10-09 15:01 [PATCH] ASoC: mc13783: add mixer controls Steffen Trumtrar
  2013-10-09 15:13 ` Mark Brown
@ 2013-10-09 15:21 ` Lars-Peter Clausen
  2013-10-10  7:36   ` Steffen Trumtrar
  1 sibling, 1 reply; 6+ messages in thread
From: Lars-Peter Clausen @ 2013-10-09 15:21 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: alsa-devel, Mark Brown, Liam Girdwood

On 10/09/2013 05:01 PM, Steffen Trumtrar wrote:
> [...]
> +
> +static const struct soc_enum mc13783_enum_asp =
> +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 4, ARRAY_SIZE(mc13783_alsp),
> +			mc13783_alsp);
> +
> +static const struct soc_enum mc13783_enum_alsp =
> +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 7, ARRAY_SIZE(mc13783_alsp),
> +			mc13783_alsp);
> +
> +static const struct soc_enum mc13783_enum_ahs =
> +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 11, ARRAY_SIZE(mc13783_ahs),
> +			mc13783_ahs);
> +
> +static const struct soc_enum mc13783_enum_arxout =
> +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 17, ARRAY_SIZE(mc13783_ahs),
> +			mc13783_ahs);
> +
> +static const struct soc_enum mc13783_enum_codec =
> +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX1, 4, ARRAY_SIZE(mc13783_alsp),
> +			mc13783_alsp);

For bonus points use SOC_ENUM_SINGLE_DECL(...) ;)

- Lars

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

* Re: [PATCH] ASoC: mc13783: add mixer controls
  2013-10-09 15:13 ` Mark Brown
@ 2013-10-10  7:34   ` Steffen Trumtrar
  2013-10-10  9:44     ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Steffen Trumtrar @ 2013-10-10  7:34 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, Liam Girdwood

Hi!

On Wed, Oct 09, 2013 at 04:13:36PM +0100, Mark Brown wrote:
> On Wed, Oct 09, 2013 at 05:01:44PM +0200, Steffen Trumtrar wrote:
> 
> > +static const char * const mc13783_alsp[] = {"Off", "Codec", "Right"};
> > +
> > +static const char * const mc13783_ahs[] = {"Codec", "Mixer"};
> 
> What are these - these look like they might be DAPM rather than regular
> controls?
> 

Looks like you are right. Will fix.

> > +	SOC_SINGLE("Headset Amp Right Switch", MC13783_AUDIO_RX0, 9, 1, 0),
> > +	SOC_SINGLE("Headset Amp Left Switch", MC13783_AUDIO_RX0, 10, 1, 0),
> 
> I would expect these to be stereo controls rather than two mono
> controls?
> 

Okay.

> > +	SOC_ENUM("Line out Amp Switch", mc13783_enum_arxout),
> 
> Switches shouldn't be enums.
> 

Hm, would "Line out Amp Source" be correct then? Or just "Line out Amp"?
I'm not really getting the documentation in that regard.

> > +	SOC_SINGLE("Codec Capture Mix Switch", MC13783_AUDIO_RX0, 21, 1, 0),
> 
> CODEC and Codec seem to be getting mixed in the file.

Okay. I will fix that.

Thanks,
Steffen

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH] ASoC: mc13783: add mixer controls
  2013-10-09 15:21 ` Lars-Peter Clausen
@ 2013-10-10  7:36   ` Steffen Trumtrar
  0 siblings, 0 replies; 6+ messages in thread
From: Steffen Trumtrar @ 2013-10-10  7:36 UTC (permalink / raw)
  To: Lars-Peter Clausen; +Cc: alsa-devel, Mark Brown, Liam Girdwood

On Wed, Oct 09, 2013 at 05:21:40PM +0200, Lars-Peter Clausen wrote:
> On 10/09/2013 05:01 PM, Steffen Trumtrar wrote:
> > [...]
> > +
> > +static const struct soc_enum mc13783_enum_asp =
> > +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 4, ARRAY_SIZE(mc13783_alsp),
> > +			mc13783_alsp);
> > +
> > +static const struct soc_enum mc13783_enum_alsp =
> > +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 7, ARRAY_SIZE(mc13783_alsp),
> > +			mc13783_alsp);
> > +
> > +static const struct soc_enum mc13783_enum_ahs =
> > +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 11, ARRAY_SIZE(mc13783_ahs),
> > +			mc13783_ahs);
> > +
> > +static const struct soc_enum mc13783_enum_arxout =
> > +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX0, 17, ARRAY_SIZE(mc13783_ahs),
> > +			mc13783_ahs);
> > +
> > +static const struct soc_enum mc13783_enum_codec =
> > +	SOC_ENUM_SINGLE(MC13783_AUDIO_RX1, 4, ARRAY_SIZE(mc13783_alsp),
> > +			mc13783_alsp);
> 
> For bonus points use SOC_ENUM_SINGLE_DECL(...) ;)
> 

Yay, bonus points. I will change that.

Thanks,
Steffen

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [PATCH] ASoC: mc13783: add mixer controls
  2013-10-10  7:34   ` Steffen Trumtrar
@ 2013-10-10  9:44     ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2013-10-10  9:44 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: alsa-devel, Liam Girdwood


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

On Thu, Oct 10, 2013 at 09:34:11AM +0200, Steffen Trumtrar wrote:
> On Wed, Oct 09, 2013 at 04:13:36PM +0100, Mark Brown wrote:

> > > +	SOC_ENUM("Line out Amp Switch", mc13783_enum_arxout),

> > Switches shouldn't be enums.

> Hm, would "Line out Amp Source" be correct then? Or just "Line out Amp"?
> I'm not really getting the documentation in that regard.

Either of those would be fine.  If there's no guidance you can pick
basically anything sensible that doesn't have a defined meaning.

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

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



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

end of thread, other threads:[~2013-10-10  9:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-09 15:01 [PATCH] ASoC: mc13783: add mixer controls Steffen Trumtrar
2013-10-09 15:13 ` Mark Brown
2013-10-10  7:34   ` Steffen Trumtrar
2013-10-10  9:44     ` Mark Brown
2013-10-09 15:21 ` Lars-Peter Clausen
2013-10-10  7:36   ` Steffen Trumtrar

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).