alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Michele Curti <michele.curti@gmail.com>,
	Bard Liao <bardliao@realtek.com>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@alsa-project.org
Subject: Re: writing an alsa driver
Date: Wed, 27 May 2015 19:41:56 +0100	[thread overview]
Message-ID: <1432752116.8235.25.camel@loki> (raw)
In-Reply-To: <20150527085440.GA4445@dellaz>

+ Bard for the codec issues.

On Wed, 2015-05-27 at 10:54 +0200, Michele Curti wrote:
> On Wed, May 27, 2015 at 08:45:43AM +0200, Takashi Iwai wrote:
> > At Sat, 23 May 2015 18:32:51 +0200,
> > Michele Curti wrote:
> > > 
> > > On Thu, May 21, 2015 at 04:52:32PM +0200, Michele Curti wrote:
> > > > Hi all,
> > > > I'm going to *try* to "write" a driver for the sound card on my new laptop,
> > > > an asus x205ta.
> > > > 
> > > > To be fair I have almost no experience but I'm hoping that all the code is
> > > > already present and it only needs some adaptations.
> > > > 

I'd expect most of the code to be present, but it's likely some
integration is required for differences to HW/BIOS compared to the
driver development platform.

> > > > The cpu is a intel bay trail z3735f, the sound card is a realtek rt5648 that
> > > > has the same product Id of the rt5645 (0x6308).
> > > > 
> > > > I see in kernel sources:
> > > >  - the codec driver
> > > > 	sound/soc/codecs/rt5645.c
> > > >  - a baytrail board that uses the rt5640
> > > > 	sound/soc/intel/boards/byt-rt5640.c
> > > >  - a braswell board that uses the rt5645
> > > > 	sound/soc/intel/boards/cht_bsw_rt5645.c
> > > > 
> > > > What do you think?  Is it feasible, given a good amount of free-time? :p
> > > > 
> > > > Thanks,
> > > > Michele
> > > 
> > > 
> > > So I started.. :)
> > > At the end of the email there is the patch.
> > > 
> > > 
> > > What I did:
> > >   - copied the board file byt-rt5640.c to byt-rt5645.c
> > >   - find&replace 5640->5645 in byt-rt5645.c
> > >   - added acpi device id to detect the sound card
> > >   - added kernel config SND_SOC_INTEL_BYT_RT5645_MACH to select the driver
> > > 
> > > 
> > > Nothing works.
> > > 
> > > But at least the right modules are loaded it seems..  Here the output of 
> > > "lsmod | grep snd":
> > > snd_soc_sst_baytrail_pcm    24576  0 
> > > snd_soc_sst_ipc        16384  1 snd_soc_sst_baytrail_pcm
> > > snd_soc_sst_dsp        36864  2 snd_soc_sst_baytrail_pcm,snd_soc_sst_ipc
> > > snd_soc_sst_byt_rt5645_mach    16384  0 
> > > snd_soc_rt5645         94208  0 
> > > regmap_i2c             16384  1 snd_soc_rt5645
> > > snd_soc_rl6231         16384  1 snd_soc_rt5645
> > > snd_soc_core          159744  3 snd_soc_rt5645,snd_soc_sst_baytrail_pcm,snd_soc_sst_byt_rt5645_mach
> > > snd_compress           20480  1 snd_soc_core
> > > dw_dmac_core           28672  2 dw_dmac,snd_soc_sst_dsp
> > > snd_pcm                90112  3 snd_soc_rt5645,snd_soc_core,snd_soc_sst_baytrail_pcm
> > > snd_timer              28672  1 snd_pcm
> > > snd                    57344  4 snd_soc_core,snd_timer,snd_pcm,snd_compress
> > > soundcore              16384  1 snd
> > > snd_soc_sst_acpi       16384  0 
> > > 

OK, this means the audio DSP and codec devices are present in the BIOS.

> > > 
> > > And dmesg tells me: 
> > > [  +1.386847] rt5645 i2c-10EC5648:00: Failed to reguest IRQ: -22
> > > [  +0.000102] rt5645 i2c-10EC5648:00: Fail gpio_request hp_det_gpio
> > > [  +0.000094] rt5645 i2c-10EC5648:00: Fail gpio_direction hp_det_gpio

Looks like the codec has no platform data and is failing to get a valid
IRQ number. Do you know what IRQ the code is actually requesting as it
could be bogus ?

> > > [  +0.088989] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.062539] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.021995] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.001828] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.016646] i2c_hid i2c-PDEC3393:00: error in i2c_hid_init_report size:7 / ret_size:4
> > > [  +0.002541] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.004755] brcmfmac: brcmf_sdio_drivestrengthinit: No SDIO Drive strength init done for chip 43340 rev 2 pmurev 20
> > > [  +0.003586] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.002844] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.001705] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.011199] i2c_hid i2c-PDEC3393:00: error in i2c_hid_init_report size:19 / ret_size:4
> > > [  +0.018094] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.067913] i2c_hid i2c-ELAN0100:00: error in i2c_hid_init_report size:633 / ret_size:7
> > > [  +0.004378] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.000145] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.000980] i2c_hid i2c-ELAN0100:00: error in i2c_hid_init_report size:131 / ret_size:7
> > > [  +0.000949] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.020845] (NULL device *): ipc: error DSP boot timeout

Ok, this means the ADSP FW has been loaded but has failed to boot for
some reason. Can you switch on driver dev_dbg() output.

