Skip to content

Conversation

@plbossart
Copy link
Member

This PR builds on previous contributions from @bardliao (PR #2936) and @brentlu (PR ##2951)

We also build on previous work from @juimonen for the multi-ssp config where we send a DAI_CONFIG IPC in the hw_params and hw_free stages. Currently we send the same information in the two cases, so the firmware cannot take any action wrt. early clock enablement. Adding a flag is enough to provide the firmware with the information missing.

This is tagged as an ABI 3.18 change.

@plbossart plbossart requested review from kv2019i and lyakh June 3, 2021 16:23
@plbossart plbossart added ABI involves ABI changes, need extra attention ADL Applies to Alder Lake platform APL Applies to ApolloLake platform CFL Applies to Coffee Lake platform CML Applies to Comet Lake platform CNL Applies to Cannonlake EHL Applies to Elkhart Lake GLK Applies to Gemini Lake ICL Applies to Icelake platform JSL Jasper Lake platform issues RKL Applies to Rocket Lake platform TGL Applies to Tiger Lake platform WHL Applies to WhiskeyLake platform labels Jun 3, 2021
ranj063
ranj063 previously approved these changes Jun 3, 2021
Copy link
Collaborator

@ranj063 ranj063 left a comment

Choose a reason for hiding this comment

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

looks good @plbossart. you have a typo on "botht" in the second patch's commit message

@plbossart
Copy link
Member Author

looks good @plbossart. you have a typo on "botht" in the second patch's commit message

thanks, fixed now

@plbossart plbossart requested review from brentlu and ranj063 June 3, 2021 16:40
@kv2019i kv2019i dismissed their stale review June 8, 2021 12:14

I don't want my minor comment to block the PR

@plbossart plbossart force-pushed the fix/ssp-dai-config branch from 1aaa70d to c4a3cf2 Compare June 8, 2021 22:38
@plbossart
Copy link
Member Author

plbossart commented Jun 8, 2021

@lyakh @kv2019i @ranj063 @bardliao @brentlu @RanderWang I pushed a small update just to see if you guys are happy with the mask and flag definitions. only compile-tested. If you are ok I'll do more tests and update the firmware part. Thanks!

@ranj063
Copy link
Collaborator

ranj063 commented Jun 9, 2021

@lyakh @kv2019i @ranj063 @bardliao @brentlu @RanderWang I pushed a small update just to see if you guys are happy with the mask and flag definitions. only compile-tested. If you are ok I'll do more tests and update the firmware part. Thanks!

I'm good with the change @plbossart

@lyakh lyakh self-requested a review June 11, 2021 05:56
plbossart and others added 5 commits June 14, 2021 13:39
This was added in ABI 3.17 but never added to the kernel tree. The
group_id is not currently used but this patch is required before
additional changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
If a system suspend happens (e.g. with rtcwake in tests) while
playback/capture is on-going, the hw_params step is not invoked on
resume.

Other dais such as HDA and ALH/SoundWire use both the .hw_params and
the .prepare stage, but in the latter case use a state variable to
detect the difference between underflows and resume operations due to
restrictions on programming sequences.

For the SSP it's fine to only do the configuration in the .prepare
step.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Mirror changes done in SOF tree. The changes do not rely on
BIT/GENMASK on purpose to keep the structure and flags common with the
firmware tree.

The DAI_CONFIG IPC is currently used in multiple ways. It is sent to
the DSP firmware when enabling static or dynamic pipelines, in
hw_params or prepare callbacks for Intel SSP, HDaudio and ALH, on
trigger_stop and hw_free.

This IPC has been abused a bit in the past, i.e. the values used for
some of the DAI-specific fields are used to either allocate or free
resources. Two typical examples are Intel HDaudio and SoundWire/ALH
DAIs, where using a zero DMA channel number or stream tag signals to
the firmware the DMA channels or tags allocated earlier can be freed.

Rather than add a new IPC for 'hw_params' and 'hw_free', this patch
suggests supporting a 2-bit value conveying the 'stage' information in
an existing IPC structure. Only 3 possible values are used.

The mapping between HW_PARAMS and HW_FREE flags and ALSA definitions
is not strictly 1:1, e.g. in some cases the HW_PARAM flag might be set
during the .prepare callback, while the HW_FREE might be sent during the
ALSA .trigger for stop/suspend.

The semantics of the flags is to reserve and start/stop all needed
resources, typically hardware related such as DMAs or clocks, when the
HW_PARAMS is set, while the HW_FREE flag allows the firmware to
release the resources allocated. The data transfers are still
controlled within the firmware through the propagation of the trigger
command.

The driver can then pass information that the DAI_CONFIG was invoked
in e.g. a pipeline/DAI setup, hw_params or hw_free stage without
having to use a special DAI-specific encoding. Unfortunately we can't
remove old encodings due to backwards-compatibility requirements but
for new cases, such as the SSP in follow-up patches, we can make the
IPC less cryptic.

This change is tagged as ABI 3.19 and is completely backwards compatible.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The DAI_CONFIG is used for both hw_params and hw_free. Use flags to
specify what stage the configuration applies to.

the DAI_CONFIG IPC may be sent also during the widget setup so each
flag is cleared after the IPC to restore the state.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Add two clks_control bits. MCLK and/or BCLK will start during hw_params
and stop during hw_free if the corresponding bit is set.

While the kernel does not do anything with these bitfields, this is
also tagged as part of the ABI 3.19 changes.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
@plbossart plbossart force-pushed the fix/ssp-dai-config branch from c4a3cf2 to a518c19 Compare June 14, 2021 20:10
@plbossart plbossart requested a review from lgirdwood as a code owner June 14, 2021 20:10
@plbossart
Copy link
Member Author

All comments addressed for firmware #4288 and kernel #2965

@plbossart
Copy link
Member Author

Merging, there are only minor fixes needed for the firmware side.

@plbossart plbossart merged commit f23f72d into thesofproject:topic/sof-dev Jun 15, 2021
@keyonjie
Copy link

@plbossart @bardliao @brentlu looks the merging of this introduces issue at SSP ports and the xrun issue (thesofproject/sof#3953) happen again, is this expected without the FW PR and theoretically will the issue be fixed once the FW PR get merged?

@brentlu
Copy link

brentlu commented Jun 16, 2021

there are two changes to SSP DAIs only:

  1. the set_config command sent in hw_params() moved to prepare()
  2. a reserved variable is repurposed to carry flag to FW

Is there FW log or dmesg log captured?

@bardliao
Copy link
Collaborator

@plbossart @bardliao @brentlu looks the merging of this introduces issue at SSP ports and the xrun issue (thesofproject/sof#3953) happen again, is this expected without the FW PR and theoretically will the issue be fixed once the FW PR get merged?

No, I didn't expect the PR (without the FW PR merged) will lead to the xrun issue. On the other hand, I don't expect the corresponding FW PR can fix the xrun issue.

@plbossart
Copy link
Member Author

What issue are you referring to @keyonjie?

TGL_NOCODEC has an IPC issue, not an xrun.

test 4645 TGLU_RVP_NOCODEC check-playback-50rounds

[ 2470.317120] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx: 0x60050000: GLB_STREAM_MSG: TRIG_STOP
[ 2470.820686] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: ipc timed out for 0x60050000 size 12
[ 2470.820701] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: info: preventing DSP entering D3 state to preserve context
[ 2470.820709] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: status: fw entered - code 00000005
[ 2470.820824] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: unexpected fault 0x00000000 trace 0x00004000
[ 2470.820841] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: hda irq intsts 0x00000000 intlctl 0xc0000081 rirb 00
[ 2470.820847] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: dsp irq ppsts 0x00000000 adspis 0x00000000
[ 2470.820856] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: host status 0x00000000 dsp status 0x00000000 mask 0x00000003
[ 2470.820861] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: waking up any trace sleepers
[ 2470.820881] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: FW Poll Status: reg[0x160]=0x140000 successful
[ 2470.820886] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: trace IO error
[ 2470.820893] kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at soc_component_trigger on 0000:00:1f.3: -110

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

Labels

ABI involves ABI changes, need extra attention ADL Applies to Alder Lake platform APL Applies to ApolloLake platform CFL Applies to Coffee Lake platform CML Applies to Comet Lake platform CNL Applies to Cannonlake EHL Applies to Elkhart Lake GLK Applies to Gemini Lake ICL Applies to Icelake platform JSL Jasper Lake platform issues RKL Applies to Rocket Lake platform TGL Applies to Tiger Lake platform WHL Applies to WhiskeyLake platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants