platform/kernel/linux-starfive.git
12 months agoASoC: topology: Log control load errors in soc_tplg_control_load()
Amadeusz Sławiński [Fri, 19 May 2023 19:56:07 +0000 (21:56 +0200)]
ASoC: topology: Log control load errors in soc_tplg_control_load()

Simplify code by logging any errors in function that does the actual
work instead of doing so in its callers.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230519195611.4068853-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Bugfixes and efficiency improvement
Mark Brown [Fri, 19 May 2023 03:32:36 +0000 (12:32 +0900)]
ASoC: cs35l56: Bugfixes and efficiency improvement

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

First two patches are bugfixes.
Third patch skips the overhead of rebooting the amp after applying
firmware files when we know that it isn't necessary.

12 months agoMerge tag 'v6.4-rc2' into asoc-6.5 to get fixes for CI
Mark Brown [Fri, 19 May 2023 03:32:04 +0000 (12:32 +0900)]
Merge tag 'v6.4-rc2' into asoc-6.5 to get fixes for CI

Linux 6.4-rc2

12 months agoASoC: cs35l56: In secure mode skip SHUTDOWN and RESET around fw download
Simon Trimmer [Thu, 18 May 2023 15:02:50 +0000 (16:02 +0100)]
ASoC: cs35l56: In secure mode skip SHUTDOWN and RESET around fw download

If the device is in secure mode it's unnecessary to send a SHUTDOWN and
SYSTEM_RESET around the firmware download. It could only be patching
insecure tunings. A tuning patch doesn't need a SHUTDOWN and only needs
a REINIT afterwards. This will reduce the overhead of exiting system
suspend in secure mode.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/Message-Id:
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: sdw_write_no_pm() should be performed under a pm_runtime request
Simon Trimmer [Thu, 18 May 2023 15:02:49 +0000 (16:02 +0100)]
ASoC: cs35l56: sdw_write_no_pm() should be performed under a pm_runtime request

SoundWire bus accesses must be performed under the guard of a pm_runtime
request, in this case the write was being performed just after the
request had been put() and so the bus could not be guaranteed to be
available.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/Message-Id:
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoASoC: cs35l56: Move DSP part string generation so that it is done only once
Simon Trimmer [Thu, 18 May 2023 15:02:48 +0000 (16:02 +0100)]
ASoC: cs35l56: Move DSP part string generation so that it is done only once

Each time we go through dsp_work() it does a devm_kasprintf() to
allocate memory to hold the part name string. It's not strictly a memory
leak because devm will free it all if the driver is removed. But we keep
allocating more and more memory to hold the same string.

Move the allocation so that it is performed after the version and
secured state information is gathered and handle allocation errors.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/Message-Id:
Signed-off-by: Mark Brown <broonie@kernel.org>
12 months agoAdd Chameleon v3 ASoC audio
Mark Brown [Thu, 18 May 2023 22:27:08 +0000 (07:27 +0900)]
Add Chameleon v3 ASoC audio

Merge series from Paweł Anikiel <pan@semihalf.com>:

The Google Chameleon v3 is a device made for testing audio and video
paths of other devices. This patchset adds support for ASoC audio on
this device. It has two audio sources: HDMI audio from the it68051 chip
(RX only), and analog audio from the ssm2603 chip (RX and TX).

The patchset adds the ASoC platform and codec drivers.

12 months agoASoC: codecs: do not store status in state containe
Mark Brown [Thu, 18 May 2023 17:11:12 +0000 (02:11 +0900)]
ASoC: codecs: do not store status in state containe

Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:

Many SoundWire CODEC drivers store the device status in a member
variable in the driver data but never reference this, and in any case
the SoundWire core stores this information for drivers so it would be
redundant even if used.

12 months agoASoC: mediatek: mt8192-mt6359: Remove " Jack" from Headphone pin name
AngeloGioacchino Del Regno [Wed, 17 May 2023 15:15:16 +0000 (17:15 +0200)]
ASoC: mediatek: mt8192-mt6359: Remove " Jack" from Headphone pin name

Function jack_kctl_name_gen() will remove the redundant " Jack" from
the name, if present, and then it will add it back, so that all of
the controls are named "(pin-name) Jack".

Remove " Jack" from the Headphone pin name to spare some CPU cycles.

This commit brings no functional changes.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
Link: https://lore.kernel.org/r/20230517151516.343037-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt722-sdca: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:53 +0000 (09:27 +0200)]
ASoC: codecs: rt722-sdca: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-13-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt715: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:52 +0000 (09:27 +0200)]
ASoC: codecs: rt715: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-12-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt715-sdca: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:51 +0000 (09:27 +0200)]
ASoC: codecs: rt715-sdca: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-11-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt712-sdca: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:50 +0000 (09:27 +0200)]
ASoC: codecs: rt712-sdca: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-10-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt712-sdca-dmic: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:49 +0000 (09:27 +0200)]
ASoC: codecs: rt712-sdca-dmic: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-9-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt711: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:48 +0000 (09:27 +0200)]
ASoC: codecs: rt711: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-8-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt711-sdca: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:47 +0000 (09:27 +0200)]
ASoC: codecs: rt711-sdca: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-7-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt700: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:46 +0000 (09:27 +0200)]
ASoC: codecs: rt700: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-6-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt5682: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:45 +0000 (09:27 +0200)]
ASoC: codecs: rt5682: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-5-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt1318: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:44 +0000 (09:27 +0200)]
ASoC: codecs: rt1318: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt1316: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:43 +0000 (09:27 +0200)]
ASoC: codecs: rt1316: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
12 months agoASoC: codecs: rt1308: do not store status in state container
Krzysztof Kozlowski [Thu, 18 May 2023 07:27:42 +0000 (09:27 +0200)]
ASoC: codecs: rt1308: do not store status in state container

Driver in its update status callback stores Soundwire device status in
state container but it never uses it later.  Simplify the code a bit.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Link: https://lore.kernel.org/r/20230518072753.7361-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: dt-bindings: nau8810: Convert to dtschema
David Lin [Tue, 16 May 2023 05:44:48 +0000 (13:44 +0800)]
ASoC: dt-bindings: nau8810: Convert to dtschema

