platform/kernel/linux-starfive.git
16 months agoASoC: dt-bindings: cirrus,cs35l45: drop unneeded quotes
Krzysztof Kozlowski [Fri, 9 Jun 2023 14:06:58 +0000 (16:06 +0200)]
ASoC: dt-bindings: cirrus,cs35l45: drop unneeded quotes

Cleanup bindings dropping unneeded quotes. Once all these are fixed,
checking for this can be enabled in yamllint.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230609140658.64557-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoFix error check and cleanup for JH7110 TDM
Mark Brown [Fri, 9 Jun 2023 12:13:51 +0000 (13:13 +0100)]
Fix error check and cleanup for JH7110 TDM

Merge series from Walker Chen <walker.chen@starfivetech.com>:

Some minor issues were found during addtional testing and static
analysis. The first patch fix the error check for the return value of
devm_reset_control_array_get_exclusive(). The second patch drop some
unused macros.

16 months agoASoC: dt-bindings: audio-graph-card: Expand 'widgets' documentation
Marek Vasut [Tue, 6 Jun 2023 17:59:51 +0000 (19:59 +0200)]
ASoC: dt-bindings: audio-graph-card: Expand 'widgets' documentation

Document the encoding of 'widgets' property to avoid confusion.

Signed-off-by: Marek Vasut <marex@denx.de>
Link: https://lore.kernel.org/r/20230606175951.215740-1-marex@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: audio-graph-card2-custom-sample: add missing CPU:Codec = 1:N sample
Kuninori Morimoto [Fri, 9 Jun 2023 01:40:41 +0000 (01:40 +0000)]
ASoC: audio-graph-card2-custom-sample: add missing CPU:Codec = 1:N sample

It has CPU:Codec = 1:1 and N:N samples, but missing 1:N settings.
This patch adds it.

One note here is that because of registering timing, probing and
CPU/Codec numbering are mismatching.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ilbx1kh3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Add IPC3 Kernel Injector
Curtis Malainey [Thu, 8 Jun 2023 22:18:16 +0000 (15:18 -0700)]
ASoC: SOF: Add IPC3 Kernel Injector

Add debugfs path to fake a malicious firmware message for fuzzing purposes.

Skip IPC4 for initial integration

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-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>
Link: https://lore.kernel.org/r/20230608221822.2825786-2-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Refactor rx function for fuzzing
Curtis Malainey [Thu, 8 Jun 2023 22:18:15 +0000 (15:18 -0700)]
ASoC: SOF: Refactor rx function for fuzzing

Refactor the function so reading the data is done outside the work
function so fuzzing can pass data directly into the work callbacks.

Also expose the inner function outside the module so we can call it from
the injector.

Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-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>
Link: https://lore.kernel.org/r/20230608221822.2825786-1-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mediatek: mt8192-mt6359: Go back to old headphone pin name
Nícolas F. R. A. Prado [Thu, 8 Jun 2023 22:10:48 +0000 (18:10 -0400)]
ASoC: mediatek: mt8192-mt6359: Go back to old headphone pin name

