platform/kernel/linux-rpi.git
15 months agoASoC: lower "no backend DAIs enabled for ... Port" log severity
Hans de Goede [Sat, 5 Aug 2023 17:14:35 +0000 (19:14 +0200)]
ASoC: lower "no backend DAIs enabled for ... Port" log severity

If SNDRV_PCM_IOCTL_PREPARE is called when the mixer settings linking
frontend and backend have not been setup yet this results in
e.g. the following errors getting logged:

[   43.244549]  Baytrail Audio Port: ASoC: no backend DAIs enabled for Baytrail Audio Port
[   43.244744]  Baytrail Audio Port: ASoC: error at dpcm_fe_dai_prepare on Baytrail Audio Port: -22

pipewire triggers this leading to 96 lines getting logged
after the user has logged into a GNOME session.

Change the actual "no backend DAIs enabled for ... Port" error to
dev_err_once() to avoid it getting repeated 48 times. While at it
also improve the error by hinting the user how to fix this.

To not make developing new UCM profiles harder, also log the error
at dev_dbg() level all the time (vs once). So that e.g. dyndbg can
be used to (re)enable the messages.

Also changes _soc_pcm_ret() to not log for -EINVAL errors, to fix
the other error getting logged 48 times. Userspace passing wrong
parameters should not lead to dmesg messages.

Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3407
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230805171435.31696-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Map missing jack kcontrols
Mark Brown [Mon, 7 Aug 2023 18:51:47 +0000 (19:51 +0100)]
ASoC: Map missing jack kcontrols

Merge series from Alper Nebi Yasak <alpernebiyasak@gmail.com>:

This patchset adds missing jack kcontrols for each independently
detectable audio peripheral and maps jack pins to those kcontrols
accordingly, with the primary intent to enable/improve jack detection
handling in PulseAudio and PipeWire through JackControl UCM values.

Usually it's just splitting a joint anything-is-connected "Headset Jack"
kcontrol (from [1]) into those like "Headphone Jack" and "Headset Mic"
(similar to a previous series for Intel Chromebooks [2]). This split is
important to avoid automatically switching to a nonexistent external
microphone when a headphone-only device is connected.

When the underlying hardware seems to support it, this also adds a "Line
Out" kcontrol. This is important in case the hardware can actually
support a line-level connection via a different configuration (bypassing
output amplifiers?), or simply for userspace to display "Line Out"
instead of "Headphones" to the user for connected line-out devices.

Beyond the mappings, I had to add PIN_SWITCH card kcontrols and DAPM
widgets to avoid "unknown pin" errors on my devices, so tried to do them
for all. For Intel devices I saw a pattern of routing things to
"Platform Clock" and added to that as well. Looking at patch 5/7 of a
Mediatek-related series [3], I can only guess that routes could be
further improved, but don't know exactly how for each device. And one
more concern is I don't know if the names conflict with any controls
from codecs, although I tried to keep to names of existing widgets.

As far as I can tell, the root cause for most of why these are missing
originates to things being developed for ChromeOS, whose userspace reads
the jack input device and doesn't care for these kcontrols. There's
non-ChromeOS cases as well, maybe things got copy-pasted around and
people didn't need or couldn't figure out how to get more specific than
a single jack kcontrol. The secondary intent in this patchset is to fix
this *everywhere*, so future copy-pastes result in the right behaviour.

For more context also see:

[1] ASoC: soc-card: Create jack kcontrol without pins
https://lore.kernel.org/alsa-devel/20220408041114.6024-1-akihiko.odaki@gmail.com/

[2] ASoC: Intel: Chromebooks: remap jack pins
https://lore.kernel.org/alsa-devel/20220616214055.134943-1-pierre-louis.bossart@linux.intel.com/

[3] ASoC: mediatek: Allow separate handling of headphone and headset mic jack
https://lore.kernel.org/alsa-devel/20220922235951.252532-1-nfraprado@collabora.com/

[4] ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols for jack detection
https://lore.kernel.org/alsa-devel/20200721182709.6895-1-alpernebiyasak@gmail.com/

This applies onto next-20230802. Unfortunately most of it is untested
except for a few Chromebooks I have (Kevin, Lick, Hana, Cozmo), because
I'm intentionally generalizing to everything.

15 months agoASoC: codecs: Add awinic AW88261 audio amplifier
Mark Brown [Mon, 7 Aug 2023 18:51:39 +0000 (19:51 +0100)]
ASoC: codecs: Add awinic AW88261 audio amplifier

Merge series from wangweidong.a@awinic.com:

The awinic AW88261 is an I2S/TDM input, high efficiency digital Smart K
audio amplifier.

15 months agoASoC: SoundWire codecs: improve pm_runtime handling
Mark Brown [Mon, 7 Aug 2023 18:51:32 +0000 (19:51 +0100)]
ASoC: SoundWire codecs: improve pm_runtime handling

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

This patchset improves the pm_runtime behavior in rare corner cases
identified by the Intel CI in the last 6 months.

a) in stress-tests, it's not uncommon to see the following type of
warnings when the codec reports as ATTACHED

    "rt711 sdw:0:025d:0711:00: runtime PM trying to activate child device
    sdw:0:025d:0711:00 but parent (sdw-master-0) is not active"

This warning was not correlated with any functional issue, but it
exposed a design issue on when to enable pm_runtime. The recommended
practice in the pm_runtime documentation is to keep the devices in
'suspended' mode and mark them as 'active' when they are really
functional.