Convert the NAU8810 audio CODEC bindings to DT schema.

Signed-off-by: David Lin <CTLIN0@nuvoton.com
Link: https://lore.kernel.org/r/20230516054447.1081404-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: tegra: tegra210_adx: fix snd_pcm_format_t type
Min-Hua Chen [Tue, 16 May 2023 22:36:59 +0000 (06:36 +0800)]
ASoC: tegra: tegra210_adx: fix snd_pcm_format_t type

use snd_pcm_format_t instead of unsigned int to fix
the following sparse warnings:

sound/soc/tegra/tegra210_adx.c:125:14: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/tegra/tegra210_adx.c:128:14: sparse: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/tegra/tegra210_adx.c:131:14: sparse: warning: restricted snd_pcm_format_t degrades to integer

Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.com
Link: https://lore.kernel.org/r/20230516223700.185569-1-minhuadotchen@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: dt-bindings: nau8315: Convert to dtschema
David Lin [Tue, 16 May 2023 05:49:45 +0000 (13:49 +0800)]
ASoC: dt-bindings: nau8315: Convert to dtschema

Convert the NAU8315 audio CODEC bindings to DT schema.

Signed-off-by: David Lin <CTLIN0@nuvoton.com
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Link: https://lore.kernel.org/r/20230516054944.1081808-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: dt-bindings: Add Google Chameleon v3 i2s device
Paweł Anikiel [Mon, 8 May 2023 11:30:33 +0000 (13:30 +0200)]
ASoC: dt-bindings: Add Google Chameleon v3 i2s device

Add binding for google,chv3-i2s device.

Signed-off-by: Paweł Anikiel <pan@semihalf.com
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Link: https://lore.kernel.org/r/20230508113037.137627-4-pan@semihalf.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: dt-bindings: Add Google Chameleon v3 audio codec
Paweł Anikiel [Mon, 8 May 2023 11:30:34 +0000 (13:30 +0200)]
ASoC: dt-bindings: Add Google Chameleon v3 audio codec

Add binding for google,chv3-codec device.

Signed-off-by: Paweł Anikiel <pan@semihalf.com
Link: https://lore.kernel.org/r/20230508113037.137627-5-pan@semihalf.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Add Google Chameleon v3 codec driver
Paweł Anikiel [Mon, 8 May 2023 11:30:32 +0000 (13:30 +0200)]
ASoC: Add Google Chameleon v3 codec driver

Add driver for the codec IP present on Google Chameleon v3

Signed-off-by: Paweł Anikiel <pan@semihalf.com
Link: https://lore.kernel.org/r/20230508113037.137627-3-pan@semihalf.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Add Google Chameleon v3 i2s driver
Paweł Anikiel [Mon, 8 May 2023 11:30:31 +0000 (13:30 +0200)]
ASoC: Add Google Chameleon v3 i2s driver

Add driver for the i2s IP present on Google Chameleon v3

Signed-off-by: Paweł Anikiel <pan@semihalf.com
Link: https://lore.kernel.org/r/20230508113037.137627-2-pan@semihalf.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: dt-bindings: nau8824: Convert to dtschema
David Lin [Mon, 15 May 2023 06:55:58 +0000 (14:55 +0800)]
ASoC: dt-bindings: nau8824: Convert to dtschema

Convert the NAU8824 audio CODEC bindings to DT schema.

Signed-off-by: David Lin <CTLIN0@nuvoton.com
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Link: https://lore.kernel.org/r/20230515065557.614125-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: dt-bindings: ssm2518: Convert to dtschema
Marek Vasut [Sun, 14 May 2023 22:52:43 +0000 (00:52 +0200)]
ASoC: dt-bindings: ssm2518: Convert to dtschema

Convert the ADI SSM2518 audio CODEC bindings to DT schema.

Signed-off-by: Marek Vasut <marex@denx.de
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Link: https://lore.kernel.org/r/20230514225243.777504-1-marex@denx.de
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Improve the audio format
Mark Brown [Mon, 15 May 2023 15:30:14 +0000 (00:30 +0900)]
ASoC: SOF: ipc4-topology: Improve the audio format

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

Improve the logic to account for the current restrictions in topology while
making it extensible for future topology modifications.

The current topology definitions assume that input/output formats come in pairs.
For example even if there's only 1 output format for a module, we add 3 output
formats to match that of the input format count with the same parameters.
This is unnecessary but we have to deal with it until the topologies are
modified. Additionally, choosing the input/output audio format should
depend only on the pipeline params or the runtime FE hw_params depending
on where the module is in the pipeline.

This series modifies the logic for selection based on this and removes
unnecessary dependencies between the input and output formats.

13 months agoASoC: mediatek: mt8188: revise AFE driver
Mark Brown [Mon, 15 May 2023 15:30:08 +0000 (00:30 +0900)]
ASoC: mediatek: mt8188: revise AFE driver

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

The series of patches consists of four major changes.
First, remove redundant supply for ADDA DAI dirver. Second, revise ETDM
control including APLL dynamic switch via DAPM, so APLL can be enabled
when it is really required. Third, update AFE probe function. Bus
protection change was dropped at the previous patch because the dependent
change was not accepted at that time. Finally, correct some binding errors
and add required clocks.

13 months agoASoC: Factor out control notification support
Mark Brown [Mon, 15 May 2023 15:17:58 +0000 (00:17 +0900)]
ASoC: Factor out control notification support

Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>:

This series introduces and uses a helper for notifying control changes
to userspace.

13 months agoASoC: SOF: Intel/ipc4: Do not reset BE DAI pipeline
Mark Brown [Mon, 15 May 2023 15:17:51 +0000 (00:17 +0900)]
ASoC: SOF: Intel/ipc4: Do not reset BE DAI pipeline

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

Do not reset pipelines during the stop/suspend triggers in the BE DAI
ops as the BE DAI pipeline needs to be left in the PAUSED state. It should
only be reset during hw_free. This simplification is already done for
the FE pipelines and the DAI trigger only toggles the states between
PAUSED and RUNNING.

