All of lore.kernel.org
 help / color / mirror / Atom feed
* How to use soc API without codec driver
@ 2009-12-08 14:46 Marc Garnier
  2009-12-08 14:51 ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Garnier @ 2009-12-08 14:46 UTC (permalink / raw)
  To: alsa-devel

Hi,

I need to receive and transmit PCM data through SSC port of a sam9261 to 
a device which doesn't have any kind of I/O controls (neither i2c nor 
spi). So, I wonder how to deal with the codec driver side.
Someone could explain me what are the minimum requirements to write a 
Asoc driver of this kind?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use soc API without codec driver
  2009-12-08 14:46 How to use soc API without codec driver Marc Garnier
@ 2009-12-08 14:51 ` Mark Brown
  2009-12-09  6:39   ` Marc Garnier
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2009-12-08 14:51 UTC (permalink / raw)
  To: Marc Garnier; +Cc: alsa-devel

On Tue, Dec 08, 2009 at 03:46:53PM +0100, Marc Garnier wrote:

> I need to receive and transmit PCM data through SSC port of a sam9261 to 
> a device which doesn't have any kind of I/O controls (neither i2c nor 
> spi). So, I wonder how to deal with the codec driver side.
> Someone could explain me what are the minimum requirements to write a 
> Asoc driver of this kind?

There's a couple of drivers for such CODECs in the tree already - have a
look at the wm8727 driver for one example.  You need to register at
least a DAI with whatever the capabilities of the hardware are and can
leave all the operations blank.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use soc API without codec driver
  2009-12-08 14:51 ` Mark Brown
@ 2009-12-09  6:39   ` Marc Garnier
  2009-12-09 10:45     ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Marc Garnier @ 2009-12-09  6:39 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel

You mean I just have to use snd_soc_register_dai()? Things like 
soc_init_card() and snd_soc_new_pcms() are not mandatory?
So, i think code like this one could be ok :

#define Q2686_RATES (SNDRV_PCM_RATE_8000_192000)

#define Q2686_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
    SNDRV_PCM_FMTBIT_S24_LE)

static struct snd_soc_dai_ops q2686_dai_ops = {
};

struct snd_soc_dai q2686_dai = {
    .name = "Q2686",
    .playback = {
        .stream_name = "Playback",
        .channels_min = 2,
        .channels_max = 2,
        .rates = Q2686_RATES,
        .formats = Q2686_FORMATS,
    },
    .capture = {
        .stream_name = "Capture",
        .channels_min = 2,
        .channels_max = 2,
        .rates = Q2686_RATES,
        .formats = Q2686_FORMATS,},
    .ops = &wm8728_dai_ops,
};
EXPORT_SYMBOL_GPL(q2686_dai);

static int __init q2686_modinit(void)
{
    return snd_soc_register_dai(&q2686_dai);
}
module_init(q2686_modinit);

static void __exit q2686_exit(void)
{
    snd_soc_unregister_dai(&q2686_dai);
}
module_exit(q2686_exit);

MODULE_DESCRIPTION("ASoC Q2686 driver");
MODULE_AUTHOR("Marc Garnier");
MODULE_LICENSE("GPL");

Mark Brown wrote:
> On Tue, Dec 08, 2009 at 03:46:53PM +0100, Marc Garnier wrote:
>
>   
>> I need to receive and transmit PCM data through SSC port of a sam9261 to 
>> a device which doesn't have any kind of I/O controls (neither i2c nor 
>> spi). So, I wonder how to deal with the codec driver side.
>> Someone could explain me what are the minimum requirements to write a 
>> Asoc driver of this kind?
>>     
>
> There's a couple of drivers for such CODECs in the tree already - have a
> look at the wm8727 driver for one example.  You need to register at
> least a DAI with whatever the capabilities of the hardware are and can
> leave all the operations blank.
>   

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: How to use soc API without codec driver
  2009-12-09  6:39   ` Marc Garnier
@ 2009-12-09 10:45     ` Mark Brown
       [not found]       ` <4B44617B.2030002@heig-vd.ch>
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2009-12-09 10:45 UTC (permalink / raw)
  To: Marc Garnier; +Cc: alsa-devel

On Wed, Dec 09, 2009 at 07:39:19AM +0100, Marc Garnier wrote:
> You mean I just have to use snd_soc_register_dai()? Things like  
> soc_init_card() and snd_soc_new_pcms() are not mandatory?

init_card() has been removed now, but new_pcms() is still required -
like I say, look at one of the existing drivers like the spdif
transciever driver for examples of drivers which do what you're trying
to do here.

> static int __init q2686_modinit(void)
> {
>    return snd_soc_register_dai(&q2686_dai);
> }
> module_init(q2686_modinit);

This should be done from a platform device, not from module init.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: capturing data from the microphone
       [not found]           ` <4B446974.1090205@heig-vd.ch>
@ 2010-01-06 11:39             ` Mark Brown
  2010-01-06 13:34               ` Riccardo Magliocchetti
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2010-01-06 11:39 UTC (permalink / raw)
  To: Marc Garnier; +Cc: Sedji Gaouaou, alsa-devel

On Wed, Jan 06, 2010 at 11:44:04AM +0100, Marc Garnier wrote:
> OK, well, I work on a custom device platform based on an Atmel
> at91sam9261. I wrote an alsa driver composed of 2 files

CCing in the list and Sedji, who wrote the driver.  Please also try
avoid top posting - Linux lists generally intersperse replies with the
relevant context from the original message since it makes mails much
more legible.

> But when I want to record a pcm stream I have this error:
> # arecord -v -c 1 -t wav -f S16_LE -r 8000 -d 10 input.wav
> arecord: pcm_read:1629: read error: Input/output error

[With an AT91 in slave mode...]
> and actually no interrupt occur and I
> wonder why...

Can you see clocks on the audio interface?  Have you checked that the
pins on the processor are configured to route the signals to the correct
IP block?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: capturing data from the microphone
  2010-01-06 11:39             ` capturing data from the microphone Mark Brown
@ 2010-01-06 13:34               ` Riccardo Magliocchetti
  0 siblings, 0 replies; 6+ messages in thread
From: Riccardo Magliocchetti @ 2010-01-06 13:34 UTC (permalink / raw)
  To: Marc Garnier; +Cc: alsa-devel

Marc,

Mark Brown ha scritto:
> On Wed, Jan 06, 2010 at 11:44:04AM +0100, Marc Garnier wrote:
>> OK, well, I work on a custom device platform based on an Atmel
>> at91sam9261. I wrote an alsa driver composed of 2 files
> 
> CCing in the list and Sedji, who wrote the driver.  Please also try
> avoid top posting - Linux lists generally intersperse replies with the
> relevant context from the original message since it makes mails much
> more legible.

The next time please also try to avoid hijacking other people's threads.

thanks,
riccardo

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-01-06 13:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-08 14:46 How to use soc API without codec driver Marc Garnier
2009-12-08 14:51 ` Mark Brown
2009-12-09  6:39   ` Marc Garnier
2009-12-09 10:45     ` Mark Brown
     [not found]       ` <4B44617B.2030002@heig-vd.ch>
     [not found]         ` <20100106103937.GA25344@rakim.wolfsonmicro.main>
     [not found]           ` <4B446974.1090205@heig-vd.ch>
2010-01-06 11:39             ` capturing data from the microphone Mark Brown
2010-01-06 13:34               ` Riccardo Magliocchetti

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.