This reverts commit cbbc0ec6dea09c ("ASoC: mediatek: mt8192-mt6359:
Remove " Jack" from Headphone pin name"). That commit removed the "
Jack" suffix with the reasoning that it is automatically added to the
name of the kcontrol created, which is true, but this name is also used
to look for the DAPM widget that will be toggled when the jack status is
updated. Since the widget is still called "Headphone Jack" the jack
can't link to the widget and the following error is shown:

mt8192_mt6359 sound: ASoC: DAPM unknown pin Headphone

It is not possible to also rename the headphone DAPM widget because its
name is used by a switch kcontrol, "Headphone Jack Switch", both to link
to the headphone widget and to assemble its name. This switch's name is
referenced in the upstream UCM file, so renaming it would break
userspace. Since the original commit didn't bring any benefit, besides
sparing a few CPU cycles, simply revert it.

Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Link: https://lore.kernel.org/r/20230608221050.217968-1-nfraprado@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: starfive: Remove some unused macros
Walker Chen [Thu, 8 Jun 2023 13:57:50 +0000 (21:57 +0800)]
ASoC: starfive: Remove some unused macros

These macros are unused and can be dropped.

Signed-off-by: Walker Chen <walker.chen@starfivetech.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230608135750.11041-3-walker.chen@starfivetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: starfive: Fix an error check in jh7110_tdm_clk_reset_get()
Walker Chen [Thu, 8 Jun 2023 13:57:49 +0000 (21:57 +0800)]
ASoC: starfive: Fix an error check in jh7110_tdm_clk_reset_get()

Fix the check for devm_reset_control_array_get_exclusive() return value.
The devm_reset_control_array_get_exclusive() function may return NULL if
it's an optional request. If optional is intended then NULL should not
be treated as an error case, but as a special kind of success case. So
here the IS_ERR() is used to check better.

Signed-off-by: Walker Chen <walker.chen@starfivetech.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230608135750.11041-2-walker.chen@starfivetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mt8188-mt6359: Cleanups
Mark Brown [Thu, 8 Jun 2023 15:07:32 +0000 (16:07 +0100)]
ASoC: mt8188-mt6359: Cleanups

Merge series from AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:

This series performs some cleanups to the mt8188-mt6359 driver,
including usage of bitfield macros, adding definitions of register
fields and some others for readability and consistency.

16 months agoASoC: tegra: Simplify code around clk_get_rate() handling
Christophe JAILLET [Thu, 8 Jun 2023 05:27:22 +0000 (07:27 +0200)]
ASoC: tegra: Simplify code around clk_get_rate() handling

clk_get_rate() returns an unsigned long, so there is no point in storing it
in a long, and test for negative values.

So, turn 'parent_rate' into an unsigned long, simplify the sanity check,
the error message and the return value, in case of error (i.e. 0).

Doing so also turns 'i' and 'valid_rates' into unsigned long, but it is
fine and harmless.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/53f928290f08f50ff43031e17fe1d88443c2c441.1686202022.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: max98088: clean up some inconsistent indenting
Jiapeng Chong [Thu, 8 Jun 2023 07:55:40 +0000 (15:55 +0800)]
ASoC: max98088: clean up some inconsistent indenting

No functional modification involved.

sound/soc/codecs/max98088.c:316 m98088_eq_band() warn: inconsistent indenting.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=5461
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230608075540.61575-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mediatek: mt8188-mt6359: Use bitfield macros for registers
AngeloGioacchino Del Regno [Thu, 8 Jun 2023 08:47:27 +0000 (10:47 +0200)]
ASoC: mediatek: mt8188-mt6359: Use bitfield macros for registers

Replace open coded instances of FIELD_GET() with it, move register
definitions at the top of the file and also replace magic numbers
with register definitions.

While at it, also change a regmap_update_bits() call to regmap_write()
because the top 29 bits of AUD_TOP_CFG (31:3) are reserved (unused).

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230608084727.74403-6-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mediatek: mt8188-mt6359: Clean up log levels
AngeloGioacchino Del Regno [Thu, 8 Jun 2023 08:47:26 +0000 (10:47 +0200)]
ASoC: mediatek: mt8188-mt6359: Clean up log levels

Change some dev_info prints to dev_err() and some to dev_dbg(),
depending on the actual severity of them.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230608084727.74403-5-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mediatek: mt8188-mt6359: Cleanup return 0 disguised as return ret
AngeloGioacchino Del Regno [Thu, 8 Jun 2023 08:47:25 +0000 (10:47 +0200)]
ASoC: mediatek: mt8188-mt6359: Cleanup return 0 disguised as return ret

Change all instances of `return ret` to `return 0` at the end of
functions where ret is always zero and also change functions
mt8188_{hdmi,dptx}_codec_init to be consistent with how other
functions are returning errors

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230608084727.74403-4-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mediatek: mt8188-mt6359: clean up a return in codec_init
Dan Carpenter [Thu, 8 Jun 2023 08:47:24 +0000 (10:47 +0200)]
ASoC: mediatek: mt8188-mt6359: clean up a return in codec_init

This code triggers a Smatch static checker warning and does sort of
look like an error path.

sound/soc/mediatek/mt8188/mt8188-mt6359.c:597 mt8188_max98390_codec_init() warn: missing error code? 'ret'

However, returning 0 is intentional.  Make that explicit.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230608084727.74403-3-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mediatek: mt8188-mt6359: Compress of_device_id entries
AngeloGioacchino Del Regno [Thu, 8 Jun 2023 08:47:23 +0000 (10:47 +0200)]
ASoC: mediatek: mt8188-mt6359: Compress of_device_id entries

Those entries fit in one line: compress them to reduce line count.
While at it, also add the sentinel comment to the last entry.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230608084727.74403-2-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: stm32: fix dtbs_check warnings
Mark Brown [Wed, 7 Jun 2023 20:16:47 +0000 (21:16 +0100)]
ASoC: stm32: fix dtbs_check warnings

Merge series from Olivier Moysan <olivier.moysan@foss.st.com>:

Fix dtbs_check warnings in STM32MP15 DK boards Devices Trees for
STM32 I2S and Cirrus CS42L51 codec.

- Add OF graph port property in I2S and CS42L51 DT bindings.
  Fixes warnings:
  audio-controller@4000b000: Unevaluated properties are not allowed
  ('port' was unexpected)
  cs42l51@4a: Unevaluated properties are not allowed
  ('port' was unexpected)
- Correct OF graph DAI audio format property for STM32MP15x Dkx I2S node

16 months agoASoC: codecs: wsa883x: use existing define instead of raw value
Krzysztof Kozlowski [Wed, 7 Jun 2023 17:13:26 +0000 (19:13 +0200)]
ASoC: codecs: wsa883x: use existing define instead of raw value

Use existing define for WSA883X_GLOBAL_PA_ENABLE instead of hard-coded
value, just like in other places in this driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230607171326.179527-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: HDA: two cleanups
Mark Brown [Wed, 7 Jun 2023 17:22:08 +0000 (18:22 +0100)]
ASoC: Intel: HDA: two cleanups

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

One removal of a non-existent Kconfig initialization and one
correction to enable SoundWire link when no HDaudio external codec is
detected. This will generate more information and help resolve cases
where the ACPI information is incorrect.

16 months agoASoC: mediatek: mt8188-mt6359: add i2c dependency
Arnd Bergmann [Wed, 7 Jun 2023 12:08:15 +0000 (14:08 +0200)]
ASoC: mediatek: mt8188-mt6359: add i2c dependency

The newly added driver is missing this dependency, causing a possible
build failure:

WARNING: unmet direct dependencies detected for SND_SOC_MAX98390
WARNING: unmet direct dependencies detected for SND_SOC_NAU8825
  Depends on [m]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=m]
  Selected by [y]:
  - SND_SOC_MT8188_MT6359 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_MT8188 [=y] && MTK_PMIC_WRAP [=y]
aarch64-linux-ld: sound/soc/codecs/max98390.o: in function `max98390_i2c_probe':
max98390.c:(.text+0x514): undefined reference to `__devm_regmap_init_i2c'

Fixes: 9f08dcbddeb30 ("ASoC: mediatek: mt8188-mt6359: support new board with nau88255")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230607120831.3587379-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Intel: hda-pcm: remove kernel parameter init
Pierre-Louis Bossart [Tue, 6 Jun 2023 22:25:29 +0000 (17:25 -0500)]
ASoC: SOF: Intel: hda-pcm: remove kernel parameter init

The 'hda_disable_rewinds' kernel parameter is initialized with a
non-existent CONFIG_SND_SOC_SOF_HDA_DISABLE_REWINDS.

We probably forgot to clean this up when this Kconfig option was
removed when upstreaming in 2021.

Reported-by: Ranjani Sridharan <ranjani.sridharan@linux.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: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230606222529.57156-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Intel: fix SoundWire/HDaudio mutual exclusion
Pierre-Louis Bossart [Tue, 6 Jun 2023 22:25:28 +0000 (17:25 -0500)]
ASoC: SOF: Intel: fix SoundWire/HDaudio mutual exclusion

The functionality described in Commit 61bef9e68dca ("ASoC: SOF: Intel: hda: enforce exclusion between HDaudio and SoundWire")
does not seem to be properly implemented with two issues that need to
be corrected.

a) The test used is incorrect when DisplayAudio codecs are not supported.

b) Conversely when only Display Audio codecs can be found, we do want
to start the SoundWire links, if any. That will help add the relevant
topologies and machine descriptors, and identify cases where the
SoundWire information in ACPI needs to be modified with a quirk.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20230606222529.57156-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: add snd_soc_get_stream_cpu()
Kuninori Morimoto [Thu, 1 Jun 2023 00:42:49 +0000 (00:42 +0000)]
ASoC: add snd_soc_get_stream_cpu()