13 months agoASoC: SOF: Intel: hda-dai: prepare LNL support
Mark Brown [Mon, 15 May 2023 15:17:44 +0000 (00:17 +0900)]
ASoC: SOF: Intel: hda-dai: prepare LNL support

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

The HDAudio support has not changed much since CometLake/2019: the
code was reshuffled for IPC4 support and we used hdac_hda for external
and Display Audio codec, but the hda-dai code was only used for
HDAudio codecs.

In the LunarLake architecture, all endpoints (HDaudio, SSP, DMIC,
SoundWire) are handled with the HDaudio DMA, which requires us to
revisit the definitions of HDA_LINK, and remove the mutual exclusion
between NOCODEC and HDA_LINK: we do want the ability to test SSP/DMIC
in NOCODEC mode even with an HDA DMA.

This code change exposed a number of issues, with a useless .prepare
callback, a DAI number mismatch and the need to support SoundWire
which is handled by a different component in
drivers/soundwire/intel_ace2.c.

13 months agoASoC: Intel: machine driver updates
Mark Brown [Mon, 15 May 2023 15:17:37 +0000 (00:17 +0900)]
ASoC: Intel: machine driver updates

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

Several updates for RPL/MTL/LNL, and one fix for SoundWire TGL device.

13 months agoASoC: SOF: ipc4-pcm: reset all pipelines during FE DAI hw_free
Ranjani Sridharan [Mon, 15 May 2023 11:20:22 +0000 (14:20 +0300)]
ASoC: SOF: ipc4-pcm: reset all pipelines during FE DAI hw_free

Do not reset pipelines during the stop/suspend triggers in the BE DAI
ops as the BE DAI pipeline needs to be left in the PAUSED state. It should
only be reset during hw_free. This simplification is already done for
the FE pipelines and the DAI trigger only toggles the states between
PAUSED and RUNNING.

But because the FE DAI hw_free is invoked first and all the pipelines are
freed during this op, we need to make sure that the BE DAI pipeline also
gets reset before it is freed. So do not skip the pipelines that have the
skip_during_fe_trigger flag set when resetting pipelines.

Also, because the pipeline state changes are split between the FE and BE
DAI ops now, protect the BE DAI pipeline state changes with the
pipeline_state_mutex as well.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
Link: https://lore.kernel.org/r/20230515112022.30297-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: hda-dai-ops: Split the get_hext_stream() op for IPC4
Ranjani Sridharan [Mon, 15 May 2023 11:20:21 +0000 (14:20 +0300)]
ASoC: SOF: Intel: hda-dai-ops: Split the get_hext_stream() op for IPC4

Introduce a separate op implementation for get_hext_stream() for IPC4.
This op will also be used to set the skip_during_fe_trigger flag for the
BE DAI pipeline. With this change, we can remove the flag setting in
sof_ipc4_dai_config() which will further simplify support for
DMIC/SSP/Soundwire in the LunarLake platform.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
Link: https://lore.kernel.org/r/20230515112022.30297-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Simplify the calculation of variables
Jiapeng Chong [Fri, 12 May 2023 06:42:25 +0000 (14:42 +0800)]
ASoC: SOF: Simplify the calculation of variables

./sound/soc/sof/pcm.c:372:27-29: WARNING !A || A && B is equivalent to !A || B.

Reported-by: Abaci Robot <abaci@linux.alibaba.com
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4938
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
Link: https://lore.kernel.org/r/20230512064225.75358-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Use set_get_data() to send LARGE_CONFIG message
Peter Ujfalusi [Fri, 12 May 2023 10:56:42 +0000 (13:56 +0300)]
ASoC: SOF: ipc4-topology: Use set_get_data() to send LARGE_CONFIG message

Instead of open coding the sending of sink format of the copier with
LARGE_CONFIG_SET message, use the proper function to do so.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
Link: https://lore.kernel.org/r/20230512105642.23437-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: remove mutual exclusion between NOCODEC and HDA_LINK
Pierre-Louis Bossart [Fri, 12 May 2023 18:17:02 +0000 (13:17 -0500)]
ASoC: SOF: Intel: remove mutual exclusion between NOCODEC and HDA_LINK

The nocodec mode served two purposes so far
a) generate a test driver for DMIC/SSP without any codec connected
b) make sure the use of snd_hdac_ libraries was contained

b) is no longer an option for LunarLake, the HDaudio DMA is used for
DMIC/SSP and the HDA_LINK option needs to be enabled.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: hda-dai: use HDA_LINK instead of HDA_AUDIO_CODEC
Pierre-Louis Bossart [Fri, 12 May 2023 18:17:01 +0000 (13:17 -0500)]
ASoC: SOF: Intel: hda-dai: use HDA_LINK instead of HDA_AUDIO_CODEC

For LunarLake support, we will have to use HDAudio DMA-based DAIs even
for SSP/DMIC/SoundWire. That's completely different to the
HDA_AUDIO_CODEC, the DAI ops deal with DMA configuration and that can
happen in the absence of any HDAudio codec.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: hda-dai: mark functions as __maybe_unused
Pierre-Louis Bossart [Fri, 12 May 2023 18:17:00 +0000 (13:17 -0500)]
ASoC: SOF: Intel: hda-dai: mark functions as __maybe_unused

hda_dai_hw_params, hda_dai_trigger(), hda_dai_hw_free are currently
only used for HDaudio codec support, but will be reused for
SSP/DMIC/SoundWire in the LunarLake/ACE2.x case. To avoid 'defined but
not used' errors or added complexity in Kconfig, mark all these
functions as __maybe_used.

When SSP/DMIC/SoundWire are added, some of these changes may be
reverted. For now this avoids compilation warnings.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: hda-dai: move hda_dai_prepare() code
Pierre-Louis Bossart [Fri, 12 May 2023 18:16:59 +0000 (13:16 -0500)]
ASoC: SOF: Intel: hda-dai: move hda_dai_prepare() code

