You are not logged in.

#1 2014-03-23 12:23:15

Boing
Member
Registered: 2014-03-23
Posts: 3

Need help installing patches for ALSA's snd_oxygen

Hello guys. I'm pretty much a noob with Arch Linux, so please bear with me.
I have a ASUS Xonar DGX soundcard which works perfectly fine on Windows, but on Arch it has some problems.
It looks like the drivers aren't fully working, for example the headphone amp and the microphone don't work.
I am using ALSA with PulseAudio.

After some searching, I found out that a guy (Roman Volkov), made patches for the module snd_oxygen to fully support my soundcard.
http://comments.gmane.org/gmane.linux.alsa.devel/115281
http://comments.gmane.org/gmane.linux.alsa.devel/116054

How would I install those patches to make my soundcard work?
Thanks!

If I forgot anything to include like logs, please tell me.

Offline

#2 2014-03-23 12:28:29

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Need help installing patches for ALSA's snd_oxygen

Offline

#3 2014-03-23 13:52:40

Boing
Member
Registered: 2014-03-23
Posts: 3

Re: Need help installing patches for ALSA's snd_oxygen

Sorry, I'm really a noob.
I don't even know where to start. In the wiki it says "how to apply patches you created or downloaded from the Internet", but I don't even know how to download that patch. Do I just copy all the text and save it in a .patch file?
Thanks again.

Offline

#4 2014-03-23 18:13:59

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Need help installing patches for ALSA's snd_oxygen

The patches you posted are for Linux 3..12, but it seems that they haven't been merged in yet, so you do have to do it yourself. I have no idea if you should patch linux 3.12 or go ahead and try the current one, 3.13.
There are also other oxygen patches e.g. http://mailman.alsa-project.org/piperma … 69104.html Since they're newer (and labeled as version 2), I think you should be using them, not the ones you linked to.

Most of the commands I posted below aren't necessary for patching, I used them to show what I've done. Maybe somebody else can assist you or provide a more detailed advice.
I'm not sure if the whole patching thing will work, if there any more patches etc.
You shouldn't be patching these files by hand, but in the way outlined in the wiki article I mentioned. See https://projects.archlinux.org/svntogit … ages/linux -> https://projects.archlinux.org/svntogit … ages/linux for how Arch Linux patches the kernel.
Read the wiki article on ABS https://wiki.archlinux.org/index.php/Arch_Build_System and kernel compilation https://wiki.archlinux.org/index.php/Ke … ild_System

Boing wrote:

Do I just copy all the text and save it in a .patch file?

The patches are between lines that say '--', but there may be more that one patch in an e-mail e.g.

Move the mixer controls and other system structures to a separate file. Also there are actual driver changes: Multichannel routing, CS4245 initialization, CS4245 SPI reading and writing, DAC/ADC settings, suspend/resume logic.

Signed-off-by: Roman I. Volkov <v1ron at mail.ru>
---
I can confirm, the driver also works with OXYGEN_FUNCTION_ENABLE_SPI_4_5 removed.
diff -uprN linux-3.12/sound/pci/oxygen/oxygen_mixer.c linux-3.12-my/sound/pci/oxygen/oxygen_mixer.c
--- linux-3.12/sound/pci/oxygen/oxygen_mixer.c	2013-11-04 03:41:51.000000000 +0400
+++ linux-3.12-my/sound/pci/oxygen/oxygen_mixer.c	2013-11-20 19:13:09.000000000 +0400
@@ -190,6 +190,7 @@ void oxygen_update_dac_routing(struct ox
 	if (chip->model.update_center_lfe_mix)
 		chip->model.update_center_lfe_mix(chip, chip->dac_routing > 2);
 }
