Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to
LinuxQuestions.org , a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free.
Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please
contact us . If you need to reset your password,
click here .
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
10-05-2006, 06:52 PM
#1
Member
Registered: Feb 2004
Location: NY, USA
Distribution: openSUSE 11
Posts: 240
Rep:
How to patch ALSA?
Could someone please inform me on how to patch ALSA if I have a c source file? The patch I want to use is here:
https://bugtrack.alsa-project.org/al...ew.php?id=2485
Thanks, I appreciate it!
10-06-2006, 03:58 PM
#2
Member
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848
Rep:
In looking at that code, it doesn't conform to the same format as the other HDA codec drivers, so I'm not quite sure if it will work. If you feel adventuresome, you can try to add it to the alsa source tree. Put the file in ./alsa-driver/alsa-kernel/pdi/hda, then add it to the Makefile in the same directory (I may be missing a step here). Compile and test it.
10-06-2006, 04:17 PM
#3
Guru
Registered: Jan 2002
Posts: 6,042
Rep:
Try downloading ALSA from the CVS tree.
10-06-2006, 04:36 PM
#4
Member
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848
Rep:
This file hasn't been added to the alsa-project as of today (and they haven't used cvs in over a year). It is currently being reviewed by the HDA maintainers.
10-07-2006, 02:59 PM
#5
Member
Registered: Sep 2004
Distribution: Slackware
Posts: 113
Rep:
GrueMaster, it works as you described, with one modification. You also need to edit the hda_patch.h file and add the conexant patch in there twice, in the same format as the others.
Eric
10-08-2006, 01:29 PM
#6
Member
Registered: Feb 2004
Location: NY, USA
Distribution: openSUSE 11
Posts: 240
Original Poster
Rep:
One quick question. When I went to do this, I had no clue where to find ./alsa-driver/alsa-kernel/pdi/hda! Where is this folder?
10-08-2006, 01:38 PM
#7
Member
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848
Rep:
Oh, I had assumed you had downloaded the latest alsa-driver from alsa-project.org. Download the alsa-driver tarball, and extract it, then follow the directions I posted earlier.
10-10-2006, 02:47 AM
#8
LQ Newbie
Registered: Oct 2006
Posts: 2
Rep:
how to use this patch (if it's still intrestering)
Short steps.
Normally i used Gentoo and I prepared ebuild (that is based on original one from portage).
Ok, to patch sources:
- download src for alsa-driver from ALSA site version 1.0.11
- unpack somewhere
- in alsa directory execute:
patch -p1 < /usr/local/portage/media-sound/alsa-driver-conexant/files/alsa-driver-conexant-1.0.11-conexant.patch
./configure --prefix=/usr --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --with-oss --without-debug --with-kernel=/usr/src/linux --with-build=/usr/src/linux --with-isapnp=yes --with-sequencer=yes --with-cards=hda-intel --build=i686-pc-linux-gnu
make
make install
that's all.
I did not try "make install" but i think i works. If you do not need OSS do not use switch. "with-oss", depends on system other parameters also can be changed
10-10-2006, 08:16 PM
#9
Member
Registered: Feb 2004
Location: NY, USA
Distribution: openSUSE 11
Posts: 240
Original Poster
Rep:
When I performed the patch as said by gruemaster and eeades I got this error:
Code:
make[5]: *** No rule to make target `/home/joshua/Desktop/alsa-driver-1.0.13/als a-driver-1.0.13/pci/hda/patch_conexant.s', needed by `/home/joshua/Desktop/alsa- driver-1.0.13/alsa-driver-1.0.13/pci/hda/patch_conexant.o'. Stop.
make[4]: *** [/home/joshua/Desktop/alsa-driver-1.0.13/alsa-driver-1.0.13/pci/hda ] Error 2
make[3]: *** [/home/joshua/Desktop/alsa-driver-1.0.13/alsa-driver-1.0.13/pci] Er ror 2
make[2]: *** [_module_/home/joshua/Desktop/alsa-driver-1.0.13/alsa-driver-1.0.13 ] Error 2
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.16.21-0.8'
make: *** [compile] Error 2
So I had to add the patch_conexant.c file to the alsa-driver-1.0.13/alsa-driver-1.0.13/pci/hda/ directory.
After that, it compiled perfectly!
10-10-2006, 09:10 PM
#10
Member
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848
Rep:
I never said it was a patch file. When you compiled it, did you get a resulting patch_conexant.o file in ./alsa-driver/pci/hda or ./alsa-driver/alsa-kernel/pci/hda? If not then you still need to add it to the Makefile and to hda_patch.h. Let me know if it works.
10-10-2006, 10:07 PM
#11
Member
Registered: Feb 2004
Location: NY, USA
Distribution: openSUSE 11
Posts: 240
Original Poster
Rep:
I added those two also. Um well let me just sum up what I did to make it clear!
**This is all within the downloaded ALSA 1.0.13 tarball**
1. Copy patch_conexant.c to /alsa-driver/alsa-kernel/pci/hda
2. Added patch_conexant.o to snd-hda-codec-objs in Makefile
3. Add snd_hda_preset_conexant to hda_preset_tables[] in hda_patch.h file
4. Copy patch_conexant.c to /alsa-driver-1.0.13/pci/hda/
5. Compile
This worked perfectly. I'm not sure if that answers your question. Sorry if it doesn't!
10-11-2006, 02:48 AM
#12
LQ Newbie
Registered: Oct 2006
Posts: 2
Rep:
Sorry, i was wrong on ALSA bug trac I put only c file.
Here you can find patch here:
diff -Nuar alsa-driver-1.0.11/alsa-kernel/pci/hda/hda_patch.h alsa-driver-1.0.11.conexant/alsa-kernel/pci/hda/hda_patch.h
--- alsa-driver-1.0.11/alsa-kernel/pci/hda/hda_patch.h 2005-08-11 12:18:38.000000000 +0200
+++ alsa-driver-1.0.11.conexant/alsa-kernel/pci/hda/hda_patch.h 2006-09-24 17:09:44.000000000 +0200
@@ -12,6 +12,8 @@
extern struct hda_codec_preset snd_hda_preset_sigmatel[];
/* SiLabs 3054/3055 modem codecs */
extern struct hda_codec_preset snd_hda_preset_si3054[];
+/* Conexant audio codec */
+extern struct hda_codec_preset snd_hda_preset_conexant[];
static const struct hda_codec_preset *hda_preset_tables[] = {
snd_hda_preset_realtek,
@@ -19,5 +21,6 @@
snd_hda_preset_analog,
snd_hda_preset_sigmatel,
snd_hda_preset_si3054,
+ snd_hda_preset_conexant,
NULL
};
diff -Nuar alsa-driver-1.0.11/alsa-kernel/pci/hda/Makefile alsa-driver-1.0.11.conexant/alsa-kernel/pci/hda/Makefile
--- alsa-driver-1.0.11/alsa-kernel/pci/hda/Makefile 2005-08-11 12:18:38.000000000 +0200
+++ alsa-driver-1.0.11.conexant/alsa-kernel/pci/hda/Makefile 2006-09-24 17:11:04.000000000 +0200
@@ -1,5 +1,5 @@
snd-hda-intel-objs := hda_intel.o
-snd-hda-codec-objs := hda_codec.o hda_generic.o patch_realtek.o patch_cmedia.o patch_analog.o patch_sigmatel.o patch_si3054.o
+snd-hda-codec-objs := hda_codec.o hda_generic.o patch_realtek.o patch_cmedia.o patch_analog.o patch_sigmatel.o patch_si3054.o patch_conexant.o
ifdef CONFIG_PROC_FS
snd-hda-codec-objs += hda_proc.o
endif
diff -Nuar alsa-driver-1.0.11/alsa-kernel/pci/hda/patch_conexant.c alsa-driver-1.0.11.conexant/alsa-kernel/pci/hda/patch_conexant.c
--- alsa-driver-1.0.11/alsa-kernel/pci/hda/patch_conexant.c 1970-01-01 01:00:00.000000000 +0100
+++ alsa-driver-1.0.11.conexant/alsa-kernel/pci/hda/patch_conexant.c 2006-09-28 23:10:20.000000000 +0200
@@ -0,0 +1,164 @@
+/*
+ * Universal Interface for Intel High Definition Audio Codec
+ *
+ * HD audio interface patch for Conexant HDA audio codec
+ *
+ * Copyright (c) 2006 Pototskiy Akex <alex.pototskiy@gmail.com>
+ *
+ *
+ * NO LICENSE NO WARRANTY
+ *
+ */
+
+#include <sound/driver.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/slab.h>
+#include <linux/pci.h>
+#include <sound/core.h>
+#include "hda_codec.h"
+#include "hda_local.h"
+
+#define MAIN_MUX 0x1A
+#define DAC 0x10
+#define ADC 0x12
+
+struct conexant_spec {
+ unsigned int cur_mux;
+ struct hda_pcm pcm;
+};
+
+static struct hda_pcm_stream conexant_pcm_analog_playback = {
+ .substreams = 1,
+ .channels_min = 2,
+ .channels_max = 2,
+ .nid = DAC, /* NID to query formats and rates */
+};
+
+static struct hda_pcm_stream conexant_pcm_analog_capture = {
+ .substreams = 1,
+ .channels_min = 2,
+ .channels_max = 2,
+ .nid = ADC, /* NID to query formats and rates */
+};
+
+static int conexant_build_pcms(struct hda_codec *codec) {
+ struct conexant_spec *spec = codec->spec;
+ struct hda_pcm *info = &spec->pcm;
+
+ codec->num_pcms = 1;
+ codec->pcm_info = info;
+
+ info->name = "CNXNT";
+ info->stream[SNDRV_PCM_STREAM_PLAYBACK] = conexant_pcm_analog_playback;
+ info->stream[SNDRV_PCM_STREAM_CAPTURE] = conexant_pcm_analog_capture;
+
+ return 0;
+}
+
+static struct hda_input_mux conexant_basic_mux = {
+ .num_items = 2,
+ .items = {
+ {"ExtMic",0x01},
+ {"IntMic",0x02},
+ }
+};
+
+static int conexant_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
+{
+ return snd_hda_input_mux_info(&conexant_basic_mux, uinfo);
+}
+
+static int conexant_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+ struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+ struct conexant_spec * spec = codec->spec;
+ ucontrol->value.enumerated.item[0] = spec->cur_mux;
+ return 0;
+}
+
+static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+ struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+ struct conexant_spec *spec = codec->spec;
+
+ return snd_hda_input_mux_put(codec, &conexant_basic_mux, ucontrol,
+ MAIN_MUX, &spec->cur_mux);
+}
+
+static struct snd_kcontrol_new conexant_basic_mixer[] = {
+ {
+ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+ .name = "Capture Source",
+ .info = conexant_mux_enum_info,
+ .get = conexant_mux_enum_get,
+ .put = conexant_mux_enum_put
+ },
+ HDA_CODEC_VOLUME("Mic Bypass Capture Volume",0x19,0x02,HDA_INPUT),
+ HDA_CODEC_MUTE("Mic Bypass Capture Switch",0x19,0x02,HDA_INPUT),
+ HDA_CODEC_MUTE("Capture Switch",0x12,0x03,HDA_INPUT),
+ HDA_CODEC_VOLUME("Capture Volume",0x12,0x03,HDA_INPUT),
+ HDA_CODEC_VOLUME("PCM Volume",0x10,0x00,HDA_OUTPUT),
+ HDA_CODEC_MUTE("PCM Switch",0x10,0x00,HDA_OUTPUT),
+ HDA_CODEC_VOLUME("Playback Volume",0x13,0x00,HDA_OUTPUT),
+ HDA_CODEC_MUTE("Playback Switch",0x13,0x00,HDA_OUTPUT),
+ {}
+};
+
+static int conexant_build_controls(struct hda_codec *codec) {
+ int err;
+
+ err = snd_hda_add_new_ctls(codec,conexant_basic_mixer);
+ if ( err < 0 )
+ return err;
+
+ return 0;
+}
+
+static struct hda_verb conexant_basic_init[] = {
+ {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+ {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+ {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 },
+ {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+ {0x12, AC_VERB_SET_CONNECT_SEL,0x03},
+ {0x1A, AC_VERB_SET_CONNECT_SEL,0x01},
+ {0x12, AC_VERB_SET_CONNECT_SEL,0x03},
+ {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17},
+ {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x00},
+ {0x1A, AC_VERB_SET_AMP_GAIN_MUTE, AC_AMP_SET_OUTPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x03},
+ {}
+};
+
+static int conexant_init(struct hda_codec *codec) {
+ snd_hda_sequence_write(codec,conexant_basic_init);
+ return 0;
+}
+
+static void conexant_free(struct hda_codec *codec) {
+ kfree(codec->spec);
+ return;
+}
+
+static struct hda_codec_ops conexant_patch_ops = {
+ .build_controls = conexant_build_controls,
+ .build_pcms = conexant_build_pcms,
+ .init = conexant_init,
+ .free = conexant_free
+};
+
+static int patch_conexant(struct hda_codec *codec) {
+ struct conexant_spec *spec;
+
+ spec = kzalloc(sizeof(*spec),GFP_KERNEL);
+ if ( !spec )
+ return -ENOMEM;
+ codec->spec = spec;
+ spec->cur_mux = 0;
+ codec->patch_ops = conexant_patch_ops;
+ return 0;
+}
+
+struct hda_codec_preset snd_hda_preset_conexant[] = {
+ { .id = 0x14f15047, .name = "CONEXANT", .patch = patch_conexant },
+ {} /* terminator */
+};
diff -Nuar alsa-driver-1.0.11/pci/hda/patch_conexant.c alsa-driver-1.0.11.conexant/pci/hda/patch_conexant.c
--- alsa-driver-1.0.11/pci/hda/patch_conexant.c 1970-01-01 01:00:00.000000000 +0100
+++ alsa-driver-1.0.11.conexant/pci/hda/patch_conexant.c 2006-09-24 17:32:04.000000000 +0200
@@ -0,0 +1,2 @@
+#define __NO_VERSION__
+#include "../../alsa-kernel/pci/hda/patch_conexant.c"
it will solve problem with compilation.
10-26-2006, 04:50 PM
#13
Member
Registered: Jun 2004
Location: Jackson, TN
Distribution: Kubuntu Feisty
Posts: 606
Rep:
i have need of this as well for recording on my laptop, a compaq presario v5204nr
This seems specific for Gentoo.. I use Mepis, what must I do to get this?
thanks,
-myk
10-26-2006, 06:02 PM
#14
Member
Registered: Feb 2004
Location: NY, USA
Distribution: openSUSE 11
Posts: 240
Original Poster
Rep:
This is not Gentoo specific. The bug report can be found here:
https://bugtrack.alsa-project.org/al...ew.php?id=2485
As of right now, the patch is going through many revisions so that they can clean it up for its addition to the next version of ALSA.
You can help test this or watch its progress by signing up to the alsa-devel mailing list.
10-26-2006, 06:41 PM
#15
Member
Registered: Aug 2005
Location: Oregon
Distribution: Kubuntu.
Posts: 848
Rep:
I've taken up the editing of this patch. The more testers, the better. Start by downloading alsa-driver-1.0.13.tar.bz2 from alsa-project.org, then get the latest patch that I've posted to the alsa-devel mailing list
here . You will also need the following driver wrapper patch:
--- /dev/null 2006-09-13 00:29:45.000000000 -0700
+++ b/pci/hda/patch_conexant.c 2006-10-21 21:30:35.000000000 -0700
@@ -0,0 +1,2 @@
+#define __NO_VERSION__
+#include "../../alsa-kernel/pci/hda/patch_conexant.c"
Follow these steps to add support for the Conexant 5047 codec:
tar -jxvf alsa-driver-1.0.13.tar.bz2
cd alsa-driver-1.0.13
patch -p1 < driver-wrapper.patch
cd alsa-kernel
patch -p1 < conexant-kernel-test6.patch
cd ..
./configure --with-debug=full --with-cards=hda-intel ; make ; make install
You can now load the driver. If it doesn't work initially, try loading it with model=test.
Send me an email with what works, what doesn't, and your system model, along with the output from "lspci -s 0:1b -vn" so I can add your system to the config. I'll post changes to the alsa-devel mailing list, and I also have a personal mailing list of testers. Drop me a note to be included.
Tobin
Thread Tools
Search this Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT -5. The time now is 10:39 AM .
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know .
Latest Threads
LQ News