[alsa-devel] Unregister a card from userspace?

Felipe Ferreri Tonello eu at felipetonello.com
Thu Nov 12 11:31:58 CET 2015


Hi Ricard,

On 11/11/15 15:33, Ricard Wanderlof wrote:
> 
> On Wed, 11 Nov 2015, Felipe Ferreri Tonello wrote:
> 
>>>> How is your architecture? If you use one card for each probe of module
>>>> then each bind should create one device, right?
>>>
>>> In this case, it is a device which is located on the SoC. There is only 
>>> one instance of it. When the module is loaded, it loads a codec driver 
>>> with its associated DAI driver, a PCM driver, snd-soc-dummy-dai, and then 
>>> a machine driver to tie it all together, finally registering the card with 
>>> ALSA.
>>>
>>> Looking in /sys/bus/platform/devices, there seems to be one device created 
>>> for the codec itself, and one for the machine driver. I don't know if 
>>> that's right or wrong, the ALSA driver hierarchy works in the sense that I 
>>> can capture audio from it anyway.
>>>
>>
>> What exactly do you want? If it is driver that register and unregister 
>> cards based on the user interaction of probing and removing that module 
>> from user-space, then you are not looking for a driver. What you are 
>> looking for is just a kernel module. The only way of interacting with it 
>> is dealing with module_init and module_exit.
> 
> What I was aiming for was that when I load this particular module, it 
> ultimately calls snd_soc_register_card in its probe function, so that the 
> device in question becomes available for ALSA once the module has been 
> loaded. And then if I want to remove the driver I simply unload the module 
> which allows it to go away.

You said that the framework that handles the module had the counter to 2
so your unregister card function was never been called, right? I don't
understand that part, since it doesn't make sense to load your module
into the kernel more then once.

Try to write just a simple module that register/unregister a card on
module_init/module_exit, respectively. That should work just fine.

-- 
Felipe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x92698E6A.asc
Type: application/pgp-keys
Size: 4830 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20151112/2c73b3e1/attachment.bin>


More information about the Alsa-devel mailing list