]> git.proxmox.com Git - mirror_ubuntu-kernels.git/log
mirror_ubuntu-kernels.git
2 years agoASoC: Intel: Introduce AVS driver
Cezary Rojewski [Fri, 11 Mar 2022 15:35:30 +0000 (16:35 +0100)]
ASoC: Intel: Introduce AVS driver

Declare base structures and core DSP operations for the avs solution.
The base structures describe PCI HDAudio bus device and platform-type
differentiations. First set of operations added controls the lifecycle
of any Audio DSP core: (un)powering, (un)resetting and (un)stalling.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220311153544.136854-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Export DAI register and widget ctor and dctor functions
Cezary Rojewski [Fri, 11 Mar 2022 15:35:29 +0000 (16:35 +0100)]
ASoC: Export DAI register and widget ctor and dctor functions

To allow for more flexibility i.e. populating component DAIs dynamically
during its initialization, without being limited to topology loading
procedure, expose snd_soc_register(), snd_soc_dapm_new_dai_widgets() and
snd_soc_dapm_free_widget() functions.

Allows users to first check available resources e.g. number of PCMs
supported by HDAudio codec before allocating the number of DAPM
widgets needed. This prevents superfluous objects from being created or
allows driver to adjust to situation when resources are limited.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220311153544.136854-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoALSA: hda: Add helper macros for DSP capable devices
Cezary Rojewski [Fri, 11 Mar 2022 15:35:28 +0000 (16:35 +0100)]
ALSA: hda: Add helper macros for DSP capable devices

HDAudio drivers make heavy use of I/O operations. Declare a range of
update, read and write helpers similar to those available for HDAudio
legacy driver. These macros are used by AVS driver to improve code
readability.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20220311153544.136854-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: atmel: mchp-pdmc: Fix spelling mistake "microchopnes" -> "microphones"
Colin Ian King [Wed, 9 Mar 2022 16:41:16 +0000 (16:41 +0000)]
ASoC: atmel: mchp-pdmc: Fix spelling mistake "microchopnes" -> "microphones"

There is a spelling mistake in a dev_info message. Fix it.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220309164116.178685-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: imx-es8328: Fix error return code in imx_es8328_probe()
Wang Wensheng [Thu, 10 Mar 2022 09:19:02 +0000 (09:19 +0000)]
ASoC: imx-es8328: Fix error return code in imx_es8328_probe()

Fix to return a negative error code from the error handling case instead
of 0, as done elsewhere in this function.

Fixes: 7e7292dba215 ("ASoC: fsl: add imx-es8328 machine driver")
Signed-off-by: Wang Wensheng <wangwensheng4@huawei.com>
Link: https://lore.kernel.org/r/20220310091902.129299-1-wangwensheng4@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: atmel: mchp-pdmc: Remove unnecessary print function dev_err()
Jiapeng Chong [Thu, 10 Mar 2022 08:27:56 +0000 (16:27 +0800)]
ASoC: atmel: mchp-pdmc: Remove unnecessary print function dev_err()

The print function dev_err() is redundant because
platform_get_irq() already prints an error.

Eliminate the follow coccicheck warning:

./sound/soc/atmel/mchp-pdmc.c:991:2-9: line 991 is redundant because
platform_get_irq() already prints an error.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
Link: https://lore.kernel.org/r/20220310082756.1183-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_spdif: Disable TX clock when stop
Shengjiu Wang [Thu, 10 Mar 2022 02:37:43 +0000 (10:37 +0800)]
ASoC: fsl_spdif: Disable TX clock when stop

The TX clock source may be changed in next case, need to
disable it when stop, otherwise the TX may not work after
changing the clock source, error log is:

aplay: pcm_write:2058: write error: Input/output error

