Commit graph

40784 commits

Author SHA1 Message Date
Geert Uytterhoeven
f41d2ece95
ASoC: amd: acp: Wrap AMD Audio ACP components in SND_SOC_AMD_ACP_COMMON
The build only descends into sound/soc/amd/acp/ if
CONFIG_SND_SOC_AMD_ACP_COMMON=y.  Hence all later config symbols should
depend on SND_SOC_AMD_ACP_COMMON, to prevent asking the user about
config symbols for driver code that won't be build anyway.

Fixes: 623621a9f9 ("ASoC: amd: Add common framework to support I2S on ACP SOC")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/53d1d63bed1865293e6f5085ead21cdbb068fb15.1635260849.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 17:32:02 +01:00
Richard Fitzgerald
a10148a8cf
ASoC: cs42l42: free_irq() before powering-down on probe() fail
Relying on devm to free the irq handler on probe failure leaves a
small window of opportunity for an interrupt to become pending and
then the handler to run after the chip has been reset and powered
off.

For safety cs42l42_probe() should free the irq in the error path.
As the irq is now disabled by the driver in probe() and remove()
there is no point allocating it as a devres-managed item, so
convert to plain non-devres.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211026125722.10220-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 14:31:10 +01:00
Richard Fitzgerald
6cb725b8a5
ASoC: cs42l42: Reset and power-down on remove() and failed probe()
Driver remove() should assert RESET and disable the supplies.

probe() fail was disabling supplies but it didn't assert reset or
put the codec into a power-down state.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211026125722.10220-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 14:31:09 +01:00
Srinivas Kandagatla
d075686867
ASoC: qdsp6: audioreach: add support for q6prm-clocks
Add q6prm clocks using existing qdsp6-audio-clock driver

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-18-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:12 +01:00
Srinivas Kandagatla
9a0e5d6fb1
ASoC: qdsp6: audioreach: add q6prm support
Add support to q6prm (Proxy Resource Manager) module used for clock resources

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-17-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:11 +01:00
Srinivas Kandagatla
30ad723b93
ASoC: qdsp6: audioreach: add q6apm lpass dai support
Add support to Audio port dais on LPASS Audio IP using
existing common q6dsp-lpass-ports.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-16-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:10 +01:00
Srinivas Kandagatla
9b4fe0f1cd
ASoC: qdsp6: audioreach: add q6apm-dai support
Add support to pcm dais in Audio Process Manager.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-15-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:09 +01:00
Srinivas Kandagatla
36ad9bf1d9
ASoC: qdsp6: audioreach: add topology support
Add ASoC topology support in audioreach

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-14-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:07 +01:00
Srinivas Kandagatla
cf989b68fc
ASoC: qdsp6: audioreach: add Kconfig and Makefile
Now that all the code for audioreach and q6apm are in at this point to be
able to compile, start adding Kconfig and Makefile changes.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-13-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:06 +01:00
Srinivas Kandagatla
25ab80db6b
ASoC: qdsp6: audioreach: add module configuration command helpers
Audioreach module configuration helpers, which will be used by
the q6apm-dai driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-12-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:05 +01:00
Srinivas Kandagatla
5477518b8a
ASoC: qdsp6: audioreach: add q6apm support
Add support to q6apm (Audio Process Manager) component which is
core Audioreach service running in the DSP.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-11-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:04 +01:00
Srinivas Kandagatla
44c28dbdb6
ASoC: qdsp6: audioreach: add basic pkt alloc support
Add basic helper functions for AudioReach.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-10-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:50:03 +01:00
Srinivas Kandagatla
9ab71ac372
ASoC: qdsp6: q6afe-clocks: move audio-clocks to common file
Move common parts of  q6afe-clocks to q6dsp-lpass-clocks so that we could
reuse most of the driver for new Q6DSP audio frameworks.

This is to make the code reuseable for new Q6DSP AudioReach framework.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-6-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:49:59 +01:00
Srinivas Kandagatla
95b6cd57e9
ASoC: qdsp6: q6afe-dai: move lpass audio ports to common file
Various Q6DSP frameworks will use LPASS Audio IP, so move all the hardware
specific details to a common file so that they could be reused across
multiple Q6DSP frameworks.

In this case all the audio ports definitions can be moved to a common file
to be able to reuse across multiple Q6DSP frameworks.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211026111655.1702-5-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 13:49:58 +01:00
Srinivasa Rao Mandadapu
9f589cf0f9
ASoC: codecs: Change bulk clock voting to optional voting in digital codecs
Change bulk clock frequency voting to optional bulk voting in va, rx and tx macros
to accommodate both ADSP and ADSP bypass based lpass architectures.

Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Co-developed-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/1635234188-7746-6-git-send-email-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 12:35:21 +01:00
Srinivasa Rao Mandadapu
7b285c74e4
ASoC: codecs: tx-macro: Update tx default values
Update mic control register default values to hardware reset values
lpass sc7280.

Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Co-developed-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/1635234188-7746-5-git-send-email-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 12:35:20 +01:00
Srinivasa Rao Mandadapu
864b9b5856
ASoC: codecs: tx-macro: Enable tx top soundwire mic clock
Enable tx path soundwire mic0 and mic1 clock.

Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Co-developed-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/1635234188-7746-4-git-send-email-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 12:35:19 +01:00
Srinivasa Rao Mandadapu
9d8c69814d
ASoC: qcom: Add compatible names in va,wsa,rx,tx codec drivers for sc7280
Add compatible names for sc7280 based targets in digital codec drivers
va,wsa,rx and tx.

Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Co-developed-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/1635234188-7746-2-git-send-email-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 12:35:17 +01:00
David Lin
6133148ca0
ASoC: nau8825: add clock management for power saving
Adjust dapm widget to manage clock from power event for power saving.

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Link: https://lore.kernel.org/r/20211025113857.3860951-3-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 12:35:16 +01:00
David Lin
c6167e10e7
ASoC: nau8825: add set_jack coponment support
Use set_jack ops to set jack for new machine drivers. Meanwhile,
the old machine drivers can still call previous export function
"nau8825_enable_jack_detect".

Signed-off-by: David Lin <CTLIN0@nuvoton.com>
Signed-off-by: Mac Chiang <mac.chiang@intel.com>
Link: https://lore.kernel.org/r/20211025113857.3860951-2-CTLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-26 12:35:15 +01:00
Johan Hovold
f4000b58b6 ALSA: line6: fix control and interrupt message timeouts
USB control and interrupt message timeouts are specified in milliseconds
and should specifically not vary with CONFIG_HZ.

Fixes: 705ececd1c ("Staging: add line6 usb driver")
Cc: stable@vger.kernel.org      # 2.6.30
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211025121142.6531-3-johan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-26 08:12:14 +02:00
Johan Hovold
9b371c6cc3 ALSA: 6fire: fix control and bulk message timeouts
USB control and bulk message timeouts are specified in milliseconds and
should specifically not vary with CONFIG_HZ.

Fixes: c6d43ba816 ("ALSA: usb/6fire - Driver for TerraTec DMX 6Fire USB")
Cc: stable@vger.kernel.org      # 2.6.39
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20211025121142.6531-2-johan@kernel.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-26 08:12:02 +02:00
Chengfeng Ye
b97053df0f ALSA: usb-audio: fix null pointer dereference on pointer cs_desc
The pointer cs_desc return from snd_usb_find_clock_source could
be null, so there is a potential null pointer dereference issue.
Fix this by adding a null check before dereference.

Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
Link: https://lore.kernel.org/r/20211024111736.11342-1-cyeaa@connect.ust.hk
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-26 08:05:23 +02:00
Chengfeng Ye
a0d21bb327 ALSA: gus: fix null pointer dereference on pointer block
The pointer block return from snd_gf1_dma_next_block could be
null, so there is a potential null pointer dereference issue.
Fix this by adding a null check before dereference.

Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
Link: https://lore.kernel.org/r/20211024104611.9919-1-cyeaa@connect.ust.hk
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-26 08:02:16 +02:00
Pavel Skripkin
3ab7992018 ALSA: mixer: fix deadlock in snd_mixer_oss_set_volume
In commit 411cef6adf ("ALSA: mixer: oss: Fix racy access to slots")
added mutex protection in snd_mixer_oss_set_volume(). Second
mutex_lock() in same function looks like typo, fix it.

Reported-by: syzbot+ace149a75a9a0a399ac7@syzkaller.appspotmail.com
Fixes: 411cef6adf ("ALSA: mixer: oss: Fix racy access to slots")
Cc: <stable@vger.kernel.org>
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Link: https://lore.kernel.org/r/20211024140315.16704-1-paskripkin@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-26 07:59:40 +02:00
Stephan Gerhold
4b29d5a0bd
ASoC: qcom: common: Respect status = "disabled" on DAI link nodes
At the moment, the DAI link nodes in the device tree always have to be
specified completely in each device tree. However, the available
interfaces (e.g. Primary/Secondary/Tertiary/Quaternary MI2S) are common
for all devices of a SoC, so the majority of the definitions can be
placed in a common device tree include to reduce boilerplate.

Make it possible to define such stubs in device tree includes by
respecting the "status" property for the DAI link nodes. This is
a trivial change that just requires switching to the _available_
OF functions that check the "status" property additionally.

This allows defining a stub like:

	sound_dai_quaternary: dai-link-quaternary {
		link-name = "Quaternary MI2S";
		status = "disabled"; /* Needs extra codec configuration */
		cpu {
			sound-dai = <&q6afedai QUATERNARY_MI2S_RX>;
		};
		platform {
			sound-dai = <&q6routing>;
		};
	};

where the codec would be filled in by the device-specific device tree.

For existing device trees this change does not make any difference.
A missing "status" property is treated like status = "okay".

Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211025105503.49444-1-stephan@gerhold.net
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 17:41:25 +01:00
Richard Fitzgerald
2003c44e28
ASoC: cs42l42: Prevent NULL pointer deref in interrupt handler
The interrupt handling code was getting the struct device* from a
struct snd_soc_component* stored in struct cs42l42_private. If the
interrupt was asserted before ASoC calls component_probe() the
snd_soc_component* will be NULL.

The stored snd_soc_component* is not actually used for anything other
than indirectly getting the struct device*. Remove it, and store the
struct device* in struct cs42l42_private.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211025112258.9282-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:38:24 +01:00
Geert Uytterhoeven
044c114014
ASoC: wm8962: Convert to devm_clk_get_optional()
Use the existing devm_clk_get_optional() helper instead of building a
similar construct on top of devm_clk_get() that fails to handle all
errors but -EPROBE_DEFER.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/c2a8a1a628804a4439732d02847e25c227083690.1634565564.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:36:21 +01:00
Julian Braha
3e701151fe
ASoC: fix unmet dependency on GPIOLIB for SND_SOC_MAX98357A
When SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH is selected,
and GPIOLIB is not selected, Kbuild gives the
following warnings:

WARNING: unmet direct dependencies detected for SND_SOC_MAX98357A
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_INTEL_DA7219_MAX98357A_GENERIC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y]

WARNING: unmet direct dependencies detected for SND_SOC_DMIC
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_INTEL_DA7219_MAX98357A_GENERIC [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y]

WARNING: unmet direct dependencies detected for SND_SOC_INTEL_DA7219_MAX98357A_GENERIC
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] && SND_SOC_INTEL_KBL [=y] && I2C [=y] && ACPI [=y] && (MFD_INTEL_LPSS [=y] || COMPILE_TEST [=n])

This is because SND_SOC_DMIC and SND_SOC_MAX98357A are
selected by SND_SOC_INTEL_DA7219_MAX98357A_GENERIC, which
is also selected by SND_SOC_INTEL_KBL_DA7219_MAX98357A_MACH.
However, the selectors do not depend on or select GPIOLIB,
despite SND_SOC_DMIC and SND_SOC_MAX98357A depending on GPIOLIB.

These unmet dependency bugs were detected by Kismet,
a static analysis tool for Kconfig. Please advise if this
is not the appropriate solution.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
Link: https://lore.kernel.org/r/20211025010615.10070-1-julianbraha@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:36:20 +01:00
Uwe Kleine-König
ca7270a7b6
ASoC: cs35l41: Make cs35l41_remove() return void
Up to now cs35l41_remove() returns zero unconditionally. Make it
return void instead which makes it easier to see in the callers that
there is no error to handle.

Also the return value of i2c, platform and spi remove callbacks is
ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211020132416.30288-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:36:19 +01:00
Uwe Kleine-König
03f0267b09
ASoc: wm8900: Drop empty spi_driver remove callback
A driver with a remove callback that just returns 0 behaves identically
to a driver with no remove callback at all. So simplify accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211020125726.22946-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:36:18 +01:00
Dmitry Osipenko
824edd866a
ASoC: tegra: Set default card name for Trimslice
The default card name for Trimslice device should be "tegra-trimslice".
It got lost by accident during unification of machine sound drivers,
fix it.

Cc: <stable@vger.kernel.org>
Fixes: cc8f70f560 ("ASoC: tegra: Unify ASoC machine drivers")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20211024192853.21957-2-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:36:17 +01:00
Dmitry Osipenko
de8fc2b0a3
ASoC: tegra: Restore AC97 support
The device-tree of AC97 codecs need to be parsed differently from I2S
codecs, plus codec device may need to be created. This was missed by the
patch that unified machine drivers into a single driver, fix it. It should
restore audio on Toradex Colibri board.

Cc: <stable@vger.kernel.org>
Fixes: cc8f70f560 ("ASoC: tegra: Unify ASoC machine drivers")
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20211024192853.21957-1-digetx@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:36:16 +01:00
Uwe Kleine-König
8b27cb2e6d
ASoc: wm8731: Drop empty spi_driver remove callback
A driver with a remove callback that just returns 0 behaves identically
to a driver with no remove callback at all. So simplify accordingly.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211020125803.23117-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:36:15 +01:00
Ajit Kumar Pandey
8a8e1b90bd
ASoC: amd: acp: Add acp_machine struct for renoir platform.
Add acpi_mach struct for renoir platform to select machine driver
based on codec and amp ACPI id.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211025074808.471333-1-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-25 12:36:13 +01:00
Mark Brown
e8e8c4a5d1
Merge series "ASoC: Add common modules support for ACP hw block" from Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>:
changes since v3:
- rebase and fixes merge conflict.
- Fixed kernel autobot warning.

Ajit Kumar Pandey (8):
  ASoC: amd: Add common framework to support I2S on ACP SOC
  ASoC: amd: acp: Add I2S support on Renoir platform
  ASoC: amd: acp: Add callback for machine driver on ACP
  ASoC: amd: acp: Add generic machine driver support for ACP cards
  ASoC: amd: acp: Add legacy sound card support for Chrome audio
  ASoC: amd: acp: Add SOF audio support on Chrome board
  ASoC: amd: acp: Add support for Maxim amplifier codec
  ASoC: amd: acp: Add support for RT5682-VS codec

 sound/soc/amd/Kconfig                |   2 +
 sound/soc/amd/Makefile               |   1 +
 sound/soc/amd/acp/Kconfig            |  51 +++
 sound/soc/amd/acp/Makefile           |  26 ++
 sound/soc/amd/acp/acp-i2s.c          | 340 +++++++++++++++
 sound/soc/amd/acp/acp-legacy-mach.c  | 104 +++++
 sound/soc/amd/acp/acp-mach-common.c  | 600 +++++++++++++++++++++++++++
 sound/soc/amd/acp/acp-mach.h         |  57 +++
 sound/soc/amd/acp/acp-platform.c     | 315 ++++++++++++++
 sound/soc/amd/acp/acp-renoir.c       | 144 +++++++
 sound/soc/amd/acp/acp-sof-mach.c     | 131 ++++++
 sound/soc/amd/acp/amd.h              | 146 +++++++
 sound/soc/amd/acp/chip_offset_byte.h |  76 ++++
 13 files changed, 1993 insertions(+)
 create mode 100644 sound/soc/amd/acp/Kconfig
 create mode 100644 sound/soc/amd/acp/Makefile
 create mode 100644 sound/soc/amd/acp/acp-i2s.c
 create mode 100644 sound/soc/amd/acp/acp-legacy-mach.c
 create mode 100644 sound/soc/amd/acp/acp-mach-common.c
 create mode 100644 sound/soc/amd/acp/acp-mach.h
 create mode 100644 sound/soc/amd/acp/acp-platform.c
 create mode 100644 sound/soc/amd/acp/acp-renoir.c
 create mode 100644 sound/soc/amd/acp/acp-sof-mach.c
 create mode 100644 sound/soc/amd/acp/amd.h
 create mode 100644 sound/soc/amd/acp/chip_offset_byte.h

--
2.25.1
2021-10-23 17:30:02 +01:00
Mark Brown
d96e75bb1d
Merge series "Add Yellow Carp platform ASoC driver" from Vijendar Mukunda <Vijendar.Mukunda@amd.com>:
Yellow Carp platform is new APU series based on acp6.x design.
This patch set adds an ASoC driver for the ACP (Audio CoProcessor)
block on AMD Yellow Carp APU with DMIC endpoint support.

changes since v1:
  - fixed SPDX commenting style in acp6x pci driver.
  - fixed Copyright commenting style in acp6x pci driver,
    pdm dma driver and machine driver files.
  - fixed local variable check logic in acp6x_power_on() function.
  - fixed Kconfig indentation issue
  - removed irq_flag local variable in irq handler.
  - add dmi info check in machine driver probe

Vijendar Mukunda (13):
  ASoC: amd: add Yellow Carp ACP6x IP register header
  ASoC: amd: add Yellow Carp ACP PCI driver
  ASoC: amd: add acp6x init/de-init functions
  ASoC: amd: add platform devices for acp6x pdm driver and dmic driver
  ASoC: amd: add acp6x pdm platform driver
  ASoC: amd: add acp6x irq handler
  ASoC: amd: add acp6x pdm driver dma ops
  ASoC: amd: add acp6x pci driver pm ops
  ASoC: amd: add acp6x pdm driver pm ops
  ASoC: amd: enable Yellow carp acp6x drivers build
  ASoC: amd: create platform device for acp6x machine driver
  ASoC: amd: add YC machine driver using dmic
  ASoC: amd: enable Yellow Carp platform machine driver build

 sound/soc/amd/Kconfig                     |  21 +
 sound/soc/amd/Makefile                    |   1 +
 sound/soc/amd/yc/Makefile                 |   9 +
 sound/soc/amd/yc/acp6x-mach.c             | 194 ++++++++++
 sound/soc/amd/yc/acp6x-pdm-dma.c          | 448 ++++++++++++++++++++++
 sound/soc/amd/yc/acp6x.h                  | 107 ++++++
 sound/soc/amd/yc/acp6x_chip_offset_byte.h | 444 +++++++++++++++++++++
 sound/soc/amd/yc/pci-acp6x.c              | 338 ++++++++++++++++
 8 files changed, 1562 insertions(+)
 create mode 100644 sound/soc/amd/yc/Makefile
 create mode 100644 sound/soc/amd/yc/acp6x-mach.c
 create mode 100644 sound/soc/amd/yc/acp6x-pdm-dma.c
 create mode 100644 sound/soc/amd/yc/acp6x.h
 create mode 100644 sound/soc/amd/yc/acp6x_chip_offset_byte.h
 create mode 100644 sound/soc/amd/yc/pci-acp6x.c

--
2.25.1
2021-10-23 17:29:20 +01:00
Mark Brown
866d744434
Merge series "ASoC: meson: axg: fix TDM channel order sync" from Jerome Brunet <jbrunet@baylibre.com>:
On the Amlogic AXG series, the TODDR FIFO may get out of sync with the TDM
decoder if the decoder is started before the FIFO. The channel appears
shifted in memory in an unpredictable way.

To fix this, the trick is to start the FIFO before the TDM decoder. This
way the FIFO is already waiting when the 1st channel is produced and it is
correctly placed in memory.

Jerome Brunet (2):
  ASoC: meson: axg-card: make links nonatomic
  ASoC: meson: axg-tdm-interface: manage formatters in trigger

 sound/soc/meson/axg-card.c          |  1 +
 sound/soc/meson/axg-tdm-interface.c | 26 +++++++++++++++++++++-----
 2 files changed, 22 insertions(+), 5 deletions(-)

--
2.33.0
2021-10-23 14:32:19 +01:00
Derek Fang
e7ee1ac4ec
ASoC: rt5682s: Downsizing the DAC volume scale
Use 0.75db/step of DAC volume instead of 1.5 to get
a more smooth volume curve.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20211021120303.4601-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-23 14:17:00 +01:00
Jerome Brunet
bf5e4887ee
ASoC: meson: axg-tdm-interface: manage formatters in trigger
So far, the formatters have been reset/enabled using the .prepare()
callback. This was done in this callback because walking the formatters use
a mutex so it could not be done in .trigger(), which is atomic by default.

It turns out there is a problem on capture path of the AXG series.
The FIFO may get out of sync with the TDM decoder if the IP are not enabled
in a specific order. The FIFO must be enabled before the formatter starts
producing data. IOW, we must deal with FE before the BE. The .prepare()
callback is called on the BEs before the FE so it is not OK for the AXG.

The .trigger() callback order can be configured, and it deals with the FE
before the BEs by default. To solve our problem, we just need to start and
stop the formatters from the .trigger() callback. It is OK do so now that
the links have been made 'nonatomic' in the card driver.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20211020114217.133153-3-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-22 13:25:48 +01:00
Jerome Brunet
e138233e56
ASoC: meson: axg-card: make links nonatomic
Non atomic operations need to be performed in the trigger callback
of the TDM interfaces. Those are BEs but what matters is the nonatomic
flag of the FE in the DPCM context. Just set nonatomic for everything so,
at least, it is clear.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20211020114217.133153-2-jbrunet@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-22 13:25:47 +01:00
Richard Fitzgerald
c778c01d3e
ASoC: cs42l42: Remove unused runtime_suspend/runtime_resume callbacks
The driver has runtime_suspend and runtime_resume callbacks, but
pm_runtime is never enabled so these functions won't be called. They
could not be used anyway because the runtime_suspend would cause jack
detect to stop working.

These functions are unused - delete them.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211018164431.5871-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-22 01:55:25 +01:00
Julian Braha
6cace797f1
ASoC: fix unmet dependency on GPIOLIB
When SND_SOC_SC7180 or SND_SOC_STORM is selected,
and GPIOLIB is not selected, Kbuild gives the following
warning:

WARNING: unmet direct dependencies detected for SND_SOC_MAX98357A
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_STORM [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_QCOM [=y]
  - SND_SOC_SC7180 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_QCOM [=y] && I2C [=y]

This is because SND_SOC_MAX98357A is selected
by SND_SOC_STORM and SND_SOC_SC7180, but
these config options do not select or depend on
GPIOLIB, despite SND_SOC_MAX98357A depending on
GPIOLIB.

These unmet dependency bugs were detected by Kismet,
a static analysis tool for Kconfig. Please advise if this
is not the appropriate solution.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
Link: https://lore.kernel.org/r/20211010215627.17869-1-julianbraha@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-22 01:55:24 +01:00
Mark Brown
324081ab79
Merge branch 'asoc-5.15' into asoc-5.16 2021-10-21 14:41:32 +01:00
Johnathon Clark
5fc462c3aa ALSA: hda/realtek: Fix mic mute LED for the HP Spectre x360 14
On the 'HP Spectre x360 Convertible 14-ea0xx' the microphone mute led is
controlled by GPIO 0x04. The speaker mute LED does not seem to be
exposed by GPIO and is there not set.

[ a slight coding-style fix by tiwai ]

Fixes: c3bb2b5219 ("ALSA: hda/realtek: Quirk for HP Spectre x360 14 amp setup")
Signed-off-by: Johnathon Clark <john.clark@cantab.net>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211020131253.35894-1-john.clark@cantab.net
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-21 07:06:49 +02:00
Takashi Iwai
411cef6adf ALSA: mixer: oss: Fix racy access to slots
The OSS mixer can reassign the mapping slots dynamically via proc
file.  Although the addition and deletion of those slots are protected
by mixer->reg_mutex, the access to slots aren't, hence this may cause
UAF when the slots in use are deleted concurrently.

This patch applies the mixer->reg_mutex in all appropriate code paths
(i.e. the ioctl functions) that may access slots.

Reported-by: syzbot+9988f17cf72a1045a189@syzkaller.appspotmail.com
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/00000000000036adc005ceca9175@google.com
Link: https://lore.kernel.org/r/20211020164846.922-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-21 07:03:47 +02:00
Alexander Sverdlin
f4ff6b56bc
ASoC: cirrus: i2s: Prepare clock before using it
Use clk_prepare_enable()/clk_disable_unprepare() in preparation for switch
to Common Clock Framework, otherwise the following is visible:

WARNING: CPU: 0 PID: 97 at drivers/clk/clk.c:1011 clk_core_enable+0x9c/0xbc
Enabling unprepared mclk
...
Hardware name: Cirrus Logic EDB9302 Evaluation Board
...
clk_core_enable
clk_core_enable_lock
ep93xx_i2s_hw_params
snd_soc_dai_hw_params
soc_pcm_hw_params
snd_pcm_hw_params
snd_pcm_ioctl
...

Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211018103105.146380-2-alexander.sverdlin@gmail.com'
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2021-10-20 17:46:36 +02:00
Mark Brown
4304150553
Merge series "ASoC: qcom: sm8250: add support for TX and RX Macro dais" from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:
This patchset adds support for testing WCD938X connected via TX and RX Macros
on SM8250 MTP.

Srinivas Kandagatla (2):
  ASoC: qcom: sm8250: add support for TX and RX Macro dais
  ASoC: qcom: sm8250: Add Jack support

 sound/soc/qcom/sm8250.c | 79 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)

--
2.21.0
2021-10-20 12:11:40 +01:00
Ajit Kumar Pandey
8b72562668
ASoC: amd: acp: Add support for RT5682-VS codec
In newer variants primary codec is rt5682vs. Add support for newer
codec variants in generic machine driver module and define driver
data to register SOF sound card.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211019070938.5076-9-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:57 +01:00
Ajit Kumar Pandey
cabc3acec0
ASoC: amd: acp: Add support for Maxim amplifier codec
In newer chrome boards we have max98360a as an amplifier codec.
Add support for max98360a in generic machine driver and configure
driver data to enable SOF sound card support on newer boards .

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211019070938.5076-8-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:56 +01:00
Ajit Kumar Pandey
9f84940f50
ASoC: amd: acp: Add SOF audio support on Chrome board
Chrome board has RT5682 codec and RT1019 amp connected to I2S SP
controller on ACP hw. Also it support DMIC capture endpoints with
inbuilt pdm controller on ACP hw block. Add driver module to create
backend dai links for sof dsp core. We pass driver data with audio
end points configuration to register sound cards and create device
nodes for all audio endpoints.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211019070938.5076-7-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:55 +01:00
Ajit Kumar Pandey
9d8a7be88b
ASoC: amd: acp: Add legacy sound card support for Chrome audio
Renoir based Chrome board has RT5682 as primary headset codec and
RT1019 amp device connected to I2SSP ACP i2s controller. Add driver
to register legacy sound card devices on Chrome board.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211019070938.5076-6-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:54 +01:00
Ajit Kumar Pandey
d4c750f2c7
ASoC: amd: acp: Add generic machine driver support for ACP cards
We have machines with different audio endpoints configurations
across various distributions. We need to support multiple sound
cards for different combinations of I2S instance and codecs hw.
Now we also need to support SOF-DSP endpoints based sound cards.
All such card combinations slightly differs in terms of machine
ops callback. This patch adds ACP generic machine driver module
that exposes method to create ACP cards dai links and define new
ops for audio endpoints configurations. Initially we have added
dailink support for RT5682 and RT1019 codec connection with ACP
I2S_SP instance. We will add newer codecs in this module to use
this for all AMD's ACP block sound cards supports in future.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211019070938.5076-5-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:53 +01:00
Ajit Kumar Pandey
e646b51f5d
ASoC: amd: acp: Add callback for machine driver on ACP
Add method to select and register machine driver for acp platform
based on ACPI ID.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211019070938.5076-4-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:52 +01:00
Ajit Kumar Pandey
58c8c8438d
ASoC: amd: acp: Add I2S support on Renoir platform
Add I2S dai driver for Renoir platform and register with common
acp framework to support non dsp I2S use case on Renoir.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211019070938.5076-3-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:50 +01:00
Ajit Kumar Pandey
623621a9f9
ASoC: amd: Add common framework to support I2S on ACP SOC
We are using legacy way of exposing dais and DMA configuration that
requires separate driver modules for various ACP SOC with almost
similar hw configuration. Moreover the legacy approach requires
separate I2S and DMA module platform devices registration and need
machine specific quirk to control various I2S endpoints. Add generic
dai driver and platform driver for I2S controller on ACP hw block.
This common framework can be used by various ACP platform devices
that shares common specs.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211019070938.5076-2-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:49 +01:00
Sugar Zhang
5ba8ecf227
ASoC: rockchip: Use generic dmaengine code
This reverts commit 75b31192fe.

The original purpose of customized pcm was to config prealloc buffer size
flexibly. but, we can do the same thing by soc-generic-dmaengine-pcm.

And the generic one can generated the better config by querying DMA
capabilities from dmaengine driver rather than the Hard-Coded one.

e.g.

the customized one:

  static const struct snd_pcm_hardware snd_rockchip_hardware = {
         .info                   = SNDRV_PCM_INFO_MMAP |
                                   SNDRV_PCM_INFO_MMAP_VALID |
                                   SNDRV_PCM_INFO_PAUSE |
                                   SNDRV_PCM_INFO_RESUME |
                                   SNDRV_PCM_INFO_INTERLEAVED,
  ...

the generic one:

  ret = dma_get_slave_caps(chan, &dma_caps);
  if (ret == 0) {
          if (dma_caps.cmd_pause && dma_caps.cmd_resume)
                  hw.info |= SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME;
          if (dma_caps.residue_granularity <= DMA_RESIDUE_GRANULARITY_SEGMENT)
                  hw.info |= SNDRV_PCM_INFO_BATCH;
  ...

So, let's revert back to use the generic dmaengine pcm.

Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
Reviewed-by: John Keeping <john@metanate.com>
Link: https://lore.kernel.org/r/1632792957-80428-1-git-send-email-sugar.zhang@rock-chips.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-20 11:12:42 +01:00
Hans de Goede
cd45c9bf8b ASoC: Intel: Move soc_intel_is_foo() helpers to a generic header
The soc_intel_is_foo() helpers from
sound/soc/intel/common/soc-intel-quirks.h are useful outside of the
sound subsystem too.

Move these to include/linux/platform_data/x86/soc.h, so that
other code can use them too.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211018143324.296961-2-hdegoede@redhat.com
2021-10-19 17:31:24 +02:00
Takashi Iwai
f917c04fac ALSA: memalloc: Fix a typo in snd_dma_buffer_sync() description
It caused a warning for kernel-doc build.

Fixes: a25684a956 ("ALSA: memalloc: Support for non-contiguous page allocation")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Link: https://lore.kernel.org/r/20211019165402.4fa82c38@canb.auug.org.au
Link: https://lore.kernel.org/r/20211019060536.26089-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-19 08:07:41 +02:00
Marco Giunta
2966492372 ALSA: usb-audio: Fix microphone sound on Jieli webcam.
When a Jieli Technology USB Webcam is connected, the video part works
well, but the mic sound is speeded up. On dmesg there are messages
about different rates from the runtime rates, warnings about volume
resolution and lastly, the log is filled, every 5 seconds, with
retire_capture_urb error messages.

The mic works only when ep packet size is set to wMaxPacketSize (normal
sound and no more retire_capture_urb error messages). Skipping reading
sample rate, fixes the messages about different rates and forcing a volume
resolution, fixes warnings about volume range. I have arbitrarily choosed
the value (16): I read in a comment that there should be no more than 255
levels, so 4096 (max volume) / 16 = 0-255.

Signed-off-by: Marco Giunta <giun7a@gmail.com>
Link: https://lore.kernel.org/r/20211018162552.12082-1-giun7a@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-19 08:07:01 +02:00
Mark Brown
bfceb9c216
Merge branch 'asoc-5.15' into asoc-5.16 2021-10-18 21:15:13 +01:00
Srinivas Kandagatla
810532e739
ASoC: qcom: sm8250: Add Jack support
WCD938X on SM8250 MTP is connected via TX macro which has MBHC support,
So add this jack support in the soundcard driver too.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211006172745.22103-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:50 +01:00
Srinivas Kandagatla
961e7ba550
ASoC: qcom: sm8250: add support for TX and RX Macro dais
On SM8250 MTP boards WCD938x codec is connected via TX and RX Macros,
so add support for this dais in the soundcard driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20211006172745.22103-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:49 +01:00
Vijendar Mukunda
a80d7edadf
ASoC: amd: enable Yellow Carp platform machine driver build
This patch enables Yellow Carp platform machine driver build.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-14-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:47 +01:00
Vijendar Mukunda
fa991481b8
ASoC: amd: add YC machine driver using dmic
Add Yellow Carp platform machine driver using dmic.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-13-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:46 +01:00
Vijendar Mukunda
058dfdf37f
ASoC: amd: create platform device for acp6x machine driver
Create platform device for acp6x machine driver.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-12-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:45 +01:00
Vijendar Mukunda
89728d97db
ASoC: amd: enable Yellow carp acp6x drivers build
Yellow Carp ACP6x drivers can be built by selecting necessary
kernel config option.
The patch enables build support of the same.

Signed-off-by: Vijendar Mukunda<Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-11-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:44 +01:00
Vijendar Mukunda
4c2e711af2
ASoC: amd: add acp6x pdm driver pm ops
Add acp6x pdm driver pm ops.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-10-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:43 +01:00
Vijendar Mukunda
c8212df7bc
ASoC: amd: add acp6x pci driver pm ops
Add acp6x pci driver pm ops.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-9-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:43 +01:00
Vijendar Mukunda
ceb4fcc13a
ASoC: amd: add acp6x pdm driver dma ops
This patch adds PDM driver DMA operations.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-8-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:42 +01:00
Vijendar Mukunda
cc0deaa2dc
ASoC: amd: add acp6x irq handler
Add ACP6x irq handler for handling irq events for ACP IP.
Add pdm irq events handling.
Whenever audio data equal to the PDM watermark level are consumed,
interrupt is generated. Acknowledge the interrupt.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-7-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:41 +01:00
Vijendar Mukunda
7610174a5b
ASoC: amd: add acp6x pdm platform driver
PDM platform driver binds to the platform device created by
ACP6x PCI device. PDM driver registers ALSA DMA and CPU DAI
components with ASoC framework.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-6-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:40 +01:00
Vijendar Mukunda
fc329c1de4
ASoC: amd: add platform devices for acp6x pdm driver and dmic driver
ACP6.x IP has PDM decoder block.
Create a platform device for it, so that the PDM platform driver
can be bound to this device.
Pass PCI resources like MMIO to this platform device.

Create a platform device for generic dmic codec driver.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-5-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:39 +01:00
Vijendar Mukunda
8c7161f2c9
ASoC: amd: add acp6x init/de-init functions
Add Yellow Carp platform ACP6x PCI driver init/deinit functions.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-4-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:38 +01:00
Vijendar Mukunda
c62442bd5d
ASoC: amd: add Yellow Carp ACP PCI driver
ACP is a PCI audio device.
This patch adds PCI driver to bind to this device and get
PCI resources.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-3-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:37 +01:00
Vijendar Mukunda
53880e382b
ASoC: amd: add Yellow Carp ACP6x IP register header
Add register header for ACP6x IP in Yellow Carp platform.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211018112044.1705805-2-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 21:11:36 +01:00
Mark Brown
a79b02d5f2
Merge series "ASoC: cleanup / tidyup soc-pcm/core/component" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

These are not a big deal, but cleanup / tidyup patch for ALSA SoC.

Kuninori Morimoto (5):
  ASoC: soc-pcm: tidyup soc_pcm_hw_clean() - step1
  ASoC: soc-pcm: tidyup soc_pcm_hw_clean() - step2
  ASoC: soc-component: add snd_soc_component_is_codec()
  ASoC: soc-core: tidyup empty function
  ASoC: soc-core: accept zero format at snd_soc_runtime_set_dai_fmt()

 include/sound/soc-component.h         |  5 +++
 sound/soc/generic/simple-card-utils.c |  4 +--
 sound/soc/meson/meson-codec-glue.c    |  3 --
 sound/soc/soc-core.c                  | 51 ++++++++-------------------
 sound/soc/soc-pcm.c                   | 13 +++----
 5 files changed, 26 insertions(+), 50 deletions(-)

--
2.25.1
2021-10-18 21:10:09 +01:00
Nicolas Frattaroli
0ea15e98cf
ASoC: rockchip: i2s-tdm: Fix refcount test
During development of V5 of the i2s-tdm patch series, I replaced
the atomic refcount with a regular integer, as it was only ever
accessed within a spinlock.

Foolishly, I got the semantics of atomic_dec_and_test wrong, which
resulted in a test for 0 actually becoming a test for >0.

The result was that setting the audio frequency broke; switching
from 44100 Hz audio playback to 96000 Hz audio playback would
garble the sound most unpleasantly.

Fix this by checking for --refcount == 0, which is what it should
have been all along.

Fixes: 081068fd64 ("ASoC: rockchip: add support for i2s-tdm controller")
Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Link: https://lore.kernel.org/r/20211015210730.308946-1-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:44 +01:00
Christian Hewitt
bc387887ae
ASoC: meson: implement driver_name for snd_soc_card in meson-card-utils
Implement driver_name to provide an alternative to card_name for userspace
configuration of Amlogic audio cards.

Suggested-by: Matthias Reichl <hias@horus.com>
Signed-off-by: Christian Hewitt <christianshewitt@gmail.com>
Acked-by: Jerome Brunet <jbrunet@baylibre.com>
Link: https://lore.kernel.org/r/20211017160028.23318-1-christianshewitt@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:43 +01:00
Uwe Kleine-König
0f884099a5
ASoC: tlv320aic32x4: Make aic32x4_remove() return void
Up to now aic32x4_remove() returns zero unconditionally. Make it return
void instead which makes it easier to see in the callers that there is
no error to handle.

Also the return value of i2c and spi remove callbacks is ignored anyway.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211015071113.2795767-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:42 +01:00
Kuninori Morimoto
7db07e37e1
ASoC: soc-core: accept zero format at snd_soc_runtime_set_dai_fmt()
Do nothing if format was zero at snd_soc_runtime_set_dai_fmt().
soc-core.c can be more simple code by this patch.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ee8jt7d3.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:40 +01:00
Kuninori Morimoto
41b1774fb8
ASoC: soc-core: tidyup empty function
This patch makes empty function to 1 line.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fsszt7dd.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:38 +01:00
Kuninori Morimoto
01e90ee15e
ASoC: soc-component: add snd_soc_component_is_codec()
Checking .non_legacy_dai_naming is not readable.
Let's add new snd_soc_component_is_codec().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7dft7dn.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:37 +01:00
Kuninori Morimoto
86e4aef6c9
ASoC: soc-pcm: tidyup soc_pcm_hw_clean() - step2
DAI active count is not exchanged during for_each_rtd_dais()
loops. We don't need to keep snd_soc_dai_stream_active() as
"active" on soc_pcm_hw_clean(). This patch avoid verbose code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ilxvt7e6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:36 +01:00
Kuninori Morimoto
121966d03b
ASoC: soc-pcm: tidyup soc_pcm_hw_clean() - step1
soc_pcm_hw_clean() is using "continue" during for_each_rtd_dais(),
but it is very verbose. This patch cleanup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0ibt7ej.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-18 13:56:35 +01:00
Mark Brown
b8f3b56493 Linux 5.15-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmFtDW0eHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGHDUH+gL+6mKumVgT8HuZ
 r2u7oETr4MCNIPHOkKZ6EYLDcC5jNcBULjs+IVjN3/KXKHdHZg+KU9Uj2gnS44bt
 NBZ1CAGSUAmE4dS2ahzyBaVwfmo9vV+XNOJxhlr5HxPKxMxp67GHqimTn0E3BPoF
 shDKZ52KDGDz6Ae7eVYlZ1Kv3RdgdlNDSoCELzXXK1L69FScp9YU/nKQ1E5nKIFa
 hC4TC1RgQi/Fhv/YdDBsY467lVCLikIWClm04A0zyP5qQIJUhCITkKhdhUrE5uBR
 A8icsDBy//d4Y6BE1/9GCayPNpBg94gpu0zEqBlBw8llTtIGqaxZ7fGr3szXSC25
 qedpPUw=
 =mnCx
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmFtba0ACgkQJNaLcl1U
 h9BE0Af+Kal8qYR8tiTbHildLUldTsS36YhIw+WEjZueX55rOPAbCHf6t3oTpTdz
 dZ9ByH89yKZ892DZfJZ4hYiUNIQOrVRNHVF0+Mr8mjKnuySHtleO/F2NeSam5N0/
 86UHp7MkOylKr1jlgBZfRZdegBw6mwhbFGRw9coOlDsEh+d3WCadRczwvMP2sJ69
 t8bt5RGrLtO6pSksRdtwl3mW7M/f99x3BZwKfPp5eDCUyXGlys3cHUH+ojqF8JZl
 UGt2K0oqpcniW0j99/MjzHOxfz19Hjf0w2b/khk6HkqISaxNyJcs0YW8vpiqwBUc
 xFZqMcSk7Ny7ZeFaw8hD1aeIEYpeBA==
 =AaU+
 -----END PGP SIGNATURE-----

Merge tag 'v5.15-rc6' into asoc-5.16

Linux 5.15-rc6
2021-10-18 13:50:42 +01:00
Takashi Iwai
2d9ea39917 ALSA: memalloc: Convert x86 SG-buffer handling with non-contiguous type
We've had an x86-specific SG-buffer handling code, but now it can be
merged gracefully with the standard non-contiguous DMA pages.

After the migration, SNDRV_DMA_TYPE_DMA_SG becomes identical with
SNDRV_DMA_TYPE_NONCONTIG on x86, while others still fall back to
SNDRV_DMA_TYPE_DEV.

The remaining problem is about the SG-buffer with WC pages: the DMA
core stuff on x86 doesn't treat it well, so we still need some special
handling to manipulate the page attribute manually.  The mmap handler
for SNDRV_DMA_TYPE_DEV_SG_WC still returns -ENOENT intentionally for
the fallback to the default handler.

Link: https://lore.kernel.org/r/20211017074859.24112-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-18 13:32:13 +02:00
Takashi Iwai
73325f60e2 ALSA: memalloc: Support for non-coherent page allocation
Following to the addition of non-contiguous pages, this patch adds the
new contiguous non-coherent page allocation to the standard memalloc
helper.  Like the previous non-contig type, this non-coherent type is
also directional and requires the explicit sync, too.  Hence the
driver using this type of buffer may need to set
SNDRV_PCM_INFO_EXPLICIT_SYNC flag to the PCM hardware.info as well,
unless it's set up in the managed mode.

Link: https://lore.kernel.org/r/20211017074859.24112-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-18 13:32:12 +02:00
Takashi Iwai
a25684a956 ALSA: memalloc: Support for non-contiguous page allocation
This patch adds the support for allocation of non-contiguous DMA pages
in the common memalloc helper.  It's another SG-buffer type, but
unlike the existing one, this is directional and requires the explicit
sync / invalidation of dirty pages on non-coherent architectures.

For this enhancement, the following points are changed:
- snd_dma_device stores the DMA direction.
- snd_dma_device stores need_sync flag indicating whether the explicit
  sync is required or not.
- A new variant of helper functions, snd_dma_alloc_dir_pages() and
  *_all() are introduced; the old snd_dma_alloc_pages() and *_all()
  kept as just wrappers with DMA_BIDIRECTIONAL.
- A new helper snd_dma_buffer_sync() is introduced; this gets called
  in the appropriate places.
- A new allocation type, SNDRV_DMA_TYPE_NONCONTIG, is introduced.

When the driver allocates pages with this new type, and it may require
the SNDRV_PCM_INFO_EXPLICIT_SYNC flag set to the PCM hardware.info for
taking the full control of PCM applptr and hwptr changes (that implies
disabling the mmap of control/status data).  When the buffer
allocation is managed by snd_pcm_set_managed_buffer(), this flag is
automatically set depending on the result of dma_need_sync()
internally.  Otherwise, if the buffer is managed manually, the driver
has to set the flag explicitly, too.

The explicit sync between CPU and device for non-coherent memory is
performed at the points before and after read/write transfer as well
as the applptr/hwptr syncptr ioctl.  In the case of mmap mode,
user-space is supposed to call the syncptr ioctl with the hwptr flag
to update and fetch the status at first; this corresponds to CPU-sync.
Then user-space advances the applptr via syncptr ioctl again with
applptr flag, and this corresponds to the device sync with flushing.

Other than the DMA direction and the explicit sync, the usage of this
new buffer type is almost equivalent with the existing
SNDRV_DMA_TYPE_DEV_SG; you can get the page and the address via
snd_sgbuf_get_page() and snd_sgbuf_get_addr(), also calculate the
continuous pages via snd_sgbuf_get_chunk_size().

For those SG-page handling, the non-contig type shares the same ops
with the vmalloc handler.  As we do always vmap the SG pages at first,
the actual address can be deduced from the vmapped address easily
without iterating the SG-list.

Link: https://lore.kernel.org/r/20211017074859.24112-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-18 13:32:10 +02:00
Greg Kroah-Hartman
412a5feba4 Merge 5.15-rc6 into tty-next
We need the serial/tty fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-10-18 09:38:54 +02:00
Randy Dunlap
3c05f1477e ALSA: ISA: not for M68K
On m68k, compiling drivers under SND_ISA causes build errors:

../sound/core/isadma.c: In function 'snd_dma_program':
../sound/core/isadma.c:33:17: error: implicit declaration of function 'claim_dma_lock' [-Werror=implicit-function-declaration]
   33 |         flags = claim_dma_lock();
      |                 ^~~~~~~~~~~~~~
../sound/core/isadma.c:41:9: error: implicit declaration of function 'release_dma_lock' [-Werror=implicit-function-declaration]
   41 |         release_dma_lock(flags);
      |         ^~~~~~~~~~~~~~~~

../sound/isa/sb/sb16_main.c: In function 'snd_sb16_playback_prepare':
../sound/isa/sb/sb16_main.c:253:72: error: 'DMA_AUTOINIT' undeclared (first use in this function)
  253 |         snd_dma_program(dma, runtime->dma_addr, size, DMA_MODE_WRITE | DMA_AUTOINIT);
      |                                                                        ^~~~~~~~~~~~
../sound/isa/sb/sb16_main.c:253:72: note: each undeclared identifier is reported only once for each function it appears in
../sound/isa/sb/sb16_main.c: In function 'snd_sb16_capture_prepare':
../sound/isa/sb/sb16_main.c:322:71: error: 'DMA_AUTOINIT' undeclared (first use in this function)
  322 |         snd_dma_program(dma, runtime->dma_addr, size, DMA_MODE_READ | DMA_AUTOINIT);
      |                                                                       ^~~~~~~~~~~~

and more...

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Link: https://lore.kernel.org/r/20211016062602.3588-1-rdunlap@infradead.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-17 09:03:20 +02:00
Nicolas Frattaroli
d6365d0f0a
ASoC: rockchip: i2s-tdm: Strip out direct CRU use
In cases where both rx and tx lrck are synced to the same source,
the resets for rx and tx need to be triggered simultaneously,
according to the downstream driver.

As there is no reset API to atomically bulk (de)assert two resets
at once, what the driver did was implement half a reset controller
specific to Rockchip, which tried to write the registers for the
resets within one write ideally or several writes within an irqsave
section.

This of course violates abstractions quite badly. The driver should
not write to the CRU's registers directly.

In practice, for the cases I tested the driver with, which is audio
playback, replacing the synchronised asserts with just individual
ones does not seem to make any difference.

If it turns out that this breaks something in the future, it should
be fixed through the specification and implementation of an atomic
bulk reset API, not with a CRU hack.

Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Message-Id: <20211016105354.116513-2-frattaroli.nicolas@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-17 00:16:43 +01:00
Mark Brown
9a61277af7
Merge series "ASoC: Add Audio Graph Card2 support" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

We already have Audio-Graph-Card which is Of-Graph base general sound
card driver. Basically it supports basic CPU-Codec connection, and is
also supporting DPCM connection. Because it was forcibly expanded to
DPCM, DT parsing is very limited and very difficult to add new features
on it, for example Multi-CPU/Codec support, Codec2Codec support, etc.

This patch adds more flexible new Audio-Graph-Card2 driver for it.
Audio-Graph-Card and Audio-Graph-Card2 are similar, but don't have
full compatibility.
The reason why I need Audio-Graph-Card2 instead of updating Audio-Graph-Card
is that it is very difficult to keep compatibility.

Audio-Graph-Card2 supports Normal/DPCM/Codec2Codec Connection wich
Single/Multi DAIs. And it is possible to Customizing.

This patch-set adds Audio-Graph-Card2 driver and its custom driver
sample, and DT settings sample which can be used for testing.

To enable testing/debuging, this patch-set also adds Test-Component
driver. We already have Dummy Component and/or Dummy DAI on soc-utils,
but 1) we can't use it from DT, 2) it do nothing.
Added new Test-Component can be used from DT, and it can indicate called
function name. We can use it to trace callback order, understanding
ALSA SoC behavior, etc, etc...
Sample DT settings of Audio Graph Card2 is using Test-Component as CPU/Codec DAI.

You can easily try to use/test it if you added below line to your DT file.
Your .config needs to have below CONFIGs to use/test it.
It will probe sample Sound Card which has Normal/DPCM/Multi/Codec2Codec
connections.

	#include "../../../../../sound/soc/generic/audio-graph-card2-custom-sample.dtsi"

	CONFIG_SND_AUDIO_GRAPH_CARD2
	CONFIG_SND_AUDIO_GRAPH_CARD2_CUSTOM_SAMPLE
	CONFIG_SND_TEST_COMPONENT

Because Audio Graph Card2 is still under experimental stage, it will
indicate such warning when probing, and the DT might be updated/exchanged.

It can use Codec2Codec, but it will start automatically when probed,
and can't stop it so far. It should be updated.

Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871r8u4s6q.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87a6mhwyqn.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87tuitusy4.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87a6jn56x0.wl-kuninori.morimoto.gx@renesas.com

v1 -> v2
	- don't use "port" base for_each loop

v2 -> v3
	- Rename audio-graph-card2 to rich-graph-card
	- Rename DSP to DPCM not to confuse
	- Normal/DPCM/Codec2Codec can use Single/Multi DAIs.
	- use dpcm/multi/codec2codec node instead of using extra compatible
	- Sample DTSI patch is separated to Single/Multi.

v3 -> v4
	- Rename rich-graph-card to audio-graph-card2
	- fixup custom sample driver's connection bug
	- test-component compatible uses "verbose" instead of "vv"

v4 -> v5
	- tidyup git-log comment at
	- tidyup Custom Sample comment

Kuninori Morimoto (16):
  ASoC: test-component: add Test Component YAML bindings
  ASoC: test-component: add Test Component for Sound debug/test
  ASoC: simple-card-utils: add asoc_graph_is_ports0()
  ASoC: simple-card-utils: add codec2codec support
  ASoC: add Audio Graph Card2 driver
  ASoC: audio-graph-card2: add Multi CPU/Codec support
  ASoC: audio-graph-card2: add DPCM support
  ASoC: audio-graph-card2: add Codec2Codec support
  ASoC: add Audio Graph Card2 Yaml Document
  ASoC: add Audio Graph Card2 Custom Sample
  ASoC: audio-graph-card2-custom-sample.dtsi: add Sample DT for Normal (Single)
  ASoC: audio-graph-card2-custom-sample.dtsi: add Sample DT for Normal (Nulti)
  ASoC: audio-graph-card2-custom-sample.dtsi: add DPCM sample (Single)
  ASoC: audio-graph-card2-custom-sample.dtsi: add DPCM sample (Multi)
  ASoC: audio-graph-card2-custom-sample.dtsi: add Codec2Codec sample (Single)
  ASoC: audio-graph-card2-custom-sample.dtsi: add Codec2Codec sample (Multi)

 .../bindings/sound/audio-graph-card2.yaml     |   57 +
 .../bindings/sound/test-component.yaml        |   33 +
 include/sound/graph_card.h                    |   21 +
 include/sound/simple_card_utils.h             |    4 +
 sound/soc/generic/Kconfig                     |   20 +
 sound/soc/generic/Makefile                    |    6 +
 .../generic/audio-graph-card2-custom-sample.c |  183 +++
 .../audio-graph-card2-custom-sample.dtsi      |  227 +++
 sound/soc/generic/audio-graph-card2.c         | 1281 +++++++++++++++++
 sound/soc/generic/simple-card-utils.c         |   46 +-
 sound/soc/generic/test-component.c            |  659 +++++++++
 11 files changed, 2536 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/sound/audio-graph-card2.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/test-component.yaml
 create mode 100644 sound/soc/generic/audio-graph-card2-custom-sample.c
 create mode 100644 sound/soc/generic/audio-graph-card2-custom-sample.dtsi
 create mode 100644 sound/soc/generic/audio-graph-card2.c
 create mode 100644 sound/soc/generic/test-component.c

--
2.25.1
2021-10-15 20:40:27 +01:00
Takashi Sakamoto
634ec0b290 ALSA: firewire-motu: notify event for parameter change in register DSP model
This commit copies queued event for change of register DSP into
userspace when application operates ALSA hwdep character device.
The notification occurs only when packet streaming is running.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-12-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:19 +02:00
Takashi Sakamoto
4c9eda8f37 ALSA: firewire-motu: queue event for parameter change in register DSP model
This commit is a preparation to notify parameter change of register DSP
to userspace application. A simple queue is added to store encoded data
for the change as long as ALSA hwdep character device is opened by
application.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-11-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:16 +02:00
Takashi Sakamoto
ca15a09ccc ALSA: firewire-motu: add ioctl command to read cached parameters in register DSP model
This patch adds new ioctl command for userspace applications to read
cached parameters of register DSP.

The structured data includes model-dependent parameters. Userspace
application should be carefully programmed so that what parameter is
common and specific.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-10-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:15 +02:00
Takashi Sakamoto
7d843c494a ALSA: firewire-motu: parse messages for input parameters in register DSP model
This commit parses message and cache current parameters of input function,
available for MOTU Ultralite, 4 pre, and Audio Express.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-9-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:14 +02:00
Takashi Sakamoto
41cc23389f ALSA: firewire-motu: parse messages for line input parameters in register DSP model
This commit parses message and cache current parameters of line input
function, available for MOTU 828 mk2 and Traveler.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-8-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:13 +02:00
Takashi Sakamoto
6ca81d2b63 ALSA: firewire-motu: parse messages for output parameters in register DSP model
This commit parses message and cache current parameters of output
function, commonly available for all of register DSP model.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-7-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:13 +02:00
Takashi Sakamoto
ce69bed555 ALSA: firewire-motu: parse messages for mixer output parameters in register DSP model
This commit parses message and cache current parameters of mixer output
function, commonly available for all of register DSP model

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-6-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:12 +02:00
Takashi Sakamoto
dc36a9755a ALSA: firewire-motu: parse messages for mixer source parameters in register-DSP model
In register DSP models, current parameters of DSP are always reported by
messages in isochronous packet. When user operates hardware component such
as rotary knob, corresponding message is changed.

This commit parses the message and cache current parameters of mixer
source function, commonly available for all of register DSP models.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-5-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:11 +02:00
Takashi Sakamoto
58b62ab702 ALSA: firewire-motu: add ioctl command to read cached hardware meter
This patch adds new ioctl commands for userspace applications to read
cached image about hardware meters in register DSP and command DSP models.

The content of image differs depending on models. Model-specific parser
should be implemented in userspace.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-4-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:09 +02:00
Takashi Sakamoto
90b28f3bb8 ALSA: firewire-motu: add message parser for meter information in command DSP model
Some of MOTU models allows software to configure their DSP parameters by
command included in asynchronous transaction. The models multiplex messages
for hardware meters into isochronous packet as well as PCM frames. For
convenience, I call them as 'command DSP' model.

This patch adds message parser for them to gather hardware meter
information.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-3-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:07 +02:00
Takashi Sakamoto
bea36afa10 ALSA: firewire-motu: add message parser to gather meter information in register DSP model
Some of MOTU models allows software to configure their DSP parameters by
accessing to their registers. The models multiplex messages for status of
DSP into isochronous packet as well as PCM frames. The message includes
information of hardware metering, MIDI message, current parameters of DSP.
For my convenience, I call them as 'register DSP' model.

This patch adds message parser for them to gather hardware meter
information.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20211015080826.34847-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 17:52:05 +02:00
Takashi Iwai
eadeb06e76 ASoC: Fixes for v5.15
A colletion of smallish mostly driver specific fixes, the biggest thing
 here is fixing some of the core code to generate change notifications
 properly when writing to controls which will fix issues with UIs not
 showing the correct values.
 
 There's one build fix here with a slightly misleading changelog saying
 it's adding IRQ config support, it's adding a missing select of the
 regmap-irq code rather than adding a feature.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmFpaYkACgkQJNaLcl1U
 h9AK1Qf8DBJ4hv+jXUB78qrymQCw1gGbZ9S+Z0TUX/GG+AquP5HbuwKvL28pjKU3
 8nNqqfqcqT9wxPu5T4ct1TJishT+3lhvpsGpMU4beP3/P1RcA6asUF9ycty2EN+s
 07gXTnYTUGzMl+ZXKBt9lZBpKrxn/EBh8CkJDNYTrTv9O6kaFwT9UT+h8Ogn+Blg
 XGg7wveKrLjpEhwFa6HvRWiV+12kI6ZWt4JQrF2Z0bMkRNWwz14A0qybrr1FrFud
 FkB1gD3PArCLv6AYTW4F8t0ldwKniJjX386yq50dOfab/iWZpcqmxou35+exhP/j
 PhXnUUvAeowZGPRjEAqAcGTq3zCTqw==
 =3OCP
 -----END PGP SIGNATURE-----

Merge tag 'asoc-fix-v5.15-rc5' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus

ASoC: Fixes for v5.15

A colletion of smallish mostly driver specific fixes, the biggest thing
here is fixing some of the core code to generate change notifications
properly when writing to controls which will fix issues with UIs not
showing the correct values.

There's one build fix here with a slightly misleading changelog saying
it's adding IRQ config support, it's adding a missing select of the
regmap-irq code rather than adding a feature.
2021-10-15 17:43:46 +02:00
Richard Fitzgerald
4ca239f337
ASoC: cs42l42: Always enable TS_PLUG and TS_UNPLUG interrupts
The headset type detection must run to set the analogue switches
correctly for the attached headset type. Without this only headsets
with wiring matching the chip default will have a functioning mic.

commit c26a5289e8 ("ASoC: cs42l42: Add support for set_jack calls")
moved the interrupt unmasking to the component set_jack() callback.
But it's not mandatory for a machine driver to register a struct
snd_soc_jack handler. Without a registered handler the type detection
would not have run and so the mic would not work on some types of
headset.

This patch restores the unmasking of TS_PLUG and TS_UNPLUG interrupts
during probe.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-17-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:24 +01:00
Richard Fitzgerald
4c8d49bc47
ASoC: cs42l42: Fix WARN in remove() if running without an interrupt
The driver must free the IRQ in remove() to prevent the potential race
where an IRQ starts to be handled while the driver is being removed but
devres has not yet called free_irq(). However, the driver can run without
an interrupt but devm_free_irq() will hit a WARN() if no devres-managed
interrupt was ever created.

Fix this by only attempting to create the interrupt handler if the hardware
config specified an interrupt, and failing probe() if the interrupt could
not be created. This means that in cs42l42_remove() an interrupt must have
been registered if the irq number is valid and therefore it is safe to call
devm_free_irq().

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-16-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:23 +01:00
Richard Fitzgerald
0c3d6c6ff7
ASoC: cs42l42: Mark OSC_SWITCH_STATUS register volatile
OSC_SWITCH_STATUS is a volatile register indicating the current state
of the clock switch logic.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-15-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:21 +01:00
Richard Fitzgerald
fdbd256175
ASoC: cs42l42: Set correct SRC MCLK
According to the datasheet the SRC MCLK must be as near as possible to
(125 * sample rate). This means it should be ~6MHz for rates up to 48k
and ~12MHz for rates above that. As per datasheet table 4-21.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-14-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:20 +01:00
Richard Fitzgerald
4ae1d8f911
ASoC: cs42l42: Allow time for HP/ADC to power-up after enable
After enabling the HP or ADC by writing the corresponding PDN=0,
it takes around 20 milliseconds for it to power up and the midrail
supply to be stable. Add this wait into a DAPM widget callback.

If HP and ADC are both powering up in a DAPM sequence, there's no
need to do the wait twice. The widget will perform one wait in the
POST_PMU if there was a PRE_PMU for one or both.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-13-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:19 +01:00
Richard Fitzgerald
3c211cb7db
ASoC: cs42l42: Use PLL for SCLK > 12.288MHz
It isn't possible to switch MCLK between 12MHz and 24MHz rate groups
on-the-fly - this can only be done when cs42l42 is powered-down.

All "normal" SCLK rates use an MCLK in the 12MHz group, so change the
configs for SCLK > 12.288 MHz to use the PLL to generate an MCLK in
the 12MHz group.

As this means MCLK_DIV is always 0 it can be removed from the pll
configuration setup.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-12-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:18 +01:00
Richard Fitzgerald
2a031a9942
ASoC: cs42l42: Don't claim to support 192k
The driver currently only supports configuring for sample rates <= 96k
and it isn't possible to setup a configuration that will support all
sample rates up to 192k.

For sample rates up to 96k MCLK is in the 12MHz group.
However, although 192k only requires an I2S clock in the 12MHz group,
the cs42l42 audio path is not natively 192k so the audio must be
resampled. But for 192k the SRC requires a 24MHz MCLK.

It is not possible to switch MCLK between 12MHz and 24MHz groups
on-the-fly. The 12MHz group supports all sample rates up to 96k.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-11-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:17 +01:00
Richard Fitzgerald
0306988789
ASoC: cs42l42: Defer probe if request_threaded_irq() returns EPROBE_DEFER
The driver can run without an interrupt so if devm_request_threaded_irq()
failed, the probe() just carried on. But if this was EPROBE_DEFER the
driver would continue without an interrupt instead of deferring to wait
for the interrupt to become available.

Fixes: 2c394ca796 ("ASoC: Add support for CS42L42 codec")
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-6-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:16 +01:00
Richard Fitzgerald
917d575801
ASoC: cs42l42: Don't set defaults for volatile registers
Volatile registers don't need a default value.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 2c394ca796 ("ASoC: Add support for CS42L42 codec")
Link: https://lore.kernel.org/r/20211015133619.4698-5-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:14 +01:00
Richard Fitzgerald
d591d4b32a
ASoC: cs42l42: Correct some register default values
Some registers had wrong default values in cs42l42_reg_defaults[].

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 2c394ca796 ("ASoC: Add support for CS42L42 codec")
Link: https://lore.kernel.org/r/20211015133619.4698-4-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:13 +01:00
Richard Fitzgerald
6e6825801a
ASoC: cs42l42: Always configure both ASP TX channels
An I2S frame always has two slots (left and right) even when sending
mono. The right channel (channel 2) of ASP TX will always have the
same bit width as the left channel and will always be on the high
phase of LRCLK.

The previous implementation always passed the field masks for both
channels to snd_soc_component_update_bits() but for mono the written value
only contained the settings for channel 1. The result was that for mono
channel 2 was set to 8-bit (which is an invalid configuration) with both
channels on the low phase of LRCLK.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Fixes: 585e7079de ("ASoC: cs42l42: Add Capture Support")
Link: https://lore.kernel.org/r/20211015133619.4698-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:13 +01:00
Richard Fitzgerald
06441c82f0
ASoC: cs42l42: Don't reconfigure the PLL while it is running
When capture and playback substreams are both running at the same time,
cs42l42_pcm_hw_params() would be called for each direction. The first
call will configure the PLL. The second call must not write the PLL
configuration registers again if the first substream is already running,
as this could destabilize the PLL.

The DAI is marked symmetric sample bits and sample rate, so the two
directions will always have the same SCLK (I2S always has 2 channel slots
so the DAI does not need to require symmetric channels to guarantee the
same SCLK). However, since cs42l42_pll_config() is checking for an active
stream it may as well test that the requested SCLK is the same as the
currently active configuration.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211015133619.4698-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:14:11 +01:00
Srinivas Kandagatla
b296997cf5
ASoC: soc-component: improve error reporting for register access
Currently errors on register read/write/update are reported with
an error code and the corresponding function but does not provide
any details on the which register number did it actually fail.

register number can give better clue and it should be easy to
locate the code and fix.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211014161330.26645-1-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:57 +01:00
Vijendar Mukunda
96792fdd77
ASoC: amd: enable vangogh platform machine driver build
Enable vangogh platform machine driver build.

Signed-off-by: VIjendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211014071714.836410-3-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:55 +01:00
Vijendar Mukunda
34a0094b9f
ASoC: amd: add vangogh machine driver
Add Vangogh machine driver using NAU8821 & CS35L41 Codecs.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211014071714.836410-2-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:55 +01:00
Vijendar Mukunda
832a5cd2d3
ASoc: amd: create platform device for VG machine driver
Create platform device for Vangogh machine driver.

Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Link: https://lore.kernel.org/r/20211014071714.836410-1-Vijendar.Mukunda@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:54 +01:00
Kuninori Morimoto
baa274db99
ASoC: audio-graph-card2-custom-sample.dtsi: add Codec2Codec sample (Multi)
This patch adds Codec2Codec-Multi sample to audio-graph-card2-custom-sample.dtsi.
Because it can use very basic connection only for now,
it can use only

	- 2channels
	- S32_LE format

Test-Component driver has "IN" and "OUT" widget. Thus the route is

	+--+    +-+
	|  |    | |- Codec8 <- IN
	|  | <- | |- Codec9 <- IN
	|  |    +-+
	|  |
	|  |    +-+
	|  | -> | |- Codec10 -> OUT
	|  |    | |- Codec11 -> OUT
	+--+    +-+

One note here is that it will start works when it boot.
In other words we can't stop it so far.
We need to update driver for it in the future.

	...
	asoc-audio-graph-card2-custom-sample: multicodec <-> multicpu mapping ok
	test-component test_codec: test_dai_startup() : test_codec.9
	test-component test_codec: test_dai_startup() : test_codec.8
	test-component test_codec: test_dai_startup() : test_codec.11
	test-component test_codec: test_dai_startup() : test_codec.10
	...

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87mtnelu2k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:49 +01:00
Kuninori Morimoto
349b15ef9d
ASoC: audio-graph-card2-custom-sample.dtsi: add Codec2Codec sample (Single)
This patch adds Codec2Codec-Single sample to audio-graph-card2-custom-sample.dtsi.
Because it can use very basic connection only for now,
it can use only

	- 2channels
	- S32_LE format

Test-Component driver has "IN" and "OUT" widget. Thus the route is

	+--+
	|  | <-- Codec6 <-- IN
	|  | --> Codec7 --> OUT
	+--+

One note here is that it will start works when it boot.
In other words we can't stop it so far.
We need to update driver for it in the future.

	...
	asoc-audio-graph-card2-custom-sample: test_codec.7 <-> test_codec.6 mapping ok
	test-component test_codec: test_dai_startup() : test_codec.6
	test-component test_codec: test_dai_startup() : test_codec.7
	...

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o87ulu2o.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:48 +01:00
Kuninori Morimoto
cb2d94aa4d
ASoC: audio-graph-card2-custom-sample.dtsi: add DPCM sample (Multi)
This patch adds DPCM link Multi-CPU/Codec sample to
audio-graph-card2-custom-sample.dtsi.
This sample is assuming MIXer connection.
One note is that Multi-FE is not supported on ASoC

	FE		BE
		****	+-+
	CPU5 -- *  * -- | | -- Codec4
	CPU6 -- *  *	| | -- Codec5
		****	+-+

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pmsalu2s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:47 +01:00
Kuninori Morimoto
e781759ab8
ASoC: audio-graph-card2-custom-sample.dtsi: add DPCM sample (Single)
This patch adds DPCM link Single-CPU/Codec sample to
audio-graph-card2-custom-sample.dtsi.
This sample is assuming MIXer connection.

	FE		BE
		****
	CPU3 -- *  * -- Codec3
	CPU4 -- *  *
		****

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r1cqlu2w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:46 +01:00
Kuninori Morimoto
5279bd8a84
ASoC: audio-graph-card2-custom-sample.dtsi: add Sample DT for Normal (Nulti)
This patch adds Normal link Multi-CPU/Codec sample to
audio-graph-card2-custom-sample.dtsi.

               +-+       +-+
        CPU1 --| | <---> | | -- Codec1
        CPU2 --| |       | | -- Codec2
               +-+       +-+

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sfx6lu30.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:45 +01:00
Kuninori Morimoto
c601fdf5c8
ASoC: audio-graph-card2-custom-sample.dtsi: add Sample DT for Normal (Single)
Audio Graph Card2 settings is a little bit difficult for beginner,
and Customizing it also difficult/confusable too.
So, this patch adds sample for it.

You can easily use it by adding below line on your DT file,
and select CONFIGs to your .config.

	#include "../../../../../sound/soc/generic/audio-graph-card2-custom-sample.dtsi"

	CONFIG_SND_AUDIO_GRAPH_CARD2
	CONFIG_SND_AUDIO_GRAPH_CARD2_CUSTOM_SAMPLE
	CONFIG_SND_TEST_COMPONENT

This patch uses audio-graph-card2 base custom sample driver.
You can directly use audio-graph-card2 instead of custom sample driver
by modifing compatible.

	- compatible = "audio-graph-card2-custom-sample";
	+ compatible = "audio-graph-card2";

Sample custom driver will indicate customized print.

It is using Test-Component driver for CPU/Codec.
It can indicate more detail print of each behavior if user want to.
In such case, you need to update compatible to "xxx-nv" or "xxx-vv".

	- compatible = "test-cpu";
	+ compatible = "test-cpu-verbose";

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tuhmlu35.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:44 +01:00
Kuninori Morimoto
95373f36b9
ASoC: add Audio Graph Card2 Custom Sample
audio-graph-card2 has customizing support.
This means user can re-use audio-graph-card2 DT parsing, and possible
to expand to own special handling.

This patch adds Audio Graph Card2 Customize Sample Driver.
It can re-use audio-graph-card2 parsing by calling
audio_graph2_parse_of(...), and user can expand each functions by
using hooks.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v922lu3c.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:43 +01:00
Kuninori Morimoto
c3a15c92a6
ASoC: audio-graph-card2: add Codec2Codec support
This patch adds Codec2Codec support to audio-graph-card2.
It can use Codec2Codec but very simple case only for now.
It doesn't have "SWITCH" control yet, thus it start automatically
when it was probed, and can't stop, so far.
Thus it needs to be updated around widgets/routing handling,
and you need to understand that it is under experimental.

Codec has SND_SOC_DAPM_INPUT() (= IN) / SND_SOC_DAPM_OUTPUT(= OUT)
widgets in below case.

It is assuming 2channel, S32_LE format for now.
It needs to be updated, too.

It needs "codec2codec" node (= B), needs to have routing (= A),
need to indicate CPU side at links (= X).
ports@0 is for CPU side (= X), port@1 is Codec side (= Y).
It needs to have "rate" (= C)

	+--+
	|  |<-- Codec0 <-- IN
	|  |--> Codec1 --> OUT
	+--+

	sound {
		compatible = "audio-graph-card2";

(A)		routing = "OUT" ,"DAI1 Playback",
			  "DAI0 Capture", "IN";

(X)		links = <&c2c>;

(B)		codec2codec {
			ports {
(C)				rate = <48000>;
(X)			c2c:	port@0 { c2cf_ep: endpoint { remote-endpoint = <&codec0_ep>; }; };
(Y)				port@1 { c2cb_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
		};
	};

	Codec {
		ports {
			port@0 {
				 bitclock-master;
				 frame-master;
				 codec0_ep: endpoint { remote-endpoint = <&c2cf_ep>; }; };
			port@1 { codec1_ep: endpoint { remote-endpoint = <&c2cb_ep>; }; };
		};
	};

Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87y26ylu4a.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:41 +01:00
Kuninori Morimoto
f03beb55a8
ASoC: audio-graph-card2: add DPCM support
This patch adds DPCM support to audio-graph-card2.
It uses "dpcm" node (= D), needs to have routing (= A),
need to indicate both FE/BE at links (= B, C).
dpcm ports@0 is for FE (= B), port@1 is for BE (= C).
remote-endpoint can use both Single/Multi connection.

			DSP
		  ************
	PCM0 <--> * fe0  be0 * <--> DAI0: Codec Headset
	PCM1 <--> * fe1  be1 * <--> DAI1: Codec Speakers
	PCM2 <--> * fe2  be2 * <--> DAI2: MODEM
	PCM3 <--> * fe3  be3 * <--> DAI3: BT
		  *	 be4 * <--> DAI4: DMIC
		  *	 be5 * <--> DAI5: FM
		  ************

	sound {
		compatible = "audio-graph-card2";

		// indicate routing
(A)		routing = "xxx Playback", "xxx Playback",
			  "xxx Playback", "xxx Playback",
			  "xxx Playback", "xxx Playback";

		// indicate all Front-End, Back-End in DPCM case
(B)		links = <&fe0, &fe1, ...
(C)			 &be0, &be1, ...

(D)		dpcm {
			// Front-End
			ports@0 {
(B)				fe0: port@0 { fe0_ep: endpoint { remote-endpoint = <&pcm0_ep>; }; };
(B)				fe1: port@1 { fe1_ep: endpoint { remote-endpoint = <&pcm1_ep>; }; };
				...
			};
			// Back-End
			ports@1 {
(C)				be0: port@0 { be0_ep: endpoint { remote-endpoint = <&dai0_ep>; }; };
(C)				be1: port@1 { be1_ep: endpoint { remote-endpoint = <&dai1_ep>; }; };
				...
			};
		};
	};

	CPU {
		ports {
			bitclock-master;
			frame-master;
			port@0 { pcm0_ep: endpoint { remote-endpoint = <&fe0_ep>; }; };
			port@1 { pcm1_ep: endpoint { remote-endpoint = <&fe1_ep>; }; };
			...
		};
	};

	Codec {
		ports {
			port@0 { dai0_ep: endpoint { remote-endpoint = <&be0_ep>; }; };
			port@1 { dai1_ep: endpoint { remote-endpoint = <&be1_ep>; }; };
			...
		};
	};

Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87zgrelu4v.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:40 +01:00
Kuninori Morimoto
c8c74939f7
ASoC: audio-graph-card2: add Multi CPU/Codec support
This patch adds Multi CPU/Codec support to audio-graph-card2.
Multi CPU/Codec will have connection part (= X) and CPU/Codec list part (= Y).
links indicates connection part of CPU side (= A).

		    +-+   (A)	     +-+
	 CPU1 --(Y) | | <-(X)--(X)-> | | (Y)-- Codec1
	 CPU2 --(Y) | |		     | | (Y)-- Codec2
		    +-+		     +-+

	sound {
		compatible = "audio-graph-card2";

(A)		links = <&mcpu>;

		multi {
			ports@0 {
(X) (A)			mcpu:	port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; };
(Y)				port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; };
(Y)				port@1 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; };
			};
			ports@1 {
(X)				port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; };
(Y)				port@0 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; };
(Y)				port@1 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; };
			};
		};
	};

	CPU {
		ports {
			bitclock-master;
			frame-master;
			port@0 { cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; };
			port@1 { cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; };
		};
	};

	Codec {
		ports {
			port@0 { codec1_ep: endpoint { remote-endpoint = <&mcodec1_ep>; }; };
			port@1 { codec2_ep: endpoint { remote-endpoint = <&mcodec2_ep>; }; };
		};
	};

Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/20210804171748.GC26252@sirena.org.uk
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/871r4qn8pk.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:39 +01:00
Kuninori Morimoto
6e5f68fe3f
ASoC: add Audio Graph Card2 driver
We already have audio-graph-card which is Of-graph base of general
sound card driver.

It is supporting DPCM connection, but was forcibly expanded.
Thus, it is very difficult to add new features on it, for example
Multi CPU/Codec support, Codec2Codec support, etc.

This patch adds more flexible new Audio Graph Card2 driver for it.
audio-graph-card and audio-graph-card2 are similar, but don't have
full compatibility.

Audio Graph Card2 supports very generic connection, but some users
want to have its own settings, for example PLL settings, etc.
For such case, it has customizing support.
In users own driver, it can use Audio Graph Card2 parsing by using
audio_graph2_parse_of(), and doing its own customizing.

Because Audio Graph Card2 is still under experimental stage,
it will indicate such warning when probing, and the DT syntax
might be changed.

Link: https://lore.kernel.org/r/87k0xszlep.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871r8u4s6q.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87a6mhwyqn.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87tuitusy4.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/87a6jn56x0.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/8735p6n8q1.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:38 +01:00
Kuninori Morimoto
52a18c2914
ASoC: simple-card-utils: add codec2codec support
codec2codec needs snd_soc_pcm_stream settings.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874k9mn8qy.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:37 +01:00
Kuninori Morimoto
9293925245
ASoC: simple-card-utils: add asoc_graph_is_ports0()
audio-graph-card2 will support DPCM/Multi/Codec2Codec,
and these will use almost same DT settings which uses
ports0 and ports1.
This patch adds asoc_graph_is_ports0() which checks
port is under port0 or not.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/875yu2n8ra.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:36 +01:00
Kuninori Morimoto
d293abc0c8
ASoC: test-component: add Test Component for Sound debug/test
We already have dummy-codec, dummy-platform.
But its issues are
	1) we don't have dummy-cpu,
	2) we can't select it via DeviceTree
	3) It do nothing

Sometimes we want to have Dummy Sound Component for debugging,
for testing, for learning Framework behavior, etc, etc...
This patch adds Test-Component driver for it.

User can select CPU   Component by using "test-cpu"   compatible,
and  can select Codec Component by using "test-codec" compatible.

It doesn't support Platform so far, but is easy to add.

We can verbose print to know its progress if user selected
xxx-verbose compatible driver.

for example,
	test-cpu		   : silent  Component, silent  DAI
	test-cpu-verbose-component : verbose Component, silent  DAI
	test-cpu-verbose-dai	   : silent  Component, verbose DAI
	test-cpu-verbose	   : verbose Component, verbose DAI

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/877dein8rx.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-15 16:10:35 +01:00
Davide Baldo
d94befbb5a ALSA: hda/realtek: Fixes HP Spectre x360 15-eb1xxx speakers
In laptop 'HP Spectre x360 Convertible 15-eb1xxx/8811' both front and
rear speakers are silent, this patch fixes that by overriding the pin
layout and by initializing the amplifier which needs a GPIO pin to be
set to 1 then 0, similar to the existing HP Spectre x360 14 model.

In order to have volume control, both front and rear speakers were
forced to use the DAC1.

This patch also correctly map the mute LED but since there is no
microphone on/off switch exposed by the alsa subsystem it never turns
on by itself.

There are still known audio issues in this laptop: headset microphone
doesn't work, the button to mute/unmute microphone is not yet mapped,
the LED of the mute/unmute speakers doesn't seems to be exposed via
GPIO and never turns on.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=213953
Signed-off-by: Davide Baldo <davide@baldo.me>
Link: https://lore.kernel.org/r/20211015072121.5287-1-davide@baldo.me
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 09:41:49 +02:00
Brendan Grieve
3c414eb65c ALSA: usb-audio: Provide quirk for Sennheiser GSP670 Headset
As per discussion at: https://github.com/szszoke/sennheiser-gsp670-pulseaudio-profile/issues/13

The GSP670 has 2 playback and 1 recording device that by default are
detected in an incompatible order for alsa. This may have been done to make
it compatible for the console by the manufacturer and only affects the
latest firmware which uses its own ID.

This quirk will resolve this by reordering the channels.

Signed-off-by: Brendan Grieve <brendan@grieve.com.au>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211015025335.196592-1-brendan@grieve.com.au
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-15 09:27:41 +02:00
Takashi Iwai
c18c496603 ALSA: pcm: Unify snd_pcm_delay() and snd_pcm_hwsync()
Both snd_pcm_delay() and snd_pcm_hwsync() do the almost same thing.
The only difference is that the former calculate the delay, so unify
them as a code cleanup, and treat NULL delay argument only for hwsync
operation.

Also, the patch does a slight code refactoring in snd_pcm_delay().
The initialization of the delay value is done in the caller side now.

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211014145323.26506-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-14 22:01:54 +02:00
Takashi Iwai
b96681bd58 ALSA: usb-audio: Initialize every feature unit once at probe time
So far we used to read the current value of the mixer element
dynamically at the first access, and the error from a GET_CUR message
is treated as a fatal error (unless QUIRK_IGNORE_CTL_ERROR is set).
It's rather inconvenient, as most of GET_CUR errors are no fatal, and
we can continue operation with assumption of some fixed value.

This patch makes the USB-audio driver to change the behavior at probe
time; now it tries to initialize the current value of each mixer
element that is built from a feature unit (those for typically for
mixer volumes and switches).  When a read failure happens, it tries to
set the known minimum value.  After that point, a cached value is used
always, hence we won't hit GET_CUR message error any longer.

The error from GET_CUR message is still shown as a warning normally,
but only once at the probe time, and it'll keep operating.  If the
message is confirmed to be harmless, it can be shut up by
QUIRK_IGNORE_CTL_ERROR quirk flag, too.

Tested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211014130636.17860-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-14 16:51:56 +02:00
Takashi Iwai
509975c778 ALSA: usb-audio: Drop superfluous error message after disconnection
The error from snd_usb_lock_shutdown() indicates that the device is
disconnected, hence it makes no sense to show any further control
message error in get_ctl_value_v2().  Return the error directly
instead.

Tested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211014130636.17860-3-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-14 16:51:37 +02:00
Takashi Iwai
ac9b019d07 ALSA: usb-audio: Downgrade error message in get_ctl_value_v2()
The error message in get_ctl_value_v2() (for UAC2/3) is shown via
KERN_ERR level but it was intended to be rather a debug message as
seen in get_ctl_value_v1() (for UAC1).  This patch downgrade the
printk level.

Tested-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20211014130636.17860-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-14 16:51:25 +02:00
Takashi Iwai
6f00d1651b Merge branch 'for-linus' into for-next
A back-merge of 5.15 branch into 5.16-devel branch for further
development of USB and ALSA core stuff that depends on 5.15 fixes.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-14 15:54:30 +02:00
Steven Clarkson
aef454b402 ALSA: hda/realtek: Add quirk for Clevo PC50HS
Apply existing PCI quirk to the Clevo PC50HS and related models to fix
audio output on the built in speakers.

Signed-off-by: Steven Clarkson <sc@lambdal.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211014133554.1326741-1-sc@lambdal.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-14 15:41:42 +02:00
Greg Kroah-Hartman
22390ce786 ALSA: usb-audio: add Schiit Hel device to quirk table
The Shciit Hel device responds to the ctl message for the mic capture
switch with a timeout of -EPIPE:

	usb 7-2.2: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x1100, type = 1
	usb 7-2.2: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x1100, type = 1
	usb 7-2.2: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x1100, type = 1
	usb 7-2.2: cannot get ctl value: req = 0x81, wValue = 0x100, wIndex = 0x1100, type = 1

This seems safe to ignore as the device works properly with the control
message quirk, so add it to the quirk table so all is good.

Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/YWgR3nOI1osvr5Yo@kroah.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-14 14:39:06 +02:00
Derek Fang
4b19e4a77c
ASoC: rt5682: fix a little pop while playback
A little pop can be heard obviously from HP while playing a silent.
This patch fixes it by using two functions:
1. Enable HP 1bit output mode.
2. Change the charge pump switch size during playback on and off.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20211014094054.811-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-14 12:47:31 +01:00
Peter Ujfalusi
f05a9b8552
ASoC: rt1011: Fix 'I2S Reference' enum control
There are several things the patch adding the support for 'I2S Reference'
got wrong:
- "None" selection is in fact equals to last selected reference
- The custom put overrides RX/TX len, TDM slot sizes, etc
- the enum is useless in most part for the reference tracking
- there is no need for EXT control as there is a single bit in
  RT1011_TDM1_SET_1 register (bit 7) which selects the reference
- it was using ucontrol->value.integer.value[0] in the put/get callbacks
  which causesed access to 'I2S Reference' enum with alsamixer to fail

Complements: c3de683c4d ("ASoC: rt1011: Fix 'I2S Reference' enum control caused error")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211013123300.11095-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-13 16:26:15 +01:00
Shengjiu Wang
6b9b546dc0
ASoC: wm8960: Fix clock configuration on slave mode
There is a noise issue for 8kHz sample rate on slave mode.
Compared with master mode, the difference is the DACDIV
setting, after correcting the DACDIV, the noise is gone.

There is no noise issue for 48kHz sample rate, because
the default value of DACDIV is correct for 48kHz.

So wm8960_configure_clocking() should be functional for
ADC and DAC function even if it is slave mode.

In order to be compatible for old use case, just add
condition for checking that sysclk is zero with
slave mode.

Fixes: 0e50b51aa2 ("ASoC: wm8960: Let wm8960 driver configure its bit clock and frame clock")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/1634102224-3922-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-13 16:25:33 +01:00
Mark Brown
495ee4bac7
Merge series "ASoC: rt9120: Add Richtek RT9120 supprot" from cy_huang <u0084500@gmail.com>
ChiYuan Huang <cy_huang@richtek.com>:

From: ChiYuan Huang <cy_huang@richtek.com>

This patch series Add the Richtek RT9120 support.

In v4:
- Add 'classd_tlv' for 'SPK Gain Volume' control item.
- Unify the tlv declaration to the postfix '_tlv'.
- Fix 'digital_tlv' mute as 1 to declare the minimum is muted.

In v3:
- Add dvdd regulator binding to check the dvdd voltage domain.
- Refine sdo_select_text.
- Use switch case in 'internal_power_event' function.
- Remove the volume and mute initially write in component probe.
- Remove the mute API. It's no need by HW design.

In v2:
- Add missing #sound-dai-cells property.

ChiYuan Huang (2):
  ASoC: dt-bindings: rt9120: Add initial bindings
  ASoC: rt9120: Add rt9210 audio amplifier support

 .../devicetree/bindings/sound/richtek,rt9120.yaml  |  59 +++
 sound/soc/codecs/Kconfig                           |  10 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/rt9120.c                          | 495 +++++++++++++++++++++
 4 files changed, 566 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/richtek,rt9120.yaml
 create mode 100644 sound/soc/codecs/rt9120.c

--
2.7.4
2021-10-13 16:24:39 +01:00
ChiYuan Huang
7228d83531
ASoC: rt9120: Add rt9210 audio amplifier support
Add Richtek rt9120 audio amplifier support.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/1634088519-995-3-git-send-email-u0084500@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-13 12:59:41 +01:00
Rikard Falkeborn
bd6e4b992b
ASoC: amd: vangogh: constify static struct snd_soc_dai_ops
The only usage of acp5x_i2s_dai_ops is to assign its address to the ops
field in the snd_soc_dai_driver struct, which is a pointer to const.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211012211506.21159-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-13 12:59:29 +01:00
Rikard Falkeborn
abed054f03
ASoC: mediatek: Constify static snd_soc_ops
These are only assigned to the ops field in the snd_soc_dai_link struct
which is a pointer to const struct snd_soc_ops. Make them const to allow
the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211012205521.14098-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-13 12:59:28 +01:00
Mark Brown
916f2ce39d
ASoC: rt9120: Drop rt9210 audio amplifier support
This drops the rt9210 support due to a race with a new version being
sent out for some incremental changes.

Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-13 12:58:31 +01:00
Jonas Hahnfeld
48827e1d6a ALSA: usb-audio: Add quirk for VF0770
The device advertises 8 formats, but only a rate of 48kHz is honored
by the hardware and 24 bits give chopped audio, so only report the
one working combination. This fixes out-of-the-box audio experience
with PipeWire which otherwise attempts to choose S24_3LE (while
PulseAudio defaulted to S16_LE).

Signed-off-by: Jonas Hahnfeld <hahnjo@hahnjo.de>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211012200906.3492-1-hahnjo@hahnjo.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-12 22:13:11 +02:00
Kai Vehmanen
b37a15188e ALSA: hda: avoid write to STATESTS if controller is in reset
The snd_hdac_bus_reset_link() contains logic to clear STATESTS register
before performing controller reset. This code dates back to an old
bugfix in commit e8a7f136f5 ("[ALSA] hda-intel - Improve HD-audio
codec probing robustness"). Originally the code was added to
azx_reset().

The code was moved around in commit a41d122449 ("ALSA: hda - Embed bus
into controller object") and ended up to snd_hdac_bus_reset_link() and
called primarily via snd_hdac_bus_init_chip().

The logic to clear STATESTS is correct when snd_hdac_bus_init_chip() is
called when controller is not in reset. In this case, STATESTS can be
cleared. This can be useful e.g. when forcing a controller reset to retry
codec probe. A normal non-power-on reset will not clear the bits.

However, this old logic is problematic when controller is already in
reset. The HDA specification states that controller must be taken out of
reset before writing to registers other than GCTL.CRST (1.0a spec,
3.3.7). The write to STATESTS in snd_hdac_bus_reset_link() will be lost
if the controller is already in reset per the HDA specification mentioned.

This has been harmless on older hardware. On newer generation of Intel
PCIe based HDA controllers, if configured to report issues, this write
will emit an unsupported request error. If ACPI Platform Error Interface
(APEI) is enabled in kernel, this will end up to kernel log.

Fix the code in snd_hdac_bus_reset_link() to only clear the STATESTS if
the function is called when controller is not in reset. Otherwise
clearing the bits is not possible and should be skipped.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211012142935.3731820-1-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-12 18:05:28 +02:00
Takashi Iwai
53451b6da8 ALSA: usb-audio: Less restriction for low-latency playback mode
The recent support for the improved low-latency playback mode applied
the SNDRV_PCM_INFO_EXPLICIT_SYNC flag for the target streams, but this
was a slight overkill.  The use of the flag above disables effectively
both PCM status and control mmaps, while basically what we want to
track is only about the appl_ptr update.

For less restriction, use a more proper flag,
SNDRV_PCM_INFO_SYNC_APPLPTR instead, which disables only the control
mmap.

Fixes: d5f871f89e ("ALSA: usb-audio: Improved lowlatency playback support")
Link: https://lore.kernel.org/r/20211011103650.10182-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-12 14:32:46 +02:00
Hui Wang
a3fd1a986e ALSA: hda/realtek: Fix the mic type detection issue for ASUS G551JW
We need to define the codec pin 0x1b to be the mic, but somehow
the mic doesn't support hot plugging detection, and Windows also has
this issue, so we set it to phantom headset-mic.

Also the determine_headset_type() often returns the omtp type by a
mistake when we plug a ctia headset, this makes the mic can't record
sound at all. Because most of the headset are ctia type nowadays and
some machines have the fixed ctia type audio jack, it is possible this
machine has the fixed ctia jack too. Here we set this mic jack to
fixed ctia type, this could avoid the mic type detection mistake and
make the ctia headset work stable.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214537
Reported-and-tested-by: msd <msd.mmq@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20211012114748.5238-1-hui.wang@canonical.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-12 14:10:19 +02:00
Peter Ujfalusi
c3de683c4d
ASoC: rt1011: Fix 'I2S Reference' enum control caused error
Access to 'I2S Reference' enum causes alsamixer to fail to load:
$ alsamixer
cannot load mixer controls: Invalid argument

cml_rt1011_rt5682 cml_rt1011_rt5682: control 2:0:0:TL I2S Reference:0: access overflow

The reason is that the original patch adding the code was using
ucontrol->value.integer.value[0]
instead the correct
ucontrol->value.enumerated.item[0]

for an ENUM control.

Fixes: 87f40af26c ("ASoC: rt1011: add i2s reference control for rt1011")
Reported-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211011144518.2518-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-12 11:48:47 +01:00
Stefan Binding
aa18457c4a
ASoC: cs42l42: Ensure 0dB full scale volume is used for headsets
Ensure the default 0dB playback path is always used.

The code that set FULL_SCALE_VOL based on LOAD_DET_RCSTAT was
spurious, and resulted in a -6dB attenuation being accidentally
inserted into the playback path.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20211011144903.28915-1-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-12 11:48:39 +01:00
Mark Brown
45ea862008
Merge series "ASoC: Intel: bytcr_rt5651: few cleanups" from Andy Shevchenko <andriy.shevchenko@linux.intel.com>:
The small set of cleanups against bytcr_rt5651 board file.

In v2:
- added commit message to patch 2 (Joe, Pierre)
- added cover letter (Pierre)
- added Hans to Cc list (Hans)

Andy Shevchenko (4):
  ASoC: Intel: bytcr_rt5651: Get platform data via dev_get_platdata()
  ASoC: Intel: bytcr_rt5651: Use temporary variable for struct device
  ASoC: Intel: bytcr_rt5651: use devm_clk_get_optional() for mclk
  ASoC: Intel: bytcr_rt5651: Utilize dev_err_probe() to avoid log
    saturation

 sound/soc/intel/boards/bytcr_rt5651.c | 118 +++++++++++---------------
 1 file changed, 50 insertions(+), 68 deletions(-)

--
2.33.0
2021-10-11 17:25:37 +01:00
Takashi Iwai
228af5a4fa ALSA: pcm: Workaround for a wrong offset in SYNC_PTR compat ioctl
Michael Forney reported an incorrect padding type that was defined in
the commit 80fe7430c7 ("ALSA: add new 32-bit layout for
snd_pcm_mmap_status/control") for PCM control mmap data.
His analysis is correct, and this caused the misplacements of PCM
control data on 32bit arch and 32bit compat mode.

The bug is that the __pad2 definition in __snd_pcm_mmap_control64
struct was wrongly with __pad_before_uframe, which should have been
__pad_after_uframe instead.  This struct is used in SYNC_PTR ioctl and
control mmap.  Basically this bug leads to two problems:

- The offset of avail_min field becomes wrong, it's placed right after
  appl_ptr without padding on little-endian

- When appl_ptr and avail_min are read as 64bit values in kernel side,
  the values become either zero or corrupted (mixed up)

One good news is that, because both user-space and kernel
misunderstand the wrong offset, at least, 32bit application running on
32bit kernel works as is.  Also, 64bit applications are unaffected
because the padding size is zero.  The remaining problem is the 32bit
compat mode; as mentioned in the above, avail_min is placed right
after appl_ptr on little-endian archs, 64bit kernel reads bogus values
for appl_ptr updates, which may lead to streaming bugs like jumping,
XRUN or whatever unexpected.
(However, we haven't heard any serious bug reports due to this over
years, so practically seen, it's fairly safe to assume that the impact
by this bug is limited.)

Ideally speaking, we should correct the wrong mmap status control
definition.  But this would cause again incompatibility with the
existing binaries, and fixing it (e.g. by renumbering ioctls) would be
really messy.

So, as of this patch, we only correct the behavior of 32bit compat
mode and keep the rest as is.  Namely, the SYNC_PTR ioctl is now
handled differently in compat mode to read/write the 32bit values at
the right offsets.  The control mmap of 32bit apps on 64bit kernels
has been already disabled (which is likely rather an overlook, but
this worked fine at this time :), so covering SYNC_PTR ioctl should
suffice as a fallback.

Fixes: 80fe7430c7 ("ALSA: add new 32-bit layout for snd_pcm_mmap_status/control")
Reported-by: Michael Forney <mforney@mforney.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Cc: <stable@vger.kernel.org>
Cc: Rich Felker <dalias@libc.org>
Link: https://lore.kernel.org/r/29QBMJU8DE71E.2YZSH8IHT5HMH@mforney.org
Link: https://lore.kernel.org/r/20211010075546.23220-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-11 18:10:47 +02:00
Andy Shevchenko
45c5dc45d8
ASoC: Intel: bytcr_rt5651: Utilize dev_err_probe() to avoid log saturation
dev_err_probe() avoids printing into log when the deferred probe is invoked.
This is possible when clock provider is pending to appear.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211007170250.27997-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 14:58:54 +01:00
Andy Shevchenko
a8627df549
ASoC: Intel: bytcr_rt5651: use devm_clk_get_optional() for mclk
The devm_clk_get_optional() helper returns NULL when devm_clk_get()
returns -ENOENT. This makes things slightly cleaner. The added benefit
is mostly cosmetic.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211007170250.27997-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 14:58:53 +01:00
Andy Shevchenko
269da8f762
ASoC: Intel: bytcr_rt5651: Use temporary variable for struct device
Use temporary variable for struct device to make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211007170250.27997-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 14:58:52 +01:00
Andy Shevchenko
0c465e7a8e
ASoC: Intel: bytcr_rt5651: Get platform data via dev_get_platdata()
Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211007170250.27997-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 14:58:51 +01:00
Andy Shevchenko
ee233500ee
ASoC: Intel: bytcr_rt5640: Utilize dev_err_probe() to avoid log saturation
dev_err_probe() avoids printing into log when the deferred probe is invoked.
This is possible when clock provider is pending to appear.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211007165715.27463-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 14:58:49 +01:00
Andy Shevchenko
a15ca6e3b8
ASoC: Intel: bytcr_rt5640: use devm_clk_get_optional() for mclk
The devm_clk_get_optional() helper returns NULL when devm_clk_get()
returns -ENOENT. This makes things slightly cleaner. The added benefit
is mostly cosmetic.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211007165715.27463-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 14:58:48 +01:00
Andy Shevchenko
81d43ca175
ASoC: Intel: bytcr_rt5640: Use temporary variable for struct device
Use temporary variable for struct device to make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211007165715.27463-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 14:58:47 +01:00
Andy Shevchenko
e86c1893d6
ASoC: Intel: bytcr_rt5640: Get platform data via dev_get_platdata()
Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211007165715.27463-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 14:58:46 +01:00
Ajit Kumar Pandey
281ddf62f5
ASoC: amd: Kconfig: Select fch clock support with machine driver
We are using fch clock controller as parent mclk source for rt5682
codec. Add config to enable clock framework support for 48MHz fixed
clock when machine driver config is selected.

Signed-off-by: Ajit Kumar Pandey <AjitKumar.Pandey@amd.com>
Link: https://lore.kernel.org/r/20211011055354.67719-1-AjitKumar.Pandey@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 13:19:18 +01:00
Yang Yingliang
c448b7aa3e
ASoC: soc-core: fix null-ptr-deref in snd_soc_del_component_unlocked()
'component' is allocated in snd_soc_register_component(), but component->list
is not initalized, this may cause snd_soc_del_component_unlocked() deref null
ptr in the error handing case.

KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:__list_del_entry_valid+0x81/0xf0
Call Trace:
 snd_soc_del_component_unlocked+0x69/0x1b0 [snd_soc_core]
 snd_soc_add_component.cold+0x54/0x6c [snd_soc_core]
 snd_soc_register_component+0x70/0x90 [snd_soc_core]
 devm_snd_soc_register_component+0x5e/0xd0 [snd_soc_core]
 tas2552_probe+0x265/0x320 [snd_soc_tas2552]
 ? tas2552_component_probe+0x1e0/0x1e0 [snd_soc_tas2552]
 i2c_device_probe+0xa31/0xbe0

Fix by adding INIT_LIST_HEAD() to snd_soc_component_initialize().

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211009065840.3196239-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-11 13:19:14 +01:00
Cameron Berkenpas
023a062f23 ALSA: hda/realtek: Fix for quirk to enable speaker output on the Lenovo 13s Gen2
The previous patch's HDA verb initialization for the Lenovo 13s
sequence was slightly off. This updated verb sequence has been tested
and confirmed working.

Fixes: ad7cc2d41b ("ALSA: hda/realtek: Quirks to enable speaker output for Lenovo Legion 7i 15IMHG05, Yoga 7i 14ITL5/15ITL5, and 13s Gen2 laptops.")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=208555
Cc: <stable@vger.kernel.org>
Signed-off-by: Cameron Berkenpas <cam@neo-zeon.de>
Link: https://lore.kernel.org/r/20211010225410.23423-1-cam@neo-zeon.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-11 11:05:59 +02:00
William Overton
6d27788160 ALSA: usb-audio: Add support for the Pioneer DJM 750MK2 Mixer/Soundcard
The kernel already has support for very similar Pioneer djm products
and this work is based on that.

Added device to quirks-table.h and added control info to
mixer_quirks.c.

Tested on my hardware and all working.

Signed-off-by: William Overton <willovertonuk@gmail.com>
Link: https://lore.kernel.org/r/20211010145841.11907-1-willovertonuk@gmail.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-10 22:26:58 +02:00
Colin Ian King
cacbce45f5
ASoC: rockchip: i2s-tdm: Fix error handling on i2s_tdm_prepare_enable_mclk failure
In the case where the call to i2s_tdm_prepare_enable_mclk fails the
function returns before the error handling goto is executed. Fix this
by removing the return do perform the intended error handling exit.

Fixes: 081068fd64 ("ASoC: rockchip: add support for i2s-tdm controller")
Addresses-Coverity: ("Structurally dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Message-Id: <20211008095430.62680-2-colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 17:22:52 +01:00
Colin Ian King
74daadc7fd
ASoC: rockchip: i2s-tdm: Remove call to rockchip_i2s_ch_to_io
The call to rockchip_i2s_ch_to_io is only useful for its return
value which is not being used. The function call also has no
side effects, the call is effectively useless and can be removed.

Addresses-Coverity: ("Useless call")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Message-Id: <20211008095430.62680-1-colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 17:22:51 +01:00
Trevor Wu
5245352588
ASoC: mediatek: mt8195: update audsys clock parent name
Because clock names are modified in mediatek CCF driver, sync the updated
clock names to audsys driver.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Message-Id: <20211008070424.14347-1-trevor.wu@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 17:22:50 +01:00
Mark Brown
4dbdda1938
Merge series "ASoC: rt9120: Add Richtek RT9120 supprot" from cy_huang <u0084500@gmail.com>
ChiYuan Huang <cy_huang@richtek.com>:

From: ChiYuan Huang <cy_huang@richtek.com>

This patch series Add the Richtek RT9120 support.

In v3:
- Add dvdd regulator binding to check the dvdd voltage domain.
- Refine sdo_select_text.
- Use switch case in 'internal_power_event' function.
- Remove the volume and mute initially write in component probe.
- Remove the mute API. It's no need by HW design.

In v2:
- Add missing #sound-dai-cells property.

ChiYuan Huang (2):
  ASoC: dt-bindings: rt9120: Add initial bindings
  ASoC: rt9120: Add rt9210 audio amplifier support

 .../devicetree/bindings/sound/richtek,rt9120.yaml  |  59 +++
 sound/soc/codecs/Kconfig                           |  10 +
 sound/soc/codecs/Makefile                          |   2 +
 sound/soc/codecs/rt9120.c                          | 489 +++++++++++++++++++++
 4 files changed, 560 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/richtek,rt9120.yaml
 create mode 100644 sound/soc/codecs/rt9120.c

--
2.7.4
2021-10-08 17:22:43 +01:00
Mark Brown
04a32383f8
Merge series "ASoC: Intel: bytcht_es8316: few cleanups" from Andy Shevchenko <andriy.shevchenko@linux.intel.com>:
The small set of cleanups against bytcht_es8316 board file.

In v4:
- fixed Pierre's email (Pierre)
- added Hans to the Cc list

In v3:
- actually added a Pierre's tag (Mark)

In v2:
- added tag (Pierre)
- added commit message to the patch 2 (Joe)

Andy Shevchenko (4):
  ASoC: Intel: bytcht_es8316: Get platform data via dev_get_platdata()
  ASoC: Intel: bytcht_es8316: Use temporary variable for struct device
  ASoC: Intel: bytcht_es8316: Switch to use gpiod_get_optional()
  ASoC: Intel: bytcht_es8316: Utilize dev_err_probe() to avoid log
    saturation

 sound/soc/intel/boards/bytcht_es8316.c | 37 +++++++++-----------------
 1 file changed, 12 insertions(+), 25 deletions(-)

--
2.33.0
2021-10-08 17:22:42 +01:00
Rander Wang
febf5da81e
ASoC: SOF: prepare code to allocate IPC messages in fw_ready
The fixed maximum size of IPC message does not allow for large
transfers, e.g. for filter data. Currently such messages will
be divided into smaller pieces and sent to firmware in multiple
chunks. For future IPC, this strategy is not suitable.

The maximum IPC message size is limited by host box size which
can be known when firmware is ready, so the fw_ready callback
can allocate IPC messages with platform-specific sizes instead
of the current fixed-size.

To be compatible with released firmware, current platforms will
still use SOF_IPC_MSG_MAX_SIZE. For future platforms, there will
be a new fw_ready function and the platform-specific allocation
will take place there.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Message-Id: <20211008093836.28210-1-peter.ujfalusi@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 13:51:16 +01:00
Andy Shevchenko
bea03a328f
ASoC: Intel: bytcht_es8316: Utilize dev_err_probe() to avoid log saturation
dev_err_probe() avoids printing into log when the deferred probe is invoked.
This is possible when clock provider is pending to appear.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20211007164523.27094-5-andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 13:51:14 +01:00
Andy Shevchenko
4e03b1b772
ASoC: Intel: bytcht_es8316: Switch to use gpiod_get_optional()
First of all, replace indexed API by plain one since we have index 0.
Second, switch to optional variant and drop duplicated code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20211007164523.27094-4-andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 13:51:13 +01:00
Andy Shevchenko
e8ccf82b8a
ASoC: Intel: bytcht_es8316: Use temporary variable for struct device
Use temporary variable for struct device to make code neater.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20211007164523.27094-3-andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 13:51:12 +01:00
Andy Shevchenko
5f6c1341d1
ASoC: Intel: bytcht_es8316: Get platform data via dev_get_platdata()
Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Message-Id: <20211007164523.27094-2-andriy.shevchenko@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 13:51:11 +01:00
ChiYuan Huang
f218b5e266
ASoC: rt9120: Add rt9210 audio amplifier support
Add Richtek rt9120 audio amplifier support.

Signed-off-by: ChiYuan Huang <cy_huang@richtek.com>
[Fix a Gain->Volume -- broonie]
Message-Id: <1633668612-25524-3-git-send-email-u0084500@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 13:50:37 +01:00
Mark Brown
06a0fc36a5
Merge series "Add reset-gpios handling for max98927" from Alejandro Tafalla <atafalla@dnyon.com>:
The max98927 codec on some devices (i.e. Xiaomi Mi A2 Lite phone) requires
hardware-resetting the codec by driving a reset-gpio. This series adds
support for it through an optional reset-gpios property.

v4:
* Correctly assert/deassert the GPIO states
* Wait for the i2c port to be ready after reset
* Reset device when removed

v3:
* Fix indentation on the dev_err_probe line

v2:
* Use dev_err_probe instead of dev_err

Alejandro Tafalla (2):
  ASoC: max98927: Handle reset gpio when probing i2c
  dt-bindings: sound: max98927: Add reset-gpios optional property

 .../devicetree/bindings/sound/max9892x.txt    |  3 +++
 sound/soc/codecs/max98927.c                   | 25 +++++++++++++++++++
 sound/soc/codecs/max98927.h                   |  1 +
 3 files changed, 29 insertions(+)

--
2.33.0
2021-10-07 22:24:59 +01:00
Mark Brown
99f11b6552
Merge series "Introduce new SOF helpers" from Daniel Baluta <daniel.baluta@oss.nxp.com>
Daniel Baluta <daniel.baluta@nxp.com>:

From: Daniel Baluta <daniel.baluta@nxp.com>

This patchseries adds new helpers in order to reduce code duplication
and prepare for compress audio support with SOF.

Bud Liviu-Alexandru (1):
  ASoC: SOF: Make Intel IPC stream ops generic

Daniel Baluta (3):
  ASoC: SOF: Introduce snd_sof_mailbox_read / snd_sof_mailbox_write
    callbacks
  ASoC: SOF: imx: Use newly introduced generic IPC stream ops
  ASoC: SOF: Introduce fragment elapsed notification API

 sound/soc/sof/Kconfig                         |  4 ++
 sound/soc/sof/Makefile                        |  3 +-
 sound/soc/sof/compress.c                      | 51 +++++++++++++++++++
 sound/soc/sof/imx/Kconfig                     |  2 +
 sound/soc/sof/imx/imx8.c                      | 39 +++++++-------
 sound/soc/sof/imx/imx8m.c                     | 26 ++++------
 sound/soc/sof/intel/Makefile                  |  3 --
 sound/soc/sof/intel/apl.c                     |  4 ++
 sound/soc/sof/intel/bdw.c                     | 12 +++--
 sound/soc/sof/intel/byt.c                     | 24 ++++++---
 sound/soc/sof/intel/cnl.c                     |  4 ++
 sound/soc/sof/intel/icl.c                     |  4 ++
 sound/soc/sof/intel/pci-tng.c                 | 12 +++--
 sound/soc/sof/intel/tgl.c                     |  4 ++
 sound/soc/sof/ipc.c                           |  6 ++-
 sound/soc/sof/ops.h                           | 15 ++++++
 sound/soc/sof/pcm.c                           |  7 ++-
 sound/soc/sof/sof-audio.h                     | 11 +++-
 sound/soc/sof/sof-priv.h                      | 28 ++++++----
 .../sof/{intel/intel-ipc.c => stream-ipc.c}   | 50 +++++++++---------
 sound/soc/sof/topology.c                      |  6 ++-
 21 files changed, 218 insertions(+), 97 deletions(-)
 create mode 100644 sound/soc/sof/compress.c
 rename sound/soc/sof/{intel/intel-ipc.c => stream-ipc.c} (58%)

--
2.27.0
2021-10-07 22:24:58 +01:00
Mark Brown
1cfd7c2ee9
Merge series "ASoC: SOF: Improvements for debugging" from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>:
Hi,

The aim of this series is to clean up, make it easier to interpret and less
'chatty' prints aimed for debugging errors.

For example currently the DSP/IPC dump is printed every time we have an IPC
timeout and it is posible to lost the first and more indicative dump to find the
rootcause.

Regards,
Peter
---
Peter Ujfalusi (18):
  ASoC: SOF: debug: Swap the dsp_dump and ipc_dump sequence for
    fw_exception
  ASoC: SOF: ipc and dsp dump: Add markers for better visibility
  ASoC: SOF: Print the dbg_dump and ipc_dump once to reduce kernel log
    noise
  ASoC: SOF: loader: Print the DSP dump if boot fails
  ASoC: SOF: intel: atom: No need to do a DSP dump in atom_run()
  ASoC: SOF: debug/ops: Move the IPC and DSP dump functions out from the
    header
  ASoC: SOF: debug: Add SOF_DBG_DUMP_OPTIONAL flag for DSP dumping
  ASoC: SOF: intel: hda-loader: Use snd_sof_dsp_dbg_dump() for DSP dump
  ASoC: SOF: Drop SOF_DBG_DUMP_FORCE_ERR_LEVEL and sof_dev_dbg_or_err
  ASoC: SOF: debug: Print out the fw_state along with the DSP dump
  ASoC: SOF: ipc: Re-enable dumps after successful IPC tx
  ASoC: SOF: ops: Force DSP panic dumps to be printed
  ASoC: SOF: Introduce macro to set the firmware state
  ASoC: SOF: intel: hda: Drop 'error' prefix from error dump functions
  ASoC: SOF: core: Clean up snd_sof_get_status() prints
  ASoC: SOF: loader: Drop SOF_DBG_DUMP_REGS flag when firmware start
    fails
  ASoC: SOF: Intel: hda-loader: Drop SOF_DBG_DUMP_REGS flag from
    dbg_dump calls
  ASoC: SOF: Intel: hda: Dump registers and stack when SOF_DBG_DUMP_REGS
    is set

Pierre-Louis Bossart (1):
  ASoC: SOF: core: debug: force all processing on primary core

 sound/soc/sof/core.c             | 24 ++++++-------
 sound/soc/sof/debug.c            | 61 ++++++++++++++++++++++++++++++--
 sound/soc/sof/intel/atom.c       |  5 +--
 sound/soc/sof/intel/hda-loader.c | 11 +++---
 sound/soc/sof/intel/hda.c        | 16 +++------
 sound/soc/sof/ipc.c              | 10 ++++--
 sound/soc/sof/loader.c           | 11 ++++--
 sound/soc/sof/ops.c              |  3 ++
 sound/soc/sof/ops.h              | 12 +------
 sound/soc/sof/pm.c               |  6 ++--
 sound/soc/sof/sof-priv.h         | 31 ++++++++++------
 sound/soc/sof/topology.c         |  6 ++++
 12 files changed, 131 insertions(+), 65 deletions(-)

--
2.33.0
2021-10-07 22:24:56 +01:00
Mark Brown
43b058698f
Merge series "Rockchip I2S/TDM controller" from Nicolas Frattaroli <frattaroli.nicolas@gmail.com>:
Hello,

this is version 5 of the I2S/TDM driver patchset. A big thanks
to everyone who has provided their valuable feedback so far.

Changes in v5:
 driver:
 - change comment style of the first comment to C++ style
 - make refcount non-atomic, as it's only ever used inside
   a spinlock
 - use newer SND_SOC_DAIFMT_CB* defines
 - change ternary statements to if/else conditions
 - make _clk_compensation_put return 1 if clock changed
 - implement set_bclk_ratio callback
 - always set half frame sync mode in TDM mode
 - automatically enable mclk-calibrate mode when the clocks for
   it are specified in the device tree
 bindings:
 - add Reviewed-by: Rob Herring
 - drop rockchip,frame-width property (done by set_bclk_ratio)
 - drop rockchip,fsync-half-frame property
 - drop rockchip,mclk-calibrate property
 dts:
 - drop empty codec block from Quartz64 device tree

Changes in v4:
 driver:
 - factor TDE/RDE enable/disable into their own inlined functions
 - add an RDE disable in a location where it looks like it was
   forgotten (rxctrl else), judging by corresponding TDE code
 - remove parentheses around CLK_PPM_MIN/MAX values
 - wording + titlecasing in the clock compensation control
 - use if statement in precious_reg instead
 - refactor rockchip_i2s_io_multiplex to have the switch statements
   in a function call to make the function less unwieldy
 - get rid of IS_ERR checks around clk enable/disable calls where
   already checked before by the probe
 - reworded some error message strings
 - fix potential deadlock in txrxctrl found by Sugar Zhang
   using spin_lock_irqsave
 - fix potential deadlock in trcm_mode found by Sugar Zhang
   using spin_lock_irqsave
 - use devm_platform_get_and_ioremap_resource in probe
 - only set DMA things if controller has capture/playback ability.
   Did not move this into init_dai because I'd then need to pass in
   the res and probe it earlier in the function, and it's also used
   elsewhere in the probe function
 - use _get_optional_exclusive for reset controls, as some controllers
   only have capture or playback capability
 bindings:
 - remove status = "okay" since that's the default
 - change the path configs to be an enum
 - rename "foo" to "bus"
 - make resets optional as controller may lack either playback or
   capture capability, and therefore also doesn't have a reset.
   At least one reset is still required, because a controller with
   no playback and no capture is not very useful

Changes in v3:
 driver:
 - alphabetically sort includes
 - check pm_runtime_get_sync return value, act on it
 - remove unnecessary initialisers in set_fmt
 - use udelay(15) in retry code: 10 retries * 15 = 150, so at worst
   we wait the full i2s register access delay
 - fix some weird returns to return directly
 - use __maybe_unused instead of #ifdef CONFIG_PM_SLEEP, also put
   __maybe_unused on the runtime callbacks
 - use (foo) instead of foo in header macros for precedence reasons
 - when using mclk-calibrate, also turn off/on those clocks during
   suspend and resume operations
 - remove mclk_tx and mclk_rx reenablement code in remove
 - move hclk enablement further down the probe, and disable it
   on probe failure
 - make reset controls mandatory, since the bindings state this too
 - use _exclusive for getting the reset controls
 - change reset assert/deassert delays to both be 10 usec
   (thank you Sugar Zhang!)
 - properly prepare and enable all mclks in probe, especially before
   calling clk_get_rate on them
 - if registering PCM fails, also use the cleanup error path instead of
   returning directly
 - bring back playback and capture only but in the way Sugar Zhang
   suggested it: set those modes depending on dma-names
 - rework clock enablement in general. Probe now always enables these,
   instead of relying on the pm resume thing
 - add myself to MAINTAINERS for this driver
 dt bindings:
 - fix a description still mentioning clk-trcm in the schema
 - document rockchip,io-multiplex, a property that describes the
   hardware as having multiplexed I2S GPIOs so direction needs to
   be changed dynamically
 - document rockchip,mclk-calibrate, which allows specifying
   different clocks for the two sample rate bases and switch between
   them as needed
 - dma-names now doesn't have a set order and items can be absent to
   indicate that the controller doesn't support this mode
 - add myself to MAINTAINERS for these bindings

Changes in v2:
 - remove ad-hoc writeq and needless (and broken) optimisation in
   reset assert/deassert. This wouldn't have worked on Big Endian,
   and would've been pointless on any other platform, as the
   overhead for saving one write was comparatively big
 - fix various checkpatch issues
 - get rid of leftover clk-trcm in schema
 - set status = "okay" in example in schema instead of "disabled"
 - change dma-names so rx is first, adjust device trees as necessary
 - properly reference uint32-array for rx-route and tx-route
   instead of uint32
 - replace trcm-sync with two boolean properties, adjust DT changes
   accordingly and also get rid of the header file
 - get rid of rockchip,no-dmaengine. This was only needed for
   some downstream driver and shouldn't be in the DT
 - get rid of rockchip,capture-only/playback-only. Rationale being
   that I have no way to test whether they're needed, and
   unconditionally setting channels_min to 0 breaks everything
 - change hclk description in "clocks"

Nicolas Frattaroli (4):
  ASoC: rockchip: add support for i2s-tdm controller
  ASoC: dt-bindings: rockchip: add i2s-tdm bindings
  arm64: dts: rockchip: add i2s1 on rk356x
  arm64: dts: rockchip: add analog audio on Quartz64

 .../bindings/sound/rockchip,i2s-tdm.yaml      |  198 ++
 MAINTAINERS                                   |    7 +
 .../boot/dts/rockchip/rk3566-quartz64-a.dts   |   31 +-
 arch/arm64/boot/dts/rockchip/rk356x.dtsi      |   26 +
 sound/soc/rockchip/Kconfig                    |   11 +
 sound/soc/rockchip/Makefile                   |    2 +
 sound/soc/rockchip/rockchip_i2s_tdm.c         | 1848 +++++++++++++++++
 sound/soc/rockchip/rockchip_i2s_tdm.h         |  398 ++++
 8 files changed, 2520 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/sound/rockchip,i2s-tdm.yaml
 create mode 100644 sound/soc/rockchip/rockchip_i2s_tdm.c
 create mode 100644 sound/soc/rockchip/rockchip_i2s_tdm.h

--
2.33.0
2021-10-07 22:24:55 +01:00
Pierre-Louis Bossart
9609cfcda0
ASoC: soc-pcm: restore mixer functionality
Recent changes in soc-pcm completely broke basic support for mixers on
Intel systems: the filters on BE states prevent the connection of a
second mixer input while the back-end is already active.

Rather than reverting the changes, which would be problematic for
Tegra systems, this patch suggests an additional filter which will
only apply to Tegra systems. This is a temporary solution which will
have to be revisited - additional issues have been reported with DPCM.

Fixes: 0c25db3f76 ('ASoC: soc-pcm: Don't reconnect an already active BE')
Suggested-by: Sameer Pujar <spujar@nvidia.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/20211004212141.193136-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 19:20:00 +01:00
Derek Fang
06096537b7
ASoC: rt5682s: Fix hp pop produced immediately after resuming
When the system plays a sound immediately after resuming from S3,
it could hear a little pop from headphones.
It is due to the HP was unmuted before the completion of
jack re-detection finished in parallel.

This patch adds a lock to make sure the HP unmute after jack detect handler,
and adds a few depop changes.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20211007085519.12543-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 19:19:58 +01:00
Nicolas Frattaroli
081068fd64
ASoC: rockchip: add support for i2s-tdm controller
This commit adds support for the rockchip i2s-tdm controller,
which enables audio output on the following rockchip SoCs:
- px30
- rk1808
- rk3308
- rk3566
- rk3568
- rv1126

This is a cleaned up version of the downstream vendor kernel's
driver. It can be enabled through the SND_SOC_ROCKCHIP_I2S_TDM
configuration option.

Signed-off-by: Nicolas Frattaroli <frattaroli.nicolas@gmail.com>
Link: https://lore.kernel.org/r/20211001171531.178775-2-frattaroli.nicolas@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 16:58:16 +01:00
Daniel Baluta
858f7a5c45
ASoC: SOF: Introduce fragment elapsed notification API
This patch prepares the introduction of the compress API with SOF.

After each fragment is accepted by the DSP we need to inform
the userspace applications that they can send the next fragment.
This is done via snd_compr_fragment_elapsed.

Similar with the PCM case, in order to avoid sending an IPC before
the previous IPC is handled we need to schedule a delayed work to
call snd_compr_fragment_elapsed().

See snd_sof_pcm_period_elapsed.

To sum up this patch offers the following API to SOF code:
	* snd_sof_compr_init_elapsed_work
	* snd_sof_compr_fragment_elapsed

Note that implementation for compressed function is in a new file
selected via CONFIG_SND_SOC_SOF_COMPRESS invisible config option.
This option is automatically selected for platforms that support
the compress interface. For now only i.MX8 platforms support this.

For symmetry we introduce snd_sof_pcm_init_elapsed_work to setup
the work struct for PCM case.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Bud Liviu-Alexandru <budliviu@gmail.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Paul Olaru <paul.olaru@oss.nxp.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211004152147.1268978-5-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 16:57:57 +01:00
Daniel Baluta
40834190aa
ASoC: SOF: imx: Use newly introduced generic IPC stream ops
This makes IMX use the newly introduced generic IPC ops
instead of imx specific ones, and removes the old IMX
ipc ops, as they are no longer needed.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Bud Liviu-Alexandru <budliviu@gmail.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211004152147.1268978-4-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 16:57:56 +01:00
Bud Liviu-Alexandru
97e22cbd0d
ASoC: SOF: Make Intel IPC stream ops generic
This operations should be generic as there is nothing Intel
specific. This works well for NXP i.MX8 stream IPC ops.

We start by moving sof/intel/intel-ipc.c into sof/stream-ipc.c and
rename the functions to be generic.

Notice that we use newly introduced snd_sof_dsp_mailbox_read
instead of sof_mailbox_read, to make sure that we are not
bound to existing MMIO memory access, and we allow platform
to implement their own memory access routines.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Bud Liviu-Alexandru <budliviu@gmail.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@gmail.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211004152147.1268978-3-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 16:57:54 +01:00
Daniel Baluta
f71f59dd45
ASoC: SOF: Introduce snd_sof_mailbox_read / snd_sof_mailbox_write callbacks
We need to introduce snd_sof_mailbox_{read/write} in order to provide
a generic way for mailbox access. These routines are optional, each
platform can implement their own specific routines.

So far, all platforms use mmapped I/O thus they can use custom made
routines sof_mailbox_read / sof_mailbox_write that use MMIO.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Bud Liviu-Alexandru <budliviu@gmail.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211004152147.1268978-2-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 16:57:53 +01:00
Peter Ujfalusi
d8a15e5fca
ASoC: SOF: pipelines: Harmonize all functions to use struct snd_sof_dev
First thing the pipelines function which have "struct device *dev" as
parameter do is:
struct snd_sof_dev *sdev = dev_get_drvdata(dev);

and in all cases the passed dev is actually coming from sdev->dev.

Skip this steps and pass directly the sdev to all pipelines related
functions as few of them already does this.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006111651.10027-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:45 +01:00
Ranjani Sridharan
ec626334ea
ASoC: SOF: topology: do not power down primary core during topology removal
When removing the topology components, do not power down
the primary core. Doing so will result in an IPC timeout
when the SOF PCI device runtime suspends.

Fixes: 0dcdf84289 ("ASoC: SOF: add a "core" parameter to widget loading functions")

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211006104041.27183-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:44 +01:00
Peter Ujfalusi
3ad7b8f481
ASoC: SOF: Intel: hda: Dump registers and stack when SOF_DBG_DUMP_REGS is set
Instead of checking the fw_state to decide what information should be
printed, use the SOF_DBG_DUMP_REGS bit in the flags to dump registers and
stack.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-20-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:41 +01:00
Peter Ujfalusi
7511b0edf1
ASoC: SOF: Intel: hda-loader: Drop SOF_DBG_DUMP_REGS flag from dbg_dump calls
In cl_dsp_init() we are powering up the DSP, register dump is not valid.
In hda_dsp_cl_boot_firmware() we are downloading the firmware to DSP, again
the register dump is not a valid concept.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-19-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:40 +01:00
Peter Ujfalusi
f8c3ec4368
ASoC: SOF: loader: Drop SOF_DBG_DUMP_REGS flag when firmware start fails
snd_sof_dsp_run() failure indicates that the DSP did not even booted up,
thus asking for dumping registers at this point is not valid.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-18-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:39 +01:00
Peter Ujfalusi
e51838909b
ASoC: SOF: core: Clean up snd_sof_get_status() prints
Clean up the error prints when decoding the status in snd_sof_get_status():
Drop the "error:" prefixes from the prints,
Use %# to print hexadecimal numbers,
Reword some of the messages to be more precise,
For a known error print out the panic code as well,
For unknown error print only the panic code without the magic

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-17-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:38 +01:00
Peter Ujfalusi
4fade25dfb
ASoC: SOF: intel: hda: Drop 'error' prefix from error dump functions
Drop the 'error' prefix printed in hda_dsp_dump_ext_rom_status(),
hda_ipc_irq_dump() and hda_ipc_dump() as it gives no value to the
information we print.

The DSP and IPC dump is marked now, which makes the 'error' prefix more
redundant.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-16-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:37 +01:00
Peter Ujfalusi
58a5c9a4aa
ASoC: SOF: Introduce macro to set the firmware state
Add sof_set_fw_state() macro to wrap the sdev->fw_state management to allow
actions to be taken when certain state is set or when state is changing.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-15-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:36 +01:00
Peter Ujfalusi
705f4539c4
ASoC: SOF: ops: Force DSP panic dumps to be printed
If a DSP panic happens we want to see the dumps.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-14-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:35 +01:00
Peter Ujfalusi
e6ff3db9ef
ASoC: SOF: ipc: Re-enable dumps after successful IPC tx
The dumps are silenced after an IPC tx timeout by default.
The IPC timeout can indicate severe error (firmware crash) or in some cases
it is less devastating and the firmware remains operational, the timeout
was due to a scheduling spike or other anomaly.

In any case consequent IPC timeouts will not print dumps but if any IPC do
succeed than we should re-enable the dumps to print dumps the next time
a timeout might happen.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-13-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:34 +01:00
Peter Ujfalusi
c05ec07143
ASoC: SOF: debug: Print out the fw_state along with the DSP dump
The fw state can be an important information along with the DSP dump.
Print it out before the dump.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-12-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:33 +01:00
Peter Ujfalusi
23013335bc
ASoC: SOF: Drop SOF_DBG_DUMP_FORCE_ERR_LEVEL and sof_dev_dbg_or_err
The sof_dev_dbg_or_err() is only used by intel/hda.c when dumping dsp
debug information.
It was used to print the extended rom status in either dev_dbg (during
retries) and finally with dev_err, but other lines were printed with
dev_err regardless.

Since we now only print the dump once, the flag and the macros is no longer
needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-11-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:31 +01:00
Peter Ujfalusi
0ecaa2fff2
ASoC: SOF: intel: hda-loader: Use snd_sof_dsp_dbg_dump() for DSP dump
Do not call directly the hda_dsp_dump(), use the generic wrapper instead
to provide consistent output.

Mark the DSP dumps as optional to not spam the kernel log with the
exception of the last dump in case the DSP fails to run.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-10-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:30 +01:00
Peter Ujfalusi
34346a383d
ASoC: SOF: debug: Add SOF_DBG_DUMP_OPTIONAL flag for DSP dumping
The new SOF_DBG_DUMP_OPTIONAL flag can be used to mark a DSP dump that
should only be printed when the SOF_DBG_PRINT_ALL_DUMPS sof_core_debug
flag is set, otherwise it should be ignored and not printed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:29 +01:00
Peter Ujfalusi
360fa3234e
ASoC: SOF: debug/ops: Move the IPC and DSP dump functions out from the header
To be usable in platform code, move the IPC and DSP dump function to
debug.c and export it in a similar way as the snd_sof_handle_fw_exception()

Make the snd_sof_ipc_dump() static as it is only used in debug.c

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-8-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:28 +01:00
Peter Ujfalusi
e131bc5886
ASoC: SOF: intel: atom: No need to do a DSP dump in atom_run()
The core already prints a dump if the DSP failed to start in
snd_sof_run_firmware(), there is no need to print it locally as well.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-7-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:27 +01:00
Peter Ujfalusi
247ac64073
ASoC: SOF: loader: Print the DSP dump if boot fails
It can be useful to print the DSP dump from the core in case the DSP boot
failed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:26 +01:00
Peter Ujfalusi
9ff90859b9
ASoC: SOF: Print the dbg_dump and ipc_dump once to reduce kernel log noise
Do not print the dump more than once to keep the kernel log cleaner in case
of a firmware failure.

When the DSP is rebooted due to suspend or runtime_suspend reset the flags
to re-enable the dump prints.

Add also a debug flag to print all dumps to get more coverage if needed.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-5-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:25 +01:00
Peter Ujfalusi
3f7561f741
ASoC: SOF: ipc and dsp dump: Add markers for better visibility
Add markers to identify the start and end of the IPC and DSP dumps in the
kernel log.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-4-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:24 +01:00
Peter Ujfalusi
e85c26eca6
ASoC: SOF: debug: Swap the dsp_dump and ipc_dump sequence for fw_exception
snd_sof_dsp_panic() only prints dsp_dump followed by flushing the DMA trace
buffer.

To retain similar 'sequence' first do an ipc_dump then the dsp_dump and
finally flush the trace buffer in case of fw_exception.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-3-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:22 +01:00
Pierre-Louis Bossart
1539c8c5fc
ASoC: SOF: core: debug: force all processing on primary core
The topology file currently provides information on which
pipeline/processing is to be scheduled on which DSP core.

To help diagnose potential issues, this patch provides an override of
the 'core' tokens to use the primary core (typically core0). Of course
this may result in a Core0 activity that exceeds hardware
capabilities, so this should only be used when the total processing
fits on DSP - possibly using firmware mockup processing and stubs.

No new dmesg log was added to avoid adding noise during topology
parsing, but the existing logs will show the primary core being used.

This is strictly for validation/debug, products should NEVER use this
override, the topology is assumed to be the description of the
firmware graph.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211006110645.26679-2-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:21 +01:00
Alejandro Tafalla
4d67dc1998
ASoC: max98927: Handle reset gpio when probing i2c
The max98927 codec on some devices requires pulling a reset gpio before
responding to any i2c command. This commit adds support for it through
an optional reset-gpios property.

Signed-off-by: Alejandro Tafalla <atafalla@dnyon.com>
Link: https://lore.kernel.org/r/d74b12a79ae9ca728d5d9e64c55b3e59e8c0e509.1633572679.git.atafalla@dnyon.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:18 +01:00
Srinivasa Rao Mandadapu
214174d9f5
ASoC: codec: wcd938x: Add irq config support
This patch fixes compilation error in wcd98x codec driver.

Fixes: 0454422288 ("ASoC: codecs: wcd938x: add audio routing and Kconfig")

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/1633614675-27122-1-git-send-email-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:14 +01:00
Takashi Iwai
5af82c81b2
ASoC: DAPM: Fix missing kctl change notifications
The put callback of a kcontrol is supposed to return 1 when the value
is changed, and this will be notified to user-space.  However, some
DAPM kcontrols always return 0 (except for errors), hence the
user-space misses the update of a control value.

This patch corrects the behavior by properly returning 1 when the
value gets updated.

Reported-and-tested-by: Hans de Goede <hdegoede@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20211006141712.2439-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:12 +01:00
Andy Shevchenko
c25d4546ca
ASoC: Intel: bytcht_es8316: Utilize dev_err_probe() to avoid log saturation
dev_err_probe() avoids printing into log when the deferred probe is invoked.
This is possible when clock provider is pending to appear.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211006150428.16434-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:11 +01:00
Andy Shevchenko
10f4a96543
ASoC: Intel: bytcht_es8316: Switch to use gpiod_get_optional()
First of all, replace indexed API by plain one since we have index 0.
Second, switch to optional variant and drop duplicated code.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211006150428.16434-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:10 +01:00
Andy Shevchenko
6f32c52106
ASoC: Intel: bytcht_es8316: Use temporary variable for struct device
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211006150428.16434-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:09 +01:00
Andy Shevchenko
2577b868a4
ASoC: Intel: bytcht_es8316: Get platform data via dev_get_platdata()
Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.com>
Link: https://lore.kernel.org/r/20211006150428.16434-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:08 +01:00
Srinivasa Rao Mandadapu
db0767b8a6
ASoC: wcd938x: Fix jack detection issue
This patch is to fix audio 3.5mm jack detection failure
on wcd938x codec based target.

Fixes: bcee7ed09b (ASoC: codecs: wcd938x: add Multi Button Headset Control support)

Signed-off-by: Venkata Prasad Potturu <potturu@codeaurora.org>
Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/1633614619-27026-1-git-send-email-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-07 15:45:07 +01:00
Takashi Iwai
59d7f5f6dd ALSA: usb-audio: Pass JOINT_DUPLEX info flag for implicit fb streams
When a stream is in the implicit feedback mode, it's more or less tied
with a capture stream.  Passing SNDRV_PCM_INFO_JOINT_DUPLEX may help
for user-space to understand the situation.

Link: https://lore.kernel.org/r/20211007083528.4184-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-07 12:25:21 +02:00
Takashi Iwai
36df2427ac ALSA: pcm: Add more disconnection checks at file ops
In the case of hot-disconnection of a PCM device, all file operations
except for close should be rejected.  This patch adds more sanity
checks in the file operation code paths.

Link: https://lore.kernel.org/r/20211006142214.3089-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-07 09:16:56 +02:00
Takashi Iwai
c0f1886de7 ALSA: hda: intel: Allow repeatedly probing on codec configuration errors
It seems that a few recent AMD systems show the codec configuration
errors at the early boot, while loading the driver at a later stage
works magically.  Although the root cause of the error isn't clear,
it's certainly not bad to allow retrying the codec probe in such a
case if that helps.

This patch adds the capability for retrying the probe upon codec probe
errors on the certain AMD platforms.  The probe_work is changed to a
delayed work, and at the secondary call, it'll jump to the codec
probing.

Note that, not only adding the re-probing, this includes the behavior
changes in the codec configuration function.  Namely,
snd_hda_codec_configure() won't unregister the codec at errors any
longer.  Instead, its caller, azx_codec_configure() unregisters the
codecs with the probe failures *if* any codec has been successfully
configured.  If all codec probe failed, it doesn't unregister but let
it re-probed -- which is the most case we're seeing and this patch
tries to improve.

Even if the driver doesn't re-probe or give up, it will go to the
"free-all" error path, hence the leftover codecs shall be disabled /
deleted in anyway.

BugLink: https://bugzilla.suse.com/show_bug.cgi?id=1190801
Link: https://lore.kernel.org/r/20211006141940.2897-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-07 09:15:22 +02:00
Werner Sembach
dd6dd6e3c7 ALSA: hda/realtek: Add quirk for TongFang PHxTxX1
This applies a SND_PCI_QUIRK(...) to the TongFang PHxTxX1 barebone. This
fixes the issue of the internal Microphone not working after booting
another OS.

When booting a certain another OS this barebone keeps some coeff settings
even after a cold shutdown. These coeffs prevent the microphone detection
from working in Linux, making the Laptop think that there is always an
external microphone plugged-in and therefore preventing the use of the
internal one.

The relevant indexes and values where gathered by naively diff-ing and
reading a working and a non-working coeff dump.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20211006130415.538243-1-wse@tuxedocomputers.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-06 15:59:29 +02:00
Mark Brown
dc1fad25bb
Merge series "ASoC: Intel: machine driver updates for 5.16" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
One quirk for a Dell TigerLake/SoundWire device, and initial support
for platforms based on the ES8336 codec (aka ES8316). For full
functionality, an update of the codec driver will be needed.

Pierre-Louis Bossart (5):
  ASoC: Intel: soc-acpi: apl/glk/tgl: add entry for devices based on
    ES8336 codec
  ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on
    ES8336 codec
  ASoC: Intel: add machine driver for SOF+ES8336
  ASoC: Intel: soc-acpi: add missing quirk for TGL SDCA single amp
  ASoC: Intel: sof_sdw: add missing quirk for Dell SKU 0A45

 sound/hda/intel-dsp-config.c                  |  22 +-
 sound/soc/intel/boards/Kconfig                |  14 +
 sound/soc/intel/boards/Makefile               |   2 +
 sound/soc/intel/boards/sof_es8336.c           | 569 ++++++++++++++++++
 sound/soc/intel/boards/sof_sdw.c              |  10 +
 .../intel/common/soc-acpi-intel-bxt-match.c   |   6 +
 .../intel/common/soc-acpi-intel-glk-match.c   |   7 +-
 .../intel/common/soc-acpi-intel-tgl-match.c   |  47 ++
 8 files changed, 674 insertions(+), 3 deletions(-)
 create mode 100644 sound/soc/intel/boards/sof_es8336.c

--
2.25.1
2021-10-05 16:25:24 +01:00
Mark Brown
6d0c1f787c
Merge series "ASoC: SOF: Intel: add flags to turn on SSP clocks early" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
With the chip shortage, some GeminiLake Intel-based designs were
respun and now rely on codecs that need the SSP bit clock turned on in
the hw_params stage, not the trigger stage. This patchset mirrors the
flags added in the SOF DAI_CONFIG IPC, and sets the flags when this
capability is indicated as necessary in the topology files where the
SSP configuration is stored.

We initially considered a more generic solution with an on-demand SSP
clock activation using the common clock framework. This would be a
more elegant solution indeed, but it would have required more
intrusive changes that would conflict with the SOF multi-client
support (in-development), and more backport hassles on product
branches. The on-demand activation of clocks is still a desired
feature that will be enabled at a later point.

Bard Liao (1):
  ASoC: SOF: dai-intel: add SOF_DAI_INTEL_SSP_CLKCTRL_MCLK/BCLK_ES bits

Pierre-Louis Bossart (4):
  ASoC: SOF: dai: mirror group_id definition added in firmware
  ASoC: SOF: dai: include new flags for DAI_CONFIG
  ASoC: SOF: Intel: hda: add new flags for DAI_CONFIG
  ASoC: SOF: Intel: hda-dai: improve SSP DAI handling for dynamic
    pipelines

 include/sound/sof/dai-intel.h |  4 ++
 include/sound/sof/dai.h       | 10 ++++-
 sound/soc/sof/intel/hda-dai.c | 82 ++++++++++++++++++++++++++++++++++-
 sound/soc/sof/intel/hda.c     |  6 +++
 sound/soc/sof/sof-audio.c     |  4 ++
 5 files changed, 103 insertions(+), 3 deletions(-)

--
2.25.1
2021-10-05 16:25:23 +01:00
Mark Brown
84a96720f3
Merge series "ASoC: SOF: topology: minor updates" from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:
Two patches to visualize settings and override dynamic pipelines + one
correction for errors on connections.

Pierre-Louis Bossart (2):
  ASoC: SOF: topology: show clks_control value in dynamic debug
  ASoC: SOF: topology: allow for dynamic pipelines override for debug

Ranjani Sridharan (1):
  ASoC: SOF: topology: return error if sof_connect_dai_widget() fails

 sound/soc/sof/sof-priv.h |  6 ++++++
 sound/soc/sof/topology.c | 24 +++++++++++++++---------
 2 files changed, 21 insertions(+), 9 deletions(-)

--
2.25.1
2021-10-05 16:25:22 +01:00
Daniel Baluta
7b84fd262d
ASoC: SOF: OF: Add fw_path and tplg_path parameters
This allows specifying an alternate path for SOF firmware or
SOF topology.

This is particularly useful for i.MX when running Linux vs Android.

Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211005071949.1277613-1-daniel.baluta@oss.nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:09:59 +01:00
Rikard Falkeborn
d54aa2aeaa
ASoC: amd: acp-rt5645: Constify static snd_soc_ops
The struct cz_aif1_ops is only assigned to the ops field in the
snd_soc_dai_link struct which is a pointer to const struct snd_soc_ops.
Make it const to allow the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211004224514.8783-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:09:58 +01:00
Ranjani Sridharan
4a23076987
ASoC: SOF: topology: return error if sof_connect_dai_widget() fails
Return the error if sof_connect_dai_widget() fails to
abort topology loading and prevent card registration.

Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211004212729.199550-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:09:56 +01:00
Pierre-Louis Bossart
ea6bfbbe3e
ASoC: SOF: topology: allow for dynamic pipelines override for debug
For debug and community support, it's useful to expose a kernel
parameter to prevent the use of dynamic pipelines exposed in a
topology file, or conversely to force an existing topology to use
dynamic pipelines.

Add an override bit and an enable bit which is valid only when the
override is set.

For products, the intent is that the topology file defines the
behavior, these two bits are only intended for diagnosis and
performance checks.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20211004212729.199550-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:09:55 +01:00
Pierre-Louis Bossart
cf9f3fffae
ASoC: SOF: topology: show clks_control value in dynamic debug
We log most of the SSP configurations except the clks_control. This
will be used to enable bclk/mclk early start so it's useful to show
the information to the user.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211004212729.199550-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:09:54 +01:00
Pierre-Louis Bossart
84e3cfd16a
ASoC: SOF: Intel: hda-dai: improve SSP DAI handling for dynamic pipelines
In order to keep the widget use_count balanced, make sure the DAI
widgets are allocated once in hw_params and released in hw_free. A
'setup' status flag is used to deal with cases where the .hw_params
callback is invoked multiple times, and likewise with cases where
hw_free is invoked without hw_params being called first (which can
happen if the FE hw_params fails).

In addition, this patch frees the widgets in the suspend transition,
and reallocates them in the .prepare callback. The 'setup' flag helps
in this case differentiate between resume (setup needed) and
xruns (setup not needed).

This balanced operation was not needed previously but will be required
when SOF dynamic pipelines are enabled.

Co-developed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:08:14 +01:00
Pierre-Louis Bossart
b30b60a26a
ASoC: SOF: Intel: hda: add new flags for DAI_CONFIG
The DAI_CONFIG is used for both hw_params and hw_free. Use flags to
specify what stage the configuration applies to.

the DAI_CONFIG IPC may be sent also during the widget setup so each
flag is cleared after the IPC to restore the state.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Brent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:08:12 +01:00
Pierre-Louis Bossart
64ba6d2ce7
ASoC: Intel: sof_sdw: add missing quirk for Dell SKU 0A45
This device is based on SDCA codecs but with a single amplifier
instead of two.

BugLink: https://github.com/thesofproject/linux/issues/3161
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Link: https://lore.kernel.org/r/20211004213512.220836-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:06:03 +01:00
Pierre-Louis Bossart
f2470679b0
ASoC: Intel: soc-acpi: add missing quirk for TGL SDCA single amp
We don't have a configuration for a single amp on link1.

BugLink: https://github.com/thesofproject/linux/issues/3161
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <bard.liao@intel.com>
Link: https://lore.kernel.org/r/20211004213512.220836-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:06:02 +01:00
Pierre-Louis Bossart
a164137ce9
ASoC: Intel: add machine driver for SOF+ES8336
Add machine driver to support APL/GLK/TGL platforms.
The TGL platform supports DMIC, APL and GLK do not.

Co-developed-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211004213512.220836-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:06:00 +01:00
Pierre-Louis Bossart
9d36ceab94
ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec
These devices are based on an I2C/I2S device, we need to force the use
of the SOF driver otherwise the legacy HDaudio driver will be loaded -
only HDMI will be supported.

Co-developed-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211004213512.220836-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:05:58 +01:00
Pierre-Louis Bossart
790049fb66
ASoC: Intel: soc-acpi: apl/glk/tgl: add entry for devices based on ES8336 codec
A number of devices, such as the "Chuwi HI10x" and "UNIQCELL Q15.6",
are based on APL/GLK with an I2C/I2S ES8336 codec.

Add table to find topology and firmware files.

Co-developed-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Huajun Li <huajun.li@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211004213512.220836-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-05 13:05:56 +01:00
Kailang Yang
5aec989130 ALSA: hda/realtek - ALC236 headset MIC recording issue
In power save mode, the recording voice from headset mic will 2s more delay.
Add this patch will solve this issue.

[ minor coding style fix by tiwai ]

Signed-off-by: Kailang Yang <kailang@realtek.com>
Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/ccb0cdd5bbd7486eabbd8d987d384cb0@realtek.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-05 09:01:32 +02:00
Takashi Iwai
5963e52621 ALSA: usb-audio: Enable rate validation for Scarlett devices
The Scarlett device series from Focusrite Novation seem requiring the
sample rate validations as we've done for MOTU devices; otherwise the
driver probes invalid audioformat entries that contain the sample
rates that actually don't work, and this may result in an incomplete
setup as reported recently.

This patch adds the needed quirk flag for enabling the sample rate
validation for Focusrite Novation devices.

Fixes: fe773b8711 ("ALSA: usb-audio: workaround for iface reset issue")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214493
Link: https://lore.kernel.org/r/20211004074050.28241-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-10-05 07:57:19 +02:00
Hans de Goede
7924f1bc94
ASoC: Intel: cht_bsw_nau8824: Set card.components string
Set the card.components string using the new nau8824_components() helper
which returns a components string based on the DMI quirks inside the
nau8824 codec driver.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211002211459.110124-4-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-04 15:55:30 +01:00
Hans de Goede
efee0fca19
ASoC: nau8824: Add a nau8824_components() helper
Some devices using the NAU8824 have only one speaker. To still have things
working properly this requires the left + right channels to both be mixed
to the left speaker output.

This mixer setup is done by userspace based on UCM profiles. But this
requires userspace to know that there is a mono-speaker. Add a helper
function (for the machine driver) to get a components string providing
this info.

This is done inside the codec driver because the codec driver already
has a DMI quirk table.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211002211459.110124-3-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-04 15:55:29 +01:00
Hans de Goede
92d3360108
ASoC: nau8824: Add DMI quirk mechanism for active-high jack-detect
Add a quirk mechanism to allow specifying that active-high jack-detection
should be used on platforms where this info is not available in devicetree.

And add an entry for the Cyberbook T116 tablet to the DMI table, so that
jack-detection will work properly on this tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211002211459.110124-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-04 15:55:28 +01:00
Hans de Goede
d316597c53
ASoC: nau8824: Fix NAU8824_JACK_LOGIC define
The NAU8824_JACK_LOGIC define was wrong, for active high jack-detect
to work bit 1 needs to be set, rather then bit 0.

The correct bit was found in the Android kernel source dump for
a Cyberbook T116 tablet; and this was also tested on that same tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211002211459.110124-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-04 15:55:26 +01:00
Hans de Goede
6e037b72cf
ASoC: rt5651: Use IRQF_NO_AUTOEN when requesting the IRQ
Use the new IRQF_NO_AUTOEN flag when requesting the IRQ, rather then
disabling it immediately after requesting it.

This fixes a possible race where the IRQ might trigger between requesting
and disabling it; and this also leads to a small code cleanup.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211003132255.31743-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-04 15:55:25 +01:00
Hans de Goede
1cf2aa6659
ASoC: es8316: Use IRQF_NO_AUTOEN when requesting the IRQ
Use the new IRQF_NO_AUTOEN flag when requesting the IRQ, rather then
disabling it immediately after requesting it.

This fixes a possible race where the IRQ might trigger between requesting
and disabling it; and this also leads to a small code cleanup.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20211003132255.31743-1-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-04 15:55:24 +01:00