platform/kernel/linux-starfive.git
19 months agoASoC: Intel: avs: rt286: Add define for codec DAI name
Amadeusz Sławiński [Fri, 25 Nov 2022 18:40:27 +0000 (19:40 +0100)]
ASoC: Intel: avs: rt286: Add define for codec DAI name

Following commits will make use of it to find codec DAI, define it
first.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221125184032.2565979-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: rt274: Refactor jack handling
Amadeusz Sławiński [Fri, 25 Nov 2022 18:40:26 +0000 (19:40 +0100)]
ASoC: Intel: avs: rt274: Refactor jack handling

Use link->exit() rather than pdev->remove() to unassign jack during card
unbind procedure so codec link initialization and exit procedures are
symmetrical.

Also, there is no need to perform search for codec dai in suspend_pre()
and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221125184032.2565979-6-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: rt274: Refer to DAI name through a constant
Amadeusz Sławiński [Fri, 25 Nov 2022 18:40:25 +0000 (19:40 +0100)]
ASoC: Intel: avs: rt274: Refer to DAI name through a constant

There is existing define for codec DAI name, make use of it when setting
codec DAI name.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221125184032.2565979-5-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: nau8825: Refactor jack handling
Amadeusz Sławiński [Fri, 25 Nov 2022 18:40:24 +0000 (19:40 +0100)]
ASoC: Intel: avs: nau8825: Refactor jack handling

Use link->exit() rather than pdev->remove() to unassign jack during card
unbind procedure so codec link initialization and exit procedures are
symmetrical.

Also, there is no need to perform search for codec dai in suspend_pre()
and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221125184032.2565979-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: da7219: Refactor jack handling
Amadeusz Sławiński [Fri, 25 Nov 2022 18:40:23 +0000 (19:40 +0100)]
ASoC: Intel: avs: da7219: Refactor jack handling

Use link->exit() rather than pdev->remove() to unassign jack during card
unbind procedure so codec link initialization and exit procedures are
symmetrical.

Also, there is no need to perform search for codec dai in suspend_pre()
and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221125184032.2565979-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: bdw_rt286: Refactor jack handling
Cezary Rojewski [Fri, 25 Nov 2022 18:40:22 +0000 (19:40 +0100)]
ASoC: Intel: bdw_rt286: Refactor jack handling

Use link->exit() rather than pdev->remove() to unassign jack during card
unbind procedure so codec link initialization and exit procedures are
symmetrical.

Also, there is no need to perform search for codec dai in suspend_pre()
and resume_post() ourselves. Use snd_soc_card_get_codec_dai() instead.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221125184032.2565979-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: mediatek: mt8173: Enable IRQ when pdata is ready
Ricardo Ribalda [Mon, 28 Nov 2022 10:49:16 +0000 (11:49 +0100)]
ASoC: mediatek: mt8173: Enable IRQ when pdata is ready

If the device does not come straight from reset, we might receive an IRQ
before we are ready to handle it.

Fixes:

[    2.334737] Unable to handle kernel read from unreadable memory at virtual address 00000000000001e4
[    2.522601] Call trace:
[    2.525040]  regmap_read+0x1c/0x80
[    2.528434]  mt8173_afe_irq_handler+0x40/0xf0
...
[    2.598921]  start_kernel+0x338/0x42c

Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Fixes: ee0bcaff109f ("ASoC: mediatek: Add AFE platform driver")
Link: https://lore.kernel.org/r/20221128-mt8173-afe-v1-0-70728221628f@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: Rework Qualcomm APR/GPR Sound nodes for SM8450
Mark Brown [Mon, 28 Nov 2022 16:38:18 +0000 (16:38 +0000)]
ASoC: dt-bindings: Rework Qualcomm APR/GPR Sound nodes for SM8450

Merge series from Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>:

Adding sound support for Qualcomm SM8450 SoC (and later for SC8280XP) brought
some changes to APR/GPR services bindings.  These bindings are part of
qcom,apr.yaml:

  apr-or-gpr-device-node <- qcom,apr.yaml
    apr-gpr-service@[0-9] <- qcom,apr.yaml
      service-specific-components <- /schemas/sound/qcom,q6*.yaml

The schema for services (apr-gpr-service@[0-9]) was not complete and is still
quite not specific.  It allows several incorrect combinations, like adding a
clock-controller to a APM device.  Restricting it would complicate the schema
even more.  Bringing new support for sound on Qualcomm SM8450 and SC8280XP SoC
would grow it as well.

Refactor the bindings before extending them for Qualcomm SM8450 SoC.

19 months agoASoC: qcom: lpass-sc7180: Add system suspend/resume PM ops
Srinivasa Rao Mandadapu [Mon, 28 Nov 2022 07:49:02 +0000 (13:19 +0530)]
ASoC: qcom: lpass-sc7180: Add system suspend/resume PM ops

Update lpass sc7180 platform driver with PM ops, such as
system supend and resume callbacks.
This update is required to disable clocks during supend and
avoid XO shutdown issue.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Tested-by: Rahul Ajmeriya <quic_rajmeriy@quicinc.com>
Link: https://lore.kernel.org/r/1669621742-28524-1-git-send-email-quic_srivasam@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rt5640: Fix Jack work after system suspend
Oder Chiou [Mon, 28 Nov 2022 07:08:25 +0000 (15:08 +0800)]
ASoC: rt5640: Fix Jack work after system suspend

We found an corner case in RT5640 codec driver which schedules jack work
after system suspend as IRQ was enabled. Due to this, hitting the error
as register access happening after suspend as jack worker thread getting
scheduled in irq handler. The patch disables the irq during the suspend
to prevent the corner case happening.

Signed-off-by: Oder Chiou <oder_chiou@realtek.com>
Reported-by: Mohan Kumar D <mkumard@nvidia.com>
Link: https://lore.kernel.org/r/20221128070825.91215-1-oder_chiou@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: Drop obsolete dependency on COMPILE_TEST
Jean Delvare [Sun, 27 Nov 2022 18:35:49 +0000 (19:35 +0100)]
ASoC: SOF: Drop obsolete dependency on COMPILE_TEST

Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), it
is possible to test-build any driver which depends on OF on any
architecture by explicitly selecting OF. Therefore depending on
COMPILE_TEST as an alternative is no longer needed.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Link: https://lore.kernel.org/r/20221127193549.211bf8f7@endymion.delvare
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: max9867: Implement exact integer mode
Pavel Dobias [Wed, 23 Nov 2022 15:38:18 +0000 (16:38 +0100)]
ASoC: max9867: Implement exact integer mode

For 8kHz and 16kHz sample rates and certain PCLK values
the codec can be programmed to operate in exact integer
mode. If available, use it to achieve the exact sample rate.

Signed-off-by: Pavel Dobias <dobias@2n.com>
Link: https://lore.kernel.org/r/20221123153818.24650-1-dobias@2n.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rsnd: adg: use __clk_get_name() instead of local clk_name[]
Kuninori Morimoto [Mon, 28 Nov 2022 05:46:28 +0000 (05:46 +0000)]
ASoC: rsnd: adg: use __clk_get_name() instead of local clk_name[]

Current rsnd_adg_clk_dbg_info() is using locak clk_name[] to ndicating
clk name, but we don't want to use local clk_name[] everywhere when we
support R-Car Gen4 sound to handling non compatible clk naming.

This patch uses __clk_get_name() instead of local clk_name[] for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v8mz8wcs.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: sdw-mockup: Switch to new snd_sdw_params_to_config helper
Charles Keepax [Wed, 23 Nov 2022 16:54:32 +0000 (16:54 +0000)]
ASoC: sdw-mockup: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-9-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rt715: Switch to new snd_sdw_params_to_config helper
Charles Keepax [Wed, 23 Nov 2022 16:54:31 +0000 (16:54 +0000)]
ASoC: rt715: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-8-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rt711: Switch to new snd_sdw_params_to_config helper
Charles Keepax [Wed, 23 Nov 2022 16:54:30 +0000 (16:54 +0000)]
ASoC: rt711: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-7-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rt700: Switch to new snd_sdw_params_to_config helper
Charles Keepax [Wed, 23 Nov 2022 16:54:29 +0000 (16:54 +0000)]
ASoC: rt700: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-6-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rt5682-sdw: Switch to new snd_sdw_params_to_config helper
Charles Keepax [Wed, 23 Nov 2022 16:54:28 +0000 (16:54 +0000)]
ASoC: rt5682-sdw: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-5-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rt1316-sdw: Switch to new snd_sdw_params_to_config helper
Charles Keepax [Wed, 23 Nov 2022 16:54:27 +0000 (16:54 +0000)]
ASoC: rt1316-sdw: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-4-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rt1308-sdw: Switch to new snd_sdw_params_to_config helper
Charles Keepax [Wed, 23 Nov 2022 16:54:26 +0000 (16:54 +0000)]
ASoC: rt1308-sdw: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-3-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: max98373-sdw: Switch to new snd_sdw_params_to_config helper
Charles Keepax [Wed, 23 Nov 2022 16:54:25 +0000 (16:54 +0000)]
ASoC: max98373-sdw: Switch to new snd_sdw_params_to_config helper

The conversion from hw_params to SoundWire config is pretty
standard as such most of the conversion can be handled by the new
snd_sdw_params_to_config helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agosound: sdw: Add hw_params to SoundWire config helper function
Charles Keepax [Wed, 23 Nov 2022 16:54:24 +0000 (16:54 +0000)]
sound: sdw: Add hw_params to SoundWire config helper function

The vast majority of the current users of the SoundWire framework
have almost identical code for converting from hw_params to SoundWire
configuration. Whilst complex devices might require more, it is very
likely that most new devices will follow the same pattern. Save a
little code by factoring this out into a helper function.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165432.594972-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rsnd: Drop obsolete dependency on COMPILE_TEST
Jean Delvare [Sun, 27 Nov 2022 18:34:41 +0000 (19:34 +0100)]
ASoC: rsnd: Drop obsolete dependency on COMPILE_TEST

Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), it
is possible to test-build any driver which depends on OF on any
architecture by explicitly selecting OF. Therefore depending on
COMPILE_TEST as an alternative is no longer needed.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Link: https://lore.kernel.org/r/20221127193441.0b54484d@endymion.delvare
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: amd: ADD HS and SP virtual DAI.
V sujith kumar Reddy [Wed, 23 Nov 2022 12:19:10 +0000 (17:49 +0530)]
ASoC: SOF: amd: ADD HS and SP virtual DAI.

ADD HS and SP virtual DAI driver to support AMD platforms.

Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
Link: https://lore.kernel.org/r/20221123121911.3446224-4-vsujithkumar.reddy@amd.corp-partner.google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: amd: Fix for selecting clock source as external clock.
V sujith kumar Reddy [Wed, 23 Nov 2022 12:19:09 +0000 (17:49 +0530)]
ASoC: SOF: amd: Fix for selecting clock source as external clock.

By default clock source is selected as internal clock of 96Mhz
which is not configurable. Now we select the clock source to
external clock (ACLK) which can be configurable to different clock
ranges depending on usecase.

Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
Link: https://lore.kernel.org/r/20221123121911.3446224-3-vsujithkumar.reddy@amd.corp-partner.google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: amd: Fix for reading position updates from stream box.
V sujith kumar Reddy [Wed, 23 Nov 2022 12:19:08 +0000 (17:49 +0530)]
ASoC: SOF: amd: Fix for reading position updates from stream box.

By default the position updates are read from dsp box when streambox
size is not defined.if the streambox size is defined to some value
then position updates can be read from the streambox.

Signed-off-by: V sujith kumar Reddy <Vsujithkumar.Reddy@amd.com>
Link: https://lore.kernel.org/r/20221123121911.3446224-2-vsujithkumar.reddy@amd.corp-partner.google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,q6apm: Add SM8450 bedais node
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:35 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,q6apm: Add SM8450 bedais node

On SM8450 and SC8280XP, the Q6APM is a bit different:
1. It is used as a platform DAI link, so it needs #sound-dai-cells.
2. It has two DAI children, so add new "bedais" node.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-12-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,q6apm-lpass-dais: Split to separate schema
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:34 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,q6apm-lpass-dais: Split to separate schema

The Qualcomm DSP LPASS Audio DAIs are a bit different than Qualcomm DSP
Audio FrontEnd (Q6AFE) DAIs - they do not use children nodes for each
DAI.  None of other properties from qcom,q6dsp-lpass-ports.yaml apply
here as well, so move the qcom,q6apm-lpass-dais compatible to its own
binding.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-11-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,q6core: Split to separate schema
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:33 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,q6core: Split to separate schema

The APR/GPR bindings with services got complicated so move out the
Q6Core service to its own binding.  Previously the compatible was
documented in qcom,apr.yaml.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-10-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,q6prm: Split to separate schema
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:32 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,q6prm: Split to separate schema

The APR/GPR bindings with services got complicated so move out the Q6PRM
service to its own binding.  Previously the compatible was documented in
qcom,apr.yaml.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-9-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,q6asm: Split to separate schema
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:31 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,q6asm: Split to separate schema

The APR/GPR bindings with services got complicated so move out the Q6ASM
service to its own binding.  Previously the compatible was documented in
qcom,apr.yaml.  Move most of the examples from its children to this new
file.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-8-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,q6adm: Split to separate schema
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:30 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,q6adm: Split to separate schema

The APR/GPR bindings with services got complicated so move out the Q6ADM
service to its own binding.  Previously the compatible was documented in
qcom,apr.yaml.  Move most of the examples from its children to this new
file.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-7-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,q6apm: Split to separate schema
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:29 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,q6apm: Split to separate schema

The APR/GPR bindings with services got complicated so move out the Q6APM
service to its own binding.  Previously the compatible was documented in
qcom,apr.yaml.  Move most of the examples from its children to this new
file.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-6-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,q6afe: Split to separate schema
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:28 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,q6afe: Split to separate schema

The APR/GPR bindings with services got complicated so move out the Q6AFE
service to its own binding.  Previously the compatible was documented in
qcom,apr.yaml.  Move most of the examples from its children to this new
file.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-5-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,apr: Correct and extend example
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:27 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,apr: Correct and extend example

Correct the APR/GPR example:
1. Use consistent 4-space indentation,
2. Add required properties to services nodes, so the binding check
   passes once schema for these services is improved,
3. Add few other properties as APR/GPR is part of a GLINK edge:
   qcom,glink-channels and qcom,intents.
4. Drop unnecessary services, to make the example compact.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-4-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,apr: Split services to shared schema
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:26 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,apr: Split services to shared schema

The APR/GPR nodes are organized like:

  apr-or-gpr-device-node <- qcom,apr.yaml
    apr-gpr-service@[0-9] <- qcom,apr.yaml
      service-specific-components <- /schemas/sound/qcom,q6*.yaml

The schema for services (apr-gpr-service@[0-9]) already grows
considerably and is still quite not specific.  It allows several
incorrect combinations, like adding a clock-controller to a APM device.
Restricting it would complicate the schema even more.  Bringing new
support for sound on Qualcomm SM8450 and SC8280XP SoC would grow it as
well.

Simplify the qcom,apr.yaml by splitting the services to a shared file
which will be:
1. Referenced by qcom,apr.yaml with additionalProperties:true,
2. Referenced by specific bindings for services with
   additionalProperties:false (not yet in this commit).

While moving the code, add also required 'reg' and
'qcom,protection-domain' to further constrain the bindings.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-3-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: qcom,apr: Add GLINK channel name for SM8450
Krzysztof Kozlowski [Tue, 15 Nov 2022 12:02:25 +0000 (13:02 +0100)]
ASoC: dt-bindings: qcom,apr: Add GLINK channel name for SM8450

On SM8450 and SC8280XP with Qualcomm GPR, the GLINK channel name
(qcom,glink-channels) for ADSP is "adsp_apps".

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20221115120235.167812-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoRK3588 Audio Support
Mark Brown [Fri, 25 Nov 2022 21:39:20 +0000 (21:39 +0000)]
RK3588 Audio Support

Merge series from Nicolas Frattaroli <frattaroli.nicolas@gmail.com>:

This patchset refactors the Rockchip I2S/TDM driver in order to
support the RK3588 SoC, and then adds the necessary compatible
string to load the driver for it.

Patch 1 rectifies a problem with the bindings where we were too
strict about requiring the rockchip,grf property. Most features
of this audio device don't need access to the GRF to function.

Patch 2 modifies the driver to adjust its behaviour to what the
changed bindings now allow, namely using most things without the
GRF.

Patch 3 and 4 are boring compatible string stuff that enables
RK3588 support. No special data is needed to initialise the
driver for this instance of the I2S/TDM IP.

19 months agoASoC: adau1372: fixes after debugging custom board
Mark Brown [Fri, 25 Nov 2022 21:26:21 +0000 (21:26 +0000)]
ASoC: adau1372: fixes after debugging custom board

Merge series from Maarten Zanders <maarten.zanders@mind.be>:

A collection of fixes and improvements for the adau1372 driver.

19 months agoASoC: adau1372: add support for S24_LE mode
Maarten Zanders [Fri, 28 Oct 2022 15:26:24 +0000 (17:26 +0200)]
ASoC: adau1372: add support for S24_LE mode

The ADAU1372 contains 24bit ADCs and DACs. Allow the driver to use
its native mode which uses the same settings as the current 32 bit
mode.

Signed-off-by: Maarten Zanders <maarten.zanders@mind.be>
Link: https://lore.kernel.org/r/20221028152626.109603-3-maarten.zanders@mind.be
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: adau1372: correct PGA enable & mute bit
Maarten Zanders [Fri, 28 Oct 2022 15:26:25 +0000 (17:26 +0200)]
ASoC: adau1372: correct PGA enable & mute bit

The DAPM control for PGAx uses the PGA mute bit for
power management. This bit is active high but is set to
non-inverted (ie when powering, it will mute).
The ALSA control "PGA x Capture Switch" uses the active
high PGA_ENx bit, but is set to inverted. So when
enabling this switch, the PGA gets disabled.

To correct the behaviour, invert both these bits.

Signed-off-by: Maarten Zanders <maarten.zanders@mind.be>
Link: https://lore.kernel.org/r/20221028152626.109603-4-maarten.zanders@mind.be
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: adau1372: fix mclk
Maarten Zanders [Fri, 28 Oct 2022 15:26:23 +0000 (17:26 +0200)]
ASoC: adau1372: fix mclk

"mclk" is retrieved from the configuration and assigned to adau1372->clk.
However adau1372->mclk (==NULL) is used for clk_prepare_enable() and
clk_disable_unprepare() which don't have any effect.

Remove .clk from struct adau1372 and use .mclk throughout.
This change ensures that the input clock is switched on/off when the
bias level is changed.

Signed-off-by: Maarten Zanders <maarten.zanders@mind.be>
Link: https://lore.kernel.org/r/20221028152626.109603-2-maarten.zanders@mind.be
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: mediatek: mtk-btcvsd: Add checks for write and read of mtk_btcvsd_snd
Jiasheng Jiang [Wed, 16 Nov 2022 03:07:50 +0000 (11:07 +0800)]
ASoC: mediatek: mtk-btcvsd: Add checks for write and read of mtk_btcvsd_snd

As the mtk_btcvsd_snd_write and mtk_btcvsd_snd_read may return error,
it should be better to catch the exception.

Fixes: 4bd8597dc36c ("ASoC: mediatek: add btcvsd driver")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20221116030750.40500-1-jiasheng@iscas.ac.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: wcd9335: fix reset line polarity in example
Dmitry Torokhov [Thu, 27 Oct 2022 07:46:48 +0000 (00:46 -0700)]
ASoC: dt-bindings: wcd9335: fix reset line polarity in example

When resetting the block, the reset line is being driven low and then
high, which means that the line in DTS should be annotated as "active
low".

Fixes: 1877c9fda1b7 ("ASoC: dt-bindings: add dt bindings for wcd9335 audio codec")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221027074652.1044235-2-dmitry.torokhov@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rockchip: i2s_tdm: Add support for RK3588
Nicolas Frattaroli [Tue, 25 Oct 2022 12:41:32 +0000 (14:41 +0200)]
ASoC: rockchip: i2s_tdm: Add support for RK3588

This adds support for the RK3588 SoC to the I2S/TDM driver.

Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Link: https://lore.kernel.org/r/20221025124132.399729-5-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: rockchip: i2s-tdm: Add RK3588 compatible
Nicolas Frattaroli [Tue, 25 Oct 2022 12:41:31 +0000 (14:41 +0200)]
ASoC: dt-bindings: rockchip: i2s-tdm: Add RK3588 compatible

This adds the compatible string for the RK3588 SoC.

Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221025124132.399729-4-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: rockchip: i2s_tdm: Make the grf property optional
Nicolas Frattaroli [Tue, 25 Oct 2022 12:41:30 +0000 (14:41 +0200)]
ASoC: rockchip: i2s_tdm: Make the grf property optional

Only IO Multiplex and two TRCM modes need access to the GRF, so
making it a hard requirement is not a wise idea, as it complicates
support for newer SoCs which do not do these things.

Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Link: https://lore.kernel.org/r/20221025124132.399729-3-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: rockchip: i2s-tdm: Make grf property optional
Nicolas Frattaroli [Tue, 25 Oct 2022 12:41:29 +0000 (14:41 +0200)]
ASoC: dt-bindings: rockchip: i2s-tdm: Make grf property optional

Turns out most things don't require the GRF, so making the property
optional is the obvious move.

Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221025124132.399729-2-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agofirmware: cs_dsp: Switch to using namespaced exports
Mark Brown [Fri, 25 Nov 2022 14:36:56 +0000 (14:36 +0000)]
firmware: cs_dsp: Switch to using namespaced exports

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

Use EXPORT_SYMBOL_NS_GPL() instead of EXPORT_SYMBOL_GPL() and patch the
three drivers that use cs_dsp to add the MODULE_IMPORT_NS().

To make the namespace more specific the KConfig symbol for cs_dsp is
changed from CS_DSP to FW_CS_DSP.

19 months agoASoC/soundwire: revisit interrupt and lcount handling
Mark Brown [Fri, 25 Nov 2022 14:23:11 +0000 (14:23 +0000)]
ASoC/soundwire: revisit interrupt and lcount handling

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

The code in drivers/soundwire/intel_init.c is hardware-dependent and the
code does not apply to new generations starting with MeteorLake. Refactor
and clean-up the code to make this intel_init.c hardware-agnostic and
move all hardware-dependencies in the SOF driver using chip descriptors.

19 months agoASoC: wm_adsp: Report when a control write changes the value
Mark Brown [Fri, 25 Nov 2022 14:23:03 +0000 (14:23 +0000)]
ASoC: wm_adsp: Report when a control write changes the value

Merge series from Richard Fitzgerald <rf@opensource.cirrus.com>:

Writing a firmware control should be returning 1 if the control value
changed, so these two patches add that.

Though this is an ALSA requirement it is also useful for non-ALSA clients
of cs_dsp to know if the control value changed, so the main handling is
implemented in cs_dsp. TLV controls are specifically an ALSA thing so they
are handled specially in wm_adsp.

Simon Trimmer (2):
  firmware: cs_dsp: cs_dsp_coeff_write_ctrl() should report changed
  ASoC: wm_adsp: Return whether changed when writing controls

 drivers/firmware/cirrus/cs_dsp.c | 17 ++++++++++++-----
 sound/soc/codecs/wm_adsp.c       | 27 ++++++++++++++++++---------
 2 files changed, 30 insertions(+), 14 deletions(-)

--
2.30.2

19 months agofirmware: cs_dsp: Make the exports namespaced
Richard Fitzgerald [Thu, 24 Nov 2022 13:45:56 +0000 (13:45 +0000)]
firmware: cs_dsp: Make the exports namespaced

Move all the exports into a namespace.
This also adds the MODULE_IMPORT_NS to the 3 drivers that use the
exported functions.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221124134556.3343784-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agofirmware: cs_dsp: Rename KConfig symbol CS_DSP -> FW_CS_DSP
Richard Fitzgerald [Thu, 24 Nov 2022 13:45:55 +0000 (13:45 +0000)]
firmware: cs_dsp: Rename KConfig symbol CS_DSP -> FW_CS_DSP