> > > [  +0.213465] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.036706] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +0.008144] byt-rt5645 byt-rt5645: ASoC: CPU DAI baytrail-pcm-audio not registered
> > > [  +1.811435] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: Jun 17 2014 11:48:43 version 6.10.190.49 (r485840) FWID 01-8744bcd2
> > > [  +0.014526] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code
> > > [  +0.092535] brcmfmac: brcmf_add_if: ERROR: netdev:wlan0 already exists
> > > [  +0.000011] brcmfmac: brcmf_add_if: ignore IF event
> > > 
> > > 
> > > For now I'm at a standstill and I don't understand a lot of things...
> > > I will read the code.. :)
> > > 
> > > Regards,
> > > Michele
> > > 
> > > Signed-off-by: Michele Curti <michele.curti@gmail.com>
> > 
> > Keyon, could you take a look?
> > 
> > 
> > Takashi
> 
> Thank you!  In that patch I did a typo:
> 
> > > index 0000000..5bdb56e
> > > --- /dev/null
> > > +++ b/sound/soc/intel/boards/byt-rt5645.c
> > > @@ -0,0 +1,222 @@
> > > +/*
> [snip]
> > > +
> > > +static struct snd_soc_dai_link byt_rt5645_dais[] = {
> > > +	{
> > > +		.name = "Baytrail Audio",
> > > +		.stream_name = "Audio",
> > > +		.cpu_dai_name = "baytrail-pcm-audio",
> > > +		.codec_dai_name = "rt5645-aif1",
> > > +		.codec_name = "i2c-10EC56458:00",
> 
> here.  This must be "i2c-10EC5648:00", but errors remain the same...
> 
> The error
> > > [  +0.020845] (NULL device *): ipc: error DSP boot timeout
> made me think that I chose the wrong platform/machine because:
> - it is stange that device is NULL
> - it is strange that dsp doesn't work after loading the firmware.
> 

The NULL device is just a bug in the code. The device should be set
prior to any driver messages. 

> So instead of adapting the boards/byt-rt5640.c I tried to adapt
> boards/bytcr_rt5640.c that uses
>   .cpu_dai_name = "ssp2-port",
>   .platform_name = "sst-mfld-platform",
> 
> I got a "dummy sound card" but no hardware sound card..

There are 2 BYT DSP driver upstream, they are for different HW
configurations. Can you stick with boards/byt-rt5640.c for the moment
until we can debug further.

> 
> I remember that the errors
> > > [  +1.386847] rt5645 i2c-10EC5648:00: Failed to reguest IRQ: -22
> > > [  +0.000102] rt5645 i2c-10EC5648:00: Fail gpio_request hp_det_gpio
> > > [  +0.000094] rt5645 i2c-10EC5648:00: Fail gpio_direction hp_det_gpio
> remain.  Now I don't have access to the laptop, so I cannot post the new 
> errors that showed up, but if you want me to make some experiments, I'll 
> do :)
> 

Ok, lets get the dev_dbg() output enabled for sst-baytrail*.c and we can
take it from there.

Thanks

Liam

> Thanks,
> Michele
> 
> PS: for the dumb things that I write, forgive me :p
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2015-05-27 18:42 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 14:52 writing an alsa driver Michele Curti
2015-05-23 16:32 ` Michele Curti
2015-05-27  6:45   ` Takashi Iwai
2015-05-27  8:54     ` Michele Curti
2015-05-27 18:41       ` Liam Girdwood [this message]
2015-05-27 20:13         ` Michele Curti
2015-05-28 11:31           ` Liam Girdwood
2015-05-28 12:53             ` Michele Curti
2015-05-28 13:21               ` Liam Girdwood
2015-05-28 19:17                 ` Michele Curti
2015-05-29  9:42                   ` Liam Girdwood
2015-05-29 13:17                     ` Michele Curti
2015-06-01 11:06                       ` Liam Girdwood
2015-06-04  7:09                         ` Marcus Bannerman
2015-06-04  9:04                           ` Michele Curti
2015-06-04  8:59                         ` Michele Curti
2015-06-04 10:33                           ` Liam Girdwood
2015-06-04 17:44                             ` Juergen Bausa
2015-06-04 19:39                         ` Michele Curti
2015-06-05  7:00                           ` Jarkko Nikula
2015-06-08  8:26                             ` Michele Curti
2015-06-08  8:49                         ` Michele Curti
2015-06-13 13:47                           ` Luka Karinja
2015-06-15 16:46                             ` Michele Curti
2015-06-15 17:04                               ` Liam Girdwood
2015-06-16 20:50                                 ` Michele Curti
2015-06-17  9:16                                   ` Liam Girdwood
2015-06-17 21:34                                     ` Michele Curti
2015-06-18 11:14                                       ` Vinod Koul
2015-06-18 18:47                                         ` Michele Curti
2015-06-19  7:54                                           ` Vinod Koul
2015-06-19  8:12                                             ` Michele Curti
2015-06-17  6:39                                 ` Jarkko Nikula
2015-06-23  9:09                                 ` Michele Curti
2015-06-23  9:51                                   ` Liam Girdwood
2015-06-24 10:21                                   ` Vinod Koul
2015-06-24 11:31                                     ` Antonio Ospite
2015-06-24 11:40                                       ` Liam Girdwood
2015-06-24 16:04                                         ` Vinod Koul
2015-06-24 18:21                                     ` Michele Curti
2015-06-25  3:24                                       ` Vinod Koul
2015-06-25  7:39                                         ` Michele Curti
2016-03-03 11:11                                         ` Michele Curti
2016-03-03 11:27                                           ` Vinod Koul
2016-03-03 13:08                                             ` Michele Curti
2016-03-03 16:20                                             ` Pierre-Louis Bossart
2016-03-04 11:07                                               ` Michele Curti
  -- strict thread matches above, loose matches on Subject: below --
2015-07-22 20:05 Marco Bodega
2015-07-24 20:54 ` Michele Curti
2015-08-10 14:12 Johnny

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=1432752116.8235.25.camel@loki \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bardliao@realtek.com \
    --cc=michele.curti@gmail.com \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).