ASoC: SOF: Intel: hda-mlink: add helpers to set link SYNC frequency
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tue, 4 Apr 2023 10:41:21 +0000 (13:41 +0300)
committerMark Brown <broonie@kernel.org>
Thu, 6 Apr 2023 15:45:44 +0000 (16:45 +0100)
commit02ba1b021c28670011b361be3be4bda49f348c43
tree67a6adb0d5082af534bbb0a345b617218cc05999
parent2e4288319ad3e18a266461d3e63c86eb36f7a152
ASoC: SOF: Intel: hda-mlink: add helpers to set link SYNC frequency

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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230404104127.5629-13-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/hda-mlink.h
sound/soc/sof/intel/hda-mlink.c