All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ricard Wanderlof <ricard.wanderlof@axis.com>
To: Felipe Ferreri Tonello <eu@felipetonello.com>
Cc: alsa-devel <alsa-devel@alsa-project.org>
Subject: Re: Unregister a card from userspace?
Date: Wed, 11 Nov 2015 16:33:17 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1511111625180.11990@lnxricardw1.se.axis.com> (raw)
In-Reply-To: <564355A9.9020704@felipetonello.com>


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.

The underlying reason for this rigmarole is rather complex, suffice to say 
at this stage that part of the hardware can be used for other mutually 
exclusive tasks.

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

Thanks for the pointers Filipe, I'll have a look there.

/Ricard
-- 
Ricard Wolf Wanderlöf                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30

  reply	other threads:[~2015-11-11 15:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-04  9:36 Unregister a card from userspace? Ricard Wanderlof
2015-11-04 11:24 ` Clemens Ladisch
2015-11-12 13:07   ` Ricard Wanderlof
2015-11-12 13:26     ` Lars-Peter Clausen
2015-11-12 15:38       ` Ricard Wanderlof
2015-11-09 11:24 ` Felipe Ferreri Tonello
2015-11-10  7:55   ` Ricard Wanderlof
2015-11-11 10:34     ` Felipe Ferreri Tonello
2015-11-11 12:59       ` Ricard Wanderlof
2015-11-11 13:09         ` Lars-Peter Clausen
2015-11-11 15:24           ` Ricard Wanderlof
2015-11-11 14:50         ` Felipe Ferreri Tonello
2015-11-11 15:33           ` Ricard Wanderlof [this message]
2015-11-12 10:31             ` Felipe Ferreri Tonello
2015-11-12 14:02               ` Ricard Wanderlof

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.02.1511111625180.11990@lnxricardw1.se.axis.com \
    --to=ricard.wanderlof@axis.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=eu@felipetonello.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.