Commit Graph

30449 Commits

Author SHA1 Message Date
Richard Fitzgerald 1cad8725f2
ASoC: cs-amp-lib: Add helpers for factory calibration data
Create a new library for code that is used by multiple Cirrus Logic
amps. This initially implements extracting amp calibration data
from EFI and writing it to firmware controls.

During factory calibration of built-in speakers the firmware
calibration constants are stored in an EFI file. The file contains
an array of calibration constants for each of the speakers.
cs_amp_get_calibration_data() searches for an entry matching the
requested UID stamp, otherwise by array index. If the data is found in
EFI the constants for that speaker are copied back to the caller.

If EFI is not enabled, the cs_amp_get_calibration_data() implementation
will compile to simply return -ENOENT and the linker can drop the code.

The code to write calibration controls uses cs_dsp. Building of cs_dsp
is not forced. Instead, the code will compile away the calls to
cs_dsp if cs_dsp is not reachable.

This strategy of conditional code allows cs-amp-lib to be shared by
multiple drivers without forcing inclusion of other modules that might
be unnecessary.

The calls to efi.get_variable() and cs_dsp are in small wrapper
functions. This is so that a KUNIT_STATIC_STUB_REDIRECT can be added in
a future patch to redirect these calls to replacement functions for
KUnit testing.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240223153910.2063698-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-23 17:21:39 +00:00
Richard Fitzgerald 5519ac3a71
ASoC: wm_adsp: Add wm_adsp_start() and wm_adsp_stop()
Separate the functionality of wm_adsp_event() into two exported
functions wm_adsp_start() and wm_adsp_stop().

This allows the codec driver to start and stop the DSP outside of a
DAPM widget.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240223153910.2063698-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-23 17:21:38 +00:00
Richard Fitzgerald eba2eb2495
ASoC: soc-card: Fix missing locking in snd_soc_card_get_kcontrol()
snd_soc_card_get_kcontrol() must be holding a read lock on
card->controls_rwsem while walking the controls list.

Compare with snd_ctl_find_numid().

The existing function is renamed snd_soc_card_get_kcontrol_locked()
so that it can be called from contexts that are already holding
card->controls_rwsem (for example, control get/put functions).

There are few direct or indirect callers of
snd_soc_card_get_kcontrol(), and most are safe. Three require
changes, which have been included in this patch:

codecs/cs35l45.c:
  cs35l45_activate_ctl() is called from a control put() function so
  is changed to call snd_soc_card_get_kcontrol_locked().

codecs/cs35l56.c:
  cs35l56_sync_asp1_mixer_widgets_with_firmware() is called from
  control get()/put() functions so is changed to call
  snd_soc_card_get_kcontrol_locked().

fsl/fsl_xcvr.c:
  fsl_xcvr_activate_ctl() is called from three places, one of which
  already holds card->controls_rwsem:
  1. fsl_xcvr_mode_put(), a control put function, which will
     already be holding card->controls_rwsem.
  2. fsl_xcvr_startup(), a DAI startup function.
  3. fsl_xcvr_shutdown(), a DAI shutdown function.

  To fix this, fsl_xcvr_activate_ctl() has been changed to call
  snd_soc_card_get_kcontrol_locked() so that it is safe to call
  directly from fsl_xcvr_mode_put().
  The fsl_xcvr_startup() and fsl_xcvr_shutdown() functions have been
  changed to take a read lock on card->controls_rsem() around calls
  to fsl_xcvr_activate_ctl(). While this is not very elegant, it
  keeps the change small, to avoid this patch creating a large
  collateral churn in fsl/fsl_xcvr.c.

Analysis of other callers of snd_soc_card_get_kcontrol() is that
they do not need any changes, they are not holding card->controls_rwsem
when they call snd_soc_card_get_kcontrol().

Direct callers of snd_soc_card_get_kcontrol():
  fsl/fsl_spdif.c: fsl_spdif_dai_probe() - DAI probe function
  fsl/fsl_micfil.c: voice_detected_fn() - IRQ handler

Indirect callers via soc_component_notify_control():
  codecs/cs42l43: cs42l43_mic_shutter() - IRQ handler
  codecs/cs42l43: cs42l43_spk_shutter() - IRQ handler
  codecs/ak4118.c: ak4118_irq_handler() - IRQ handler
  codecs/wm_adsp.c: wm_adsp_write_ctl() - not currently used

Indirect callers via snd_soc_limit_volume():
  qcom/sc8280xp.c: sc8280xp_snd_init() - DAIlink init function
  ti/rx51.c: rx51_aic34_init() - DAI init function

I don't have hardware to test the fsl/*, qcom/sc828xp.c, ti/rx51.c
and ak4118.c changes.

Backport note:
The fsl/, qcom/, cs35l45, cs35l56 and cs42l43 callers were added
since the Fixes commit so won't all be present on older kernels.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 209c6cdfd2 ("ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card")
Link: https://lore.kernel.org/r/20240221123710.690224-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-23 13:40:06 +00:00
Kuninori Morimoto b1724c00f0
ASoC: soc-core: tidyup strcmp() param on snd_soc_is_matching_dai()
snd_soc_is_matching_dai() checks DAI name, which is paired function
with snd_soc_dai_name_get().

It checks dlc->dai_name and dai->name (A) or dai->driver_name (B) or
dai->component->name (C)

	static int snd_soc_is_matching_dai(...)
	{
		...
		if (strcmp(dlc->dai_name, dai->name) == 0)
			   ~~~~~~~~~~~~~  ^^^^^^^^^(A)
		if (...
		    strcmp(dai->driver->name, dlc->dai_name) == 0)
			 (B)^^^^^^^^^^^^^^^^  ~~~~~~~~~~~~~
		if (...
		    strcmp(dlc->dai_name, dai->component->name) == 0)
			   ~~~~~~~~~~~~~  ^^^^^^^^^^^^^^^^^^(C)
		...
	}

But (B) part order is different with (A) and (C) (= ^^^^ and ~~~~).
This is not a big deal, but confusable to read. Fixup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://msgid.link/r/87wmqxjbcg.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-22 19:49:41 +00:00
Vijendar Mukunda 253ce07d2a
ASoC: amd: ps: modify ACP register end address macro
Modify ACP63_REG_END macro to access all ACP registers.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240222102656.631144-2-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-22 19:49:40 +00:00
Vijendar Mukunda 4c75493833
ASoC: amd: ps: update license
To align with AMD SoundWire manager driver license, update license as
GPL-2.0-only for Pink Sardine ACP PCI driver and corresponding child
drivers.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240222102656.631144-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-22 19:49:39 +00:00
Cezary Rojewski bf900c85f8
ASoC: codecs: rt5660: Simplify mclk initialization
Most of clk_xxx() functions do check if provided clk-pointer is
non-NULL. These do not check if the pointer is an error-pointer.
Providing such to a clk_xxx() results in a panic.

By utilizing _optional() variant of devm_clk_get() the driver code is
both simplified and more robust. There is no need to remember about
IS_ERR(clk) checks each time mclk is accessed.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240221152516.852353-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-21 16:26:22 +00:00
Cezary Rojewski 6413849b67
ASoC: codecs: rt5640: Simplify mclk initialization
Most of clk_xxx() functions do check if provided clk-pointer is
non-NULL. These do not check if the pointer is an error-pointer.
Providing such to a clk_xxx() results in a panic.

rt5640_set_dai_sysclk() is an example of that - clk_set_rate() is not
guarded by IS_ERR().

By utilizing _optional() variant of devm_clk_get() the driver code is
both simplified and more robust. There is no need to remember about
IS_ERR(clk) checks each time mclk is accessed.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240221152516.852353-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-21 16:26:21 +00:00
Cezary Rojewski f76de61ad1
ASoC: codecs: rt5616: Simplify mclk initialization
Most of clk_xxx() functions do check if provided clk-pointer is
non-NULL. These do not check if the pointer is an error-pointer.
Providing such to a clk_xxx() results in a panic.

By utilizing _optional() variant of devm_clk_get() the driver code is
both simplified and more robust. There is no need to remember about
IS_ERR(clk) checks each time mclk is accessed.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240221152516.852353-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-21 16:26:20 +00:00
Cezary Rojewski 67e9bf0933
ASoC: codecs: rt5514: Simplify mclk initialization
Most of clk_xxx() functions do check if provided clk-pointer is
non-NULL. These do not check if the pointer is an error-pointer.
Providing such to a clk_xxx() results in a panic.

By utilizing _optional() variant of devm_clk_get() the driver code is
both simplified and more robust. There is no need to remember about
IS_ERR(clk) checks each time mclk is accessed.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240221152516.852353-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-21 16:26:19 +00:00
Cezary Rojewski 71d322fd16
ASoC: codecs: nau8825: Simplify mclk initialization
Most of clk_xxx() functions do check if provided clk-pointer is
non-NULL. These do not check if the pointer is an error-pointer.
Providing such to a clk_xxx() results in a panic.

By utilizing _optional() variant of devm_clk_get() the driver code is
both simplified and more robust. There is no need to remember about
IS_ERR(clk) checks each time mclk is accessed.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240221152516.852353-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-21 16:26:18 +00:00
Cezary Rojewski e2cb72d287
ASoC: codecs: da7213: Simplify mclk initialization
Most of clk_xxx() functions do check if provided clk-pointer is
non-NULL. These do not check if the pointer is an error-pointer.
Providing such to a clk_xxx() results in a panic.

By utilizing _optional() variant of devm_clk_get() the driver code is
both simplified and more robust. There is no need to remember about
IS_ERR(clk) checks each time mclk is accessed.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240221152516.852353-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-21 16:26:17 +00:00
Colin Ian King 1382d8b551
ASoC: qcom: Fix uninitialized pointer dmactl
In the case where __lpass_get_dmactl_handle is called and the driver
id dai_id is invalid the pointer dmactl is not being assigned a value,
and dmactl contains a garbage value since it has not been initialized
and so the null check may not work. Fix this to initialize dmactl to
NULL. One could argue that modern compilers will set this to zero, but
it is useful to keep this initialized as per the same way in functions
__lpass_platform_codec_intf_init and lpass_cdc_dma_daiops_hw_params.

Cleans up clang scan build warning:
sound/soc/qcom/lpass-cdc-dma.c:275:7: warning: Branch condition
evaluates to a garbage value [core.uninitialized.Branch]

Fixes: b81af585ea ("ASoC: qcom: Add lpass CPU driver for codec dma control")
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://msgid.link/r/20240221134804.3475989-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-21 14:01:17 +00:00
Krzysztof Kozlowski 0dae534c48
ASoC: codecs: wsa884x: Allow sharing reset GPIO
On some boards with multiple WSA8840/WSA8845 speakers, the reset
(shutdown) GPIO is shared between two speakers.  Use the reset
controller framework and its "reset-gpio" driver to handle this case.
This allows bring-up and proper handling of all WSA884x speakers on
X1E80100-CRD board.

Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240129115216.96479-7-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-21 13:02:54 +00:00
Mark Brown b96ccdcf9d
ASoC: Intel: avs: Fixes and new platforms support
Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

The avs-driver continues to be utilized on more recent Intel machines.
As TGL-based (cAVS 2.5) e.g.: RPL, inherit most of the functionality
from previous platforms:

SKL <- APL <- CNL <- ICL <- TGL

rather than putting everything into a single file, the platform-specific
bits are split into cnl/icl/tgl.c files instead. Makes the division clear
and code easier to maintain.

Layout of the patchset:

First are two changes combined together address the sound-clipping
problem, present when only one stream is running - specifically one
CAPTURE stream.

Follow up is naming-scheme adjustment for some of the existing functions
what improves code incohesiveness. As existing IPC/IRQ code operates
solely on cAVS 1.5 architecture, it needs no abstraction. The situation
changes when newer platforms come into the picture. Thus the next two
patches abstract the existing IPC/IRQ handlers so that majority of the
common code can be re-used.

The ICCMAX change stands out a bit - the AudioDSP firmware loading
procedure differs on ICL-based platforms (and onwards) and having a
separate commit makes the situation clear to the developers who are
going to support the solution from LTS perspective. For that reason
I decided not to merge it into the commit introducing the icl.c file.
2024-02-21 00:52:26 +00:00
Cezary Rojewski 5b417fe0cd
ASoC: Intel: avs: Populate board selection with new I2S entries
Update board selection with tables specifying supported I2S
configurations. DMIC/HDAudio board selection require no update as
dmic/hdaudio machine boards are generic and not tied to any specific
codec.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-11-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:20:01 +00:00
Cezary Rojewski 36478a74c7
ASoC: Intel: avs: ICCMAX recommendations for ICL+ platforms
For ICL+ platforms to avoid DMI/OPIO L1 entry during the base firmware
load procedure, HW recommends to set LTRP_GB to 95us and start an
additional CAPTURE stream in the background.