Before we change the Kconfig support, move code around. No
functionality change with this commit in isolation.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: Kconfig: move selection of PROBE_WORK_QUEUE
Pierre-Louis Bossart [Fri, 12 May 2023 18:16:58 +0000 (13:16 -0500)]
ASoC: SOF: Intel: Kconfig: move selection of PROBE_WORK_QUEUE

The probe workqueue is only needed if we have a Display Audio codec.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: clarify initialization when HDA_AUDIO_CODEC is not used
Pierre-Louis Bossart [Fri, 12 May 2023 18:16:57 +0000 (13:16 -0500)]
ASoC: SOF: Intel: clarify initialization when HDA_AUDIO_CODEC is not used

For LunarLake support, we need to enable HDA_LINK but we also want the
ability to remove HDaudio codec support, e.g. for 'nocodec'
tests. This requires a small change in the bus initialization without
any codec-specific callbacks provided.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: fix DAI number mismatch
Pierre-Louis Bossart [Fri, 12 May 2023 18:16:56 +0000 (13:16 -0500)]
ASoC: SOF: Intel: fix DAI number mismatch

The number of DAIs was based on a Kconfig option and the declaration
on another. Fix before changing the dependencies.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: hda-dai: remove use of cpu_dai->component drvdata
Pierre-Louis Bossart [Fri, 12 May 2023 18:16:55 +0000 (13:16 -0500)]
ASoC: SOF: Intel: hda-dai: remove use of cpu_dai->component drvdata

The existing code relies on conversions from cpu_dai to the sdev
structure pointer based on the cpu_dai component. This works fine for
HDaudio but will not work for SoundWire DAIs which are registered by a
different component. That's a problem preventing reuse of the HDaudio
DMA stream allocation for SoundWire DAIs starting with the LunarLake
platform.

This patch introduces a set of helpers to perform the conversion, and
an indirect way of retrieving the sdev pointer based on the
swidget->comp intermediate pointer.

Suggested-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: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: Intel: hda-dai: simplify .prepare callback
Pierre-Louis Bossart [Fri, 12 May 2023 18:16:54 +0000 (13:16 -0500)]
ASoC: SOF: Intel: hda-dai: simplify .prepare callback

