linux-2.6-microblaze.git
2 years agoASoC: Intel: bytcht_es8316: move comment to the right place
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:10 +0000 (13:26 -0600)]
ASoC: Intel: bytcht_es8316: move comment to the right place

Additional code was added and the comment on the speaker GPIO needs to
be moved before we actually try to get the GPIO.

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/20220308192610.392950-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: add cfg-dmics component for UCM support
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:09 +0000 (13:26 -0600)]
ASoC: Intel: sof_es8336: add cfg-dmics component for UCM support

The presence of DMICs needs to be signaled to UCM, follow the HDaudio
example and use the 'cfg-dmics' component string to report the number
of dmics present on the platform.

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/20220308192610.392950-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: extend machine driver to support ES8326 codec
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:08 +0000 (13:26 -0600)]
ASoC: Intel: sof_es8336: extend machine driver to support ES8326 codec

The ES8326 requires a different codec driver than ES8316/8336, fixup
the codec name and dai name depending on the ACPI _HID exposed in the
DSDT.

Also add the select in Kconfig

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/20220308192610.392950-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: add support for JD inverted quirk
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:07 +0000 (13:26 -0600)]
ASoC: Intel: sof_es8336: add support for JD inverted quirk

The codec driver exposes a set of properties that can be set from the
machine driver - as done in bytcht_es8316.c

Start by adding the JD_INVERTED 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: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220308192610.392950-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: move comment to the right place
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:06 +0000 (13:26 -0600)]
ASoC: Intel: sof_es8336: move comment to the right place

Additional code was added and the comment on the speaker GPIO needs to
be moved before we actually try to get the GPIO.

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/20220308192610.392950-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: log all quirks
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:05 +0000 (13:26 -0600)]
ASoC: Intel: sof_es8336: log all quirks

We only logged the SSP quirk, make sure the GPIO and DMIC quirks are
exposed.

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/20220308192610.392950-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: use NHLT information to set dmic and SSP
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:04 +0000 (13:26 -0600)]
ASoC: Intel: sof_es8336: use NHLT information to set dmic and SSP

Since we see a proliferation of devices with various configurations,
we want to automatically set the DMIC and SSP information. This patch
relies on the information extracted from NHLT and partially reverts
existing DMI quirks added by commit a164137ce91a ("ASoC: Intel: add
machine driver for SOF+ES8336")

Note that NHLT can report multiple SSPs, choosing from the
ssp_link_mask in an MSB-first manner was found experimentally to work
fine.

The only thing that cannot be detected is the GPIO type, and users may
want to use the quirk override parameter if the 'wrong' solution is
provided.

Tested-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220308192610.392950-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: Revert "ASoC: Intel: sof_es8336: add quirk for Huawei D15 2021"
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:03 +0000 (13:26 -0600)]
ASoC: Intel: Revert "ASoC: Intel: sof_es8336: add quirk for Huawei D15 2021"

This reverts commit ce6a70bfce21bb4edb7c0f29ecfb0522fa34ab71.

The next patch will add run-time detection of the required SSP and
this hard-coded quirk is not needed.

Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220308192610.392950-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: get codec device with ACPI instead of bus search
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:02 +0000 (13:26 -0600)]
ASoC: Intel: sof_es8336: get codec device with ACPI instead of bus search

We have an existing 'adev' handle from which we can find the codec
device, no need for an I2C bus search.

This change aligns this driver will all other I2S-based machine
drivers.

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/20220308192610.392950-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: make gpio optional
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:26:01 +0000 (13:26 -0600)]
ASoC: Intel: sof_es8336: make gpio optional

Do not fail if the GPIO used for speakers is not present, at least the
headphone, headset and internal mics should work.

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/20220308192610.392950-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: soc-acpi: add ESSX8336 support on Cannon Lake machines
Nikolai Kostrigin [Tue, 8 Mar 2022 19:26:00 +0000 (13:26 -0600)]
ASoC: Intel: soc-acpi: add ESSX8336 support on Cannon Lake machines

Add the support for all ES83x6 devices

Signed-off-by: Nikolai Kostrigin <nickel@altlinux.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220308192610.392950-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoALSA: intel-dspconfig: add ES8336 support for CNL
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:59 +0000 (13:25 -0600)]
ALSA: intel-dspconfig: add ES8336 support for CNL

We're missing this check for the CNL PCI id

Reported-by: Nikolai Kostrigin <nickel@altlinux.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20220308192610.392950-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: soc-acpi: add more ACPI HIDs for ES83x6 devices
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:58 +0000 (13:25 -0600)]
ASoC: Intel: soc-acpi: add more ACPI HIDs for ES83x6 devices

We only saw ESSX8336 so far, but now with reports of 'ESSX8326' we
need to expand to a full list. Let's reuse the 'snd_soc_acpi_codecs'
structure to store the information.

Note that ES8326 will need a dedicated codec driver, but the plan is
to use the same machine driver for all Everest Audio devices.

Reported-by: anthony tonitch <d.tonitch@gmail.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/20220308192610.392950-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoALSA: intel-dsp-config: add more ACPI HIDs for ES83x6 devices
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:57 +0000 (13:25 -0600)]
ALSA: intel-dsp-config: add more ACPI HIDs for ES83x6 devices

We only saw ESSX8336 so far, but now with reports of 'ESSX8326' we
need to expand to a full list. Let's reuse the 'snd_soc_acpi_codecs'
structure to store the information.

Reported-by: anthony tonitch <d.tonitch@gmail.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>
Acked-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20220308192610.392950-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: soc-acpi: quirk topology filename dynamically
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:56 +0000 (13:25 -0600)]
ASoC: Intel: soc-acpi: quirk topology filename dynamically

Different topology filenames may be required depending on which SSP is
used, and whether or not digital mics are present.

This patch adds a tplg_quirk_mask and in the case of the SOF driver
adds the relevant configurations.

This is a short-term solution to the ES8336 support issues.

In a long-term solution, we would need an interface where the machine
driver or platform driver have the ability to alter the topology
hard-coded low-level hardware support, e.g. by substituting an
interface for another, or disabling an interface that is not supported
on a given skew.

BugLink: https://github.com/thesofproject/linux/issues/3248
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/20220308192610.392950-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda: report SSP link mask to machine driver
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:55 +0000 (13:25 -0600)]
ASoC: SOF: Intel: hda: report SSP link mask to machine driver

For devices designed for Windows, the SSP information should be listed
in the NHLT, and when present can be used to set quirks automatically
in the machine driver.

The NHLT information exposes BT and analog audio connections
separately, for now we are only interested in the analog audio parts.

The use of dev_info() for the SSP mask is intentional so that we can
immediately flag devices with an ES8336 codec. Since NHLT is not used
for recent Chromebooks these messages should be rare.

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/20220308192610.392950-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoALSA: intel-nhlt: add helper to detect SSP link mask
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:54 +0000 (13:25 -0600)]
ALSA: intel-nhlt: add helper to detect SSP link mask

