-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linux: add SOF nocodec mode #112
Conversation
@andy-shev @htot I have no idea if this is the 'right' way to fix this, when I compile this somehow my changes are not taken into account. the main error I see is with this code: /* find machine */
snd_sof_machine_select(sdev);
if (sof_pdata->machine) {
snd_sof_set_mach_params(sof_pdata->machine, sdev->dev);
return 0;
}
#if !IS_ENABLED(CONFIG_SND_SOC_SOF_NOCODEC)
dev_err(sdev->dev, "error: no matching ASoC machine driver found - aborting probe\n");
return -ENODEV;
#endif
#if IS_ENABLED(CONFIG_SND_SOC_SOF_FORCE_NOCODEC_MODE)
nocodec: We really need to define NOCODEC or the driver assumes there's an ACPI codec configuration issue - which is correct for Edison by default there is no codec connected |
It should be right, by I have struggled in the past too. Instructions are here. When your done, don't forget to clean up. Anyway I'll try this and otherwise try to generate the fragment myself. Thanks! |
never mind, I forgot CONFIG_EXPERT=y is required. re-checking now |
There is quite a bit turned on by default (by Andy's kernel). When I go into menuconfig and turn additional on as you suggest and off what I think is not needed the following fragment is generated:
|
yep, this works now: And after adding the firmware I can see the data being consumed at the right pace:
|
The nocodec mode is required if there is no ACPI codec HID, otherwise the kernel will throw an error such as [ 9.612127] sof-audio-pci 0000:00:0d.0: error: no matching ASoC machine driver found - aborting probe [ 9.621634] sof-audio-pci 0000:00:0d.0: error: failed to get machine info -19 [ 9.629027] sof-audio-pci 0000:00:0d.0: error: failed to probe DSP hardware! Note that /lib/firmware/intel/sof/sof-byt.ri and /lib/firmware/intel/sof-tplg/sof-byt.tplg files need to be present for the probe to succeed, the nocodec mode depends on them Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
a759785
to
12c1fa8
Compare
@htot @andy-shev updated the fragment, with the attached file unzipped to /lib/firmware/intel an audio card is created. Now we need to configure the SSP2 pins to see if there's actually data coming out :-) |
Thank you for very good news! I have just sent you various instructions how it can be achieved. Additional Qs, though: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
I was just reading all this and it's a bit beyond my reach and workload...
the plan was initially to push SOF firmware through the linux-firmware tree, but then Jaroslav objected that some of the topology and utilities don't belong there so we created a separate repo. https://github.com/thesofproject/sof-bin/tree/stable-v1.5/ we will need to figure out how we propagate the firmware into a Yocto or Buildroot image. For Edison you only need /lib/firmware/intel/sof/sof-byt.ri and /lib/firmware/intel/sof-tplg/sof-byt.tplg files. if you have any suggestions we are all ears.
If you have an I2C codec HID already and probe it sucessfully, then all we need is an entry in a table, as e.g. done here: For simple drivers this can be as simple as: {
.id = "1AEC8804",
.drv_name = "sof-wm8804",
.sof_fw_filename = "sof-apl.ri",
.sof_tplg_filename = "sof-apl-wm8804.tplg",
}, and the matching ASL snippet is at https://github.com/thesofproject/acpi-scripts/blob/master/Up2/WM8804.asl |
I can help with a HACK approach, but I also need a bit of time to find.
There are no such files. I see sof-byt-v1.5.ri and sof-byt-nocodec.tplg. That's what you meant?
Easiest way is to provide BuildRoot package. At least for my development.
A-ha! Thanks for the pointers! I'll look at them when will have time for SOF. |
yes, I want to grab the SSP signals with a LogicPro analyzer and check the waveforms are correct. I have some doubts since the registers should be different from Baytrail to configure the SSP root frequency.
yes, sorry. what you found was their names in the repo, and what I listed is the target names so that the kernel finds them.
I started with Yocto, last year I think I was successful with BuildRoot but I forgot absolutely everything. The ClearLinux folks used a Makefile, I need to ask Auke again if he's got something turn-key. |
I'm trying to figure out what we can do new with this? Sorry, new to playing sound with edison. We have
Do I understand correctly: we need to modify kernel to tell which firmware files to use, or that is only for new drivers? I had a look in For now I can write a simple recipe to clone sof-bin repo and take sof-byt-v1.5.ri and sof-byt-nocodec.tplg and install using the target names. Is that correct? |
The drivers know what firmware then needed, they all use request_firmware(name). What you need is a similar recipe for the SOF firmware + topology (the topology did not exist back in the 2015 days).
For the nocodec case, it's taken from sound/soc/sof/sof-pci-dev.c. The soc-acpi*-match.c files are only used if there is a codec HID in the ACPI tables.
Yep. I don't know if you can fetch it from sof-bin directly, that would help change versions with just a variable name. |
What I did for now is PR #113 As is we need to add firmwares 1 by 1 and rename as fit. Maybe not to bad, as we also need to bring in acpi table for each. I built this, but haven't tested yet (that will be tomorrow). |
Found a type in my PR, fixed it. So now I have:
and
So, without any ADC connected to Edison, can I play sound? I the past it was supported of usb or bluetooth (doc). |
No. For now all you can do is configure the SSP pins, possibly I2C as well, and connect a DAC board. |
Oh, that's too bad. I got the idea from the dumbed down block diagram form the Edison Audio Setup guide: @andy-shev Where do you want to go from here? |
@htot yes if we can connect SSP2 using SSP1 is no issue for SOF, the main issue is how to set-up BlueZ and all the stacks, that's a bit beyond my area of expertise. My short-term plan was to try and turn on the SSP2 pins with custom debugfs commands. I'd like to verify that all the patterns are fine (possible clock issue I'd like to rule-out). I tried to update some patches @andy-shev pointed me to, wondering if this is indeed the right direction. |
Bluez is already setup, so maybe we are not far from the target. |
Merged as part of PR #113 thanks |
@plbossart I run speaker test with oscilloscope connected and see 96.15 kHz output on the pins. Clock of I²S seems 2.4 MHz. UPDATE: 96.15 kHz is the frequency of the first two pulses from speaker-test output. So, it varies depends on the sample I have got. |
maybe try 'speaker-test -Dhw:0,0 -c2 -r48000' you should see the fsync with a 48kHz frequency as well? |
I already returned oscilloscope to the lab. Sorry, can't test it in nearest future (the oscilloscope is used by others as well). |
That's why I have my own LogicPro8. USB puck the size of half a credit card, it shows me all audio/I2C patterns. best toy ever and well worth the money. I'll take this for a spin, do I get this right that if I take all the latest code from the yocto recipes things should just work? |
We are not yet loading the acpi table that @andy-shev created for this. You might want to try the |
wow, I had no idea all of this even existing. Given my bandwidth, it's unlikely I'll find the time to look into this... Oh well. |
Or we just configure meta-intel-edison to build and load it for you from the initramfs. I could make a branch for you? |
that would be wonderful :-) |
Ah wait, I see it has even been made easier for us by @andy-shev arduino-audio-no-codec.asl has only a define
and includes
@andy-shev is it correct that I don't need to update kernel right now, as we already have enabled sof through the 5.6.0 kernel recipe? BTW I have an oscilloscope right here. How would you like me to test? |
@htot, if you have correct firmware and driver available, yes, nothing is needed on top. |
Where can I find |
It's a part of alsa-utils or so. https://alsa.opensrc.org/Speaker-test |
@plbossart please checkout PR #115 |
This is needed if there is no ACPI codec HID
Signed-off-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com