OSDN Git Service

tomoyo/tomoyo-test1.git
16 months agoASoC: amd: yc: Add DMI entries to support HP OMEN 16-n0xxx (8A43)
Duc Anh Le [Mon, 27 Feb 2023 23:49:21 +0000 (00:49 +0100)]
ASoC: amd: yc: Add DMI entries to support HP OMEN 16-n0xxx (8A43)

This model requires an additional detection quirk to enable the internal microphone.

Signed-off-by: Duc Anh Le <lub.the.studio@gmail.com>
Link: https://lore.kernel.org/r/20230227234921.7784-1-lub.the.studio@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: zl38060 add gpiolib dependency
Arnd Bergmann [Mon, 27 Feb 2023 08:58:26 +0000 (09:58 +0100)]
ASoC: zl38060 add gpiolib dependency

Without gpiolib, this driver fails to link:

arm-linux-gnueabi-ld: sound/soc/codecs/zl38060.o: in function `chip_gpio_get':
zl38060.c:(.text+0x30): undefined reference to `gpiochip_get_data'
arm-linux-gnueabi-ld: sound/soc/codecs/zl38060.o: in function `zl38_spi_probe':
zl38060.c:(.text+0xa18): undefined reference to `devm_gpiochip_add_data_with_key'

This appears to have been in the driver since the start, but is hard to
hit in randconfig testing since gpiolib is almost always selected by something
else.

Fixes: 52e8a94baf90 ("ASoC: Add initial ZL38060 driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230227085850.2503725-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: sam9g20ek: Disable capture unless building with microphone input
Mark Brown [Sat, 25 Feb 2023 21:48:13 +0000 (21:48 +0000)]
ASoC: sam9g20ek: Disable capture unless building with microphone input

Without modification the AT91SAM9G20-EK has no capture support, none of the
inputs of the CODEC are wired to anything to useful and there are no paths
supporting loopback. Since the audio is clocked from the CODEC and the DAPM
inputs are marked as unusable this means that capture will fail to transfer
any data as the ADC path can't be powered up.

Flag this in the device description so apps don't see unusable capture
support, guarded with the existing optional define for mic input.

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230225-asoc-sam9g20ek-v1-1-9baeb4893142@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: apple: mca: Improve handling of unavailable DMA channels
Martin Povišer [Fri, 24 Feb 2023 15:33:02 +0000 (16:33 +0100)]
ASoC: apple: mca: Improve handling of unavailable DMA channels

When we fail to obtain a DMA channel, don't return a blanket -EINVAL,
instead return the original error code if there's one. This makes
deferring work as it should. Also don't print an error message for
-EPROBE_DEFER.

Fixes: 4ec8179c212f ("ASoC: apple: mca: Postpone requesting of DMA channels")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20230224153302.45365-3-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: apple: mca: Fix SERDES reset sequence
Martin Povišer [Fri, 24 Feb 2023 15:33:01 +0000 (16:33 +0100)]
ASoC: apple: mca: Fix SERDES reset sequence

Fix the reset sequence of reads and writes that we invoke from within
the early trigger. It looks like there never was a SERDES_CONF_SOME_RST
bit that should be involved in the reset sequence, and its presence in
the driver code is a mistake from earlier.

Instead, the reset sequence should go as follows: We should switch the
the SERDES unit's SYNC_SEL mux to the value of 7 (so outside the range
of 1...6 representing cluster's SYNCGEN units), then raise the RST bit
in SERDES_STATUS and wait for it to clear.

Properly resetting the SERDES unit fixes frame desynchronization hazard
in case of long frames (longer than 4 used slots). The desynchronization
manifests itself by rotating the PCM channels.

Fixes: 3df5d0d97289 ("ASoC: apple: mca: Start new platform driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20230224153302.45365-2-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: apple: mca: Fix final status read on SERDES reset
Martin Povišer [Fri, 24 Feb 2023 15:33:00 +0000 (16:33 +0100)]
ASoC: apple: mca: Fix final status read on SERDES reset

From within the early trigger we are doing a reset of the SERDES unit,
but the final status read is on a bad address. Add the missing SERDES
unit offset in calculation of the address.

Fixes: 3df5d0d97289 ("ASoC: apple: mca: Start new platform driver")
Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20230224153302.45365-1-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: adau7118: don't disable regulators on device unbind
Nuno Sá [Fri, 24 Feb 2023 10:45:51 +0000 (11:45 +0100)]
ASoC: adau7118: don't disable regulators on device unbind

The regulators are supposed to be controlled through the
set_bias_level() component callback. Moreover, the regulators are not
enabled during probe and so, this would lead to a regulator unbalanced
use count.

Fixes: ca514c0f12b02 ("ASOC: Add ADAU7118 8 Channel PDM-to-I2S/TDM Converter driver")
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20230224104551.1139981-1-nuno.sa@analog.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: dt-bindings: apple,mca: Add t8112-mca compatible
Janne Grunau [Sun, 12 Feb 2023 15:41:24 +0000 (16:41 +0100)]
ASoC: dt-bindings: apple,mca: Add t8112-mca compatible

The block found on Apple's M2 SoC is compatible with the existing driver
so add its per-SoC compatible.

Signed-off-by: Janne Grunau <j@jannau.net>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20230202-asahi-t8112-dt-v1-14-cb5442d1c229@jannau.net
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: Intel: sof_rt5682: Add quirk for Rex board with mx98360a amplifier
Dharageswari.R [Mon, 20 Feb 2023 08:06:52 +0000 (10:06 +0200)]
ASoC: Intel: sof_rt5682: Add quirk for Rex board with mx98360a amplifier

Add mtl_mx98360a_rt5682 driver data for Chrome Rex board support.

Signed-off-by: Dharageswari.R <dharageswari.r@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230220080652.23136-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: mediatek: mt8188: correct etdm control return value
Trevor Wu [Wed, 15 Feb 2023 12:50:16 +0000 (20:50 +0800)]
ASoC: mediatek: mt8188: correct etdm control return value

In mt8188_etdm_clk_src_sel_put() function, val retrieved by FIELD_PREP
is shifted to the corresponding bit filed, so it can compare with the
register value directly.

Originally, the redundant bit shift of the register value results in
the wrong comparison result, so we remove bit shift operation in the
patch.

Fixes: 2babb4777489 ("ASoC: mediatek: mt8188: support etdm in platform driver")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230215125017.16044-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: SMA1303: Change the value for right output
Kiseok Jo [Fri, 17 Feb 2023 00:44:03 +0000 (00:44 +0000)]
ASoC: SMA1303: Change the value for right output

This device can output mono, left or right.
LR data should be swapped to output right data.

Signed-off-by: Kiseok Jo <kiseok.jo@irondevice.com>
Link: https://lore.kernel.org/r/20230217004403.10220-1-kiseok.jo@irondevice.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: amd: yp: Add OMEN by HP Gaming Laptop 16z-n000 to quirks
Joseph Hunkeler [Thu, 16 Feb 2023 15:50:07 +0000 (10:50 -0500)]
ASoC: amd: yp: Add OMEN by HP Gaming Laptop 16z-n000 to quirks

Enables display microphone on the HP OMEN 16z-n000 (8A42) laptop

Signed-off-by: Joseph Hunkeler <jhunkeler@gmail.com>
Link: https://lore.kernel.org/r/20230216155007.26143-1-jhunkeler@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
16 months agoASoC: rsnd: adg: Fix BRG typos
Geert Uytterhoeven [Wed, 15 Feb 2023 14:17:41 +0000 (15:17 +0100)]
ASoC: rsnd: adg: Fix BRG typos

"BRG" stands for "Baud Rate Generator", but is frequently misspelled as
"RBG".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/ac6365c17861d71fbc89d823089db4aafdb763ed.1676470202.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: da7219: Improve the IRQ process to increase the stability
David Rau [Wed, 15 Feb 2023 10:10:45 +0000 (10:10 +0000)]
ASoC: da7219: Improve the IRQ process to increase the stability

Remove the sleep control in IRQ thread
and create an individual task to handel it for Jack plug in event.

This commit improves the control of ground switches in the AAD IRQ.

Signed-off-by: David Rau <David.Rau.opensource@dm.renesas.com>
Link: https://lore.kernel.org/r/20230215101045.21456-1-David.Rau.opensource@dm.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-ac97: Return correct error codes
Andy Shevchenko [Wed, 15 Feb 2023 13:23:43 +0000 (15:23 +0200)]
ASoC: soc-ac97: Return correct error codes

With the switching to dev_err_probe(), during the conversion
of GPIO calls, the return code is passed is a paratemer to it.
At the same time a copy'n'paste mistake was made, so the wrong
variable has been taken for the error reporting. Fix this.

Fixes: 3ee0d39c50dc ("ASoC: soc-ac97: Convert to agnostic GPIO API")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230215132343.35547-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-dapm.h: fixup warning struct snd_pcm_substream not declared
Lucas Tanure [Wed, 15 Feb 2023 13:28:51 +0000 (13:28 +0000)]
ASoC: soc-dapm.h: fixup warning struct snd_pcm_substream not declared

Add struct snd_pcm_substream forward declaration

Fixes: 078a85f2806f ("ASoC: dapm: Only power up active channels from a DAI")
Signed-off-by: Lucas Tanure <lucas.tanure@collabora.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230215132851.1626881-1-lucas.tanure@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: cs35l45: Remove separate namespace for tables
Charles Keepax [Wed, 15 Feb 2023 10:58:18 +0000 (10:58 +0000)]
ASoC: cs35l45: Remove separate namespace for tables

Now tables isn't a separate module, definitely no need to have a
separate namespace for it.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230215105818.3315925-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: cs35l45: Remove separate tables module
Charles Keepax [Wed, 15 Feb 2023 10:58:17 +0000 (10:58 +0000)]
ASoC: cs35l45: Remove separate tables module

There is no reason to have a separate module for the tables file it just
holds regmap callbacks and register patches used by the main part of the
driver. Remove the separate module and merge it into the main driver
module.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230215105818.3315925-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: soc-ac97: Convert to agnostic GPIO API
Andy Shevchenko [Mon, 13 Feb 2023 16:17:13 +0000 (18:17 +0200)]
ASoC: soc-ac97: Convert to agnostic GPIO API

The of_gpio.h is going to be removed. In preparation of that convert
the driver to the agnostic API.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230213161713.1450-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: renesas,rsnd.yaml: drop "dmas/dma-names" from "rcar_sound,ssi"
Kuninori Morimoto [Mon, 13 Feb 2023 02:13:18 +0000 (02:13 +0000)]
ASoC: dt-bindings: renesas,rsnd.yaml: drop "dmas/dma-names" from "rcar_sound,ssi"

SSI is supporting both "PIO mode" and "DMA mode", thus "dmas/dma-names"
are not mandatory property. Drop these from rcar_sound,ssi's required:.
This is prepare for Gen4 support. See more details on Link

Link: https://lore.kernel.org/all/87zg9vk0ex.wl-kuninori.morimoto.gx@renesas.com/#r
Link: https://lore.kernel.org/all/87r0v2uvm7.wl-kuninori.morimoto.gx@renesas.com/#r
Link: https://lore.kernel.org/all/87r0v1t02h.wl-kuninori.morimoto.gx@renesas.com/#r
Link: https://lore.kernel.org/all/87y1p7bpma.wl-kuninori.morimoto.gx@renesas.com/#r
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/87r0uu8g8x.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: Intel/ipc4: Support for low power playback
Mark Brown [Tue, 14 Feb 2023 17:59:59 +0000 (17:59 +0000)]
ASoC: SOF: Intel/ipc4: Support for low power playback

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

The following series will enable the the Low Power Audio (LPA)
playback on Intel platforms when using IPC4.

The support is closely follows how IPC3 supports similar use case.

All depending patches are upstream and our CI have been testing
this feature for some time without issues.

17 months agoASoC: codecs: wcd934x: Use min macro for comparison and assignment
Deepak R Varma [Mon, 13 Feb 2023 17:40:46 +0000 (23:10 +0530)]
ASoC: codecs: wcd934x: Use min macro for comparison and assignment

Simplify code by using min helper macro for logical evaluation and value
assignment. The change also facilitates code realignment for improved
readability.
Proposed change is identified using minmax.cocci Coccinelle script.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/Y+p2Hn0nrtHiKwPR@ubun2204.myguest.virtualbox.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: Intel: Skylake: Fix struct definition
Amadeusz Sławiński [Mon, 13 Feb 2023 20:52:23 +0000 (21:52 +0100)]
ASoC: Intel: Skylake: Fix struct definition

The kernel is globally removing the ambiguous 0-length and 1-element
arrays in favor of flexible arrays, so that we can gain both compile-time
and run-time array bounds checking[1]. In this instance, struct
skl_cpr_cfg contains struct skl_cpr_gtw_cfg, which defined "config_data"
as a 1-element array.

However, case present in sound/soc/intel/skylake/skl-topology.h is not a
simple one as the structure takes part in IPC communication. Apparently
original definition missed one field, which while not used by AudioDSP
firmware when there is no additional data, is still expected to be part
of an IPC message. Currently this works because of how 'config_data' is
declared: 'config_data[1]'. Now when one replaces it with a flexible
array there would be one field missing. Update struct declaration to fix
this.

Reported-by: Sasa Ostrouska <casaxa@gmail.com>
Link: https://lore.kernel.org/all/CALFERdwvq5day_sbDfiUsMSZCQu9HG8-SBpOZDNPeMdZGog6XA@mail.gmail.com/
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Cc: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Cc: alsa-devel@alsa-project.org
CC: Kees Cook <keescook@chromium.org>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20230213205223.2679357-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: tlv320adcx140: extend list of supported samplerates
Steffen Aschbacher [Tue, 14 Feb 2023 09:10:51 +0000 (11:10 +0200)]
ASoC: tlv320adcx140: extend list of supported samplerates

The 'tlv320adcx140' driver currently supports 3 devices: TLV320ADC3140,
TLV320ADC5140 and TLV320ADC6140.

All 3 devices, support higher samplerates, up to 768-kHz according to their
datasheets.

In our applications, we only tested (and worked) with 96 kHz and 192 kHz.

This change extends the list of supported sample-rates for these devices
with 96 & 192 kHz.

References:
  https://www.ti.com/product/TLV320ADC3140
  https://www.ti.com/product/TLV320ADC5140
  https://www.ti.com/product/TLV320ADC6140

Signed-off-by: Steffen Aschbacher <steffen.aschbacher@stihl.de>
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
Link: https://lore.kernel.org/r/20230214091051.16323-1-alex@shruggie.ro
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: imx-pcm-rpmsg: Remove unused variable
Deepak R Varma [Mon, 13 Feb 2023 18:13:03 +0000 (23:43 +0530)]
ASoC: imx-pcm-rpmsg: Remove unused variable

Variable ret is initialed but is never modified or used except for
returning the initial value 0. The value can be directly returned
instead and the variable definition can be dropped.
Issue identified using returnvar.cocci Coccinelle semantic patch.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Link: https://lore.kernel.org/r/Y+p9r5y9DPSJkPVf@ubun2204.myguest.virtualbox.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoSoC: rt5682s: Disable jack detection interrupt during suspend
Matthias Kaehlcke [Thu, 9 Feb 2023 01:20:23 +0000 (01:20 +0000)]
SoC: rt5682s: Disable jack detection interrupt during suspend

The rt5682s driver switches its regmap to cache-only when the
device suspends and back to regular mode on resume. When the
jack detect interrupt fires rt5682s_irq() schedules the jack
detect work. This can result in invalid reads from the regmap
in cache-only mode if the work runs before the device has
resumed:

[   19.672162] rt5682s 2-001a: ASoC: error at soc_component_read_no_lock on rt5682s.2-001a for register: [0x000000f0] -16

Disable the jack detection interrupt during suspend and
re-enable it on resume. The driver already schedules the
jack detection work on resume, so any state change during
suspend is still handled.

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Link: https://lore.kernel.org/r/20230209012002.1.Ib4d6481f1d38a6e7b8c9e04913c02ca88c216cf6@changeid
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: Intel: hda-dsp: Set streaming flag for d0i3
Rander Wang [Tue, 14 Feb 2023 10:33:45 +0000 (12:33 +0200)]
ASoC: SOF: Intel: hda-dsp: Set streaming flag for d0i3

Enable d0i3 streaming if all the active streams can
work in d0i3 state and playback is enabled.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230214103345.30669-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: Intel: Enable d0i3 work for ipc4
Rander Wang [Tue, 14 Feb 2023 10:33:44 +0000 (12:33 +0200)]
ASoC: SOF: Intel: Enable d0i3 work for ipc4

Schedule a delayed work for d0i3 entry after every non-pm ipc msg.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230214103345.30669-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: ipc4: Wake up dsp core before sending ipc msg
Rander Wang [Tue, 14 Feb 2023 10:33:43 +0000 (12:33 +0200)]
ASoC: SOF: ipc4: Wake up dsp core before sending ipc msg

The driver shall update the power state to D0i0 before sending
a generic IPC. Power-related IPCs are the exception to the rule,
they may be sent even when the power-state is D0i3

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230214103345.30669-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: Intel: hda-dsp: use set_pm_gate according to ipc version
Rander Wang [Tue, 14 Feb 2023 10:33:42 +0000 (12:33 +0200)]
ASoC: SOF: Intel: hda-dsp: use set_pm_gate according to ipc version

Use set_pm_gate to unify pm gate setting for different
ipc version.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230214103345.30669-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: Introduce a new set_pm_gate() IPC PM op
Rander Wang [Tue, 14 Feb 2023 10:33:41 +0000 (12:33 +0200)]
ASoC: SOF: Introduce a new set_pm_gate() IPC PM op

Set_pm_gate depends on ipc version. This patch defines
the ops for both IPC3 and IPC4.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230214103345.30669-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: Remove unneeded semicolon
Yang Li [Mon, 13 Feb 2023 01:05:47 +0000 (09:05 +0800)]
ASoC: codecs: Remove unneeded semicolon

./sound/soc/codecs/peb2466.c:1851:2-3: Unneeded semicolon
./sound/soc/codecs/peb2466.c:1887:2-3: Unneeded semicolon

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4045
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Acked-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20230213010547.105312-1-yang.lee@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: tlv320adcx140: fix 'ti,gpio-config' DT property init
Steffen Aschbacher [Mon, 13 Feb 2023 07:38:05 +0000 (09:38 +0200)]
ASoC: tlv320adcx140: fix 'ti,gpio-config' DT property init

When the 'ti,gpio-config' property is not defined, the
device_property_count_u32() will return an error, rather than zero.

The current check, only handles a return value of zero, which assumes that
the property is defined and has nothing defined.

This change extends the check to also check for an error case (most likely
to be hit by the case that the 'ti,gpio-config' is not defined).

In case that the 'ti,gpio-config' and the returned 'gpio_count' is not
correct, there is a 'if (gpio_count != ADCX140_NUM_GPIO_CFGS)' check, a few
lines lower that will return -EINVAL.
This means that someone tried to define 'ti,gpio-config', but with the
wrong number of GPIOs.

Fixes: d5214321498a ("ASoC: tlv320adcx140: Add support for configuring GPIO pin")
Signed-off-by: Steffen Aschbacher <steffen.aschbacher@stihl.de>
Signed-off-by: Alexandru Ardelean <alex@shruggie.ro>
Link: https://lore.kernel.org/r/20230213073805.14640-1-alex@shruggie.ro
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: Modify error implicit declaration of function 'gpiod_set_value_cansleep'
Weidong Wang [Mon, 13 Feb 2023 09:36:49 +0000 (17:36 +0800)]
ASoC: codecs: Modify error implicit declaration of function 'gpiod_set_value_cansleep'

Add select GPIOLIB to the sound/soc/codecs/Kconfig file

Signed-off-by: Ben Yi <yijiangtao@awinic.com>
Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://lore.kernel.org/r/20230213093649.22928-4-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: Modify the log print statement
Weidong Wang [Mon, 13 Feb 2023 09:36:48 +0000 (17:36 +0800)]
ASoC: codecs: Modify the log print statement

Change hdrlen to hdr_len

Signed-off-by: Ben Yi <yijiangtao@awinic.com>
Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://lore.kernel.org/r/20230213093649.22928-3-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: Fixed a spelling error in the function name
Weidong Wang [Mon, 13 Feb 2023 09:36:47 +0000 (17:36 +0800)]
ASoC: codecs: Fixed a spelling error in the function name

Change the function name aw88395_plack_event to aw88395_playback_event

Signed-off-by: Ben Yi <yijiangtao@awinic.com>
Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://lore.kernel.org/r/20230213093649.22928-2-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: maxim,max98095: Convert to dtschema
Krzysztof Kozlowski [Sat, 11 Feb 2023 13:47:55 +0000 (14:47 +0100)]
ASoC: dt-bindings: maxim,max98095: Convert to dtschema

Convert the Maxim Integrated MAX98095 audio codec bindings to DT schema.
Add missing sound-dai-cells during conversion.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230211134755.86061-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: ep93xx: ignore 0 Hz sysclk
Alexander Sverdlin [Sun, 12 Feb 2023 22:09:23 +0000 (23:09 +0100)]
ASoC: ep93xx: ignore 0 Hz sysclk

Commit 2458adb8f92a
("SoC: simple-card-utils: set 0Hz to sysclk when shutdown")
added a call to snd_soc_dai_set_sysclk() with 0 Hz frequency. Being
propagated further it causes a division by zero in clk-ep93xx driver:

Division by zero in kernel.
CPU: 0 PID: 52 Comm: aplay Tainted: G        W          6.2.0-rc4-... #1
Hardware name: Generic DT based system
 unwind_backtrace from show_stack+0x10/0x18
 show_stack from dump_stack_lvl+0x28/0x34
 dump_stack_lvl from __div0+0x10/0x1c
 __div0 from Ldiv0+0x8/0x1c
 Ldiv0 from ep93xx_mux_determine_rate+0x78/0x1d0
 ep93xx_mux_determine_rate from clk_core_round_rate_nolock+0x48/0xc8
 clk_core_round_rate_nolock from clk_core_set_rate_nolock+0x48/0x160
 clk_core_set_rate_nolock from clk_set_rate+0x30/0x8c
 clk_set_rate from ep93xx_i2s_set_sysclk+0x30/0x6c
 ep93xx_i2s_set_sysclk from snd_soc_dai_set_sysclk+0x3c/0xa4
 snd_soc_dai_set_sysclk from asoc_simple_shutdown+0xb8/0x164
 asoc_simple_shutdown from snd_soc_link_shutdown+0x44/0x54
 snd_soc_link_shutdown from soc_pcm_clean+0x78/0x180
 soc_pcm_clean from soc_pcm_close+0x28/0x40
 soc_pcm_close from snd_pcm_release_substream.part.0+0x3c/0x84
 snd_pcm_release_substream.part.0 from snd_pcm_release+0x40/0x88
 snd_pcm_release from __fput+0x74/0x278

There has been commit f1879d7b98dc ("ASoC: rockchip: ignore 0Hz sysclk"),
but it prepared by far not all drivers.

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20230212220923.258414-1-alexander.sverdlin@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: rt712-sdca: fix coding style and unconditionally return issues
Shuming Fan [Fri, 10 Feb 2023 08:21:41 +0000 (16:21 +0800)]
ASoC: rt712-sdca: fix coding style and unconditionally return issues

This patch fixes
1. coding style issues
2. check if the setting was set already in rt712_sdca_mux_put callback

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20230210082141.24077-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: rsnd: core.c: indicate warning if strange TDM width was set
Kuninori Morimoto [Fri, 10 Feb 2023 05:13:43 +0000 (05:13 +0000)]
ASoC: rsnd: core.c: indicate warning if strange TDM width was set

Current rsnd silently uses default TDM width if it was strange
settings. It is difficult to notice about it.
This patch indicates warning for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87lel6ksqn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: qcom: q6dsp and lpass codec stablity fixes
Mark Brown [Thu, 9 Feb 2023 18:24:42 +0000 (18:24 +0000)]
ASoC: qcom: q6dsp and lpass codec stablity fixes

Merge series from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
From q6dsp side issues are around locking of position pointer and handle
From LPASS codec side most of the staiblity issues were around runtime pm,:

While testing X13s audio, we found multiple stablity issues this patchset
fixes these issues.
From q6dsp side issues are around locking of position pointer and handle
multiple prepare cases along with pulse audio timerbased scheduling workaround.

From LPASS codec side most of the staiblity issues were around runtime pm,
hitting various issues as the codec was firstly resetting the soundwire block
for every clk disable/enable which is taking the slaves out of sync and
resulting in re-enumerating. Second issue was around fsgen clk is not
brining up the codec out of suspend as it was not added after
runtime pm enabled. Final issue was with codec mclk rate which should
have been 192KHz same as npl instead of 96KHz. We were getting lucky as
wsa drivers are setting the same clk to 192KHz.

With this patches, x13s audio is pretty stable.

17 months agoASoC: SOF: ipc4-topology: Configure copier sink format
Mark Brown [Thu, 9 Feb 2023 18:24:35 +0000 (18:24 +0000)]
ASoC: SOF: ipc4-topology: Configure copier sink format

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

In a course of creating complicated topologies where multiple output pins of a
copier is enabled, we have discovered that additional configuration needs to be
sent to the firmware to make the use cases working.

17 months agoAdd the Infineon PEB2466 codec support
Mark Brown [Thu, 9 Feb 2023 18:24:27 +0000 (18:24 +0000)]
Add the Infineon PEB2466 codec support

Merge series from Herve Codina <herve.codina@bootlin.com>:

The Infineon PEB2466 codec is a programmable DSP-based four channels
codec with filters capabilities.
It also provides signals as GPIOs.

17 months agoASoC: dt-bindings: qcom,q6apm-dai: adjust iommus for SM8550 ADSP
Krzysztof Kozlowski [Mon, 6 Feb 2023 15:05:32 +0000 (16:05 +0100)]
ASoC: dt-bindings: qcom,q6apm-dai: adjust iommus for SM8550 ADSP

It seems that SM8550 ADSP remote processor uses two IOMMUs.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230206150532.513468-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: qcom,wcd934x: Allow usage as IFD device
Krzysztof Kozlowski [Mon, 6 Feb 2023 18:08:05 +0000 (19:08 +0100)]
ASoC: dt-bindings: qcom,wcd934x: Allow usage as IFD device

The WCD9340 audio codec appears on Slimbus twice: as IFD device without
properties and the actual audio-codec referencing the former via
wcd9340_ifd.  Allow in the binding both versions to fix several warnings
like:

  sdm850-samsung-w737.dtb: ifd@0,0: 'reset-gpios' is a required property
  sdm850-samsung-w737.dtb: ifd@0,0: 'slim-ifc-dev' is a required property
  sdm850-samsung-w737.dtb: ifd@0,0: 'interrupt-controller' is a required property

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230206180805.6621-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: qcom,wcd934x: Describe slim-ifc-dev
Krzysztof Kozlowski [Mon, 6 Feb 2023 18:08:04 +0000 (19:08 +0100)]
ASoC: dt-bindings: qcom,wcd934x: Describe slim-ifc-dev

The "slim-ifc-dev" property should not be just "true", because it allows
any type.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230206180805.6621-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: qcom,wsa881x: Allow sound-name-prefix
Krzysztof Kozlowski [Mon, 6 Feb 2023 18:08:03 +0000 (19:08 +0100)]
ASoC: dt-bindings: qcom,wsa881x: Allow sound-name-prefix

Reference common DAI properties to fix:

  sdm845-db845c.dtb: speaker@0,1: 'sound-name-prefix' does not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230206180805.6621-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: rt712-sdca: Add RT712 SDCA driver for Jack and Amp topology
Shuming Fan [Tue, 7 Feb 2023 09:09:46 +0000 (17:09 +0800)]
ASoC: rt712-sdca: Add RT712 SDCA driver for Jack and Amp topology

This is the initial codec driver for rt712 SDCA (Jack+Amp topology).
The host should connect with rt712 SdW1 interface.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20230207090946.20659-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: rt5640: Update MCLK rate in set_sysclk()
Sameer Pujar [Thu, 9 Feb 2023 14:36:56 +0000 (20:06 +0530)]
ASoC: rt5640: Update MCLK rate in set_sysclk()

Simple-card/audio-graph-card drivers do not handle MCLK clock when it
is specified in the codec device node. The expectation here is that,
the codec should actually own up the MCLK clock and do necessary setup
in the driver.

This is inspired from,
commit dbf54a953435 ("ASoC: rt5659: Update MCLK rate in set_sysclk()").

Cc: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/1675953417-8686-2-git-send-email-spujar@nvidia.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoMAINTAINERS: add the Infineon PEB2466 codec entry
Herve Codina [Mon, 6 Feb 2023 14:49:04 +0000 (15:49 +0100)]
MAINTAINERS: add the Infineon PEB2466 codec entry

After contributing the driver, add myself as the maintainer for the
Infineon PEB2466 codec.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20230206144904.91078-4-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: Add support for the Infineon PEB2466 codec
Herve Codina [Mon, 6 Feb 2023 14:49:03 +0000 (15:49 +0100)]
ASoC: codecs: Add support for the Infineon PEB2466 codec

The Infineon PEB2466 codec is a programmable DSP-based four channels
codec with filters capabilities.
It also provides signals as GPIOs.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20230206144904.91078-3-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: Add the Infineon PEB2466 codec
Herve Codina [Mon, 6 Feb 2023 14:49:02 +0000 (15:49 +0100)]
ASoC: dt-bindings: Add the Infineon PEB2466 codec

The Infineon PEB2466 codec is a programmable DSP-based four channels
codec with filters capabilities.

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20230206144904.91078-2-herve.codina@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: ipc4-topology: set copier sink format
Bard Liao [Thu, 9 Feb 2023 14:21:23 +0000 (16:21 +0200)]
ASoC: SOF: ipc4-topology: set copier sink format

MOD_INIT_INSTANCE IPC for a copier only contains the sink format for
output pin 0. Any additional output pins that are used need to have their
sink format set using the LARGE_CONFIG_SET IPC message.
Otherwise, firmware will report error or crash due to NULL format is used.

Signed-off-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>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230209142123.17193-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: ipc4-topology: Print queue IDs in error
Ranjani Sridharan [Thu, 9 Feb 2023 14:21:22 +0000 (16:21 +0200)]
ASoC: SOF: ipc4-topology: Print queue IDs in error

Print the queue ID's during bind/unbind errors as well to make it easier
to see what failed exactly.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.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: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230209142123.17193-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: lpass: remove not so useful verbose log
Srinivas Kandagatla [Thu, 9 Feb 2023 12:28:06 +0000 (12:28 +0000)]
ASoC: codecs: lpass: remove not so useful verbose log

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230209122806.18923-9-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: lpass: do not reset soundwire block on clk enable
Srinivas Kandagatla [Thu, 9 Feb 2023 12:28:05 +0000 (12:28 +0000)]
ASoC: codecs: lpass: do not reset soundwire block on clk enable

resetting soundwire block will put the slaves out of sync and result
in re-enumeration during fsgen disable/enable path this is totally
unnecessary and resulting fifo overflows.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230209122806.18923-8-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: lpass: fix incorrect mclk rate
Srinivas Kandagatla [Thu, 9 Feb 2023 12:28:04 +0000 (12:28 +0000)]
ASoC: codecs: lpass: fix incorrect mclk rate

For some reason we ended up with incorrect mclk rate which should be
1920000 instead of 96000, So far we were getting lucky as the same clk
is set to 192000 by wsa and va macro. This issue is discovered when there
is no wsa macro active and only rx or tx path is tested.
Fix this by setting correct rate.

Fixes: c39667ddcfc5 ("ASoC: codecs: lpass-tx-macro: add support for lpass tx macro")
Fixes: af3d54b99764 ("ASoC: codecs: lpass-rx-macro: add support for lpass rx macro")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230209122806.18923-7-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: lpass: register mclk after runtime pm
Srinivas Kandagatla [Thu, 9 Feb 2023 12:28:03 +0000 (12:28 +0000)]
ASoC: codecs: lpass: register mclk after runtime pm

move mclk out registration after runtime pm is enabled so that the
clk framework can resume the codec if it requires to enable the mclk out.

Fixes: c96baa2949b2 ("ASoC: codecs: wsa-macro: add runtime pm support")
Fixes: 72ad25eabda0 ("ASoC: codecs: va-macro: add runtime pm support")
Fixes: 366ff79ed539 ("ASoC: codecs: rx-macro: add runtime pm support")
Fixes: 1fb83bc5cf64 ("ASoC: codecs: tx-macro: add runtime pm support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230209122806.18923-6-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: qcom: audioreach: fix ADSP ready check
Srinivas Kandagatla [Thu, 9 Feb 2023 12:28:02 +0000 (12:28 +0000)]
ASoC: qcom: audioreach: fix ADSP ready check

currently q6apm_is_adsp_ready() will only return the cached value of
previous result. If we are unlucky and previous result is not-ready
then the caller will always get not-ready flag.

This is not correct, we should query the dsp of its current state in
irrespective of previous reported state.

Fixes: 47bc8cf60e92 ("ASoC: qdsp6: audioreach: Add ADSP ready check")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230209122806.18923-5-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: qcom: q6apm-dai: Add SNDRV_PCM_INFO_BATCH flag
Srinivas Kandagatla [Thu, 9 Feb 2023 12:28:01 +0000 (12:28 +0000)]
ASoC: qcom: q6apm-dai: Add SNDRV_PCM_INFO_BATCH flag

At the moment, playing audio with PulseAudio with the qdsp6 driver
results in distorted sound. It seems like its timer-based scheduling
does not work properly with qdsp6 since setting tsched=0 in
the PulseAudio configuration avoids the issue.

Apparently this happens when the pointer() callback is not accurate
enough. There is a SNDRV_PCM_INFO_BATCH flag that can be used to stop
PulseAudio from using timer-based scheduling by default.

According to https://www.alsa-project.org/pipermail/alsa-devel/2014-March/073816.html:

The flag is being used in the sense explained in the previous audio
meeting -- the data transfer granularity isn't fine enough but aligned
to the period size (or less).

q6apm-dai reports the position as multiple of

prtd->pcm_count = snd_pcm_lib_period_bytes(substream)

so it indeed just a multiple of the period size.

Therefore adding the flag here seems appropriate and makes audio
work out of the box.

Comment log inspired by Stephan Gerhold sent for q6asm-dai.c few years back.

Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230209122806.18923-4-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: qcom: q6apm-dai: fix race condition while updating the position pointer
Srinivas Kandagatla [Thu, 9 Feb 2023 12:28:00 +0000 (12:28 +0000)]
ASoC: qcom: q6apm-dai: fix race condition while updating the position pointer

It is noticed that the position pointer value seems to get a get corrupted
due to missing locking between updating and reading.

Fix this by adding a spinlock around the position pointer.

Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230209122806.18923-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: qcom: q6apm-lpass-dai: unprepare stream if its already prepared
Srinivas Kandagatla [Thu, 9 Feb 2023 12:27:59 +0000 (12:27 +0000)]
ASoC: qcom: q6apm-lpass-dai: unprepare stream if its already prepared

prepare callback can be called multiple times, so unprepare the stream
if its already prepared.

Without this DSP is not happy to setting the params on a already
prepared graph.

Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230209122806.18923-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SMA1303: Remove the sysclk setting in devicetree
Kiseok Jo [Thu, 9 Feb 2023 08:49:03 +0000 (08:49 +0000)]
ASoC: SMA1303: Remove the sysclk setting in devicetree

In SMA1303, this device does not support MCLK.
So it need to remove sysclk setting in devicetree.

Signed-off-by: Kiseok Jo <kiseok.jo@irondevice.com>
Link: https://lore.kernel.org/r/20230209084903.13000-2-kiseok.jo@irondevice.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: max98090: simplify snd_soc_dai_driver
Krzysztof Kozlowski [Wed, 8 Feb 2023 16:04:10 +0000 (17:04 +0100)]
ASoC: codecs: max98090: simplify snd_soc_dai_driver

The max98090 has only one DAI, so snd_soc_dai_driver does not have to be
an array.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230208160410.371609-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: maxim,max98090: Convert to dtschema
Krzysztof Kozlowski [Wed, 8 Feb 2023 16:04:09 +0000 (17:04 +0100)]
ASoC: dt-bindings: maxim,max98090: Convert to dtschema

Convert the Maxim Integrated MAX98090/MAX98091 audio codecs bindings to
DT schema.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230208160410.371609-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: meson: convert axg sound card control to schema
Jerome Brunet [Wed, 8 Feb 2023 09:35:19 +0000 (10:35 +0100)]
ASoC: dt-bindings: meson: convert axg sound card control to schema

Convert the DT binding documentation for the Amlogic axg sound card to
schema.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230208093520.52843-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: irondevice,sma1303: Rework binding and add missing properties
Kiseok Jo [Wed, 8 Feb 2023 09:24:20 +0000 (09:24 +0000)]
ASoC: dt-bindings: irondevice,sma1303: Rework binding and add missing properties

Add the missing properties as compatible, reg, sound-dai-cells.
And then check this file using 'make dt_binding_check'.

Signed-off-by: Kiseok Jo <kiseok.jo@irondevice.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230208092420.5037-8-kiseok.jo@irondevice.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SMA1303: Convert the TDM slot properties in devicetree to mixer
Kiseok Jo [Wed, 8 Feb 2023 09:24:18 +0000 (09:24 +0000)]
ASoC: SMA1303: Convert the TDM slot properties in devicetree to mixer

It seems correct that the user changes the TDM slot needed after
device probe.

Signed-off-by: Kiseok Jo <kiseok.jo@irondevice.com>
Link: https://lore.kernel.org/r/20230208092420.5037-6-kiseok.jo@irondevice.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SMA1303: Remove the I2C Retry property in devicetree
Kiseok Jo [Wed, 8 Feb 2023 09:24:17 +0000 (09:24 +0000)]
ASoC: SMA1303: Remove the I2C Retry property in devicetree

It's necessary to set the value for each device, so remove that.

Signed-off-by: Kiseok Jo <kiseok.jo@irondevice.com>
Link: https://lore.kernel.org/r/20230208092420.5037-5-kiseok.jo@irondevice.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: renesas,rsnd.yaml: tidyup reg/reg-name
Kuninori Morimoto [Wed, 8 Feb 2023 01:31:38 +0000 (01:31 +0000)]
ASoC: dt-bindings: renesas,rsnd.yaml: tidyup reg/reg-name

Tidyup reg/reg-name "maxItems".
Pointed by Krzysztof, and corrected by Rob.

Link: https://lore.kernel.org/r/46974ae7-5f7f-8fc1-4ea8-fe77b58f5bfb@linaro.org
Link: https://lore.kernel.org/r/20230207211621.GA4158591-robh@kernel.org
Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/87pmalt01x.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: meson: convert axg spdif output to schema
Jerome Brunet [Mon, 6 Feb 2023 15:34:48 +0000 (16:34 +0100)]
ASoC: dt-bindings: meson: convert axg spdif output to schema

Convert the DT binding documentation for the Amlogic axg spdif output to
schema.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230206153449.596326-7-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: meson: convert axg spdif input to schema
Jerome Brunet [Mon, 6 Feb 2023 15:34:47 +0000 (16:34 +0100)]
ASoC: dt-bindings: meson: convert axg spdif input to schema

Convert the DT binding documentation for the Amlogic axg spdif input to
schema.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230206153449.596326-6-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: meson: convert axg fifo to schema
Jerome Brunet [Mon, 6 Feb 2023 15:34:46 +0000 (16:34 +0100)]
ASoC: dt-bindings: meson: convert axg fifo to schema

Convert the DT binding documentation for the Amlogic axg audio FIFOs to
schema.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230206153449.596326-5-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: meson: convert axg pdm to schema
Jerome Brunet [Mon, 6 Feb 2023 15:34:45 +0000 (16:34 +0100)]
ASoC: dt-bindings: meson: convert axg pdm to schema

Convert the DT binding documentation for the Amlogic axg PDM device to
schema.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230206153449.596326-4-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: meson: convert axg tdm formatters to schema
Jerome Brunet [Mon, 6 Feb 2023 15:34:44 +0000 (16:34 +0100)]
ASoC: dt-bindings: meson: convert axg tdm formatters to schema

Convert the DT binding documentation for the Amlogic tdm formatters to
schema.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230206153449.596326-3-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: meson: convert axg tdm interface to schema
Jerome Brunet [Mon, 6 Feb 2023 15:34:43 +0000 (16:34 +0100)]
ASoC: dt-bindings: meson: convert axg tdm interface to schema

Convert the DT binding documentation for the Amlogic tdm interface to
schema.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230206153449.596326-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: Fix unsigned comparison with less than zero
Jiapeng Chong [Mon, 6 Feb 2023 07:55:18 +0000 (15:55 +0800)]
ASoC: codecs: Fix unsigned comparison with less than zero

The val is defined as unsigned int type, if(val<0) is redundant, so
delete it.

sound/soc/codecs/idt821034.c:449 idt821034_kctrl_gain_put() warn: unsigned 'val' is never less than zero.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3947
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Acked-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20230206075518.84169-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: aw88395: initialize cur_scene_id to 0
Tom Rix [Sun, 5 Feb 2023 01:57:33 +0000 (17:57 -0800)]
ASoC: codecs: aw88395: initialize cur_scene_id to 0

cppcheck reports
sound/soc/codecs/aw88395/aw88395_lib.c:789:6: error: Uninitialized variable: cur_scene_id [uninitvar]
 if (cur_scene_id == 0) {
     ^

Passing a garbage value to aw_dev_parse_data_by_sec_type_v1() will cause a crash
when the value is used as an array index.  This check assumes cur_scene_id is
initialized to 0, so initialize it to 0.

Fixes: 4345865b003b ("ASoC: codecs: ACF bin parsing and check library file for aw88395")
Signed-off-by: Tom Rix <trix@redhat.com>
Link: https://lore.kernel.org/r/20230205015733.1721009-1-trix@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: core/ipc4/mtl: Add support for PCM delay
Mark Brown [Fri, 3 Feb 2023 15:07:15 +0000 (15:07 +0000)]
ASoC: SOF: core/ipc4/mtl: Add support for PCM delay

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

The following series adds support for the PCM delay reporting in SOF core level
and implements the needed infrastructure with IPC4 to finally enable it for MTL.

Currently this is only supported on MTL (and via IPC4), but with the
infrastructure in place it will be possible to support other platforms with
DeepBuffer.

17 months agoASoC: (SOF) topology: Regression fixes for next
Mark Brown [Fri, 3 Feb 2023 14:43:55 +0000 (14:43 +0000)]
ASoC: (SOF) topology: Regression fixes for next

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

Today I came across two regressions in next with SOF:

The topology would not load with a failure of creating playback DAI
the first patch is fixing this which was caused by a missing 'else' in the patch

After fixing the topology loading, the module unloading caused kernel panic.
The second patch is correcting that which is I likely caused by copy-paste to
set wrong unload callback for the graph element.

With these patches applied SOF is working on next and modules can be unloaded

17 months agoASoC: amd: update ps platform acp header file
Vijendar Mukunda [Wed, 1 Feb 2023 16:56:25 +0000 (22:26 +0530)]
ASoC: amd: update ps platform acp header file

Rename Audio buffer and soundwire manager instance registers.
Remove scratch registers as these registers can be accessed
using ACP_SCRATCH_REG_0 register relative offset.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20230201165626.3169041-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: codecs: fix platform_no_drv_owner.cocci warning
Yang Li [Fri, 3 Feb 2023 01:15:04 +0000 (09:15 +0800)]
ASoC: codecs: fix platform_no_drv_owner.cocci warning

./sound/soc/codecs/aw88395/aw88395.c:572:3-8: No need to set .owner here. The core will do it.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3935
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230203011504.78918-1-yang.lee@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: meson: fix gx-card codec node regex
Jerome Brunet [Thu, 2 Feb 2023 18:36:46 +0000 (19:36 +0100)]
ASoC: dt-bindings: meson: fix gx-card codec node regex

'codec' is a valid node name when there is a single codec
in the link. Fix the node regular expression to apply this.

Fixes: fd00366b8e41 ("ASoC: meson: gx: add sound card dt-binding documentation")
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230202183653.486216-3-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: dt-bindings: create component common schema
Jerome Brunet [Thu, 2 Feb 2023 18:36:45 +0000 (19:36 +0100)]
ASoC: dt-bindings: create component common schema

All DAIs are component but not all components are DAI.
Move the component properties (sound-name-prefix ATM) to a separate schema
file so it can be used by non-DAI components, such as auxiliary devices.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230202183653.486216-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: fix intel-soundwire link failure
Arnd Bergmann [Thu, 2 Feb 2023 10:22:30 +0000 (11:22 +0100)]
ASoC: SOF: fix intel-soundwire link failure

My randconfig build setup ran into a rare build failure with

CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE=y
CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE=m
CONFIG_SOUNDWIRE=y
CONFIG_SOUNDWIRE_INTEL=m
CONFIG_SND_SOC_SOF_HDA=y
CONFIG_SND_SOC_SOF_INTEL_TGL=y

x86_64-linux-ld: sound/soc/sof/intel/hda.o: in function `hda_init_caps':
hda.c:(.text+0x691): undefined reference to `sdw_intel_cnl_hw_ops'
x86_64-linux-ld: hda.c:(.text+0x6f2): undefined reference to `sdw_intel_probe'
x86_64-linux-ld: sound/soc/sof/intel/hda.o: in function `hda_sdw_startup':
hda.c:(.text+0x1c40): undefined reference to `sdw_intel_startup'
x86_64-linux-ld: sound/soc/sof/intel/hda.o: in function `hda_sdw_process_wakeen':
hda.c:(.text+0x1cb6): undefined reference to `sdw_intel_process_wakeen_event'
x86_64-linux-ld: sound/soc/sof/intel/hda.o: in function `hda_dsp_interrupt_thread':
hda.c:(.text+0x1d67): undefined reference to `sdw_intel_thread'
x86_64-linux-ld: sound/soc/sof/intel/hda.o: in function `hda_dsp_remove':
hda.c:(.text+0x2655): undefined reference to `sdw_intel_exit'

My best understanding is that the definition of
SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE was intended to avoid this
problem, but got it wrong for the SND_SOC_SOF_INTEL_SOUNDWIRE=m case,
where the 'select' is meant to set SOUNDWIRE_INTEL to the value of
SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE rather than the intersection of
SND_SOC_SOF_INTEL_SOUNDWIRE_LINK_BASELINE and SND_SOC_SOF_INTEL_SOUNDWIRE.

Change the condition to check for SND_SOC_SOF_INTEL_SOUNDWIRE to be a
boolean rather than a tristate expression in order to propagate this
as intended.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20230202102247.806749-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: mediatek: mt8188: remove etdm dead code
Trevor Wu [Thu, 2 Feb 2023 10:37:04 +0000 (18:37 +0800)]
ASoC: mediatek: mt8188: remove etdm dead code

Some Smatch static checker warning like below was found.

sound/soc/mediatek/mt8188/mt8188-dai-etdm.c:2487
mt8188_dai_etdm_parse_of()
warn: 'ret' returned from snprintf() might be larger than 48

    2479         for (i = 0; i < MT8188_AFE_IO_ETDM_NUM; i++) {
    2480                 dai_id = ETDM_TO_DAI_ID(i);
    2481                 etdm_data = afe_priv->dai_priv[dai_id];
    2482
    2483                 ret = snprintf(prop, sizeof(prop),
    2484                                "mediatek,%s-multi-pin-mode",
    2485                                of_afe_etdms[i].name);
    2486                 if (ret < 0) {
--> 2487                         dev_err(afe->dev, "%s snprintf
err=%d\n",
    2488

In linux kernel, snprintf() never returns negatives. On the other hand,
the format string like "mediatek,%s-multi-pin-mode" must be smaller
than sizeof(prop)=48.

After discussing in the mail thread[1], I remove the dead code to fix
the Smatch warnings.

[1]: https://lore.kernel.org/all/Y9EdBg641tJDDrt%2F@kili/

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230202103704.15626-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: ipc4-pcm: add delay function support
Rander Wang [Thu, 2 Feb 2023 13:29:54 +0000 (15:29 +0200)]
ASoC: SOF: ipc4-pcm: add delay function support

The delay function is used to calculate the difference
between hw_ptr and dai dma position. I2S, DMIC and SDW will
use dai dma position in shared SRAM window to calculate the
delay. HDaudio will retrieve dai dma position from host mmio memory
space since it doesn't support LLP counter reported by firmware.

In two cases dai dma position is inaccurate for delay calculation
(1) dai pipeline is started before host pipeline
(2) multiple streams mixed into one. Each stream has the same dai
    dma position
Firmware calculates correct stream_start_offset for all cases including
above two. Driver subtracts stream_start_offset from dai dma position to
get accurate one.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: Intel: mtl: add get_stream_position support
Rander Wang [Thu, 2 Feb 2023 13:29:53 +0000 (15:29 +0200)]
ASoC: SOF: Intel: mtl: add get_stream_position support

Get HDaudio link position for current stream delay calculation
from hda registers.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: add get_stream_position ops for pcm delay
Rander Wang [Thu, 2 Feb 2023 13:29:52 +0000 (15:29 +0200)]
ASoC: SOF: add get_stream_position ops for pcm delay

PCM delay depends on stream position based on hardware
counter to calculate stream delay so add this ops to get
stream position according to hardware counter.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: add delay function support in sof framework
Rander Wang [Thu, 2 Feb 2023 13:29:51 +0000 (15:29 +0200)]
ASoC: SOF: add delay function support in sof framework

Sof framework will call specific delay function for
different IPC version.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: ipc4-pcm: add hw_params
Rander Wang [Thu, 2 Feb 2023 13:29:50 +0000 (15:29 +0200)]
ASoC: SOF: ipc4-pcm: add hw_params

Use the hw_params to init time info for ipc4 delay calculation.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: ipc4-pcm: allocate time info for pcm delay feature
Rander Wang [Thu, 2 Feb 2023 13:29:49 +0000 (15:29 +0200)]
ASoC: SOF: ipc4-pcm: allocate time info for pcm delay feature

Allocate time info when pcm is loaded by topology
and free it when pcm is unloaded by topology.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: add time info structure for ipc4 path
Rander Wang [Thu, 2 Feb 2023 13:29:48 +0000 (15:29 +0200)]
ASoC: SOF: add time info structure for ipc4 path

Start_stream_offset is used to strip invalid sample count in dai
for some cases like dai is started before host. llp_offset is used
to get current dai position from memory windows.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: add fw_info_box support
Rander Wang [Thu, 2 Feb 2023 13:29:47 +0000 (15:29 +0200)]
ASoC: SOF: add fw_info_box support

FW can share some information with host driver, .e.g fw status, pipeline
status and volume status. On ipc4 platform it is located in memory
windows 0 with size of struct sof_ipc4_fw_reg.

With this patch, ipc4 driver can find fw information in fw_info_box

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: SOF: add ipc4_fw_reg header file
Rander Wang [Thu, 2 Feb 2023 13:29:46 +0000 (15:29 +0200)]
ASoC: SOF: add ipc4_fw_reg header file

Ipc4_fw_reg defines the content of memory window 0 shared by fw.
Host driver can get fw information by data structure defined in
this file.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230202132954.26773-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: mchp-spdifrx: Fix uninitialized use of mr in mchp_spdifrx_hw_params()
Nathan Chancellor [Thu, 2 Feb 2023 16:34:19 +0000 (09:34 -0700)]
ASoC: mchp-spdifrx: Fix uninitialized use of mr in mchp_spdifrx_hw_params()

Clang warns:

  ../sound/soc/atmel/mchp-spdifrx.c:455:3: error: variable 'mr' is uninitialized when used here [-Werror,-Wuninitialized]
                  mr |= SPDIFRX_MR_ENDIAN_BIG;
                  ^~
  ../sound/soc/atmel/mchp-spdifrx.c:432:8: note: initialize the variable 'mr' to silence this warning
          u32 mr;
                ^
                 = 0
  1 error generated.

Zero initialize mr so that these bitwise OR and assignment operation
works unconditionally.

Fixes: fa09fa60385a ("ASoC: mchp-spdifrx: fix controls which rely on rsr register")
Link: https://github.com/ClangBuiltLinux/linux/issues/1797
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20230202-mchp-spdifrx-fix-uninit-mr-v1-1-629a045d7a2f@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoFix default DMIC gain on AMD PDM drivers
Mark Brown [Thu, 2 Feb 2023 15:36:47 +0000 (15:36 +0000)]
Fix default DMIC gain on AMD PDM drivers

Merge series from Mario Limonciello <mario.limonciello@amd.com>:

It's been reported that a number of laptops have a low volume
level from the digital microphone compared to Windows.

AMD offers a register that can adjust the gain for PDM which is not
configured at maximum gain by default.

To fix this change the default for all 3 drivers to raise the gain
but also offer a module parameter. The module parameter can be used
for debugging if the gain is too high on a given laptop.

This is intentionally split into multiple patches for default and
parameter so that if the default really does behave better universally
we can bring it back to stable too later.

17 months agoASoC: codecs: aw88395: Fix spelling mistake "cersion" -> "version"
Colin Ian King [Thu, 2 Feb 2023 10:32:36 +0000 (10:32 +0000)]
ASoC: codecs: aw88395: Fix spelling mistake "cersion" -> "version"

There are spelling mistakes in dev_err messages. Fix them.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20230202103236.270057-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: amd: ps: Add a module parameter to influence pdm_gain
Mario Limonciello [Tue, 31 Jan 2023 18:46:52 +0000 (12:46 -0600)]
ASoC: amd: ps: Add a module parameter to influence pdm_gain

In case of regressions for any users that the new pdm_gain value is
too high and for additional debugging, introduce a module parameter
that would let them configure it.

This parameter should be removed in the future:
 * If it's determined that the parameter is not needed, just hardcode
   the correct value as before
 * If users do end up using it to debug and report different values
   we should introduce a config knob that can have policy set by ucm.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230131184653.10216-7-mario.limonciello@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
17 months agoASoC: amd: ps: Adjust the gain for PDM DMIC
Mario Limonciello [Tue, 31 Jan 2023 18:46:51 +0000 (12:46 -0600)]
ASoC: amd: ps: Adjust the gain for PDM DMIC

No issues have been reported yet for DMIC audio level on ps platforms,
but as problems were found both on YC (Rembrandt) and Renoir based
designs it's very likely they happen on ps too.

Increase the PDM gain to solve this problem.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20230131184653.10216-6-mario.limonciello@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>