b) enabling pm_runtime when the codec reports as ATTACHED also creates
a problematic case when the ASoC pm_runtime_get_sync() will silently
fail due to the -EACCESS error handling. This can happen when playback
starts before the codec is enumerated.

This patchset modifies the initial stages so that codecs are
pm_runtime enabled in the .probe() callback, but become pm_runtime
'active' only when they report present. This is better aligned with
the design of the pm_runtime helpers and improved CI results
significantly.

This patchset modifies all existing SoundWire codecs (except Qualcomm
ones), but the pattern of changes is exactly the same in all patches.

15 months agoASoC: codecs: Add aw88261 amplifier driver
Weidong Wang [Fri, 4 Aug 2023 11:47:49 +0000 (19:47 +0800)]
ASoC: codecs: Add aw88261 amplifier driver

Add i2c and amplifier registration for
aw88261 and their associated operation functions.

Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://lore.kernel.org/r/20230804114749.215460-4-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: codecs: Add code for bin parsing compatible with aw88261
Weidong Wang [Fri, 4 Aug 2023 11:47:48 +0000 (19:47 +0800)]
ASoC: codecs: Add code for bin parsing compatible with aw88261

Add aw88261 compatible code to the aw88395_lib.c file
so that it can parse aw88261's bin file.

Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Link: https://lore.kernel.org/r/20230804114749.215460-3-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: Add schema for "awinic,aw88261"
Weidong Wang [Fri, 4 Aug 2023 11:47:47 +0000 (19:47 +0800)]
ASoC: dt-bindings: Add schema for "awinic,aw88261"

Add the awinic,aw88261 property to the awinic,aw88395.yaml file.

Signed-off-by: Weidong Wang <wangweidong.a@awinic.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230804114749.215460-2-wangweidong.a@awinic.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: jz4740: Update to use maple tree register cache
Mark Brown [Wed, 12 Jul 2023 11:14:21 +0000 (12:14 +0100)]
ASoC: jz4740: Update to use maple tree register cache

The maple tree register cache is based on a much more modern data structure
than the rbtree cache and makes optimisation choices which are probably
more appropriate for modern systems than those made by the rbtree cache. In
v6.5 it has also acquired the ability to generate multi-register writes in
sync operations, bringing performance up to parity with the rbtree cache
there.

Update the jz4740 driver to use the more modern data structure.

Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230712-asoc-jz-maple-v1-1-3f745adf96e5@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: codecs: max9892x: Reformat to coding style
Krzysztof Kozlowski [Sun, 30 Jul 2023 20:18:26 +0000 (22:18 +0200)]
ASoC: codecs: max9892x: Reformat to coding style

Reformat the code to match Linuxn coding style: re-indent continued
lines and stop too-early line wrapping, drop unneeded {} brackets.  No
functional impact.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230730201826.70453-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: codecs: max9892x: Unify interleave mode OF property
Krzysztof Kozlowski [Sun, 30 Jul 2023 20:18:25 +0000 (22:18 +0200)]
ASoC: codecs: max9892x: Unify interleave mode OF property

MAX98926 and MAX98927 are quite similar and use the same bindings,
although drivers were not implementing them in the same way:
MAX98926 has boolean "interleave-mode" but MAX98927 has uint32
"interleave_mode".  Unify them under maxim,interleave-mode, already used
in other Maxim device.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230730201826.70453-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: Convert maxim,max98925 to DT schema
Krzysztof Kozlowski [Sun, 30 Jul 2023 20:18:24 +0000 (22:18 +0200)]
ASoC: dt-bindings: Convert maxim,max98925 to DT schema

Convert the Maxim Integrated MAX98925/MAX98926/MAX98927 speaker
amplifier bindings to DT schema format.  Changes during conversion:
1. Add "sound-dai-cells", already used by DTS.
2. Use "maxim,interleave-mode" instead previous "interleave-mode" and
   undocumented but used interleave_mode.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20230730201826.70453-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: samsung: midas_wm1811: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:37 +0000 (20:57 +0300)]
ASoC: samsung: midas_wm1811: Map missing jack kcontrols

This driver does not map jack pins to kcontrols that PulseAudio/PipeWire
need to handle jack detection events. The WM1811 codec used here seems
to support detecting Headphone and Headset Mic connections. Expose each
to userspace as a kcontrol and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-28-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: samsung: lowland: Split Line Out jack kcontrol from Headphone
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:36 +0000 (20:57 +0300)]
ASoC: samsung: lowland: Split Line Out jack kcontrol from Headphone

This driver has correctly mapped jack kcontrols for Headphone and
Headset Mic. However, it is also mapping Line Out jack detection events
to the Headphone kcontrol.

The WM5100 codec used here can distinguish Line Out connections from
Headphone connections. Decouple the two, expose Line Out to userspace as
an independent kcontrol and add the necessary widget.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-27-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: samsung: littlemill: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:35 +0000 (20:57 +0300)]
ASoC: samsung: littlemill: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The WM8958 codec used
here can detect Headphone and Headset Mic connections. Expose each to
userspace as a kcontrol and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-26-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rockchip: rockchip_rt5645: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:34 +0000 (20:57 +0300)]
ASoC: rockchip: rockchip_rt5645: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here supports detecting Headphone and Headset Mic connections. Expose
both to userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-25-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rk3399-gru-sound: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:33 +0000 (20:57 +0300)]
ASoC: rk3399-gru-sound: Map missing Line Out jack kcontrol

Commit d0508b4f1604 ("ASoC: rk3399_gru_sound: Add DAPM pins, kcontrols
for jack detection") maps kcontrols for Headphones and Headset Mic jacks
for this driver so that PulseAudio and PipeWire can handle insertion
events for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widget.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-24-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: qcom: sdm845: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:32 +0000 (20:57 +0300)]
ASoC: qcom: sdm845: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5663 codec used
here can detect Headphone and Headset Mic connections. Expose each to
userspace as a kcontrol.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-23-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: qcom: sc7280: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:31 +0000 (20:57 +0300)]
ASoC: qcom: sc7280: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5682 and
RT5682s codecs used here can detect Headphone and Headset Mic
connections. Expose each to userspace as a kcontrol.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-22-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: qcom: sc7180: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:30 +0000 (20:57 +0300)]
ASoC: qcom: sc7180: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5682 and
RT5682s codecs used here can detect Headphone and Headset Mic
connections. Expose each to userspace as a kcontrol.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-21-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: qcom: apq8016_sbc: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:29 +0000 (20:57 +0300)]
ASoC: qcom: apq8016_sbc: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. It seems to support
detecting Headphone and Headset Mic connections. Expose each to
userspace as a kcontrol and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-20-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8186-mt6366-da7219-max98357: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:28 +0000 (20:57 +0300)]
ASoC: mediatek: mt8186-mt6366-da7219-max98357: Map missing jack kcontrols

Commit 8e9867486806 ("ASoC: mediatek: mt8186-da7219: Expose individual
headset jack pins") maps kcontrols for Headphone and Headset Mic jacks
for this driver so that PulseAudio and PipeWire can handle jack
detection events for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-19-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8183-mt6358-ts3a227-max98357: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:27 +0000 (20:57 +0300)]
ASoC: mediatek: mt8183-mt6358-ts3a227-max98357: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The TS3A227 component
used here can detect Headphones and Headset Mic connections. Expose each
to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-18-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8183-da7219-max98357: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:26 +0000 (20:57 +0300)]
ASoC: mediatek: mt8183-da7219-max98357: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The DA7219 codec used
here can detect Headphones, Headset Mic and Line Out connections. Expose
each to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-17-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8173-rt5650: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:25 +0000 (20:57 +0300)]
ASoC: mediatek: mt8173-rt5650: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here can detect Headphone and Headset Mic connections. Expose both to
userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-16-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8173-rt5650-rt5676: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:24 +0000 (20:57 +0300)]
ASoC: mediatek: mt8173-rt5650-rt5676: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here can detect Headphone and Headset Mic connections. Expose both to
userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-15-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8173-rt5650-rt5514: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:23 +0000 (20:57 +0300)]
ASoC: mediatek: mt8173-rt5650-rt5514: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here can detect Headphone and Headset Mic connections. Expose each to
userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-14-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8173-max98090: Configure jack as a Headset jack
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:22 +0000 (20:57 +0300)]
ASoC: mediatek: mt8173-max98090: Configure jack as a Headset jack

This driver has correctly mapped jack kcontrols for Headphone and
Headset Mic. However, it is configuring the jack to only care about
Headphone events. The MAX98090 codec used here can detect both
connections, so configure the jack as such.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-13-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: imx-es8328: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:21 +0000 (20:57 +0300)]
ASoC: imx-es8328: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. It seems to have a
single detection GPIO pin used to report everything as a Headset. But it
has widgets for Headphone and Mic Jack, so expose both to userspace as
kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-12-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_da7219_max98373: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:20 +0000 (20:57 +0300)]
ASoC: Intel: sof_da7219_max98373: Map missing Line Out jack kcontrol

Commit 2913bb1f6830 ("ASoC: Intel: sof_da7219_max98373: remap jack
pins") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle jack detection events
for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-11-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: kbl_da7219_max98927: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:19 +0000 (20:57 +0300)]
ASoC: Intel: kbl_da7219_max98927: Map missing Line Out jack kcontrol

Commit b9f53b9fc14e ("ASoC: Intel: kbl_da7219_max98927: remap jack
pins") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle jack detection events
for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-10-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: kbl_da7219_max98357a: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:18 +0000 (20:57 +0300)]
ASoC: Intel: kbl_da7219_max98357a: Map missing Line Out jack kcontrol

Commit c2065d43ae85 ("ASoC: Intel: kbl_da7219_max98357a: remap jack
pins") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle jack detection events
for these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-9-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: bytcr_wm5102: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:17 +0000 (20:57 +0300)]
ASoC: Intel: bytcr_wm5102: Map missing Line Out jack kcontrol

Commit ecd77d494ec9 ("ASoC: Intel: bytcr_wm5102: Add jack detect
support") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle jack detection events
for these peripherals.

The WM5102 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-8-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: bxt_da7219_max98357a: Map missing Line Out jack kcontrol
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:16 +0000 (20:57 +0300)]
ASoC: Intel: bxt_da7219_max98357a: Map missing Line Out jack kcontrol