We are using get_stream_cpu() to get CPU stream which cares
Codec2Codec. But it is static function for now, and we want to use it
from other files. This patch makes it global function.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fs7cj9mf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: soc.h: remove snd_soc_compr_ops :: trigger
Kuninori Morimoto [Thu, 1 Jun 2023 00:43:02 +0000 (00:43 +0000)]
ASoC: soc.h: remove snd_soc_compr_ops :: trigger

ASoC framework is not using trigger call-back for snd_soc_compr_ops.
This patch remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87edmwj9m1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: machine driver updates for 6.5
Mark Brown [Tue, 6 Jun 2023 15:41:59 +0000 (16:41 +0100)]
ASoC: Intel: machine driver updates for 6.5

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

An unusually large set of patches to deal with new SoundWire-based
platforms.

The bulk of the patches addresses support for MTL using RT712, RT713,
MAX98363, CS42L42 jack codec and amplifiers. The sof_sdw machine
driver had to be updated to remove limitations on number of codecs per
links, dai types, dai naming, etc. We also moved parts of the Realtek
and Maxim support in common code to avoid duplication.

Community users also reported two Dell SKUs which were not supported
in the mainline due to hardware permutations.

16 months agoASoC: dt-bindings: document audio of graph port for cs42l51
Olivier Moysan [Tue, 6 Jun 2023 11:56:03 +0000 (13:56 +0200)]
ASoC: dt-bindings: document audio of graph port for cs42l51

When linking the CS42L51 to another DAI component, according
to audio graph cards bindings, an OF graph port property is expected
in the node. Document the port property.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230606115605.1633595-3-olivier.moysan@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: dt-bindings: stm32: document audio of graph port for i2s
Olivier Moysan [Tue, 6 Jun 2023 11:56:02 +0000 (13:56 +0200)]
ASoC: dt-bindings: stm32: document audio of graph port for i2s

When linking the STM32 I2S to another DAI component, according
to audio graph cards bindings, an OF graph port property is expected
in the node. Document the port property.

Signed-off-by: Olivier Moysan <olivier.moysan@foss.st.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230606115605.1633595-2-olivier.moysan@foss.st.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mt8188: add new board support
Mark Brown [Mon, 5 Jun 2023 17:29:36 +0000 (18:29 +0100)]
ASoC: mt8188: add new board support

Merge series from Trevor Wu <trevor.wu@mediatek.com>:

In the series, we extend the capability of mt8188-mt6359 driver.

The following changes are included.
1. Divide ADDA BE dai into two dais for SOF.
2. Register hdmi/dp jack pins.
3. dai_fmt can be configured from device tree.
4. Add some I2S codecs support.

In addition, new compatible string "mediatek,mt8188-nau8825" is
included for a new board support.

16 months agoASoC: SOF: Intel: LunarLake preparation patches
Mark Brown [Mon, 5 Jun 2023 17:29:30 +0000 (18:29 +0100)]
ASoC: SOF: Intel: LunarLake preparation patches

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This patchset adds the changes required for the hda-dai extension to
deal with SSSP/DMIC/SoundWire starting with LunarLake, as well as the
new TLV IPC to provide the DMA stream_tag to the DSP firmware.

LunarLake support for SSP/DMIC is ready but is gated by the patch
"ASoC: SOF: Intel: shim: add enum for ACE 2.0 IP used in LunarLake"
currently only present in the SoundWire tree.

16 months agoASoC: SOF: Intel: hda: add helper to extract SoundWire link count
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:20 +0000 (15:56 -0500)]
ASoC: SOF: Intel: hda: add helper to extract SoundWire link count

The register changed with the HDaudio integration, the information is
present in the extended link descriptor and not in the SHIM.

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/20230602205620.310879-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Intel: mtl: prepare for code reuse
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:19 +0000 (15:56 -0500)]
ASoC: SOF: Intel: mtl: prepare for code reuse

Some functions can be used for newer LNL hardware.

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/20230602205620.310879-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: ipc4-topology: add DMA config TLV to IPC data
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:18 +0000 (15:56 -0500)]
ASoC: SOF: ipc4-topology: add DMA config TLV to IPC data

This patch adds a DMA config TLV structure and the relevant code to
copy this TLV after the gateway configuration. For now this is an
iso-functionality change, the TLVs are not configured just
yet. Additional patches will be needed for DMIC/SSP/ALH (aka
SoundWire).

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: ipc4-topology: introduce DMA config TLV
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:17 +0000 (15:56 -0500)]
ASoC: SOF: ipc4-topology: introduce DMA config TLV

Starting with LunarLake, the DMIC/SSP/SoundWire audio interfaces will
use the HDaudio DMA. This patch adds the DMA configuration structure
to be passed as a TLV appended at the end of each gateway
configuration.

This patch only provides the definitions for now, the TLV will be
added in the actual blobs separately for each interface.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: ipc4-topology: extend ALH-specific data structure
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:16 +0000 (15:56 -0500)]
ASoC: SOF: ipc4-topology: extend ALH-specific data structure

LunarLake introduces a new TLV blob passed to the firmware for DMA
configuration. This TLV structure is directly inspired by the ALH
multi-gateway structure used so far. This patch suggest a transition
to the more abstract structure with no references to ALH.

This is an iso-functionality redefinition of structure, the TLV will
be added in a follow-up patch.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Intel: hda-dai: add get_hlink callback
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:15 +0000 (15:56 -0500)]
ASoC: SOF: Intel: hda-dai: add get_hlink callback

The existing code for HDAudio DAIs cannot be extended to other types
of DAIs, specific programming sequences need to be abstracted
away.

This patch hides the mechanism to determine the multi-link structure
related to the DAI and program the LOSIDV register. An added benefit
is that we can remove all references to the codec DAI from what should
be a CPU dai configuration only.

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>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Intel: hda-dai: add calc_stream_format callback
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:14 +0000 (15:56 -0500)]
ASoC: SOF: Intel: hda-dai: add calc_stream_format callback

The existing code for HDAudio DAIs cannot be extended to other types
of DAIs, specific programming sequences need to be abstracted away.

This patch hides the stream format setup which is currently completely
related to the HDaudio codec setup - not something that will work for
other types of DAIs.

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>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Intel: hda-dai: add codec_dai_set_stream callback
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:13 +0000 (15:56 -0500)]
ASoC: SOF: Intel: hda-dai: add codec_dai_set_stream callback

The existing code for HDAudio DAIs cannot be extended to other types
of DAIs, specific programming sequences need to be abstracted
away. Start here with hiding the stream_tag needed by the HDAudio
codec_dai.

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>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SOF: Intel: hda-dai: add error checks to prevent static analysis warnings
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:56:12 +0000 (15:56 -0500)]
ASoC: SOF: Intel: hda-dai: add error checks to prevent static analysis warnings

make KCFLAGS='-fanalyzer' sound/soc/sof/intel/ reports several NULL
pointer dereference paths.

Example log:
ops = hda_dai_get_ops(substream, cpu_dai);
  |      |                          ^~~~~
  |      |                          |
  |      |               (14) return of NULL to ‘non_hda_dai_hw_params’ from ‘hda_dai_get_ops’
  |  353 |         sdev = widget_to_sdev(w);
  |  354 |         hext_stream = ops->get_hext_stream(sdev, cpu_dai, substream);
  |      |                       ~~~~~~~~~~~~~~~~~~~~
  |      |                          |
  |      |                          (15) dereference of NULL ‘ops’

The function hda_dai_get_ops() can return NULL, but the return value
is not checked across the board. It's not a problem today, since we do
check in the first use of the function, but static analysis tools are
not aware of the different ALSA stages. Rather than argue forever,
let's just add the error checks consistently and make sure this tool
can be added to the CI checks.

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/20230602205620.310879-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: soc-acpi: add Rex CS42l42 and MAX98363 SoundWire entries
Uday M Bhat [Fri, 2 Jun 2023 20:22:25 +0000 (15:22 -0500)]
ASoC: Intel: soc-acpi: add Rex CS42l42 and MAX98363 SoundWire entries

Add support to the following daughter card for rex:

SDW0: CS42l42 Headset
SDW2: MX98363 Speaker

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-29-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: Add support for Rex soundwire
Uday M Bhat [Fri, 2 Jun 2023 20:22:24 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: Add support for Rex soundwire

Add rex entry in the soundwire quirk table

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-28-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: Add support for MAX98363 codec
Uday M Bhat [Fri, 2 Jun 2023 20:22:23 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: Add support for MAX98363 codec

Add support for MAX98363 soundwire codec. Update build
configuration to include this codec.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-27-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: Modify maxim helper functions and structure names
Uday M Bhat [Fri, 2 Jun 2023 20:22:22 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: Modify maxim helper functions and structure names

Init function and structure names are modified to use maxim
instead of max98373. Card components and speaker names are
updated based on part id.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-26-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: Rename sof_sdw_max98373.c file to sof_sdw_maxim.c
Uday M Bhat [Fri, 2 Jun 2023 20:22:21 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: Rename sof_sdw_max98373.c file to sof_sdw_maxim.c

This is needed to use the common implementation for other maxim
soundwire codecs

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-25-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: Add helper function for cs42l42 codec
Uday M Bhat [Fri, 2 Jun 2023 20:22:20 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: Add helper function for cs42l42 codec

Helper functions added to support CS42l42 soundwire codec.
Build configuration is updated to include this codec.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-24-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: Add rpl_rt1019_rt5682 driver
Terry Cheong [Fri, 2 Jun 2023 20:22:19 +0000 (15:22 -0500)]
ASoC: Intel: Add rpl_rt1019_rt5682 driver

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

Reviewed-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Terry Cheong <htcheong@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-23-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: Sof_ssp_amp: Correcting author name.
Balamurugan C [Fri, 2 Jun 2023 20:22:18 +0000 (15:22 -0500)]
ASoC: Intel: Sof_ssp_amp: Correcting author name.

Corrected the author name camel case and initial.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Balamurugan C <balamurugan.c@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-22-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: ADL: Moving amp only boards into end of the table.
Balamurugan C [Fri, 2 Jun 2023 20:22:17 +0000 (15:22 -0500)]
ASoC: Intel: ADL: Moving amp only boards into end of the table.

Moving amp only boards into end of the match table to have
better order and maintenance.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Balamurugan C <balamurugan.c@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: ADL: Enable HDMI-In capture feature support for non-I2S codec boards.
Balamurugan C [Fri, 2 Jun 2023 20:22:16 +0000 (15:22 -0500)]
ASoC: Intel: ADL: Enable HDMI-In capture feature support for non-I2S codec boards.

Adding HDMI-In capture support for the products doesn't have onboard
I2S codec.but need to support HDMI-In capture via I2S and audio playback
through HDMI/DP monitor.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Balamurugan C <balamurugan.c@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof-sdw: add Dell SKU 0B34
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:22:15 +0000 (15:22 -0500)]
ASoC: Intel: sof-sdw: add Dell SKU 0B34

This device has no 3.5mm jack, only a single amplifier and mic codec.

Closes: https://github.com/thesofproject/linux/issues/4399
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: soc-acpi: add tables for Dell SKU 0B34
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:22:14 +0000 (15:22 -0500)]
ASoC: Intel: soc-acpi: add tables for Dell SKU 0B34

Yet another permutation of devices.

Closes: https://github.com/thesofproject/linux/issues/4399
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: add quick for Dell SKU 0BDA
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:22:13 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: add quick for Dell SKU 0BDA

The SKU numbering isn't quite consistent with the existing RaptorLake
SKUs but the PCI ID is definitively RaptorLake.

Closes: https://github.com/thesofproject/linux/issues/4380
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: soc-acpi: add table for RPL Dell SKU 0BDA
Pierre-Louis Bossart [Fri, 2 Jun 2023 20:22:12 +0000 (15:22 -0500)]
ASoC: Intel: soc-acpi: add table for RPL Dell SKU 0BDA

This is a standard configuration we've seen before for TGL.

Closes: https://github.com/thesofproject/linux/issues/4380
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: increase sdw pin index for each sdw link
Bard Liao [Fri, 2 Jun 2023 20:22:11 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: increase sdw pin index for each sdw link

To support multiple codecs per SoundWire link, we have to assign multiple
CPU DAIs to different DAI links sharing the same physical link. This is
not possible with the existing code since we assume that only 'Pin2' is
used for playback and 'Pin3' used for capture - additional DAIs cannot
be handled.

This patch enables more CPU DAIs to be used, e.g. "SDW0 Pin2",
"SDW0 Pin3", and "SDW0 Pin4" for SDW0-Playback-SimpleJack,
SDW0-Capture-SimpleJack, and SDW0-Playback-SmartAmp DAI links on physical
link #0.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: add rt713 support
Bard Liao [Fri, 2 Jun 2023 20:22:10 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: add rt713 support

rt713 is rt712 but without amp.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: soc-acpi-intel-mtl-match: add rt712 ID
Bard Liao [Fri, 2 Jun 2023 20:22:09 +0000 (15:22 -0500)]
ASoC: Intel: soc-acpi-intel-mtl-match: add rt712 ID

Add rt712 ID for MTL.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: soc-acpi-intel-tgl-match: add rt712 ID
Bard Liao [Fri, 2 Jun 2023 20:22:08 +0000 (15:22 -0500)]
ASoC: Intel: soc-acpi-intel-tgl-match: add rt712 ID

Add rt712 ID for TGL.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: add rt712 support
Bard Liao [Fri, 2 Jun 2023 20:22:07 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: add rt712 support

Rt712 is a multi function codec which shpports headset, amp, and dmic
functions. Rt712 has two sdw interfaces and codec drivers, one for jack
and amp, the other for dmic. part id 0x712 is for jack and amp, and 0x1712
is for dmic.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: make rt711_sdca be generic
Bard Liao [Fri, 2 Jun 2023 20:22:06 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: make rt711_sdca be generic

Let rename rt711_sdca to rt_sdca_jack and let it be used for all
Realtek sdca jacks.
The commit uses component->name_prefix to construct card->components,
and determine which codec it is. So, we have to set name_prefix
properly.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: rename SOF_RT711_JDSRC to SOF_JACK_JDSRC
Bard Liao [Fri, 2 Jun 2023 20:22:05 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: rename SOF_RT711_JDSRC to SOF_JACK_JDSRC

Jack Detection source can be applied to all jacks, not only rt711.
No function changes.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw_rt_sdca_jack_common: test SOF_JACK_JDSRC in _exit
Bard Liao [Fri, 2 Jun 2023 20:22:04 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw_rt_sdca_jack_common: test SOF_JACK_JDSRC in _exit

if (!SOF_RT711_JDSRC(sof_sdw_quirk)) is tested in rt711_sdca_add_codec_
device_props(), and we don't add software node to the device if jack
source is not set. We need to do the same test in
sof_sdw_rt711_sdca_exit(), and avoid removing software node if jack
source is not set.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: add multi dailink support for a codec
Bard Liao [Fri, 2 Jun 2023 20:22:03 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: add multi dailink support for a codec

A codec may support multiple dais for different purpose. For example,
the rt712 codec supports jack and amp on different dais and machine
driver needs to create different dailink for those dais.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sdw_sof: append dai_type and remove codec_type
Bard Liao [Fri, 2 Jun 2023 20:22:02 +0000 (15:22 -0500)]
ASoC: Intel: sdw_sof: append dai_type and remove codec_type

We append codec type to dailink name to distinguish different dailink
on the same sdw link and direction. But we could create multi dailinks
for a codec and the dailink name will be duplicated if we append codec
type to the dailink name.
Appending dai type instead of codec type can solve the issue.
For example, if a codec supports JACK on dai 0 and AMP on dai 1, the
existing code will create dailinks
SDW0-Playback-SimpleJack or SDW0-Playback-SmartAmp for both dailinks,
and it will be SDW0-Playback-SimpleJack for dailink 0 and
SDW0-Playback-SmartAmp for dailink 1 after this change.
Then codec type is not used any more and can be removed.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: add codec_info pointer
Bard Liao [Fri, 2 Jun 2023 20:22:01 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: add codec_info pointer

codec_info_list[codec_index] is used multiple times in the
create_sdw_dailink() function. Adding a codec_info pointer to shorten
the code. This is a preparation for the following up patches.
No function changed.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: use predefine dailink id
Bard Liao [Fri, 2 Jun 2023 20:22:00 +0000 (15:22 -0500)]
ASoC: Intel: sof_sdw: use predefine dailink id

Currently, we assign dailink ids in order, and shift with codec type.
The purpose is to have consistent dailink ids for topologies.
This can be simplified if we have a predefined dailink id in
sof_sdw_dai_info.
We reuse the existing ids as the predefine ids. So the dailink ids will
not be changed by this commit.
With this change, we no longer need to check the adr order described in a
snd_soc_acpi_link_adr array.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: add dai info
Bard Liao [Fri, 2 Jun 2023 20:21:59 +0000 (15:21 -0500)]
ASoC: Intel: sof_sdw: add dai info

The existing code create a dailink for a codec. However, we may need
multi dailinks for a codec. This commit adds a new struct in
sof_sdw_codec_info{} to store the dai info of a codec.
The initial assumption if that we will create at most 3 dailink types
for a codec, since this is the max known with upcoming SDCA devices. We
may need to increase this number as new SDCA 'functions' become available.

One strong assumption is that all dailinks exposed are independent, as per
SDCA directions.

This commit just moves some items into the new sof_sdw_dai_info struct.
There is no function changed. Multi dais supported will be added in the
follow up commits.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_sdw: add missing exit callback
Bard Liao [Fri, 2 Jun 2023 20:21:58 +0000 (15:21 -0500)]
ASoC: Intel: sof_sdw: add missing exit callback

Somehow .exit = sof_sdw_rt_amp_exit was missing in rt1318 codec info.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230602202225.249209-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: amd: vangogh: select CONFIG_SND_AMD_ACP_CONFIG
Arnd Bergmann [Mon, 5 Jun 2023 08:58:29 +0000 (10:58 +0200)]
ASoC: amd: vangogh: select CONFIG_SND_AMD_ACP_CONFIG

The vangogh driver just gained a link time dependency that now causes
randconfig builds to fail:

x86_64-linux-ld: sound/soc/amd/vangogh/pci-acp5x.o: in function `snd_acp5x_probe':
pci-acp5x.c:(.text+0xbb): undefined reference to `snd_amd_acp_find_config'

Fixes: e89f45edb747e ("ASoC: amd: vangogh: Add check for acp config flags in vangogh platform")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230605085839.2157268-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoAdd NAU8825C support
Mark Brown [Mon, 5 Jun 2023 12:11:17 +0000 (13:11 +0100)]
Add NAU8825C support

Merge series from David Lin <CTLIN0@nuvoton.com>:

This series adds nau8825c support. The driver can be used on
NAU8825B and NAU8825C.

17 months agoASoC: amd: vangogh: select CONFIG_SND_AMD_ACP_CONFIG
Arnd Bergmann [Fri, 2 Jun 2023 12:44:39 +0000 (14:44 +0200)]
ASoC: amd: vangogh: select CONFIG_SND_AMD_ACP_CONFIG

The vangogh driver just gained a link time dependency that now causes
randconfig builds to fail:

x86_64-linux-ld: sound/soc/amd/vangogh/pci-acp5x.o: in function `snd_acp5x_probe':
pci-acp5x.c:(.text+0xbb): undefined reference to `snd_amd_acp_find_config'

Fixes: e89f45edb747e ("ASoC: amd: vangogh: Add check for acp config flags in vangogh platform")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230602124447.863476-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: mediatek,mt8188-mt6359: add NAU8825 support
Trevor Wu [Fri, 26 May 2023 09:31:50 +0000 (17:31 +0800)]
ASoC: dt-bindings: mediatek,mt8188-mt6359: add NAU8825 support

Add compatible string "mediatek,mt8188-nau8825" to support new board
with nau8825 codec.

Introduce two properties "dai-format" and "mediatek,clk-provider" under
dai-link subnode to configure dai-link parameters via dts.

"codec" property is removed from required property of dai-link subnode.
For co-clock case, it's possible two dai-links should be configured to
the same dai format, but only one cpu dai is bound with codec.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230526093150.22923-8-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: mediatek: mt8188-mt6359: support new board with nau88255
Trevor Wu [Fri, 26 May 2023 09:31:49 +0000 (17:31 +0800)]
ASoC: mediatek: mt8188-mt6359: support new board with nau88255

This patch adds multiple i2s codecs support including NAU88L25,
MAX98390, and the dumb amp like NAU8318 usage. In addition, dmic-codec
is also added to skip the beginning pop noise.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230526093150.22923-7-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-dapm.c: clean up debugfs for freed widget
Trevor Wu [Fri, 26 May 2023 09:31:48 +0000 (17:31 +0800)]
ASoC: soc-dapm.c: clean up debugfs for freed widget

When a widget is added to dapm via snd_soc_dapm_new_widgets,
dapm_debugfs_add_widget is also called to create a corresponding debugfs
file. However, when a widget is freed by snd_soc_dapm_free_widget, the
corresponding debugfs is not cleared. As a result, the freed widget is
still seen in the dapm directory.

This patch adds dapm_debugfs_free_widget to free the debugfs of a
specified widget, and it's called at snd_soc_dapm_free_widget to clean
up the debugfs for freed widget.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230526093150.22923-6-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: mediatek: common: soundcard driver add dai_fmt support
Trevor Wu [Fri, 26 May 2023 09:31:47 +0000 (17:31 +0800)]
ASoC: mediatek: common: soundcard driver add dai_fmt support

There are two changes included in the patch.

First, add set_dailink_daifmt() function, so dai_fmt can be updated by
the configuration in dai-link sub node.

Second, remove codec phandle from required property in dai-link sub node.
For example, user possibly needs to update dai-format for all etdm
co-clock dai-links, but codec doesn't need to be specified in capture
dai-link for a speaker amp.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230526093150.22923-5-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: mediatek: mt8188-mt6359: register hdmi/dp jack pins
Trevor Wu [Fri, 26 May 2023 09:31:46 +0000 (17:31 +0800)]
ASoC: mediatek: mt8188-mt6359: register hdmi/dp jack pins

Some userspace applications need jack control events, so register hdmi
and dp jack pins to activate jack control events.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230526093150.22923-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name
Trevor Wu [Fri, 26 May 2023 09:31:45 +0000 (17:31 +0800)]
ASoC: dt-bindings: mediatek,mt8188-mt6359: remove ADDA_BE from link-name

ADDA_BE is used to connect to mt6359. For machine mt8188-mt6359, codec
for ADDA_BE must be mt6359 which are configured on the machine driver.
Besides, ADDA_BE is divided into two dais, UL_SRC_BE and DL_SRC_BE.
As a result, remove ADDA_BE from items of link-name.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230526093150.22923-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: mediatek: mt8188: separate ADDA playback dai from capture dai
Trevor Wu [Fri, 26 May 2023 09:31:44 +0000 (17:31 +0800)]
ASoC: mediatek: mt8188: separate ADDA playback dai from capture dai

MT8188 will support SOF. In SOF, be_hw_params_fixup callback are used to
configure BE hardware parameters. However, playback and capture stream
share the same callback function in which it can't know the stream type.

It's possible to require different parameters for playback and capture
stream, so separate them into two dais for SOF usage.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Link: https://lore.kernel.org/r/20230526093150.22923-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: nau8825: Update output control for NAU8825C
David Lin [Fri, 2 Jun 2023 04:09:24 +0000 (12:09 +0800)]
ASoC: nau8825: Update output control for NAU8825C

Update the output control for NAU8825C.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230602040924.188913-4-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: nau8825: Update the calculation of FLL for NAU8825C
David Lin [Fri, 2 Jun 2023 04:09:23 +0000 (12:09 +0800)]
ASoC: nau8825: Update the calculation of FLL for NAU8825C

The FLL is updated to 24 bit with lower power consumption.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230602040924.188913-3-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: nau8825: Add registers patch for NAU8825C
David Lin [Fri, 2 Jun 2023 04:09:22 +0000 (12:09 +0800)]
ASoC: nau8825: Add registers patch for NAU8825C

The patch is to update default regmap and register a set of registers
for NAU8825C.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230602040924.188913-2-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoAdd TDM audio on StarFive JH7110
Mark Brown [Thu, 1 Jun 2023 15:43:46 +0000 (16:43 +0100)]
Add TDM audio on StarFive JH7110

Merge series from Walker Chen <walker.chen@starfivetech.com>:

This patchset adds TDM audio driver for the StarFive JH7110 SoC. The
first patch adds device tree binding for TDM module. The second patch
adds tdm driver support for JH7110 SoC. The last patch adds device tree
node and pins configuration of tdm to JH7110 dts.

The series has been tested on the VisionFive 2 board by plugging an
audio expansion board.

For more information of audio expansion board, you can take a look
at the following webpage:
https://wiki.seeedstudio.com/ReSpeaker_2_Mics_Pi_HAT/

17 months agoASoC: SOF: mediatek: add adsp debug dump
Trevor Wu [Thu, 1 Jun 2023 03:49:39 +0000 (11:49 +0800)]
ASoC: SOF: mediatek: add adsp debug dump

Add mt8188 and mt8186 .dbg_dump callback to print some information when
DSP panic occurs.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230601034939.15802-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agofirmware: cs_dsp: Log that a bin file was loaded
Richard Fitzgerald [Wed, 31 May 2023 17:01:58 +0000 (18:01 +0100)]
firmware: cs_dsp: Log that a bin file was loaded

Change the message at the start of bin file loading from
cs_dsp_dbg() to cs_dsp_info() so that there is confirmation
in the kernel log that a bin file was loaded, and the name
of the file.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230531170158.2744700-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: starfive: Add JH7110 TDM driver
Walker Chen [Fri, 26 May 2023 14:54:01 +0000 (22:54 +0800)]
ASoC: starfive: Add JH7110 TDM driver

Add tdm driver support for the StarFive JH7110 SoC.

Signed-off-by: Walker Chen <walker.chen@starfivetech.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230526145402.450-3-walker.chen@starfivetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: Add TDM controller bindings for StarFive JH7110
Walker Chen [Fri, 26 May 2023 14:54:00 +0000 (22:54 +0800)]
ASoC: dt-bindings: Add TDM controller bindings for StarFive JH7110

Add bindings for TDM driver which supports multi-channel audio playback
and capture on JH7110 platform.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Walker Chen <walker.chen@starfivetech.com>
Link: https://lore.kernel.org/r/20230526145402.450-2-walker.chen@starfivetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: minor cleanup for soc_get_playback_capture()
Mark Brown [Wed, 31 May 2023 15:37:39 +0000 (16:37 +0100)]
ASoC: minor cleanup for soc_get_playback_capture()

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

This is minor cleanup patches for soc_get_playback_capture().

17 months agoASoC: nau8825: Add the management of headset detection for power saving
David Lin [Wed, 31 May 2023 07:53:35 +0000 (15:53 +0800)]
ASoC: nau8825: Add the management of headset detection for power saving

The patch is to manage HSD feature for power saving. The detail is to
disable HSD feature after the headset detection is done. When the jack
is inserted, the HSD feature will be enabled again.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20230531075334.168637-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-pcm.c: tidyup playback/capture_only at soc_get_playback_capture()
Kuninori Morimoto [Tue, 30 May 2023 00:50:08 +0000 (00:50 +0000)]
ASoC: soc-pcm.c: tidyup playback/capture_only at soc_get_playback_capture()

soc_get_playback_capture() (A) returns number of substreams for
playback/capture, and then, we can use playback/capture_only flag (X)(Y).

(A)     static int soc_get_playback_capture(...)
{
...
(X) if (dai_link->playback_only) {
(*) *playback = 1;
*capture = 0;
}

(Y) if (dai_link->capture_only) {
*playback = 0;
(*) *capture = 1;
}
...
}

But this flag should not have effect to opposite side stream (*).
This patch tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87sfbezlq8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-pcm.c: use temporary variable at soc_get_playback_capture()
Kuninori Morimoto [Tue, 30 May 2023 00:50:01 +0000 (00:50 +0000)]
ASoC: soc-pcm.c: use temporary variable at soc_get_playback_capture()

soc_get_playback_capture() (A) returns number of substreams for
playback/capture (B).

(A) static int soc_get_playback_capture(...,
(B) int *playback, int *capture)
{
...
for_each_xxx(...) {
if (xxx)
return -EINVAL;
=> *playback = 1;
...
=> *capture = 1;
...
}
...
}

But, it is directly updating playback/capture which is the result of this
function even though it might be error. It should be updated in case of
succeed only. This patch updates it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87ttvuzlqe.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-pcm.c: cleanup soc_get_playback_capture() error
Kuninori Morimoto [Tue, 30 May 2023 00:49:56 +0000 (00:49 +0000)]
ASoC: soc-pcm.c: cleanup soc_get_playback_capture() error

soc_get_playback_capture() (A) checks dai_link status, and indicate error
if it was not matching (B).

(A) static int soc_get_playback_capture(...)
{
...
 ^ if (dai_link->dynamic && dai_link->num_cpus > 1) {
 | dev_err(rtd->dev,
(B) "DPCM doesn't support Multi CPU for Front-Ends yet\n");
 | return -EINVAL;
 v }
...
}

We can use 100 char for 1 line today. This patch cleanup error code line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87v8gazlqk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-pcm.c: use dai_link on soc_get_playback_capture()
Kuninori Morimoto [Tue, 30 May 2023 00:49:50 +0000 (00:49 +0000)]
ASoC: soc-pcm.c: use dai_link on soc_get_playback_capture()

soc_get_playback_capture() (A) is using rtd->dai_link->xxx everywhere.
Because of that, 1 line is unnecessarily long and not readable.

(A) static int soc_get_playback_capture(...)
{
if (rtd->dai_link->dynamic ...) {
    ^^^^^^^^^^^^^
...
} else {
int cpu_capture = rtd->dai_link->c2c_params ?
  ^^^^^^^^^^^^^
...
}

if (rtd->dai_link->playback_only) {
    ^^^^^^^^^^^^^
...
}
...
}

This patch uses variable "dai_link" to be clear code.
Nothing changes the meanings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87wn0qzlqp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-pcm.c: indicate error if stream has no playback no capture
Kuninori Morimoto [Tue, 30 May 2023 00:49:43 +0000 (00:49 +0000)]
ASoC: soc-pcm.c: indicate error if stream has no playback no capture

soc_get_playback_capture() (A) returns number of substreams for
playback/capture (B).
ASoC will probe the Sound Card and mapps CPU<->Codec pair.

(A) static int soc_get_playback_capture(...,
(B)     int *playback, int *capture)
{
...
if (rtd->dai_link->playback_only) {
*playback = 1;
*capture = 0;
}

if (rtd->dai_link->capture_only) {
*playback = 0;
*capture = 1;
}
(C)
return 0;
}

But it might be no playback no capture if it returns playback=0, capture=0.
It is very difficult to notice about it. This patch indicates error at (C)
then.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87y1l6zlqx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoES8316 audio codec fixes on Rock5B
Mark Brown [Tue, 30 May 2023 19:41:29 +0000 (20:41 +0100)]
ES8316 audio codec fixes on Rock5B

Merge series from Cristian Ciocaltea <cristian.ciocaltea@collabora.com>:

This patch series handles a few issues related to the ES8316 audio
codec, discovered while doing some testing on the Rock 5B board.

17 months agoASoC: es8316: Do not set rate constraints for unsupported MCLKs
Cristian Ciocaltea [Tue, 30 May 2023 18:11:39 +0000 (21:11 +0300)]
ASoC: es8316: Do not set rate constraints for unsupported MCLKs

When using the codec through the generic audio graph card, there are at
least two calls of es8316_set_dai_sysclk(), with the effect of limiting
the allowed sample rates according to the MCLK/LRCK ratios supported by
the codec:

1. During audio card setup, to set the initial MCLK - see
   asoc_simple_init_dai().

2. Before opening a stream, to update MCLK, according to the stream
   sample rate and the multiplication factor - see
   asoc_simple_hw_params().

In some cases the initial MCLK might be set to a frequency that doesn't
match any of the supported ratios, e.g. 12287999 instead of 12288000,
which is only 1 Hz below the supported clock, as that is what the
hardware reports. This creates an empty list of rate constraints, which
is further passed to snd_pcm_hw_constraint_list() via
es8316_pcm_startup(), and causes the following error on the very first
access of the sound card:

  $ speaker-test -D hw:Analog,0 -F S16_LE -c 2 -t wav
  Broken configuration for playback: no configurations available: Invalid argument
  Setting of hwparams failed: Invalid argument

Note that all subsequent retries succeed thanks to the updated MCLK set
at point 2 above, which uses a computed frequency value instead of a
reading from the hardware registers. Normally this would have mitigated
the issue, but es8316_pcm_startup() executes before the 2nd call to
es8316_set_dai_sysclk(), hence it cannot make use of the updated
constraints.

Since es8316_pcm_hw_params() performs anyway a final validation of MCLK
against the stream sample rate and the supported MCLK/LRCK ratios, fix
the issue by ensuring that sysclk_constraints list is only set when at
least one supported sample rate is autodetected by the codec.

Fixes: b8b88b70875a ("ASoC: add es8316 codec driver")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20230530181140.483936-3-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: es8316: Increment max value for ALC Capture Target Volume control
Cristian Ciocaltea [Tue, 30 May 2023 18:11:38 +0000 (21:11 +0300)]
ASoC: es8316: Increment max value for ALC Capture Target Volume control

The following error occurs when trying to restore a previously saved
ALSA mixer state (tested on a Rock 5B board):

  $ alsactl --no-ucm -f /tmp/asound.state store hw:Analog
  $ alsactl --no-ucm -I -f /tmp/asound.state restore hw:Analog
  alsactl: set_control:1475: Cannot write control '2:0:0:ALC Capture Target Volume:0' : Invalid argument

According to ES8316 datasheet, the register at address 0x2B, which is
related to the above mixer control, contains by default the value 0xB0.
Considering the corresponding ALC target bits (ALCLVL) are 7:4, the
control is initialized with 11, which is one step above the maximum
value allowed by the driver:

 ALCLVL | dB gain
 -------+--------
  0000  |  -16.5
  0001  |  -15.0
  0010  |  -13.5
  ....  |  .....
  0111  |   -6.0
  1000  |   -4.5
  1001  |   -3.0
  1010  |   -1.5
  ....  |  .....
  1111  |   -1.5

The tests performed using the VU meter feature (--vumeter=TYPE) of
arecord/aplay confirm the specs are correct and there is no measured
gain if the 1011-1111 range would have been mapped to 0 dB:

 dB gain | VU meter %
 --------+-----------
   -6.0  |  30-31
   -4.5  |  35-36
   -3.0  |  42-43
   -1.5  |  50-51
    0.0  |  50-51

Increment the max value allowed for ALC Capture Target Volume control,
so that it matches the hardware default.  Additionally, update the
related TLV to prevent an artificial extension of the dB gain range.

Fixes: b8b88b70875a ("ASoC: add es8316 codec driver")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20230530181140.483936-2-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: topology: allow for partial dailink stream_name
Mark Brown [Tue, 30 May 2023 16:43:11 +0000 (17:43 +0100)]
ASoC: topology: allow for partial dailink stream_name

Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

The topology file and the machine driver rely on common definitions
for the dailink stream_name.  To avoid any backwards-compatibility
problems, the machine driver stream names are set in stone and cannot
be modified.

This is problematic when we try to name some of the topology widgets
after the stream_name, since the widget name is limited to 44
characters

tools/include/uapi/sound/asound.h:#define SNDRV_CTL_ELEM_ID_NAME_MAXLEN 44

Existing examples include "Analog Playback and Capture" for HDaudio
dailinks, which leaves less than 20 chars to identify widgets/controls
with a meaningful name.

Since the 44-char limit is part of the UAPI definitions, we assumed
there is no way to increase it.

This patchset suggests instead a partial match which allows topology
files to use a shorter stream_name, which in turn allows for
self-explanatory widget names that comply with the 44-char limit.

This should not break any existing setup but with the introduction of
a partial match new dailinks should be named carefully to avoid
confusions between e.g. 'link1' and 'link10'. The last patch fixes
such an issue in the 'nocodec' test topology used by Intel.

17 months agoASoC: SOF: add mt8188 audio support
Mark Brown [Tue, 30 May 2023 16:43:05 +0000 (17:43 +0100)]
ASoC: SOF: add mt8188 audio support

Merge series from Trevor Wu <trevor.wu@mediatek.com>:

This adds mt8188 audio support.

17 months agoASoC: SOF: Intel: HDA: Limit the number of dai drivers for nocodec mode
Ranjani Sridharan [Fri, 26 May 2023 20:41:49 +0000 (15:41 -0500)]
ASoC: SOF: Intel: HDA: Limit the number of dai drivers for nocodec mode

With a common kernel config for nocodec and codec modes, the number of DAI
drivers will be set to 15 for nocodec as well. So adjust this when set
the machine params for the nocodec mode if the debug flag is set.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.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/20230526204149.456068-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: topology: Use partial match for connecting DAI link and DAI widget
Ranjani Sridharan [Fri, 26 May 2023 20:41:48 +0000 (15:41 -0500)]
ASoC: SOF: topology: Use partial match for connecting DAI link and DAI widget

This allows setting shorter names for the widget stream names in
topology. For example, in the case of HDA Analog DAI link, the stream
name is "Analog Playback and Capture". But it is enough to match "Analog"
in the DAI link stream name with a widget's stream name. This is needed
to set more meaningful names for the DAI widgets using the stream name
in topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.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/20230526204149.456068-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: topology: Allow partial matching when finding DAI link
Ranjani Sridharan [Fri, 26 May 2023 20:41:47 +0000 (15:41 -0500)]
ASoC: topology: Allow partial matching when finding DAI link

This allows for setting shorter link names in topology. For example,
for the HDA Analog DAI link, just "Analog" would suffice instead of
"Analog Playback and Capture"

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
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>
Link: https://lore.kernel.org/r/20230526204149.456068-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>