Once the load completes, original LTRP_GB value is restored and the
additional stream is released.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-10-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:20:00 +00:00
Cezary Rojewski 5acb19ecd1
ASoC: Intel: avs: TGL-based platforms support
Define handlers specific to cAVS 2.5 platforms, that is TGL, ADL, RPL
and all other variants based on this very version of AudioDSP
architecture. Most operations are inherited from their predecessors with
the major difference being AudioDSP cores management - firmware handlers
that on its own so there is no need to interfere.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-9-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:19:59 +00:00
Cezary Rojewski 275b583d04
ASoC: Intel: avs: ICL-based platforms support
Define handlers specific to cAVS 2.0 platforms, that is ICL, JSL and all
other variants based on this very version of AudioDSP architecture. Most
operations are inherited from their predecessors with the major
difference being firmware-logging functionality - IPC request as well as
debug memory windows layout have changed.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-8-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:19:58 +00:00
Cezary Rojewski 8a6502ade1
ASoC: Intel: avs: CNL-based platforms support
Define handlers specific to cAVS 1.8 platforms, that is CNL, CFL, CML
and all other variants based on this very version of AudioDSP
architecture. Most operations are inherited from their predecessors.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:19:56 +00:00
Cezary Rojewski 97bd565ff5
ASoC: Intel: avs: Abstract IRQ handling
Servicing IPCs on CNL platforms and onward differs from the existing
one. To make room for these, relocate SKL-based platforms specific code
into the skl.c file leaving only the genering irq_handler in the common
code.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:19:55 +00:00
Cezary Rojewski 7576e2f4d9
ASoC: Intel: avs: Abstract IPC handling
Servicing IPCs on CNL platforms and onward differs from the existing
one. To make room for these, enrich platform descriptor with fields
representing crucial IPC registers and utilize them throughout the code.

While cleaning up device descriptors, reduce the number of code lines by
assigning 'min_fw_version' within a single line.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:19:54 +00:00
Cezary Rojewski a8f858d98f
ASoC: Intel: avs: Prefix SKL/APL-specific members
Prefix members that are platform-specific with 'avs_' to improve code
cohesiveness and reduce the chance for naming-conflics with other
drivers.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:19:53 +00:00
Cezary Rojewski e1a0cbae52
ASoC: Intel: avs: Fix sound clipping in single capture scenario
To avoid sound clipping when there just one, single CAPTURE stream
ongoing, disable L1SEN before it is started. Any PLAYBACK stream or
additional CAPTURE allows L1SEN to be re-enabled.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:19:52 +00:00
Cezary Rojewski 1b72943ab1
ASoC: Intel: avs: L1SEN reference counted
Code loading is not the only procedure that manipulates L1SEN. Update
existing mechanism so the stream starting procedure can interfere with
L1SEN without causing any trouble to its other users.

Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://msgid.link/r/20240220115035.770402-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-20 13:19:51 +00:00
Vitaly Rodionov 3b4ec34602
ASoC: cs42l42: Remove redundant delays in suspend().
This patch will remove redundant delay and minimise
total suspend() function call time.

Signed-off-by: Vitaly Rodionov <vitalyr@opensource.cirrus.com>
Link: https://msgid.link/r/20240216101157.23176-1-vitalyr@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:18 +00:00
Colin Ian King e480c0991d
ASoC: tas2781: Remove redundant initialization of pointer 'data'
The pointer 'data' being initialized with a value that is never read, it
is being re-assigned inside a while-loop. The initialization is redundant
and can be removed.

Cleans up clang scan build warning
sound/soc/codecs/tas2781-fmwlib.c:1534:17: warning: Value stored to
'data' during its initialization is never read [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://msgid.link/r/20240216142219.2109050-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:17 +00:00
Arnd Bergmann a3d543b9e6
ASoC: SOF: amd: fix soundwire dependencies
The soundwire-amd driver has a bit of a layering violation requiring
the SOF driver to directly call into its exported symbols rather than
through an abstraction.

The SND_SOC_SOF_AMD_SOUNDWIRE Kconfig symbol tries to deal with the
dependency by selecting SOUNDWIRE_AMD in a complicated set of conditions,
but gets it wrong for a configuration involving SND_SOC_SOF_AMD_COMMON=y,
SND_SOC_SOF_AMD_ACP63=m, and SND_SOC_SOF_AMD_SOUNDWIRE_LINK_BASELINE=m
SOUNDWIRE_AMD=m, which results in a link failure:

ld.lld: error: undefined symbol: sdw_amd_get_slave_info
>>> referenced by acp-common.c
ld.lld: error: undefined symbol: amd_sdw_scan_controller
ld.lld: error: undefined symbol: sdw_amd_probe
ld.lld: error: undefined symbol: sdw_amd_exit
>>> referenced by acp.c
>>>               sound/soc/sof/amd/acp.o:(amd_sof_acp_remove) in archive vmlinux.a

In essence, the SND_SOC_SOF_AMD_COMMON option cannot be built-in when
trying to link against a modular SOUNDWIRE_AMD driver.

Since CONFIG_SOUNDWIRE_AMD is a user-visible option, it really should
never be selected by another driver in the first place, so replace the
extra complexity with a normal Kconfig dependency in SND_SOC_SOF_AMD_SOUNDWIRE,
plus a top-level check that forbids any of the AMD SOF drivers from being
built-in with CONFIG_SOUNDWIRE_AMD=m.

In normal configs, they should all either be built-in or all loadable
modules anyway, so this simplification does not limit any real usecases.

Fixes: d948218424 ("ASoC: SOF: amd: add code for invoking soundwire manager helper functions")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://msgid.link/r/20240219093900.644574-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:16 +00:00
Vijendar Mukunda bbf3e6145e
ASoC: amd: ps: add machine select and register code
Add machine select logic for SoundWire interface and create a machine
device node based on ACP PDM/SoundWire configuration.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240214104014.1144668-5-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:15 +00:00
Vijendar Mukunda c76f3b1f9b
ASoC: amd: ps: fix for acp pme wake for soundwire configuration
Consider the below scenario, When ACP and SoundWire managers are in
D3 state and SoundWire manager power off mode is selected and acp and
SoundWire manager instances are in runtime suspended state.

In this case, for the ACP PME wake event, the ACP PCI driver should resume
SoundWire manager devices based on wake enable status set.

Add code for handling ACP PME wake event for runtime suspend scenario
when SoundWire power off mode is selected.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240214104014.1144668-4-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:14 +00:00
Vijendar Mukunda 3c697ced39
ASoC: amd: ps: remove acp_reset flag
The earlier acp_reset flag is set to true in two instances as mentioned
below.
1. When active SoundWire manager instances power mode is set to
Power off mode when SoundWire configuration is selected.
2. For other acp configurations

As code being refactored and common function being used for scanning
SoundWire controller, acp_reset flag update logic is dropped.

Instead of it, check the SoundWire manager instance enable state, based on
it update sdw_en_stat flag which will be used to apply ACP init/de-init
sequence during suspend/resume callbacks based on flag set value when
SoundWire configuration is selected.
For other acp configurations, acp init/de-init will be called by default.

Refactor existing pm ops logic for SoundWire configuration and use
sdw_en_stat flag for invoking acp init/de-init sequence.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240214104014.1144668-3-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:13 +00:00
Vijendar Mukunda eaf825037d
ASoC: amd: ps: refactor acp child platform device creation code
Refactor ACP child platform device creation code based on acp config.
Use common SoundWire manager functions for device probe and exit
sequences.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240214104014.1144668-2-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:12 +00:00
Vijendar Mukunda 0386d765f2
ASoC: amd: ps: refactor acp device configuration read logic
Refactor acp device configuration read logic and use common function
to scan SoundWire devices.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240214104014.1144668-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:11 +00:00
Krzysztof Kozlowski cf88ab486a
ASoC: Constify pointer to of_phandle_args
Constify pointer to of_phandle_args in few function arguments, for code
safety and self-documenting code.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240216145448.224185-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 17:02:10 +00:00
Richard Fitzgerald e33625c84b
ASoC: cs35l56: Must clear HALO_STATE before issuing SYSTEM_RESET
The driver must write 0 to HALO_STATE before sending the SYSTEM_RESET
command to the firmware.

HALO_STATE is in DSP memory, which is preserved across a soft reset.
The SYSTEM_RESET command does not change the value of HALO_STATE.
There is period of time while the CS35L56 is resetting, before the
firmware has started to boot, where a read of HALO_STATE will return
the value it had before the SYSTEM_RESET. If the driver does not
clear HALO_STATE, this would return BOOT_DONE status even though the
firmware has not booted.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 8a731fd37f ("ASoC: cs35l56: Move utility functions to shared file")
Link: https://msgid.link/r/20240216140535.1434933-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-19 16:58:02 +00:00
Takashi Iwai 471864ac8a Merge branch 'for-linus' into for-next
Pull the latest 6.8 stuff into devel branch for further development.
Fixed the trivial merge conflict for HD-audio Realtek stuff.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-15 16:57:37 +01:00
Masahiro Yamada 74e0259495
ASoC: codecs: remove redundant 'tristate' in sound/soc/codecs/Kconfig
The type 'tristate' is already specified three lines above.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://msgid.link/r/20240215132854.1907630-1-masahiroy@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-15 13:41:05 +00:00
Dan Carpenter 98f681b0f8
ASoC: SOF: Add some bounds checking to firmware data
Smatch complains about "head->full_size - head->header_size" can
underflow.  To some extent, we're always going to have to trust the
firmware a bit.  However, it's easy enough to add a check for negatives,
and let's add a upper bounds check as well.

Fixes: d2458baa79 ("ASoC: SOF: ipc3-loader: Implement firmware parsing and loading")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://msgid.link/r/5593d147-058c-4de3-a6f5-540ecb96f6f8@moroto.mountain
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-14 13:22:24 +00:00
Mark Brown 81ff296a81
ASoC: meson: aiu: fix function pointer type
Merge series from Jerome Brunet <jbrunet@baylibre.com>:

This patchset fixes 2 -Wcast-function-type-strict warning in amlogic
audio drivers with clang 16.
2024-02-14 12:17:04 +00:00
Mark Brown 2775f88bec
ASoC: SOF: Extend ChainDMA and DSPless mode to LNL+
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

For both ChainDMA and DSPless mode the requirement is that the link must
be serviced by HD-DMA.
On pre Lunar Lake platforms this was only valid for HDAudio links but with
Lunar Lake all link types now serviced by HD-DMA.

This allows us to enable ChainDMA and DSPless mode for SoundWire links as
well.
2024-02-14 11:41:32 +00:00
Jerome Brunet 5ad992c71b
ASoC: meson: t9015: fix function pointer type mismatch
clang-16 warns about casting functions to incompatible types, as is done
here to call clk_disable_unprepare:

sound/soc/meson/t9015.c:274:4: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  274 |                         (void(*)(void *))clk_disable_unprepare,

The pattern of getting, enabling and setting a disable callback for a
clock can be replaced with devm_clk_get_enabled(), which also fixes
this warning.

Fixes: 33901f5b9b ("ASoC: meson: add t9015 internal DAC driver")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Link: https://msgid.link/r/20240213215807.3326688-3-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-14 00:43:31 +00:00
Jerome Brunet 98ac85a00f
ASoC: meson: aiu: fix function pointer type mismatch
clang-16 warns about casting functions to incompatible types, as is done
here to call clk_disable_unprepare:

sound/soc/meson/aiu.c:243:12: error: cast from 'void (*)(struct clk *)' to 'void (*)(void *)' converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  243 |                                        (void(*)(void *))clk_disable_unprepare,

The pattern of getting, enabling and setting a disable callback for a
clock can be replaced with devm_clk_get_enabled(), which also fixes
this warning.

Fixes: 6ae9ca9ce9 ("ASoC: meson: aiu: add i2s and spdif support")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Justin Stitt <justinstitt@google.com>
Link: https://msgid.link/r/20240213215807.3326688-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-14 00:43:30 +00:00
Richard Fitzgerald 0db0c17708
ASoC: cs35l56: Workaround for ACPI with broken spk-id-gpios property
The ACPI in some SoundWire laptops has a spk-id-gpios property but
it points to the wrong Device node. This patch adds a workaround to
try to get the GPIO directly from the correct Device node.

If the attempt to get the GPIOs from the property fails, the workaround
looks for the SDCA node "AF01", which is where the GpioIo resource is
defined. If this exists, a spk-id-gpios mapping is added to that node
and then the GPIO is got from that node using the property.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://msgid.link/r/20240209111840.1543630-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 19:37:25 +00:00
Krzysztof Kozlowski fd236653ab
ASoC: codecs: tx-macro: Simplify setting AMIC control
When updating all bits in AMIC control registers (mask 0xff), use more
obvious snd_soc_component_write().  Replace also hard-coded value 0x00
with a define.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240202154134.66967-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 17:36:02 +00:00
Krzysztof Kozlowski b396071681
ASoC: codecs: tx-macro: Mark AMIC control registers as volatile
Just like DMIC, the AMIC control registers are volatile.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240202154134.66967-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 17:36:01 +00:00
Krzysztof Kozlowski 58cef044e6
ASoC: codecs: tx-macro: Drop unimplemented DMIC clock divider
Downstream driver configures DMIC clock rate through the divider
register but only parts of this code ended up in the upstream driver: we
always write the same value 0, so DIV2.  Same default value is used also
for the AMIC rate control.

Let's make it obvious and drop unneeded parts of the code.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://msgid.link/r/20240202154134.66967-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 17:36:00 +00:00
Srinivas Kandagatla a6eb64e7e3
ASoC: codecs: va-macro: add npl clk
New versions of VA Macro has soundwire integrated, so handle the soundwire npl
clock correctly in the codec driver.

Introduce has_npl_clk and handle the sm8550 case separately because
it has soundwire integrated but doesn't have an npl clock.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://msgid.link/r/20240203-topic-sm8x50-upstream-va-macro-npl-v2-1-f2db82ae3359@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 17:35:59 +00:00
Mark Brown 9dbe95e28f
ASoC: SOF: Intel: pci-tgl/lnl: Change default paths
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

Hi,

Align the IPC4 firmware path/name and the topology path to the documentation:
default_fw_path:     intel/sof-ipc4/{platform_name}
default_lib_path:    intel/sof-ipc4-lib/{platform_name}
default_tplg_path:   intel/sof-ipc4-tplg
default_fw_filename: sof-{platform_name}.ri

Tiger Lake and Lunar Lake support is not yet available via the official
firmware release, the paths can be changed now to avoid misalignment in the
future.

Regards,
Peter
---
Peter Ujfalusi (2):
  ASoC: SOF: Intel: pci-tgl: Change the default paths and firmware names
  ASoC: SOF: Intel: pci-lnl: Change the topology path to
    intel/sof-ipc4-tplg

 sound/soc/sof/intel/pci-lnl.c |  2 +-
 sound/soc/sof/intel/pci-tgl.c | 64 +++++++++++++++++------------------
 2 files changed, 33 insertions(+), 33 deletions(-)

--
2.43.0
2024-02-13 17:12:51 +00:00
Bard Liao e49676a5fc
ASoC: SOF: ipc4-topology: set config_length based on device_count
Set ipc4_copier->data.gtw_cfg.config_length dynamically based on
blob->alh_cfg.device_count to align with the other OS.

Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213123007.29956-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 14:23:00 +00:00
Peter Ujfalusi b30289e7fa
ASoC: SOF: Fix runtime pm usage counter balance after fw exception
If the retain context is enabled we will unconditionally increment the
device's pm use count on each exception and when the drivers are unloaded
we do not correct this (as we don't know how many times we 'prevented
d3 entry').
Introduce a flag to make sure that we do not increment the use count more
than once and on module unload decrement the use count if needed to
balance it.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@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://msgid.link/r/20240213114729.7055-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 14:22:57 +00:00
Pierre-Louis Bossart 2065610b5d
ASoC: SOF: Intel: hda-dai: add support for dspless mode beyond HDAudio
For SoundWire/ALH, we need to have a dai configured, but we don't want
to send a DMA_TLV to firmware. Add additional code branches.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-16-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:29:04 +00:00
Peter Ujfalusi 0afce89ff8
ASoC: SOF: Intel: lnl: Do not use LNL specific wrappers in DSPless mode
When DSPless mode is selected the DMIC/SSP offload status should not be
changed since the DSP is not in use.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-15-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:29:03 +00:00
Pierre-Louis Bossart 0c3d57365a
ASoC: SOF: Intel: hda-dai-ops: add SoundWire dspless mode
This mode is only supported starting with LunarLake (ACE_2_0).

DMIC and SSP remain supported with the DSP only for now, since they
need a DAI configuration that is provided to firmware.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-14-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:29:02 +00:00
Pierre-Louis Bossart 797b92591a
ASoC: SOF: Intel: hda-dai-ops: use dai_type
Now that we have the dai_type we can remove any dependencies on
copiers.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-13-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:29:01 +00:00
Ranjani Sridharan f9618ff105
ASoC: SOF: topology: Parse DAI type token for dspless mode
Starting with LunarLake, the dspless mode can handle SoundWire/ALH,
DMIC and SSPs, so we need to identify the dai type from topology.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:29:00 +00:00
Pierre-Louis Bossart 67bde2e8c0
ASoC: SOF: Intel: start SoundWire links earlier for LNL+ devices
The SoundWire integration is different from previous platforms, with
no dependencies on the DSP enablement. We can start the SoundWire
links in the probe instead of waiting for the post_fw_run stage.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-11-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:59 +00:00
Pierre-Louis Bossart 743eb6c68d
ASoC: SOF: topology: dynamically allocate and store DAI widget->private
For dspless mode, we need to allocate and store an 'sdai'
structure. The existing code allocate the data on the stack and does
not set the widget->private pointer.

This minor change should not have any impact on existing DAIs, even
when the DSP is used.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:58 +00:00
Pierre-Louis Bossart daa09d0615
ASoC: SOF: Intel: hda-dai: remove dspless special case
The existing code forces a parameter to be NULL but that parameter is
not used yet. Remove the special case in preparation for additional
changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:57 +00:00
Pierre-Louis Bossart df82dbb5fb
ASoC: SOF: ipc4-topology: allow chain_dma for all supported DAIs
Now that we have a 'is_chain_dma_supported' callback we can use it to
double-check possible disconnects between a topology file enabling
chain-dma for a DAI and the hardware/firmware capabilities.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:56 +00:00
Pierre-Louis Bossart 8722d245a7
ASoC: SOF: ipc4-pcm: fix dma_id for CHAIN_DMA capture
The existing code uses (stream_tag - 1) for the host and link dma id.

This is correct for playback, but for capture this results in an
invalid dma_type being used. The firmware assumes that the dma_id for
capture is always larger than DAI_NUM_HDA_OUT

This patch adds the offset for num_playback_streams, filled on Intel
platforms with the value extracted from the hardware capabilities.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:56 +00:00
Pierre-Louis Bossart 426476344f
ASoC: SOF: ipc4: store number of playback/capture streams
The CHAIN_DMA IPC needs the number of playback streams as a start
offset for the dma_id of a capture stream.

This offset can be retrieved on Intel platforms from the GCAP
information, and stored in the sof_ipc4_fw_data structure.

One could argue that the fields added are not really dependent on any
firmware definitions but rather on hardware capabilities, but they are
required for the IPC CHAIN_DMA definitions so adding them in
ipc4_fw_data isn't completely silly.

The CHAIN_DMA IPC is currently only functional on Intel HDaudio DMAs,
and gated by the snd_sof_is_chain_dma_supported() helper.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:55 +00:00
Pierre-Louis Bossart a5b7767723
ASoC: SOF: Intel: hda-dai-ops: enable chain_dma for ALH
Use the existing callbacks and mix/match of HDaudio and SoundWire
support.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:54 +00:00
Pierre-Louis Bossart d69f9ecbe1
ASoC: SOF: Intel: hda: add 'is_chain_dma_supported' callback
Reuse existing function to get the interface mask and expose it to the
SOF core with a callback - the main user is the IPC4 topology so only
HDaudio platforms provide this callback.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:53 +00:00
Pierre-Louis Bossart ba91d0919a
ASoC: SOF: ops: add new 'is_chain_dma_supported' callback
IPC4 introduced a 'chain-dma' mode when host and link DMA are
connected by firmware without using a regular pipeline or the ability
to add intermediate connections. This mode is not available on all
platforms and all links, so add a platform-specific callback to help
the SOF ipc4-topology core handle different hardware+firmware
configurations.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:52 +00:00
Pierre-Louis Bossart 3858464de5
ASoC: SOF: ipc4-topology: change chain_dma handling in dai_config
The chain_dma mode is currently only handled for HDaudio, but can be
used for orther DAIs starting with LunarLake. Move the chain_dma
handling earlier.

Error detection for the chain_dma case for older platforms is handled
at a different level.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213101247.28887-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:51 +00:00
Curtis Malainey fcbe487308
ASoC: SOF: IPC3: fix message bounds on ipc ops
commit 74ad8ed651 ("ASoC: SOF: ipc3: Implement rx_msg IPC ops")
introduced a new allocation before the upper bounds check in
do_rx_work. As a result A DSP can cause bad allocations if spewing
garbage.

Fixes: 74ad8ed651 ("ASoC: SOF: ipc3: Implement rx_msg IPC ops")
Reported-by: Tim Van Patten <timvp@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://msgid.link/r/20240213123834.4827-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:45 +00:00
Peter Ujfalusi c40aad7c81
ASoC: SOF: ipc4-pcm: Workaround for crashed firmware on system suspend
When the system is suspended while audio is active, the
sof_ipc4_pcm_hw_free() is invoked to reset the pipelines since during
suspend the DSP is turned off, streams will be re-started after resume.

If the firmware crashes during while audio is running (or when we reset
the stream before suspend) then the sof_ipc4_set_multi_pipeline_state()
will fail with IPC error and the state change is interrupted.
This will cause misalignment between the kernel and firmware state on next
DSP boot resulting errors returned by firmware for IPC messages, eventually
failing the audio resume.
On stream close the errors are ignored so the kernel state will be
corrected on the next DSP boot, so the second boot after the DSP panic.

If sof_ipc4_trigger_pipelines() is called from sof_ipc4_pcm_hw_free() then
state parameter is SOF_IPC4_PIPE_RESET and only in this case.

Treat a forced pipeline reset similarly to how we treat a pcm_free by
ignoring error on state sending to allow the kernel's state to be
consistent with the state the firmware will have after the next boot.

Link: https://github.com/thesofproject/sof/issues/8721
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@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: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20240213115233.15716-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:44 +00:00
Arnd Bergmann 5b5089e2a1
ASoC: q6dsp: fix event handler prototype
clang-16 points out a mismatch in function types that was hidden
by a typecast:

sound/soc/qcom/qdsp6/q6apm-dai.c:355:38: error: cast from 'void (*)(uint32_t, uint32_t, uint32_t *, void *)' (aka 'void (*)(unsigned int, unsigned int, unsigned int *, void *)') to 'q6apm_cb' (aka 'void (*)(unsigned int, unsigned int, void *, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  355 |         prtd->graph = q6apm_graph_open(dev, (q6apm_cb)event_handler, prtd, graph_id);
sound/soc/qcom/qdsp6/q6apm-dai.c:499:38: error: cast from 'void (*)(uint32_t, uint32_t, uint32_t *, void *)' (aka 'void (*)(unsigned int, unsigned int, unsigned int *, void *)') to 'q6apm_cb' (aka 'void (*)(unsigned int, unsigned int, void *, void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  499 |         prtd->graph = q6apm_graph_open(dev, (q6apm_cb)event_handler_compr, prtd, graph_id);

The only difference here is the 'payload' argument, which is not even
used in this function, so just fix its type and remove the cast.

Fixes: 88b60bf047 ("ASoC: q6dsp: q6apm-dai: Add open/free compress DAI callbacks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://msgid.link/r/20240213101105.459402-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:43 +00:00
Peter Ujfalusi b029482011
ASoC: SOF: Intel: pci-lnl: Change the topology path to intel/sof-ipc4-tplg
The firmware release which going to introduce support for Lunar Lake will
use the documented default topology directory for IPC4:
intel/sof-ipc4-tplg

Change the default path accordingly before sof-bin (sof-firmware) release
includes Lunar Lake firmware and topologies.

Link: https://github.com/thesofproject/sof-docs/blob/master/getting_started/intel_debug/introduction.rst#2-topology-file
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Mengdong Lin <mengdong.lin@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Chao Song <chao.song@linux.intel.com>
Link: https://msgid.link/r/20240213080418.21256-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:39 +00:00
Peter Ujfalusi d463bcd7eb
ASoC: SOF: Intel: pci-tgl: Change the default paths and firmware names
The currently used paths and firmware name reflects the reference firmware
convention:

default_fw_path:     intel/avs/{platform_name}
default_lib_path:    intel/avs-lib/{platform_name}
default_tplg_path:   intel/avs-tplg
default_fw_filename: dsp_basefw.bin

The SOF supports building the firmware for cAVS2.5 platforms using IPC4 and
it is the preferred IPC4 implementation to be used on these devices.

Change the paths and firmware names to reflect this:

default_fw_path:     intel/sof-ipc4/{platform_name}
default_lib_path:    intel/sof-ipc4-lib/{platform_name}
default_tplg_path:   intel/sof-ipc4-tplg
default_fw_filename: sof-{platform_name}.ri

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://msgid.link/r/20240213080418.21256-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 13:28:38 +00:00
Yinchuan Guo 00933c4993
ASoC: codecs: fix TYPO 'reguest' to 'request' in error log
This patch corrects a common misspelling of "request" as "reguest" found
in error log across multiple files within sound/soc/codecs.

Signed-off-by: Yinchuan Guo <guoych37@mail2.sysu.edu.cn>
Link: https://msgid.link/r/20240212144247.43744-1-guoych37@mail2.sysu.edu.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-12 16:34:22 +00:00
Attila Tőkés f7fe85b229
ASoC: amd: yc: Fix non-functional mic on Lenovo 82UU
Like many other models, the Lenovo 82UU (Yoga Slim 7 Pro 14ARH7)
needs a quirk entry for the internal microphone to function.

Signed-off-by: Attila Tőkés <attitokes@gmail.com>
Link: https://msgid.link/r/20240210193638.144028-1-attitokes@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-12 16:03:08 +00:00
Daniel Baluta 2b9cdef136
ASoC: SOF: imx: Add devicetree support to select topologies
We describe tplg_file_name and drv_name using snd_sof_of_mach
array and select correct machine description based on dts compatible
string.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Reviewed-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://msgid.link/r/20240212125258.420265-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-12 13:42:22 +00:00
Hans de Goede d6755a53b8
ASoC: rt5645: Add DMI quirk for inverted jack-detect on MeeGoPad T8
The MeeGoPad T8 uses the standard rt5645 jd_mode=3 setting for jack-detect,
but the used jack connector outputs an inverted jack-detect signal.

Add a DMI quirk for this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://msgid.link/r/20240211212736.179605-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-12 13:41:29 +00:00
Hans de Goede 551539a860
ASoC: rt5645: Make LattePanda board DMI match more precise
The DMI strings used for the LattePanda board DMI quirks are very generic.

Using the dmidecode database from https://linux-hardware.org/ shows
that the chosen DMI strings also match the following 2 laptops
which also have a rt5645 codec:

Insignia NS-P11W7100 https://linux-hardware.org/?computer=E092FFF8BA04
Insignia NS-P10W8100 https://linux-hardware.org/?computer=AFB6C0BF7934

All 4 hw revisions of the LattePanda board have "S70CR" in their BIOS
version DMI strings:

DF-BI-7-S70CR100-*
DF-BI-7-S70CR110-*
DF-BI-7-S70CR200-*
LP-BS-7-S70CR700-*

See e.g. https://linux-hardware.org/?computer=D98250A817C0

Add a partial (non exact) DMI match on this string to make the LattePanda
board DMI match more precise to avoid false-positive matches.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://msgid.link/r/20240211212736.179605-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-12 13:41:28 +00:00
Takashi Iwai 8e5ffd767b ASoC: pxa2xx-ac97: Replace with DEFINE_SIMPLE_DEV_PM_OPS()
Use the new DEFINE_SIMPLE_DEV_PM_OPS() instead of SIMPLE_DEV_PM_OPS()
for code-simplification.  We need no longer CONFIG_PM_SLEEP ifdefs.
Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-14-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-12 11:50:25 +01:00
Mark Brown 8c41be2599
ASoC: Intel: Boards: Fix NULL pointer deref in BYT/CHT
Merge series from Hans de Goede <hdegoede@redhat.com>:

While testing 6.8 on a Bay Trail device with a ALC5640 codec
I noticed a regression in 6.8 which causes a NULL pointer deref
in probe().

All BYT/CHT Intel machine drivers are affected. Patch 1/2 of
this series fixes all of them.

Patch 2/2 adds some small cleanups to cht_bsw_rt5645.c for
issues which I noticed while working on 1/2.
2024-02-12 01:11:19 +00:00
Cristian Ciocaltea c4b603c6e2
ASoC: SOF: amd: Fix locking in ACP IRQ handler
A recent change in acp_irq_thread() was meant to address a potential race
condition while trying to acquire the hardware semaphore responsible for
the synchronization between firmware and host IPC interrupts.

This resulted in an improper use of the IPC spinlock, causing normal
kernel memory allocations (which may sleep) inside atomic contexts:

1707255557.133976 kernel: BUG: sleeping function called from invalid context at include/linux/sched/mm.h:315

...

1707255557.134757 kernel:  sof_ipc3_rx_msg+0x70/0x130 [snd_sof]
1707255557.134793 kernel:  acp_sof_ipc_irq_thread+0x1e0/0x550 [snd_sof_amd_acp]
1707255557.134855 kernel:  acp_irq_thread+0xa3/0x130 [snd_sof_amd_acp]
1707255557.134904 kernel:  ? irq_thread+0xb5/0x1e0
1707255557.134947 kernel:  ? __pfx_irq_thread_fn+0x10/0x10
1707255557.134985 kernel:  irq_thread_fn+0x23/0x60

Moreover, there are attempts to lock a mutex from the same atomic
context:

1707255557.136357 kernel: =============================
1707255557.136393 kernel: [ BUG: Invalid wait context ]
1707255557.136413 kernel: 6.8.0-rc3-next-20240206-audio-next #9 Tainted: G        W
1707255557.136432 kernel: -----------------------------
1707255557.136451 kernel: irq/66-AudioDSP/502 is trying to lock:
1707255557.136470 kernel: ffff965152f26af8 (&sb->s_type->i_mutex_key#2){+.+.}-{3:3}, at: start_creating.part.0+0x5f/0x180

...

1707255557.137429 kernel:  start_creating.part.0+0x5f/0x180
1707255557.137457 kernel:  __debugfs_create_file+0x61/0x210
1707255557.137475 kernel:  snd_sof_debugfs_io_item+0x75/0xc0 [snd_sof]
1707255557.137494 kernel:  sof_ipc3_do_rx_work+0x7cf/0x9f0 [snd_sof]
1707255557.137513 kernel:  sof_ipc3_rx_msg+0xb3/0x130 [snd_sof]
1707255557.137532 kernel:  acp_sof_ipc_irq_thread+0x1e0/0x550 [snd_sof_amd_acp]
1707255557.137551 kernel:  acp_irq_thread+0xa3/0x130 [snd_sof_amd_acp]

Fix the issues by reducing the lock scope in acp_irq_thread(), so that
it guards only the hardware semaphore acquiring attempt.  Additionally,
restore the initial locking in acp_sof_ipc_irq_thread() to synchronize
the handling of immediate replies from DSP core.

Fixes: 802134c8c2 ("ASoC: SOF: amd: Refactor spinlock_irq(&sdev->ipc_lock) sequence in irq_handler")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Link: https://lore.kernel.org/r/20240208234315.2182048-1-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-11 16:58:50 +00:00
Alexey Khoroshilov 6ef5d5b92f
ASoC: rt5645: Fix deadlock in rt5645_jack_detect_work()
There is a path in rt5645_jack_detect_work(), where rt5645->jd_mutex
is left locked forever. That may lead to deadlock
when rt5645_jack_detect_work() is called for the second time.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: cdba4301ad ("ASoC: rt5650: add mutex to avoid the jack detection failure")
Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Link: https://lore.kernel.org/r/1707645514-21196-1-git-send-email-khoroshilov@ispras.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-11 16:58:49 +00:00
Hans de Goede 930375d34d
ASoC: Intel: cht_bsw_rt5645: Cleanup codec_name handling
4 fixes / cleanups to the rt5645 mc driver's codec_name handling:

1. In the for loop looking for the dai_index for the codec, replace
card->dai_link[i] with cht_dailink[i]. The for loop already uses
ARRAY_SIZE(cht_dailink) as bound and card->dai_link is just a pointer to
cht_dailink using card->dai_link only obfuscates that cht_dailink is being
modified directly rather then say a copy of cht_dailink. Using
cht_dailink[i] also makes the code consistent with other machine drivers.

2. Don't set cht_dailink[dai_index].codecs->name in the for loop,
this immediately gets overridden using acpi_dev_name(adev) directly
below the loop.

3. Add a missing break to the loop.

4. Remove the now no longer used (only set, never read) codec_name field
from struct cht_mc_private.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240210134400.24913-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-11 16:57:24 +00:00
Hans de Goede 7d99a70b65
ASoC: Intel: Boards: Fix NULL pointer deref in BYT/CHT boards
Since commit 13f58267cd ("ASoC: soc.h: don't create dummy Component
via COMP_DUMMY()") dummy snd_soc_dai_link.codecs entries no longer
have a name set.

This means that when looking for the codec dai_link the machine
driver can no longer unconditionally run strcmp() on
snd_soc_dai_link.codecs[0].name since this may now be NULL.

Add a check for snd_soc_dai_link.codecs[0].name being NULL to all
BYT/CHT machine drivers to avoid NULL pointer dereferences in
their probe() methods.

Fixes: 13f58267cd ("ASoC: soc.h: don't create dummy Component via COMP_DUMMY()")
Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240210134400.24913-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-11 16:57:23 +00:00
Richard Fitzgerald 727b943263
ASoC: cs35l56: Remove default from IRQ1_CFG register
The driver never uses the IRQ1_CFG register so there's no need to provide
a default value. It's set as a readable register only for debugging
through the regmap registers file.

A system-specific firmware could overwrite this register with a non-default
value. Therefore the driver can't hardcode what the initial value actually
is. As the register is only for debugging the value can be left unknown
until someone wants to read it through debugfs.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240209145700.1555950-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-09 15:22:54 +00:00
Cezary Rojewski f7fc624be3
ASoC: Intel: avs: Expose FW version with sysfs
Add functionality to read version of loaded FW from sysfs.

Signed-off-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/20240209085256.121261-1-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-09 14:32:51 +00:00
Gergo Koteles 4089d82e67
ASoC: tas2781: remove unused acpi_subysystem_id
The acpi_subysystem_id is only written and freed, not read, so
unnecessary.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/454639336be28d2b50343e9c8366a56b0975e31d.1707456753.git.soyer@irl.hu
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-09 14:32:51 +00:00
Bard Liao 6b4c7d4d82
ASoC: Intel: sof_sdw: starts non sdw BE id with the highest sdw BE id
The soundwire links do not have their IDs as consecutive numbers, thus
the last link might have lower be_id than the previous one and this
leads to id collision with non SDW links.

For example,
create dai link SDW0-Playback-SimpleJack, id 0
create dai link SDW0-Capture-SmartMic, id 4
create dai link SDW0-Capture-SimpleJack, id 1
create dai link SDW2-Playback-SmartAmp, id 2
create dai link SDW2-Capture-SmartAmp, id 3
create dai link iDisp1, id 4
create dai link iDisp2, id 5
create dai link iDisp3, id 6

Reviewed-by: Chao Song <chao.song@linux.intel.com>
Co-developed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-25-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:26 +00:00
Chao Song 7fa43af5b4
ASoC: Intel: soc-acpi-intel-lnl-match: Add rt722 support
This patch adds match table for rt722 multiple
function codec on link 0.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-24-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:25 +00:00
Chao Song 0bbb0136b4
ASoC: Intel: soc-acpi: add RT712 support for LNL
This patch adds RT712 support for LNL.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-23-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:23 +00:00
Charles Keepax 36fe7a495e
ASoC: Intel: sof_sdw: Remove unused function prototypes
Recent commits remove a lot of init functions remove their function
prototypes as well.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-22-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:22 +00:00
Charles Keepax c1469c3a8a
ASoC: Intel: ssp-common: Add stub for sof_ssp_get_codec_name
As this function is now used in sof_board_helpers it requires a build
stub for the case SSP_COMMON is not built in.

Fixes: ba0c7c3287 ("ASoC: Intel: board_helpers: support amp link initialization")
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:21 +00:00
mosomate c13e03126a
ASoC: Intel: common: DMI remap for rebranded Intel NUC M15 (LAPRC710) laptops
Added DMI quirk to handle the rebranded variants of Intel NUC M15
(LAPRC710) laptops. The DMI matching is based on motherboard
attributes.

Link: https://github.com/thesofproject/linux/issues/4218
Signed-off-by: Máté Mosonyi <mosomate@gmail.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:19 +00:00
Bard Liao 579d6596eb
ASoC: Intel: sof_sdw: remove .init callbacks
Some codec .init callbacks are empty after removing dai_links->init =
xxx_rtd_init;. Remove those callbacks.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:18 +00:00
Bard Liao 8266c73126
ASoC: Intel: sof_sdw: add common sdw dai link init
Currently, we set sdw dai link .init callback in the codec_info_list's
dais.init function. This works fine if all codecs in the dai link are
the same. However, we need to do all the .init stuff for all different
codecs in the dai link if not all codecs in the dai link are the same.
Use a common dai link .init callback to call the new rtd_init callback
in sof_sdw_dai_info{} to do rtd_init for each dai.
Some codec init callback will become empty after this change. They will
be removed in the follow up patch.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:17 +00:00
Bard Liao 7bc6ceba7d
ASoC: Intel: sof_sdw_rt5682: use helper to get codec dai by name
Use helper to get codec dai by name.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:15 +00:00
Bard Liao 5e052fba62
ASoC: Intel: sof_sdw_cs42l42: use helper to get codec dai by name
Use helper to get codec dai by name.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:14 +00:00
Bard Liao 3e522c9852
ASoC: Intel: sof_sdw_rt700: use helper to get codec dai by name
Use helper to get codec dai by name.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:13 +00:00
Bard Liao c44f69bbcc
ASoC: Intel: sof_sdw_rt712_sdca: use helper to get codec dai by name
Use helper to get codec dai by name.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:12 +00:00
Bard Liao 91a959d891
ASoC: Intel: sof_sdw_rt711: use helper to get codec dai by name
Use helper to get codec dai by name.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:11 +00:00
Bard Liao 49f679a175
ASoC: Intel: sof_sdw_rt_sdca_jack_common: use helper to get codec dai by name
Use helper to get codec dai by name.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:10 +00:00
Bard Liao 4ca5ba58f1
ASoC: Intel: add get_codec_dai_by_name helper function
Currently, we assume the codecs in a dai link are all the same.
So that we get codec dai with snd_soc_rtd_to_codec(rtd, 0) in dai_links
->init callback. However, a link can include different codecs.
For example, a 4 speakers link can consist of rt712 and rt1316.
Therefore, we need to select the codec dai by name in the dai link.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:09 +00:00
Bard Liao 9f3763b362
ASoC: Intel: sof_sdw: use single rtd_init for rt_amps
2 amps can be in the same or different dai links. To handle this, the
existing code implements different spk_init functions to add dapm routes
for different amps. However, sof_sdw.c doesn't support non-aggregated
amp any more since it used pre-defined BE id.
With that assumption, combine the spk_init functions together.
This is a preparation of putting different types amps in a single dai
link.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240208165545.93811-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-08 21:23:08 +00:00