Qualify the KConfig symbol for cs_dsp by adding a FW_ prefix so that
it is more explicit what is being referred to. This is preparation for
using the symbol to namespace the exports.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221124134556.3343784-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: codecs: src4xxx-i2c: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:45:37 +0000 (23:45 +0100)]
ASoC: codecs: src4xxx-i2c: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-604-uwe@kleine-koenig.org
Reviewed-by: Matt Flax <flatmax@flatmax.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: max98396: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:45:36 +0000 (23:45 +0100)]
ASoC: max98396: Convert to i2c's .probe_new()

.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in the probe function.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-603-uwe@kleine-koenig.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: codecs: tas2780: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:45:38 +0000 (23:45 +0100)]
ASoC: codecs: tas2780: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-605-uwe@kleine-koenig.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: codecs: es8326: Convert to i2c's .probe_new()
Uwe Kleine-König [Fri, 18 Nov 2022 22:45:35 +0000 (23:45 +0100)]
ASoC: codecs: es8326: Convert to i2c's .probe_new()

The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-602-uwe@kleine-koenig.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoMerge branch 'i2c/client_device_id_helper-immutable' of https://git.kernel.org/pub...
Mark Brown [Thu, 24 Nov 2022 19:20:09 +0000 (19:20 +0000)]
Merge branch 'i2c/client_device_id_helper-immutable' of https://git./linux/kernel/git/wsa/linux into HEAD

so we can apply I2C cleanups.

19 months agoASoC: mediatek: mt8186: Correct I2S shared clocks
Jiaxin Yu [Thu, 24 Nov 2022 02:30:50 +0000 (10:30 +0800)]
ASoC: mediatek: mt8186: Correct I2S shared clocks

In mt8186 platform, I2S2 should be the main I2S port that provide
the clock, on the contrary I2S3 should be the second I2S port that
use this clock.

Fixes: 9986bdaee477 ("ASoC: mediatek: mt8186: Configure shared clocks")
Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20221124023050.4470-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: add compatible string for NAU8318
David Lin [Thu, 24 Nov 2022 05:56:58 +0000 (13:56 +0800)]
ASoC: dt-bindings: add compatible string for NAU8318

The audio amplifier NAU8318 is almost functionally identical to NAU8315.
Adds compatible string "nuvoton,nau8318" for driver reuse.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20221124055658.53828-2-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: nau8315: add new acpi id and compatible id
David Lin [Thu, 24 Nov 2022 05:56:57 +0000 (13:56 +0800)]
ASoC: nau8315: add new acpi id and compatible id

Add new acpi id and compatible id for nau8315.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20221124055658.53828-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: qcom: cleanup and fix dependency of QCOM_COMMON
Srinivas Kandagatla [Thu, 24 Nov 2022 14:03:51 +0000 (14:03 +0000)]
ASoC: qcom: cleanup and fix dependency of QCOM_COMMON

SND_SOC_QCOM_COMMON depends on SOUNDWIRE for some symbols but this
is not explicitly specified using Kconfig depends. On the other hand
SND_SOC_QCOM_COMMON is also directly selected by the sound card
Kconfigs, this could result in various combinations and some symbols
ending up in modules and soundcard that uses those symbols as in-build
driver.

Fix these issues by explicitly specifying the dependencies of
SND_SOC_QCOM_COMMON and also use imply a to select SND_SOC_QCOM_COMMON
so that the symbol is selected based on its dependencies.

Also remove dummy stubs in common.c around CONFIG_SOUNDWIRE

Fixes: 3bd975f3ae0a ("ASoC: qcom: sm8250: move some code to common")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221124140351.407506-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: qcom: Add checks for devm_kcalloc
Yuan Can [Thu, 24 Nov 2022 14:05:10 +0000 (14:05 +0000)]
ASoC: qcom: Add checks for devm_kcalloc

As the devm_kcalloc may return NULL, the return value needs to be checked
to avoid NULL poineter dereference.

Fixes: 24caf8d9eb10 ("ASoC: qcom: lpass-sc7180: Add platform driver for lpass audio")
Signed-off-by: Yuan Can <yuancan@huawei.com>
Link: https://lore.kernel.org/r/20221124140510.63468-1-yuancan@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: wm_adsp: Return whether changed when writing controls
Simon Trimmer [Wed, 23 Nov 2022 16:58:11 +0000 (16:58 +0000)]
ASoC: wm_adsp: Return whether changed when writing controls

Functions that update cs_dsp controls need to handle return codes that
indicate whether the control value changed. A return code of 1 indicates
a change, 0 indicates no-change and a negative value is an error
condition.

Acked controls implicitly change value when written so a successful
write shall always report that the value changed.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165811.3014472-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agofirmware: cs_dsp: cs_dsp_coeff_write_ctrl() should report changed
Simon Trimmer [Wed, 23 Nov 2022 16:58:10 +0000 (16:58 +0000)]
firmware: cs_dsp: cs_dsp_coeff_write_ctrl() should report changed

ALSA callers need to know whether there was a change to the value so
that they can report a control write change correctly.

Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221123165811.3014472-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: Intel: hda: read multi-link capabilities earlier
Pierre-Louis Bossart [Fri, 11 Nov 2022 04:26:53 +0000 (12:26 +0800)]
ASoC: SOF: Intel: hda: read multi-link capabilities earlier

There's no reason to delay the multi-link parsing, this can be done
earlier before checking the SoundWire capabilities.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221111042653.45520-9-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agosoundwire: intel_init: remove check on number of links
Pierre-Louis Bossart [Fri, 11 Nov 2022 04:26:52 +0000 (12:26 +0800)]
soundwire: intel_init: remove check on number of links

The number of links is checked with a chip-dependent helper in the
caller, remove the check in drivers/soundwire/intel_init.c

This change makes intel_init.c hardware-agnostic - which is quite
fitting for a layer that only creates auxiliary devices.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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>
Acked-By: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20221111042653.45520-8-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agosoundwire: intel_init: remove sdw_intel_enable_irq()
Pierre-Louis Bossart [Fri, 11 Nov 2022 04:26:51 +0000 (12:26 +0800)]
soundwire: intel_init: remove sdw_intel_enable_irq()

The functionality is implemented with per-chip callbacks, there are no
users of this symbol, remove the code.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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>
Acked-By: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20221111042653.45520-7-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: Intel: hda: add callback to check SoundWire lcount information
Pierre-Louis Bossart [Fri, 11 Nov 2022 04:26:50 +0000 (12:26 +0800)]
ASoC: SOF: Intel: hda: add callback to check SoundWire lcount information

