Skip to content

Conversation

@plbossart
Copy link
Member

@plbossart plbossart commented Jan 4, 2020

before we even look at SOF support on Broadwell, the current mailine code is broken with the legacy driver (w/ legacy BIOS and Ubuntu installed with chrx)

I was able to restore functionality with the patches in this PR, but there's clearly a problem registering the SPI component.

Without the last patch which essentially removes the SPI/Hotword support, I see errors such as

[   73.454937] bdw-rt5677 bdw-rt5677: ASoC: no sink widget found for DSP Capture
[   73.454940] bdw-rt5677 bdw-rt5677: ASoC: Failed to add route DSP Buffer -> direct -> DSP Capture
[   21.791961] bdw-rt5677 bdw-rt5677: ASoC: CPU DAI spi-RT5677AA:00 not registered
[   15.467040] bdw-rt5677 bdw-rt5677: snd_soc_add_dai_link start
[   15.467042] bdw-rt5677 bdw-rt5677: ASoC: binding System PCM
[   15.467044] bdw-rt5677 bdw-rt5677: ASoC: sanity check done System PCM
[   15.467057] bdw-rt5677 bdw-rt5677: snd_soc_add_dai_link end
[   15.467058] bdw-rt5677 bdw-rt5677: snd_soc_add_dai_link start
[   15.467059] bdw-rt5677 bdw-rt5677: ASoC: binding Codec DSP
[   15.467061] bdw-rt5677 bdw-rt5677: ASoC: platform component spi-RT5677AA:00 not found for Codec DSP
[   15.467064] bdw-rt5677 bdw-rt5677: ASoC: sanity check failed Codec DSP, ret -517

@cujomalainey what is needed to probe this SPI thingy? Could this be a legacy BIOS issue?

@xiulipan @fredoh9 @ranj063 FYI.

@plbossart plbossart requested a review from lgirdwood as a code owner January 4, 2020 02:15
@cujomalainey
Copy link

@plbossart I cc'ed you on a patch a few hours ago to alsa that should fix the issue with regards to the SPI links.

@plbossart
Copy link
Member Author

@plbossart I cc'ed you on a patch a few hours ago to alsa that should fix the issue with regards to the SPI links.

The patch doesn't help, I have the Kconfig selected but somehow the SPI probe fails. There is something missing either in my configuration or the SPI probe stuff.

This is with the seabios/legacy mode installed with chrx.

[   19.365810] bdw-rt5677 bdw-rt5677: bdw_rt5677_probe entry
[   19.365814] bdw-rt5677 bdw-rt5677: bdw_rt5677_probe end
[   19.365817] bdw-rt5677 bdw-rt5677: snd_soc_add_dai_link start
[   19.365818] bdw-rt5677 bdw-rt5677: ASoC: binding System PCM
[   19.365820] bdw-rt5677 bdw-rt5677: ASoC: sanity check done System PCM
[   19.365833] bdw-rt5677 bdw-rt5677: snd_soc_add_dai_link end
[   19.365834] bdw-rt5677 bdw-rt5677: snd_soc_add_dai_link start
[   19.365836] bdw-rt5677 bdw-rt5677: ASoC: binding Codec DSP
[   19.365837] bdw-rt5677 bdw-rt5677: ASoC: platform component spi-RT5677AA:00 not found for Codec DSP
[   19.365839] bdw-rt5677 bdw-rt5677: ASoC: sanity check failed Codec DSP, ret -517

@cujomalainey
Copy link

Is your bios defining the SPI port? ID RT5677AA?

@plbossart
Copy link
Member Author

Is your bios defining the SPI port? ID RT5677AA?

Yes it's defined in the DSDT and I just checked it's copy/pasted from the Coreboot parts.
I must be missing a CONFIG, likely for the SPI controller. We don't have any dependency for SPI as we do for I2C_DESIGNWARE, so something must be missing.

@cujomalainey
Copy link

cujomalainey commented Jan 6, 2020

Looks related to ID INT3430 which is found in these drivers, which reminds me of when I had to fix the bug in the spi bus after suspend/resume issues.