Commit bbdd4ea2190b4 ("ASoC: Intel: bxt_da7219_max98357a: remap jack
pins") maps kcontrols for Headphone and Headset Mic jacks for this
driver so that PulseAudio and PipeWire can handle detection events for
these peripherals.

The DA7219 codec used here can also distinguish between Headphone and
Line Out connections that go into the same physical port. Expose the
latter to userspace as a kcontrol as well and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-7-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: avs: da7219: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:15 +0000 (20:57 +0300)]
ASoC: Intel: avs: da7219: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The DA7219 codec used
here can detect Headphones, Headset Mic and Line Out connections. Expose
each to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-6-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: amd: acp3x-rt5682-max9836: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:14 +0000 (20:57 +0300)]
ASoC: amd: acp3x-rt5682-max9836: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5682, RT1015
and RT1015p codecs used here can detect Headphone and Headset Mic
connections. Expose the former two to userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-5-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: amd: acp: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:13 +0000 (20:57 +0300)]
ASoC: amd: acp: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5682, RT5682s,
NAU8825 and NAU8821 codecs used here can detect Headphone and Headset
Mic connections. Expose both to userspace as kcontrols and add the
necessary widgets. Split the jack and pin structs per-codec to
accommodate for per-codec differences.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-4-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: amd: acp-rt5645: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:12 +0000 (20:57 +0300)]
ASoC: amd: acp-rt5645: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The RT5645 codec used
here can detect Headphone and Headset Mic connections. Expose both to
userspace as kcontrols.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-3-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: amd: acp-da7219-max98357a: Map missing jack kcontrols
Alper Nebi Yasak [Wed, 2 Aug 2023 17:57:11 +0000 (20:57 +0300)]
ASoC: amd: acp-da7219-max98357a: Map missing jack kcontrols

This driver does not properly map jack pins to kcontrols that PulseAudio
and PipeWire need to handle jack detection events. The DA7219 codec used
here can detect Headphones, Headset Mic and Line Out connections. Expose
each to userspace as kcontrols and add the necessary widgets.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Link: https://lore.kernel.org/r/20230802175737.263412-2-alpernebiyasak@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: max98373-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:29 +0000 (10:36 -0500)]
ASoC: max98373-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: max98363: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:28 +0000 (10:36 -0500)]
ASoC: max98363: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt5682-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:27 +0000 (10:36 -0500)]
ASoC: rt5682-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt1318-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:26 +0000 (10:36 -0500)]
ASoC: rt1318-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt1316-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:25 +0000 (10:36 -0500)]
ASoC: rt1316-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt1308-sdw: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:24 +0000 (10:36 -0500)]
ASoC: rt1308-sdw: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt715-sdca: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:23 +0000 (10:36 -0500)]
ASoC: rt715-sdca: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt715: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:22 +0000 (10:36 -0500)]
ASoC: rt715: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt712-sdca-dmic: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:21 +0000 (10:36 -0500)]
ASoC: rt712-sdca-dmic: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt1712-sdca: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:20 +0000 (10:36 -0500)]
ASoC: rt1712-sdca: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt700: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:19 +0000 (10:36 -0500)]
ASoC: rt700: enable pm_runtime in probe, keep status as 'suspended'

This patch suggests enabling pm_runtime during the probe, but marking the
device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

The changes are directly inspired by RT711 and RT711-sdca changes.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt711-sdca: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:18 +0000 (10:36 -0500)]
ASoC: rt711-sdca: enable pm_runtime in probe, keep status as 'suspended'

In stress cases involving module insertion/removal followed by
playback/capture, it can happen that capture/playback is started
before the codec enumeration completes.

The codec driver registers its components with the ASoC framework
during the probe stage, so there is currently no way for the card
creation to wait for the codec enumeration/initialization to complete.

In addition, when the capture/playback starts, the ASoC framework uses
pm_runtime_get_sync() to properly refcount and power-manage
devices. This is problematic in the SoundWire case because pm_runtime
is enabled during the enumeration/initialization stage, so
pm_runtime_get_sync() will return -EACCESS which is
ignored. Additional errors will happen when setting the pm_runtime
status as 'active' because the parent is not properly resumed,
resulting in an error such as:

"rt711 sdw:0:025d:0711:00: runtime PM trying to activate child device
sdw:0:025d:0711:00 but parent (sdw-master-0) is not active"

This patch suggests enabling pm_runtime during the probe, but marking
the device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

Closes: https://github.com/thesofproject/linux/issues/4328
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt711: enable pm_runtime in probe, keep status as 'suspended'
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:17 +0000 (10:36 -0500)]
ASoC: rt711: enable pm_runtime in probe, keep status as 'suspended'

In stress cases involving module insertion/removal followed by
playback/capture, it can happen that capture/playback is started
before the codec enumeration completes.

The codec driver registers its components with the ASoC framework
during the probe stage, so there is currently no way for the card
creation to wait for the codec enumeration/initialization to complete.

In addition, when the capture/playback starts, the ASoC framework uses
pm_runtime_get_sync() to properly refcount and power-manage
devices. This is problematic in the SoundWire case because pm_runtime
is enabled during the enumeration/initialization stage, so
pm_runtime_get_sync() will return -EACCESS which is
ignored. Additional errors will happen when setting the pm_runtime
status as 'active' because the parent is not properly resumed,
resulting in an error such as:

"rt711 sdw:0:025d:0711:00: runtime PM trying to activate child device
sdw:0:025d:0711:00 but parent (sdw-master-0) is not active"

This patch suggests enabling pm_runtime during the probe, but marking
the device as 'active' only after it is enumerated. That will force a
dependency between the card and the codec, pm_runtime_get_sync() will
have to wait for the codec device to resume and hence implicitly wait
for the enumeration/initialization to be completed. In the nominal
case where the codec device is already active the get_sync() would
only perform a ref-count increase.

Closes: https://github.com/thesofproject/linux/issues/4328
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: rt5682-sdw: make regmap cache-only in probe
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:16 +0000 (10:36 -0500)]
ASoC: rt5682-sdw: make regmap cache-only in probe

The RT5682 needs specific attention: there are two regmap in
rt5682_priv struct, one is sdw_regmap which is for IO transfer, and
the other is used for registers control.

We need to set both regmaps when we set cache only. Because if we set
rt5682->sdw_regmap only, rt5682->regmap won't set/get the right value
when it call regmap_write/read(rt5682->sdw_regmap, ...). If we set
rt5682->regmap only, regmap_write(rt5682->sdw_regmap, ...) is used
in rt5682_clock_config which will be called by the ..bus_config ops.

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/20230802153629.53576-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SoundWire codecs: make regmap cache-only in probe
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:15 +0000 (10:36 -0500)]
ASoC: SoundWire codecs: make regmap cache-only in probe

The SoundWire bus may start after the probe where the SoundWire ASoC
components are registered. This creates a time window where the card
can be created and the registers be accessed.

As discussed on the mailing list, we can't really control when codecs
are enumerated and initialized, but we can make sure the access to the
codecs is cached until the hardware is accessible.

This patch configures regcache_cache_only() with a 'true' parameter in
the probe function, and a 'false' parameter in the io_init routine.

The rt5682 is handled through a different patch due to its specific
cache handling.

Link: https://lore.kernel.org/alsa-devel/20230503144102.242240-1-krzysztof.kozlowski@linaro.org/
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SoundWire codecs: return error status in probe
Pierre-Louis Bossart [Wed, 2 Aug 2023 15:36:14 +0000 (10:36 -0500)]
ASoC: SoundWire codecs: return error status in probe

For some reason the first batch of SoundWire codec drivers squelch
errors in the SoundWire probe callback.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230802153629.53576-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: ti: davinci-evm: simplify the code with module_platform_driver
Yang Yingliang [Fri, 4 Aug 2023 08:54:02 +0000 (16:54 +0800)]
ASoC: ti: davinci-evm: simplify the code with module_platform_driver

The init/exit() of driver only calls platform_driver_register/unregister,
it can be simpilfied with module_platform_driver.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230804085402.1328033-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: wm8960: Add support for the power supplies
Fabio Estevam [Thu, 3 Aug 2023 21:55:06 +0000 (18:55 -0300)]
ASoC: wm8960: Add support for the power supplies

WM8960 has the following power supplies:

- AVDD
- DBVDD
- DCVDD
- SPKVDD1
- SPKVDD1

Add support for them.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230803215506.142922-2-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: dt-bindings: wlf,wm8960: Describe the power supplies
Fabio Estevam [Thu, 3 Aug 2023 21:55:05 +0000 (18:55 -0300)]
ASoC: dt-bindings: wlf,wm8960: Describe the power supplies

WM8960 has the following power supplies:

- AVDD
- DBVDD
- DCVDD
- SPKVDD1
- SPKVDD1

Add them to bindings to improve the hardware description.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230803215506.142922-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: mediatek: mt8186 modify dram type as non-cache
Trevor Wu [Thu, 3 Aug 2023 07:50:28 +0000 (15:50 +0800)]
ASoC: SOF: mediatek: mt8186 modify dram type as non-cache

To prevent incorrect access between the host and DSP sides, we need to
modify DRAM as a non-cache memory type. Additionally, we can retrieve
the size of shared DMA from the device tree.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Kuan-Hsun Cheng <Allen-KH.Cheng@mediatek.com>
Link: https://lore.kernel.org/r/20230803075028.32170-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: soc-acpi: Add missing kernel doc
Charles Keepax [Thu, 3 Aug 2023 16:23:12 +0000 (17:23 +0100)]
ASoC: soc-acpi: Add missing kernel doc

The UID field in snd_soc_acpi_link_adr is not documented, add kernel doc
for it.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20230803162312.117771-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: mediatek: mt8186: Remove unused mutex.
Sebastian Andrzej Siewior [Thu, 3 Aug 2023 08:39:08 +0000 (10:39 +0200)]
ASoC: mediatek: mt8186: Remove unused mutex.

The mutex mutex_request_dram has no user.

Remove mutex_request_dram.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20230803083908.9DxbPvOK@linutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: fsl_micfil: Use SET_SYSTEM_SLEEP_PM_OPS to simplify PM
Chancel Liu [Wed, 2 Aug 2023 05:21:17 +0000 (13:21 +0800)]
ASoC: fsl_micfil: Use SET_SYSTEM_SLEEP_PM_OPS to simplify PM

Use SET_SYSTEM_SLEEP_PM_OPS to simplify suspend and resume function.
fsl_micfil_suspend() and fsl_micfil_resume() can be deleted.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230802052117.1293029-4-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: fsl_micfil: Add fsl_micfil_use_verid function
Chancel Liu [Wed, 2 Aug 2023 05:21:16 +0000 (13:21 +0800)]
ASoC: fsl_micfil: Add fsl_micfil_use_verid function