The code has been cleaned-up multiple times, but while adding the new
abstractions for DMIC/SSP/SoundWire it appears that we don't really
need a specific sequence for .prepare, and we can reuse what
.hw_params already does.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Rander Wang <rander.wang@intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com
Link: https://lore.kernel.org/r/20230512181702.117483-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Modify input audio format selection logic
Ranjani Sridharan [Mon, 15 May 2023 10:33:36 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: Modify input audio format selection logic

The current selection logic assumes that input and output formats always
come in pairs in topology. Handle this special case by checking if all
input formats are the same. And for the case where there are multiple
supported input audio formats, modify the selection logic to pick the
audio formats based on the reference params which is either the FE
hw_params or the pipeline params based on the type of module.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: New helper to check if all output formats are the same
Ranjani Sridharan [Mon, 15 May 2023 10:33:35 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: New helper to check if all output formats are the same

Add a helper function to check if all formats are identical.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Modify the output format selection logic
Ranjani Sridharan [Mon, 15 May 2023 10:33:34 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: Modify the output format selection logic

Modify the output format selection when there are multiple output
formats available to choose the one that matches the reference params.
The reference params depend on the type of module. In the case of
processing modules, the reference params are based on the selected input
audio format. This would be the case when a processing module does not
perform any format conversion during processing.

The only special case is the copier module. The copier module is capable
of format conversion but it is only used in the case when the output
is fixed to a single format. In the case of a module copier, when there are
multiple formats, the reference params is based on the selected input
params and the output format must match that of the selected input
format. In the case of host copier, the reference params should be
based on the input audio format for playback and the FE hw_params for
capture. In the case DAI copier, the reference params should be based on
the input audio format for capture and the FE hw_params for playback
when there is no format conversion in the pipeline from the host to the
DAI.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Add a new helper function to get the valid bits
Ranjani Sridharan [Mon, 15 May 2023 10:33:33 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: Add a new helper function to get the valid bits

Add a new helper function sof_ipc4_get_valid_bits() to get the valid
bits in the PCM params.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Handle output format special case
Ranjani Sridharan [Mon, 15 May 2023 10:33:32 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: Handle output format special case

The current topologies have input/output formats in pairs and even
though there are multiple output formats, they are all the same. Handle
this case as if there were only one format in topology. Also, add a check
for the number of output formats and reports errors where applicable.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Rename sof_ipc4_init_audio_fmt()
Ranjani Sridharan [Mon, 15 May 2023 10:33:31 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: Rename sof_ipc4_init_audio_fmt()

Rename it to sof_ipc4_init_input_audio_fmt() as it only does input
format selection now.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Move the call to init output format
Ranjani Sridharan [Mon, 15 May 2023 10:33:30 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: Move the call to init output format

In preparation for changing the logic for input/output format selection,
move the call to sof_ipc4_init_output_audio_fmt() into the individual
widget prepare ops.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Add a helper function for output format selection
Ranjani Sridharan [Mon, 15 May 2023 10:33:29 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: Add a helper function for output format selection

Add a helper function to select the output format.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: SOF: ipc4-topology: Handle input/output audio format special case
Ranjani Sridharan [Mon, 15 May 2023 10:33:28 +0000 (13:33 +0300)]
ASoC: SOF: ipc4-topology: Handle input/output audio format special case

When there is only one input/output format specified in topology, there
is no need to search for a matching format, simply pick the available
one. This is in preparation to modify and split the selection logic for
the input and output audio formats.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230515103336.16132-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Intel: sof_sdw: add quirk for LNL RVP
Peter Ujfalusi [Fri, 12 May 2023 17:33:05 +0000 (12:33 -0500)]
ASoC: Intel: sof_sdw: add quirk for LNL RVP

We should use RT711_JD2_100K for on board rt711

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@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/20230512173305.65399-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Intel: soc-acpi: add tables for LunarLake
Pierre-Louis Bossart [Fri, 12 May 2023 17:33:04 +0000 (12:33 -0500)]
ASoC: Intel: soc-acpi: add tables for LunarLake

These tables are used for 'nocodec' and SoundWire mockups+RVP tests.
The LNL RVP has a single rt711-sdca SoundWire codec.

Co-developed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@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/20230512173305.65399-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Intel: sof_sdw: add new mapping for HP Spectre x360
Pierre-Louis Bossart [Fri, 12 May 2023 17:33:03 +0000 (12:33 -0500)]
ASoC: Intel: sof_sdw: add new mapping for HP Spectre x360

A BIOS/DMI update seems to have broken some devices, let's add a new
mapping.

Link: https://github.com/thesofproject/linux/issues/4323
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/20230512173305.65399-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Intel: sof_sdw: start set codec init function with an adr index
Bard Liao [Fri, 12 May 2023 17:33:02 +0000 (12:33 -0500)]
ASoC: Intel: sof_sdw: start set codec init function with an adr index

Currently, set_codec_init_func always start with link->adr_d[0] because
we assumed all adr_d on the same link are the same devices. The
assumption is no longer valid when different devices on the same sdw link
are supported.

Fixes: c8db7b50128b ("ASoC: Intel: sof_sdw: support different devices on the same sdw link")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Link: https://lore.kernel.org/r/20230512173305.65399-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Intel: soc-acpi: add support for MTL SDCA boards
Chao Song [Fri, 12 May 2023 17:33:01 +0000 (12:33 -0500)]
ASoC: Intel: soc-acpi: add support for MTL SDCA boards

The description and board layout is changed and different
from previous ones for CometLake and Tigerlake.

The new codec layout for MTL is:
  SDW0: RT711 Headphone
  SDW1: RT714 DMIC
  SDW2: RT1316 Speaker
  SDW3: RT1316 Speaker

The previous codec layout for CML and TGL is:
  SDW0: RT711 Headphone
  SDW1: RT1316 Speaker
  SDW2: RT1316 Speaker
  SDW3: RT714 DMIC

Signed-off-by: Chao Song <chao.song@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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Link: https://lore.kernel.org/r/20230512173305.65399-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Intel: sof_sdw: add quirk for MTL RVP
Bard Liao [Fri, 12 May 2023 17:33:00 +0000 (12:33 -0500)]
ASoC: Intel: sof_sdw: add quirk for MTL RVP

We should use RT711_JD2_100K for on board rt711.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Link: https://lore.kernel.org/r/20230512173305.65399-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Intel: sof_sdw: remove SOF_SDW_TGL_HDMI for MeteorLake devices
Bard Liao [Fri, 12 May 2023 17:32:59 +0000 (12:32 -0500)]
ASoC: Intel: sof_sdw: remove SOF_SDW_TGL_HDMI for MeteorLake devices

Topologies support three HDMI links on MeteorLake devices only.

Fixes: 18489174e4fb ("ASoC: intel: sof_sdw: add RT711 SDCA card for MTL platform")
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com
Link: https://lore.kernel.org/r/20230512173305.65399-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Intel: Add rpl_max98373_8825 driver
Terry Cheong [Fri, 12 May 2023 17:32:58 +0000 (12:32 -0500)]
ASoC: Intel: Add rpl_max98373_8825 driver

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

Signed-off-by: Terry Cheong <htcheong@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/20230512173305.65399-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: wm_adsp: Update to use new component control notify helepr
Charles Keepax [Fri, 12 May 2023 12:28:32 +0000 (13:28 +0100)]
ASoC: wm_adsp: Update to use new component control notify helepr

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com
Link: https://lore.kernel.org/r/20230512122838.243002-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: ak4118: Update to use new component control notify helper
Charles Keepax [Fri, 12 May 2023 12:28:31 +0000 (13:28 +0100)]
ASoC: ak4118: Update to use new component control notify helper

Update the driver to use the new ASoC core control notify helper.
This also fixes a bug where the control would not be found if the
CODEC was given a name prefix.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com
Link: https://lore.kernel.org/r/20230512122838.243002-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: soc-component: Add notify control helper function
Charles Keepax [Fri, 12 May 2023 12:28:30 +0000 (13:28 +0100)]
ASoC: soc-component: Add notify control helper function

Add a function to allow ASoC drivers to easily notify an ALSA control
change. This function will automatically add any component naming
prefix into the control name.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com
Link: https://lore.kernel.org/r/20230512122838.243002-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: dt-bindings: mediatek,mt8188-afe: add audio properties
Trevor Wu [Wed, 10 May 2023 03:55:26 +0000 (11:55 +0800)]
ASoC: dt-bindings: mediatek,mt8188-afe: add audio properties

Add apll1_d4 to clocks for switching the parent of top_a1sys_hp
dynamically and add property "mediatek,infracfg" for bus protection.

Because no mt8188 upstream dts exists, the change won't break anything.
In addition, apll2_d4, apll12_div4, top_a2sys and top_aud_iec are also
included in clocks, because these clocks are possibly used in the future.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Link: https://lore.kernel.org/r/20230510035526.18137-10-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: dt-bindings: mediatek,mt8188-afe: correct clock name
Trevor Wu [Wed, 10 May 2023 03:55:25 +0000 (11:55 +0800)]
ASoC: dt-bindings: mediatek,mt8188-afe: correct clock name

The original clock names are different from the list in driver code.
Correct the mismatched binding names in the patch.

Because no mt8188 upstream dts exists, it doesn't affect the existing
dts file.

Fixes: 692d25b67e10 ("ASoC: dt-bindings: mediatek,mt8188-afe: add audio afe document")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org
Link: https://lore.kernel.org/r/20230510035526.18137-9-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: mediatek: mt8188: add required clocks
Trevor Wu [Wed, 10 May 2023 03:55:24 +0000 (11:55 +0800)]
ASoC: mediatek: mt8188: add required clocks

apll2_d4, apll12_div4, top_a2sys and top_aud_iec are possibly used in
the future. To prevent from breaking binding ABI after any mt8188 dts
upstream, add these clocks to clock list in advance.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Link: https://lore.kernel.org/r/20230510035526.18137-8-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: mediatek: mt8188: add bus protection
Trevor Wu [Wed, 10 May 2023 03:55:23 +0000 (11:55 +0800)]
ASoC: mediatek: mt8188: add bus protection

Add bus protection for reset controller.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Link: https://lore.kernel.org/r/20230510035526.18137-7-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: mediatek: mt8188: combine afe component registration
Trevor Wu [Wed, 10 May 2023 03:55:22 +0000 (11:55 +0800)]
ASoC: mediatek: mt8188: combine afe component registration

There is no benefit to separate two components for AFE, so DAI driver
registration is moved to dev_snd_soc_register_component to merge these
two components.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Link: https://lore.kernel.org/r/20230510035526.18137-6-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: mediatek: mt8188: refine APLL control
Trevor Wu [Wed, 10 May 2023 03:55:21 +0000 (11:55 +0800)]
ASoC: mediatek: mt8188: refine APLL control

Currently, APLL is only used in ETDM module, so APLL and APLL tuner
don't need to be enabled when AFE is used. Integrate APLL control into
ETDM DAPM routes, so that APLL can be enabled when it is really required.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Link: https://lore.kernel.org/r/20230510035526.18137-5-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: mediatek: mt8188: revise ETDM control flow
Trevor Wu [Wed, 10 May 2023 03:55:20 +0000 (11:55 +0800)]
ASoC: mediatek: mt8188: revise ETDM control flow

Replace register controls in snd_soc_dai_ops with snd_soc_dapm_widgets.
startup, shutdown and trigger ops are removed, and create DAPM_SUPPLY
to handle mclk, clock gating and etdm enabling. Additionally, mclk setup
sequence is also updated because of new supply enabling sequence.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Link: https://lore.kernel.org/r/20230510035526.18137-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: mediatek: mt8188: complete set_tdm_slot function
Trevor Wu [Wed, 10 May 2023 03:55:19 +0000 (11:55 +0800)]
ASoC: mediatek: mt8188: complete set_tdm_slot function

User can configures slot number of TDM mode via set_tdm_slot callback.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Link: https://lore.kernel.org/r/20230510035526.18137-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: mediatek: mt8188: remove supply AUDIO_HIRES
Trevor Wu [Wed, 10 May 2023 03:55:18 +0000 (11:55 +0800)]
ASoC: mediatek: mt8188: remove supply AUDIO_HIRES

AUDIO_HIRES is not required in MT8188. Because top_audio_h is disabled
when hires clock is not used, set_parent is a redundant operation.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com
Link: https://lore.kernel.org/r/20230510035526.18137-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org
13 months agoASoC: Merge up fixes for CI
Mark Brown [Fri, 12 May 2023 04:14:20 +0000 (13:14 +0900)]
ASoC: Merge up fixes for CI

Avoid tripping over fixed issues in CI.

13 months agoLinux 6.4-rc2
Linus Torvalds [Sun, 14 May 2023 19:51:40 +0000 (12:51 -0700)]
Linux 6.4-rc2

13 months agoMerge tag 'cxl-fixes-6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Linus Torvalds [Sun, 14 May 2023 19:32:34 +0000 (12:32 -0700)]
Merge tag 'cxl-fixes-6.4-rc2' of git://git./linux/kernel/git/cxl/cxl

Pull compute express link fixes from Dan Williams:

 - Fix a compilation issue with DEFINE_STATIC_SRCU() in the unit tests

 - Fix leaking kernel memory to a root-only sysfs attribute

* tag 'cxl-fixes-6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl:
  cxl: Add missing return to cdat read error path
  tools/testing/cxl: Use DEFINE_STATIC_SRCU()

13 months agoMerge tag 'parisc-for-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Sun, 14 May 2023 16:54:38 +0000 (09:54 -0700)]
Merge tag 'parisc-for-6.4-2' of git://git./linux/kernel/git/deller/parisc-linux

Pull parisc architecture fixes from Helge Deller:

 - Fix encoding of swp_entry due to added SWP_EXCLUSIVE flag

 - Include reboot.h to avoid gcc-12 compiler warning

* tag 'parisc-for-6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: Fix encoding of swp_entry due to added SWP_EXCLUSIVE flag
  parisc: kexec: include reboot.h

13 months agoMerge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm
Linus Torvalds [Sun, 14 May 2023 16:17:32 +0000 (09:17 -0700)]
Merge tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:

 - fix unwinder for uleb128 case

 - fix kernel-doc warnings for HP Jornada 7xx

 - fix unbalanced stack on vfp success path

* tag 'for-linus' of git://git.armlinux.org.uk/~rmk/linux-arm:
  ARM: 9297/1: vfp: avoid unbalanced stack on 'success' return path
  ARM: 9296/1: HP Jornada 7XX: fix kernel-doc warnings
  ARM: 9295/1: unwind:fix unwind abort for uleb128 case

13 months agoMerge tag 'locking_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 May 2023 15:00:46 +0000 (08:00 -0700)]
Merge tag 'locking_urgent_for_v6.4_rc2' of git://git./linux/kernel/git/tip/tip

Pull locking fix from Borislav Petkov:

 - Make sure __down_read_common() is always inlined so that the callers'
   names land in traceevents output and thus the blocked function can be
   identified

* tag 'locking_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  locking/rwsem: Add __always_inline annotation to __down_read_common() and inlined callers

13 months agoMerge tag 'perf_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 May 2023 14:56:51 +0000 (07:56 -0700)]
Merge tag 'perf_urgent_for_v6.4_rc2' of git://git./linux/kernel/git/tip/tip

Pull perf fixes from Borislav Petkov:

 - Make sure the PEBS buffer is flushed before reprogramming the
   hardware so that the correct record sizes are used

 - Update the sample size for AMD BRS events

 - Fix a confusion with using the same on-stack struct with different
   events in the event processing path

* tag 'perf_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf/x86/intel/ds: Flush PEBS DS when changing PEBS_DATA_CFG
  perf/x86: Fix missing sample size update on AMD BRS
  perf/core: Fix perf_sample_data not properly initialized for different swevents in perf_tp_event()

13 months agoMerge tag 'sched_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 May 2023 14:50:34 +0000 (07:50 -0700)]
Merge tag 'sched_urgent_for_v6.4_rc2' of git://git./linux/kernel/git/tip/tip

Pull scheduler fix from Borislav Petkov:

 - Fix a couple of kernel-doc warnings

* tag 'sched_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched: fix cid_lock kernel-doc warnings

13 months agoMerge tag 'x86_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 May 2023 14:44:48 +0000 (07:44 -0700)]
Merge tag 'x86_urgent_for_v6.4_rc2' of git://git./linux/kernel/git/tip/tip

Pull x86 fix from Borislav Petkov:

 - Add the required PCI IDs so that the generic SMN accesses provided by
   amd_nb.c work for drivers which switch to them. Add a PCI device ID
   to k10temp's table so that latter is loaded on such systems too

* tag 'x86_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  hwmon: (k10temp) Add PCI ID for family 19, model 78h
  x86/amd_nb: Add PCI ID for family 19h model 78h

13 months agoMerge tag 'timers_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Sun, 14 May 2023 14:39:15 +0000 (07:39 -0700)]
Merge tag 'timers_urgent_for_v6.4_rc2' of git://git./linux/kernel/git/tip/tip

Pull timer fix from Borislav Petkov:

 - Prevent CPU state corruption when an active clockevent broadcast
   device is replaced while the system is already in oneshot mode

* tag 'timers_urgent_for_v6.4_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  tick/broadcast: Make broadcast device replacement work correctly

13 months agoMerge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sun, 14 May 2023 00:45:39 +0000 (17:45 -0700)]
Merge tag 'ext4_for_linus_stable' of git://git./linux/kernel/git/tytso/ext4

Pull ext4 fixes from Ted Ts'o:
 "Some ext4 bug fixes (mostly to address Syzbot reports)"

* tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
  ext4: bail out of ext4_xattr_ibody_get() fails for any reason
  ext4: add bounds checking in get_max_inline_xattr_value_size()
  ext4: add indication of ro vs r/w mounts in the mount message
  ext4: fix deadlock when converting an inline directory in nojournal mode
  ext4: improve error recovery code paths in __ext4_remount()
  ext4: improve error handling from ext4_dirhash()
  ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled
  ext4: check iomap type only if ext4_iomap_begin() does not fail
  ext4: avoid a potential slab-out-of-bounds in ext4_group_desc_csum
  ext4: fix data races when using cached status extents
  ext4: avoid deadlock in fs reclaim with page writeback
  ext4: fix invalid free tracking in ext4_xattr_move_to_block()
  ext4: remove a BUG_ON in ext4_mb_release_group_pa()
  ext4: allow ext4_get_group_info() to fail
  ext4: fix lockdep warning when enabling MMP
  ext4: fix WARNING in mb_find_extent

13 months agoMerge tag 'fbdev-for-6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Sun, 14 May 2023 00:41:58 +0000 (17:41 -0700)]
Merge tag 'fbdev-for-6.4-rc2' of git://git./linux/kernel/git/deller/linux-fbdev

Pull fbdev fixes from Helge Deller:

 - use after free fix in imsttfb (Zheng Wang)

 - fix error handling in arcfb (Zongjie Li)

 - lots of whitespace cleanups (Thomas Zimmermann)

 - add 1920x1080 modedb entry (me)

* tag 'fbdev-for-6.4-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
  fbdev: stifb: Fix info entry in sti_struct on error path
  fbdev: modedb: Add 1920x1080 at 60 Hz video mode
  fbdev: imsttfb: Fix use after free bug in imsttfb_probe
  fbdev: vfb: Remove trailing whitespaces
  fbdev: valkyriefb: Remove trailing whitespaces
  fbdev: stifb: Remove trailing whitespaces
  fbdev: sa1100fb: Remove trailing whitespaces
  fbdev: platinumfb: Remove trailing whitespaces
  fbdev: p9100: Remove trailing whitespaces
  fbdev: maxinefb: Remove trailing whitespaces
  fbdev: macfb: Remove trailing whitespaces
  fbdev: hpfb: Remove trailing whitespaces
  fbdev: hgafb: Remove trailing whitespaces
  fbdev: g364fb: Remove trailing whitespaces
  fbdev: controlfb: Remove trailing whitespaces
  fbdev: cg14: Remove trailing whitespaces
  fbdev: atmel_lcdfb: Remove trailing whitespaces
  fbdev: 68328fb: Remove trailing whitespaces
  fbdev: arcfb: Fix error handling in arcfb_probe()

13 months agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sun, 14 May 2023 00:37:32 +0000 (17:37 -0700)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fix from James Bottomley:
 "A single small fix for the UFS driver to fix a power management
  failure"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: ufs: core: Fix I/O hang that occurs when BKOPS fails in W-LUN suspend

13 months agoparisc: Fix encoding of swp_entry due to added SWP_EXCLUSIVE flag
Helge Deller [Sat, 13 May 2023 20:30:06 +0000 (22:30 +0200)]
parisc: Fix encoding of swp_entry due to added SWP_EXCLUSIVE flag

Fix the __swp_offset() and __swp_entry() macros due to commit 6d239fc78c0b
("parisc/mm: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE") which introduced the
SWP_EXCLUSIVE flag by reusing the _PAGE_ACCESSED flag.

Reported-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
Tested-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Fixes: 6d239fc78c0b ("parisc/mm: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE")
Cc: <stable@vger.kernel.org> # v6.3+
13 months agoext4: bail out of ext4_xattr_ibody_get() fails for any reason
Theodore Ts'o [Fri, 12 May 2023 19:16:27 +0000 (15:16 -0400)]
ext4: bail out of ext4_xattr_ibody_get() fails for any reason

In ext4_update_inline_data(), if ext4_xattr_ibody_get() fails for any
reason, it's best if we just fail as opposed to stumbling on,
especially if the failure is EFSCORRUPTED.

Cc: stable@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 months agoext4: add bounds checking in get_max_inline_xattr_value_size()
Theodore Ts'o [Fri, 12 May 2023 19:11:02 +0000 (15:11 -0400)]
ext4: add bounds checking in get_max_inline_xattr_value_size()

Normally the extended attributes in the inode body would have been
checked when the inode is first opened, but if someone is writing to
the block device while the file system is mounted, it's possible for
the inode table to get corrupted.  Add bounds checking to avoid
reading beyond the end of allocated memory if this happens.

Reported-by: syzbot+1966db24521e5f6e23f7@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?extid=1966db24521e5f6e23f7
Cc: stable@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 months agoext4: add indication of ro vs r/w mounts in the mount message
Theodore Ts'o [Fri, 12 May 2023 18:49:57 +0000 (14:49 -0400)]
ext4: add indication of ro vs r/w mounts in the mount message

Whether the file system is mounted read-only or read/write is more
important than the quota mode, which we are already printing.  Add the
ro vs r/w indication since this can be helpful in debugging problems
from the console log.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 months agoext4: fix deadlock when converting an inline directory in nojournal mode
Theodore Ts'o [Sun, 7 May 2023 01:04:01 +0000 (21:04 -0400)]
ext4: fix deadlock when converting an inline directory in nojournal mode

In no journal mode, ext4_finish_convert_inline_dir() can self-deadlock
by calling ext4_handle_dirty_dirblock() when it already has taken the
directory lock.  There is a similar self-deadlock in
ext4_incvert_inline_data_nolock() for data files which we'll fix at
the same time.

A simple reproducer demonstrating the problem:

    mke2fs -Fq -t ext2 -O inline_data -b 4k /dev/vdc 64
    mount -t ext4 -o dirsync /dev/vdc /vdc
    cd /vdc
    mkdir file0
    cd file0
    touch file0
    touch file1
    attr -s BurnSpaceInEA -V abcde .
    touch supercalifragilisticexpialidocious

Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230507021608.1290720-1-tytso@mit.edu
Reported-by: syzbot+91dccab7c64e2850a4e5@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?id=ba84cc80a9491d65416bc7877e1650c87530fe8a
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 months agoext4: improve error recovery code paths in __ext4_remount()
Theodore Ts'o [Sat, 6 May 2023 02:20:29 +0000 (22:20 -0400)]
ext4: improve error recovery code paths in __ext4_remount()

If there are failures while changing the mount options in
__ext4_remount(), we need to restore the old mount options.

This commit fixes two problem.  The first is there is a chance that we
will free the old quota file names before a potential failure leading
to a use-after-free.  The second problem addressed in this commit is
if there is a failed read/write to read-only transition, if the quota
has already been suspended, we need to renable quota handling.

Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230506142419.984260-2-tytso@mit.edu
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 months agoext4: improve error handling from ext4_dirhash()
Theodore Ts'o [Sat, 6 May 2023 15:59:13 +0000 (11:59 -0400)]
ext4: improve error handling from ext4_dirhash()

The ext4_dirhash() will *almost* never fail, especially when the hash
tree feature was first introduced.  However, with the addition of
support of encrypted, casefolded file names, that function can most
certainly fail today.

So make sure the callers of ext4_dirhash() properly check for
failures, and reflect the errors back up to their callers.

Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230506142419.984260-1-tytso@mit.edu
Reported-by: syzbot+394aa8a792cb99dbc837@syzkaller.appspotmail.com
Reported-by: syzbot+344aaa8697ebd232bfc8@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?id=db56459ea4ac4a676ae4b4678f633e55da005a9b
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 months agoext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled
Theodore Ts'o [Sat, 6 May 2023 01:02:30 +0000 (21:02 -0400)]
ext4: don't clear SB_RDONLY when remounting r/w until quota is re-enabled

When a file system currently mounted read/only is remounted
read/write, if we clear the SB_RDONLY flag too early, before the quota
is initialized, and there is another process/thread constantly
attempting to create a directory, it's possible to trigger the

WARN_ON_ONCE(dquot_initialize_needed(inode));

in ext4_xattr_block_set(), with the following stack trace:

   WARNING: CPU: 0 PID: 5338 at fs/ext4/xattr.c:2141 ext4_xattr_block_set+0x2ef2/0x3680
   RIP: 0010:ext4_xattr_block_set+0x2ef2/0x3680 fs/ext4/xattr.c:2141
   Call Trace:
    ext4_xattr_set_handle+0xcd4/0x15c0 fs/ext4/xattr.c:2458
    ext4_initxattrs+0xa3/0x110 fs/ext4/xattr_security.c:44
    security_inode_init_security+0x2df/0x3f0 security/security.c:1147
    __ext4_new_inode+0x347e/0x43d0 fs/ext4/ialloc.c:1324
    ext4_mkdir+0x425/0xce0 fs/ext4/namei.c:2992
    vfs_mkdir+0x29d/0x450 fs/namei.c:4038
    do_mkdirat+0x264/0x520 fs/namei.c:4061
    __do_sys_mkdirat fs/namei.c:4076 [inline]
    __se_sys_mkdirat fs/namei.c:4074 [inline]
    __x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4074

Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20230506142419.984260-1-tytso@mit.edu
Reported-by: syzbot+6385d7d3065524c5ca6d@syzkaller.appspotmail.com
Link: https://syzkaller.appspot.com/bug?id=6513f6cb5cd6b5fc9f37e3bb70d273b94be9c34c
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
13 months agoext4: check iomap type only if ext4_iomap_begin() does not fail
Baokun Li [Fri, 5 May 2023 13:24:29 +0000 (21:24 +0800)]
ext4: check iomap type only if ext4_iomap_begin() does not fail

When ext4_iomap_overwrite_begin() calls ext4_iomap_begin() map blocks may
fail for some reason (e.g. memory allocation failure, bare disk write), and
later because "iomap->type ! = IOMAP_MAPPED" triggers WARN_ON(). When ext4
iomap_begin() returns an error, it is normal that the type of iomap->type
may not match the expectation. Therefore, we only determine if iomap->type
is as expected when ext4_iomap_begin() is executed successfully.

Cc: stable@kernel.org
Reported-by: syzbot+08106c4b7d60702dbc14@syzkaller.appspotmail.com
Link: https://lore.kernel.org/all/00000000000015760b05f9b4eee9@google.com
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20230505132429.714648-1-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>