Fixes: a2388a498ad2 ("ASoC: fsl: Add S/PDIF CPU DAI driver")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1646879863-27711-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoClean ups and preparation for IPC abstraction in the SOF driver
Mark Brown [Thu, 10 Mar 2022 11:33:40 +0000 (11:33 +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 agoALSA/ASoC/SOF/Intel: improve support for ES8336-based platforms
Mark Brown [Thu, 10 Mar 2022 11:33:39 +0000 (11:33 +0000)]
ALSA/ASoC/SOF/Intel: improve support for ES8336-based platforms

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

This patchset adds a number of improvements for ES8336-based Intel
platforms, which are not well supported at all in Linux. Since
Christmas 2021, we've seen dozens of reports of broken audio [1].

The fundamental problem is that those platforms were built for Windows
but using an I2S codec - instead of the HDaudio traditional
solution. As a result, we are missing all the usual information needed
to configure the audio card (which I2S, what configuration, DMICs or
not, etc). The situation is similar to Baytrail with all possible
permutations enabled.

Some of the information can be discovered by checking the contents of
the 'NHLT' ACPI table. This helps discover at run-time which SSP to
use, and the number of microphones present. This NHLT-based solution
helps remove quirks that were added earlier.

Unfortunately, there are still a number of platform properties that
are not described by ACPI, just as GPIOs used for speakers, jack
detection inversion, etc. For some case, quirks are still provided in
the machine drivers.

Additional work will likely be needed, e.g. to detect which MCLK needs
to be used, refine the UCM settings, add the ES8326 codec driver, but
this is a first-step towards an 'out of the box' experience on Intel
platforms.

This patchset touches the sound/hda/intel-nhlt parts but should IMHO
be merged in the ASoC tree.

I would like to acknowledge the help of Nikolai Kostrigin, Mauro
Carvalho Chehab, Huajun Li, David Yang (@yangxiaohua2009) and other
GitHub testers.

[1] https://github.com/thesofproject/linux/issues?q=is%3Aissue+is%3Aopen+label%3A%22codec+ES8336%22

2 years agoASoC: qcom: fix Kconfig for SC7280
Srinivas Kandagatla [Wed, 9 Mar 2022 14:05:52 +0000 (14:05 +0000)]
ASoC: qcom: fix Kconfig for SC7280

select would force the symbol to value without checking the dependencies.
In this case selecting TX and RX MACROs directly without checking its
dependency on COMMON_CLK would break builds on platform which do no
set COMMON_CLK.
ex:
WARNING: unmet direct dependencies detected for SND_SOC_LPASS_RX_MACRO
  Depends on [n]: SOUND [=m] && !UML && SND [=m] && SND_SOC [=m] && COMMON_CLK [=n]
  Selected by [m]:
  - SND_SOC_SC7280 [=m] && SOUND [=m] && !UML && SND [=m] && SND_SOC [=m] &&
 SND_SOC_QCOM [=m] && I2C [=y] && SOUNDWIRE [=m]

move select to imply which should enforce symbol to be set to 'n' if any
dependencies are not resolved.

Fixes: 57350bd41c3a ("ASoC: qcom: SC7280: Add machine driver")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20220309140552.8065-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc-msg-injector: Use devm_kzalloc() for the rx_buffer
Peter Ujfalusi [Wed, 9 Mar 2022 11:01:04 +0000 (13:01 +0200)]
ASoC: SOF: ipc-msg-injector: Use devm_kzalloc() for the rx_buffer

The rx_buffer is cleared before sending an IPC to make sure that when the
/sys/kernel/debug/sof/ipc_msg_inject file is read we will have correct
information in the buffer (no random or stale data).

But if the user reads the file before sending any message the buffer might
contain garbage which should not be interpreted.

To prevent this, clear the rx_buffer on allocation.

Fixes: cac0b0887e53 ("ASoC: SOF: Convert the generic IPC message injector into SOF client")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220309110104.18370-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_spdif: keep all TxClk sources by txclk array
Viorel Suman [Wed, 9 Mar 2022 09:18:43 +0000 (17:18 +0800)]
ASoC: fsl_spdif: keep all TxClk sources by txclk array

Use txclk array to keep all TxClk sources instead of keeping
clocks per rate - need to do this in order to avoid multiple
prepare_enable/disable_unprepare of the same clock during
suspend/resume.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1646817523-26800-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: Remove unneeded semicolon
Jiapeng Chong [Wed, 9 Mar 2022 00:49:28 +0000 (08:49 +0800)]
ASoC: SOF: amd: Remove unneeded semicolon

Fix the following coccicheck warnings:

./sound/soc/sof/amd/acp-ipc.c:74:2-3: Unneeded semicolon.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220309004929.125558-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: amd: Remove unneeded semicolon
Jiapeng Chong [Wed, 9 Mar 2022 00:49:29 +0000 (08:49 +0800)]
ASoC: SOF: amd: Remove unneeded semicolon

Fix the following coccicheck warnings:

./sound/soc/sof/amd/acp.c:280:3-4: Unneeded semicolon.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220309004929.125558-2-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: boards: fix randconfig issue
Pierre-Louis Bossart [Tue, 8 Mar 2022 20:23:18 +0000 (14:23 -0600)]
ASoC: Intel: boards: fix randconfig issue

on x86_64:

ERROR: modpost: "sof_dai_get_bclk"
[sound/soc/intel/boards/snd-soc-intel-sof-cirrus-common.ko] undefined!

ERROR: modpost: "sof_dai_get_mclk"
[sound/soc/intel/boards/snd-soc-intel-sof-realtek-common.ko]
undefined!

This comes from a missing dependency on at least ONE SOF platform
being selected. This dependency exists for all other machine drivers,
this was missed in the earlier reviews.

Fixes: 2fe14ff61bd6 ("ASoC: Intel: sof_ssp_amp: rename driver and support cs35l41 amplifier")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220308202318.401358-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_rpmsg: Remove SET_SYSTEM_SLEEP_PM_OPS callback
Shengjiu Wang [Wed, 9 Mar 2022 10:38:13 +0000 (18:38 +0800)]
ASoC: fsl_rpmsg: Remove SET_SYSTEM_SLEEP_PM_OPS callback

For sound need to be continuously output at suspend with rpmsg
sound card, so need to keep the clock always on at suspend,
then suspend & resume callback is not needed.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1646822293-26965-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
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 agoASoC: SOF: move definition of snd_sof_ipc to header file
Rander Wang [Tue, 8 Mar 2022 16:43:44 +0000 (08:43 -0800)]
ASoC: SOF: move definition of snd_sof_ipc to header file

Move definition of struct snd_sof_ipc to the header file so it can be
shared with new IPC versions.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220308164344.577647-19-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: make struct snd_sof_dai IPC agnostic
Ranjani Sridharan [Tue, 8 Mar 2022 16:43:43 +0000 (08:43 -0800)]
ASoC: SOF: make struct snd_sof_dai IPC agnostic

Remove the comp_dai and dai_config members of struct snd_sof_dai and
replace it with a void *private field. Introduce a new struct
sof_dai_private_data that will contain the pointer to these two fields.
The topology parser will populate this structure and save it as part of
the "private" member in snd_sof_dai. Change all users of these fields to
use the private member instead.

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/20220308164344.577647-18-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Rename arguments in sof_parse_tokens()
Ranjani Sridharan [Tue, 8 Mar 2022 16:43:42 +0000 (08:43 -0800)]
ASoC: SOF: topology: Rename arguments in sof_parse_tokens()

Rename the count and priv_size arguments in sof_parse_tokens() and add
comments to clarify the arguments.

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/20220308164344.577647-17-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Rename arguments in sof_parse_token_sets()
Ranjani Sridharan [Tue, 8 Mar 2022 16:43:41 +0000 (08:43 -0800)]
ASoC: SOF: topology: Rename arguments in sof_parse_token_sets()

Rename the priv_size arg to array_size and clarify the arguments in the
comments.

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/20220308164344.577647-16-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Modify signature for token parsing functions
Ranjani Sridharan [Tue, 8 Mar 2022 16:43:40 +0000 (08:43 -0800)]
ASoC: SOF: topology: Modify signature for token parsing functions

Modify the signature for sof_parse_uuid_tokens(),
sof_parse_word_tokens() and sof_parse_string_tokens() to reorder the
arguments to be more intuitive and rename the count arg to num_tokens.

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/20220308164344.577647-15-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add a tuples array to struct snd_sof_widget
Ranjani Sridharan [Tue, 8 Mar 2022 16:43:39 +0000 (08:43 -0800)]
ASoC: SOF: Add a tuples array to struct snd_sof_widget

Add 2 new fields to snd_sof_widget to store an array of tuples
defined by struct snd_sof_tuple and the number of tuples. When the
topology gets parsed, the tuples associated with a widget will be stored
in this array and will be used to construct the IPC structure
depending on the IPC version.

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/20220308164344.577647-14-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: make sof_route_load() IPC agnostic
Ranjani Sridharan [Tue, 8 Mar 2022 16:43:38 +0000 (08:43 -0800)]
ASoC: SOF: topology: make sof_route_load() IPC agnostic

The IPC structure can be set up using the fields in struct snd_sof_route
when the pipeline connections are established.

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/20220308164344.577647-13-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: make struct snd_sof_widget IPC agnostic
Ranjani Sridharan [Tue, 8 Mar 2022 16:43:37 +0000 (08:43 -0800)]
ASoC: SOF: make struct snd_sof_widget IPC agnostic

Parse the UUID token and save it in the new uuid field in struct
snd_sof_widget. struct sof_ipc_comp_ext is no longer needed. So remove
it too.

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/20220308164344.577647-12-ranjani.sridharan@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>