fsl_micfil_use_verid() can help to parse the version info in VERID and
PARAM registers. Since the two registers are added only on i.MX93
platform, a member flag called use_verid is introduced to soc data
structure which indicates acquiring MICFIL version.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230802052117.1293029-3-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: fsl_micfil: Add new registers and new bit definition
Chancel Liu [Wed, 2 Aug 2023 05:21:15 +0000 (13:21 +0800)]
ASoC: fsl_micfil: Add new registers and new bit definition

MICFIL IP is upgraded on i.MX93 platform. These new registers and new
bit definition are added to complete the register list.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230802052117.1293029-2-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: machine driver updates for 6.6
Mark Brown [Tue, 1 Aug 2023 13:56:00 +0000 (14:56 +0100)]
ASoC: Intel: machine driver updates for 6.6

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

Lots of small cleanups coming from Bard Liao and Charles Keepax for
SoundWire platforms, and minor additions for RVPs and Chromebooks.

15 months agoASoC/SOF/Intel/AMD: cleanups for GCC11 -fanalyzer
Mark Brown [Tue, 1 Aug 2023 11:45:03 +0000 (12:45 +0100)]
ASoC/SOF/Intel/AMD: cleanups for GCC11 -fanalyzer

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

GCC11 provides an '-fanalyzer' static analysis option which does not
provide too many false-positives. This patch cleans-up known
problematic code paths to help enable this capability in CI. We've
used this for about a month already.

15 months agoASoC: SOF: Deprecate invalid enums in IPC3
Curtis Malainey [Mon, 31 Jul 2023 21:32:41 +0000 (16:32 -0500)]
ASoC: SOF: Deprecate invalid enums in IPC3

The switch component was never completed and sat half empty for over 3
years. It was recently deleted. For modern components this would
require not change in the kernel but since this was a legacy allocation
from the enum days of IPC3 we should mark the respective enum as
deprecated.

The splitter component was never even got a source file in the firmware.
Therefore also delete it since this is not needed.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731213242.434594-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: ipc3: update dai_link_fixup for SOF_DAI_MEDIATEK_AFE
Trevor Wu [Mon, 31 Jul 2023 21:32:40 +0000 (16:32 -0500)]
ASoC: SOF: ipc3: update dai_link_fixup for SOF_DAI_MEDIATEK_AFE

For MediaTek AFE, DAI DMA can support different bitwidths compared to
the BE DAI. Therefore, it is preferable to obtain the BE frame format
from the DAI_CONFIG.

Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731213242.434594-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: soc-acpi: improve log messagesin link_slaves_found()
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:32:39 +0000 (16:32 -0500)]
ASoC: soc-acpi: improve log messagesin link_slaves_found()

use 'part_id' to follow MIPI/SoundWire wording and use more consistent
%#x format.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230731213242.434594-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: soc-acpi: move link_slaves_found()
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:32:38 +0000 (16:32 -0500)]
ASoC: soc-acpi: move link_slaves_found()

Move existing function in common library to make sure the code can be
reused by other SoC vendors.

No functionality change outside of the move and added prefix.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230731213242.434594-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: Intel: start simplify the signature of link_slaves_found()
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:32:37 +0000 (16:32 -0500)]
ASoC: SOF: Intel: start simplify the signature of link_slaves_found()

