* asoc device probing and dai question
@ 2010-12-02 11:01 Koul, Vinod
2010-12-02 11:07 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Koul, Vinod @ 2010-12-02 11:01 UTC (permalink / raw)
To: alsa-devel@alsa-project.org; +Cc: Harsha, Priya, Mark Brown, Liam Girdwood
Hi,
In our driver, the machine probe creates the soc-audio device. I am adding the
codec and platform device in my soc-device. But the probe for the codec doesn't
get called unless we add the cpu and codec dais in the machine probe. I saw the
soc-core code and looks like it checks if cpu and codec dais are registerd if so
then only proceeds and calls the codec probe.
So should I continue to register the dai for both cpu and codec in machine
probe. I didn't see other driver in soc/ doing this, so did I miss something.
Code:
In m/c driver... (the m/c driver probe is called by kernel when it finds this
device, and I register it as a platform device)
/* Audio machine driver */
static struct snd_soc_card snd_soc_intelmid_card = {
.name = "intel_mid_sound_card",
.platform = &intelmid_soc_platform,
.dai_link = intelmid_msic_dai,
.num_links = 1,
};
/* Audio subsystem */
static struct snd_soc_device intelmid_snd_devdata = {
.card = &snd_soc_intelmid_card,
.codec_dev = &intel_msic_codec,
};
int __devinit snd_intelmid_mc_probe(struct platform_device *pdev)
{
int ret_val;
snd_printk(KERN_DEBUG "snd_intelmad_probe called\n");
ret_val = snd_soc_register_dais(mid_bsp_dai, ARRAY_SIZE(mid_bsp_dai));
ret_val = snd_soc_register_dais(intel_msic_dais, ARRAY_SIZE(intel_msic_dais));
intelmid_snd_device = platform_device_alloc("soc-audio", -1);
if (!intelmid_snd_device) {
snd_printk(KERN_ERR "Platform device allocation failed\n");
return -ENOMEM;
}
platform_set_drvdata(intelmid_snd_device, &intelmid_snd_devdata);
intelmid_snd_devdata.dev = &intelmid_snd_device->dev;
ret_val = platform_device_add(intelmid_snd_device);
if (ret_val) {
snd_printk(KERN_ERR "Unable to add platform device\n");
platform_device_put(intelmid_snd_device);
}
return ret_val;
}
In platform init (note I don't have probe for platform)
static int __init intel_mid_soc_platform_init(void)
{
snd_printk(KERN_DEBUG "intel_mid_soc_platform_init called\n");
return snd_soc_register_platform(&intelmid_soc_platform);
}
Thanks
Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asoc device probing and dai question
2010-12-02 11:01 asoc device probing and dai question Koul, Vinod
@ 2010-12-02 11:07 ` Mark Brown
2010-12-02 11:23 ` Koul, Vinod
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2010-12-02 11:07 UTC (permalink / raw)
To: Koul, Vinod; +Cc: alsa-devel@alsa-project.org, Harsha, Priya, Liam Girdwood
On Thu, Dec 02, 2010 at 04:31:07PM +0530, Koul, Vinod wrote:
> So should I continue to register the dai for both cpu and codec in machine
> probe. I didn't see other driver in soc/ doing this, so did I miss something.
No, this is the wrong approach. The machine driver should not be
registering anything except itself. The CODEC and CPU drivers should be
being probed independantly in whatever way they would normally be probed
for the bus they're on.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asoc device probing and dai question
2010-12-02 11:07 ` Mark Brown
@ 2010-12-02 11:23 ` Koul, Vinod
2010-12-02 11:25 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Koul, Vinod @ 2010-12-02 11:23 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel@alsa-project.org, Harsha, Priya, Liam Girdwood
On Thu, Dec 02, 2010 at 04:37:29PM +0530, Mark Brown wrote:
> On Thu, Dec 02, 2010 at 04:31:07PM +0530, Koul, Vinod wrote:
>
> > So should I continue to register the dai for both cpu and codec in machine
> > probe. I didn't see other driver in soc/ doing this, so did I miss something.
>
> No, this is the wrong approach. The machine driver should not be
> registering anything except itself. The CODEC and CPU drivers should be
> being probed independantly in whatever way they would normally be probed
> for the bus they're on.
Thanks.
One thing which confused me is the soc-core, there the probe of codec and
platform are being called, what is the reason for that?
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asoc device probing and dai question
2010-12-02 11:23 ` Koul, Vinod
@ 2010-12-02 11:25 ` Mark Brown
2010-12-02 11:38 ` Koul, Vinod
0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2010-12-02 11:25 UTC (permalink / raw)
To: Koul, Vinod; +Cc: alsa-devel@alsa-project.org, Harsha, Priya, Liam Girdwood
On Thu, Dec 02, 2010 at 04:53:22PM +0530, Koul, Vinod wrote:
> One thing which confused me is the soc-core, there the probe of codec and
> platform are being called, what is the reason for that?
This allows them to do any initialisation which requires the ALSA card
to be present - the ALSA card is only created once the entire platform
is ready.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asoc device probing and dai question
2010-12-02 11:25 ` Mark Brown
@ 2010-12-02 11:38 ` Koul, Vinod
2010-12-02 11:47 ` Mark Brown
0 siblings, 1 reply; 6+ messages in thread
From: Koul, Vinod @ 2010-12-02 11:38 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel@alsa-project.org, Harsha, Priya, Liam Girdwood
> > One thing which confused me is the soc-core, there the probe of codec and
> > platform are being called, what is the reason for that?
>
> This allows them to do any initialisation which requires the ALSA card
> to be present - the ALSA card is only created once the entire platform
> is ready.
Thanks
So I am thinking now that since my platform tells me that I have only one audio
device which is platform device, so should I add my codec device and platform
device same way as I add the soc-audio from my machine driver. That way I can
even change codec's based on what I detect on the board.
And platform and codec driver probe register the dais
Would that be the right approach?
~Vinod
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: asoc device probing and dai question
2010-12-02 11:38 ` Koul, Vinod
@ 2010-12-02 11:47 ` Mark Brown
0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2010-12-02 11:47 UTC (permalink / raw)
To: Koul, Vinod; +Cc: alsa-devel@alsa-project.org, Harsha, Priya, Liam Girdwood
On Thu, Dec 02, 2010 at 05:08:51PM +0530, Koul, Vinod wrote:
> So I am thinking now that since my platform tells me that I have only one audio
> device which is platform device, so should I add my codec device and platform
> device same way as I add the soc-audio from my machine driver. That way I can
> even change codec's based on what I detect on the board.
> And platform and codec driver probe register the dais
> Would that be the right approach?
Ideally your platform would also register the devices separately
(especialy the CODEC which would usually be instantiated by whatever
bus it's on, or the probe of the core driver for the CODEC if it's an
MFD like yours are in silicon) but if you're limited in this way then
it's a good approach.
It may be worth separating out the device registration from the rest of
the machine driver for clarity.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-12-02 11:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-02 11:01 asoc device probing and dai question Koul, Vinod
2010-12-02 11:07 ` Mark Brown
2010-12-02 11:23 ` Koul, Vinod
2010-12-02 11:25 ` Mark Brown
2010-12-02 11:38 ` Koul, Vinod
2010-12-02 11:47 ` Mark Brown
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.