The number of links is stored in different registers depending on the
IP version, add sdw_check_lcount() callback. This callback only checks
that the number of links supported in hardware is compatible with the
number of links exposed in ACPI _DSD properties.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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://lore.kernel.org/r/20221111042653.45520-6-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: Intel: mtl: move SoundWire interrupt enabling to callback
Pierre-Louis Bossart [Fri, 11 Nov 2022 04:26:49 +0000 (12:26 +0800)]
ASoC: SOF: Intel: mtl: move SoundWire interrupt enabling to callback

There's no real rationale for enabling the SoundWire interrupt in the
init, this can be done from the enable_sdw_irq() callback.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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://lore.kernel.org/r/20221111042653.45520-5-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: Intel: mtl: factor interrupt enable/disable interrupt functions
Pierre-Louis Bossart [Fri, 11 Nov 2022 04:26:48 +0000 (12:26 +0800)]
ASoC: SOF: Intel: mtl: factor interrupt enable/disable interrupt functions

The offsets and sequences are identical for interrupt enabling and
disabling, we can refactor the code with a single routine and a
boolean.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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://lore.kernel.org/r/20221111042653.45520-4-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: Intel: hda: add per-chip enable_sdw_irq() callback
Pierre-Louis Bossart [Fri, 11 Nov 2022 04:26:47 +0000 (12:26 +0800)]
ASoC: SOF: Intel: hda: add per-chip enable_sdw_irq() callback

Different generations of Intel hardware rely on different programming
sequences to enable SoundWire IP. In existing hardware, the SoundWire
interrupt is enabled with a register field in the DSP register
space. With HDaudio multi-link extensions registers, the SoundWire
interrupt will be enabled with a generic interrupt enable field in
LCTL, without any dependency on the DSP being enabled.

Add a per-chip callback following the example of the check_sdw_irq()
model already upstream.

Note that the callback is not populated yet for MeteorLake (MTL) since
the interrupts are already enabled in the init. A follow-up patch will
move the functionality to this callback after a couple of cleanups.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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://lore.kernel.org/r/20221111042653.45520-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agosoundwire: intel_init: remove useless interrupt enablement in interrupt thread
Pierre-Louis Bossart [Fri, 11 Nov 2022 04:26:46 +0000 (12:26 +0800)]
soundwire: intel_init: remove useless interrupt enablement in interrupt thread

When the code reaches the SoundWire interrupt thread handling, the
interrupt was enabled already, and there is no code that disables it
-> this is a no-op sequence.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.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>
Acked-By: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20221111042653.45520-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: DSP recovery and resume fixes
Mark Brown [Wed, 23 Nov 2022 12:22:12 +0000 (12:22 +0000)]
ASoC: Intel: avs: DSP recovery and resume fixes

Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

Two fixes that are result of the recent discussions [1][2].

First adds missing locking around snd_pcm_stop() while the second fix
sets substream state to DISCONNECTED if any suspend/resume related
operation fails so that userspace has means to be aware that something
went wrong during said operation.

19 months agoASoC: soc-dai: Do not call snd_soc_link_be_hw_params_fixup() twice
Richard Fitzgerald [Fri, 4 Nov 2022 16:02:52 +0000 (16:02 +0000)]
ASoC: soc-dai: Do not call snd_soc_link_be_hw_params_fixup() twice

For a BE link snd_soc_link_be_hw_params_fixup() is called by
dpcm_be_dai_hw_params() to initialize the params before it passes them
to __soc_pcm_hw_params(). Then __soc_pcm_hw_params() refines params to
match the BE codec and passes that to snd_soc_dai_hw_params().

The second call of snd_soc_link_be_hw_params_fixup() within
snd_soc_dai_hw_params() was overwriting the refined params with the
original BE CPU DAI params. This would then lead to various problems,
for example passing an invalid number of channels to the codec driver
hw_params(), or enabling more AIF widgets on the codec than are actually
mapped by TDM slots.

These errors may not be noticed on a simple 1:1 link between one CPU DAI
and one codec DAI, because most likely they have the same DAI config
(though this is not necessarily true, for example if the CPU end has dummy
TDM slots to achieve a desirable BCLK).

For 1:N mappings there are likely to be multiple codecs using different
subsets of the TDM slots and this overwriting of the refined params
can cause incorrect configuration of each codec on the link.