The NHLT information can be used to figure out which SSPs are enabled
in a platform.

The 'SSP' link type is too broad for machine drivers, since it can
cover the Bluetooth sideband and the analog audio codec connections,
so this helper exposes a parameter to filter with the device
type (DEVICE_I2S refers to analog audio codec in NHLT parlance).

The helper returns a mask, since more than one SSP may be used for
analog audio, e.g. the NHLT spec describes the use of SSP0 for
amplifiers and SSP1 for headset codec. Note that if more than one bit
is set, it's impossible to determine which SSP is connected to what
external component. Additional platform-specific information based on
e.g. DMI quirks would still be required in the machine driver to
configure the relevant dailinks.

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>
Acked-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20220308192610.392950-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda: retrieve DMIC number for I2S boards
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:53 +0000 (13:25 -0600)]
ASoC: SOF: Intel: hda: retrieve DMIC number for I2S boards

We currently extract the DMIC number only for HDaudio or SoundWire
platforms. For I2S/TDM platforms, this wasn't necessary until now, but
with devices with ES8336 we need to find a solution to detect dmics
more reliably than with a DMI 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: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220308192610.392950-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-acpi: add information on I2S/TDM link mask
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:52 +0000 (13:25 -0600)]
ASoC: soc-acpi: add information on I2S/TDM link mask

The platform driver may have information on which I2S/TDM link(s) to
enable in the machine driver. In the case of Intel devices, this may
be extracted from NHLT tables in platform firmware. This link
information is necessary to make sure machine driver and topology are
aligned.

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/20220308192610.392950-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-acpi: fix kernel-doc descriptor
Pierre-Louis Bossart [Tue, 8 Mar 2022 19:25:51 +0000 (13:25 -0600)]
ASoC: soc-acpi: fix kernel-doc descriptor

Add missing dmic_num mention and clarify that 'links' mean 'SoundWire
links', not to be used for other links.

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/20220308192610.392950-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoClean ups and preparation for IPC abstraction in the SOF driver
Mark Brown [Tue, 8 Mar 2022 17:19:21 +0000 (17:19 +0000)]
Clean ups and preparation for IPC abstraction in the SOF driver

Merge series from Ranjani Sridharan <ranjani.sridharan@linux.intel.com>:

In preparation for adding support for the new IPC version that has been
introduced in the SOF firmware, this patch set includes some clean ups
and necessary modifications to commonly used functions that will be
re-used across different IPC-specific code.

2 years agoAdd driver for SAMA7G5's PDMC
Mark Brown [Tue, 8 Mar 2022 17:19:20 +0000 (17:19 +0000)]
Add driver for SAMA7G5's PDMC

Merge series from Codrin Ciubotariu <codrin.ciubotariu@microchip.com>:

This patch series adds support for Pulse Density Microphone Controller
(PDMC), present on Microchip's SAMA7G5.
The PDMC interfaces up to 4 digital microphones having Pulse Density
Modulated (PDM) outputs. It generates a single clock line and samples 1 or
2 data lines. The signal path includes an audio grade programmable
decimation filter and outputs 24-bit audio words.
The source of each channel can be independently defined as PDMC_DS0 or
PDMC_DS1, sampled at the rising or falling edge of PDMC_CLK.

The patch series starts with a fix on the ASoC DMA engine support. Then
continues with the bindings and the driver of PDMC. It is followed by the
DT nodes for SAMA7G5 and SAMA7G5-EK. In the end, the drivers for PDMC
and PDM microphones are enabled in sama7_defconfig.

2 years agoASoC: mxs: Fix error handling in mxs_sgtl5000_probe
Miaoqian Lin [Tue, 8 Mar 2022 02:01:44 +0000 (02:01 +0000)]
ASoC: mxs: Fix error handling in mxs_sgtl5000_probe

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
For example, when codec_np is NULL, saif_np[0] and saif_np[1]
are not NULL, it will cause leaks.

of_node_put() will check if the node pointer is NULL, so we can
call it directly to release the refcount of regular pointers.

Fixes: e968194b45c4 ("ASoC: mxs: add device tree support for mxs-sgtl5000")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220308020146.26496-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: atmel: mchp-pdmc: add PDMC driver
Codrin Ciubotariu [Mon, 7 Mar 2022 12:21:59 +0000 (14:21 +0200)]
ASoC: atmel: mchp-pdmc: add PDMC driver

The Pulse Density Microphone Controller (PDMC) interfaces up to 4 digital
microphones having Pulse Density Modulated (PDM) outputs. It generates a
single clock line and samples 1 or 2 data lines. The signal path includes
an audio grade programmable decimation filter and outputs 24-bit audio
words on the APB bus.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220307122202.2251639-4-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: Document Microchip's PDMC
Codrin Ciubotariu [Mon, 7 Mar 2022 12:21:58 +0000 (14:21 +0200)]
ASoC: dt-bindings: Document Microchip's PDMC

Add DT bindings for the new Microchip PDMC embedded in sama7g5 SoCs.

Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20220307122202.2251639-3-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dmaengine: do not use a NULL prepare_slave_config() callback
Codrin Ciubotariu [Mon, 7 Mar 2022 12:21:57 +0000 (14:21 +0200)]
ASoC: dmaengine: do not use a NULL prepare_slave_config() callback

Even if struct snd_dmaengine_pcm_config is used, prepare_slave_config()
callback might not be set. Check if this callback is set before using it.

Fixes: fa654e085300 ("ASoC: dmaengine-pcm: Provide default config")
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220307122202.2251639-2-codrin.ciubotariu@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rk817: Fix missing clk_disable_unprepare() in rk817_platform_probe
Miaoqian Lin [Mon, 7 Mar 2022 09:01:30 +0000 (09:01 +0000)]
ASoC: rk817: Fix missing clk_disable_unprepare() in rk817_platform_probe

Fix the missing clk_disable_unprepare() before return
from rk817_platform_probe() in the error handling case.

Fixes: 0d6a04da9b25 ("ASoC: Add Rockchip rk817 audio CODEC support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Tested-by: Chris Morgan <macromorgan@hotmail.com>
Link: https://lore.kernel.org/r/20220307090146.4104-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8192-mt6359: Fix error handling in mt8192_mt6359_dev_probe
Miaoqian Lin [Tue, 8 Mar 2022 01:52:22 +0000 (01:52 +0000)]
ASoC: mediatek: mt8192-mt6359: Fix error handling in mt8192_mt6359_dev_probe

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
Fix this by calling of_node_put() in error handling too.

Fixes: 4e28491a7a19 ("ASoC: mediatek: mt8192-mt6359: fix device_node leak")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220308015224.23585-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add missing of_node_put() in imx8m_probe
Miaoqian Lin [Tue, 8 Mar 2022 02:33:23 +0000 (02:33 +0000)]
ASoC: SOF: Add missing of_node_put() in imx8m_probe

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

Fixes: afb93d716533 ("ASoC: SOF: imx: Add i.MX8M HW support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220308023325.31702-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rockchip: i2s: Fix missing clk_disable_unprepare() in rockchip_i2s_probe
Miaoqian Lin [Mon, 7 Mar 2022 08:35:52 +0000 (08:35 +0000)]
ASoC: rockchip: i2s: Fix missing clk_disable_unprepare() in rockchip_i2s_probe

Fix the missing clk_disable_unprepare() before return
from rockchip_i2s_probe() in the error handling case.

Fixes: 01605ad12875 ("ASoC: rockchip-i2s: enable "hclk" for rockchip I2S controller")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220307083553.26009-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: acp3x: Fix signedness bug in acp3x
YueHaibing [Sat, 5 Mar 2022 12:36:13 +0000 (20:36 +0800)]
ASoC: amd: acp3x: Fix signedness bug in acp3x

In acp3x_audio_probe() platform_get_irq() may return error, but i2s_irq now
is unsigned int so the error handling is never triggered.

Fixes: 87d71a128771 ("ASoC: amd: pcm-dma: Use platform_get_irq() to get the interrupt")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20220305123613.6324-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: acp5x-pcm-dma: Fix signedness bug
YueHaibing [Sat, 5 Mar 2022 12:37:05 +0000 (20:37 +0800)]
ASoC: amd: acp5x-pcm-dma: Fix signedness bug

In acp5x_audio_probe() platform_get_irq() may return error, but i2s_irq now
is unsigned int so the error handling is never triggered.

Fixes: 87d71a128771 ("ASoC: amd: pcm-dma: Use platform_get_irq() to get the interrupt")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20220305123705.3708-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8183: support wb bt audio
Jiaxin Yu [Mon, 7 Mar 2022 03:30:56 +0000 (11:30 +0800)]
ASoC: mediatek: mt8183: support wb bt audio

Use "bt-sco-pcm-wb" codec dai driver for wb bt audio.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220307033056.11463-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: catpt: use asoc_substream_to_rtd()
Lianjie Zhang [Mon, 7 Mar 2022 15:19:39 +0000 (23:19 +0800)]
ASoC: Intel: catpt: use asoc_substream_to_rtd()

Now we can use asoc_substream_to_rtd() macro,
let's use it.

Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220307151939.32870-1-zhanglianjie@uniontech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: atmel: Fix error handling in snd_proto_probe
Miaoqian Lin [Tue, 8 Mar 2022 01:39:48 +0000 (01:39 +0000)]
ASoC: atmel: Fix error handling in snd_proto_probe

The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
Fix this by calling of_node_put() in error handling too.

Fixes: a45f8853a5f9 ("ASoC: Add driver for PROTO Audio CODEC (with a WM8731)")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220308013949.20323-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: change comp_dai to a pointer in struct snd_sof_dai
Ranjani Sridharan [Mon, 7 Mar 2022 18:11:03 +0000 (10:11 -0800)]
ASoC: SOF: change comp_dai to a pointer in struct snd_sof_dai

This will avoid having to add the extended data for DAI components during
sof_widget_setup() as an extra step.

Signed-off-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>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220307181111.49392-11-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: expose some get_token ops
Ranjani Sridharan [Mon, 7 Mar 2022 18:11:02 +0000 (10:11 -0800)]
ASoC: SOF: topology: expose some get_token ops

These will be used later on by IPC-specific code.

Signed-off-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>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220307181111.49392-10-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Modify the get_token op for string tokens
Ranjani Sridharan [Mon, 7 Mar 2022 18:11:01 +0000 (10:11 -0800)]
ASoC: SOF: topology: Modify the get_token op for string tokens

Modify the get_token op for string type tokens to pass the string as the
argument instead of a pointer to struct snd_soc_tplg_vendor_string_elem.

Signed-off-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>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220307181111.49392-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Drop the size parameter from struct sof_topology_token
Ranjani Sridharan [Mon, 7 Mar 2022 18:11:00 +0000 (10:11 -0800)]
ASoC: SOF: topology: Drop the size parameter from struct sof_topology_token

It is always 0 and never used while parsing.

Signed-off-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>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220307181111.49392-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: remove redundant code in sof_link_afe_load()
Ranjani Sridharan [Mon, 7 Mar 2022 18:10:59 +0000 (10:10 -0800)]
ASoC: SOF: topology: remove redundant code in sof_link_afe_load()

Looks like a copy-paste error. The CPU DAI is never used.

Signed-off-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>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220307181111.49392-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: remove redundant code
Ranjani Sridharan [Mon, 7 Mar 2022 18:10:58 +0000 (10:10 -0800)]
ASoC: SOF: topology: remove redundant code

With the change in the commit:
"ASoC: SOF: Intel: hda: assign link DMA channel at run-time",
there is no need to find the CPU DAI in sof_link_hda_load().

Fixes: bdf4ad3fd01f ('ASoC: SOF: Intel: hda: assign link DMA channel at
run-time')

Signed-off-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>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220307181111.49392-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-audio: removed unused function
Pierre-Louis Bossart [Mon, 7 Mar 2022 18:10:57 +0000 (10:10 -0800)]
ASoC: SOF: sof-audio: removed unused function

cppcheck warning:

sound/soc/sof/sof-audio.c:884:0: style: The function
'snd_sof_find_spcm_pcm_id' is never used. [unusedFunction]

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220307181111.49392-5-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: set swidget's core for scheduler widget
Ranjani Sridharan [Mon, 7 Mar 2022 18:10:56 +0000 (10:10 -0800)]
ASoC: SOF: set swidget's core for scheduler widget

Set the swidget's core for scheduler type widgets to match that of the
pipeline core. This simplifies the flow for core get/put during widget
setup/free.

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>
Link: https://lore.kernel.org/r/20220307181111.49392-4-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: simplify snd_sof_device_remove()
Ranjani Sridharan [Mon, 7 Mar 2022 18:10:55 +0000 (10:10 -0800)]
ASoC: SOF: simplify snd_sof_device_remove()

The commit "ASoC: SOF: core: Unregister machine driver before IPC and
debugfs" moved the call to unregister the machine driver to be done
before freeing the IPC. With this change, we can safely move the call to
snd_sof_remove() inside the same if() block just above.

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>
Link: https://lore.kernel.org/r/20220307181111.49392-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: remove snd_sof_pipeline_find()
Ranjani Sridharan [Mon, 7 Mar 2022 18:10:54 +0000 (10:10 -0800)]
ASoC: SOF: remove snd_sof_pipeline_find()

It is not used.

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>
Link: https://lore.kernel.org/r/20220307181111.49392-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: Cleanups and 1:1 bclk:mclk ratio support
Mark Brown [Mon, 7 Mar 2022 20:37:00 +0000 (20:37 +0000)]
ASoC: fsl_sai: Cleanups and 1:1 bclk:mclk ratio support

Merge series from Sascha Hauer <s.hauer@pengutronix.de>:

This series has some updates for the fsl_sai driver: Some general
cleanup patches, a bugfix in the ip revision checking and finally
the mclk setting is made more accurate and support for 1:1 bclk:mclk
setting is added.

2 years agoASoC: SOF: updates for 5.18
Mark Brown [Mon, 7 Mar 2022 20:36:58 +0000 (20:36 +0000)]
ASoC: SOF: updates for 5.18

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

A couple of updates for Intel and AMD hardware, along with minor
cleanups

Ajit Kumar Pandey (4):
  ASoC: SOF: amd: Flush cache after ATU_BASE_ADDR_GRP register update
  ASoC: SOF: amd: Use semaphore register to synchronize ipc's irq
  ASoC: SOF: amd: Move group register configuration to acp-loader
  ASoC: SOF: amd: Increase ACP_HW_SEM_RETRY_COUNT value

Curtis Malainey (1):
  ASoC: SOF: fix 32 signed bit overflow

Gongjun Song (1):
  ASoC: SOF: Intel: pci-tgl: add RPL-S support

Peter Ujfalusi (2):
  ASoC: SOF: amd: acp-pcm: Take buffer information directly from runtime
  ASoC: SOF: amd: Do not set ipc_pcm_params ops as it is optional

Pierre-Louis Bossart (2):
  ASoC: SOF: debug: clarify operator precedence
  ASoC: SOF: Intel: hda: clarify operator precedence

 include/sound/sof/header.h         |  2 +-
 include/uapi/sound/sof/abi.h       |  2 +-
 sound/soc/sof/amd/acp-dsp-offset.h |  1 +
 sound/soc/sof/amd/acp-ipc.c        | 22 ++++++++++++++--------
 sound/soc/sof/amd/acp-loader.c     |  9 +++++++++
 sound/soc/sof/amd/acp-pcm.c        |  7 ++++---
 sound/soc/sof/amd/acp-stream.c     |  3 +++
 sound/soc/sof/amd/acp.c            | 29 ++++++++++++++---------------
 sound/soc/sof/amd/acp.h            |  3 +--
 sound/soc/sof/amd/renoir.c         |  1 -
 sound/soc/sof/debug.c              |  2 +-
 sound/soc/sof/intel/hda.c          |  2 +-
 sound/soc/sof/intel/pci-tgl.c      |  2 ++
 13 files changed, 52 insertions(+), 33 deletions(-)

--
2.30.2

2 years agoASoC: Intel: boards: cleanups for 5.18
Mark Brown [Mon, 7 Mar 2022 20:36:57 +0000 (20:36 +0000)]
ASoC: Intel: boards: cleanups for 5.18

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

Updates to clean-up the GPIOLIB dependency and a quirk for HP
SoundWire devices.

2 years agoASoC: audio_graph_card2: Support variable slot widths
Mark Brown [Mon, 7 Mar 2022 20:36:55 +0000 (20:36 +0000)]
ASoC: audio_graph_card2: Support variable slot widths

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

This adds support for I2S/TDM links where the slot width varies
depending on the sample width, in a way that cannot be guessed by
component hw_params().

A typical example is:

- 16-bit samples use 16-bit slots
- 24-bit samples use 32-bit slots

There is no way for a component hw_params() to deduce from the information
it is passed that 24-bit samples will be in 32-bit slots.

Some audio hardware cannot support a fixed slot width or a slot width
equal to the sample width in all cases. This is usually due either to
limitations of the audio serial port or system clocking restrictions.

2 years agoASoC: codecs: Add Awinic AW8738 audio amplifier driver
Mark Brown [Mon, 7 Mar 2022 20:36:54 +0000 (20:36 +0000)]
ASoC: codecs: Add Awinic AW8738 audio amplifier driver

Merge series from Stephan Gerhold <stephan@gerhold.net>:

This series adds a simple driver and DT schema for the Awinic AW8738
audio amplifier. It's fairly simple - the main difference to
simple-amplifier is that there is a "one-wire pulse control" that
allows configuring the amplifier to one of a few pre-defined modes.
This can be used to configure the speaker-guard function (primarily
the power limit for the amplifier).

2 years agoASoC: amd: vg: fix signedness bug in acp5x_audio_probe()
Dan Carpenter [Fri, 4 Mar 2022 13:12:56 +0000 (16:12 +0300)]
ASoC: amd: vg: fix signedness bug in acp5x_audio_probe()

The "adata->i2s_irq" variable is unsigned so the error handling
will not work.

Fixes: 87d71a128771 ("ASoC: amd: pcm-dma: Use platform_get_irq() to get the interrupt")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220304131256.GA28739@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs42l42: Add warnings about DETECT_MODE and PLL_START
Richard Fitzgerald [Fri, 4 Mar 2022 14:40:15 +0000 (14:40 +0000)]
ASoC: cs42l42: Add warnings about DETECT_MODE and PLL_START

DETECT_MODE and PLL_START must be zero while HP_PDN and ADC_PDN are
both 1. If this condition is broken it can discharge FILT+ and it
can then take up to 1 second for FILT+ to recharge.

There is no workaround required for this, simply avoiding settings
and sequences that would break the requirement. The driver already
meets the requirement.

But it is not obvious from reading the code that this requirement
exists, or what is ensuring it is met. So it would not currently be
obvious to someone changing the code that there is certain special
behaviour that must be maintained.

To avoid accidental breakage in the future:

- Add comments into the register definitions to warn about this so
  that anyone changing the code around DETECT_MODE and PLL_START is
  aware of this requirement.

- Add a comment where PLL_START is written to 1 to highlight the
  requirement and why it is satisfied.

- Add a comment in cs42l42_setup_hs_type_detect() when DETECT_MODE is
  initialized.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220304144015.398656-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wm_adsp: Expand firmware loading search options
Simon Trimmer [Thu, 3 Mar 2022 15:50:16 +0000 (15:50 +0000)]
ASoC: wm_adsp: Expand firmware loading search options

The parts supported by this driver can have product-specific
firmware and tunings files. Typically these have been used on
embedded systems where the manufacturer is responsible for
installing the correct product-specific firmware files into
/lib/firmware. However, the linux-firmware repository places all
available firmwares into /lib/firmware and it is up to the driver to
select the correct product-specific firmware from that directory.

For example a product containing four smart amplifiers may provide
firmware specific for that product and each of the amplifiers may
have coefficient files containing tunings for their placement in the
mechanical design.

This change extends firmware (wmfw) and coefficient (bin) filenames
to be of the general form:

<cirrus/>part-dspN-fwtype<-system_name<-asoc_component_prefix>>.type

Where the cirrus subdirectory, system_name and asoc_component_prefix
are optional.

New files will be placed in the cirrus subdirectory to avoid
polluting the main /lib/firmware/ location. The generic name must be
searched in /lib/firmware before /lib/firmware/cirrus so that a
generic file in the new location does not override existing
product-specific files in the legacy location.

The search order for firmware files is:
  - cirrus/part-dspN-fwtype-system_name-asoc_component_prefix.wmfw
  - cirrus/part-dspN-fwtype-system_name.wmfw
  - part-dspN-fwtype.wmfw
  - cirrus/part-dspN-fwtype.wmfw

- Qualifications are added to the filename so that rightwards is more
  specific.
- The system_name is provided by the codec driver.
- The asoc_component_prefix is used to identify tunings for individual
  parts because it would already exist to disambiguate the controls
  and it makes it obvious which firmware file applies to which device.

The optional coefficient file must have the same filename
construction as the discovered wmfw except:
  - where the wmfw has only system_name then the bin file can
    optionally include the asoc_component_prefix. This is to allow a
    common wmfw for all amps but separate tunings per amp.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220303155016.122125-1-simont@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsi: Add check for clk_enable
Jiasheng Jiang [Wed, 2 Mar 2022 06:28:44 +0000 (14:28 +0800)]
ASoC: fsi: Add check for clk_enable

As the potential failure of the clk_enable(),
it should be better to check it and return error
if fails.

Fixes: ab6f6d85210c ("ASoC: fsi: add master clock control functions")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220302062844.46869-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: select correct WCD938X config for SC7280
Srinivas Kandagatla [Fri, 4 Mar 2022 16:09:34 +0000 (16:09 +0000)]
ASoC: qcom: select correct WCD938X config for SC7280

SC7280 config selected WCD938X instead of WCD938X_SDW Soundwire codecs.
WCD938X_SDW actually selects WCD938X, so directly selecting WCD938X results
in unmet dependencies and below warning

WARNING: unmet direct dependencies detected for SND_SOC_WCD938X
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=m]
 && SND_SOC_WCD938X_SDW [=n] && (SOUNDWIRE [=n] || !SOUNDWIRE [=n])
  Selected by [m]:
  - SND_SOC_SC7280 [=m] && SOUND [=y] && !UML && SND [=y]
 && SND_SOC [=m] && SND_SOC_QCOM [=m] && (I2C [=y] && SOUNDWIRE [=n] ||
 COMPILE_TEST [=y])

Fix this issue by selecting WCD SoundWire codecs instead of component driver.

Fixes: 57350bd41c3a ("ASoC: qcom: SC7280: Add machine driver")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220304160934.32010-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l41: Remove unnecessary param
Lucas Tanure [Fri, 4 Mar 2022 15:07:05 +0000 (15:07 +0000)]
ASoC: cs35l41: Remove unnecessary param

cs35l41_private is not used on cs35l41_handle_pdata

Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220304150721.3802-5-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l41: Fix max number of TX channels
Lucas Tanure [Fri, 4 Mar 2022 15:07:03 +0000 (15:07 +0000)]
ASoC: cs35l41: Fix max number of TX channels

This device only has 4 TX channels.

Fixes: fe1024d50477b ("ASoC: cs35l41: Combine adjacent register writes")
Signed-off-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220304150721.3802-3-tanureal@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682s: Stabilize the combo jack detection
Derek Fang [Mon, 7 Mar 2022 10:21:54 +0000 (18:21 +0800)]
ASoC: rt5682s: Stabilize the combo jack detection

Changes:
1. Revise rt5682s_sar_power_mode and rt5682s_headset_detect to be more
   rational.
2. Manually set to the jack-unplugging state via rt5682s_headset_detect
   during going to suspend. Close unnecessary powers and prepare for
   re-detecting the CBJ during resuming.
3. Simplize rt5682s_resume.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20220307102154.26065-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wm8350: Handle error for wm8350_register_irq
Jiasheng Jiang [Fri, 4 Mar 2022 02:38:21 +0000 (10:38 +0800)]
ASoC: wm8350: Handle error for wm8350_register_irq

As the potential failure of the wm8350_register_irq(),
it should be better to check it and return error if fails.
Also, use 'free_' in order to avoid the same code.

Fixes: a6ba2b2dabb5 ("ASoC: Implement WM8350 headphone jack detection")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220304023821.391936-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: atmel: Add missing of_node_put() in at91sam9g20ek_audio_probe
Miaoqian Lin [Mon, 7 Mar 2022 12:45:39 +0000 (12:45 +0000)]
ASoC: atmel: Add missing of_node_put() in at91sam9g20ek_audio_probe

This node pointer is returned by of_parse_phandle() with refcount
incremented in this function.
Calling of_node_put() to avoid the refcount leak.

Fixes: 531f67e41dcd ("ASoC: at91sam9g20ek-wm8731: convert to dt support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220307124539.1743-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: pcm-dma: Fix signedness bug in acp3x_audio_probe()
Dan Carpenter [Fri, 4 Mar 2022 13:15:34 +0000 (16:15 +0300)]
ASoC: amd: pcm-dma: Fix signedness bug in acp3x_audio_probe()

The "adata->i2s_irq" variable is unsigned so this error handling
code will not work.

Fixes: 87d71a128771 ("ASoC: amd: pcm-dma: Use platform_get_irq() to get the interrupt")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220304131534.GD28739@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: pcm-dma: Fix signedness bug in acp_pdm_audio_probe()
Dan Carpenter [Fri, 4 Mar 2022 13:13:35 +0000 (16:13 +0300)]
ASoC: amd: pcm-dma: Fix signedness bug in acp_pdm_audio_probe()

The "adata->pdm_irq" variable is unsigned so the error handling will
not work.

Fixes: 87d71a128771 ("ASoC: amd: pcm-dma: Use platform_get_irq() to get the interrupt")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220304131335.GB28739@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: acp: Fix signedness bug in renoir_audio_probe()
Dan Carpenter [Fri, 4 Mar 2022 13:14:49 +0000 (16:14 +0300)]
ASoC: amd: acp: Fix signedness bug in renoir_audio_probe()

The "adata->i2s_irq" is unsigned so this error handling will not
work.

Fixes: 3304a242f45a ("ASoC: amd: Use platform_get_irq_byname() to get the interrupt")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220304131449.GC28739@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_sdw: fix quirks for 2022 HP Spectre x360 13"
Anthony I Gilea [Fri, 4 Mar 2022 20:45:32 +0000 (14:45 -0600)]
ASoC: Intel: sof_sdw: fix quirks for 2022 HP Spectre x360 13"

HP changed the DMI identification for 2022 devices:
Product Name: HP Spectre x360 Conv 13-ap0001na
Product Name: 8709
This patch relaxes the DMI_MATCH criterion to work with all versions of this product.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Anthony I Gilea <i@cpp.in>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304204532.54675-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: boards: add GPIOLIB dependency where missed
Pierre-Louis Bossart [Fri, 4 Mar 2022 20:45:31 +0000 (14:45 -0600)]
ASoC: Intel: boards: add GPIOLIB dependency where missed

We have eleven machine drivers who make explicit references to
gpios. Let's add the dependency.

The use of 'depends on' instead of 'select' is intentional. On one
side it could be argued that the GPIOs are required, but on the other
it might create more issues with randconfig builds. This patch sticks
with the existing direction of using 'depends' on high-level non-audio
dependencies

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220304204532.54675-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: boards: remove explicit dependency on GPIOLIB when DMIC is used"
Pierre-Louis Bossart [Fri, 4 Mar 2022 20:45:30 +0000 (14:45 -0600)]
ASoC: Intel: boards: remove explicit dependency on GPIOLIB when DMIC is used"

This patch reverts commit 4262ddc2ad63 ("ASoC: Intel: boards: add
explicit dependency on GPIOLIB when DMIC is used") and all follow-up
additions of this dependency.

Now that the DMIC does not depend on GPIOLIB we can simplify again.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220304204532.54675-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: implement 1:1 bclk:mclk ratio support
Ahmad Fatoum [Wed, 2 Mar 2022 08:34:28 +0000 (09:34 +0100)]
ASoC: fsl_sai: implement 1:1 bclk:mclk ratio support

With higher channel counts, we may need higher clock rates.  Starting
with SAI v3.1 (i.MX8MM), we can bypass the divider and get a 1:1
bclk:mclk ratio. Add the necessary support.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-8-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: use DIV_ROUND_CLOSEST() to calculate divider
Sascha Hauer [Wed, 2 Mar 2022 08:34:27 +0000 (09:34 +0100)]
ASoC: fsl_sai: use DIV_ROUND_CLOSEST() to calculate divider

In fsl_sai_set_bclk() we want to calculate the divider that gets us
closest to the desired frequency, so use DIV_ROUND_CLOSEST() instead of
just doing a clk_rate/freq.
Also discard invalid ratios earlier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-7-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: Use better variable names
Sascha Hauer [Wed, 2 Mar 2022 08:34:26 +0000 (09:34 +0100)]
ASoC: fsl_sai: Use better variable names

"ret" is normally used as a variable name for return values. In
fsl_sai_set_bclk() it stores the difference between the desired rate and
the rate we can archieve, so rename it to "diff". Also rename "savesub"
to "bestdiff" as that stores the best difference we have found.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-6-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: store full version instead of major/minor
Sascha Hauer [Wed, 2 Mar 2022 08:34:25 +0000 (09:34 +0100)]
ASoC: fsl_sai: store full version instead of major/minor

The driver tests for the hardware revision being newer than 3.1
with (sai->verid.major >= 3 && sai->verid.minor >= 1). The result
is obviously wrong for hardware revision 4.0. Fix this by storing
the full version in a single variable and comparing to that one.
No practical change at the moment as there is no 4.0 ip version
currently.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-5-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: simplify register poking in fsl_sai_set_bclk
Ahmad Fatoum [Wed, 2 Mar 2022 08:34:24 +0000 (09:34 +0100)]
ASoC: fsl_sai: simplify register poking in fsl_sai_set_bclk

Depending on SAI synchronization mode, the same value is either
written to FSL_SAI_TCR2 or FSL_SAI_RCR2 or nothing is written at all.

As the computation is the same either way, factor it out to make it
clearer what the difference is. No functional change.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-4-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: simplify irq return value
Sascha Hauer [Wed, 2 Mar 2022 08:34:23 +0000 (09:34 +0100)]
ASoC: fsl_sai: simplify irq return value

Instead of using a boolean "irq_none" to describe the interrupt
handlers return value use a variable of type irqreturn_t and return
it directly. No functional change.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-3-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: Drop unnecessary defines
Sascha Hauer [Wed, 2 Mar 2022 08:34:22 +0000 (09:34 +0100)]
ASoC: fsl_sai: Drop unnecessary defines

The fsl_sai driver has FSL_FMT_TRANSMITTER and FSL_FMT_RECEIVER defines
which are used in a single function only then are then only translated
into a bool 'tx' variable. Drop the defines and pass the boolean value
directly to fsl_sai_set_dai_sysclk_tr(). No functional change.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220302083428.3804687-2-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: Add Awinic AW8738 audio amplifier driver
Jonathan Albrieux [Fri, 4 Mar 2022 10:24:52 +0000 (11:24 +0100)]
ASoC: codecs: Add Awinic AW8738 audio amplifier driver

The Awinic AW8738 is a simple audio amplifier using a single GPIO.
The main difference to simple-amplifier is that there is a "one-wire
pulse control" that allows configuring the amplifier to one of a few
pre-defined modes. This can be used to configure the speaker-guard
function (primarily the power limit for the amplifier).

Add a simple driver that allows setting it up in the device tree
with a specified mode number.

Signed-off-by: Jonathan Albrieux <jonathan.albrieux@gmail.com>
Co-developed-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20220304102452.26856-3-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: Add schema for "awinic,aw8738"
Stephan Gerhold [Fri, 4 Mar 2022 10:24:51 +0000 (11:24 +0100)]
ASoC: dt-bindings: Add schema for "awinic,aw8738"

Add a DT schema for describing Awinic AW8738 audio amplifiers. They are
fairly simple and controlled using a single GPIO. The number of pulses
during power up selects one of a few pre-defined operation modes. This
can be used to configure the speaker-guard function (primarily the
power limit for the amplifier).

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20220304102452.26856-2-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: audio_graph_card2: Add support for variable slot widths
Richard Fitzgerald [Mon, 28 Feb 2022 17:27:54 +0000 (17:27 +0000)]
ASoC: audio_graph_card2: Add support for variable slot widths

Some audio hardware cannot support the same slot width for all sample
widths, or a slot width equal to the sample width for all sample widths.
This is usually due either to limitations of the audio serial port or
system clocking restrictions.
A typical example would be:

- 16-bit samples in 16-bit slots
- 24-bit samples in 32-bit slots

The new dai-tdm-slot-width-map property allows setting a mapping of
sample widths and the corresponding tdm slot widths and slot counts.
Although the slot count is usually the same for all cases this does
allow for adding padding slots to maintain the same bitclk frequency.

The property is added to each endpoint node that needs the component
DAI to be told the TDM slot width and count.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220228172754.453783-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: audio-graph-port: Add dai-tdm-slot-width-map
Richard Fitzgerald [Mon, 28 Feb 2022 17:27:53 +0000 (17:27 +0000)]
ASoC: dt-bindings: audio-graph-port: Add dai-tdm-slot-width-map

Some audio hardware cannot support a fixed slot width for all sample
widths, or a slot width equal to the sample width for all sample widths.
This is usually due either to limitations of the audio serial port or
system clocking restrictions.

This property allows setting a mapping of sample widths and the
corresponding tdm slot widths. The slot count is also provided for
each slot width - although this would almost always be the same for
all slot widths this allows for possibly adding extra padding slots
to maintain a fixed bitclock frequency.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220228172754.453783-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: hda: clarify operator precedence
Pierre-Louis Bossart [Fri, 4 Mar 2022 20:57:33 +0000 (14:57 -0600)]
ASoC: SOF: Intel: hda: clarify operator precedence

cppcheck warning

sound/soc/sof/intel/hda.c:545:46: style: Clarify calculation
precedence for '&' and '?'. [clarifyCalculation]
 char *level = flags & SOF_DBG_DUMP_OPTIONAL ? KERN_DEBUG : KERN_ERR;

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: debug: clarify operator precedence
Pierre-Louis Bossart [Fri, 4 Mar 2022 20:57:32 +0000 (14:57 -0600)]
ASoC: SOF: debug: clarify operator precedence

cppcheck warning:

for '&' and '?'. [clarifyCalculation]
 char *level = flags & SOF_DBG_DUMP_OPTIONAL ? KERN_DEBUG : KERN_ERR;
                                             ^

sound/soc/sof/debug.c:398:46: style: Clarify calculation precedence
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: fix 32 signed bit overflow
Curtis Malainey [Fri, 4 Mar 2022 20:57:31 +0000 (14:57 -0600)]
ASoC: SOF: fix 32 signed bit overflow

Shifting in a signed 32bit container past the signed bit is technically
undefined behaviour. Fix by using unsigned types. Found via cppcheck.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@intel.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: Increase ACP_HW_SEM_RETRY_COUNT value
Ajit Kumar Pandey [Fri, 4 Mar 2022 20:57:30 +0000 (14:57 -0600)]
ASoC: SOF: amd: Increase ACP_HW_SEM_RETRY_COUNT value

Host is trying to acquire semaphore lock based on HW_SEM_RETRY_COUNT
value which is set to 10 by default. So host will loop for 10 times
trying to acquire lock before giving error msg "Failed to acquire HW
lock". Though this loop count of 10 is good enough with most of the
times but we have observed such failure msg in very few cases(~5 %).

Increase ACP_HW_SEM_RETRY_COUNT to avoid such issue and loop for a
significant time period before throwing error. We're setting newer
loop count to quite higher value of 10K but it's very unlikely that
it will loop for this count, since for most of the cases lock will
get acquired at much lesser loop iterations.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: Move group register configuration to acp-loader
Ajit Kumar Pandey [Fri, 4 Mar 2022 20:57:29 +0000 (14:57 -0600)]
ASoC: SOF: amd: Move group register configuration to acp-loader

We are using PTE_GRP1 for DMA operations to load firmware binaries
but we are enabling PTE_GRP and flushing ATU cache much before in
probe callbacks. This can cause issue if we try to load firmware
runtime during system resume as probe callback will not be invoked
hence PTE_GRP will not be enabled. Moreover it makes more sense to
flush the cache after register configuration.

Move PTE group register configuration to acp-loader within pre_fw_run
callback to avoid such issue.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: Use semaphore register to synchronize ipc's irq
Ajit Kumar Pandey [Fri, 4 Mar 2022 20:57:28 +0000 (14:57 -0600)]
ASoC: SOF: amd: Use semaphore register to synchronize ipc's irq

Add lock and unlock around ipc irq handling code using hw semaphore
register that exhibit special property for register read calls. As
host and DSP firmware uses few shared registers, there is a possible
race condition around those shared registers values. This lock ensure
synchronization between Firmware and host ipc interrupts.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: Flush cache after ATU_BASE_ADDR_GRP register update
Ajit Kumar Pandey [Fri, 4 Mar 2022 20:57:27 +0000 (14:57 -0600)]
ASoC: SOF: amd: Flush cache after ATU_BASE_ADDR_GRP register update

ACP_SRAM_PTE block has cache that needs to be flushed after every
PTE updates. This patch updates ACPAXI2AXI_ATU_CTRL register to
flush cache after updating PTE with stream physical address.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: Do not set ipc_pcm_params ops as it is optional
Peter Ujfalusi [Fri, 4 Mar 2022 20:57:26 +0000 (14:57 -0600)]
ASoC: SOF: amd: Do not set ipc_pcm_params ops as it is optional

The ipc_pcm_params() ops implementation for AMD is a NOP and since the
callback is marked now as optional, it can be dropped along with the
empty function.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: acp-pcm: Take buffer information directly from runtime
Peter Ujfalusi [Fri, 4 Mar 2022 20:57:25 +0000 (14:57 -0600)]
ASoC: SOF: amd: acp-pcm: Take buffer information directly from runtime

Instead of using the values from ipc_params, take them directly from
substream->runtime.

This is in preparation of making the platform hw_params callback to be
IPC agnostic.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: pci-tgl: add RPL-S support
Gongjun Song [Fri, 4 Mar 2022 20:57:24 +0000 (14:57 -0600)]
ASoC: SOF: Intel: pci-tgl: add RPL-S support

Add PCI DID for Intel Raptor Lake S.

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Gongjun Song <gongjun.song@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220304205733.62233-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: bt-sco: fix bt-sco-pcm-wb dai widget don't connect to the endpoint
Jiaxin Yu [Wed, 2 Mar 2022 01:35:33 +0000 (09:35 +0800)]
ASoC: bt-sco: fix bt-sco-pcm-wb dai widget don't connect to the endpoint

This patch fix the second dai driver's dai widget can't connect to the
endpoint. Because "bt-sco-pcm" and "bt-sco-pcm-wb" dai driver have the
same stream_name, so it will cause they have the same widget name.
Therefor it will just create only one route when do snd_soc_dapm_add_route
that only find the widget through the widget name.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/20220302013533.29068-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: hdac_hda: Avoid unexpected match when pcm_name is "Analog"
Meng Tang [Wed, 2 Mar 2022 09:43:51 +0000 (17:43 +0800)]
ASoC: hdac_hda: Avoid unexpected match when pcm_name is "Analog"

pcm name can be "Analog" and "Alt Analog", cpcm->name can be
"Analog Codec DAI" and "Alt Analog Codec DAI". When pcm_name
is "Analog", "Analog Codec DAI" and "Alt Analog Codec DAI" are
both satisfy the 'if (strstr(cpcm->name, pcm_name))' condition,
which may cause the returned cpcm to be "Alt Analog Codec DAI".

Even if we get the pcm name by id, and "Analog Codec DAI" goes
into the loop before "Alt Analog Codec DAI", but I still think
we'd better have multiple insurances against unexpected return
values. After, we can correctly return the expected result
even if other relevant places are changed.

Signed-off-by: Meng Tang <tangmeng@uniontech.com>
Link: https://lore.kernel.org/r/20220302094351.3487-1-tangmeng@uniontech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: machine driver updates for 5.18
Mark Brown [Wed, 2 Mar 2022 16:58:51 +0000 (16:58 +0000)]
ASoC: Intel: machine driver updates for 5.18

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

Two cleanups to remove an unused filename and typos, and one addition
of an ACPI matching table for a Dell SoundWire SKU without local
microphones.

The main change is the addition of a common 'sof-ssp-amp' machine
driver for devices with amplifiers only (no headset codec) and
different connections using I2S links (Bluetooth offload, HDMI
receiver). It's likely that the amplifier will be swapped out by OEMs,
this machine driver provides a relatively generic solution to avoid
copy-paste of similar solutions.

2 years agoASoC: qcom: Fix error code in lpass_platform_copy()
Dan Carpenter [Tue, 1 Mar 2022 08:11:04 +0000 (11:11 +0300)]
ASoC: qcom: Fix error code in lpass_platform_copy()

The copy_to/from_user() functions return the number of bytes remaining
to be copied.  This function needs to return negative error codes
because snd_soc_pcm_component_copy_user() treats positive returns as
success in soc_component_ret().

Fixes: 7d7209557b67 ("ASoC: qcom: Add support for codec dma driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220301081104.GB17375@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-compress: prevent the potentially use of null pointer
Jiasheng Jiang [Fri, 15 Oct 2021 08:13:53 +0000 (08:13 +0000)]
ASoC: soc-compress: prevent the potentially use of null pointer

There is one call trace that snd_soc_register_card()
->snd_soc_bind_card()->soc_init_pcm_runtime()
->snd_soc_dai_compress_new()->snd_soc_new_compress().
In the trace the 'codec_dai' transfers from card->dai_link,
and we can see from the snd_soc_add_pcm_runtime() in
snd_soc_bind_card() that, if value of card->dai_link->num_codecs
is 0, then 'codec_dai' could be null pointer caused
by index out of bound in 'asoc_rtd_to_codec(rtd, 0)'.
And snd_soc_register_card() is called by various platforms.
Therefore, it is better to add the check in the case of misusing.
And because 'cpu_dai' has already checked in soc_init_pcm_runtime(),
there is no need to check again.
Adding the check as follow, then if 'codec_dai' is null,
snd_soc_new_compress() will not pass through the check
'if (playback + capture != 1)', avoiding the leftover use of
'codec_dai'.

Fixes: 467fece ("ASoC: soc-dai: move snd_soc_dai_stream_valid() to soc-dai.c")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/1634285633-529368-1-git-send-email-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-generic-dmaengine-pcm: set period_bytes_min based on maxburst
Sascha Hauer [Tue, 1 Mar 2022 11:34:46 +0000 (12:34 +0100)]
ASoC: soc-generic-dmaengine-pcm: set period_bytes_min based on maxburst

In dmaengine_pcm_set_runtime_hwparams() period_bytes_min is hardcoded to
256. For some applications that may be too big. This patch changes that
to calculate the value based on dma_data->maxburst. The correct value
would be maxburst multiplied by the address width of the hardware FIFO.
Unfortunately the address width is dynamically calculated based on the
stream parameters and is not known at open time, so the worst case
is chosen here which is 8 bytes, the maximum that is supported by
dmaengine drivers.
Not all drivers may set a maxburst value, so we fall back to the
previously used hardcoded value of 256 bytes.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220301113446.1053171-1-s.hauer@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dwc-i2s: Handle errors for clk_enable
Jiasheng Jiang [Tue, 1 Mar 2022 08:47:42 +0000 (16:47 +0800)]
ASoC: dwc-i2s: Handle errors for clk_enable

As the potential failure of the clk_enable(),
it should be better to check it, as same as clk_prepare_enable().

Fixes: c9afc1834e81 ("ASoC: dwc: Disallow building designware_pcm as a module")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301084742.3751939-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: use asoc_substream_to_rtd()
Zhen Ni [Wed, 2 Mar 2022 08:15:02 +0000 (16:15 +0800)]
ASoC: amd: use asoc_substream_to_rtd()

Uses asoc_substream_to_rtd() helper.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
Link: https://lore.kernel.org/r/20220302081502.25367-1-nizhen@uniontech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: atmel_ssc_dai: Handle errors for clk_enable
Jiasheng Jiang [Tue, 1 Mar 2022 09:06:37 +0000 (17:06 +0800)]
ASoC: atmel_ssc_dai: Handle errors for clk_enable

As the potential failure of the clk_enable(),
it should be better to check it and return error if fals.

Fixes: cbaadf0f90d6 ("ASoC: atmel_ssc_dai: refactor the startup and shutdown")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301090637.3776558-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mxs-saif: Handle errors for clk_enable
Jiasheng Jiang [Tue, 1 Mar 2022 08:17:17 +0000 (16:17 +0800)]
ASoC: mxs-saif: Handle errors for clk_enable

As the potential failure of the clk_enable(),
it should be better to check it, like mxs_saif_trigger().

Fixes: d0ba4c014934 ("ASoC: mxs-saif: set a base clock rate for EXTMASTER mode work")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20220301081717.3727190-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: soc-acpi: add entries in ADL match table
Libin Yang [Tue, 1 Mar 2022 19:49:03 +0000 (13:49 -0600)]
ASoC: Intel: soc-acpi: add entries in ADL match table

Support configuration with SoundWire RT1316 amplifiers on link0 and
link1, and RT711 on link2 for headphone/headset. This product does not
support local microphones.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Libin Yang <libin.yang@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_ssp_amp: rename driver and support cs35l41 amplifier
Brent Lu [Tue, 1 Mar 2022 19:49:02 +0000 (13:49 -0600)]
ASoC: Intel: sof_ssp_amp: rename driver and support cs35l41 amplifier

Add support of CS35L41 amplifier to the machine driver, as well as
the support of HDMI playback and BT offload DAI Link.

Rename the driver to a generic name to support different amplifiers
from different vendors.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: cirrus-common: support cs35l41 amplifier
Brent Lu [Tue, 1 Mar 2022 19:49:01 +0000 (13:49 -0600)]
ASoC: Intel: cirrus-common: support cs35l41 amplifier

Implement cs35l41 support code in this common module so it could be
shared between multiple SOF machine drivers.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220301194903.60859-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>