[alsa-devel] [PATCH] ASoC: mc13783: add mixer controls
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)
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.
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
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.
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
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
participants (3)
-
Lars-Peter Clausen
-
Mark Brown
-
Steffen Trumtrar