Skip to content

Conversation

@plbossart
Copy link
Member

@plbossart plbossart commented Jan 26, 2023

The LunarLake hardware moved a set of DMIC/SSP/SoundWire registers in the HDaudio multi-link areas. This PR adds a set of helpers to configure the DMIC/SSP/SoundWire. In the case of SoundWire, the configurations will be made both from the sound/soc/sof/intel and drivers/soundwire/intel locations, so the hda-mlink is now a separate module to avoid circular dependencies.

The actual use of these helpers will be provided when this PR #4158 and PR #4157 are merged. There will be cross-dependencies between ALSA, ASoC and SoundWire so we have to progress in steps.

One possible pushback is that this adds yet another layer on top of hdac_link and hdac_ext_link. That's a valid point. The reason why this was added as a separate extension is that we don't have the ability to validate the Skylake and AVS drivers, and there's no reason why these drivers would need to know about a hardware extension added 8 years after the introduction of SKL/KBL.

One could also argue that this extension is not SOF-specific. That's correct from a hardware perspective, however since there are no other users it's not clear where else than sound/soc/sof/intel this module should be located.

@tiwai FYI

@plbossart
Copy link
Member Author

2 checkpatch warnings missed, oops. fixed now.

@plbossart
Copy link
Member Author

@ujfalusi @RanderWang @ranj063 @bardliao can you please look into this PR? it's rather important and gates the rest of the SoundWire patches.

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 great. just minor comments

@plbossart
Copy link
Member Author

v2: addressed comments, moved interrupt code in hdaml section.
Still to be done; revisit what the sleep and retry times should be with hardware team.

@plbossart plbossart force-pushed the hdaudio/extended-multi-link branch from 442f1f3 to db258a6 Compare February 9, 2023 19:28
bardliao
bardliao previously approved these changes Feb 10, 2023
RanderWang
RanderWang previously approved these changes Feb 10, 2023
@plbossart plbossart dismissed stale reviews from RanderWang and bardliao via df257de February 10, 2023 23:23
@plbossart plbossart force-pushed the hdaudio/extended-multi-link branch from db258a6 to df257de Compare February 10, 2023 23:23
@plbossart
Copy link
Member Author

v3: modified hardware poll delay to 10us and max 1ms

@plbossart plbossart requested a review from bardliao February 10, 2023 23:24
These helpers configure the ratio between the base clock and the
hardware signal used for link synchronization.

The SYNCPRD is written before the first sublink is powered-up. The
SYNCPU bit is set, but it will only be cleared after the link is
powered-up, hence the implementation with a set/wait pattern.

These helpers are currently only needed by SoundWire support, where
the lock is taken at a higher level, so only the _unlocked versions
are exposed for now.

Note that the _wait_bit() implementation is similar to previous
helpers in drivers/soundwire, but with sleep duration and timeout
aligned with hardware recommendations. If desired, this helper could
be modified in a second step with e.g. readl_poll_timeout().

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
The multi-link synchronization uses the same concept and registers,
but moved to the HDAudio extended links.

Add helpers for sync_arm and sync_go which are the basic for the bus
reset, bank switch and clock stop.

Since SoundWire is the only user of those helpers, only expose the
_unlocked versions for now.

Note that SYNCGO is a write-only bit, so no error can be reported. We
still return 0 for compatibility with the SoundWire stream management
headers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
This helper is an optimization where sync_go is only called when the
cmdsync field is actually set to a non-zero value.

Since this is also only used by SoundWire for now, only expose the
_unlocked version.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Each SoundWire peripheral can be programmed from the manager side
either with a regular command FIFO, or with the HDaudio CORB/RIRB
DMA-based mechanism. The mapping between SoundWire peripheral and SDI
address is handled with the LSDIID register.

This mapping only works of course if each peripheral has a unique
address across all links. This has already been enforced in previous
Intel contributions allowing for an IDA-based solution for the device
number allocation.

The checks on the dev_num are handled at the SoundWire level, but the
locking is handled at the hda-mlink level.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Small helpers to make DAI ops simpler.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
For DMIC and SSP, the DSP will be responsible for programming the
blobs and link registers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
For SoundWire usages, we need to use the global eml_lock to
serialize/protect all accesses to shared registers.  Due to the split
implementation across two subsystems, we need to pass a pointer
around.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@plbossart
Copy link
Member Author

v4: fixed nocodec issue (wrong Kconfig). sof-test will still fail on sof-logger test until thesofproject/sof-test#1003 is merged.

@plbossart
Copy link
Member Author

The only issue in the tests is the hda-mlink module issue
https://sof-ci.01.org/linuxpr/PR4158/build3217/devicetest/index.html
https://sof-ci.01.org/linuxpr/PR4158/build3218/devicetest/index.html

sof-test was updated, will re-run the tests.

@plbossart
Copy link
Member Author

SOFCI TEST

@plbossart
Copy link
Member Author

I don't understand the CI failures, I tested manually on the very same device that fails https://sof-ci.01.org/linuxpr/PR4158/build3223/devicetest/index.html?model=ADLP_RVP_SDW_IPC4ZPH&testcase=check-kmod-load-unload and it's working fine.

Probably some caching issue?

@plbossart
Copy link
Member Author

SOFCI_TEST

@ranj063
Copy link
Collaborator

ranj063 commented Feb 16, 2023

SOFCI TEST

Copy link

@RanderWang RanderWang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@ujfalusi ujfalusi left a comment

Choose a reason for hiding this comment

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

With the update for sof-test merged, all is good.

@plbossart
Copy link
Member Author

@bardliao @ranj063 can I bother you to provide your review one final time?

@plbossart
Copy link
Member Author

plbossart commented Feb 16, 2023

GitHub I hate you, why can't I rebase this branch?

"This branch cannot be rebased due to too many changes"

What a useless tool.

@plbossart
Copy link
Member Author

I'll use a merge commit for now, I don't have time to deal with stupid tools today.

@plbossart plbossart merged commit d0bbcf3 into thesofproject:topic/sof-dev Feb 16, 2023
Copy link
Collaborator

@bardliao bardliao left a comment

Choose a reason for hiding this comment

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

I am late, but it looks good to me.

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