The erroneous extra call to the BE fixup function() was introduced
by:
commit a655de808cbd ("ASoC: core: Allow topology to override machine
driver FE DAI link config.")

at that time, the call to the BE fixup was already done by
dpcm_be_dai_hw_params(), which was introduced several years earlier
by:
commit 01d7584cd2e5 ("ASoC: dpcm: Add Dynamic PCM core operations.")

The erroneous code has changed and moved to a different source file
since the patch that introduced it, so this fix patch won't directly
apply as a fix on top of code older than:
commit 8b4ba1d31771 ("ASoC: soc-dai: fix up hw params only if it is
needed")

though it can be applied with some minor adjustment to code before
that patch but after:
commit aa6166c2ac28 ("ASoC: soc-dai: mv soc_dai_hw_params() to soc-dai")

On any tree older than that the code is in soc-pcm.c.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221104160252.166114-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: wm_adsp: Allow client to hook into pre_run callback
Richard Fitzgerald [Wed, 9 Nov 2022 16:53:29 +0000 (16:53 +0000)]
ASoC: wm_adsp: Allow client to hook into pre_run callback

Some HALO-based codecs need some additional custom setup in the
pre_run stage of cs_dsp. Implement the callback in wm_adsp to call
an optional codec driver callback.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221109165331.29332-11-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: Disconnect substream if suspend or resume fails
Cezary Rojewski [Wed, 16 Nov 2022 11:55:50 +0000 (12:55 +0100)]
ASoC: Intel: avs: Disconnect substream if suspend or resume fails

To improve performance and overall system stability, suspend/resume
operations for ASoC cards always return success status and defer the
actual work.

Because of that, if a substream fails to resume, userspace may still
attempt to invoke commands on it as from their perspective the operation
completed successfully. Set substream's state to DISCONNECTED to ensure
no further commands are attempted.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221116115550.1100398-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: Lock substream before snd_pcm_stop()
Cezary Rojewski [Wed, 16 Nov 2022 11:55:49 +0000 (12:55 +0100)]
ASoC: Intel: avs: Lock substream before snd_pcm_stop()

snd_pcm_stop() shall be called with stream lock held to prevent any
races between nonatomic streaming operations.

Fixes: 2f1f570cd730 ("ASoC: Intel: avs: Coredump and recovery flow")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221116115550.1100398-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: Add missing audio amplifier for KBL
Alicja Michalska [Mon, 21 Nov 2022 23:20:40 +0000 (00:20 +0100)]
ASoC: Intel: avs: Add missing audio amplifier for KBL

KBL platform is missing the definition of 'max98357a' audio amplifier.
This amplifier is used on many KBL Chromebooks, for instance variant
'nami' of 'Google/poppy' baseboard.

Reported-by: CoolStar <coolstarorganization@gmail.com>
Signed-off-by: Alicja Michalska <ahplka19@gmail.com>
Link: https://lore.kernel.org/r/Y3wHyJ/EcsLRHGr3@tora
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: add Dell SKU 0C11 support
Mark Brown [Tue, 22 Nov 2022 15:20:52 +0000 (15:20 +0000)]
ASoC: Intel: add Dell SKU 0C11 support

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

Add Dell SKU 0C11 support with rt1318 codec.

19 months agoASoC: Intel: soc-acpi: add SKU 0C11 SoundWire configuration
Gongjun Song [Thu, 17 Nov 2022 00:27:58 +0000 (08:27 +0800)]
ASoC: Intel: soc-acpi: add SKU 0C11 SoundWire configuration

Audio hardware configuration of SKU 0C11 product is rt711 on link0,
two rt1318s on link1 and link2, rt714 on link3

Signed-off-by: Gongjun Song <gongjun.song@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221117002758.496211-4-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: sof_sdw: Add support for SKU 0C11 product
Gongjun Song [Thu, 17 Nov 2022 00:27:57 +0000 (08:27 +0800)]
ASoC: Intel: sof_sdw: Add support for SKU 0C11 product

SKU 0C11 product supports a SoundWire headset codec, SoundWire
capture from local microphones and two SoundWire amplifiers.

Signed-off-by: Gongjun Song <gongjun.song@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221117002758.496211-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: intel: sof_sdw: add rt1318 codec support.
Gongjun Song [Thu, 17 Nov 2022 00:27:56 +0000 (08:27 +0800)]
ASoC: intel: sof_sdw: add rt1318 codec support.

Add rt1318 sdca codec support in sof_sdw machine driver.

Signed-off-by: Gongjun Song <gongjun.song@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221117002758.496211-2-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: Skylake: Fix Kconfig dependency
Lili Li [Mon, 21 Nov 2022 10:47:42 +0000 (18:47 +0800)]
ASoC: Intel: Skylake: Fix Kconfig dependency

Commit e4746d94d00c ("ASoC: Intel: Skylake: Introduce HDA codec init and
exit routines") introduced HDA codec init routine which depends on SND_HDA.
Select SND_SOC_HDAC_HDA unconditionally to fix following compile error:
ERROR: modpost: "snd_hda_codec_device_init" [sound/soc/intel/skylake/snd-soc-skl.ko] undefined!

Fixes: e4746d94d00c ("ASoC: Intel: Skylake: Introduce HDA codec init and exit routines")
Reviewed-by: Junxiao Chang <junxiao.chang@intel.com>
Suggested-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Lili Li <lili.li@intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221121104742.1007486-1-lili.li@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: nau8825: Add a manually mechanism for detection failure
David Lin [Tue, 22 Nov 2022 07:38:56 +0000 (15:38 +0800)]
ASoC: nau8825: Add a manually mechanism for detection failure

This patch is to use saradc to check the jack type when auto
detection is still failure.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20221122073855.43024-2-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: nau8825: Adjust internal clock during jack detection
David Lin [Tue, 22 Nov 2022 07:38:55 +0000 (15:38 +0800)]
ASoC: nau8825: Adjust internal clock during jack detection

This patch is to rasie up internal clock during jack detection.
The fast clock will accelerate charge and discharge effect.
So this mechanism will make jack detection more robust.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Link: https://lore.kernel.org/r/20221122073855.43024-1-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: sof_sdw: Add support for SKU 0C4F product
Gongjun Song [Tue, 22 Nov 2022 05:20:52 +0000 (13:20 +0800)]
ASoC: Intel: sof_sdw: Add support for SKU 0C4F product

SKU 0C4F product supports a SoundWire headset codec, SoundWire
capture from local microphones and two SoundWire amplifiers.

Signed-off-by: Gongjun Song <gongjun.song@intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221122052052.687281-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: core: Exit all links before removing their components
Cezary Rojewski [Thu, 27 Oct 2022 08:58:40 +0000 (10:58 +0200)]
ASoC: core: Exit all links before removing their components

Flows leading to link->init() and link->exit() are not symmetric.
Currently the relevant part of card probe sequence goes as:

for_each_card_rtds(card, rtd)
for_each_rtd_components(rtd, i, component)
component->probe()
for_each_card_rtds(card, rtd)
for_each_rtd_dais(rtd, i, dai)
dai->probe()
for_each_card_rtds(card, rtd)
rtd->init()

On the other side, equivalent remove sequence goes as:

for_each_card_rtds(card, rtd)
for_each_rtd_dais(rtd, i, dai)
dai->remove()
for_each_card_rtds(card, rtd)
for_each_rtd_components(rtd, i, component)
component->remove()
for_each_card_rtds(card, rtd)
rtd->exit()

what can lead to errors as link->exit() may still operate on resources
owned by its components despite the probability of them being freed
during the component->remove().

This change modifies the remove sequence to:

for_each_card_rtds(card, rtd)
rtd->exit()
for_each_card_rtds(card, rtd)
for_each_rtd_dais(rtd, i, dai)
dai->remove()
for_each_card_rtds(card, rtd)
for_each_rtd_components(rtd, i, component)
component->remove()

so code found in link->exit() is safe to touch any component stuff as
component->remove() has not been called yet.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/20221027085840.1562698-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: mchp-spdiftx: add power saving features
Mark Brown [Fri, 18 Nov 2022 15:13:50 +0000 (15:13 +0000)]
ASoC: mchp-spdiftx: add power saving features

Merge series from Claudiu Beznea <claudiu.beznea@microchip.com>:

This series adds support for runtime PM and system suspend/resume
for Microchip SPDIFTX (patches 2/3, 3/3). Along with it I took the
chance and added a minor cleanup (patch 1/3).

19 months agoASoC: Intel: sof_sdw_amp: mark coeff tables with __maybe_unused
Pierre-Louis Bossart [Fri, 18 Nov 2022 01:51:06 +0000 (09:51 +0800)]
ASoC: Intel: sof_sdw_amp: mark coeff tables with __maybe_unused

The same file provides two tables used in separate drivers, make them
as __maybe_unused to avoid errors:

sound/soc/intel/boards/sof_sdw_amp_coeff_tables.h:163:17: error:
‘dell_0b00_bq_params’ defined but not used
[-Werror=unused-const-variable=]
  163 | static const u8 dell_0b00_bq_params[] = {

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20221118015106.532302-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: avs: Initialize private data for subsequent HDA FEs
Cezary Rojewski [Fri, 18 Nov 2022 11:30:52 +0000 (12:30 +0100)]
ASoC: Intel: avs: Initialize private data for subsequent HDA FEs

HDAudio implementation found in sound/pci/hda expects a valid stream
pointer in substream->runtime->private_data location. For ASoC users,
that should point to a valid link stream which is assigned when BE
opens.

As BE borrows its runtime from FE, the information may be lost when
reparenting comes into picture - see dpcm_be_reparent(). To support the
DPCM reparenting functionality for HDAudio scenarios while still
fulfilling expectations of HDAudio common code, have all FEs point to
the same private data.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221118113052.1340593-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: mchp-spdiftx: add support for system suspend/resume
Claudiu Beznea [Thu, 17 Nov 2022 12:37:50 +0000 (14:37 +0200)]
ASoC: mchp-spdiftx: add support for system suspend/resume

Add support for system suspend/resume by moving the enable/disable
of interrupts in mchp_spdiftx_trigger() on SNDRV_PCM_TRIGGER_SUSPEND/
SNDRV_PCM_TRIGGER_RESUME commands.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20221117123750.291911-4-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: mchp-spdiftx: add runtime pm support
Claudiu Beznea [Thu, 17 Nov 2022 12:37:49 +0000 (14:37 +0200)]
ASoC: mchp-spdiftx: add runtime pm support

Add runtime PM support for Microchip SPDIFTX driver. The runtime PM
APIs disables/enables IP's clock and enables/disable caching for
regmap.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20221117123750.291911-3-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: mchp-spdiftx: simplify locking around ctrl->ch_stat
Claudiu Beznea [Thu, 17 Nov 2022 12:37:48 +0000 (14:37 +0200)]
ASoC: mchp-spdiftx: simplify locking around ctrl->ch_stat

Use a temporary variable to keep the AES3 value. With this a
spin_unlock_irqrestore() call has been removed from the final code.

Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Link: https://lore.kernel.org/r/20221117123750.291911-2-claudiu.beznea@microchip.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: dt-bindings: sun50i-dmic: Add D1 compatible string
Samuel Holland [Wed, 16 Nov 2022 03:46:21 +0000 (21:46 -0600)]
ASoC: dt-bindings: sun50i-dmic: Add D1 compatible string

The Allwinner D1 SoC has a DMIC codec like the one in the H6. It appears
to be register-compatible with the H6 variant, and the existing Linux
driver has been tested on a D1-based board, the Lichee RV 86 Panel.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Acked-by: Ban Tao <fengzheng923@gmail.com>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221116034621.37762-1-samuel@sholland.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: amd: acp: Fix possible UAF in acp_dma_open
Gaosheng Cui [Fri, 18 Nov 2022 03:00:56 +0000 (11:00 +0800)]
ASoC: amd: acp: Fix possible UAF in acp_dma_open

Smatch report warning as follows:

sound/soc/amd/acp/acp-platform.c:199 acp_dma_open() warn:
  '&stream->list' not removed from list

If snd_pcm_hw_constraint_integer() fails in acp_dma_open(),
stream will be freed, but stream->list will not be removed from
adata->stream_list, then list traversal may cause UAF.

Fix by adding the newly allocated stream to the list once it's fully
initialised.

Fixes: 7929985cfe36 ("ASoC: amd: acp: Initialize list to store acp_stream during pcm_open")
Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
Link: https://lore.kernel.org/r/20221118030056.3135960-1-cuigaosheng1@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: Intel: sof_nau8825: support rt1015p speaker amplifier
Brent Lu [Thu, 17 Nov 2022 23:19:19 +0000 (17:19 -0600)]
ASoC: Intel: sof_nau8825: support rt1015p speaker amplifier

Add rt1015p speaker amplifier support with a new board info
'adl_rt1015p_nau8825' which supports NAU8825 on SSP0 and ALC1015Q on
SSP1.

Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Brent Lu <brent.lu@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20221117231919.112483-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: SOF: probes: Check ops before memory allocation
Andy Shevchenko [Thu, 17 Nov 2022 10:32:23 +0000 (12:32 +0200)]
ASoC: SOF: probes: Check ops before memory allocation

We may check ops before spending resources on memory allocation.
While at it, utilize dev_get_platdata() helper.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20221117103223.74425-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: codecs: wsa883x: Simplify with dev_err_probe
Krzysztof Kozlowski [Wed, 9 Nov 2022 16:37:59 +0000 (17:37 +0100)]
ASoC: codecs: wsa883x: Simplify with dev_err_probe

Code can be a bit simpler with dev_err_probe().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221109163759.1158837-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
19 months agoASoC: codecs: wsa883x: Shutdown on error path
Krzysztof Kozlowski [Wed, 9 Nov 2022 16:37:58 +0000 (17:37 +0100)]
ASoC: codecs: wsa883x: Shutdown on error path

If probe fails, toggle shutdown via GPIO to save power and reverse
probe actions.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20221109163759.1158837-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>