Re: Unregister a card from userspace?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Ricard,

On 11/11/15 12:59, Ricard Wanderlof wrote:
> 
> On Wed, 11 Nov 2015, Felipe Ferreri Tonello wrote:
> 
>>> But that is precisely the problem. The framework that manages the 
>>> insertion and deletion of modules notes that my module has a usage count 
>>> that is > 0 (in my case it is 2, which I'm convinced is because the card 
>>> has been registered with ALSA), and refuses to free the module. So there 
>>> is now way any unregister_card call can be made when my module is freed, 
>>> as due to the usage count it would never even be attempted.
>>
>> Do you mean that unbind is never called? Well, the framework should call
>> bind/unbind for each user of your module.
> 
> Ok, I didn't know that. It's the first time I've been writing an ALSA 
> driver as a loadable module.

Well, this is not ALSA specific, it really depends on which framework
your driver is based on, but they all share similar flow on probe and
remove driver.

> 
>> 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.

On the other hand, if in fact you want a driver, then check
sound/drivers/dummy.c for an example. You can also read the
Documentation/driver-model/platform.txt for more info.

-- 
Felipe

Attachment: 0x92698E6A.asc
Description: application/pgp-keys

_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux