platform/kernel/linux-rpi.git
14 months agoASoC: Intel: sof_sdw: remove late_probe flag in struct sof_sdw_codec_info
Yong Zhi [Wed, 19 Apr 2023 19:55:20 +0000 (14:55 -0500)]
ASoC: Intel: sof_sdw: remove late_probe flag in struct sof_sdw_codec_info

Just use codec_card_late_probe ptr in struct sof_sdw_codec_info
for validation check and drop late_probe variable.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230419195524.46995-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Intel: soc-acpi: Add entry for rt711-sdca-sdw at link 2 in RPL match table
apoorv [Wed, 19 Apr 2023 19:55:19 +0000 (14:55 -0500)]
ASoC: Intel: soc-acpi: Add entry for rt711-sdca-sdw at link 2 in RPL match table

RT711 sdca sdw is added with SDW2 link for RPL-P CRB platform.

Signed-off-by: apoorv <apoorv@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230419195524.46995-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: Intel: sof_cirrus_common: Guard against missing buses
Curtis Malainey [Wed, 19 Apr 2023 19:55:18 +0000 (14:55 -0500)]
ASoC: Intel: sof_cirrus_common: Guard against missing buses

Even if we find a acpi device we can still be missing the physical node.

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>
Link: https://lore.kernel.org/r/20230419195524.46995-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: fsl: Restore configuration of platform
Shengjiu Wang [Wed, 19 Apr 2023 10:29:18 +0000 (18:29 +0800)]
ASoC: fsl: Restore configuration of platform

This reverts commit 33683cbf49b54 ("ASoC: fsl: remove unnecessary
dai_link->platform").

dai_link->platform is needed. The platform component is
"snd_dmaengine_pcm", which is registered from cpu driver,

If dai_link->platform is not assigned, then platform
component will not be probed, then there will be issue:

aplay: main:831: audio open error: Invalid argument

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1681900158-17428-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: fsl: Simplify an error message
Christophe JAILLET [Sun, 16 Apr 2023 06:29:34 +0000 (08:29 +0200)]
ASoC: fsl: Simplify an error message

dev_err_probe() already display the error code. There is no need to
duplicate it explicitly in the error message.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/c167c16a535049d56f817bbede9c9f6f0a0f4c68.1681626553.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: cs35l56: Updates for B0 silicon
Mark Brown [Tue, 18 Apr 2023 18:08:24 +0000 (19:08 +0100)]
ASoC: cs35l56: Updates for B0 silicon

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

These patches make some small changes to align with the B0
silicon revision.

14 months agoASoC: cs35l56: Rename mixer source defines for SoundWire DP1
Richard Fitzgerald [Tue, 18 Apr 2023 14:43:09 +0000 (15:43 +0100)]
ASoC: cs35l56: Rename mixer source defines for SoundWire DP1

Rename the mixer source defines from CS35L56_INPUT_SRC_SWIRE_RXn
to CS35L56_INPUT_SRC_SWIRE_DP1_CHANNELn to match the latest
datasheet.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230418144309.1100721-5-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: cs35l56: Remove SDW2RX1 mixer source
Richard Fitzgerald [Tue, 18 Apr 2023 14:43:08 +0000 (15:43 +0100)]
ASoC: cs35l56: Remove SDW2RX1 mixer source

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.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230418144309.1100721-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: cs35l56: Remove SDW1 TX5 and TX6
Richard Fitzgerald [Tue, 18 Apr 2023 14:43:07 +0000 (15:43 +0100)]
ASoC: cs35l56: Remove SDW1 TX5 and TX6

Reduce SDW1 to 4 channels and remove the controls for SDW1
TX5 and TX6.

The TX5 and TX6 channels have been removed from B0 silicon.
There is no need to support them on A1 silicon.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230418144309.1100721-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: cs35l56: Update comment on masking of EINT20 interrupts
Richard Fitzgerald [Tue, 18 Apr 2023 14:43:06 +0000 (15:43 +0100)]
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.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230418144309.1100721-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: codecs: wcd938x: Simplify with dev_err_probe
Krzysztof Kozlowski [Tue, 18 Apr 2023 07:46:30 +0000 (09:46 +0200)]
ASoC: codecs: wcd938x: Simplify with dev_err_probe

Replace dev_err() in probe() path with dev_err_probe() to:
1. Make code a bit simpler and easier to read,
2. Do not print messages on deferred probe.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230418074630.8681-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: codecs: wcd934x: Simplify &pdev->dev in probe
Krzysztof Kozlowski [Tue, 18 Apr 2023 07:46:29 +0000 (09:46 +0200)]
ASoC: codecs: wcd934x: Simplify &pdev->dev in probe

The probe already stores pointer to &pdev->dev, so use it to make the
code a bit easier to read.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230418074630.8681-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: codecs: wcd934x: Simplify with dev_err_probe
Krzysztof Kozlowski [Tue, 18 Apr 2023 07:46:28 +0000 (09:46 +0200)]
ASoC: codecs: wcd934x: Simplify with dev_err_probe

Replace dev_err() in probe() path with dev_err_probe() to:
1. Make code a bit simpler and easier to read,
2. Do not print messages on deferred probe.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230418074630.8681-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: dt-bindings: wm8728: Convert to dtschema
Saalim Quadri [Mon, 17 Apr 2023 20:43:23 +0000 (20:43 +0000)]
ASoC: dt-bindings: wm8728: Convert to dtschema

Convert the WM8728 audio CODEC bindings to DT schema

Signed-off-by: Saalim Quadri <danascape@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230417204323.137681-1-danascape@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: nau8825: fix bounds check for adc_delay
Tom Rix [Tue, 18 Apr 2023 12:09:55 +0000 (08:09 -0400)]
ASoC: nau8825: fix bounds check for adc_delay

clang build reports
sound/soc/codecs/nau8825.c:2826:31: error: overlapping comparisons
  always evaluate to false [-Werror,-Wtautological-overlap-compare]
        if (nau8825->adc_delay < 125 && nau8825->adc_delay > 500)
            ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~

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>
14 months agoASoC: codecs: wcd9335: Simplify with dev_err_probe
Krzysztof Kozlowski [Mon, 17 Apr 2023 14:14:50 +0000 (16:14 +0200)]
ASoC: codecs: wcd9335: Simplify with dev_err_probe

Code can be a bit simpler with dev_err_probe().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230417141453.919158-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
14 months agoASoC: dt-bindings: wm8737: Convert to dtschema
Saalim Quadri [Mon, 17 Apr 2023 21:24:00 +0000 (21:24 +0000)]
ASoC: dt-bindings: wm8737: Convert to dtschema

Convert the WM8737 audio CODEC bindings to DT schema

Signed-off-by: Saalim Quadri <danascape@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230417212400.161796-1-danascape@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Code improvements
Mark Brown [Mon, 17 Apr 2023 20:26:56 +0000 (21:26 +0100)]
ASoC: cs35l56: Code improvements

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

Various code improvements. These remove redundant code and
clean up less-than-optimal original implementations.

15 months agoASoC: fsl_mqs: move of_node_put() to the correct location
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>
15 months agoASoC: cleanup mutex lock
Mark Brown [Mon, 17 Apr 2023 19:12:43 +0000 (20:12 +0100)]
ASoC: cleanup mutex lock

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

ASoC is using many type of mutex lock, but
some of them has helper function, but some doesn't.
Or, it has helper function, but is static.

This patch-set adds helper function and use it.

15 months agoASoC: add snd_soc_card_mutex_lock/unlock()
Kuninori Morimoto [Thu, 6 Apr 2023 00:16:27 +0000 (00:16 +0000)]
ASoC: add snd_soc_card_mutex_lock/unlock()

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.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a5zlx3tw.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: expand snd_soc_dpcm_mutex_lock/unlock()
Kuninori Morimoto [Thu, 6 Apr 2023 00:16:10 +0000 (00:16 +0000)]
ASoC: expand snd_soc_dpcm_mutex_lock/unlock()

soc-pcm.c has snd_soc_dpcm_mutex_lock/unlock(),
but other files can't use it because it is static function.

It requests snd_soc_pcm_runtime as parameter (A), but sometimes we
want to use it by snd_soc_card (B).

(A) static inline void snd_soc_dpcm_mutex_lock(struct snd_soc_pcm_runtime *rtd)
{
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
}    ^^^^^^^^^

(B) mutex_lock_nested(&card->pcm_mutex, card->pcm_subclass);
   ^^^^

We want to use it with both "rtd" and "card" for dapm lock/unlock.
To enable it, this patch uses _Generic macro.

This patch makes snd_soc_dpcm_mutex_{un}lock() global function, and use it on
each files.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bkk1x3ud.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: expand snd_soc_dapm_mutex_lock/unlock()
Kuninori Morimoto [Thu, 6 Apr 2023 00:15:48 +0000 (00:15 +0000)]
ASoC: expand snd_soc_dapm_mutex_lock/unlock()

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).

(A) static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
{
mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
}    ^^^^^^^^^^

(B) mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
   ^^^^

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.

snd_soc_dapm_mutex_lock(dapm); snd_soc_dapm_mutex_unlock(dapm);
snd_soc_dapm_mutex_lock(card); snd_soc_dapm_mutex_unlock(card);

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.

mutex_lock(&card->dapm_mutex);
mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);

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.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87cz4hx3v0.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: wm8753: Convert to dtschema
Saalim Quadri [Fri, 14 Apr 2023 22:38:01 +0000 (22:38 +0000)]
ASoC: dt-bindings: wm8753: Convert to dtschema

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>
15 months agoASoC: ssm2602: Add support for CLKDIV2
Paweł Anikiel [Fri, 14 Apr 2023 14:02:00 +0000 (16:02 +0200)]
ASoC: ssm2602: Add support for CLKDIV2

The SSM260x chips have an internal MCLK /2 divider (bit D7 in register
R8). Add logic that allows for more MCLK values using this divider.

Signed-off-by: Paweł Anikiel <pan@semihalf.com>
Link: https://lore.kernel.org/r/20230414140203.707729-7-pan@semihalf.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Don't return a value from cs35l56_remove()
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().

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230414133753.653139-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Remove redundant dsp_ready_completion
Simon Trimmer [Fri, 14 Apr 2023 13:37:52 +0000 (14:37 +0100)]
ASoC: cs35l56: Remove redundant dsp_ready_completion

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.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230414133753.653139-5-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Wait for init_complete in cs35l56_component_probe()
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.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230414133753.653139-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Allow a wider range for reset pulse width
Simon Trimmer [Fri, 14 Apr 2023 13:37:50 +0000 (14:37 +0100)]
ASoC: cs35l56: Allow a wider range for reset pulse width

There is no reason to have such a tight usleep range of 400us and it is
acceptable to allow MIN_US * 2.

Also wrap the usleep in an inline function.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/168147949455.26.3401634900657387799@mailman-core.alsa-project.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Rework IRQ allocation
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.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/168147949598.26.711670799488943454@mailman-core.alsa-project.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: nau8825: Add delay control for input path
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.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230414103941.39566-2-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: nau8825: Add delay control for input path
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.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230414103941.39566-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: da7218: Use devm_clk_get_optional()
Christophe JAILLET [Thu, 13 Apr 2023 05:28:33 +0000 (07:28 +0200)]
ASoC: da7218: Use devm_clk_get_optional()

Use devm_clk_get_optional() instead of hand writing it.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/51976b2515d7007ba5c8aa7524892f147d7cdd51.1681363691.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: da7219: Improve the relability of AAD IRQ process
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

Signed-off-by: David Rau <David.Rau.opensource@dm.renesas.com>
Link: https://lore.kernel.org/r/20230413024134.8612-1-David.Rau.opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Add system suspend handling
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.

15 months agoASoC: cs35l56: Re-patch firmware after system suspend
Richard Fitzgerald [Tue, 11 Apr 2023 15:25:28 +0000 (16:25 +0100)]
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.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/168122674550.26.8545058503709956172@mailman-core.alsa-project.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Remove quick-cancelling of dsp_work()
Richard Fitzgerald [Tue, 11 Apr 2023 15:25:23 +0000 (16:25 +0100)]
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.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/168122674746.26.16881587647873355224@mailman-core.alsa-project.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Add basic system suspend handling
Richard Fitzgerald [Tue, 11 Apr 2023 15:25:27 +0000 (16:25 +0100)]
ASoC: cs35l56: Add basic system suspend handling

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

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230411152528.329803-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Always wait for firmware boot in runtime-resume
Richard Fitzgerald [Tue, 11 Apr 2023 15:25:26 +0000 (16:25 +0100)]
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.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230411152528.329803-5-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Skip first init_completion wait in dsp_work if init_done
Richard Fitzgerald [Tue, 11 Apr 2023 15:25:25 +0000 (16:25 +0100)]
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.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230411152528.329803-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs35l56: Use DAPM widget for firmware PLAY/PAUSE
Richard Fitzgerald [Tue, 11 Apr 2023 15:25:24 +0000 (16:25 +0100)]
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.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230411152528.329803-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: ep93xx: Add OF support
Alexander Sverdlin [Tue, 11 Apr 2023 16:59:51 +0000 (18:59 +0200)]
ASoC: ep93xx: Add OF support

Add the new cirrus,ep9301-ac97 and cirrus,ep9301-i2s compatibles.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20230411165951.2335899-2-alexander.sverdlin@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: ep93xx: Add I2S description
Alexander Sverdlin [Tue, 11 Apr 2023 16:59:50 +0000 (18:59 +0200)]
ASoC: ep93xx: Add I2S description

Add device tree bindings for Cirrus Logic EP93xx internal SoCs' I2S
controller.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230411165951.2335899-1-alexander.sverdlin@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: amd: Add check for acp config flags
Syed Saba Kareem [Wed, 12 Apr 2023 09:16:16 +0000 (14:46 +0530)]
ASoC: amd: Add check for acp config flags

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.

Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com>
Reviewed-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20230412091638.1158901-1-Syed.SabaKareem@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: tas5720: add missing unwind goto in tas5720_codec_probe
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.

Signed-off-by: Ying Liu <lyre@hust.edu.cn>
Link: https://lore.kernel.org/r/20230411170912.1939906-1-lyre@hust.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: mtl: fix page fault in dspless mode when DSP is disabled
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>
15 months agoASoC: amd: yc: Add ThinkBook 14 G5+ ARP to quirks list for acp6x
Baishan Jiang [Wed, 12 Apr 2023 08:40:43 +0000 (16:40 +0800)]
ASoC: amd: yc: Add ThinkBook 14 G5+ ARP to quirks list for acp6x

ThinkBook 14 G5+ ARP uses Ryzen 7735H processor, and has the same
microphone problem as ThinkBook 14 G4+ ARA.

Adding 21HY to acp6x quirks table enables microphone for ThinkBook
14 G5+ ARP.

Signed-off-by: Baishan Jiang <bjiang400@outlook.com>
Link: https://lore.kernel.org/r/OS3P286MB1711DD6556284B69C79C0C4FE19B9@OS3P286MB1711.JPNP286.PROD.OUTLOOK.COM
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: HDaudio multi-link
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.

15 months agoASoC: dt-bindings: wm8523: Convert to dtschema
Saalim Quadri [Wed, 5 Apr 2023 20:34:19 +0000 (02:04 +0530)]
ASoC: dt-bindings: wm8523: Convert to dtschema

Convert the WM8523 audio CODEC bindings to DT schema

Signed-off-by: Saalim Quadri <danascape@gmail.com>
Link: https://lore.kernel.org/r/20230405203419.5621-1-danascape@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: wm8711: Convert to dtschema
Saalim Quadri [Wed, 5 Apr 2023 20:58:20 +0000 (02:28 +0530)]
ASoC: dt-bindings: wm8711: Convert to dtschema

Convert the WM8711 audio CODEC bindings to DT schema

Signed-off-by: Saalim Quadri <danascape@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230405205820.6836-1-danascape@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: wm8580: Convert to dtschema
Saalim Quadri [Wed, 5 Apr 2023 20:50:25 +0000 (02:20 +0530)]
ASoC: dt-bindings: wm8580: Convert to dtschema

Convert the WM8580 and WM8581 audio CODEC bindings to DT schema

Signed-off-by: Saalim Quadri <danascape@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230405205025.6448-1-danascape@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: ep93xx: Prepare for DT transition
Mark Brown [Tue, 11 Apr 2023 14:17:18 +0000 (15:17 +0100)]
ASoC: ep93xx: Prepare for DT transition

Merge series from Alexander Sverdlin <alexander.sverdlin@gmail.com>:

This is a preparatory series for EP93xx transition to DT. This patchset is
a pre-requisite and has been tested with the full DT patchset [1].

[1]. git://git.maquefel.me/linux.git branch ep93xx/6.2-rc4-v0

Alexander Sverdlin (3):
  ASoC: ep93xx: i2s: move enable call to startup callback
  ASoC: cs4271: flat regcache, trivial simplifications
  ASoC: ep93xx: i2s: Make it individually selectable

 sound/soc/cirrus/Kconfig      |  6 +++++-
 sound/soc/cirrus/ep93xx-i2s.c | 12 +++++++++++-
 sound/soc/codecs/cs4271-i2c.c |  1 -
 sound/soc/codecs/cs4271-spi.c |  1 -
 sound/soc/codecs/cs4271.c     |  4 ++--
 5 files changed, 18 insertions(+), 6 deletions(-)

--
2.40.0

15 months agoASoC: mediatek: common: Fix refcount leak in parse_dai_link_info
Aashish Sharma [Tue, 11 Apr 2023 00:34:31 +0000 (06:04 +0530)]
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.

Fixes: 4302187d955f ("ASoC: mediatek: common: add soundcard driver common code")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@inria.fr>
Link: https://lore.kernel.org/r/202304090504.2K8L6soj-lkp@intel.com/
Signed-off-by: Aashish Sharma <shraash@google.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230411003431.4048700-1-shraash@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: amd: Add Dell G15 5525 to quirks list
Cem Kaya [Mon, 10 Apr 2023 18:38:15 +0000 (20:38 +0200)]
ASoC: amd: Add Dell G15 5525 to quirks list

Add Dell G15 5525 Ryzen Edition to quirks list for acp6x so that
internal mic works.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=217155
Signed-off-by: Cem Kaya <cemkaya.boun@gmail.com>
Link: https://lore.kernel.org/r/20230410183814.260518-1-cemkaya.boun@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: ep93xx: i2s: Make it individually selectable
Alexander Sverdlin [Mon, 10 Apr 2023 22:39:02 +0000 (00:39 +0200)]
ASoC: ep93xx: i2s: Make it individually selectable

This is necessary to replace EDB93XX specific SoC audio driver with generic
"simple-audio-card".

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20230410223902.2321834-4-alexander.sverdlin@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: cs4271: flat regcache, trivial simplifications
Alexander Sverdlin [Mon, 10 Apr 2023 22:39:01 +0000 (00:39 +0200)]
ASoC: cs4271: flat regcache, trivial simplifications

- 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

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20230410223902.2321834-3-alexander.sverdlin@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: ep93xx: i2s: move enable call to startup callback
Alexander Sverdlin [Mon, 10 Apr 2023 22:39:00 +0000 (00:39 +0200)]
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
 ...

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20230410223902.2321834-2-alexander.sverdlin@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: asahi-kasei,ak4458: fix missing quotes around hash
Krzysztof Kozlowski [Fri, 7 Apr 2023 17:00:32 +0000 (19:00 +0200)]
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>
15 months agoASoC: mediatek: mt8186: set variable aud_pinctrl to static
Tom Rix [Fri, 7 Apr 2023 11:55:53 +0000 (07:55 -0400)]
ASoC: mediatek: mt8186: set variable aud_pinctrl to static

smatch reports
sound/soc/mediatek/mt8186/mt8186-afe-gpio.c:14:16: warning: symbol
  'aud_pinctrl' was not declared. Should it be static?

This variable is only used in one file so should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20230407115553.1968111-1-trix@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-dai: Print the format_val as hexadecimal number
Peter Ujfalusi [Thu, 6 Apr 2023 15:52:19 +0000 (10:52 -0500)]
ASoC: SOF: Intel: hda-dai: Print the format_val as hexadecimal number

The format_val is a set of bitfileds, printing it as a decimal just makes
interpreting it complicated.

In other HDA core code the format_val is printed as hexadecimal also.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Jaska Uimonen <jaska.uimonen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230406155219.18997-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: MTL: conditionally wake WPIO1PG domain
Yong Zhi [Thu, 6 Apr 2023 15:44:54 +0000 (10:44 -0500)]
ASoC: SOF: Intel: MTL: conditionally wake WPIO1PG domain

Wake IO1 from power gating if there is SoundWire enabled link discovered
by ACPI scan.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230406154454.18163-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: Add rpl_mx98360_rt5682 driver
Curtis Malainey [Thu, 6 Apr 2023 15:37:02 +0000 (10:37 -0500)]
ASoC: Intel: Add rpl_mx98360_rt5682 driver

Boards were using this in older kernels before adl and rpl ids were
split. Add this back to maintain support.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230406153703.17194-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: add helper to retrieve eml_lock
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:27 +0000 (13:41 +0300)]
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>
15 months agoASoC: SOF: Intel: hda-mlink: add helper to offload link ownership
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:26 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: add helper to offload link ownership

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>
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-18-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: add helpers to retrieve DMIC/SSP hlink
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:25 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: add helpers to retrieve DMIC/SSP hlink

Small helpers to make DAI ops simpler.

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-17-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: program SoundWire LSDIID registers
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:24 +0000 (13:41 +0300)]
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>
15 months agoASoC: SOF: Intel: hda-mlink: add helper to check cmdsync
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:23 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: add helper to check cmdsync

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>
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-15-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: add helpers for sync_arm/sync_go
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:22 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: add helpers for sync_arm/sync_go

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>
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-14-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: add helpers to set link SYNC frequency
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:21 +0000 (13:41 +0300)]
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>
15 months agoASoC: SOF: Intel: hda-mlink: add helpers to enable/check interrupts
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:20 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: add helpers to enable/check interrupts

When INTC is set, LCTL exposes INTEN and INTSTS fields.

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-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: add helper to return sublink count
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:19 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: add helper to return sublink count

This is needed for SoundWire integration.

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-11-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: add convenience helpers for SoundWire PM
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:18 +0000 (13:41 +0300)]
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>
15 months agoASoC: SOF: Intel: hda-mlink: introduce helpers for 'extended links' PM
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:17 +0000 (13:41 +0300)]
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>
15 months agoASoC: SOF: Intel: hda-mlink: special-case HDaudio regular links
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:16 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: special-case HDaudio regular links

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>
15 months agoASoC: SOF: Intel: hda-mlink: add structures to parse ALT links
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:15 +0000 (13:41 +0300)]
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>
15 months agoASoC: SOF: Intel: hda-mlink: move to a dedicated module
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:14 +0000 (13:41 +0300)]
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>
15 months agoASoC: SOF: Intel: hda-mlink: add return value for hda_bus_ml_get_capabilities()
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:13 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: add return value for hda_bus_ml_get_capabilities()

Add return value - this will need additional work in the caller.

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-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda-mlink: improve hda_bus_ml_free() helper
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:12 +0000 (13:41 +0300)]
ASoC: SOF: Intel: hda-mlink: improve hda_bus_ml_free() helper

Use list_for_each_entry_safe() instead of open-coding.

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-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoALSA: hda: add HDaudio Extended link definitions
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:11 +0000 (13:41 +0300)]
ALSA: hda: add HDaudio Extended link definitions

Add new definitions for the HDaudio Extended link support,
specifically new registers for SoundWire, Intel DMIC and INTEL SSP
interfaces.

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-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoDocumentation: sound: add description of Intel HDaudio multi-links
Pierre-Louis Bossart [Tue, 4 Apr 2023 10:41:10 +0000 (13:41 +0300)]
Documentation: sound: add description of Intel HDaudio multi-links

Add description of 'Skylake' multi-link structure added in 2015 and
recent extensions to support SoundWire/DMIC/SSP interfaces.

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-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: hda: add __func__ in SoundWire lcount() error logs
Pierre-Louis Bossart [Thu, 6 Apr 2023 15:29:37 +0000 (10:29 -0500)]
ASoC: SOF: Intel: hda: add __func__ in SoundWire lcount() error logs

Make sure SoundWire lcount helpers have unique error logs, but a
common pattern for reporting issues.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230406152937.15347-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: max98363: Make soc_codec_dev_max98363 static
Tom Rix [Thu, 6 Apr 2023 15:23:00 +0000 (11:23 -0400)]
ASoC: max98363: Make soc_codec_dev_max98363 static

smatch reports
sound/soc/codecs/max98363.c:392:39: warning: symbol
  'soc_codec_dev_max98363' was not declared. Should it be static?

This variable is only used in one file so should be static.

Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20230406152300.1954292-1-trix@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: qcom: fixes for Click/Pop Noise
Mark Brown [Thu, 6 Apr 2023 15:02:24 +0000 (16:02 +0100)]
ASoC: qcom: fixes for Click/Pop Noise

Merge series from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:

Click/Pop Noise was a long pending issue with WSA Codecs which are prone
to accumlate DC when ports are active but without any data streams.
There are multiple places in the current setup, where this could happen
in both startup as well as shutdown path.

15 months agoASoC: qcom: sdw: do not restart soundwire ports for every prepare
Srinivas Kandagatla [Thu, 23 Mar 2023 16:44:01 +0000 (16:44 +0000)]
ASoC: qcom: sdw: do not restart soundwire ports for every prepare

unpreparing/disabling and preparing/reenabling soundwire ports is not required
for every prepare call, this add lots of click and pop noise if we do this in
middle of playback or capture.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230323164403.6654-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: qcom: q6apm-lpass-dai: close graphs before opening a new one
Srinivas Kandagatla [Thu, 23 Mar 2023 16:44:00 +0000 (16:44 +0000)]
ASoC: qcom: q6apm-lpass-dai: close graphs before opening a new one

On multiple prepare calls, its possible that the playback graphs are
not unloaded from the DSP, which can have some wierd side-effects,
one of them is that the data not consumed without any errors.

Fixes: c2ac3aec474d("ASoC: qcom: q6apm-lpass-dai: unprepare stream if its already prepared")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230323164403.6654-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt712-sdca: Add RT712 SDCA driver for Mic topology
Shuming Fan [Thu, 6 Apr 2023 08:55:35 +0000 (16:55 +0800)]
ASoC: rt712-sdca: Add RT712 SDCA driver for Mic topology

This is the initial codec driver for rt712 SDCA (Mic topology).
The host should connect with rt712 SdW2 interface.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20230406085535.52002-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: soc-dapm.c: tidyup dapm_connect_dai_pair()
Kuninori Morimoto [Wed, 5 Apr 2023 22:57:55 +0000 (22:57 +0000)]
ASoC: soc-dapm.c: tidyup dapm_connect_dai_pair()

dapm_connect_dai_pair() handles
"Normal/Codec2Codec" x "CPU/Codec" x "Playback/Capture".

(A) is "Codec2Codec" case of "CPU"   widget x "Playback/Capture",
(B) is "Normal"      case of "CPU"   widget x "Playback/Capture",
(C) is each          case of "Codec" widget.

(X) is handling "Playback" case DAI connecting,
(Y) is handling "Capture"  case DAI connecting.

static void dapm_connect_dai_pair(...)
{
...

(A) if (dai_link->params) {
playback_cpu = ...
capture_cpu = ...
(B) } else {
playback_cpu = ...
capture_cpu = ...
}

 ^ /* connect BE DAI playback if widgets are valid */
 | stream = SNDRV_PCM_STREAM_PLAYBACK;
 | (C) codec = codec_dai->playback_widget;
 |
 | if (playback_cpu && codec) {
(X) if (dai_link->params && !rtd->c2c_widget[stream]) {
 | ...
 | }
 |
 | (z) dapm_connect_dai_routes(...);
 v }

capture:
 ^ /* connect BE DAI capture if widgets are valid */
 | stream = SNDRV_PCM_STREAM_CAPTURE;
 | (C) codec = codec_dai->capture_widget;
 |
 | if (codec && capture_cpu) {
(Y) if (dai_link->params && !rtd->c2c_widget[stream]) {
 | ...
 | }
 |
 | (z) dapm_connect_dai_routes(...);
 v }
}

(X) part and (Y) part are almost same.
Main purpose of these parts (and this function) is calling
dapm_connect_dai_routes() (= z) on each cases.
The difference is "parameter"
(= Normal/Codec2Codec x CPU/Codec x Playback/Capture).

This patch cleanup these, but nothing changed for meaning.

Link: https://lore.kernel.org/r/87ilen6ni4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877cuqvswc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: clarify Codec2Codec params
Mark Brown [Wed, 5 Apr 2023 15:35:09 +0000 (16:35 +0100)]
ASoC: clarify Codec2Codec params

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

ASoC is supporting Codec2Codec, but its parameter name is
"params" and "num_params" which are very unclear naming.

This patch-set clarifies it by replacing to c2c_params / num_c2c_params.

15 months agoASoC: dt-bindings: wm8510: Convert to dtschema
Saalim Quadri [Wed, 5 Apr 2023 11:16:05 +0000 (16:46 +0530)]
ASoC: dt-bindings: wm8510: Convert to dtschema

Convert the WM8510 audio CODEC bindings to DT schema

Signed-off-by: Saalim Quadri <danascape@gmail.com>
Link: https://lore.kernel.org/r/20230405111605.5250-1-danascape@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: soc.h: remove unused params/num_params
Kuninori Morimoto [Sun, 2 Apr 2023 23:00:17 +0000 (23:00 +0000)]
ASoC: soc.h: remove unused params/num_params

No drivers are using params/num_params any more.
Let's remove these.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87iledc2ke.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: samsung: switch to use c2c_params instead of params
Kuninori Morimoto [Sun, 2 Apr 2023 23:00:07 +0000 (23:00 +0000)]
ASoC: samsung: switch to use c2c_params instead of params

