Commit graph

998079 commits

Author SHA1 Message Date
Jerome Brunet a0695853e5
ASoC: stm32: do not request a new clock consummer reference
This reverts commit 65d1cce726.

There is problem with clk_hw_get_hw(). Using it pins the clock provider to
itself, making it impossible to remove the module.

Revert commit 65d1cce726 ("ASoC: stm32: properly get clk from the
provider") until this gets sorted out.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210428122632.46244-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-28 16:34:53 +01:00
Marco Felsch 6c9762a78c
ASoC: max98088: fix ni clock divider calculation
The ni1/ni2 ratio formula [1] uses the pclk which is the prescaled mclk.
The max98088 datasheet [2] has no such formula but table-12 equals so
we can assume that it is the same for both devices.

While on it make use of DIV_ROUND_CLOSEST_ULL().

[1] https://datasheets.maximintegrated.com/en/ds/MAX98089.pdf; page 86
[2] https://datasheets.maximintegrated.com/en/ds/MAX98088.pdf; page 82

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.kernel.org/r/20210423135402.32105-1-m.felsch@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-26 13:44:46 +01:00
Mark Brown 25c4a9b614
ASoC: simple-card: Fix breakage on kontron-sl28-var3-ads2
A KernelCI bisection identified 59c35c44a9 "ASoC: simple-card: add
simple_parse_node()" as causing simple-card to fail to instantiate on
kontron-sl28-var3-ads2 systems.  Since the merge window is expected to
open over the weekend drop that commit and subsequent ones which depend
on it for now in case other systems are affected too.

The boot log showed the error as:

<4>[    9.948821] sysfs: cannot create duplicate filename '/devices/platform/sound/(null)-wm8904-hifi'

(backtrace)

<3>[   10.191982] kobject_add_internal failed for (null)-wm8904-hifi with -EEXIST, don't try to register things with the same name in the same directory.

The dropped commits are:

73371bacf0 "ASoC: audio-graph: tidyup graph_dai_link_of_dpcm()"
434392271a "ASoC: simple-card: add simple_link_init()"
59c35c44a9 "ASoC: simple-card: add simple_parse_node()"

Reported-by: Guillaume Tucker <guillaume.tucker@collabora.com>
Reported-by: "kernelci.org bot" <bot@kernelci.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 18:13:32 +01:00
Shuming Fan a1aee7f7b7
ASoC: rt711-sdca: add the notification when volume changed
This patch adds the return value when the volume settings were changed.
The userspace application might monitor the kcontrols to check which control changed.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20210422103235.22048-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 15:36:12 +01:00
Shuming Fan ca5118c0c0
ASoC: rt711-sdca: change capture switch controls
The DAPM event and mixer control could mute/unmute the capture directly.
That will be confused that capture still works if the user settings is unmute before the capture.
Therefore, this patch uses the variables to record the capture switch status of DAPM and mixer.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20210422103220.21987-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 15:36:11 +01:00
Jerome Brunet 12f8127fe9
ASoC: da7219: properly get clk from the provider
Instead of using the clk embedded in the clk_hw (which is meant to go
away), a clock provider which need to interact with its own clock should
request clk reference through the clock provider API.

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-6-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 13:16:27 +01:00
Jerome Brunet 27dc72b44e
ASoC: lpass: use the clock provider API
Clock providers should be registered using the clk_hw API.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-5-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 13:16:26 +01:00
Jerome Brunet 8691743c51
ASoC: rt5682: clock driver must use the clock provider API
Clock drivers ops should not call the clk API but the clock provider
(clk_hw) instead.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-4-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 13:16:25 +01:00
Jerome Brunet 104c3a9ed0
ASoC: wcd934x: use the clock provider API
Clock providers should use the clk_hw API

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-3-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 13:16:24 +01:00
Jerome Brunet 65d1cce726
ASoC: stm32: properly get clk from the provider
Instead of using the clk embedded in the clk_hw (which is meant to go
away), a clock provider which need to interact with its own clock should
request clk reference through the clock provider API.

Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20210421120512.413057-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-23 13:16:23 +01:00
Arnd Bergmann ccd4cc3ed0
ASoC: tegra: mark runtime-pm functions as __maybe_unused
A reorganization of the driver source led to two of them causing
a compile time warning in some configurations:

tegra/tegra20_spdif.c:36:12: error: 'tegra20_spdif_runtime_resume' defined but not used [-Werror=unused-function]
   36 | static int tegra20_spdif_runtime_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
tegra/tegra20_spdif.c:27:12: error: 'tegra20_spdif_runtime_suspend' defined but not used [-Werror=unused-function]
   27 | static int tegra20_spdif_runtime_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tegra/tegra30_ahub.c:64:12: error: 'tegra30_ahub_runtime_resume' defined but not used [-Werror=unused-function]
   64 | static int tegra30_ahub_runtime_resume(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~
tegra/tegra30_ahub.c:43:12: error: 'tegra30_ahub_runtime_suspend' defined but not used [-Werror=unused-function]
   43 | static int tegra30_ahub_runtime_suspend(struct device *dev)
      |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Mark these functions as __maybe_unused to avoid this kind of warning.

Fixes: b5571449e6 ("ASoC: tegra30: ahub: Remove handing of disabled runtime PM")
Fixes: c53b396f0d ("ASoC: tegra20: spdif: Remove handing of disabled runtime PM")
Fixes: 80ec4a4cb3 ("ASoC: tegra20: i2s: Remove handing of disabled runtime PM")
Fixes: b5f6f781fc ("ASoC: tegra30: i2s: Remove handing of disabled runtime PM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210422133418.1757893-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-22 16:27:37 +01:00
Kuninori Morimoto 73371bacf0
ASoC: audio-graph: tidyup graph_dai_link_of_dpcm()
Use local variable at local area only.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6psi417.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:50:51 +01:00
Kuninori Morimoto 434392271a
ASoC: simple-card: add simple_link_init()
This patch adds simple_link_init() and share dai_link setting code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bla8i41b.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:50:50 +01:00
Kuninori Morimoto 59c35c44a9
ASoC: simple-card: add simple_parse_node()
Parse dai/tdm/clk are common for both CPU/Codec node.
This patch creates simple_parse_node() for it and share the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87czuoi41f.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:50:49 +01:00
Kuninori Morimoto e51237b8d3
ASoC: audio-graph: add graph_link_init()
This patch adds graph_link_init() and share dai_link setting code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87eef4i41k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:50:48 +01:00
Kuninori Morimoto 8859f809c7
ASoC: audio-graph: add graph_parse_node()
Parse mclk_fs/dai/tdm/clk are common for both CPU/Codec node.
This patch creates graph_parse_node() for it and share the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fszki426.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-21 15:50:47 +01:00
Mark Brown 23b16df6c9
Merge series "ASoC: audio-graph: cleanups" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

These patches cleanups audio-graph.
This is part of prepare for new audio-graph-card2.

Kuninori Morimoto (6):
  ASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.c
  ASoC: audio-graph: move audio_graph_remove() to simple-card-utils.c
  ASoC: audio-graph: check ports if exists
  ASoC: audio-graph: remove "audio-graph-card," preix support
  ASoC: audio-graph: remove unused "node" from graph_parse_mclk_fs()
  ASoC: audio-graph: remove Platform support

 include/sound/graph_card.h               |  4 --
 include/sound/simple_card_utils.h        |  3 ++
 sound/soc/generic/audio-graph-card.c     | 52 ++++--------------------
 sound/soc/generic/simple-card-utils.c    | 25 ++++++++++++
 sound/soc/generic/simple-card.c          |  7 ----
 sound/soc/tegra/tegra_audio_graph_card.c |  4 +-
 6 files changed, 38 insertions(+), 57 deletions(-)

--
2.25.1

Thank you for your help !!

Best regards
---
Kuninori Morimoto
2021-04-20 19:30:50 +01:00
Viorel Suman 7342db3cdd
ASoC: ak4458: enable daisy chain
Enable Daisy Chain if in TDM mode and the number of played
channels is bigger than the maximum supported number of channels.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1618915453-29445-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:51 +01:00
Kuninori Morimoto 63f2f9cceb
ASoC: audio-graph: remove Platform support
Platform was one of mandatory component on ASoC before,
and audio-graph-card was assuming that CPU and Platform were
same driver.

But it is no longer mandatory on ASoC.
Current ASoC will just ignore if Platform and CPU were same
or doplicated component.

Of course ASoC is supporting Platform, but current
audio-graph-card doesn't support detecting it from DT.

This means current audio-graph-card operation for Platform so far
is 100% useless. This patch removes it.
We can respawn it when we need it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sg3n3ubg.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:49 +01:00
Kuninori Morimoto 67800ae939
ASoC: audio-graph: remove unused "node" from graph_parse_mclk_fs()
graph_parse_mclk_fs() has "node", but is not used.
This patch removes unused "node"

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tuo33ubl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:48 +01:00
Kuninori Morimoto 14d78d74d7
ASoC: audio-graph: remove "audio-graph-card, " preix support
No upstream code is using "audio-graph-card," preix,
and Yaml base Document doesn't indicate it.
Let's remove it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v98j3ubp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:47 +01:00
Kuninori Morimoto 6769ea1e43
ASoC: audio-graph: check ports if exists
"endpoint" and "port" are always exists, but there is no guarantee
for "ports". This patch checks "ports" if exists, otherwise,
it might set un-expected settings.

This patch also do align to 100 char in 1 line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wnsz3ubu.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:46 +01:00
Kuninori Morimoto f6fcc820e0
ASoC: audio-graph: move audio_graph_remove() to simple-card-utils.c
audio-graph-card2 can reuse  audio_graph_remove() / asoc_simple_remove().
This patch moves it to simple-card-utils.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y2df3uby.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:45 +01:00
Kuninori Morimoto 1a456b1c6b
ASoC: audio-graph: move audio_graph_card_probe() to simple-card-utils.c
audio-graph-card2 can reuse audio_graph_card_probe().
This patch moves it to simple-card-utils.c.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgxv3uc4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 17:25:44 +01:00
Thierry Reding ec1af6c64d
ASoC: simple-card-utils: Allocate link info structure on heap
struct link_info can grow fairly large and may cause the stack frame
size to be exceeded when allocated on the stack. Some architectures
such as 32-bit ARM, RISC-V or PowerPC have small stack frames where
this causes a compiler warning, so allocate these structures on the
heap instead of the stack.

Fixes: 343e55e718 ("ASoC: simple-card-utils: Increase maximum number of links to 128")
Reported-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20210419164117.1422242-1-thierry.reding@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 13:47:30 +01:00
Jack Yu 7f51384f17
ASoC: rt1015p: add support on format S32_LE
Add support on format S32_LE for rt1015p.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/377f0ee05d514c66b567eb6385ac7753@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-20 13:47:29 +01:00
Mark Brown 4b1013f407
Merge series "ASoC: rt286/rt298: Fixes for DMIC2 config and combo jack" from David Ward <david.ward@gatech.edu>:
The last two patches in this series fix a longstanding issue that prevented
the ALC3263 codec from using a headset mic. This codec can be found on Dell
systems including the Latitude 13 7350, Venue 11 Pro 7140, and XPS 13 9343.
In fact, there is an ACPI quirk for the XPS 13 9343, which forces it to use
legacy HD Audio just to avoid this issue:

https://lore.kernel.org/alsa-devel/CAPeXnHv07HkvcHrYFmZMr8OTp7U7F=k_k=LPYnUtp89iPn2d2Q@mail.gmail.com/

This may allow that ACPI quirk to be removed. Either way, the other systems
mentioned above do not support this quirk and already use the ASoC driver,
so this fix is necessary for headset mic support on those systems.

Note: there is likely other handling for this codec that only exists in the
HDA driver, but which also belongs in the ASoC driver. Commit 394c97f824
("ALSA: hda/realtek - Change EAPD to verb control") describes an issue that
does not seem to be resolved in the ASoC driver, to give an example.

Other patches in this series are not specific to the ALC3263. These patches
set the correct combo jack configuration when headphones are inserted, and
fix a misaligned value set in the DMIC2 Configuration Default register.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=114171
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=150601
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205961
Signed-off-by: David Ward <david.ward@gatech.edu>

David Ward (5):
  ASoC: rt286: Fix upper byte in DMIC2 configuration
  ASoC: rt286: Configure combo jack for headphones
  ASoC: rt298: Configure combo jack for headphones
  ASoC: rt286: Make RT286_SET_GPIO_* readable and writable
  ASoC: rt286: Generalize support for ALC3263 codec

 sound/soc/codecs/rt286.c | 34 +++++++++++++++++++++-------------
 sound/soc/codecs/rt298.c |  9 +++++++--
 2 files changed, 28 insertions(+), 15 deletions(-)

--
2.31.1
2021-04-19 18:18:45 +01:00
David Ward aa2f9c1282
ASoC: rt286: Generalize support for ALC3263 codec
The ALC3263 codec on the XPS 13 9343 is also found on the Latitude 13 7350
and Venue 11 Pro 7140. They require the same handling for the combo jack to
work with a headset: GPIO pin 6 must be set.

The HDA driver always sets this pin on the ALC3263, which it distinguishes
by the codec vendor/device ID 0x10ec0288 and PCI subsystem vendor ID 0x1028
(Dell). The ASoC driver does not use PCI, so adapt this check to use DMI to
determine if Dell is the system vendor.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=150601
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=205961
Signed-off-by: David Ward <david.ward@gatech.edu>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210418134658.4333-6-david.ward@gatech.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 16:53:25 +01:00
David Ward f3bd4dde9f
ASoC: rt298: Configure combo jack for headphones
During jack detection, the combo jack is configured for a CTIA headset, and
then for an OMTP headset, while sensing the mic connection. If a mic is not
found in either case, the combo jack should be re-configured for headphones
only. This is consistent with the HDA driver behavior.

Signed-off-by: David Ward <david.ward@gatech.edu>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210418134658.4333-4-david.ward@gatech.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 16:53:24 +01:00
David Ward b15c3ea7e0
ASoC: rt286: Configure combo jack for headphones
During jack detection, the combo jack is configured for a CTIA headset, and
then for an OMTP headset, while sensing the mic connection. If a mic is not
found in either case, the combo jack should be re-configured for headphones
only. This is consistent with the HDA driver behavior.

Signed-off-by: David Ward <david.ward@gatech.edu>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210418134658.4333-3-david.ward@gatech.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 16:53:23 +01:00
Niklas Carlsson 11a9b98761
ASoC: sigmadsp: Disable cache mechanism for readbacks
The ALSA control readback functionality only works for non-volatile
controls, i.e. control values that does not change on their own without
driver interaction.

This doesn't work for readbacks since the DSP firmware updates the
control value. Disable the cache mechanism in the driver if the control
name matches the prefix used for readbacks to ensure that the control
value is valid.

Signed-off-by: Niklas Carlsson <niklasc@axis.com>
Link: https://lore.kernel.org/r/20210419144901.9441-1-Niklas.Carlsson@axis.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 16:51:52 +01:00
David Ward cd8499d5c0
ASoC: rt286: Make RT286_SET_GPIO_* readable and writable
The GPIO configuration cannot be applied if the registers are inaccessible.
This prevented the headset mic from working on the Dell XPS 13 9343.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=114171
Signed-off-by: David Ward <david.ward@gatech.edu>
Link: https://lore.kernel.org/r/20210418134658.4333-5-david.ward@gatech.edu
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 16:51:10 +01:00
David Ward dfa7b01dbd
ASoC: rt286: Fix upper byte in DMIC2 configuration
This HDA verb sets the upper byte of the Configuration Default register, so
only an 8-bit value should be used. For the rt298, the same fix was applied
in commit f8f2dc4a71 ("ASoC: rt298: fix wrong setting of gpio2_en").

Signed-off-by: David Ward <david.ward@gatech.edu>
Link: https://lore.kernel.org/r/20210418134658.4333-2-david.ward@gatech.edu
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 16:51:00 +01:00
Mark Brown 87143bfdb9
Merge series "ASoC: remove more cppcheck warnings" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
I missed those warnings in the previous rounds, they are mostly
trivial and shouldn't change the behavior.

Pierre-Louis Bossart (5):
  ASoC: soc-acpi: remove useless initialization
  ASoC: soc-core: fix signed/unsigned issue
  ASoC: soc-core: fix always-false condition
  ASoC: codecs: lpass-rx-macro: remove useless return
  ASoC: codecs: rt5682: clarify expression

 sound/soc/codecs/lpass-rx-macro.c | 2 --
 sound/soc/codecs/rt5682.c         | 2 +-
 sound/soc/soc-acpi.c              | 2 +-
 sound/soc/soc-core.c              | 7 +------
 4 files changed, 3 insertions(+), 10 deletions(-)

--
2.25.1
2021-04-19 16:21:45 +01:00
Viorel Suman e86a53fb64
ASoC: ak4458: check reset control status
check the return value of ak4458_rstn_control.

Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1618826072-29344-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 14:03:34 +01:00
Pierre-Louis Bossart 9726db36ed
ASoC: codecs: rt5682: clarify expression
cppcheck warning:

sound/soc/codecs/rt5682.c:2404:42: style: Boolean result is used in
bitwise operation. Clarify expression with
parentheses. [clarifyCondition]
   (pll_code.m_bp << RT5682_PLL_M_BP_SFT | RT5682_PLL_RST));
                                         ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 14:03:32 +01:00
Pierre-Louis Bossart 36924a12c3
ASoC: codecs: lpass-rx-macro: remove useless return
cppcheck warning:

sound/soc/codecs/lpass-rx-macro.c:1626:9: warning: Identical condition
and return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/codecs/lpass-rx-macro.c:1623:6: note: If condition 'ret' is
true, the function will return/exit
 if (ret)
     ^
sound/soc/codecs/lpass-rx-macro.c:1626:9: note: Returning identical
expression 'ret'
 return ret;
        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 14:03:32 +01:00
Pierre-Louis Bossart e2290daefe
ASoC: soc-core: fix always-false condition
cppcheck warning:

sound/soc/soc-core.c:2784:6: style: Condition '!num_routes' is always
false [knownConditionTrueFalse]
 if (!num_routes) {
     ^
sound/soc/soc-core.c:2777:17: note: Assuming that condition
'num_routes<0' is not redundant
 if (num_routes < 0 || num_routes & 1) {
                ^
sound/soc/soc-core.c:2783:2: note: Compound assignment '/=', assigned
value is 0
 num_routes /= 2;
 ^
sound/soc/soc-core.c:2784:6: note: Condition '!num_routes' is always
false
 if (!num_routes) {
     ^

The documentation for of_property_count_string reads

"
 * Returns the number of strings on
 * success, -EINVAL if the property does not exist, -ENODATA if property
 * does not have a value, and -EILSEQ if the string is not null-terminated
 * within the length of the property data.
"

Since the case for num_routes == 0 is not possible, let's remove this
test.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 14:03:31 +01:00
Pierre-Louis Bossart d3b47a888f
ASoC: soc-core: fix signed/unsigned issue
cppcheck warning:

sound/soc/soc-core.c:2237:13: warning: %x in format string (no. 1)
requires 'unsigned int *' but the argument type is 'signed
int *'. [invalidScanfArgType_int]
 } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) {
            ^
sound/soc/soc-core.c:2237:13: warning: %x in format string (no. 2)
requires 'unsigned int *' but the argument type is 'signed
int *'. [invalidScanfArgType_int]
 } else if (sscanf(name, "%x-%x", &id1, &id2) == 2) {
            ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 14:03:30 +01:00
Pierre-Louis Bossart 59ce3233a5
ASoC: soc-acpi: remove useless initialization
cppcheck warning:

value that is never used. [unreadVariable]
 acpi_status status = AE_OK;
                    ^

sound/soc/soc-acpi.c:37:21: style: Variable 'status' is assigned a
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Link: https://lore.kernel.org/r/20210416191144.27006-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-19 14:03:29 +01:00
Rob Herring d63f2a88d5
ASoC: mt6359: Drop ASoC mt6359 ASoC accdet jack document
This reverts commit e61c589587.

The binding document has lots of schema errors and there's been no
effort to fix them, so let's remove it.

Cc: Argus Lin <argus.lin@mediatek.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: alsa-devel@alsa-project.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20210416180118.3662904-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 19:30:07 +01:00
Jack Yu fa2f98378f
ASoC: rt715: remove kcontrols which no longer be used
Using new kcontrols "Capture Switch" and "Capture Volume" instead,
remove kcontrols which no longer be used.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/5c314f5512654aca9fff0195f77264de@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 17:20:01 +01:00
Jack Yu dcca646c49
ASoC: rt715: add main capture switch and main capture volume
Add main capture switch and main capture volume control.
Main capture control has its own channel value respectivelly.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/dfd43a8db04e4d52a889d6f5c1262173@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 17:20:00 +01:00
Jack Yu a48f928e13
ASoC: rt715: modification for code simplicity
Modification for code simplicity.

Signed-off-by: Jack Yu <jack.yu@realtek.com>
Link: https://lore.kernel.org/r/340ee2df83ce47fcb1b59541b12ba7f4@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 17:19:59 +01:00
Mark Brown 7ae6af4131
Merge series "ASoC: Intel: add new TGL/ADL configurations" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
Very little code but quite a few descriptors to add TigerLake (TGL)
/AlderLake (ADL) ACPI match tables for I2S and SoundWire devices, new
dailinks for Bluetooth offload. Some day this will be read from
platform firmware.

Also clarify how microphones are handled for SoundWire devices, and
create modules to avoid linking the same code multiple times.

Pierre-Louis Bossart (5):
  ASoC: Intel: soc-acpi: add ADL SoundWire base configurations
  ASoC: Intel: soc-acpi: add ADL jack-less SoundWire configurations
  ASoC: Intel: sof_sdw: add mutual exclusion between PCH DMIC and RT715
  ASoC: Intel: boards: handle hda-dsp-common as a module
  ASoC: Intel: boards: create sof-maxim-common module

Vamshi Krishna Gopal (3):
  ASoC: Intel: soc-acpi: add entries for i2s machines in ADL match table
  ASoC: Intel: sof_sdw: add quirk for new ADL-P Rvp
  ASoC: Intel: boards: add support for adl boards in sof-rt5682

Yong Zhi (1):
  ASoC: Intel: Boards: tgl_max98373: Add BT offload support

 sound/soc/intel/boards/Kconfig                |  18 ++
 sound/soc/intel/boards/Makefile               |  28 +-
 sound/soc/intel/boards/bxt_da7219_max98357a.c |   1 +
 sound/soc/intel/boards/bxt_rt298.c            |   1 +
 sound/soc/intel/boards/cml_rt1011_rt5682.c    |   1 +
 sound/soc/intel/boards/ehl_rt5660.c           |   1 +
 sound/soc/intel/boards/glk_rt5682_max98357a.c |   1 +
 sound/soc/intel/boards/hda_dsp_common.c       |   5 +
 sound/soc/intel/boards/skl_hda_dsp_generic.c  |   1 +
 sound/soc/intel/boards/sof_da7219_max98373.c  |   1 +
 sound/soc/intel/boards/sof_maxim_common.c     |  24 +-
 sound/soc/intel/boards/sof_maxim_common.h     |   6 +-
 sound/soc/intel/boards/sof_pcm512x.c          |   1 +
 sound/soc/intel/boards/sof_rt5682.c           |  67 ++++-
 sound/soc/intel/boards/sof_sdw.c              |  32 ++-
 sound/soc/intel/boards/sof_sdw_common.h       |   1 +
 sound/soc/intel/boards/sof_sdw_max98373.c     |   4 +-
 .../intel/common/soc-acpi-intel-adl-match.c   | 249 ++++++++++++++++++
 18 files changed, 415 insertions(+), 27 deletions(-)

--
2.25.1
2021-04-16 16:55:32 +01:00
Mark Brown ac22cf5252
Merge series "ASoC: soc-pcm: ignore dummy-DAI at soc_pcm_params_symmetry()" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

I noticed if we have...

	1) Sound Card used DPCM
	2) It exchanges rate to 48kHz by using .be_hw_params_fixup()
	3) Codec had symmetric_rate = 1

We will get below error.
I didn't confirm, but maybe same things happen
if it exchanged channels/sample_bits.

	# aplay 44100.wav
	# aplay 44100.wav
=>	[kernel] be.ak4613-hifi: ASoC: unmatched rate symmetry: snd-soc-dummy-dai:44100 - soc_pcm_params_symmetry:48000
	[kernel] be.ak4613-hifi: ASoC: hw_params BE failed -22
	[kernel] fe.rsnd-dai.0: ASoC: hw_params BE failed -22
	aplay: set_params:1407: Unable to install hw params:
	ACCESS:  RW_INTERLEAVED
	FORMAT:  S16_LE
	SUBFORMAT:  STD
	SAMPLE_BITS: 16
	FRAME_BITS: 32
	CHANNELS: 2
	RATE: 44100
	PERIOD_TIME: (23219 23220)
	PERIOD_SIZE: 1024
	PERIOD_BYTES: 4096
	PERIODS: 4
	BUFFER_TIME: (92879 92880)
	BUFFER_SIZE: 4096
	BUFFER_BYTES: 16384
	TICK_TIME: 0

This patch-set solves this issue.
patch 1) - 3) are just cleanup patches.
4) is fot this issue.

Link: https://lore.kernel.org/r/87a6q0z4xt.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (4):
  ASoC: soc-pcm: don't use "name" on __soc_pcm_params_symmetry() macro
  ASoC: soc-pcm: indicate DAI name if soc_pcm_params_symmetry() failed
  ASoC: soc-utils: add snd_soc_component_is_dummy()
  ASoC: soc-pcm: ignore dummy-DAI at soc_pcm_params_symmetry()

 include/sound/soc-component.h |  1 +
 sound/soc/soc-core.c          |  2 +-
 sound/soc/soc-pcm.c           | 14 ++++++++------
 sound/soc/soc-utils.c         |  6 ++++++
 4 files changed, 16 insertions(+), 7 deletions(-)

--
2.25.1
2021-04-16 16:55:31 +01:00
Thierry Reding 343e55e718
ASoC: simple-card-utils: Increase maximum number of links to 128
On Tegra186 and later, the number of links can go up to 72, so bump the
maximum number of links to the next power of two (128).

Fixes: f2138aed23 ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210416071147.2149109-2-thierry.reding@gmail.com
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 16:54:48 +01:00
Thierry Reding 0f687d8267
ASoC: simple-card-utils: Propagate errors on too many links
The DAI counting code doesn't propagate errors when the number of
maximum links is exceeded, which causes subsequent initialization code
to continue to run and that eventually leads to memory corruption with
the code trying to access memory that is out of bounds.

