* ASOC: Best way to get private data from machine driver to the other drivers?
@ 2007-09-28 21:14 Timur Tabi
2007-10-01 10:53 ` Liam Girdwood
0 siblings, 1 reply; 9+ messages in thread
From: Timur Tabi @ 2007-09-28 21:14 UTC (permalink / raw)
To: alsa-devel
I'm writing an ASOC driver. When my machine driver loads, it determines some
hardware information for the DMA controllers, some other hardware information
for the I2S controller, and even more information for the codec.
I want to be able to pass all this information to each of the three other
drivers. Unfortunately, it doesn't appear that I have enough "private_data"
pointers available to me.
The current ASOC drivers all use statically defined global structures and
indexes into arrays of these structures to identify individual devices, such
associating I2S controller #2 with DMA channels 3 and 4. On PowerPC, this
doesn't work. The actual hardware configuration is determined at runtime (see
arch/powerpc/boot/dts/), and so the machine driver needs to collect all the
information and make all the device-to-device associations.
For example, the PCM driver has an open function:
static struct snd_pcm_ops fsl_dma_ops = {
.open = fsl_dma_open,
...
static int fsl_dma_open(struct snd_pcm_substream *substream)
{
...
What I would like is for fsl_dma_open() to be able to obtain pointers to the
DMA controller's registers (there are two controllers with 4 channels each) by
looking inside 'substream'. How can I do that?
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: ASOC: Best way to get private data from machine driver to the other drivers?
2007-09-28 21:14 ASOC: Best way to get private data from machine driver to the other drivers? Timur Tabi
@ 2007-10-01 10:53 ` Liam Girdwood
2007-10-01 20:10 ` Timur Tabi
2007-10-01 21:49 ` Timur Tabi
0 siblings, 2 replies; 9+ messages in thread
From: Liam Girdwood @ 2007-10-01 10:53 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel
On Fri, 2007-09-28 at 16:14 -0500, Timur Tabi wrote:
> I'm writing an ASOC driver. When my machine driver loads, it determines some
> hardware information for the DMA controllers, some other hardware information
> for the I2S controller, and even more information for the codec.
>
> I want to be able to pass all this information to each of the three other
> drivers. Unfortunately, it doesn't appear that I have enough "private_data"
> pointers available to me.
>
> The current ASOC drivers all use statically defined global structures and
> indexes into arrays of these structures to identify individual devices, such
> associating I2S controller #2 with DMA channels 3 and 4. On PowerPC, this
> doesn't work. The actual hardware configuration is determined at runtime (see
> arch/powerpc/boot/dts/), and so the machine driver needs to collect all the
> information and make all the device-to-device associations.
>
> For example, the PCM driver has an open function:
>
> static struct snd_pcm_ops fsl_dma_ops = {
> .open = fsl_dma_open,
> ...
>
> static int fsl_dma_open(struct snd_pcm_substream *substream)
> {
> ...
>
> What I would like is for fsl_dma_open() to be able to obtain pointers to the
> DMA controller's registers (there are two controllers with 4 channels each) by
> looking inside 'substream'. How can I do that?
>
I think we have addressed this now in ASoC V2. Every component driver
now registers as a standard Linux device driver. It would probably be
possible to read the dts configuration at probe() and then configure the
driver with the correct DMA pointers before calling driver_register().
http://opensource.wolfsonmicro.com/cgi-bin/gitweb/gitweb.cgi?p=linux-2.6-asoc;a=shortlog;h=asoc-v2-dev
Could you have a look at the V2 i.mx31 SSI driver and let me know if we
need further changes for better dts support.
Thanks
Liam
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: ASOC: Best way to get private data from machine driver to the other drivers?
2007-10-01 10:53 ` Liam Girdwood
@ 2007-10-01 20:10 ` Timur Tabi
2007-10-02 16:40 ` Liam Girdwood
2007-10-01 21:49 ` Timur Tabi
1 sibling, 1 reply; 9+ messages in thread
From: Timur Tabi @ 2007-10-01 20:10 UTC (permalink / raw)
To: Liam Girdwood; +Cc: alsa-devel
Liam Girdwood wrote:
> Could you have a look at the V2 i.mx31 SSI driver and let me know if we
> need further changes for better dts support.
I'll do that. However, I still have the same problem - without a git-http
interface, my ability to "work with" that repository is limited. Can you
create a repo on kernel.org? I have git better access to that site.
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ASOC: Best way to get private data from machine driver to the other drivers?
2007-10-01 20:10 ` Timur Tabi
@ 2007-10-02 16:40 ` Liam Girdwood
2007-10-02 16:49 ` Timur Tabi
2007-10-02 16:50 ` Timur Tabi
0 siblings, 2 replies; 9+ messages in thread
From: Liam Girdwood @ 2007-10-02 16:40 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel
On Mon, 2007-10-01 at 15:10 -0500, Timur Tabi wrote:
> Liam Girdwood wrote:
>
> > Could you have a look at the V2 i.mx31 SSI driver and let me know if we
> > need further changes for better dts support.
>
> I'll do that. However, I still have the same problem - without a git-http
> interface, my ability to "work with" that repository is limited. Can you
> create a repo on kernel.org? I have git better access to that site.
>
Do you know who would be the best person to ask for this ?
If it's ok with the kernel.org folks I can do this.
Liam
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ASOC: Best way to get private data from machine driver to the other drivers?
2007-10-02 16:40 ` Liam Girdwood
@ 2007-10-02 16:49 ` Timur Tabi
2007-10-02 16:50 ` Timur Tabi
1 sibling, 0 replies; 9+ messages in thread
From: Timur Tabi @ 2007-10-02 16:49 UTC (permalink / raw)
To: Liam Girdwood; +Cc: alsa-devel
Liam Girdwood wrote:
> Do you know who would be the best person to ask for this ?
>
> If it's ok with the kernel.org folks I can do this.
http://kernel.org/faq/#account
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ASOC: Best way to get private data from machine driver to the other drivers?
2007-10-02 16:40 ` Liam Girdwood
2007-10-02 16:49 ` Timur Tabi
@ 2007-10-02 16:50 ` Timur Tabi
1 sibling, 0 replies; 9+ messages in thread
From: Timur Tabi @ 2007-10-02 16:50 UTC (permalink / raw)
To: Liam Girdwood; +Cc: alsa-devel
Liam Girdwood wrote:
> On Mon, 2007-10-01 at 15:10 -0500, Timur Tabi wrote:
>> Liam Girdwood wrote:
>>
>>> Could you have a look at the V2 i.mx31 SSI driver and let me know if we
>>> need further changes for better dts support.
>> I'll do that. However, I still have the same problem - without a git-http
>> interface, my ability to "work with" that repository is limited. Can you
>> create a repo on kernel.org? I have git better access to that site.
>>
>
> Do you know who would be the best person to ask for this ?
I take it that enabling git-http access is not an option? Normally, that
would be easier than getting an account on kernel.org.
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ASOC: Best way to get private data from machine driver to the other drivers?
2007-10-01 10:53 ` Liam Girdwood
2007-10-01 20:10 ` Timur Tabi
@ 2007-10-01 21:49 ` Timur Tabi
2007-10-02 16:37 ` Liam Girdwood
1 sibling, 1 reply; 9+ messages in thread
From: Timur Tabi @ 2007-10-01 21:49 UTC (permalink / raw)
To: Liam Girdwood; +Cc: alsa-devel
Liam Girdwood wrote:
> Could you have a look at the V2 i.mx31 SSI driver and let me know if we
> need further changes for better dts support.
I'm trying to port the CS4270 codec driver (it's easier) to ASOC v2, and I see
that you don't have snd_pcm_rate_to_rate_bit(). Where did it go?
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ASOC: Best way to get private data from machine driver to the other drivers?
2007-10-01 21:49 ` Timur Tabi
@ 2007-10-02 16:37 ` Liam Girdwood
2007-10-02 16:48 ` Timur Tabi
0 siblings, 1 reply; 9+ messages in thread
From: Liam Girdwood @ 2007-10-02 16:37 UTC (permalink / raw)
To: Timur Tabi; +Cc: alsa-devel
On Mon, 2007-10-01 at 16:49 -0500, Timur Tabi wrote:
> Liam Girdwood wrote:
>
> > Could you have a look at the V2 i.mx31 SSI driver and let me know if we
> > need further changes for better dts support.
>
> I'm trying to port the CS4270 codec driver (it's easier) to ASOC v2, and I see
> that you don't have snd_pcm_rate_to_rate_bit(). Where did it go?
>
We never had a snd_pcm_rate_to_rate_bit() in the ASoC code, perhaps you
mean something else ?
Liam
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: ASOC: Best way to get private data from machine driver to the other drivers?
2007-10-02 16:37 ` Liam Girdwood
@ 2007-10-02 16:48 ` Timur Tabi
0 siblings, 0 replies; 9+ messages in thread
From: Timur Tabi @ 2007-10-02 16:48 UTC (permalink / raw)
To: Liam Girdwood; +Cc: alsa-devel
Liam Girdwood wrote:
> On Mon, 2007-10-01 at 16:49 -0500, Timur Tabi wrote:
>> Liam Girdwood wrote:
>>
>>> Could you have a look at the V2 i.mx31 SSI driver and let me know if we
>>> need further changes for better dts support.
>> I'm trying to port the CS4270 codec driver (it's easier) to ASOC v2, and I see
>> that you don't have snd_pcm_rate_to_rate_bit(). Where did it go?
>>
>
> We never had a snd_pcm_rate_to_rate_bit() in the ASoC code, perhaps you
> mean something else ?
In may not be part of ASoC, but it's part of ALSA, and I need it. It's not
just in your repository.
sound/core/pcm_misc.c
/**
* snd_pcm_rate_to_rate_bit - converts sample rate to SNDRV_PCM_RATE_xxx bit
* @rate: the sample rate to convert
*
* Returns the SNDRV_PCM_RATE_xxx flag that corresponds to the given rate, or
* SNDRV_PCM_RATE_KNOT for an unknown rate.
*/
unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate)
{
unsigned int i;
for (i = 0; i < snd_pcm_known_rates.count; i++)
if (snd_pcm_known_rates.list[i] == rate)
return 1u << i;
return SNDRV_PCM_RATE_KNOT;
}
EXPORT_SYMBOL(snd_pcm_rate_to_rate_bit);
--
Timur Tabi
Linux Kernel Developer @ Freescale
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-10-02 16:50 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-28 21:14 ASOC: Best way to get private data from machine driver to the other drivers? Timur Tabi
2007-10-01 10:53 ` Liam Girdwood
2007-10-01 20:10 ` Timur Tabi
2007-10-02 16:40 ` Liam Girdwood
2007-10-02 16:49 ` Timur Tabi
2007-10-02 16:50 ` Timur Tabi
2007-10-01 21:49 ` Timur Tabi
2007-10-02 16:37 ` Liam Girdwood
2007-10-02 16:48 ` Timur Tabi
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.