linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: eero.nurkkala@offcode.fi
To: linux-arm-msm@vger.kernel.org
Cc: Eero Nurkkala <eero.nurkkala@offcode.fi>
Subject: [PATCH] ASoC: msm8x60: enhance mixer interfaces
Date: Thu, 10 Feb 2011 12:49:09 +0200	[thread overview]
Message-ID: <1297334949-5168-1-git-send-email-eero.nurkkala@offcode.fi> (raw)

From: Eero Nurkkala <eero.nurkkala@offcode.fi>

Currenly, a simple access to any of the interfaces fail,
when accessed in the following manner:
"amixer set Volume 100%" -> no success.

Simplify the initiation and fix the interfaces so that
they may be altered in a more generic ways.
With the patch:

amixer set Volume 100%
Simple mixer control 'Volume',0
  Capabilities: volume penum
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 16383
  Front Left: 16383 [100%]
  Front Right: 16383 [100%]

Signed-off-by: Eero Nurkkala <eero.nurkkala@offcode.fi>
---
 sound/soc/msm/msm8x60.c |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/sound/soc/msm/msm8x60.c b/sound/soc/msm/msm8x60.c
index 38c56de..eb0dab2 100644
--- a/sound/soc/msm/msm8x60.c
+++ b/sound/soc/msm/msm8x60.c
@@ -850,33 +850,26 @@ static struct snd_kcontrol_new snd_msm_secondary_controls[] = {
 			pcm_route_info, pcm_route_get_tx, pcm_route_put_tx, 0),
 };
 
-static int msm_new_mixer(struct snd_card *card)
+static int msm_new_mixer(struct snd_soc_codec *codec)
 {
 	unsigned int idx;
 	int err;
 	int dev_cnt;
 
-	strcpy(card->mixername, "MSM Mixer");
-	for (idx = 0; idx < ARRAY_SIZE(snd_msm_controls); idx++) {
-		err = snd_ctl_add(card,	snd_ctl_new1(&snd_msm_controls[idx],
-					NULL));
-		if (err < 0)
-			pr_err("%s:ERR adding ctl\n", __func__);
-	}
-
-	for (idx = 0; idx < ARRAY_SIZE(snd_msm_secondary_controls); idx++) {
-		err = snd_ctl_add(card,
-			snd_ctl_new1(&snd_msm_secondary_controls[idx],
-			NULL));
-		if (err < 0)
-			pr_err("%s:ERR adding secondary ctl\n", __func__);
-	}
+	strcpy(codec->card->mixername, "MSM Mixer");
+	if (snd_soc_add_controls(codec, snd_msm_controls,
+			ARRAY_SIZE(snd_msm_controls)))
+		pr_err("%s:ERR adding ctl\n", __func__);
 	dev_cnt = msm_snddev_devcount();
 
+	if (snd_soc_add_controls(codec, snd_msm_secondary_controls,
+			ARRAY_SIZE(snd_msm_secondary_controls)))
+		pr_err("%s:ERR adding secondary ctl\n", __func__);
+
 	for (idx = 0; idx < dev_cnt; idx++) {
 		if (!snd_dev_ctl_index(idx)) {
-			err = snd_ctl_add(card, snd_ctl_new1(
-				&snd_dev_controls[idx], NULL));
+			err = snd_ctl_add(codec->card, snd_soc_cnew(
+				&snd_dev_controls[idx], codec, NULL));
 			if (err < 0)
 				pr_err("%s:ERR adding ctl\n", __func__);
 		} else
@@ -892,7 +885,7 @@ static int msm_soc_dai_init(struct snd_soc_codec *codec)
 {
 
 	int ret = 0;
-	ret = msm_new_mixer(codec->card);
+	ret = msm_new_mixer(codec);
 	if (ret < 0)
 		pr_err("%s: ALSA MSM Mixer Fail\n", __func__);
 
-- 
1.7.0.4


             reply	other threads:[~2011-02-10 10:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-10 10:49 eero.nurkkala [this message]
2011-02-10 17:33 ` [PATCH] ASoC: msm8x60: enhance mixer interfaces David Brown
2011-02-10 18:11   ` eero.nurkkala
2011-02-10 18:11     ` David Brown
2011-02-19  2:00 ` Patrick Lai
2011-02-21  6:58   ` eero.nurkkala

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297334949-5168-1-git-send-email-eero.nurkkala@offcode.fi \
    --to=eero.nurkkala@offcode.fi \
    --cc=linux-arm-msm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).