Fix this by propagating errors when the maximum number of links is
reached, which ensures that the driver fails to load and prevents the
memory corruption.

Fixes: f2138aed23 ("ASoC: simple-card-utils: enable flexible CPU/Codec/Platform")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://lore.kernel.org/r/20210416071147.2149109-1-thierry.reding@gmail.com
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Tested-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 16:54:08 +01:00
Kuninori Morimoto 9c2ae363f3
ASoC: soc-pcm: ignore dummy-DAI at soc_pcm_params_symmetry()
soc_pcm_params_symmetry() checks CPU / Codec symmetry.
Unfortunately there was bug on it (= A) which didn't check Codec.
But is back by (B).

	A: v5.7:  commit c840f7698d ("ASoC: soc-pcm: Merge for_each_rtd_cpu/codec_dais()")
	B: v5.12: commit 3a90672111 ("ASoC: soc-pcm: cleanup soc_pcm_params_symmetry()")

In total,
old - v5.6 (= Generation-1):

	symmetric_rate		: DAI_Link / CPU / Codec
	symmetric_channels	: DAI_Link / CPU / Codec
	symmetric_sample_bits	: DAI_Link / CPU / Codec

v5.7 - v5.11 (= Generation-2): (= because of bug by (A))

	symmetric_rate		: DAI_Link / CPU
	symmetric_channels	: DAI_Link / CPU / Codec
	symmetric_sample_bits	: DAI_Link / CPU / Codec

v5.12 - (= Generation-3): (= back by (B))

	symmetric_rate		: DAI_Link / CPU / Codec
	symmetric_channels	: DAI_Link / CPU / Codec
	symmetric_sample_bits	: DAI_Link / CPU / Codec

OTOH, we can use DPCM which is configured by FE / BE.
Both FE / BE uses dummy-DAI.

	FE: CPU       <-> dummy-DAI
	BE: dummy-DAI <-> Codec

One note is that we can use .be_hw_params_fixup in DPCM case.
This means BE settings might be fixuped/updated by FE.
This feature is used for example on MIXer case.
It can be happen not only for rate, but for channels/sample_bits too.

Because of these reasons, below issue happen on
Generation-1 / Generation-3, if...

	1) Sound Card used DPCM
	2) It exchanges rate to 48kHz by using .be_hw_params_fixup()
	3) Codec had symmetric_rate = 1

I didn't confirm, but maybe same things happen
if it exchanged channels/sample_bits at Generation-1/2/3 too.

	# aplay 44100.wav
	# aplay 44100.wav
=>	[kernel] be.ak4613-hifi: ASoC: unmatched rate symmetry: snd-soc-dummy-dai:44100 - soc_pcm_params_symmetry:48000
	[kernel] be.ak4613-hifi: ASoC: hw_params BE failed -22
	[kernel] fe.rsnd-dai.0: ASoC: hw_params BE failed -22
	aplay: set_params:1407: Unable to install hw params:
	ACCESS:  RW_INTERLEAVED
	FORMAT:  S16_LE
	SUBFORMAT:  STD
	SAMPLE_BITS: 16
	FRAME_BITS: 32
	CHANNELS: 2
	RATE: 44100
	PERIOD_TIME: (23219 23220)
	PERIOD_SIZE: 1024
	PERIOD_BYTES: 4096
	PERIODS: 4
	BUFFER_TIME: (92879 92880)
	BUFFER_SIZE: 4096
	BUFFER_BYTES: 16384
	TICK_TIME: 0

soc_pcm_params_symmetry() checks by below

	if (symmetry)
		for_each_rtd_cpu_dais(rtd, i, cpu_dai)
			if (cpu_dai->xxx && cpu_dai->xxx != d.xxx) {
				dev_err(rtd->dev, "...");
				return -EINVAL;
			}

Because of above reason 3) (= Codec had symmetric_rate = 1)
BE can't ignore "if (symmetric)".

At 1st aplay, soc_pcm_params_symmetry() ignores it,
because dummy-DAI->rate is 0.
After this check, each DAI sets/keep settings.

In above sample case, BE gets 48000 and FE gets 44100,
and it happen BE -> FE order.
Because DPCM is sharing *same* dummy-DAI,
dummy-DAI sets as 48000 by BE, and is overwrote by 44100 by FE.

This settings never be cleaned (= a) after 1st aplay,
because dummy-DAI is used from FE/BE, never be last user (b).

	static int soc_pcm_hw_clean(...)
	{
		...
		for_each_rtd_dais(rtd, i, dai) {
			...
(b)			if (snd_soc_dai_active(dai) == 1)
(a)				soc_pcm_set_dai_params(dai, NULL);
			...
		}
		...
	}

At 2nd aplay, BE gets 48000 but dummy-DAI is keeping 44100,
soc_pcm_params_symmetry() checks will fail.

To solve this issue, this patch ignores dummy-DAI
at soc_pcm_params_symmetry()

Link: https://lore.kernel.org/r/87a6q0z4xt.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y2djxa2n.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 14:34:13 +01:00
Kuninori Morimoto 8f1a16818a
ASoC: soc-utils: add snd_soc_component_is_dummy()
There is snd_soc_dai_is_dummy(), but not for component.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgxzxa2t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-04-16 14:34:12 +01:00