drivers/acpi/acpi_lpss.c
drivers/spi/spi-pxa2xx.c

@plbossart
Copy link
Member Author

Looks related to ID INT3430 which is found in these drivers, which reminds me of when I had to fix the bug in the spi bus after suspend/resume issues.

drivers/acpi/acpi_lpss.c
drivers/spi/spi-pxa2xx.c

I got it, it's indeed a miss with the SPI_MASTER and SPI_PXA2XX dependencies not modeled. Fixed now with the update.

@plbossart
Copy link
Member Author

well not quite, I saw one error with DMAs now:

[   53.154287] haswell-pcm-audio haswell-pcm-audio: initialising Audio DSP IPC
[   53.154302] haswell-pcm-audio haswell-pcm-audio: initialising audio DSP id 0x3438
[   53.164474] haswell-pcm-audio haswell-pcm-audio: error: DMA device register failed
[   53.164478] haswell-pcm-audio haswell-pcm-audio: sst_dma_new failed -22
[   53.165332] bdw-rt5677 bdw-rt5677: bdw_rt5677_probe entry
[   53.165335] bdw-rt5677 bdw-rt5677: bdw_rt5677_probe end
[   53.165338] bdw-rt5677 bdw-rt5677: snd_soc_add_dai_link start
[   53.165340] bdw-rt5677 bdw-rt5677: ASoC: binding System PCM
[   53.165342] bdw-rt5677 bdw-rt5677: ASoC: platform component haswell-pcm-audio not found for System PCM
[   53.165344] bdw-rt5677 bdw-rt5677: ASoC: sanity check failed System PCM, ret -517
ro

@cujomalainey this reminds me of an error reported by others on the Chrome team?

@cujomalainey
Copy link

cujomalainey commented Jan 6, 2020

Ah yes I remember those errors with the uprev team. That appears to be slightly different iirc. It was a transient failure on samus, it was on buddy that it was consistent. Does rebooting solve it? Also the only solution to date afaik is still to revert that really old sst D3 crash prevention patch.

@plbossart
Copy link
Member Author

Ah yes I remember those errors with the uprev team. That appears to be slightly different iirc. It was a transient failure on samus, it was on buddy that it was consistent. Does rebooting solve it? Also the only solution to date afaik is still to revert that really old sst D3 crash prevention patch.

I can't reproduce it so far on Samus after rebooting so it does look like a transient. I guess now that I've seen it I would be more inclined to revert this code that no one is able to explain anyways.

@cujomalainey
Copy link

Looked up the old bug, that actually is the exact error message we were seeing on samus, so that is definitely the bug

The existing machine driver depends on SPI Master capabilities, but
the Kconfig does not model this dependency and the SPI controller
needs to be selected as well.

Without this patch the machine driver probe would fail with the
spi-RT5677AA:00 component never registered by the ACPI/LPSS subsystem.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The legacy driver uses dummy cpu_dai and platform, SOF requires actual
values to bind.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@plbossart plbossart changed the title [TEST] Fix bdw rt5677 in legacy mode Enable SOF on Broadwell/Samus (bdw-rt5677) Jan 6, 2020
@plbossart
Copy link
Member Author

@cujomalainey @fredoh9 @xiulipan with these patches I get nice sound on Samus :-)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart are you possibly missing the virtual widgets for the other three "AIF1 Capture", "AIF1 Playback" and "DSP Buffer"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AIF1 playback/capture are on the codec side, so are defined by the codec driver.

I have no idea what the 'DSP Buffer' is

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DSP Buffer is for the codecs internal DSP power graph.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart That was strange, I redo the test without this patch on samus with the latest tplg from https://github.com/thesofproject/sof/blob/c68605403c52ac43ac1b97dec780b9407026ec7f/tools/topology/sof-bdw-codec.m4 and it works without error.

