Commit graph

3746 commits

Author SHA1 Message Date
Daniel Vetter f112b68f27 Linux 6.8-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmXb0T4eHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiG5YQH/3eCV90sNGch0Y94
 8rtTdqFrVx7QPNl0pz+Mo6OUIKUUHvTuwime16ckLxG+3x2Y3I0MjP1edd1NB99C
 Kje//JTpaZBPpTZ/jY4u8B1Shov2Drdx/J4NFnE/9rG6yXzKQBtvON/xAxXDCVHT
 mLhst2LR0FeCSMk9jAX6CoqUPEgwlylNyAetKxaDQgoHl4GTZC7FDO17WxyjpIxe
 1rVHsrV9Eq8kD4uxrzpTYWgZrwTObPmlZjvefa1JfzSwRNABIBJj/C1nra1Zc1oi
 b7xVaXS1cMOxrtuuG00fmHsPnWivu0tuND7H3/yLd1mRCZAPSsVbVvrI/KNtoeV4
 1euINlY=
 =7IFt
 -----END PGP SIGNATURE-----

Merge v6.8-rc6 into drm-next

Thomas Zimmermann asked to backmerge -rc6 for drm-misc branches,
there's a few same-area-changed conflicts (xe and amdgpu mostly) that
are getting a bit too annoying.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
2024-02-26 11:41:07 +01:00
Mark Brown 0c4ebb28b3
ALSA: cs35l56: Apply calibration from EFI
Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

Factory calibration of the speakers stores the calibration information
into an EFI variable.

This set of patches adds support for applying speaker calibration
data from that EFI variable.

The HDA patch (#5) depends on the ASoC patches #2 and #3
2024-02-24 01:58:40 +00:00
Richard Fitzgerald e1830f66f6
ASoC: cs35l56: Add helper functions for amp calibration
Adds some helper functions and data for applying amp calibration.

1. cs35l56_read_silicon_uid() to get the silicon ID that is used to
   search for the correct calibration data entry.

2. Add the registers for the silicon ID to the readable registers.

3. cs35l56_get_calibration() wrapper around
   cs_amp_get_efi_calibration_data()

4. cs35l56_calibration_controls() table of the firmware controls
   for calibration data.

5. Added members to struct cs35l56_base to store the calibration
   data.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240223153910.2063698-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-23 17:21:40 +00:00
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 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
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 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
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
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
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
Pierre-Louis Bossart b85a3dc281
ASoC: SOF: Intel: hda-mlink: update incorrect comment
Likely a copy-paste error, wrong CONFIG used.

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/20240213114354.32579-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-13 14:22:58 +00:00
Takashi Iwai fd1786bf71 ALSA: ens137x: 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.

For building properly, add the dummy functions for
snd_ak4531_suspend/resume() functions, too.

Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-12 11:50:24 +01:00
Takashi Iwai 8cd4a3b221 ALSA: als4000: 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.

For building properly, add the dummy functions for
snd_sbmixer_suspend/resume() functions, too.

Just a cleanup, no functional changes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20240207155140.18238-6-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-02-12 11:50:24 +01: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
Thomas Zimmermann 0e85f1ae4a Merge drm/drm-next into drm-misc-next
Backmerging to update drm-misc-next to the state of v6.8-rc3. Also
fixes a build problem with xe.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
2024-02-07 13:02:20 +01:00
Gergo Koteles 34a1066981
ASoC: tas2781: add module parameter to tascodec_init()
The tascodec_init() of the snd-soc-tas2781-comlib module is called from
snd-soc-tas2781-i2c and snd-hda-scodec-tas2781-i2c modules. It calls
request_firmware_nowait() with parameter THIS_MODULE and a cont/callback
from the latter modules.

The latter modules can be removed while their callbacks are running,
resulting in a general protection failure.

Add module parameter to tascodec_init() so request_firmware_nowait() can
be called with the module of the callback.

Fixes: ef3bcde75d ("ASoC: tas2781: Add tas2781 driver")
CC: stable@vger.kernel.org
Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/118dad922cef50525e5aab09badef2fa0eb796e5.1707076603.git.soyer@irl.hu
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-05 14:31:37 +00:00
Richard Fitzgerald 9e92b77ceb
ASoC: cs35l56: Allow more time for firmware to boot
The original 50ms timeout for firmware boot is not long enough for
worst-case time to reboot after a firmware download. Increase the
timeout to 250ms.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: e496112529 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56")
Link: https://msgid.link/r/20240129162737.497-15-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-01 12:57:26 +00:00
Richard Fitzgerald 245eeff18d
ASoC: cs35l56: Load tunings for the correct speaker models
If the "spk-id-gpios" property is present it points to GPIOs whose
value must be used to select the correct bin file to match the
speakers.

Some manufacturers use multiple sources of speakers, which need
different tunings for best performance. On these models the type of
speaker fitted is indicated by the values of one or more GPIOs. The
number formed by the GPIOs identifies the tuning required.

The speaker ID must be used in combination with the subsystem ID
(either from PCI SSID or cirrus,firmware-uid property), because the
GPIOs can only indicate variants of a specific model.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 1a1c3d794e ("ASoC: cs35l56: Use PCI SSID as the firmware UID")
Link: https://msgid.link/r/20240129162737.497-14-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-01 12:57:25 +00:00
Richard Fitzgerald f4ef514995
ASoC: cs35l56: Firmware file must match the version of preloaded firmware
Check during initialization whether the firmware is already patched.
If so, include the firmware version in the wm_adsp fwf_name string.

If the firmware has already been patched by the BIOS the driver
can only replace it if it has control of hard RESET.

If the driver cannot replace the firmware, it can still load a wmfw
(for ALSA control definitions) and/or a bin (for additional tunings).
But these must match the version of firmware that is running on the
CS35L56.

The firmware is pre-patched if FIRMWARE_MISSING == 0.

Including the firmware version in the fwf_name string will
qualify the firmware file name:

Normal (unpatched or replaceable firmware):
  cs35l56-rev-dsp1-misc[-system_name].[wmfw|bin]

Preloaded firmware:
  cs35l56-rev[-s]-VVVVVV-dsp1-misc[-system_name].[wmfw|bin]

Where:
   [-s] is an optional -s added into the name for a secured CS35L56
   VVVVVV is the 24-bit firmware version in hexadecimal.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 608f1b0dbd ("ASoC: cs35l56: Move DSP part string generation so that it is done only once")
Link: https://msgid.link/r/20240129162737.497-13-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-01 12:57:24 +00:00
Richard Fitzgerald 72a77d7631
ASoC: cs35l56: Fix to ensure ASP1 registers match cache
Add a dummy SUPPLY widget connected to the ASP that forces the
chip registers to match the regmap cache when the ASP is
powered-up.

On a SoundWire system the ASP is free for use as a chip-to-chip
interconnect. This can be either for the firmware on multiple
CS35L56 to share reference audio; or as a bridge to another
device. If it is a firmware interconnect it is owned by the
firmware and the Linux driver should avoid writing the registers.
However. If it is a bridge then Linux may take over and handle
it as a normal codec-to-codec link.

CS35L56 is designed for SDCA and a generic SDCA driver would
know nothing about these chip-specific registers. So if the
ASP is being used on a SoundWire system the firmware sets up the
ASP registers. This means that we can't assume the default
state of the ASP registers. But we don't know the initial state
that the firmware set them to until after the firmware has been
downloaded and booted, which can take several seconds when
downloading multiple amps.

To avoid blocking probe() for several seconds waiting for the
firmware, the silicon defaults are assumed. This allows the machine
driver to setup the ASP configuration during probe() without being
blocked. If the ASP is hooked up and used, the SUPPLY widget
ensures that the chip registers match what was configured in the
regmap cache.

If the machine driver does not hook up the ASP, it is assumed that
it won't call any functions to configure the ASP DAI. Therefore
the regmap cache will be clean for these registers so a
regcache_sync() will not overwrite the chip registers. If the
DAI is not hooked up, the dummy SUPPLY widget will not be
invoked so it will never force-overwrite the chip registers.

Backport note:
This won't apply cleanly to kernels older than v6.6.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: e496112529 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56")
Link: https://msgid.link/r/20240129162737.497-8-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-02-01 12:57:20 +00:00
Vijendar Mukunda 14d89e55de
ASoC: SOF: amd: Add Soundwire DAI configuration support for AMD platforms
Add support for configuring AMD Soundwire DAI from topology.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://msgid.link/r/20240129055147.1493853-10-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-30 16:06:39 +00:00
Maxime Ripard 4db102dcb0
Merge drm/drm-next into drm-misc-next
Kickstart 6.9 development cycle.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
2024-01-29 14:20:23 +01:00
Christophe JAILLET 1ac1b4b79b ALSA: synth: Save a few bytes of memory when registering a 'snd_emux'
snd_emux_register() calls pass a string literal as the 'name' parameter.

So kstrdup_const() can be used instead of kfree() to avoid a memory
allocation in such cases.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/9e7b94c852a25ed4be5382e5e48a7dd77e8d4d1a.1705743706.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-22 13:04:22 +01:00
Takashi Iwai e069642059 ASoC: Fixes for v6.8
A bunch of small fixes that come in during the merge window, mainly
 fixing issues from some core refactoring around dummy components that
 weren't detected until things reached mainline.
 
 The TAS driver changes are a little larger than normal for a device ID
 addition due to some shuffling around of where things are registered and
 DT updates but aren't really any more substantial than normal.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmWmnFEACgkQJNaLcl1U
 h9Dzvgf/RfM1g44TeC/hSX0+qdrL6QYg5wPeMWPtV4xgLqx2oqftU9eIcBLHPz03
 N1hdutFFqNTR3W5GiTmyV5mLdgJpZBgkYU5dkhXCrlI7xJ6tV7Wsx86Q9ClSmEBH
 Z4ZR2oAmCQIt3swshOBvwYUI6MOcG/zSqDBcRQ6t6d98TOkp2m3PPrjEYqEA2ja9
 tyr73WXsdammYXZVYPu9oYoNE2Ef6Io5nkyds1F4irCcx1EXiS95cZjF3/OZ9OPP
 iGpzVkXvgwb0Jbq+NsBogydsIsSAu4pyNNcu3P9Xcr1rkNqVwz1X1KYvvnSHDqdw
 ZbmU6r83dCUpizpgFA4wv8irNn+aKw==
 =Rr9L
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v6.8-merge-window' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v6.8

A bunch of small fixes that come in during the merge window, mainly
fixing issues from some core refactoring around dummy components that
weren't detected until things reached mainline.

The TAS driver changes are a little larger than normal for a device ID
addition due to some shuffling around of where things are registered and
DT updates but aren't really any more substantial than normal.
2024-01-16 17:37:17 +01:00
Jani Nikula a05f727930 ASoC: hdmi-codec: drop drm/drm_edid.h include
hdmi-codec.h does not appear to directly need drm/drm_edid.h for
anything. Remove it.

There are some files that get drm/drm_edid.h by proxy; include it where
needed.

v2-v4: Fix build (kernel test robot <lkp@intel.com>)

Cc: Rob Clark <robdclark@gmail.com>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Sean Paul <sean@poorly.run>
Cc: Marijn Suijten <marijn.suijten@somainline.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Cc: Robert Foss <rfoss@kernel.org>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: linux-sound@vger.kernel.org
Acked-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: <jyri.sarha@linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240104201632.1100753-3-jani.nikula@intel.com
2024-01-16 16:07:28 +02:00
Takashi Iwai 0205f3753d ASoC: Updates for v6.8
This is a relatively quiet release, there's a lot of driver specific
 changes and the usual high level of activity in the SOF core but the
 one big core change was Mormioto-san's work to support more N:M
 CPU:CODEC mapping cases.  Highlights include:
 
  - Enhanced support for N:M CPU:CODEC mappings in the core and in
    audio-graph-card2.
  - Support for falling back to older SOF IPC versions where firmware for
    new versions is not available.
  - Support for notification of control changes generated by SOF firmware
    with IPC4.
  - Device tree support for describing parts of the card which can be
    active over suspend (for very low power playback or wake word use
    cases).
  - ACPI parsing support for the ES83xx driver, reducing the number of
    quirks neede for x86 systems.
  - Support for more AMD and Intel systems, NXP i.MX8m MICFIL, Qualcomm
    SM8250, SM8550, SM8650 and X1E80100.
  - Removal of Freescale MPC8610 support, the SoC is no longer supported
    by Linux.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmWbJ5EACgkQJNaLcl1U
 h9CZTwf/c8CPwoKABZear8jiQpZLUhFLuGQwSShPYVZ7XPzzTMp9BwVmd40DCnUi
 NeSc22t2UgT0H06nx3QK8sKOhrpQoBQVrIajf2AaxD44TJbsOYGGe4pMh1sXKAMF
 c0ybp8uRgsjiv2Y++SBXZLexGC11/b8eTFLV1nTK/i2nygGjbfWSJ9s4PpB9V6cA
 nZrQ/p+x/ZwaBejFUnvE06M7GHtCD6lxrB9Q1EmWA4RxcW7RNUtIN5gr16HlaMiC
 3gix4mg40llhBFF9s4eBjRBNKL2paiejPZwcYkAC8w+SkZ/roXaeN55g0avmDWyW
 AN9o096vaEVWKhZ/jdTHmFVf2PV2Iw==
 =rbT5
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v6.8' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v6.8

This is a relatively quiet release, there's a lot of driver specific
changes and the usual high level of activity in the SOF core but the
one big core change was Mormioto-san's work to support more N:M
CPU:CODEC mapping cases.  Highlights include:

 - Enhanced support for N:M CPU:CODEC mappings in the core and in
   audio-graph-card2.
 - Support for falling back to older SOF IPC versions where firmware for
   new versions is not available.
 - Support for notification of control changes generated by SOF firmware
   with IPC4.
 - Device tree support for describing parts of the card which can be
   active over suspend (for very low power playback or wake word use
   cases).
 - ACPI parsing support for the ES83xx driver, reducing the number of
   quirks neede for x86 systems.
 - Support for more AMD and Intel systems, NXP i.MX8m MICFIL, Qualcomm
   SM8250, SM8550, SM8650 and X1E80100.
 - Removal of Freescale MPC8610 support, the SoC is no longer supported
   by Linux.
2024-01-08 08:18:02 +01:00
Shenghao Ding e9aa44736c
ASoC: tas2781: Add tas2563 into header file for DSP mode
Move tas2563 from tas2562 header file to tas2781 header file to unbind
tas2563 from tas2562 driver code and bind it to tas2781 driver code,
because tas2563 only work in bypass-DSP mode with tas2562 driver. In
order to enable DSP mode for tas2563, it has been moved to tas2781
driver. As to the hardware part, such as register setting and DSP
firmware, all these are stored in the binary firmware. What tas2781
drivder does is to parse the firmware and download it to the chip,
then power on the chip. So, tas2781 driver can be resued as tas2563
driver. Only attention will be paid to downloading corresponding firmware.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://msgid.link/r/20240104145721.1398-3-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2024-01-05 13:27:17 +00:00
Gergo Koteles c3ca4458cc ALSA: hda/tas2781: add TAS2563 support for 14ARB7
The INT8866 belongs to the Lenovo Yoga 7 Gen 7 AMD 14ARB7
laptop. It has two TAS2563 amplifier. Add the PNP ID
and calibration functions to handle them.

ACPI excerpt:

Scope (_SB.I2CD)
{
    Device (TAS)
    {
        Name (_HID, "INT8866")  // _HID: Hardware ID
        Name (_UID, Zero)  // _UID: Unique ID
        Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
        {
            Name (RBUF, ResourceTemplate ()
            {
                I2cSerialBusV2 (0x004C, ControllerInitiated, 0x00061A80,
                    AddressingMode7Bit, "\\_SB.I2CD",
                    0x00, ResourceConsumer, , Exclusive,
                    )
                I2cSerialBusV2 (0x004D, ControllerInitiated, 0x00061A80,
                    AddressingMode7Bit, "\\_SB.I2CD",
                    0x00, ResourceConsumer, , Exclusive,
                    )
                GpioInt (Edge, ActiveLow, SharedAndWake, PullNone, 0x0000,
                    "\\_SB.GPIO", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0020
                    }
             })
             Return (RBUF) /* \_SB_.I2CD.TAS_._CRS.RBUF */
        }

        Method (_STA, 0, NotSerialized)  // _STA: Status
        {
            Return (0x0F)
        }
    }
}

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/3b8d4c602e1a46922f53bc9afc8b705d55aa4872.1703891777.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-02 16:15:28 +01:00
Gergo Koteles c021ca729f ALSA: hda/tas2781: add configurable global i2c address
Make the global i2c address configurable to support compatible amplifiers
with different global i2c address.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/a252f1efeed5049f027f01e699c9e10e1e05bf9e.1703891777.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-02 16:15:09 +01:00
Gergo Koteles 76f5f55c45 ALSA: hda/tas2781: add ptrs to calibration functions
Make calibration functions configurable to support different calibration
data storage modes.

Signed-off-by: Gergo Koteles <soyer@irl.hu>
Link: https://lore.kernel.org/r/5859c77ffef752b8a9784713b412d815d7e2688c.1703891777.git.soyer@irl.hu
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2024-01-02 16:14:01 +01:00
Greg Kroah-Hartman 66e82d2199 ALSA: mark all struct bus_type as const
Now that the driver core can properly handle constant struct bus_type,
move all of the sound subsystem struct bus_type structures as const,
placing them into read-only memory which can not be modified at runtime.

Note, this fixes a duplicate definition of ac97_bus_type, which somehow
was declared extern in a .h file, and then static as a prototype in a .c
file, and then properly later on in the same .c file.  Amazing that no
compiler warning ever showed up for this.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Dawei Li <set_pte_at@outlook.com>
Cc: Yu Liao <liaoyu15@huawei.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: linux-sound@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/2023121945-immersion-budget-d0aa@gregkh
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-12-30 10:10:41 +01:00
Kuninori Morimoto 13f58267cd
ASoC: soc.h: don't create dummy Component via COMP_DUMMY()
Many ASoC drivers define CPU/Codec/Platform dai_link by below macro.

	SND_SOC_DAILINK_DEFS(link,
(A)		     DAILINK_COMP_ARRAY(COMP_CPU("cpu_dai")),
(B)		     DAILINK_COMP_ARRAY(COMP_CODEC("codec", "dai1"),
(B)					COMP_CODEC("codec", "dai2")),
(C)		     DAILINK_COMP_ARRAY(COMP_EMPTY()));

In this case, this macro will be converted to like below

	[o] = static struct snd_soc_dai_link_component

(A)	[o] link_cpus[]      = {{ .dai_name = "cpu_dai" }};
(B)	[o] link_codecs[]    = {{ .dai_name = "dai1", .name = "codec" },
				{ .dai_name = "dai2", .name = "codec" }}
(C)	[o] link_platforms[] = {{ }};

CPU and Codec info will be filled by COMP_CPU() / COMP_CODEC (= A,B),
and Platform will have empty data by COMP_EMPTY() (= C) in this case.

Platform empty info will be filled when driver probe()
(most of case, CPU info will be copied to use soc-generic-dmaengine-pcm).

For example in case of DPCM FE/BE, it will be like below.
Codec will be dummy Component / DAI in this case (X).

	SND_SOC_DAILINK_DEFS(link,
		     DAILINK_COMP_ARRAY(COMP_CPU(...)),
(X)		     DAILINK_COMP_ARRAY(COMP_DUMMY()),
		     DAILINK_COMP_ARRAY(COMP_EMPTY()));

(X) part will converted like below

	[o] link_codecs[]    = {{ .name = "snd-soc-dummy",
				  .dai_name = "snd-soc-dummy-dai", }}

Even though we already have common asoc_dummy_dlc for dummy
Component / DAI, this macro will re-create new dummy dlc.
Some drivers defines many dai_link info via SND_SOC_DAILINK_DEFS(),
this means many dummy dlc also will be re-created. This is waste of
memory.

If we can use existing common asoc_dummy_dlc at (X),
we can avoid to re-creating dummy dlc, then, we can save the memory.

At that time, we want to keep existing code as much as possible, because
too many drivers are using this macro. But because of its original style,
using common asoc_dummy_dlc from it is very difficult or impossible.

So let's change the mind. The macro is used like below

	SND_SOC_DAILINK_DEFS(link,
		     DAILINK_COMP_ARRAY(COMP_CPU(...)),
(x)		     DAILINK_COMP_ARRAY(COMP_DUMMY()),
		     DAILINK_COMP_ARRAY(COMP_EMPTY()));

	static struct snd_soc_dai_link dai_links[] = {
	{
		.name = ...,
		.stream_name = ...,
(y)		SND_SOC_DAILINK_REG(link),
	},

(y) part will be like below

        static struct snd_soc_dai_link dai_links[] = {
        {
                .name = ...,
                .stream_name = ...,
 ^		...
 |		.codecs		= link_codecs,
(y)		.num_codecs	= ARRAY_SIZE(link_codecs),
 v		...
	}

This patch try to use trick on COMP_DUMMY()

-	#define COMP_DUMMY()	{ .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }
+	#define COMP_DUMMY()

By this tric, (x) part will be like below.

before
	[o] link_codecs[] = {{ .name = "snd-soc-dummy", .dai_name = "snd-soc-dummy-dai", }}
after
	[o] link_codecs[] = { };

This is same as below

	[o] link_codecs[0];

This means it has pointer (link_codecs), but the array size is 0.
(y) part will be like below.

	static struct snd_soc_dai_link dai_links[] = {
	{
		...
		.codecs		= link_codecs,
		.num_codecs	= 0,
		...
	},

This is very special settings that normal use usually not do,
but new macro do.
We can find this special settings on soc-core.c and fill it as
"dummy DAI" (= asoc_dummy_dlc). By this tric, we can avoid to re-create
dummy dlc and save the memory.

This patch add tric at COMP_DUMMY() and add snd_soc_fill_dummy_dai()
to fill dummy DAI.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://msgid.link/r/871qbi93qu.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-19 13:23:46 +00:00
Rander Wang 57cd29a825
ASoC: SOF: IPC4: synchronize fw_config_params with fw definitions
Update fw_config_params in driver.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://msgid.link/r/20231215083102.3064200-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-15 12:57:56 +00:00
Daniel Baluta d29351e8c2
ASoC: audio-graph-card2: Introduce playback-only/capture-only DAI link flags
We need this to support MICFIL PDM found on i.MX8MP where the DAI link
supports only capture direction.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://msgid.link/r/20231128081119.106360-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-14 10:56:47 +00:00
Mark Brown 885f68fec0
GPIO descriptor cleanup for some Wolfson codecs
Merge series from Linus Walleij <linus.walleij@linaro.org>:

This converts the remaining Wolfson ASoC codecs to
use GPIO descriptors.

These Wolfson codecs are mostly used with different
Samsung S3C (especially Cragganmore 6410) board files,
so the in-tree users are fixed up in the process.
2023-12-09 00:16:04 +00:00
Linus Walleij 729f02ec02
ASoC: wm8996: Convert to GPIO descriptors
This converts the WM8996 codec to use GPIO descriptors, an a similar
way to WM5100.

The driver is instantiating a GPIO chip named wm8996, and we get
rid of the base address for the GPIO chip from the platform data and
just use dynamic numbering. Move base and ngpio into the static
gpio_chip template.

Fix up the only in-tree user which is the Cragganmore 6410 module.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-5-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:32:00 +00:00
Linus Walleij 8563cfe39b
ASoC: wm5100: Convert to GPIO descriptors
This converts the WM5100 codec to use GPIO descriptors, a pretty
straight-forward conversion with the following peculiarities:

- The driver is instantiating a GPIO chip named wm5100, and the
  headphone polarity detection GPIO is lifted from there. We add
  this to the GPIO descriptor table as well, and we can then get
  rid of also the base address for the GPIO chip from the
  platform data and just use dynamic numbering.

- Fix up the only in-tree user which is the Cragganmore 6410
  module.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-4-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:31:59 +00:00
Linus Walleij 0119b2a24e
ASoC: wm2200: Convert to GPIO descriptors
This converts the WM2200 codec to use GPIO descriptors.
This is a pretty straight-forward conversion, and it also
switches over the single in-tree user in the S3C
Cragganmore module for S3C 6410.

This coded does not seem to get selected or be selectable
through Kconfig, I had to hack another soundcard Kconfig
entry to select it for compile tests.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-3-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:31:59 +00:00
Linus Walleij 10a366f36e
ASoC: wm1250-ev1: Convert to GPIO descriptors
This converts the WM1250-EV1 codec to use GPIO descriptors.
It turns out that the platform data was only used to pass some
global GPIO numbers from a board file, so we get rid of this
and also switch over the single in-tree user in the S3C
Cragganmore module for S3C 6410.

The driver obtains two GPIO lines named OSR and master and just
pull them low, we leave this behaviour as it was.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-2-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:31:58 +00:00
Linus Walleij b53d477756
ASoC: wm0010: Convert to GPIO descriptors
This converts the WM0010 codec to use GPIO descriptors.
It's a pretty straight-forward conversion also switching over
the single in-tree user in the S3C Cragganmore module
for S3C 6410.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231208-descriptors-sound-wlf-v1-1-c4dab6f521ec@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-08 14:31:57 +00:00
Baofeng Tian 8ec56af3da
ASoC: SOF: add alignment for topology header file struct definition
sof header file requires these struct with 4 byte aligned, so
add same alignment in sof driver definition.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231204214713.208951-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-04 21:49:21 +00:00
Baofeng Tian 6c4df324d7
ASoC: SOF: align topology header file with sof topology header
Add missed definition and align variable names with sof topology
header file.

Signed-off-by: Baofeng Tian <baofeng.tian@intel.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/20231204214713.208951-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-04 21:49:20 +00:00
Linus Walleij 42d1178d22
ASoC: cs4271: Convert to GPIO descriptors
This converts the Cirrus CS4271 ASoC codec driver to use
GPIO descriptors.

It turns out that there are two in-kernel users of the platform
data passing mechanism so these are switched over as well.

One locally defined GPIO "gpio_disabled" is declared in the
state struct but completely unused in the driver, so we delete
it.

Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20231201-descriptors-sound-cirrus-v2-6-ee9f9d4655eb@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-12-01 16:59:21 +00:00
Peter Ujfalusi 1162d267ea
ASoC: SOF: Add placeholder for platform IPC type and path overrides
Add a struct sof_loadable_file_profile which can be filled by platforms
(sof-acpi-dev.c, sof-of-dev.c and sof-acpi-dev.c) to be able to use common,
generic code to handle path customization.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20231129125327.23708-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-29 13:25:06 +00:00
Cezary Rojewski dfd6ba6813 ALSA: hda: Drop snd_hdac_calc_stream_format()
There are no users of the function.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-15-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:28:47 +01:00
Cezary Rojewski d24f1a090d ALSA: hda: Upgrade stream-format infrastructure
Introduce a set of functions that ultimately facilite SDxFMT-related
calculations in atomic manner:

First, introduce snd_pcm_subformat_width() and snd_pcm_hw_params_bits()
helpers that separate the base functionality from the HDAudio-specific
one.

snd_hdac_format_normalize() - format converter. S20_LE, S24_LE and their
unsigned and BE friends are invalid from HDAudio perspective but still
can be specified as function argument due to compatibility reasons.

snd_hdac_stream_format_bits() - obtain just the bits-per-sample value.
Does not ignore subformat and msbits parameters.

snd_hdac_stream_format() and snd_hdac_spdif_stream_format() - obtain the
SDxFMT value given the audio format parameters. The former is stripped
away of spdif-related information. Useful for users that do not care
about them.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-5-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:27:41 +01:00
Cezary Rojewski 4a6ba09e89 ASoC: pcm: Honor subformat when configuring runtime
Subformat options are ignored when setting up hardware parameters and
assigning PCM stream capabilities. Account for them to allow for
granular format selection.

As there is only one user currently (format S32_LE), subformat is
represented by a simple u32 and stores flags only for that one user
alone. Such approach allows for alloc/free-less code until there are
more users on the horizon.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Link: https://lore.kernel.org/r/20231117120610.1755254-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:27:20 +01:00
Cezary Rojewski a7fc8b862f ALSA: hda: Honor subformat when querying PCMs
Update mechanism for querying supported PCMs to allow for granular
format selection when container size is 32 bits. Currently always the
highest bit depth is selected, regardless of how many actual formats
codec in question supports.

Acked-by: Mark Brown <broonie@kernel.org>
Co-developed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20231117120610.1755254-3-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:24:27 +01:00
Jaroslav Kysela 2112aa0349 ALSA: pcm: Introduce MSBITS subformat interface
Improve granularity of format selection for S32/U32 formats by adding
constants representing 20, 24 and MAX most significant bits.

The MAX means the maximum number of significant bits which can
the physical format hold. For 32-bit formats, MAX is related
to 32 bits. For 8-bit formats, MAX is related to 8 bits etc.

As there is only one user currently (format S32_LE), subformat is
represented by a simple u32 and stores flags only for that one user
alone. The approach of subformat being part of struct snd_pcm_hardware
is a compromise between ALSA and ASoC allowing for
hw_params-intersection code to be alloc/free-less while not adding any
new responsibilities to ASoC runtime structures.

Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Co-developed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20231117120610.1755254-2-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-27 17:24:26 +01:00
Kuninori Morimoto 45cc50d134
ASoC: makes CPU/Codec channel connection map more generic
Current ASoC CPU:Codec = N:M connection is using connection mapping idea,
but it is used for N < M case only. We want to use it for any case.

By this patch, not only N:M connection, but all existing connection
(1:1, 1:N, N:N) will use same connection mapping. Then, because it will
use default mapping, no conversion patch is needed to exising drivers.

More over, CPU:Codec = N:M (N > M) also supported in the same time.

ch_maps array will has CPU/Codec index by this patch.

Image
	CPU0 <---> Codec0
	CPU1 <-+-> Codec1
	CPU2 <-/

ch_map
	ch_map[0].cpu = 0	ch_map[0].codec = 0
	ch_map[1].cpu = 1	ch_map[1].codec = 1
	ch_map[2].cpu = 2	ch_map[2].codec = 1

Link: https://lore.kernel.org/r/87fs6wuszr.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/878r7yqeo4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Tested-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/87ttpq4f2c.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-27 13:44:00 +00:00
Peter Ujfalusi 1a307538c9
ASoC: SOF: ipc4: Add data struct for module notification message from firmware
With the module notification message the information about the notification
is provided via the mailbox with the sof_ipc4_notify_module_data struct.

It contains the module and instance id of the sender of the notification,
the event_id and optionally additional data which is module and event
specific.

At the same time add definitions to identify ALSA kcontrol change
notification.
These notifications use standardized event_id, modules must follow this if
they support such notifications:
upper 16 bit: 0xA15A as a magic identification value
lower 16 bit: param_id of the changed control

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://lore.kernel.org/r/20231124150853.18648-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-24 15:38:00 +00:00
Stefan Binding d04ce4113c ALSA: cs35l41: Fix for old systems which do not support command
Some older laptops using cs35l41 use firmware which does not support
the CSPL_MBOX_CMD_SPK_OUT_ENABLE command.
Firmware versions v0.28.0 and older do not support this command.

Fixes: fa3efcc36a ("ALSA: cs35l41: Use mbox command to enable speaker output for external boost")
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231117163609.823627-3-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-11-20 12:37:01 +01:00
Jack Yu 577d715448
ASoC: rt5682s: Add LDO output selection for dacref
Add LDO output selection for dacref.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/62cad4e51c044108bad872ab349e36f8@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-14 17:39:27 +00:00
Daniel Baluta 89ef42088b
ASoC: SOF: Add support for configuring PDM interface from topology
Currently we only support configuration for number of channels and
sample rate.

Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Link: https://lore.kernel.org/r/20231109135900.88310-3-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-11-13 00:43:06 +00:00
Takashi Iwai 2dc15ff73b ASoC: Updates for v6.7
More updates for v6,7 following the early merge request:
 
   - Fixes for handling of component name prefixing when name prefixes
     are used by the machine driver.
   - Fixes for noise when stopping some Sounwire CODECs.
   - Support for AMD ACP 6.3 and 7.0, Awinc AW88399, more Intel
     platforms and more Qualcomm SC7180 platforms.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmU/rAQACgkQJNaLcl1U
 h9AXVwf/SwWrxTus3+O2hS5rwusjqQBn1t2mzlnxsYNVCYGBcjOpMGL4HrJzn++e
 DJXoMyWis5FNKFWyPtKMGE1kZYdUUE/g7LpZOBew4P47nBv6SQWRvUxPfoq8mdOg
 Xb4+kjBzTq1dhwZnZPvNdsknvM7cLfx/lyo2vUJR4peDL0rzgnx72fhRZAjzh2OH
 CSz69aTjpliqikp+V7JVFYf2yma2LjTOCL2saiIF/PcxsqUUa73XTggg610EPY+R
 pOFb2MBRDbZuJrETbaiytLwtcPuvrpiHRHhxuClsjHGVTDbGfE7GzePS+yUu66y9
 LO8oAl7kJebw+WWffIOoL2IjXcG9tA==
 =nn11
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v6.7-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v6.7

More updates for v6,7 following the early merge request:

  - Fixes for handling of component name prefixing when name prefixes
    are used by the machine driver.
  - Fixes for noise when stopping some Sounwire CODECs.
  - Support for AMD ACP 6.3 and 7.0, Awinc AW88399, more Intel
    platforms and more Qualcomm SC7180 platforms.
2023-10-31 09:01:25 +01:00
Mark Brown bdb7e19220
ASoC: Merge up workaround for CODECs that play noise on stopped stream
This was sent too late to actually make it for v6.6 but was sent against
v6.6 so merge it up here.
2023-10-27 22:33:15 +01:00
Srinivas Kandagatla f0220575e6
ASoC: soc-dai: add flag to mute and unmute stream during trigger
In some setups like Speaker amps which are very sensitive, ex: keeping them
unmute without actual data stream for very short duration results in a
static charge and results in pop and clicks. To minimize this, provide a way
to mute and unmute such codecs during trigger callbacks.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20231027105747.32450-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-27 17:44:04 +01:00
Stefan Binding 76c121821a ASoC: cs35l41: Detect CSPL errors when sending CSPL commands
The existing code checks for the correct state transition after sending
a command. However, it is possible for the message box to return -1,
which indicates an error, if an error has occurred in the firmware.
We can detect if the error has occurred, and return a different error.
In addition, there is no recovering from a CSPL error, so the retry
mechanism is not needed in this case, and we can return immediately.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231026150558.2105827-9-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:29 +02:00
Stefan Binding 2ee06ff5d7 ALSA: hda: cs35l41: Force a software reset after hardware reset
To ensure the chip has correctly reset during probe and system suspend,
we need to force a software reset, in case of systems where the
hardware reset is not available.

The software reset register was labelled as volatile but not readable,
however, it is readable, (just returns 0x0). Adding it to readable
registers means it will be correctly treated as volatile, and thus
will not be cached.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231026150558.2105827-6-sbinding@opensource.cirrus.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 17:55:20 +02:00
Takashi Iwai ba238233e4 ALSA: wavefront: Drop obsoleted comments and definitions
The header file contains lots of outdated comments and definitions.
Drop those as cleanup.

Link: https://lore.kernel.org/r/20231025132314.5878-11-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 09:43:24 +02:00
Takashi Iwai 0e646fc3a2 ALSA: wavefront: Replace with __packed attribute
Replace the old __attribute__((packed)) with the new __packed.
Only cleanup, no functional changes.

Link: https://lore.kernel.org/r/20231025132314.5878-10-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 09:43:20 +02:00
Takashi Iwai 9ffbedf07d ALSA: opl3: Replace with __packed attribute
Replace the old __attribute__((packed)) with the new __packed.
Only cleanup, no functional changes.

Link: https://lore.kernel.org/r/20231025132314.5878-9-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-26 09:43:15 +02:00
Uwe Kleine-König 393df6f321
ASoC: simple-card-utils: Make simple_util_remove() return void
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code.  However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

simple_util_remove() returned zero unconditionally. Make it return void
instead and convert all users to struct platform_device::remove_new().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: Herve Codina <herve.codina@bootlin.com>
Link: https://lore.kernel.org/r/20231013221945.1489203-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-23 13:29:45 +01:00
Takashi Iwai 39cd06e3f7 ASoC: Updates for v6.7
This is quite a large set of changes but mostly due to API cleanups and
 in driver specific ways rather than due to anything subsystem wide.
 Highlights include:
 
  - Standardisation of API prefixes on snd_soc_, removing asoc_.
  - GPIO API usage improvements.
  - Support for HDA patches.
  - Lots of work on SOF, including crash dump support.
  - Support for AMD platforms with es83xx, Awinc AT87390, many Intel
    platforms, many Mediatek platforms, Qualcomm SM6115,  Richtek RTQ9128
    and Texas Instruments TAS575x.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmUy6X8ACgkQJNaLcl1U
 h9Cv7Qf+PO4ucl/rFITWAp2Ta9fw7Z5J6UCiXiR54TPgAiLJrpKSi3rbYTXjO90Y
 1NNOdoMKr109zdOpdSZI7EX0GgWQbGbdB40nxESdTcojAloRH0jt4RaF7G7B7+86
 b8PGlVPLLV/4zFf9f2gpEKPcKhRRRKYOBIEB+amfjWpdXVrqPD3zS/S16Q3Hn4Gy
 Fx9b9X/lVDG9uqJomHpunEdViZjkm5CCNzdyAhHH99afiqSe//pevx6/FpzAHyng
 AZgE9Yfq4Xw4pdzDdGVfYC+L1GZiHIDRzsusz6aPA5nrMhSn0ru8PMGtmQQTzyhb
 PLYw0OW8cWymfqwal8wrNGJfSZ8IGA==
 =lN5P
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v6.7' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next

ASoC: Updates for v6.7

This is quite a large set of changes but mostly due to API cleanups and
in driver specific ways rather than due to anything subsystem wide.
Highlights include:

 - Standardisation of API prefixes on snd_soc_, removing asoc_.
 - GPIO API usage improvements.
 - Support for HDA patches.
 - Lots of work on SOF, including crash dump support.
 - Support for AMD platforms with es83xx, Awinc AT87390, many Intel
   platforms, many Mediatek platforms, Qualcomm SM6115,  Richtek RTQ9128
   and Texas Instruments TAS575x.

[ the merge conflicts around SOF Intel HD-audio and CS35L41 subcodec
  drivers are resolved here -- tiwai ]
2023-10-21 09:49:15 +02:00
Maarten Lankhorst e6d0c13e9f ALSA: hda: i915: Remove extra argument from snd_hdac_i915_init
Now that all drivers have moved from modprobe loading to
handling -EPROBE_DEFER, we can remove the argument again.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20231009115437.99976-14-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:56:25 +02:00
Maarten Lankhorst 32f4e921fe ALSA: hda: i915: Add an allow_modprobe argument to snd_hdac_i915_init
Xe is a new GPU driver that re-uses the display (and sound) code from
i915. It's no longer possible to load i915, as the GPU can be driven
by the xe driver instead.

The new behavior will return -EPROBE_DEFER, and wait for a compatible
driver to be loaded instead of modprobing i915.

Converting all drivers at the same time is a lot of work, instead we
will convert each user one by one.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@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://lore.kernel.org/r/20231009115437.99976-8-maarten.lankhorst@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:55:27 +02:00
Takashi Iwai 87543ce503 Merge branch 'for-linus' into for-next
For applying HD-audio EPROBE_DEFER series cleanly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-19 14:51:12 +02:00
Mark Brown 3c716e7f8a
ASoC: Merge fixes for consistent cs42l43 schema
We have adjacent changes for the cs42l43 DT schema, merge the fixes
branch up so that there's a single thing for people to base future
changes on.
2023-10-10 17:07:17 +01:00
Krzysztof Kozlowski 76aca10ccb
ASoC: soc-dapm: Add helper for comparing widget name
Some drivers use one event callback for multiple widgets but still need
to perform a bit different actions based on actual widget.  This is done
by comparing widget name, however drivers tend to miss possible name
prefix.  Add a helper to solve common mistakes.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20231003155710.821315-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-09 13:03:28 +01:00
Cezary Rojewski 5eb4ff884f ALSA: hda: Add code_loading parameter to stream setup
AudioDSP firmware is the one who kicks SDxFIFOS calculation when a
stream is decoupled mode. During firmware bring up procedure, there is
no firmware running and the code-loading stream is always a decoupled
one. So, there is none to trigger the calculation and we end up with
false-positive timeout (-110) messages.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20231006102857.749143-4-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 14:30:39 +02:00
Simon Trimmer 3df761bdbc
ASoC: cs35l56: Wake transactions need to be issued twice
As the dummy wake is a toggling signal (either I2C or SPI activity) it
is not guaranteed to meet the minimum asserted hold time for a wake
signal. In this case the wake must guarantee rising edges separated by
at least the minimum hold time.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231006111039.101914-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-06 12:30:27 +01:00
Cezary Rojewski 88320b74ef ALSA: hda: Introduce HOST stream setup mechanism
HDAudio stream setup procedure differs between revisions of the
controller device. Currently the differences are handled directly within
AudioDSP platform drivers with if-statements. Implement a more generic
approach and expose a function that a platform driver may use to ensure
the correct procedure is followed each time.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20230926080623.43927-3-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 11:11:39 +02:00
Cezary Rojewski 2ee2c75c58 ALSA: hda: Poll SDxFIFOS after programming SDxFMT
Software shall read SDxFIFOS calculated by the hardware and notify if
invalid value is programmed before continuing the stream preparation.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20230926080623.43927-2-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-10-06 11:11:39 +02:00
Kees Cook 80e698e2df
ASoC: soc-dapm: Annotate struct snd_soc_dapm_widget_list with __counted_by
Prepare for the coming implementation by GCC and Clang of the __counted_by
attribute. Flexible array members annotated with __counted_by can have
their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for
array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
functions).

As found with Coccinelle[1], add __counted_by for struct snd_soc_dapm_widget_list.
Additionally, since the element count member must be set before accessing
the annotated flexible array member, move its initialization earlier.

Cc: Liam Girdwood <lgirdwood@gmail.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: linux-hardening@vger.kernel.org
Link: https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci [1]
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: "Gustavo A. R. Silva" <gustavoars@kernel.org>
Link: https://lore.kernel.org/r/20231003232852.work.257-kees@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-04 12:56:21 +01:00
Simon Trimmer d4e1417bb9
ASoC: cs35l56: Remove unused hibernate wake constants
The two CS35L56_HIBERNATE_WAKE_* constants in cs35l56.h aren't used by
any of the driver code.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20231003093418.21600-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-03 14:51:19 +01:00
Shenghao Ding 4c556d1ea5
ASoC: tas2781: fixed compiling issue in m68k
fixed m68k compiling issue: mapping table can save code field; storing the
dev_idx as a member of block can reduce unnecessary  time and system
resource comsumption of dev_idx mapping every time the block data writing
to the dsp.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://lore.kernel.org/r/20231002090434.1896-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-10-02 14:06:27 +01:00
Amadeusz Sławiński dd9f9cc1e6
ASoC: core: Do not call link_exit() on uninitialized rtd objects
On init we have sequence:

	for_each_card_prelinks(card, i, dai_link) {
		ret = snd_soc_add_pcm_runtime(card, dai_link);

	ret = init_some_other_things(...);
	if (ret)
		goto probe_end:

	for_each_card_rtds(card, rtd) {
		ret = soc_init_pcm_runtime(card, rtd);

probe_end:

while on exit:
	for_each_card_rtds(card, rtd)
		snd_soc_link_exit(rtd);

If init_some_other_things() step fails due to error we end up with
not fully setup rtds and try to call snd_soc_link_exit on them, which
depending on contents on .link_exit handler, can end up dereferencing
NULL pointer.

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/20230929103243.705433-2-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-29 14:17:49 +02:00
Kuninori Morimoto ad484cc98f
ASoC: remove asoc_xxx() compatible macro
No driver is using asoc_xxx() any more.
This patch removes compatible macro for asoc_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878r8tfo06.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-26 17:18:45 +02:00
Kuninori Morimoto b5a95c5bf6
ASoC: simple_card_utils.h: convert not to use asoc_xxx()
ASoC is using 2 type of prefix (asoc_xxx() vs snd_soc_xxx()),
but these are unified into snd_soc_xxx().

simple_card / audio_graph drivers are historically using
asoc_xxx() prefix too. simple_card / audio_graph are not
ASoC framework, so let's use simple_card_xxx_() / audio_graph_xxx()
for global function prefix.

This patch has asoc_xxx() as define to keep compatible.
It will be removed if all drivers were switched to new style.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87edj4s26a.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25 14:16:14 +02:00
Kuninori Morimoto 1d5a2b5dd0
ASoC: soc.h: convert asoc_xxx() to snd_soc_xxx()
ASoC is using 2 type of prefix (asoc_xxx() vs snd_soc_xxx()), but there
is no particular reason about that [1].
To reduce confusing, standarding these to snd_soc_xxx() is sensible.

This patch adds asoc_xxx() macro to keep compatible for a while.
It will be removed if all drivers were switched to new style.

Link: https://lore.kernel.org/r/87h6td3hus.wl-kuninori.morimoto.gx@renesas.com [1]
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fs3ks26i.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-25 14:16:13 +02:00
Mark Brown 03db12ef1c
ASoC: SOF: ipc4/Intel: Support for firmware exception
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:

When a firmware crashes it creats a panic information into a telemetry
slot.  The panic format is defined by Zephyr, includes stack and
additional information to help to identify the reason for the crash.
Part of the firmware exception handling the firmware also sends an
EXCEPTION_CAUGHT notification.

This series implements the kernel side handling of the exception: print
information into the kernel log export the whole telemetry slot to user
space for tools extract additional information from the panic dump.
2023-09-19 18:22:11 +01:00
Peter Ujfalusi 7b5300e90a
ASoC: SOF: Drop unused IPC type defines
The SOF stack now uses the generic names for the IPC type, the defines can
be dropped.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230919104226.32239-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-19 13:49:13 +01:00
Peter Ujfalusi 6974f2cd2f
ASoC: SOF: Introduce generic names for IPC types
Change the enum names for the IPC types to be more descriptive and drop
tying the IPC4 to Intel SoCs.

Add defines to avoid build breakage while the related code is
modified to use the new enum names.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230919104226.32239-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-19 13:49:05 +01:00
Rander Wang 4287205065
ASoC: SOF: ipc4-mtrace: move debug slot related definitions to header.h
The macro definitions of debug slot can be used by gdb, telemetry
and mtrace log, so move these definitions to header.h from mtrace.
Then these macro definitions can be shared

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230919092416.4137-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-19 13:48:45 +01:00
Arun T 24af0d7c0f
ASoC: Intel: common: add ACPI matching tables for Arrow Lake
Initial support for ARL w/ RT711

Signed-off-by: Arun T <arun.t@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230915080635.1619942-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-16 00:05:56 +01:00
Peter Ujfalusi 4f0f3c7749
ASoC: SOF: ipc4: Add new message type: SOF_IPC4_GLB_LOAD_LIBRARY_PREPARE
On Intel platforms there is a strict order requirement for the DMA
programming:
DSP side configures the buffer and sets the GEN bit
Host side sets the RUN bit.

In order to follow this flow, a new global message type has been added to
prepare the DSP side of the DMA:

host sends LOAD_LIBRARY_PREPARE with the dma_id
DSP side sets its buffer and sets the GEN bit
Host sets the RUN bit
Host sends LOAD_LIBRARY with dma_id and lib_id
DSP receives the library data.

It is up to the platform code to use the new prepare stage message and how
to handle the reply to it from the firmware, which can indicate that the
message type is not supported/handled.
In this case the kernel should proceed to the LOAD_LIBRARY stage assuming
a single stage library loading:

host sends LOAD_LIBRARY_PREPARE with the dma_id
DSP replies that the message type is not supported/handled
Host acknowledges the return code and sets the RUN bit
Host sends LOAD_LIBRARY with dma_id and lib_id
DSP receives the library data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Chao Song <chao.song@linux.intel.com>
Link: https://lore.kernel.org/r/20230915114018.1701-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-15 13:15:33 +01:00
Richard Fitzgerald ba2de401d3
ASoC: SOF: Pass PCI SSID to machine driver
Pass the PCI SSID of the audio interface through to the machine driver.
This allows the machine driver to use the SSID to uniquely identify the
specific hardware configuration and apply any platform-specific
configuration.

struct snd_sof_pdata is passed around inside the SOF code, but it then
passes configuration information to the machine driver through
struct snd_soc_acpi_mach and struct snd_soc_acpi_mach_params. So SSID
information has been added to both snd_sof_pdata and
snd_soc_acpi_mach_params.

PCI does not define 0x0000 as an invalid value so we can't use zero to
indicate that the struct member was not written. Instead a flag is
included to indicate that a value has been written to the
subsystem_vendor and subsystem_device members.

sof_pci_probe() creates the struct snd_sof_pdata. It is passed a struct
pci_dev so it can fill in the SSID value.

sof_machine_check() finds the appropriate struct snd_soc_acpi_mach. It
copies the SSID information across to the struct snd_soc_acpi_mach_params.
This done before calling any custom set_mach_params() so that it could be
used by the set_mach_params() callback to apply variant params.

The machine driver receives the struct snd_soc_acpi_mach as its
platform_data.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230912163207.3498161-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-12 18:53:48 +01:00
Richard Fitzgerald 47f56e38a1
ASoC: soc-card: Add storage for PCI SSID
Add members to struct snd_soc_card to store the PCI subsystem ID (SSID)
of the soundcard.

The PCI specification provides two registers to store a vendor-specific
SSID that can be read by drivers to uniquely identify a particular
"soundcard". This is defined in the PCI specification to distinguish
products that use the same silicon (and therefore have the same silicon
ID) so that product-specific differences can be applied.

PCI only defines 0xFFFF as an invalid value. 0x0000 is not defined as
invalid. So the usual pattern of zero-filling the struct and then
assuming a zero value unset will not work. A flag is included to
indicate when the SSID information has been filled in.

Unlike DMI information, which has a free-format entirely up to the vendor,
the PCI SSID has a strictly defined format and a registry of vendor IDs.

It is usual in Windows drivers that the SSID is used as the sole identifier
of the specific end-product and the Windows driver contains tables mapping
that to information about the hardware setup, rather than using ACPI
properties.

This SSID is important information for ASoC components that need to apply
hardware-specific configuration on PCI-based systems.

As the SSID is a generic part of the PCI specification and is treated as
identifying the "soundcard", it is reasonable to include this information
in struct snd_soc_card, instead of components inventing their own custom
ways to pass this information around.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230912163207.3498161-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-12 18:53:47 +01:00
Mark Brown 966277df0a
ASoC: Convert some Maxim codecs to use GPIO
Merge series from Linus Walleij <linus.walleij@linaro.org>:

The Maxim devices are pretty straight-forward to convert
over to use GPIO descriptors, so let's do it.
2023-09-11 22:38:44 +01:00
Mark Brown 09d86dbf16
Improve CS35l41-based audio codec drivers
Merge series from Cristian Ciocaltea <cristian.ciocaltea@collabora.com>:

This patch series contains several fixes and improvements to drivers
based on the CS35l41 audio codec.

It has been verified on Valve's Steam Deck, except the HDA related patches.
2023-09-11 22:38:11 +01:00
Cristian Ciocaltea 77bf613f0b
ASoC: cs35l41: Fix broken shared boost activation
Enabling the active/passive shared boosts requires setting SYNC_EN, but
*not* before receiving the PLL Lock signal.

Due to improper error handling, it was not obvious that waiting for the
completion operation times out and, consequently, the shared boost is
never activated.

Further investigations revealed the signal is triggered while
snd_pcm_start() is executed, right after receiving the
SNDRV_PCM_TRIGGER_START command, which happens long after the
SND_SOC_DAPM_PRE_PMU event handler is invoked as part of
snd_pcm_prepare().  That is where cs35l41_global_enable() is called
from.

Increasing the wait duration doesn't help, as it only causes an
unnecessary delay in the invocation of snd_pcm_start().  Moving the wait
and the subsequent regmap operations to the SNDRV_PCM_TRIGGER_START
callback is not a solution either, since they would be executed in an
IRQ-off atomic context.

Solve the issue by setting the SYNC_EN bit in PWR_CTRL3 register right
after receiving the PLL Lock interrupt.

Additionally, drop the unnecessary writes to PWR_CTRL1 register, part of
the original mdsync_up_seq, which would have toggled GLOBAL_EN with
unwanted consequences on PLL locking behavior.

Fixes: f503056493 ("ALSA: cs35l41: Add shared boost feature")
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
Reviewed-by: David Rhodes <david.rhodes@cirrus.com>
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20230907171010.1447274-5-cristian.ciocaltea@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11 13:34:36 +01:00
Linus Walleij 637a7969ef
ASoC: max9768: Convert to use GPIO descriptors
The MAX9768 is pretty straight forward to convert to GPIO
descriptors.

To name the GPIO properties, I looke at the bindings in
maxim,max9759.yaml which names these GPIO "mute" and
"shutdown" respectively.

No board files using platform data exist in the kernel, new
users can use GPIO descriptor tables if desired.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230911-descriptors-asoc-max-v2-1-b9d793fb768e@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11 12:50:05 +01:00
Andy Shevchenko 428cc4106a
ASoC: soc.h: replace custom COUNT_ARGS() & CONCATENATE() implementations
Replace custom implementation of the macros from args.h.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20230904111524.1740930-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-09-11 01:29:59 +01:00
Takashi Iwai ef98a48832 ASoC: Name iov_iter argument as iterator instead of buffer
While transitioning ASoC code for iov_iter usages, I kept the argument
name as "buf" as the original code.  But, iov_iter is an iterator, and
using the name "buf" may be misleading: the crucial difference is that
iov_iter can be proceeded after the operation, hence it can't be
passed twice, while a simple "buffer" sounds as if reusable.

To make the usage clearer, rename the argument from "buf" to "iter".
There is no functional changes, just names.

Fixes: 66201cacc3 ("ASoC: component: Add generic PCM copy ops")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/CAHk-=wje+VkXjjfVTmK-uJdG_M5=ar14QxAwK+XDiq07k_pzBg@mail.gmail.com
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230831130457.8180-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-01 15:38:49 +02:00
Takashi Iwai 69d0fd348d ASoC: dmaengine: Drop unused iov_iter for process callback
Passing the iov_iter to the process callback is rather buggy, as the
iterator has been already processed for playback.  Similarly, it makes
the copy for capture buggy after the process callback reading the
iterator out.  Moreover, all existing process callbacks don't refer to
the passed iterator at all.  So, it's better to drop the argument from
the process callback.

Fixes: 9bebd65443 ("ASoC: dmaengine: Use iov_iter for process callback, too")
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/CAHk-=wje+VkXjjfVTmK-uJdG_M5=ar14QxAwK+XDiq07k_pzBg@mail.gmail.com
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230831130457.8180-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-09-01 15:38:29 +02:00
Takashi Iwai 692f551015 ASoC: Updates for v6.6
The rest of the updates for v6.6, some of the highlights include:
 
  - A big API cleanup from Morimoto-san, rationalising the places we put
    functions.
  - Lots of work on the SOF framework, AMD and Intel drivers, including a
    lot of cleanup and new device support.
  - Standardisation of the presentation of jacks from drivers.
  - Provision of some generic sound card DT properties.
  - Conversion oof more drivers to the maple tree register cache.
  - New drivers for AMD Van Gogh, AWInic AW88261, Cirrus Logic cs42l43,
    various Intel platforms, Mediatek MT7986, RealTek RT1017 and StarFive
    JH7110.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmTo6Y0ACgkQJNaLcl1U
 h9AnaAf/XiBSnZl2i9wFckPy7bLcR74YrP1sFet5ZAqtpIt+/DvzQlgFAraHJ4tR
 ScM2ZyyMwREaFhrHIXKLm8kbaOKeIjIMSxiHREVG9Wibq8d1TwaOHWAcXc9jMsQb
 3G23Aizy2h5yD+/VTh8q6aV+fmYZJDfr1tIu8zWva90HcL2fMGvLjVdt24RNejTL
 bgCC2GaaGP4pnC3xoBo1hGayvp0PES1BHVeyAXqMVscH+GCplPNJEdSHvU14OBck
 1Nfjf5NVkh5G0pvrbG/yblsn1Zm5HRAzCE7gF1OHLFH27ygvp7fGk6TIXXpvw23c
 OSvveYee2YLrf4kyndmv88Aq8JVTeA==
 =9F/T
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v6.6' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Updates for v6.6

The rest of the updates for v6.6, some of the highlights include:

 - A big API cleanup from Morimoto-san, rationalising the places we put
   functions.
 - Lots of work on the SOF framework, AMD and Intel drivers, including a
   lot of cleanup and new device support.
 - Standardisation of the presentation of jacks from drivers.
 - Provision of some generic sound card DT properties.
 - Conversion oof more drivers to the maple tree register cache.
 - New drivers for AMD Van Gogh, AWInic AW88261, Cirrus Logic cs42l43,
   various Intel platforms, Mediatek MT7986, RealTek RT1017 and StarFive
   JH7110.
2023-08-28 16:13:03 +02:00
Takashi Iwai b2bcbd031d ALSA: ump: Don't create unused substreams for static blocks
When the UMP Endpoint is declared as "static", that is, no dynamic
reassignment of UMP Groups, it makes little sense to expose always all
16 groups with 16 substreams.  Many of those substreams are disabled
groups, hence they are useless, but applications don't know it and try
to open / access all those substreams unnecessarily.

This patch limits the number of UMP legacy rawmidi substreams only to
the active groups.  The behavior is changed only for the static
endpoint (i.e. devices without UMP v1.1 feature implemented or with
the static block flag is set).

Fixes: 0b5288f5fe ("ALSA: ump: Add legacy raw MIDI support")
Link: https://lore.kernel.org/r/20230824075108.29958-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-08-24 10:03:17 +02:00
Mark Brown 1a512d1383
Add I2S support for the StarFive JH7110 SoC
Merge series from Xingyu Wu <xingyu.wu@starfivetech.com>:

This patch series adds I2S support for the StarFive JH7110 RISC-V
SoC based on Designware I2S controller. There has three I2S channels
(RX/TX0/TX1) on the JH7110 SoC, one of which is for record(RX) and
two for playback(TX).

The first patch adds support for the StarFive JH7110 SoC in the
Designware I2S bindings.
The second patch adds the ops to get data from platform bus in the
I2S driver.
The third patch adds support for the StarFive JH7110 SoC in
the Designware I2S driver.
The fourth patch fixes the name of I2STX1 pinmux.
The last patch adds device node of I2S RX/TX0/TX1 in JH7110 dts.

This patch series is based on Linux-next(20230818) which is merge
clock, syscon and dma nodes for the StarFive JH7110 SoC.

The series has been tested and works normally on the VisionFive 2
board by plugging an audio expansion board.
2023-08-23 19:54:51 +01:00
Xingyu Wu 52ea7c0543
ASoC: dwc: i2s: Add StarFive JH7110 SoC support
Add StarFive JH7110(TX0/TX1/RX channels) SoC support in the
designware I2S driver and a flag to check if it is on the JH7110 SoC.

These channels need to enable clocks, resets and syscon register on the
JH7110 SoC. So add init ops in platform data for the JH7110 SoC to do this.

Their resets should be deassert before changing the parent of clocks so
these are done in the init ops of platform data.

The I2S controllers use DMA controller by platform data on the JH7110
and their settings about snd_dmaengine_dai_dma_data() should be added
in the dw_configure_dai_by_pd(). And use dmaengine PCM registration if
these do not have IRQ on the JH7110 SoC.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
Link: https://lore.kernel.org/r/20230821144151.207339-4-xingyu.wu@starfivetech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-23 13:56:40 +01:00
Linus Walleij 6dd11b9459
ASoC: Delete UDA134x/L3 audio codec
This codec was used by the deleted S3C board
sound/soc/samsung/s3c24xx_uda134x.c.

Fixes: 503278c127 ("ASoC: samsung: remove unused drivers")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20230822-delete-l3-v2-1-b3ffc07348af@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2023-08-23 13:27:20 +01:00