Reputation: 71
I am trying to create a simple driver for my PCI sound card in which I will use the ALSA api. To run my driver I have blacklisted the original snd_intel8x0 sound card driver. At this point my probe function is called and my PCI IO ports are allocated and the PCI device is enabled.
Unfortunately when I try to use the ALSA api I get these errors:
[...] alsa: Unknown symbol snd_card_register (err 0)
[...] alsa: Unknown symbol snd_card_create (err 0)
[...] alsa: Unknown symbol snd_card_free (err 0)
[...] alsa: Unknown symbol snd_device_new (err 0)
Also in file /proc/kallsyms there are no snd* symbols (if the original driver snd_intel8x0 is running all of the above mentioned snd* functions are available in /proc/kallsyms)
And folder /proc/asound is gone when the original driver is blacklisted (if snd_intel8x0 is running asound folder is present)
My search in internet and questions in here and in other forums show that I have to build somehow the ALSA with my driver. How should I do this? Any guidelines, tutorials links are highly appreciated.
Thanks a lot in advance. I hope to get some useful answers. I am trying to fix this issue for a long time now with no success.
Greetings, Nedelin.
Upvotes: 1
Views: 799
Reputation: 71
Well I will try to explain what I have done so far as detailed as possible.
So here is the makefile I use
obj-m := alsa.o
KERNELDIR ?= /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
all: $(MAKE) -C $(KERNELDIR) M=$(PWD)
clean: rm -rf *.o ~ core .depend ..cmd *.ko *.mod.c .tmp_versions
I do the loading with sudo insmod .ko
Here I will say that initially I didn't want to use ALSA. At that point I created one bare-bone PCI driver, which only initialized the PCI device and registered IO ports and IO memory in the probe function. And I succeeded loading this module(the probe was executed and IO regions were reserved). For building this PCI driver I used the above mentioned Makefile. Later I decided that I need the ALSA and since then I get the [...] alsa: Unknown symbol snd_card_register (err 0) errors
I also tried to include my driver in the ALSA tree as described in the link which you sent me. Here is how I have changed the Makfile and Kconfig files in /sound/pci(one remark I created a link in /sound/pci/Nedelin_ALSA_PCI.o which points to the actual code. I mention this in order to avoid any comments on the names of the file):
Makefile
...
snd-nedelinxalsaxpci-objs := Nedelin_ALSA_PCI.o
...
obj-$(CONFIG_SND_NEDELINXALSAXPCI) += snd-nedelinxalsaxpc
Kconfig
config SND_NEDELINXALSAXPCI
tristate "Intel/SiS/nVidia/SND_NEDELINXALSAXPCI Driver"
select SND_AC97_CODEC
help This is my driver...
This seemed successful. I located my driver in make menuconfig and loaded it as module. Recompiled my kernel, also OK. And I see my driver in /lib/modules//kernel/sound/pci. If I try to load it with modprobe it seems to be loaded(module_init() is executed) but my probe function is not executed.
I am totally confused.
Upvotes: 1
Reputation: 180020
You did something wrong when compiling or loading your module, but since you did not mention how you tried to do that, nothing more specific can be said.
For a description of how to compile and load modules, see chapter 2 of Linux Device Drivers.
For ALSA drivers, see Writing an ALSA Driver.
Upvotes: 1