dnl CODEC is defined and will be expanded, need to undefine it before use
undefine(`CODEC')
VIRTUAL_WIDGET(SSP0 CODEC OUT, output, 0)
VIRTUAL_WIDGET(SSP0 CODEC IN, input, 1)
VIRTUAL_WIDGET(DSP Capture, input, 2)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiulipan thanks for testing, indeed this is not needed, I was using an old topology file :-(

Fixed now

@plbossart
Copy link
Member Author

Instructions to reproduce my setup:

For now playback works fine in PulseAudio with jack detection and switching between speakers and headphones.

I haven't tested the capture at all.

@plbossart
Copy link
Member Author

bdw-rt5677

@plbossart
Copy link
Member Author

@cujomalainey @juimonen can you take a look at the UCM file at https://github.com/plbossart/UCM/tree/master/sof-bdw-rt5677?

I can get capture to work fine but the switch between internal mic and headset mic is not automatic. I wonder if this is supported by PulseAudio or if there is a way to express an action to be taken on headset plug? Thanks!

@cujomalainey
Copy link

evtest reports the jack name as "bdw-rt5677 Mic Jack" try changing that

@plbossart
Copy link
Member Author

evtest reports the jack name as "bdw-rt5677 Mic Jack" try changing that

doesn't help. evtest does dectest sof-bdw-rt5677 Headphone and Mic Jack, but if I use 'JackControl "sdw-bdw-rt5677 Headphone Jack"' then the automatic switch is broken for playback, and the value of the string has no impact for capture. Must be a PulseAudio restriction maybe?

@cujomalainey
Copy link

is the jack being detected in amixer? if it is then I would leave it with pulse

@xiulipan
Copy link

xiulipan commented Jan 7, 2020

@plbossart I will update #1484 to cover only sound/soc/intel/boards/broadwell.c with the same change style here.

lgirdwood
lgirdwood previously approved these changes Jan 7, 2020
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've no other comments to add other than those already discussed. I'm assuming this works for XPS13 too ?

@plbossart
Copy link
Member Author

I think we are good to merge, the only issues I see for now are

  1. left/right inversion. This could be an SSP issue or a codec issue.
  2. headset automatic detection in PulseAudio

Considering that Samus never worked before, this is small potatoes to fix.

@lgirdwood
Copy link
Member

I think we are good to merge, the only issues I see for now are

Ack

  1. left/right inversion. This could be an SSP issue or a codec issue.

I'm assuming this is consistent rather than random ?

Fwiw, could be the FRAME_POLARITY logic needs negated, I do remeber running into this in the last few years but I cant remember the platform.

@plbossart
Copy link
Member Author

  1. left/right inversion. This could be an SSP issue or a codec issue.

I'm assuming this is consistent rather than random ?

yes, it's not the result of an underflow, I have a consistent inversion both on speakers and headphones.

But I am not 100% it's firmware, the UCM file I took from Chrome folks has weird settings such as

		cset "name='Stereo DAC MIXL ST L Switch' off"
		cset "name='Stereo DAC MIXL DAC1 L Switch' off"
		cset "name='Stereo DAC MIXL DAC2 L Switch' off"
		cset "name='Stereo DAC MIXL DAC1 R Switch' on" <<< ???

		cset "name='Stereo DAC MIXR ST R Switch' off"
		cset "name='Stereo DAC MIXR DAC1 R Switch' off"
		cset "name='Stereo DAC MIXR DAC2 R Switch' off"
		cset "name='Stereo DAC MIXR DAC1 L Switch' on" <<<???

Fwiw, could be the FRAME_POLARITY logic needs negated, I do remeber running into this in the last few years but I cant remember the platform.

yes, that'd be my next check. I have a Samus device wired with the SSP pins blue-wired so I'll try to capture the signals with my LogicPro when I have a bit of time.

@plbossart plbossart merged commit 8d23d03 into thesofproject:topic/sof-dev Jan 7, 2020
DAILINK_COMP_ARRAY(COMP_CPU("ssp0-port")));
#else
SND_SOC_DAILINK_DEF(ssp0_port,
DAILINK_COMP_ARRAY(COMP_DUMMY())));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One too many brackets there. Fails to compile

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xiulipan @fredoh9 I thought we compiled in SST mode? We have a kconfig-sst.sh, isn't this used?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants