platform/kernel/linux-rpi.git
2 years agoASoC: Intel: avs: Parse module-extension tuples
Cezary Rojewski [Thu, 31 Mar 2022 13:52:35 +0000 (15:52 +0200)]
ASoC: Intel: avs: Parse module-extension tuples

Anything that goes beyond module base config is an extension config. It
covers all fields for all specific module types available in ADSP
firmware. Add parsing helpers to support loading such information from
the topology file.

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/20220331135246.993089-4-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: avs: Add topology parsing infrastructure
Cezary Rojewski [Thu, 31 Mar 2022 13:52:34 +0000 (15:52 +0200)]
ASoC: Intel: avs: Add topology parsing infrastructure

AVS topology is split into two major parts: dictionaries - found within
ASoC topology manifest - and path templates.

Dictionaries job is to reduce the total amount of memory
occupied by topology elements. Rather than having every pipeline and
module carry its own information, each refers to specific entry in
specific dictionary by provided (from topology file) indexes. In
consequence, most struct avs_tplg_xxx are made out of pointers.

To support the above, range of parsing helpers for all value-types known
to ALSA: uuid, bool, byte, short, word and string are added. Additional
handlers help translate pointer-types and more complex objects such as
audio formats and module base configs.

Path templates are similar to path descriptions found in skylake-driver
and they describe how given path shall look like in runtime - number of
modules and pipelines that shape it and how they are laid out.

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/20220331135246.993089-3-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: avs: Declare vendor tokens
Cezary Rojewski [Thu, 31 Mar 2022 13:52:33 +0000 (15:52 +0200)]
ASoC: Intel: avs: Declare vendor tokens

Expose all vendor tokens that help shape AVS topology. Parsing helpers
introduced in follow up patches make use of these to know which block
they are currently dealing with and to verify their correctness.

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/20220331135246.993089-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-card: Create jack kcontrol without pins
Akihiko Odaki [Fri, 8 Apr 2022 04:11:14 +0000 (13:11 +0900)]
ASoC: soc-card: Create jack kcontrol without pins

snd_soc_card_jack_new() allowed to create jack kcontrol without pins,
but did not create kcontrols. The jack would not have kcontrols if pins
were not going to be added.

This renames the old snd_soc_card_jack_new() to
snd_soc_card_jack_new_pins() for use when pins are provided or will be
added later. The new snd_soc_card_jack_new() appropriately creates a
jack for use without pins and adds a kcontrol.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Link: https://lore.kernel.org/r/20220408041114.6024-1-akihiko.odaki@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Intel: Check the bar size before remapping
Zheyu Ma [Sat, 9 Apr 2022 14:39:50 +0000 (22:39 +0800)]
ASoC: SOF: Intel: Check the bar size before remapping

The driver should use the pci_resource_len() to get the actual length of
pci bar, and compare it with the expect value. If the bar size is too
small (such as a broken device), the driver should return an error.

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Link: https://lore.kernel.org/r/20220409143950.2570186-1-zheyuma97@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ti: osk5912: Make it CCF clk API compatible
Janusz Krzysztofik [Thu, 7 Apr 2022 19:12:02 +0000 (21:12 +0200)]
ASoC: ti: osk5912: Make it CCF clk API compatible

The driver, OMAP1 specific, now omits clk_prepare/unprepare() steps, not
supported by OMAP1 custom implementation of clock API.  However, non-CCF
stubs of those functions exist for use on such platforms until converted
to CCF.

Update the driver to be compatible with CCF implementation of clock API.

Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Link: https://lore.kernel.org/r/20220407191202.46206-1-jmkrzyszt@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
Minghao Chi [Tue, 12 Apr 2022 08:30:00 +0000 (08:30 +0000)]
ASoC: fsl: using pm_runtime_resume_and_get instead of pm_runtime_get_sync

Using pm_runtime_resume_and_get is more appropriate
for simplifing code

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20220412083000.2532711-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fix invalid yaml
Corentin Labbe [Mon, 11 Apr 2022 19:44:09 +0000 (19:44 +0000)]
ASoC: fix invalid yaml

The word "or" is useless and breaks yaml validation.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Link: https://lore.kernel.org/r/20220411194409.3390002-1-clabbe@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: remaining simple i2c probe changes
Mark Brown [Tue, 12 Apr 2022 16:16:54 +0000 (17:16 +0100)]
ASoC: remaining simple i2c probe changes

Merge series from Stephen Kitt <steve@sk2.org>:

This series covers all the remaining changes to migrate
sound/soc/codecs i2c probes to probe_new, where the const struct
i2c_client * argument is unused; there are a few remaining files which
use the argument and will need i2c_match_id migration.

2 years agoASoC: SOF: Abstractions for top-level IPC ops
Mark Brown [Tue, 12 Apr 2022 16:16:52 +0000 (17:16 +0100)]
ASoC: SOF: Abstractions for top-level IPC ops

Merge series from Ranjani Sridharan <ranjani.sridharan@linux.intel.com>:

This series is continuation of the IPC abstraction in the SOF driver in
preparation for supporting the new IPC supported by the SOF firmware.
It introduces abstraction for top-level IPC ops for sending/receiving
regular and large IPC's.

Peter Ujfalusi (15):
  ASoC: SOF: Add helper function to prepare and send an IPC message
  ASoC: SOF: Add high level IPC IO callback definitions to ipc_ops
  ASoC: SOF: ipc3: Implement the tx_msg IPC ops
  ASoC: SOF: ipc3: Use sof_ipc3_tx_msg() internally for message sending
  ASoC: SOF: ipc3: Implement the set_get_data IPC ops
  ASoC: SOF: ipc3: Implement the get_reply IPC ops
  ASoC: SOF: ipc3: Implement rx_msg IPC ops
  ASoC: SOF: ipc: Separate the ops checks by functions/topics
  ASoC: SOF: ipc: Add check for mandatory IPC message handling ops
  ASoC: SOF: ipc: Use the get_reply ops in snd_sof_ipc_get_reply()
  ASoC: SOF: ipc: Switch over to use the tx_msg and set_get_data ops
  ASoC: SOF: ipc: Switch over to use the rx_msg ops
  ASoC: SOF: Add widget_kcontrol_setup control ops for IPC3
  ASoC: SOF: sof-audio: Use the widget_kcontrol_setup ops for kcontrol
    set up
  ASoC: SOF: ipc: Move the ipc_set_get_comp_data() local to ipc3-control

 sound/soc/sof/ipc.c          | 858 ++---------------------------------
 sound/soc/sof/ipc3-control.c | 131 +++++-
 sound/soc/sof/ipc3.c         | 682 +++++++++++++++++++++++++++-
 sound/soc/sof/sof-audio.c    |  54 +--
 sound/soc/sof/sof-audio.h    |   7 +-
 sound/soc/sof/sof-priv.h     |  28 +-
 6 files changed, 880 insertions(+), 880 deletions(-)

--
2.25.1

2 years agoAllow detecting ACP6x DMIC via _DSD
Mark Brown [Tue, 12 Apr 2022 16:16:51 +0000 (17:16 +0100)]
Allow detecting ACP6x DMIC via _DSD

Merge series from Mario Limonciello <mario.limonciello@amd.com>:

It's not possible to probe for the presence of a DMIC, so the ACP6x
machine driver currently has a hardcoded list of all the systems known
to have a DMIC connected to the ACP.

Although this design works it means that the acp6x driver needs to always
grow with more systems and worse, if an OEM introduces a new system there
will be a mismatch in time that even if the driver (otherwise) works fine
it needs their system added to the list to work.

So this series introduces a _DSD that OEMs can populate into the BIOS to
indicate presence of a DMIC.

2 years agoASoC: cs35l45: Make exports namespaced
Richard Fitzgerald [Mon, 11 Apr 2022 16:59:29 +0000 (17:59 +0100)]
ASoC: cs35l45: Make exports namespaced

Use the new EXPORT_SYMBOL_NS_GPL() for exports from the set of
drivers for cs35l45.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220411165929.1302333-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tegra186_asrc: mark runtime-pm functions as __maybe_unused
YueHaibing [Mon, 11 Apr 2022 02:09:08 +0000 (10:09 +0800)]
ASoC: tegra186_asrc: mark runtime-pm functions as __maybe_unused

sound/soc/tegra/tegra186_asrc.c:90:12: error: ‘tegra186_asrc_runtime_resume’ defined but not used [-Werror=unused-function]
 static int tegra186_asrc_runtime_resume(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/tegra/tegra186_asrc.c:80:12: error: ‘tegra186_asrc_runtime_suspend’ defined but not used [-Werror=unused-function]
 static int tegra186_asrc_runtime_suspend(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

Fixes: a2df8c2d5b36 ("ASoC: tegra: Add Tegra186 based ASRC driver")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Sameer Pujar <spujar@nvidia.com>
Link: https://lore.kernel.org/r/20220411020908.580-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: yc: add new YC platform varaint support
Vijendar Mukunda [Mon, 11 Apr 2022 13:41:15 +0000 (19:11 +0530)]
ASoC: amd: yc: add new YC platform varaint support

Update PCI revision id check for the new YC platform varaint.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20220411134119.1767646-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: uda1380: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:36 +0000 (18:58 +0200)]
ASoC: uda1380: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-15-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ts3a227e: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:35 +0000 (18:58 +0200)]
ASoC: ts3a227e: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-14-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tlv320*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:34 +0000 (18:58 +0200)]
ASoC: tlv320*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-13-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tda7419: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:33 +0000 (18:58 +0200)]
ASoC: tda7419: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-12-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tas*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:32 +0000 (18:58 +0200)]
ASoC: tas*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-11-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sta*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:31 +0000 (18:58 +0200)]
ASoC: sta*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-10-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: pcm*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:30 +0000 (18:58 +0200)]
ASoC: pcm*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-9-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: nau8*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:29 +0000 (18:58 +0200)]
ASoC: nau8*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-8-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ml26124: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:28 +0000 (18:58 +0200)]
ASoC: ml26124: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-7-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: max9*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:27 +0000 (18:58 +0200)]
ASoC: max9*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-6-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: lm4857: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:26 +0000 (18:58 +0200)]
ASoC: lm4857: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-5-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: es83*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:25 +0000 (18:58 +0200)]
ASoC: es83*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-4-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cx2072x: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:24 +0000 (18:58 +0200)]
ASoC: cx2072x: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-3-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:23 +0000 (18:58 +0200)]
ASoC: ak4*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-2-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: Add support for enabling DMIC on acp6x via _DSD
Mario Limonciello [Mon, 11 Apr 2022 13:45:32 +0000 (08:45 -0500)]
ASoC: amd: Add support for enabling DMIC on acp6x via _DSD

Currently the acp6x machine driver requires a hardcoded list of systems
that physically have DMIC connected.

To avoid having to continually add to an evergrowing list of systems add
support for a _DSD that can advertise this.

OEMs can add this _DSD to their BIOS under the ACP device to automatically
add the device to this driver without requiring any driver modifications.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20220411134532.13538-3-mario.limonciello@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: amd: Add driver data to acp6x machine driver
Mario Limonciello [Mon, 11 Apr 2022 13:45:31 +0000 (08:45 -0500)]
ASoC: amd: Add driver data to acp6x machine driver

Currently all of the quirked systems use the same card and so the
DMI quirk list doesn't contain driver data.

Add driver data to these quirks and then check the data was present
or not.  This will allow potentially setting quirks for systems with
faulty firmware that claims to have a DMIC but doesn't really.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20220411134532.13538-2-mario.limonciello@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Move the ipc_set_get_comp_data() local to ipc3-control
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:08 +0000 (10:27 -0700)]
ASoC: SOF: ipc: Move the ipc_set_get_comp_data() local to ipc3-control

The snd_sof_ipc_set_get_comp_data() only used for kcontrol data update
and it is an IPC3 message parsing function.

Move it out from the generic ipc.c to ipc3-control.c and rename it to
better describe it's function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-16-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: sof-audio: Use the widget_kcontrol_setup ops for kcontrol set up
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:07 +0000 (10:27 -0700)]
ASoC: SOF: sof-audio: Use the widget_kcontrol_setup ops for kcontrol set up

Remove the local implementation and switch to the IPC neutral ops to
set up the kcontrols associated with the swidget.

The set up call uses snd_sof_ipc_set_get_comp_data() which is largely an
IPC3 parsing function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-15-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add widget_kcontrol_setup control ops for IPC3
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:06 +0000 (10:27 -0700)]
ASoC: SOF: Add widget_kcontrol_setup control ops for IPC3

Define and set the widget_kcontrol_setup control IPC ops for IPC3.

The widget_kcontrol_setup callback can be used to set up all
kcontrols associated with the swidget.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-14-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Switch over to use the rx_msg ops
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:05 +0000 (10:27 -0700)]
ASoC: SOF: ipc: Switch over to use the rx_msg ops

Use the new ops for handling message reception.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-13-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Switch over to use the tx_msg and set_get_data ops
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:04 +0000 (10:27 -0700)]
ASoC: SOF: ipc: Switch over to use the tx_msg and set_get_data ops

Use the new ops for sending messages and to handle large component data
set get operation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-12-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Use the get_reply ops in snd_sof_ipc_get_reply()
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:03 +0000 (10:27 -0700)]
ASoC: SOF: ipc: Use the get_reply ops in snd_sof_ipc_get_reply()

Use the get_reply ops to allow IPC dependent handling of the reply message.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-11-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Add check for mandatory IPC message handling ops
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:02 +0000 (10:27 -0700)]
ASoC: SOF: ipc: Add check for mandatory IPC message handling ops

Make sure that the mandatory IPC message handling ops are provided by the
IPC implementation.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-10-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc: Separate the ops checks by functions/topics
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:01 +0000 (10:27 -0700)]
ASoC: SOF: ipc: Separate the ops checks by functions/topics

Separate the mandatory ops checks by topics (pcm and topology for now) to
be able to provide intuitive feedback on the possible missing ops and to
make it easier to add new mandatory ops checks in the future.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-9-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3: Implement rx_msg IPC ops
Peter Ujfalusi [Tue, 5 Apr 2022 17:27:00 +0000 (10:27 -0700)]
ASoC: SOF: ipc3: Implement rx_msg IPC ops

Add the implementation for the rx_msg callback to handle message reception
for IPC3.

The implementation is equivalent to the currently used code in ipc.c

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-8-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3: Implement the get_reply IPC ops
Peter Ujfalusi [Tue, 5 Apr 2022 17:26:59 +0000 (10:26 -0700)]
ASoC: SOF: ipc3: Implement the get_reply IPC ops

Add the implementation for the get_reply callback to copy the reply message
from mailbox to msg->reply_data buffer.

The implementation is equivalent to the currently used code in ipc.c

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-7-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3: Implement the set_get_data IPC ops
Peter Ujfalusi [Tue, 5 Apr 2022 17:26:58 +0000 (10:26 -0700)]
ASoC: SOF: ipc3: Implement the set_get_data IPC ops

Add the implementation for the set_get_data callback for handling large
data set and get.

The set_get_data() in IPC3 can be used only for component messages. The
function expects the caller to prepare the message behind the data pointer
for sending/receiving data. The callback only implements the needed code
to be able to split up a message if needed for transfer.

The set_get_data ops is based on the existing
snd_sof_ipc_set_get_comp_data() and sof_set_get_large_ctrl_data() but made
it generic entry point.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-6-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3: Use sof_ipc3_tx_msg() internally for message sending
Peter Ujfalusi [Tue, 5 Apr 2022 17:26:57 +0000 (10:26 -0700)]
ASoC: SOF: ipc3: Use sof_ipc3_tx_msg() internally for message sending

Instead of using sof_ipc_tx_message() for sending message, use the
sof_ipc3_tx_msg() directly within ipc3.c

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-5-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3: Implement the tx_msg IPC ops
Peter Ujfalusi [Tue, 5 Apr 2022 17:26:56 +0000 (10:26 -0700)]
ASoC: SOF: ipc3: Implement the tx_msg IPC ops

Add the implementation for the IPC3 tx_msg callback for sending a single
IPC message.

The implementation is equivalent to the currently used code in ipc.c

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-4-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add high level IPC IO callback definitions to ipc_ops
Peter Ujfalusi [Tue, 5 Apr 2022 17:26:55 +0000 (10:26 -0700)]
ASoC: SOF: Add high level IPC IO callback definitions to ipc_ops

Add tx_msg(), rx_msg(), set_get_data() and get_reply() ops, which can
be used as a generic API for sending, receiving single messages and
to write and read large data.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-3-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: Add helper function to prepare and send an IPC message
Peter Ujfalusi [Tue, 5 Apr 2022 17:26:54 +0000 (10:26 -0700)]
ASoC: SOF: Add helper function to prepare and send an IPC message

The new sof_ipc_send_msg() can be used by IPC dependent code to prepare
the ipc->msg for a new message transmission and then call in to platform
code to send the message.

Higher level code should be handling the completion and reply.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220405172708.122168-2-ranjani.sridharan@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: update to support either TAS2764 or TAS2780
Raphael-Xu [Fri, 8 Apr 2022 14:11:19 +0000 (22:11 +0800)]
ASoC: update to support either TAS2764 or TAS2780

update tas27xx.yaml to support either TAS2764 or TAS2780

Signed-off-by: Raphael-Xu <13691752556@139.com>
Link: https://lore.kernel.org/r/20220408141119.958-2-13691752556@139.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rename tas2764 to tas27xx
Raphael-Xu [Fri, 8 Apr 2022 14:11:18 +0000 (22:11 +0800)]
ASoC: rename tas2764 to tas27xx

rename tas2764.yaml to tas27xx.yaml

Signed-off-by: Raphael-Xu <13691752556@139.com>
Link: https://lore.kernel.org/r/20220408141119.958-1-13691752556@139.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8192: support rt1015p_rt5682s
Mark Brown [Fri, 8 Apr 2022 14:43:43 +0000 (15:43 +0100)]
ASoC: mediatek: mt8192: support rt1015p_rt5682s

Merge series from Jiaxin Yu <jiaxin.yu@mediatek.com>:

The series reuses mt8192-mt6359-rt1015-rt5682.c for supporting machine
driver with rt1015p speaker amplifier and rt5682s headset codec.

2 years agoASoC: mediatek: mt8195: Make sure of_device_id table are NULL terminated
Lv Ruyi [Fri, 8 Apr 2022 10:03:09 +0000 (10:03 +0000)]
ASoC: mediatek: mt8195: Make sure of_device_id table are NULL terminated

Fix the following coccicheck review:
./sound/soc/mediatek/mt8195/mt8195-mt6359.c:1657:1-2:
mt8195_mt6359_dt_match is not NULL terminated at line 1657

Fixes: 86a6b9c9dfff ("ASoC: mediatek: mt8195: add machine support for max98390 and rt5682")
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
Link: https://lore.kernel.org/r/20220408100309.2495462-1-lv.ruyi@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Merge fixes
Mark Brown [Fri, 8 Apr 2022 11:22:10 +0000 (12:22 +0100)]
ASoC: Merge fixes

Pull in wm8731 fix.

Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8192: support rt1015p_rt5682s
Jiaxin Yu [Fri, 8 Apr 2022 06:05:52 +0000 (14:05 +0800)]
ASoC: mediatek: mt8192: support rt1015p_rt5682s

Add support for using the rt5682s codec together with rt1015p on
mt8192-mt6359 machines. All configurations are shared with the rt5682
codec variant, so simply select the SND_SOC_RT5682S config to ensure the
codec is present and set the correct card name. The codec will be linked
to by pointing to it in the headset-codec property in the devicetree.

While at it, also create macros for the names of the different codec
variants supported by this driver, as well as rename occurrences of
rt1015p_rt5682 to rt1015p_rt5682x, since they are shared between rt5682
and rt5682s.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220408060552.26607-5-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8192: refactor for I2S8/I2S9 DAI links of headset
Jiaxin Yu [Fri, 8 Apr 2022 06:05:51 +0000 (14:05 +0800)]
ASoC: mediatek: mt8192: refactor for I2S8/I2S9 DAI links of headset

As part of the refactoring to allow the same machine driver to be used for
the rt1015(p) and rt5682(s) codecs on the MT8192 platform, parse the
rt5682(s) codec from the headset-codec property in the devicetree and wire
it to the I2S8 and I2S9 backends.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220408060552.26607-4-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: mt8192: refactor for I2S3 DAI link of speaker
Jiaxin Yu [Fri, 8 Apr 2022 06:05:50 +0000 (14:05 +0800)]
ASoC: mediatek: mt8192: refactor for I2S3 DAI link of speaker

As part of the refactoring to allow the same machine driver to be used for
the rt1015(p) and rt5682(s) codecs on the MT8192 platform, parse the
rt1015(p) codecs from the speaker-codecs property in the devicetree and
wire them to the I2S3 backend, instead of hardcoding the links and
selecting through the compatible.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220408060552.26607-3-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: mt8192-mt6359: add new compatible and new properties
Jiaxin Yu [Fri, 8 Apr 2022 06:05:49 +0000 (14:05 +0800)]
ASoC: dt-bindings: mt8192-mt6359: add new compatible and new properties

1. Adds new compatible string "mt8192_mt6359_rt1015p_rt5682s" for machines
with rt1015p and rt5682s.
2. Adds new property "headset-codec" for getting headset codec.
3. Adds new property "speaker-codecs" for getting speaker codecs.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220408060552.26607-2-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoMake headphone work on Huawei Matebook D15
Mark Brown [Fri, 8 Apr 2022 11:08:37 +0000 (12:08 +0100)]
Make headphone work on Huawei Matebook D15

Merge series from Mauro Carvalho Chehab <mchehab@kernel.org>:

Huawei Matebook D15 uses two different GPIOs are used to control the output:

- gpio0 controls the speaker output;
- gpio1 controls the headphone output.

Changing both at the same time cause spurious events that are mis-interpreted
as input events, causing troubles on apps. So, a delay is needed before turning
on such gpios.

Also, the headset microphone is connected to MIC1, instead of MIC2 port.

With this patch, plugging a headphone causes a jack event to trigger the speaker
supply, powering down the speaker and powering up the headphone output.
Removing the headphone also triggers the power supply, powering up the speaker
and powering down the headphone.

The headset microphone also works.

2 years agoASoC: Intel: sof_es8336: Add a quirk for Huawei Matebook D15
Mauro Carvalho Chehab [Thu, 7 Apr 2022 18:49:59 +0000 (20:49 +0200)]
ASoC: Intel: sof_es8336: Add a quirk for Huawei Matebook D15

Based on experimental tests, Huawei Matebook D15 actually uses
both gpio0 and gpio1: the first one controls the speaker, while
the other one controls the headphone.

Also, the headset is mapped as MIC1, instead of MIC2.

So, add a quirk for it.

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/d678aef9fc9a07aced611aa7cb8c9b800c649e5a.1649357263.git.mchehab@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: add a quirk for headset at mic1 port
Mauro Carvalho Chehab [Thu, 7 Apr 2022 18:49:58 +0000 (20:49 +0200)]
ASoC: Intel: sof_es8336: add a quirk for headset at mic1 port

The headset/internal mic can either be routed as mic1/mic2
or vice-versa.

By default, the driver assumes that the headset is mapped as
mic2, but not all devices map this way.

So, add a quirk to support changing it to mic1, using mic2
for the internal analog mic (if any).

Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/5d88fc29b79be7ab77dae391c8e5ee929fd36c27.1649357263.git.mchehab@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: support a separate gpio to control headphone
Mauro Carvalho Chehab [Thu, 7 Apr 2022 18:49:57 +0000 (20:49 +0200)]
ASoC: Intel: sof_es8336: support a separate gpio to control headphone

Some devices may use both gpio0 and gpio1 to independently switch
the speaker and the headphone.

Add support for that.

Acked-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/535454c0c598a8454487fe29b164527370e2db81.1649357263.git.mchehab@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: sof_es8336: simplify speaker gpio naming
Pierre-Louis Bossart [Thu, 7 Apr 2022 18:49:56 +0000 (20:49 +0200)]
ASoC: Intel: sof_es8336: simplify speaker gpio naming

In preparation for the support of an additional gpio for headphone
control, rename GPIOs to make explicit references to speakers and
gpio0 or gpio1.

No functionality change.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/3008c576ca45d5cc99ad4a18d1d30de45a0aff80.1649357263.git.mchehab@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: mediatek: mt8195 add shutdown callback
YC Hung [Wed, 6 Apr 2022 19:40:46 +0000 (14:40 -0500)]
ASoC: SOF: mediatek: mt8195 add shutdown callback

Add mt8195 shutdown callback function implementation to ensure that
shutdown flow is called to shutdown dsp core, disable adsp clock, and
power off dsp sram correctly during reboot flow.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220406194048.289787-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: OF: Add shutdown callback for SOF OF device
YC Hung [Wed, 6 Apr 2022 19:40:45 +0000 (14:40 -0500)]
ASoC: SOF: OF: Add shutdown callback for SOF OF device

Add shutdown callback function for SOF OF device and call
snd_sof_device_shutdown in sof_of_shutdown callback for DSP
shutdown sequence.

Signed-off-by: YC Hung <yc.hung@mediatek.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220406194048.289787-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wm8731: Disable the regulator when probing fails
Zheyu Ma [Tue, 5 Apr 2022 12:10:38 +0000 (20:10 +0800)]
ASoC: wm8731: Disable the regulator when probing fails

When the driver fails during probing, the driver should disable the
regulator, not just handle it in wm8731_hw_init().

The following log reveals it:

[   17.812483] WARNING: CPU: 1 PID: 364 at drivers/regulator/core.c:2257 _regulator_put+0x3ec/0x4e0
[   17.815958] RIP: 0010:_regulator_put+0x3ec/0x4e0
[   17.824467] Call Trace:
[   17.824774]  <TASK>
[   17.825040]  regulator_bulk_free+0x82/0xe0
[   17.825514]  devres_release_group+0x319/0x3d0
[   17.825882]  i2c_device_probe+0x766/0x940
[   17.829198]  i2c_register_driver+0xb5/0x130

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Link: https://lore.kernel.org/r/20220405121038.4094051-1-zheyuma97@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: soc-acpi: correct device endpoints for max98373
Chao Song [Wed, 6 Apr 2022 19:23:41 +0000 (14:23 -0500)]
ASoC: Intel: soc-acpi: correct device endpoints for max98373

The left speaker of max98373 uses spk_r_endpoint, and right
speaker uses spk_l_endpoint, this is obviously wrong.

This patch corrects the endpoints for max98373 codec.

Signed-off-by: Chao Song <chao.song@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220406192341.271465-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: wcd934x: do not switch off SIDO Buck when codec is in use
Srinivas Kandagatla [Thu, 7 Apr 2022 09:43:13 +0000 (10:43 +0100)]
ASoC: codecs: wcd934x: do not switch off SIDO Buck when codec is in use

SIDO(Single-Inductor Dual-Ouput) Buck powers up both analog and digital
circuits along with internal memory, powering off this is the last thing
that codec should do when going to very low power.

Current code was powering off this Buck if there are no users of sysclk,
which is not correct. Powering off this buck will result in no register access.
This code path was never tested until recently after adding pm support
in SoundWire controller. Fix this by removing the buck poweroff when the
codec is active and also the code that is not used.

Without this patch all the read/write transactions will never complete and
results in SLIMBus Errors like:

qcom,slim-ngd qcom,slim-ngd.1: Tx:MT:0x0, MC:0x60, LA:0xcf failed:-110
wcd934x-codec wcd934x-codec.1.auto: ASoC: error at soc_component_read_no_lock
on wcd934x-codec.1.auto for register: [0x00000d05] -110
qcom,slim-ngd-ctrl 171c0000.slim: Error Interrupt received 0x82000000

Reported-by: Amit Pundir <amit.pundir@linaro.org>
Fixes: a61f3b4f476e ("ASoC: wcd934x: add support to wcd9340/wcd9341 codec")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Amit Pundir <amit.pundir@linaro.org>
Link: https://lore.kernel.org/r/20220407094313.2880-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Fix memory leak in sof_control_load()
Yu Liao [Fri, 18 Mar 2022 02:16:16 +0000 (10:16 +0800)]
ASoC: SOF: topology: Fix memory leak in sof_control_load()

scontrol doesn't get freed when kstrdup returns NULL.
Fix by free iscontrol in that case.

     scontrol = kzalloc(sizeof(*scontrol), GFP_KERNEL);
     if (!scontrol)
         return -ENOMEM;

     scontrol->name = kstrdup(hdr->name, GFP_KERNEL);
     if (!scontrol->name)
         return -ENOMEM;

Signed-off-by: Yu Liao <liaoyu15@huawei.com>
Link: https://lore.kernel.org/r/20220318021616.2599630-1-liaoyu15@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: cleanup dailinks on widget unload
Pierre-Louis Bossart [Wed, 6 Apr 2022 19:16:06 +0000 (14:16 -0500)]
ASoC: SOF: topology: cleanup dailinks on widget unload

We set the cpu_dai capture_ or playback_widget on widget_ready but
never clear them, which leads to failures when unloading/reloading a
topology in modprobe/rmmod tests

BugLink: https://github.com/thesofproject/linux/issues/3535
Fixes: 311ce4fe7637 ("ASoC: SOF: Add support for loading topologies")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220406191606.254576-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt711/5682: check if bus is active before deferred jack detection
Pierre-Louis Bossart [Wed, 6 Apr 2022 19:20:05 +0000 (14:20 -0500)]
ASoC: rt711/5682: check if bus is active before deferred jack detection

This patch takes a defensive programming and paranoid approach in case
the parent device (SoundWire) is pm_runtime resumed but the rt711
device is not. In that case, during the attachment and initialization,
a jack detection workqueue can be scheduled. Since the pm_runtime
suspend routines will not be invoked, the sequence to cancel all
deferred work is not executed, and the jack detection could happen
after the bus stops operating, leading to a timeout.

This patch applies the same solution to rt5682, based on the
similarities between codec drivers. The race condition with rt5682 was
not detected experimentally though.

BugLink: https://github.com/thesofproject/linux/issues/3459
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220406192005.262996-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wm8731: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 17:39:52 +0000 (19:39 +0200)]
ASoC: wm8731: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220405173952.2180743-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: sgtl5000: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:40:31 +0000 (18:40 +0200)]
ASoC: sgtl5000: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20220405164031.2160888-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt1016: enable building
Stephen Kitt [Tue, 5 Apr 2022 17:11:58 +0000 (19:11 +0200)]
ASoC: rt1016: enable building

The rt1016 driver wasn't listed in Kconfig and Makefile, which AFAICT
means it isn't ever built. This patch adds the appropriate entries to
Kconfig and Makefile.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405171158.2168762-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: pcm3060: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:36:18 +0000 (18:36 +0200)]
ASoC: pcm3060: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405163618.2158090-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: Avoid open coded arithmetic in memory allocation
Christophe JAILLET [Sun, 20 Mar 2022 06:22:26 +0000 (07:22 +0100)]
ASoC: SOF: topology: Avoid open coded arithmetic in memory allocation

Use kcalloc() instead of kzalloc()+open coded multiplication.
This is safer and saves a few lines of code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/3bbf03cfd1966bc6fb6dd0939e039fc161078a61.1647757329.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 13:03:26 +0000 (15:03 +0200)]
ASoC: rt*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405130326.2107293-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: tscs*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:34:00 +0000 (18:34 +0200)]
ASoC: tscs*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405163400.2156631-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wm*: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 12:24:11 +0000 (14:24 +0200)]
ASoC: wm*: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

wm8731.c is excluded and will be submitted separately.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220405122411.2096387-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: lm49xxx: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:35:33 +0000 (18:35 +0200)]
ASoC: lm49xxx: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405163533.2157401-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mt6660: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:37:50 +0000 (18:37 +0200)]
ASoC: mt6660: use simple i2c probe function

The i2c probe functions here don't use the id information provided in
their second argument, so the single-parameter i2c probe function
("probe_new") can be used instead.

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405163750.2158916-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: boards: Use temporary variable for struct device
Zhen Ni [Mon, 14 Mar 2022 05:46:21 +0000 (13:46 +0800)]
ASoC: Intel: boards: Use temporary variable for struct device

Use temporary variable for struct device to make code neater.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
Link: https://lore.kernel.org/r/20220314054621.14694-1-nizhen@uniontech.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4613: add TDM256 test support
Mark Brown [Wed, 6 Apr 2022 22:37:26 +0000 (23:37 +0100)]
ASoC: ak4613: add TDM256 test support

Merge series from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:

Renesas is the only user of ak4613 driver on upstream for now.
It has STEREO/TDM512/TDM256/TDM128 mode, but STEREO only is used,
because of Renesas board connection.

I noticed that I can test first 2ch out of TDM256 mode 8ch
Playback even in such a situation.

base-commit: 3123109284176b1532874591f7c81f3837bbdc17

2 years agoUpdate dt-bindings for sc7280 platform
Mark Brown [Wed, 6 Apr 2022 21:41:58 +0000 (22:41 +0100)]
Update dt-bindings for sc7280 platform

Merge series from Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>:

This patch set is to update required clocks, power domain names for
sc7280 platforms, and add mic bias supply for wcd938x codec.

2 years agoASoC: Intel: sof_rt5682: Add support for max98360a speaker amp on SSP2
Ajye Huang [Thu, 24 Mar 2022 08:47:08 +0000 (16:47 +0800)]
ASoC: Intel: sof_rt5682: Add support for max98360a speaker amp on SSP2

Follow Intel's design to replace max98360a amp SSP2 reather than SSP1
by judging DMI_OEM_STRING in sof_rt5682_quirk_table struct.
And reusing max98357's topology since DAI setting could be leveraged.

Signed-off-by: Ajye Huang <ajye_huang@compal.corp-partner.google.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220324084708.2009375-1-ajye_huang@compal.corp-partner.google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: fsl_sai: fix 1:1 bclk:mclk ratio support
Ahmad Fatoum [Tue, 5 Apr 2022 15:57:31 +0000 (17:57 +0200)]
ASoC: fsl_sai: fix 1:1 bclk:mclk ratio support

Refactoring in commit a50b7926d015 ("ASoC: fsl_sai: implement 1:1
bclk:mclk ratio support") led to the bypass never happening
as (ratio = 1) was caught in the existing if (ratio & 1) continue;
check. The correct check sequence instead is:

 - skip all ratios lower than one and higher than 512
 - skip all odd ratios except for 1:1
 - skip 1:1 ratio if and only if !support_1_1_ratio

And for all others, calculate the appropriate divider. Adjust the
code to facilitate this.

Fixes: a50b7926d015 ("ASoC: fsl_sai: implement 1:1 bclk:mclk ratio support")
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.kernel.org/r/20220405155731.745413-1-a.fatoum@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: simple-card-utils: Avoid NULL deref in asoc_simple_set_tdm()
Richard Fitzgerald [Mon, 4 Apr 2022 11:32:52 +0000 (12:32 +0100)]
ASoC: simple-card-utils: Avoid NULL deref in asoc_simple_set_tdm()

Don't dereference simple_dai before it has been checked for NULL.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 1e974e5b82b3 ("ASoC: audio_graph_card2: Add support for variable slot widths")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220404113252.1152659-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Add a driver for the Cirrus Logic CS35L45 Smart Amplifier
Mark Brown [Wed, 6 Apr 2022 13:23:49 +0000 (14:23 +0100)]
ASoC: Add a driver for the Cirrus Logic CS35L45 Smart Amplifier

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

This adds basic audio support for the Cirrus Logic CS35L45 amplifier.

The first two patches add two generic helpers to ASoC, and patch 3 is
a kunit test for patch 2.

2 years agoASoC: meson: aiu: fix duplicate debugfs directory error
Mark Brown [Wed, 6 Apr 2022 13:23:46 +0000 (14:23 +0100)]
ASoC: meson: aiu: fix duplicate debugfs directory error

Merge series from Heiner Kallweit <hkallweit1@gmail.com>:

On a S905W-based system I get the following error:
debugfs: Directory 'c1105400.audio-controller' with parent 'P230-Q200' already present!

Turned out that multiple components having the same name triggers this
error in soc_init_component_debugfs(). The proposed solution allows
other drivers to adopt the same approach with minimal effort.
With the patch the error is gone and that's the debugfs entries.

/sys/kernel/debug/asoc/P230-Q200/acodec:c1105400.audio-controller
/sys/kernel/debug/asoc/P230-Q200/hdmi:c1105400.audio-controller
/sys/kernel/debug/asoc/P230-Q200/cpu:c1105400.audio-controller

2 years agoASoC: meson: aiu: fix duplicate debugfs directory error
Heiner Kallweit [Wed, 9 Mar 2022 20:23:06 +0000 (21:23 +0100)]
ASoC: meson: aiu: fix duplicate debugfs directory error

On a S905W-based system I get the following error:
debugfs: Directory 'c1105400.audio-controller' with parent 'P230-Q200' already present!

Turned out that multiple components having the same name triggers this
error in soc_init_component_debugfs(). With the patch the error is gone
and that's the debugfs entries.

/sys/kernel/debug/asoc/P230-Q200/acodec:c1105400.audio-controller
/sys/kernel/debug/asoc/P230-Q200/hdmi:c1105400.audio-controller
/sys/kernel/debug/asoc/P230-Q200/cpu:c1105400.audio-controller

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/38053baf-c33b-7fdf-7593-99b22153a9c0@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-core: add debugfs_prefix member to snd_soc_component_driver
Heiner Kallweit [Wed, 9 Mar 2022 20:21:55 +0000 (21:21 +0100)]
ASoC: soc-core: add debugfs_prefix member to snd_soc_component_driver

Allow the component debugfs_prefix to be set from
snd_soc_component_driver. First use case is avoiding a duplicate
debugfs entry error in case a device has multiple components
which have the same name therefore.

Note that we don't set component->debugfs_prefix if it's set already.
That's needed because partially component->debugfs_prefix is set
before calling snd_soc_component_initialize().

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/d18bff6a-1df1-5f95-0cf8-10dbaa62d7be@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: lpass-cpu: Update clocks and power domain names for sc7280 platform
Srinivasa Rao Mandadapu [Mon, 21 Mar 2022 08:56:21 +0000 (14:26 +0530)]
ASoC: dt-bindings: lpass-cpu: Update clocks and power domain names for sc7280 platform

Update required clock-names used for MI2S primary path, VA macro's
codec memory path and HDMI path in sc7280 based platforms.
Update power domain names required for sc7280 platforms.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Co-developed-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Signed-off-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Link: https://lore.kernel.org/r/1647852981-27895-4-git-send-email-quic_srivasam@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: wcd938x: Add mic bias supply property
Srinivasa Rao Mandadapu [Mon, 21 Mar 2022 08:56:20 +0000 (14:26 +0530)]
ASoC: dt-bindings: wcd938x: Add mic bias supply property

Add vdd mic bias supply, which is required to provide bias
for wcd938x codec.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Co-developed-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Signed-off-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/1647852981-27895-3-git-send-email-quic_srivasam@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: dt-bindings: Update bindings for clocks in lpass digital codes
Srinivasa Rao Mandadapu [Mon, 21 Mar 2022 08:56:19 +0000 (14:26 +0530)]
ASoC: qcom: dt-bindings: Update bindings for clocks in lpass digital codes

Update dt-bindings for clocks as per ADSP bypass solutions, in which macro
dcodec GDSCs are enabled using power domains in lpass digital codec drivers.

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Co-developed-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Signed-off-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/1647852981-27895-2-git-send-email-quic_srivasam@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4613: add TDM256 support
Kuninori Morimoto [Tue, 5 Apr 2022 02:06:51 +0000 (02:06 +0000)]
ASoC: ak4613: add TDM256 support

AK4613 has STEREO/TDM512/TDM256/TDM128 mode.
Renesas is the only user of ak4613 on upstream for now,
and is using it as STEREO mode, because of board connection.
Thus, current driver is supporting STEREO mode only, and other
modes are not supported.

But I noticed that I can try first 2ch out of TDM256 mode 8ch
Playback even in such a situation.

But because of board connection, I can't test full TDM256 mode,
and/or other TDM mode. Thus I don't want to add new DT propaty for now.
This patch enables TDM256 mode test by "ifdef style",
but it has no effect to current supported STEREO mode.
You can define AK4613_ENABLE_TDM_TEST to try TDM256 mode.

Please don't hesitate to break current code if you can add full TDM256
and/or other TDM mode. You don't need to care compatibility with Renesas.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878rskp9l0.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4613: rename constraint to constraint_rates
Kuninori Morimoto [Tue, 5 Apr 2022 02:06:44 +0000 (02:06 +0000)]
ASoC: ak4613: rename constraint to constraint_rates

TDM support needs to use constraint_channels.
This patch renames current constraint to constraint_rates for it.
This is prepare for TDM support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6d0p9l7.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4613: priv has ctrl1 instead of iface
Kuninori Morimoto [Tue, 5 Apr 2022 02:06:34 +0000 (02:06 +0000)]
ASoC: ak4613: priv has ctrl1 instead of iface

Current priv is using ->iface, but it is not good match
to support TDM. This patch adds ->ctrl1 instead of it.
This is prepare for TDM support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bkxgp9lh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4613: return error if it was setup as clock provider
Kuninori Morimoto [Tue, 5 Apr 2022 02:06:25 +0000 (02:06 +0000)]
ASoC: ak4613: return error if it was setup as clock provider

Renesas is only user of ak4613 on upstream, and it is tested
only under "clock consumer" because of board mounting situation.

Thus, "clock provider" is not supperted/tested.
This patch return error if it was setup as clock provider.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87czhwp9lq.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4613: tidyup ak4613_interface
Kuninori Morimoto [Tue, 5 Apr 2022 02:06:17 +0000 (02:06 +0000)]
ASoC: ak4613: tidyup ak4613_interface

ak4613 driver is assuming symmetric format.
Thus, we don't need to have asymmetric table for judging the
iface at .hw_param.

This patch cleanup ak4613_interface for it.
This is prepare for TDM support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ee2cp9lz.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ak4613: add missing mutex_lock()
Kuninori Morimoto [Tue, 5 Apr 2022 02:06:08 +0000 (02:06 +0000)]
ASoC: ak4613: add missing mutex_lock()

We need to use mutex_lock() for priv->cnt / priv->iface,
but we are missing it at ak4613_dai_startup().
This patch adds missing mutex_lock() for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fsmsp9m7.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l45: Add driver for Cirrus Logic CS35L45 Smart Amp
James Schulman [Tue, 5 Apr 2022 13:54:19 +0000 (14:54 +0100)]
ASoC: cs35l45: Add driver for Cirrus Logic CS35L45 Smart Amp

The CS35L45 is a 15 V Boosted Mono Class D Amplifier with DSP
Speaker Protection and Adaptive Battery Management.

This initial driver provides standard non-boosted audio operation
without the DSP.

Signed-off-by: James Schulman <james.schulman@cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220405135419.1230088-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: dt-bindings: cs35l45: Cirrus Logic CS35L45 Smart Amp
Richard Fitzgerald [Tue, 5 Apr 2022 13:54:18 +0000 (14:54 +0100)]
ASoC: dt-bindings: cs35l45: Cirrus Logic CS35L45 Smart Amp

This adds the schema binding for the Cirrus Logic CS35L45 Smart Amp
and associated header file.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20220405135419.1230088-5-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-utils: Add kunit test for snd_soc_tdm_params_to_bclk()
Richard Fitzgerald [Tue, 5 Apr 2022 13:54:17 +0000 (14:54 +0100)]
ASoC: soc-utils: Add kunit test for snd_soc_tdm_params_to_bclk()

Create a new kunit test for soc-utils and use it to test
snd_soc_tdm_params_to_bclk().

The test uses a table of values to avoid the possibility that an
on-the-fly generator contains the same algorithmic error as the
function-under-test and so fails to detect a bug.

There is no need to test every possible combination of values.
Enough test cases are included to give confidence that the function
is producing the correct results.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220405135419.1230088-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-utils: Add helper to calculate BCLK from TDM info
Richard Fitzgerald [Tue, 5 Apr 2022 13:54:16 +0000 (14:54 +0100)]
ASoC: soc-utils: Add helper to calculate BCLK from TDM info

Add a helper function snd_soc_tdm_params_to_bclk() to calculate
the bclk from params info and the tdm sots configuration.

When using a TDM frame of N slots of width W bits:

   bclk = sample_rate * N * W

As a convenience to simplify calling code, if the slot count or
slot width are 0 a value will be obtained from the params. This
allows calling code to use this one function to handle cases of
TDM where only one parameter is fixed, or I2S where the slot width
is fixed (for example to set a 32-bit slot for 24-bit samples).

Also as a convenience the slot count can optionally be rounded up
to a multiple. This is mainly useful for I2S systems, since I2S has
two phases of LRCLK the number of slots is always a multiple of 2.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220405135419.1230088-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>