Hans de Goede [Fri, 21 Apr 2023 18:37:14 +0000 (20:37 +0200)]
ASoC: Intel: soc-acpi-byt: Fix "WM510205" match no longer working
Commit 7e1d728a94ca ("ASoC: Intel: soc-acpi-byt: Add new WM5102 ACPI HID")
added an extra HID to wm5102_comp_ids.codecs, but it forgot to bump
wm5102_comp_ids.num_codecs, causing the last codec HID in the codecs list
to no longer work.
Bump wm5102_comp_ids.num_codecs to fix this.
Fixes: 7e1d728a94ca ("ASoC: Intel: soc-acpi-byt: Add new WM5102 ACPI HID") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230421183714.35186-1-hdegoede@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
There is no way to select max98090 from menuconfig right now.
Add a Kconfig menu description to allow building the driver standalone.
It will allow this codec to be used by any other I2S master without
adding extra sound card entry in Kconfig.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Tested-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/877cu6f619.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: fsl: imx-audmix: cleanup platform which is using Generic DMA
If CPU is using soc-generic-dmaengine-pcm, Platform Component will be
same as CPU Component. In this case, we can use CPU dlc for Platform dlc.
This patch shares CPU dlc with Platform, and add comment.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Tested-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/878remf61j.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: fsl: imx-spdif: cleanup platform which is using Generic DMA
If CPU is using soc-generic-dmaengine-pcm, Platform Component will be
same as CPU Component. In this case, we can use CPU dlc for Platform dlc.
This patch shares CPU dlc with Platform, and add comment.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Tested-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/87a5z2f61w.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: fsl: imx-es8328: cleanup platform which is using Generic DMA
If CPU is using soc-generic-dmaengine-pcm, Platform Component will be
same as CPU Component. In this case, we can use CPU dlc for Platform dlc.
This patch shares CPU dlc with Platform, and add comment.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Tested-by: Shengjiu Wang <shengjiu.wang@gmail.com> Link: https://lore.kernel.org/r/87bkjif628.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
Mark Brown [Thu, 20 Apr 2023 13:49:35 +0000 (14:49 +0100)]
ASoC: SOF: pcm/Intel: Pause-resume improvements for
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:
Last minute patch for correct the pasue/resume operation with IPC4. The
issues are hardto reproduce and needs extended stress testing to be hit,
in which case the audio breaks due to DMA errors.
Mark Brown [Thu, 20 Apr 2023 13:49:22 +0000 (14:49 +0100)]
ASoC: Intel: boards: updates for 6.4
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
Preparation of ALC712 support with different types of SoundWire
devices per link, new RaptorLake SoundWire device, better error
handling for Cirrus devices and cosmetic changes for Max98373.
Bard Liao (3):
ASoC: Intel: sof_sdw: set codec_num = 1 if the device is not
aggregated
ASoC: Intel: sof_sdw: support different devices on the same sdw link
ASoC: Intel: sof_sdw: append codec type to dai link name
Curtis Malainey (1):
ASoC: Intel: sof_cirrus_common: Guard against missing buses
Yong Zhi (2):
ASoC: Intel: sof_sdw: remove late_probe flag in struct
sof_sdw_codec_info
ASoC: Intel: sof_sdw_max98373: change sof_sdw_mx8373_late_probe to
static call
apoorv (1):
ASoC: Intel: soc-acpi: Add entry for rt711-sdca-sdw at link 2 in RPL
match table
Mark Brown [Wed, 19 Apr 2023 18:45:06 +0000 (19:45 +0100)]
ASoC: es8316: Don't use ranges based register lookup for a single register
The es8316 driver uses a register range to specify the single volatile
register it has. While the cost will be in the noise this is a bunch of
overhead compared to just having a volatile_reg() callback so switch to
the callback.
ASoC: SOF: Intel: Split the set_power_op for IPC3 and IPC4
Suspending to S0iX with IPC3 requires the PM_GATE IPC to be sent again
to stop the DMA trace. But with IPC4, this is not needed as the trace is
stopped with the LARGE_CONFIG_SET IPC. Also, sending the MOD_D0IX IPC to
set the D0I3 state again when the DSP is in D0I3 already results in an
imbalance in PM runtime states in the firmware. So split the
set_power_state ops for IPC3 and IPC4 to avoid sending the MOD_D0IX IPC
when the DSP is already in D0I3 with IPC4.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230420104714.29573-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: pcm: Add an option to skip platform trigger during stop
In the case of IPC4, a pipeline is only paused during STOP/PAUSE/SUSPEND
triggers and the FW keeps the host DMA running when a pipeline is
paused. The start/stop tests iterate through STOP/START triggers without
involving a hw_free. This means that the pipeline state will only toggle
between PAUSED (during the STOP trigger) and RUNNING (during the START
trigger). So this test should be treated in the same way as a
PAUSE_PUSH/PAUSE_RELEASE test and the DMA should be kept running when
toggling the pipeline states between PAUSED and RUNNING.
Since there is no way to tell if a STOP trigger will be followed by hw_free
or not, this patch proposes to always skip DMA stop during the STOP trigger
and handle it later during hw_free. Introduce a new flag in struct
sof_ipc_pcm_ops, delayed_platform_trigger, that will be used to ensure that
the host DMA will not be stopped during the STOP/PAUSE/RELEASE triggers
and set it for IPC4. The platform_trigger call to stop the DMA will be
invoked during PCM hw_free instead when the pipeline is reset.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230420114137.27613-3-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: Intel: hda: Do not stop/start DMA during pause/release
The FW does not pause/stop the host DMA during pause and stopping the
host DMA from the driver could result in an unknown behaviour. So, skip
triggering the HD-Audio host DMA during pause/release.
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230420114137.27613-2-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: Intel: sof_sdw: append codec type to dai link name
The existing sdw_sof machine driver constructs two SoundWire interfaces
by direction and sdw link id. It means that we will have exactly the
same dai link name if two dai links are on the same sdw link with the
same direction.
The new Realtek codec has two SoundWire interfaces for jack and DMIC
functions and they are treated as different codecs. To create two dai
links for jack and DMIC, we need to have different dai link names.
This patch suggests to append codec type if there are two or more
different types of devices on the same sdw bus.
ASoC: Intel: sof_sdw: support different devices on the same sdw link
The existing code assumes all devices on the same soundwire link
are the same devices. eg. all rt1316. This commit removes the
assumption and supports different devices on the same soundwire link.
ASoC: Intel: sof_sdw: set codec_num = 1 if the device is not aggregated
We assume adr_link->num_adr = 1 if a device is not aggregated. However,
the assumption is not valid if there are different type devices on the
same soundwire link.
Convert all existing calls that pass "NULL, 0" for reply data to the new
no_reply calls. Also convert any calls that pass in data but don't
actually parse the result.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20230419194057.42205-3-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
95% of the calls inside SOF to TX an IPC don't care about a reply. Yet
the previous commit cleaned up a bunch of replies that were being
populated and then thrown away. This adds some functions so users who do
not need replies don't feel obligated to provide the space to the API.
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20230419194057.42205-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
The mixer source index value for SDW2RX1 is different between
A1 and B0 silicon. As the driver doesn't provide a DAI for SDW2
just remove it as a mixer source option.
ASoC: cs35l56: Update comment on masking of EINT20 interrupts
EINT20 contains wake-source interrupts and also interface-blocked
interrupts, which all default to unmasked after reset or wake.
The comment in cs35l56_init() only mentioned the wake interrupts.
Update the comment so it's clear that it's intentional to also
mask the *_BLOCKED interrupts.
This is a bug, a logical-or should have been used.
Fixes: fc0b096c9291 ("ASoC: nau8825: Add delay control for input path") Signed-off-by: Tom Rix <trix@redhat.com> Acked-by: David Lin <CTLIN0@nuvoton.com> Link: https://lore.kernel.org/r/20230418120955.3230705-1-trix@redhat.com Signed-off-by: Mark Brown <broonie@kernel.org>
Liliang Ye [Mon, 3 Apr 2023 15:26:47 +0000 (23:26 +0800)]
ASoC: fsl_mqs: move of_node_put() to the correct location
of_node_put() should have been done directly after
mqs_priv->regmap = syscon_node_to_regmap(gpr_np);
otherwise it creates a reference leak on the success path.
To fix this, of_node_put() is moved to the correct location, and change
all the gotos to direct returns.
Fixes: a9d273671440 ("ASoC: fsl_mqs: Fix error handling in probe") Signed-off-by: Liliang Ye <yll@hust.edu.cn> Reviewed-by: Dan Carpenter <error27@gmail.com> Link: https://lore.kernel.org/r/20230403152647.17638-1-yll@hust.edu.cn Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC need to use card->mutex with _INIT or _RUNTIME,
but there is no helper function for it.
This patch adds its helper function and use it.
Because people might misunderstand that _init() is mutex initialization,
this patch renames _INIT to _ROOT and adds new
snd_soc_card_mutex_lock_root() for it.
soc.h has snd_soc_dapm_mutex_lock/unlock() definition and
many drivers are using it, but soc-dapm.c is not.
1st reason is snd_soc_dapm_mutex_lock/unlock() requests
snd_soc_dapm_context pointer as parameter (A), but sometimes soc-dapm.c
needs to use snd_soc_card (B).
2nd reason is it want to use SND_SOC_DAPM_CLASS_INIT for mutex_lock_nested(),
but helper is using _RUNTIME (A).
The conclusion is we want to use "dapm vs card" and "_RUNTIME vs _INIT"
for dapm lock/unlock. To enable this selfish request, this patch uses
_Generic macro. We can use snd_soc_dapm_mutex_lock/unlock() for both
dapm and card case.
Current soc-dapm.c is using both mutex_lock() and mutex_lock_nested().
This patch handles mutex_lock() as mutex_lock_nested(..., 0),
in other words, handles below as same.
Because people might misunderstand that _init() is mutex initialization,
this patch renames _INIT to _ROOT and adds new
snd_soc_dapm_mutex_lock_root() for it.
This patch also moves snd_soc_dapm_subclass definition from soc-dapm.h
to soc.h to keep related code together.
Because very complex soc.h vs soc-dapm.h relationship,
it is difficult/impossible to define these helper into soc-dapm.h.
Convert the WM8753 audio codec bindings to DT schema.
Signed-off-by: Saalim Quadri <danascape@gmail.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230414223801.1106550-1-danascape@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Simon Trimmer [Fri, 14 Apr 2023 13:37:53 +0000 (14:37 +0100)]
ASoC: cs35l56: Don't return a value from cs35l56_remove()
cs35l56_remove() always returns 0. Two of the functions that call
it are void and the other one should only return 0. So there's no
point returning anything from cs35l56_remove().
dsp_ready_completion is redundant and can be replaced by a call
flush_work() to wait for cs35l56_dsp_work() to complete.
As the dsp_work is queued by component_probe() it must run before other
ASoC component callbacks and therefore there is no risk of calling
flush_work() before the dsp_work() has been queued.
Simon Trimmer [Fri, 14 Apr 2023 13:37:51 +0000 (14:37 +0100)]
ASoC: cs35l56: Wait for init_complete in cs35l56_component_probe()
Moving the wait from the beginning of the cs35l56_dsp_work() into
cs35l56_component_probe() will prevent the limbo situation that is an
artifact of the two stage SoundWire driver probe and initialisation
where the card is all registered and shows in ALSA but doesn't actually
work because the hardware didn't enumerate.
The other bus drivers perform the probe and init sequentially and are
not susceptible to this issue.
Simon Trimmer [Fri, 14 Apr 2023 13:37:49 +0000 (14:37 +0100)]
ASoC: cs35l56: Rework IRQ allocation
The irq member was being set before calling the init function and then
cs35l56_irq_request() was called only when the init was successful.
However cs35l56_release() calls devm_free_irq() when the irq member is
set and therefore if init() fails then this will cause an attempted free
of an unallocated IRQ.
Instead pass the desired IRQ number to the cs35l56_irq_request()
function and set cs35l56->irq only when it has been successfully
allocated.
David Lin [Fri, 14 Apr 2023 10:39:44 +0000 (18:39 +0800)]
ASoC: nau8825: Add delay control for input path
Change the original fixed delay to the assignment from property. It will make
more flexible to different platforms for avoiding pop noise at the beginning
of recording.
David Lin [Fri, 14 Apr 2023 10:39:42 +0000 (18:39 +0800)]
ASoC: dt-bindings: nau8825: Add delay control for input path
Change the original fixed delay to the assignment from property. It will make
more flexible to different platforms for avoiding pop noise at the beginning
of recording.
David Rau [Thu, 13 Apr 2023 02:41:34 +0000 (02:41 +0000)]
ASoC: da7219: Improve the relability of AAD IRQ process
- Configure the default gound switch delay time before enabling IRQ
to avoid the unexpected delay time is set up
- Apply DA7219 AAD own work queue to handle AAD events
- Replace msleep with queue_delayed_work to have better relability
This commit improves the control of ground switches in AAD IRQ
Mark Brown [Wed, 12 Apr 2023 18:59:27 +0000 (19:59 +0100)]
ASoC: cs35l56: Add system suspend handling
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:
This set of patches adds handling for system suspend.
Patches 1..4 make some code changes that simplify the
suspend implementation, mainly to avoid race conditions.
There are two seperate aspects to suspend, and these have
been done as two patches:
- the main suspend-resume handling,
- re-loading the firmware if necessary after resume.
ASoC: cs35l56: Re-patch firmware after system suspend
Check during cs35l56_system_resume() whether the firmware patch must
be applied again.
The FIRMWARE_MISSING flag in the PROTECTION_STATUS register indicates
whether the firmware has been patched.
In non-secure mode the FIRMWARE_MISSING flag is cleared at the end of
dsp_work(). If it is set after system-resume we know that dsp_work()
must be run again.
In secure mode the pre-OS loader will have done the secure patching
and cleared the FIRMWARE_MISSING flag. So this flag does not tell us
whether firmware memory was lost. But the driver could only be
downloading non-secure tunings, which is always safe to do.
If the driver has control of RESET we will have asserted it during
suspend so the firmware patch will have been lost. The driver would only
have control of RESET in non-secure mode.
ASoC: cs35l56: Remove quick-cancelling of dsp_work()
Delete the 'removing' flag and don't kick init_completion to make a
quick cancel of dsp_work(). Just let it timeout on the wait for the
completion.
Simplify the code to standard cancelling or flushing of the work.
This avoids introducing corner cases from a layer of custom signalling.
It also avoids potential race conditions when system-suspend handling
is added.
Unless the hardware is broken, the dsp_work() will already have started
and passed the completion before the driver would want to cancel it.
This adds the main handling for system suspend but does not handle
re-patching the firmware after system resume.
This is a multi-stage suspend and resume because if there is a
RESET line it is almost certain that it will be shared by all the
amps. So every amp must have done its suspend before we can
assert RESET. Likewise we must de-assert RESET before the amps
can resume.
It's preferable to assert RESET before we turning off regulators, and
while they power up.
The actual suspend and resume is done by using the pair
pm_runtime_force_suspend() and pm_runtime_force_resume() to
re-use our runtime suspend/resume sequences.
pm_runtime_force_suspend() will disable our pm_runtime. If we were
runtime-resumed it calls our runtime_suspend().
pm_runtime_force_resume() re-enables pm_runtime and if we were
originally runtime-resumed before the pm_runtime_force_suspend()
it calls our runtime_resume(). Otherwise it leaves us
runtime-suspended.
The general process is therefore:
suspend() -> finish dsp_work and then run our runtime_suspend
suspend_late() -> assert RESET and turn off supplies
resume_early() -> enable supplies and de-assert RESET
resume() -> pm_runtime_force_resume()
In addition, to prevent the IRQ handler running in the period
between pm_runtime_force_suspend() and pm_runtime_force_resume()
the parent IRQ is temporarily disabled:
- from suspend until suspend_noirq
- from resume_noirq until resume
ASoC: cs35l56: Always wait for firmware boot in runtime-resume
When we are resuming from a system suspend the CS35L56 has probably
been hard reset (usually a power-on reset). So we must wait for the
firmware to boot. On SoundWire we also need it to re-initialize before
we can read the registers to check the CS35L56 state.
The simplest way to handle this is for runtime-resume to always wait
for firmware boot. If the firmware is already booted the overhead is
only one register read.
The system-resume will have to runtime-resume the driver anyway before
attempting any register access. So this will automatically include the
wait for initialization on SoundWire.
ASoC: cs35l56: Skip first init_completion wait in dsp_work if init_done
At the start of dsp_work() only wait for init_completion if !init_done.
This allows system suspend to re-queue dsp_work() without having to
do a dummy complete() of init_completion.
A dummy completion in system suspend would have to be conditional on
init_done. But that would create a possible race condition between our
system resume and cs35l56_init() in the corner case that we suspend right
after the SoundWire core has enumerated and reported ATTACHED.
It is safer and simpler to have cs35l56_init() as the only place that
init_completion is completed, and dsp_work() as the only place that
it is consumed.
ASoC: cs35l56: Use DAPM widget for firmware PLAY/PAUSE
If we use a DAPM widget instead of mute_stream() to send the
PLAY command we can issue the plays to multiple amps in parallel.
With mute_stream each codec driver instance is called one at a
time so we get N * PS0 delay time.
DAPM does each stage on every widget in a card before moving to
the next stage. So all amps will do the PRE_PMU then all will do
the POST_PMU. The PLAY is sent in the PRE_PMU so that they all
power-up in parallel. After the PS0 wait in the first POST_PMU
all the other amps will also be ready so there won't be any extra
delay, or it will be negligible.
There's also no point waiting for the MBOX ack in the PRE_PMU.
We won't see a PS0 state in POST_PMU if it didn't ack the PLAY
command. So we can save a little extra time.
We have SOF and generic ACP support enabled for Rembrandt and
pheonix platforms on some machines. Since we have same PCI id
used for probing, add check for machine configuration flag to
avoid conflict with newer pci drivers. Such machine flag has
been initialized via dmi match on few Chrome machines. If no
flag is specified probe and register older platform device.
Ying Liu [Tue, 11 Apr 2023 17:09:12 +0000 (01:09 +0800)]
ASoC: tas5720: add missing unwind goto in tas5720_codec_probe
Smatch complains that missing unwind goto in tas5720_codec_probe.
When tas5720 has an invalid devtype, it is expected to invoke
regulator_bulk_disable to handle the failure. But the default
option return an error code directly. Fix it by reusing the
probe_fail label.
Fred Oh [Wed, 12 Apr 2023 06:14:57 +0000 (09:14 +0300)]
ASoC: SOF: Intel: mtl: fix page fault in dspless mode when DSP is disabled
The patch to make DSPless mode work even if the DSP is
disabled in BIOS missed to touch the MTL code to add
the needed checks.
If the DSP is disabled this can lead to page fault due to not
accesible registers.
Fixes: 9fc6786f549c ("ASoC: SOF: Intel: hda: make DSPless mode work with DSP disabled in BIOS") Signed-off-by: Fred Oh <fred.oh@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Link: https://lore.kernel.org/r/20230412061457.27937-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Mark Brown [Tue, 11 Apr 2023 18:47:17 +0000 (19:47 +0100)]
ASoC: SOF: Intel: hda-mlink: HDaudio multi-link
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:
The following series adds the core support to handle the recently updated
HDaudio multi-link support to hanlde non HDA links, like SoundWire/DMIC/SSP on
Intel platform.
For details, please see the first patch which documents the current mlink
support (introduced at Skylake) and the new extensions, arriving with LNL.
There is no change in functionality for existing HDA support, the extension is
backwards compatible with existing implementations.
ASoC: mediatek: common: Fix refcount leak in parse_dai_link_info
Add missing of_node_put()s before the returns to balance
of_node_get()s and of_node_put()s, which may get unbalanced
in case the for loop 'for_each_available_child_of_node' returns
early.
- Switch to REGCACHE_FLAT, the whole overhead of RBTREE is not worth it
with non sparse register set in the address range 1..7.
- Move register width to central location
ASoC: ep93xx: i2s: move enable call to startup callback
Make startup/shutdown callbacks symmetric to avoid clock subsystem warnings
(reproduced with "aplay --dump-hw-params" + ctrl-c):
WARNING: CPU: 0 PID: 102 at drivers/clk/clk.c:1048 clk_core_disable
lrclk already disabled
CPU: 0 PID: 102 Comm: aplay Not tainted 6.2.0-rc4 #1
Hardware name: Generic DT based system
...
clk_core_disable from clk_core_disable_lock
clk_core_disable_lock from ep93xx_i2s_shutdown
ep93xx_i2s_shutdown from snd_soc_dai_shutdown
snd_soc_dai_shutdown from soc_pcm_clean
soc_pcm_clean from soc_pcm_close
soc_pcm_close from snd_pcm_release_substream.part.0
snd_pcm_release_substream.part.0 from snd_pcm_release
snd_pcm_release from __fput
__fput from task_work_run
...
WARNING: CPU: 0 PID: 102 at drivers/clk/clk.c:907 clk_core_unprepare
lrclk already unprepared
CPU: 0 PID: 102 Comm: aplay Tainted: G W 6.2.0-rc4 #1
Hardware name: Generic DT based system
...
clk_core_unprepare from clk_unprepare
clk_unprepare from ep93xx_i2s_shutdown
ep93xx_i2s_shutdown from snd_soc_dai_shutdown
snd_soc_dai_shutdown from soc_pcm_clean
soc_pcm_clean from soc_pcm_close
soc_pcm_close from snd_pcm_release_substream.part.0
snd_pcm_release_substream.part.0 from snd_pcm_release
snd_pcm_release from __fput
__fput from task_work_run
...
ASoC: dt-bindings: asahi-kasei,ak4458: fix missing quotes around hash
The yamllint expect comments to start with hash and space ('# '), so
quote the description to fix:
asahi-kasei,ak4458.yaml:40:30: [error] missing starting space in comment (comments)
Reported-by: Rob Herring <robh@kernel.org> Closes: https://lore.kernel.org/all/CAL_JsqJzxQb1g=yVgHduLnYOpk8-Q3jppA1qQT1Ce51_gNWjhg@mail.gmail.com/ Fixes: 009e83b591dd ("ASoC: dt-bindings: ak4458: Convert to dtschema") Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20230407170032.102412-1-krzysztof.kozlowski@linaro.org Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: Intel: hda-mlink: add helper to retrieve eml_lock
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> 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-19-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: Intel: hda-mlink: program SoundWire LSDIID registers
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> 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-16-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
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>
ASoC: SOF: Intel: hda-mlink: add convenience helpers for SoundWire PM
The updated SoundWire Intel driver will need to rely on Extended
HDaudio links for power management, but it doesn't need to be aware of
all the HDaudio structures. Add convenience helpers to avoid polluting
SoundWire drivers too much with HDaudio information.
Since the SoundWire/Intel solution already takes the lock at a higher
level, the _unlocked PM helpers are used.
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-10-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: Intel: hda-mlink: introduce helpers for 'extended links' PM
Add helpers to program SPA/CPA bits, using a mutex to access the
shared LCTL register if required.
All links are managed with the same LCTLx.SPA bits. However there are
quite a few implementation details to be aware of:
Legacy HDaudio multi-links are powered-up when exiting reset, which
requires the ref_count to be manually set to one when initializing the
link.
Alternate links for SoundWire/DMIC/SSP need to be explicitly
powered-up before accessing the SHIM/IP/Vendor-Specific SHIM space for
each sublink. DMIC/SSP/SoundWire are all different cases with a
different device/dai/hlink relationship.
SoundWire will handle power management with the auxiliary device
resume/suspend routine. The ref_count is not necessary in this case.
The DMIC/SSP will by contrast handle the power management from DAI
.startup and .shutdown callbacks.
The SSP has a 1:1 mapping between sublink and DAI, but it's
bidirectional so the ref_count will help avoid turning off the sublink
when one of the two directions is still in use.
The DMIC has a single link but two DAIs for data generated at
different sampling frequencies, again the ref_count will make sure the
two DAIs can be used concurrently.
And last the SoundWire Intel require power-up/down and bank switch to
be handled with a lock already taken, so the 'eml_lock' is made
optional with the _unlocked versions of the helpers.
Note that the _check_power_active() implementation is similar to
previous helpers in sound/hda/ext, 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-9-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
For backwards compatibility, HDaudio/iDISP links are powered-on when
exiting reset, and the existing driver forces them to be powered-off
when entering S0ix. In addition, the get/put helpers are invoked
directly by the ASoC codec drivers, which a historical layering
violation.
Extended links are powered-on by software only, during the probe and
DAI startup phases. This calls for a different handling of the
'regular' and 'extended' audio links.
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-8-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: Intel: hda-mlink: add structures to parse ALT links
Extend hdac_ext_link to store information needed for ALT
links. Follow-up patches will include more functional patches for
power-up and down.
Note that this patch suggests the use of an 'eml_lock' to serialize
access to shared registers. SoundWire-specific sequence require the
lock to be taken at a higher level, as a result the helpers added in
follow-up patches will provide 'unlocked' versions when needed.
Also note that the low-level sequences with the 'hdaml_' prefix are
taken directly from the hardware specifications - naming conventions
included. The code will be split in two, with locking and linked-list
management handled separately to avoid mixing required hardware setup
and Linux-based resource management.
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-7-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
ASoC: SOF: Intel: hda-mlink: move to a dedicated module
Some of the functions will be used for SoundWire enumeration and power
management, to avoid cycles in module dependencies and simplify
integration all the HDaudio multi-link needs to move to a dedicated
module.
Drop no longer needed headers at the same time.
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-6-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>