Start removing Intel-specific arguments to make that function usable
by other SOC vendors.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230731213242.434594-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Move group_generated logic
Charles Keepax [Mon, 31 Jul 2023 21:42:57 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Move group_generated logic

Hoist the handling logic for group_generated up to the
sof_card_dai_links_create level. This avoids the need to pass the array
through multiple levels of functions.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230731214257.444605-24-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Merge codec_conf_alloc into dailink_info
Charles Keepax [Mon, 31 Jul 2023 21:42:56 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Merge codec_conf_alloc into dailink_info

Rename get_sdw_dailink_info to simply get_dailink_info and have it also
return the number of codecs present. Then hoist the allocation of the
codec conf structure up into sof_card_dai_links_create. This saves an
extra loop through the adr_link array, allows us to get rid of
sof_card_codec_conf_alloc and makes the allocation more explicit.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230731214257.444605-23-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Clean up DAI link counting
Charles Keepax [Mon, 31 Jul 2023 21:42:55 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Clean up DAI link counting

The counting of each of the types of DAI link is a bit messy with things
added onto an intermediate variable as it goes along. Re-order things a
little to keep the order consistent with the rest of the function and
simplify the process down to a variable for each type of DAI and then
sum them at the end.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@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/20230731214257.444605-22-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_sdw: add cs35l56 codec info
Chao Song [Mon, 31 Jul 2023 21:42:54 +0000 (16:42 -0500)]
ASoC: Intel: sof_sdw: add cs35l56 codec info

Add cs35l56 support in sof_sdw machine driver.

Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Chao Song <chao.song@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/20230731214257.444605-21-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Allow direct specification of CODEC name
Charles Keepax [Mon, 31 Jul 2023 21:42:53 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Allow direct specification of CODEC name

Add support for MFD based CODEC drivers, by allowing the CODEC name to
not be the SoundWire device directly.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.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/20230731214257.444605-20-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_sdw: break earlier when a adr link contains different codecs
Bard Liao [Mon, 31 Jul 2023 21:42:52 +0000 (16:42 -0500)]
ASoC: Intel: sof_sdw: break earlier when a adr link contains different codecs

create_codec_dai_name() is used to create codec component's information
in different adr links. We can and should break before we do anything.

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/20230731214257.444605-19-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Move amp_num initialisation to mc_probe
Charles Keepax [Mon, 31 Jul 2023 21:42:51 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Move amp_num initialisation to mc_probe

The amp_num member of the info struct is zeroed at the start of
sof_card_dai_links_create, but then summed in mc_probe after
sof_card_dai_links_create is called. It is a little clearer to hoist the
initialisation out of sof_card_dai_links_create so it is on the same
level as the summation.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-18-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Remove redundant parameters in dai creation
Charles Keepax [Mon, 31 Jul 2023 21:42:50 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Remove redundant parameters in dai creation

Pull the device and mach struct out of the card rather than explicitly
passing to sof_card_dai_links_create.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-17-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Minor tidy up of mc_probe
Charles Keepax [Mon, 31 Jul 2023 21:42:49 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Minor tidy up of mc_probe

Shuffle things around to group operations a little more, and
consistently use card->dev.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-16-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Constify parameter to find_codec_part_info
Charles Keepax [Mon, 31 Jul 2023 21:42:48 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Constify parameter to find_codec_part_info

The address passed to find_codec_part_info should be const.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-15-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Simplify find_codec_info_acpi
Charles Keepax [Mon, 31 Jul 2023 21:42:47 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Simplify find_codec_info_acpi

Use a return rather than a break and an additional range check.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-14-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Use a module device table
Charles Keepax [Mon, 31 Jul 2023 21:42:46 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Use a module device table

A module device table is generally preferred over hard coding a
MODULE_ALIAS.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-13-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Remove some extra line breaks
Charles Keepax [Mon, 31 Jul 2023 21:42:45 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Remove some extra line breaks

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Rename codec_idx to codec_dlc_index
Charles Keepax [Mon, 31 Jul 2023 21:42:44 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Rename codec_idx to codec_dlc_index

Having two local variables called codec_idx and codec_index, that refer
to different things is a little confusing. Rename codec_idx to
codec_dlc_index to indicate it points into the dai_link_component array.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-11-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: intel: sof_sdw: Use consistent variable naming for links
Charles Keepax [Mon, 31 Jul 2023 21:42:43 +0000 (16:42 -0500)]
ASoC: intel: sof_sdw: Use consistent variable naming for links

The driver makes extensive use of both ACPI link and ASoC DAI link
structs, often referring to both with the variable name link. Make the
code a little easier to follow by consistently using adr_link for the
ACPI bits and dai_links for the ASoC bits.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_sdw: add support for SKU 0AFE
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:42:42 +0000 (16:42 -0500)]
ASoC: Intel: sof_sdw: add support for SKU 0AFE

Yet another missing configuration, with the standard configuration

link0: rt711-sdca
link 1 and 2: rt1316-sdca
link3: rt714-sdca

Link: https://github.com/thesofproject/sof/issues/7799
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/20230731214257.444605-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_sdw: rename link_id to be_id
Bard Liao [Mon, 31 Jul 2023 21:42:41 +0000 (16:42 -0500)]
ASoC: Intel: sof_sdw: rename link_id to be_id

The link_id parameter in create_sdw_dailink is actually the BE link id.
Rename it to be_id to be consistent with the caller and less confusion.
No functionality change.

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/20230731214257.444605-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_sdw: allow mockup amplifier to provide feedback
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:42:40 +0000 (16:42 -0500)]
ASoC: Intel: sof_sdw: allow mockup amplifier to provide feedback

The capture setting are missing and preventing topologies with
feedback from loading.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731214257.444605-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_sdw: reorder SoundWire codecs in Kconfig
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:42:39 +0000 (16:42 -0500)]
ASoC: Intel: sof_sdw: reorder SoundWire codecs in Kconfig

No functionality change, just sort Realtek codecs using increasing
part IDs.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@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/20230731214257.444605-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_sdw: Update BT offload config for soundwire config
Uday M Bhat [Mon, 31 Jul 2023 21:42:38 +0000 (16:42 -0500)]
ASoC: Intel: sof_sdw: Update BT offload config for soundwire config

For soundwire config, SSP1 is used for BT offload. This is enabled
in sof_sdw_quirk_table

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Uday M Bhat <uday.m.bhat@intel.com>
Signed-off-by: Jairaj Arava <jairaj.arava@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731214257.444605-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_rt5682 add support for HDMI_In capture
apoorv [Mon, 31 Jul 2023 21:42:37 +0000 (16:42 -0500)]
ASoC: Intel: sof_rt5682 add support for HDMI_In capture

Adding support for 2 streams of HDMI-In capture via I2S with rt5682s
codec variant

Reviewed-by: CBM <balamurugan.c@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: apoorv <apoorv@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731214257.444605-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: sof_rt5682: add RPL support for MAX98357A speaker
Terry Cheong [Mon, 31 Jul 2023 21:42:36 +0000 (16:42 -0500)]
ASoC: Intel: sof_rt5682: add RPL support for MAX98357A speaker

Adding support back to RPL devices that lost audio after the RPL/ADL
split. The hardware configuration is:

SSP0: 10EC5682/RTL5682 codec
SSP2: MAX98357A amplifier

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Terry Cheong <htcheong@chromium.org>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731214257.444605-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: soc-acpi: Add entry for rt711-sdca-sdw at link 0 in RPL match table
Balamurugan C [Mon, 31 Jul 2023 21:42:35 +0000 (16:42 -0500)]
ASoC: Intel: soc-acpi: Add entry for rt711-sdca-sdw at link 0 in RPL match table

Adding RT711 sdca SDW codec support with SDW0 link for RPL RVP platforms

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Balamurugan C <balamurugan.c@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230731214257.444605-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: amd: acp5x-mach:add checks to avoid static analysis warnings
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:37:48 +0000 (16:37 -0500)]
ASoC: amd: acp5x-mach:add checks to avoid static analysis warnings

snd_soc_card_get_codec_dai() can return NULL, but that value is not
checked for, leading to static analysis warnings.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20230731213748.440285-9-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: atom: remove static analysis false positive
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:37:47 +0000 (16:37 -0500)]
ASoC: Intel: atom: remove static analysis false positive

make KCFLAGS='-fanalyzer' sound/soc/intel/atom/ reports a possible
NULL pointer dereference.

sound/soc/intel/atom/sst/sst_stream.c:221:40: error: dereference of
NULL ‘block’ [CWE-476] [-Werror=analyzer-null-dereference]
  221 |                         unsigned char *r = block->data;

This is a false-positive, the GCC analyzer generated that report by
considering if (bytes->block) as true in some cases and false in
others.

We can simplify the code and use a local variable so that static
analysis does not try to look for cases where bytes->block can be
modified concurrently.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20230731213748.440285-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: Intel: bdw_rt286: add checks to avoid static analysis warnings
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:37:46 +0000 (16:37 -0500)]
ASoC: Intel: bdw_rt286: add checks to avoid static analysis warnings

snd_soc_card_get_codec_dai() can return NULL, but that value is not
checked for, leading to false-positive static analysis warnings

sound/soc/intel/boards/bdw_rt286.c:190:16: error: dereference of NULL
‘codec_dai’ [CWE-476] [-Werror=analyzer-null-dereference]

  190 |         return snd_soc_component_set_jack(codec_dai->component, NULL, NULL);
      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ‘card_suspend_pre’: event 1
    |
    |  190 |         return snd_soc_component_set_jack(codec_dai->component, NULL, NULL);
    |      |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    |      |                |
    |      |                (1) dereference of NULL ‘codec_dai’

This NULL dereference cannot happen, the codec-dai "rt286-aif1" must exists
otherwise the card would not be created. Static analysis cannot know
that however so we might as well squelch this report.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20230731213748.440285-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: mediatek: remove error checks on NULL ipc
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:37:45 +0000 (16:37 -0500)]
ASoC: SOF: mediatek: remove error checks on NULL ipc

mtk_adsp_ipc_get_data() can return NULL, but the value is not checked
before being used, leading to static analysis warnings.

sound/soc/sof/mediatek/mt8195/mt8195.c:90:32: error: dereference of
NULL ‘0’ [CWE-476] [-Werror=analyzer-null-dereference]

   90 |         spin_lock_irqsave(&priv->sdev->ipc_lock, flags);
      |                            ~~~~^~~~~~

It appears this is not really a possible problem, so remove those checks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20230731213748.440285-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: imx: remove error checks on NULL ipc
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:37:44 +0000 (16:37 -0500)]
ASoC: SOF: imx: remove error checks on NULL ipc

imx_dsp_get_data() can return NULL, but the value is not checked
before being usd, leading to static analysis warnings.

sound/soc/sof/imx/imx8.c:85:32: error: dereference of NULL ‘0’
[CWE-476] [-Werror=analyzer-null-dereference]

   85 |         spin_lock_irqsave(&priv->sdev->ipc_lock, flags);
      |                            ~~~~^~~~~~

It appears this is not really a possible problem, so remove those checks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20230731213748.440285-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: topology: simplify code to prevent static analysis warnings
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:37:43 +0000 (16:37 -0500)]
ASoC: SOF: topology: simplify code to prevent static analysis warnings

make KCFLAGS='-fanalyzer' sound/soc/sof/intel/ reports a possible NULL
pointer dereference.

sound/soc/sof/topology.c:1136:21: error: dereference of NULL ‘w’
[CWE-476] [-Werror=analyzer-null-dereference]

 1136 |     strcmp(w->sname, rtd->dai_link->stream_name))

The code is rather confusing and can be simplified to make static
analysis happy. No functionality change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20230731213748.440285-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
15 months agoASoC: SOF: ipc3: add checks to prevent static analysis warnings
Pierre-Louis Bossart [Mon, 31 Jul 2023 21:37:42 +0000 (16:37 -0500)]
ASoC: SOF: ipc3: add checks to prevent static analysis warnings

make KCFLAGS='-fanalyzer' sound/soc/sof/ reports an issue with memcpy:

sound/soc/sof/ipc3.c: In function ‘ipc3_wait_tx_done’:
sound/soc/sof/ipc3.c:309:33: error: use of NULL ‘reply_data’ where
non-null expected [CWE-476] [-Werror=analyzer-null-argument]

  309 |                        memcpy(reply_data, msg->reply_data,
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  310 |                               msg->reply_size);

The finding is legit with this call:
    return sof_ipc3_tx_msg(sdev, &pm_ctx, sizeof(pm_ctx), NULL, 0, false);

Static analysis has no way of knowing that the reply will be zero-sized.

Add a check to only do the memcpy if the reply size is not zero and
the destination pointer is not NULL.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20230731213748.440285-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>