ASoC is now using c2c_params instead of params. This patch replace it.
num_c2c_params (was num_params) was not mandatory before,
but let's set it by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87jzytc2kp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: meson: switch to use c2c_params instead of params
Kuninori Morimoto [Sun, 2 Apr 2023 22:59:57 +0000 (22:59 +0000)]
ASoC: meson: switch to use c2c_params instead of params

ASoC is now using c2c_params instead of params. This patch replace it.
num_c2c_params (was num_params) was not mandatory before,
but let's set it by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lej9c2ky.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: audio-graph-card2: switch to use c2c_params instead of params
Kuninori Morimoto [Sun, 2 Apr 2023 22:59:45 +0000 (22:59 +0000)]
ASoC: audio-graph-card2: switch to use c2c_params instead of params

ASoC is now using c2c_params instead of params. This patch replace it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87mt3pc2la.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: soc.h: clarify Codec2Codec params
Kuninori Morimoto [Sun, 2 Apr 2023 22:59:35 +0000 (22:59 +0000)]
ASoC: soc.h: clarify Codec2Codec params

snd_soc_dai_link has params/num_params, but it is unclear that
params for what. This patch clarify it is params for Codec2Codec.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o7o5c2lk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: ak4458: Convert to dtschema
Saalim Quadri [Tue, 28 Mar 2023 09:18:31 +0000 (14:48 +0530)]
ASoC: dt-bindings: ak4458: Convert to dtschema

Convert the AK4458 audio DAC bindings to DT schema.

Signed-off-by: Saalim Quadri <danascape@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230328091831.55690-1-danascape@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: core/Intel: Introduce DSPless mode
Mark Brown [Tue, 4 Apr 2023 17:40:48 +0000 (18:40 +0100)]
ASoC: SOF: core/Intel: Introduce DSPless mode

Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

This series will add support for SOF Linux stack to run without using the DSP.

DSPless mode provides a good tool for verification that the hardware itself
works correctly by taking the DSP use out from the picture.
It can only work with interfaces which supports this mode: Intel HDA at the
moment but with LNL it could be possible to support other audio interfaces.

The main driver for this mode is to be able to test programming sequences,
low-level code and for low-level verification of a platform.

The feature is not targetted for end-users and it will not make the SOF stack
to work on hardware without DSP, but it is giving us a tool to debug and enable
platforms earlier (when for example t he firmware is not mature enough).

15 months agoASoC: tegra20_ac97: Add missing unwind goto in tegra20_ac97_platform_probe()
Zihao Wang [Tue, 4 Apr 2023 08:46:22 +0000 (16:46 +0800)]
ASoC: tegra20_ac97: Add missing unwind goto in tegra20_ac97_platform_probe()

Smatch Warns:
sound/soc/tegra/tegra20_ac97.c:321 tegra20_ac97_platform_probe()
warn: missing unwind goto?

The goto will set the "soc_ac97_ops" and "soc_ac97_bus" operations to
NULL.  But they are already NULL at this point so it is a no-op.
However, just for consistency, change the direct return to a goto.  No
functional change.

Signed-off-by: Zihao Wang <u202012060@hust.edu.cn>
Reviewed-by: Dan Carpenter <error27@gmail.com>
Link: https://lore.kernel.org/r/20230404084622.1202-1-u202012060@hust.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: pci-tgl: Allow DSPless mode
Peter Ujfalusi [Tue, 4 Apr 2023 09:21:15 +0000 (12:21 +0300)]
ASoC: SOF: Intel: pci-tgl: Allow DSPless mode

set the dspless_mode_supported flag to true for tgl/adl family to allow
DSPless mode.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230404092115.27949-13-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: pci-skl: Allow DSPless mode
Peter Ujfalusi [Tue, 4 Apr 2023 09:21:14 +0000 (12:21 +0300)]
ASoC: SOF: Intel: pci-skl: Allow DSPless mode

set the dspless_mode_supported flag to true for skl family to allow
DSPless mode.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230404092115.27949-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: pci-mtl: Allow DSPless mode
Peter Ujfalusi [Tue, 4 Apr 2023 09:21:13 +0000 (12:21 +0300)]
ASoC: SOF: Intel: pci-mtl: Allow DSPless mode

set the dspless_mode_supported flag to true for mtl family to allow
DSPless mode.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Link: https://lore.kernel.org/r/20230404092115.27949-11-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>