Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: fmoraes@nc.rr.com
To: alsa-devel@lists.sourceforge.net
Subject: [PATCH] remove AC97 existing control
Date: Tue, 22 Mar 2005 07:45:15 -0500	[thread overview]
Message-ID: <cecf51cf0059.cf0059cecf51@southeast.rr.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

This patch should fix bug report 752 by removing the existing control from the AC97.


Sign off: Francisco Moraes


[-- Attachment #2: emu10k1x_mixer.patch --]
[-- Type: text/x-patch, Size: 1462 bytes --]

Index: alsa-kernel/pci/emu10k1/emu10k1x.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/emu10k1/emu10k1x.c,v
retrieving revision 1.7
diff -u -r1.7 emu10k1x.c
--- alsa-kernel/pci/emu10k1/emu10k1x.c	21 Mar 2005 08:13:32 -0000	1.7
+++ alsa-kernel/pci/emu10k1/emu10k1x.c	22 Mar 2005 12:35:48 -0000
@@ -1201,6 +1201,25 @@
 	.put =          snd_emu10k1x_spdif_put
 };
 
+static int remove_ctl(snd_card_t *card, const char *name)
+{
+	snd_ctl_elem_id_t id;
+	memset(&id, 0, sizeof(id));
+	strcpy(id.name, name);
+	id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+	return snd_ctl_remove_id(card, &id);
+}
+
+static snd_kcontrol_t *ctl_find(snd_card_t *card, const char *name)
+{
+	snd_ctl_elem_id_t sid;
+	memset(&sid, 0, sizeof(sid));
+	/* FIXME: strcpy is bad. */
+	strcpy(sid.name, name);
+	sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+	return snd_ctl_find_id(card, &sid);
+}
+
 static int __devinit snd_emu10k1x_mixer(emu10k1x_t *emu)
 {
 	int err;
@@ -1215,6 +1234,11 @@
 		return -ENOMEM;
 	if ((err = snd_ctl_add(card, kctl)))
 		return err;
+	if ((kctl = ctl_find(card, SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT))) != NULL) {
+		/* already defined by ac97, remove it */
+		/* FIXME: or do we need both controls? */
+		remove_ctl(card, SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT));
+	}
 	if ((kctl = snd_ctl_new1(&snd_emu10k1x_spdif_control, emu)) == NULL)
 		return -ENOMEM;
 	if ((err = snd_ctl_add(card, kctl)))

             reply	other threads:[~2005-03-22 12:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-22 12:45 fmoraes [this message]
2005-03-23 14:58 ` [PATCH] remove AC97 existing control Takashi Iwai
2005-03-24 13:24   ` Francisco Moraes
2005-03-24 17:49     ` Takashi Iwai

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=cecf51cf0059.cf0059cecf51@southeast.rr.com \
    --to=fmoraes@nc.rr.com \
    --cc=alsa-devel@lists.sourceforge.net \
    /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