+EXPORT_SYMBOL(oxygen_update_dac_routing);
 
 static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)
 {
diff -uprN linux-3.12/sound/pci/oxygen/cs4245.h linux-3.12-my/sound/pci/oxygen/cs4245.h
--- linux-3.12/sound/pci/oxygen/cs4245.h	2013-11-04 03:41:51.000000000 +0400
+++ linux-3.12-my/sound/pci/oxygen/cs4245.h	2013-11-20 12:08:07.000000000 +0400
@@ -103,5 +103,6 @@
 #define CS4245_ADC_UNDRFL	0x01
 
 
-#define CS4245_SPI_ADDRESS	(0x9e << 16)
-#define CS4245_SPI_WRITE	(0 << 16)
+#define CS4245_SPI_ADDRESS	0x9e
+#define CS4245_SPI_WRITE	0
+#define CS4245_SPI_READ		1
diff -uprN linux-3.12/sound/pci/oxygen/xonar_dg.h linux-3.12-my/sound/pci/oxygen/xonar_dg.h
--- linux-3.12/sound/pci/oxygen/xonar_dg.h	2013-11-04 03:41:51.000000000 +0400
+++ linux-3.12-my/sound/pci/oxygen/xonar_dg.h	2013-11-21 13:41:44.000000000 +0400
@@ -3,6 +3,51 @@
 
 #include "oxygen.h"
 
...

The patches start with the line that says 'diff'.
One:

diff -uprN linux-3.12/sound/pci/oxygen/oxygen_mixer.c linux-3.12-my/sound/pci/oxygen/oxygen_mixer.c
--- linux-3.12/sound/pci/oxygen/oxygen_mixer.c	2013-11-04 03:41:51.000000000 +0400
+++ linux-3.12-my/sound/pci/oxygen/oxygen_mixer.c	2013-11-20 19:13:09.000000000 +0400
@@ -190,6 +190,7 @@ void oxygen_update_dac_routing(struct ox
 	if (chip->model.update_center_lfe_mix)
 		chip->model.update_center_lfe_mix(chip, chip->dac_routing > 2);
 }
+EXPORT_SYMBOL(oxygen_update_dac_routing);
 
 static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)
 {

Two:

diff -uprN linux-3.12/sound/pci/oxygen/cs4245.h linux-3.12-my/sound/pci/oxygen/cs4245.h
--- linux-3.12/sound/pci/oxygen/cs4245.h	2013-11-04 03:41:51.000000000 +0400
+++ linux-3.12-my/sound/pci/oxygen/cs4245.h	2013-11-20 12:08:07.000000000 +0400
@@ -103,5 +103,6 @@
 #define CS4245_ADC_UNDRFL	0x01
 
 
-#define CS4245_SPI_ADDRESS	(0x9e << 16)
-#define CS4245_SPI_WRITE	(0 << 16)
+#define CS4245_SPI_ADDRESS	0x9e
+#define CS4245_SPI_WRITE	0
+#define CS4245_SPI_READ

Three:

diff -uprN linux-3.12/sound/pci/oxygen/xonar_dg.h linux-3.12-my/sound/pci/oxygen/xonar_dg.h
--- linux-3.12/sound/pci/oxygen/xonar_dg.h	2013-11-04 03:41:51.000000000 +0400
+++ linux-3.12-my/sound/pci/oxygen/xonar_dg.h	2013-11-21 13:41:44.000000000 +0400
@@ -3,6 +3,51 @@
 
 #include "oxygen.h"
 
...

Get the patches from the mailing list, edit the PKGBUILD for the linux kernel, add the lines for your patches and try to compile it.



Here I'll try to explain what patching is about. Feel free to skip it.
Download the linux sources from http://www.kernel.org/pub/linux/kernel/ … .13.tar.xz and put them into our patching directory. Just create one e.g. in your ~.

$ bsdtar -xqOf linux-3.13.tar.xz linux-3.13/sound/pci/oxygen/Makefile > Makefile

Let's see if the Makefile has already been patched, is xonar_dg_mixer.o mentioned there?

$ grep xonar_dg_mixer.o Makefile
$ 

Nope. We have to patch it then.
You already have the Makefile file, now save the diff

diff -uprN linux-3.12/sound/pci/oxygen/Makefile linux-3.12-my/sound/pci/oxygen/Makefile
--- linux-3.12/sound/pci/oxygen/Makefile    2013-11-04 03:41:51.000000000 +0400
+++ linux-3.12-my/sound/pci/oxygen/Makefile 2013-11-20 19:04:54.000000000 +0400
@@ -1,5 +1,5 @@
 snd-oxygen-lib-objs := oxygen_io.o oxygen_lib.o oxygen_mixer.o oxygen_pcm.o
-snd-oxygen-objs := oxygen.o xonar_dg.o
+snd-oxygen-objs := oxygen.o xonar_dg_mixer.o xonar_dg.o
 snd-virtuoso-objs := virtuoso.o xonar_lib.o \
     xonar_pcm179x.o xonar_cs43xx.o xonar_wm87x6.o xonar_hdmi.o

to a file named Makefile.diff, put it in the same directory as the Makefile

$ ls
Makefile  Makefile.diff  linux-3.13.tar.xz 

and run

patch -p1 < Makefile.diff 
$ patch -p1 < Makefile.diff 
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -uprN linux-3.12/sound/pci/oxygen/Makefile linux-3.12-my/sound/pci/oxygen/Makefile
|--- linux-3.12/sound/pci/oxygen/Makefile    2013-11-04 03:41:51.000000000 +0400
|+++ linux-3.12-my/sound/pci/oxygen/Makefile 2013-11-20 19:04:54.000000000 +0400
--------------------------
File to patch:

Ah yes, we haven't created the linux-3.12/sound/pci/oxygen/ hierarchy, but we can patch it anyway, just type in 'Makefile' at the 'File to patch:' prompt:

File to patch: Makefile
patching file Makefile
Hunk #1 succeeded at 1 with fuzz 2.

Let's see

$ ls
Makefile  Makefile.diff  Makefile.orig  linux-3.13.tar.xz 

The old Makefile has been renamed Makefile.orig, Makefile is now patched with Makefile.diff, compare

$ cat Makefile
snd-oxygen-lib-objs := oxygen_io.o oxygen_lib.o oxygen_mixer.o oxygen_pcm.o
snd-oxygen-objs := oxygen.o xonar_dg_mixer.o xonar_dg.o
snd-virtuoso-objs := virtuoso.o xonar_lib.o \
	xonar_pcm179x.o xonar_cs43xx.o xonar_wm87x6.o xonar_hdmi.o

obj-$(CONFIG_SND_OXYGEN_LIB) += snd-oxygen-lib.o
obj-$(CONFIG_SND_OXYGEN) += snd-oxygen.o
obj-$(CONFIG_SND_VIRTUOSO) += snd-virtuoso.o

to

$ cat Makefile.orig 
snd-oxygen-lib-objs := oxygen_io.o oxygen_lib.o oxygen_mixer.o oxygen_pcm.o
snd-oxygen-objs := oxygen.o xonar_dg.o
snd-virtuoso-objs := virtuoso.o xonar_lib.o \
	xonar_pcm179x.o xonar_cs43xx.o xonar_wm87x6.o xonar_hdmi.o

obj-$(CONFIG_SND_OXYGEN_LIB) += snd-oxygen-lib.o
obj-$(CONFIG_SND_OXYGEN) += snd-oxygen.o
obj-$(CONFIG_SND_VIRTUOSO) += snd-virtuoso.o

or see just the changes - the old line:

$ comm -13 <(sort Makefile) <(sort Makefile.orig)
snd-oxygen-objs := oxygen.o xonar_dg.o

the new line:

$ comm -23 <(sort Makefile) <(sort Makefile.orig)
snd-oxygen-objs := oxygen.o xonar_dg_mixer.o xonar_dg.o

The patch said:

-snd-oxygen-objs := oxygen.o xonar_dg.o
+snd-oxygen-objs := oxygen.o xonar_dg_mixer.o xonar_dg.o

which means 'change the line that starts with '-' to the line that starts with '+''.
This is how you patch files by hand.

Good luck.

Offline

#5 2014-03-23 19:36:00

Boing
Member
Registered: 2014-03-23
Posts: 3

Re: Need help installing patches for ALSA's snd_oxygen

karol wrote:

-snip-

Thanks for the long and informative post, karol. I'm starting to understand more and more, slowly.
So, to install a patch I have to download the kernel, edit the kernel with the patch, compile the kernel and install the new kernel?
Is there a way to install the patch without installing a custom kernel? Thanks.

Offline

#6 2014-04-02 18:30:44

l0vot
Member
Registered: 2011-08-26
Posts: 117

Re: Need help installing patches for ALSA's snd_oxygen

the above method involves applying the patch directly to the kernle directly before compilation, and I'm guessing the patches have to be redone every time you recompile the kernle (which I have to do often because the catalyst drivers. Plus kernal updates). The oxygen driver, unlike the kernle does not update seeing as an incomplete driver was released over a year ago, and was never officially fixed or updated as far as I can tell. How would I apply the patches directly to the driver source so the patched driver is included in the "stock" kernle every time it compiles on my system.

EDIT: a recent kernel update FINALLY updated the driver so it actually has working volume controls and front panel support.

Last edited by l0vot (2014-04-14 07:01:20)

Offline

Board footer

Powered by FluxBB