Commit graph

23216 commits

Author SHA1 Message Date
Yang Yingliang
68912ebf4d
ASoC: axi-spdif: Use devm_platform_get_and_ioremap_resource()
Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210610133120.141405-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 14:59:16 +01:00
Yang Yingliang
9494d05997
ASoC: atmel-classd: Use devm_platform_get_and_ioremap_resource()
Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210611022115.3583765-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 14:59:15 +01:00
Yang Yingliang
be374dc0b5
ASoC: mchp-i2s-mcc: Use devm_platform_get_and_ioremap_resource()
Use devm_platform_get_and_ioremap_resource() to simplify
code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210611044256.3899583-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 14:59:14 +01:00
Mark Brown
a918e29174
Merge series "ASoC: codecs: add wcd938x support" from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:
This patchset adds support for Qualcomm WCD938X codec.

Qualcomm WCD9380/WCD9385 Codec is a standalone Hi-Fi audio codec IC
connected over SoundWire. This device has two SoundWire devices, RX and
TX respectively supporting 4 x ADCs, ClassH, Ear, Aux PA, 2xHPH,
7 x TX diff inputs, 8 DMICs and MBHC.

Eventhough this device has two SoundWire devices, only tx device has
access to main codec Control/Status Registers!

For codec driver to be functional it would need both tx and rx Soundwire devices
to be up and this is taken care by using device component framework and device-links
are used to ensure proper pm dependencies. Ex tx does not enter suspend
before rx or codec is suspended.

This patchset along with other SoundWire patches on the list
have been tested on SM8250 MTP device.

Thanks,
srini

Changes since v8:
 - moved Kconfig and Makefile changes to last patch as suggested by Mark
 - removed array of enums and used static entries instead. Suggested by Mark
 - return true if put succeeds, Suggested by Mark
 - removed some unneeded semi-colons in switch

Srinivas Kandagatla (9):
  ASoC: dt-bindings: wcd938x: add bindings for wcd938x
  ASoC: codecs: wcd-clsh: add new version support
  ASoC: codecs: wcd938x: add basic driver
  ASoC: dt-bindings: wcd938x-sdw: add bindings for wcd938x-sdw
  ASoC: codecs: wcd938x-sdw: add SoundWire driver
  ASoC: codecs: wcd938x: add basic controls
  ASoC: codecs: wcd938x: add playback dapm widgets
  ASoC: codecs: wcd938x: add capture dapm widgets
  ASoC: codecs: wcd938x: add audio routing and Kconfig

 .../bindings/sound/qcom,wcd938x-sdw.yaml      |   70 +
 .../bindings/sound/qcom,wcd938x.yaml          |  146 +
 sound/soc/codecs/Kconfig                      |   14 +
 sound/soc/codecs/Makefile                     |    4 +
 sound/soc/codecs/wcd-clsh-v2.c                |  348 +-
 sound/soc/codecs/wcd-clsh-v2.h                |   16 +
 sound/soc/codecs/wcd938x-sdw.c                |  315 ++
 sound/soc/codecs/wcd938x.c                    | 3753 +++++++++++++++++
 sound/soc/codecs/wcd938x.h                    |  720 ++++
 9 files changed, 5376 insertions(+), 10 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,wcd938x-sdw.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,wcd938x.yaml
 create mode 100644 sound/soc/codecs/wcd938x-sdw.c
 create mode 100644 sound/soc/codecs/wcd938x.c
 create mode 100644 sound/soc/codecs/wcd938x.h

--
2.21.0
2021-06-14 14:58:52 +01:00
Srinivas Kandagatla
0454422288
ASoC: codecs: wcd938x: add audio routing and Kconfig
This patch adds audio routing for both playback and capture and
Makefile and Kconfigs changes for wcd938x

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210609090943.7896-10-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:43 +01:00
Srinivas Kandagatla
d5add08fcb
ASoC: codecs: wcd938x: add capture dapm widgets
This patch adds required dapm widgets for capture path.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210609090943.7896-9-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:42 +01:00
Srinivas Kandagatla
8da9db0cd6
ASoC: codecs: wcd938x: add playback dapm widgets
This patch adds required dapm widgets for playback.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210609090943.7896-8-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:41 +01:00
Srinivas Kandagatla
e8ba1e05bd
ASoC: codecs: wcd938x: add basic controls
This patch adds basic controls found in wcd938x codec.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210609090943.7896-7-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:40 +01:00
Srinivas Kandagatla
16572522ae
ASoC: codecs: wcd938x-sdw: add SoundWire driver
This patch adds support to SoundWire devices on WCD9380/WCD9385 Codec

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210609090943.7896-6-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:39 +01:00
Srinivas Kandagatla
8d78602aa8
ASoC: codecs: wcd938x: add basic driver
This patch adds basic SoundWire codec driver to support for
WCD938X TX and RX devices.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210609090943.7896-4-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:37 +01:00
Srinivas Kandagatla
19c5d1f6a0
ASoC: codecs: wcd-clsh: add new version support
From WCD937X Class H controller has changed significantly, so add support
to this new version for WCD937X and WCD938X Codecs.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210609090943.7896-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:36 +01:00
Yang Li
03c0cbd946
ASoC: codecs: wcd: Remove unneeded semicolon
Eliminate the following coccicheck warning:
./sound/soc/codecs/wcd-mbhc-v2.c:990:2-3: Unneeded semicolon.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/1623221171-105359-1-git-send-email-yang.lee@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:23 +01:00
Srinivasa Rao Mandadapu
da0363f7bf
ASoC: qcom: Fix for DMA interrupt clear reg overwriting
The DMA interrupt clear register overwritten during
simultaneous playback and capture in lpass platform
interrupt handler. It's causing playback or capture stuck
in similtaneous plaback on speaker and capture on dmic test.
Update appropriate reg fields of corresponding channel instead
of entire register write.

Fixes: commit c5c8635a04 ("ASoC: qcom: Add LPASS platform driver")

Signed-off-by: Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210609072310.26099-1-srivasam@codeaurora.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-14 11:14:22 +01:00
Mark Brown
116b1e12b7 Improvements to the hdmi-codec driver and ALSA infrastructure around it
to support the HDMI Channel Mapping and IEC958 controls
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYMHitQAKCRDj7w1vZxhR
 xQ40AP49z0mUifkpbyUvYwdmrUVlg2JEWSTOWaH3tp0kke/dBQEA1vYxdMimhFu3
 SYKXxgtvlT7vL48vNYBxGbNuGQvzJw4=
 =IWna
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmDHK+QACgkQJNaLcl1U
 h9DGHAf/ZhveHulV/2ysiFroyNxcp0PLT49/I/2AAyPhglREmbrXhWCALLcVf0ur
 UqN2OlvdaiiozXHqsLrm5i1qKvz86659FPv8kEBpLyOgvCpsOu+HnjYk+EEJ2nDf
 u8YDbXc5HZQ6bLD2cz/KRKPs7HlTtzq5yCn1tPsaNvcnOQ3/XnyeDo7XegIiah46
 ts3mnOHTvYDujMehxIxMW0oe29pz6qibHynG4iNiEkVw0ZlBvHC4d0MWunSP8GpV
 wrHt62K0xgrI5UU4ilpIXozUiFZGiFm9grPwZ6sXFGEvtSVLRUJebnCGe5ccgXQ5
 4iNE9EClQHYZZm/vYpB4YxTPis1+bQ==
 =k79R
 -----END PGP SIGNATURE-----

Merge tag 'asoc-hdmi-codec-improvements-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/mripard/linux into asoc-5.14

Improvements to the hdmi-codec driver and ALSA infrastructure around it
to support the HDMI Channel Mapping and IEC958 controls
2021-06-14 11:13:53 +01:00
Maxime Ripard
2fef64eec2
ASoC: hdmi-codec: Add a prepare hook
The IEC958 status bit is usually set by the userspace after hw_params
has been called, so in order to use whatever is set by the userspace, we
need to implement the prepare hook. Let's add it to the hdmi_codec_ops,
and mandate that either prepare or hw_params is implemented.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-6-maxime@cerno.tech
2021-06-10 11:48:56 +02:00
Maxime Ripard
7a8e1d4421
ASoC: hdmi-codec: Add iec958 controls
The IEC958 status bits can be exposed and modified by the userspace
through dedicated ALSA controls.

This patch implements those controls for the hdmi-codec driver. It
relies on a default value being setup at probe time that can later be
overridden by the control put.

The hw_params callback is then called with a buffer filled with the
proper bits for the current parameters being passed on so the underlying
driver can just reuse those bits as is.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-5-maxime@cerno.tech
2021-06-10 11:48:49 +02:00
Maxime Ripard
366b45b974
ASoC: hdmi-codec: Rework to support more controls
We're going to add more controls to support the IEC958 output, so let's
rework the control registration a bit to support more of them.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20210525132354.297468-4-maxime@cerno.tech
2021-06-08 17:05:47 +02:00
Wan Jiabing
3ea8a74598
ASoC: remove unneeded semicolons in wcd934x.c
Fix following coccicheck warning:
./sound/soc/codecs/wcd934x.c:5136:2-3: Unneeded semicolon
./sound/soc/codecs/wcd934x.c:2466:2-3: Unneeded semicolon
./sound/soc/codecs/wcd934x.c:2527:2-3: Unneeded semicolon

Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20210608030656.24052-1-wanjiabing@vivo.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-08 13:36:48 +01:00
Kuninori Morimoto
640eac4c84
ASoC: soc-core: don't use discriminatory terms on snd_soc_runtime_get_dai_fmt()
snd_soc_runtime_get_dai_fmt() is using discriminatory terms.
This patch fixup it.

Fixes: ba9e82a1c8 ("ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874ke9dxkp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-08 13:36:47 +01:00
Christophe JAILLET
b6052c3c7a
ASoC: mediatek: mtk-btcvsd: Fix an error handling path in 'mtk_btcvsd_snd_probe()'
If an error occurs after a successful 'of_iomap()' call, it must be undone
by a corresponding 'iounmap()' call, as already done in the remove
function.

While at it, remove the useless initialization of 'ret' at the beginning of
the function.

Fixes: 4bd8597dc3 ("ASoC: mediatek: add btcvsd driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/0c2ba562c3364e61bfbd5b3013a99dfa0d9045d7.1622989685.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-08 13:36:46 +01:00
Mark Brown
d08c5b76b2
Merge series "ASoC: adds new .auto_selectable_formats support" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

These are v3 of "ASoC: adds new .get_fmt support",
but renamed Subject.

This is a little bit challenging patch-set.
The idea/code is almost same as v1 / v2.
v3 has "priority" support.

We need to set dai_link->dai_fmt to select CPU/Codec settings,
and it is selected by Sound Card Driver, today.

Because of it, Sound Card user need to know both CPU / Codec
available dai_fmt, and needs to select it.
For example simple-card / audio-graph case, it is selected by
"format" and "bitclock/frame-master/inversion" on DT.

But, it can be automatically selected if both CPU and Codec drivers
indicate it to ALSA SoC Framework, somehow.

By this patch, dai_fmt can be automatically selected from each
driver if both CPU / Codec driver had .auto_selectable_formats.
Automatically selectable *field* is depends on each drivers.

For example, some driver want to select format "automatically",
but want to select other fields "manually", because of complex limitation.
Or other example, in case of both CPU and Codec are possible to be
clock provider, but the quality was different.
In these case, user need/want to *manually* select each fields
from Sound Card driver.

It uses Sound Card specified fields preferentially, and try to select
non-specific fields from CPU and Codec driver settings if driver had
.auto_selectable_formats.
In other words, we can select all dai_fmt via Sound Card driver
same as before.

Select dai_fmt 100% automatically is very difficult and will be very complex,
but select automatically some fields only is very easy, I guess.
This patch-set is based on such assumption.

v1 -> v2
	- Add more detail explanation on git-log, code, comment.
	- Possible to be Clock/Frame provider is depends on driver's situation.

v2 -> v3
	- has priority
	- tidyup function explanation for snd_soc_dai_get_fmt()
	- Each driver don't try to have SND_SOC_DAIFMT_CBx_CFx to avoid confusion

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com

Kuninori Morimoto (7):
  ASoC: soc-core: move snd_soc_runtime_set_dai_fmt() to upside
  ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()
  ASoC: ak4613: add .auto_selectable_formats support
  ASoC: pcm3168a: add .auto_selectable_formats support
  ASoC: rsnd: add .auto_selectable_formats support
  ASoC: fsi: add .auto_selectable_formats support
  ASoC: hdmi-codec: add .auto_selectable_formats support

 include/sound/soc-dai.h       |  55 +++++++
 sound/soc/codecs/ak4613.c     |  11 ++
 sound/soc/codecs/hdmi-codec.c |  21 +++
 sound/soc/codecs/pcm3168a.c   |  26 +++
 sound/soc/sh/fsi.c            |  15 ++
 sound/soc/sh/rcar/core.c      |  31 +++-
 sound/soc/soc-core.c          | 288 ++++++++++++++++++++++++++--------
 sound/soc/soc-dai.c           |  63 ++++++++
 sound/soc/soc-utils.c         |  29 ++++
 9 files changed, 475 insertions(+), 64 deletions(-)

--
2.25.1
2021-06-07 19:53:01 +01:00
Colin Ian King
d50b86b3f6
ASoC: rk817: remove redundant assignment to pointer node, add missing of_node_put
The pointer node is being initialized with a value that is never read and
it is being updated later with a new value.  The initialization is
redundant and can be removed.

The function is missing a of_node_put on node, fix this by adding the call
before returning.

Addresses-Coverity: ("Unused value")
Fixes: 0d6a04da9b ("ASoC: Add Rockchip rk817 audio CODEC support")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Tested-by: Chris Morgan <macromorgan@hotmail.com>
Link: https://lore.kernel.org/r/20210603113659.82031-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 16:20:03 +01:00
Jiapeng Chong
54f6731394
ASoC: rk817: Remove unneeded semicolon
Fix the following coccicheck warnings:

./sound/soc/codecs/rk817_codec.c:49:2-3: Unneeded semicolon.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/1622802209-45031-1-git-send-email-jiapeng.chong@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 16:20:02 +01:00
Mark Brown
b9de77d0bc Immutable branch between MFD and ASoC due for the v5.14 merge window
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmC3UjQACgkQUa+KL4f8
 d2FOXRAArFhjSte5NR6lSI46znDRXVGTsw9VXfJO/7K8uFnHM1aSU0ViyVmtGqba
 z6QHazztq9J0EP99Q8Ikgk4vrlUEpnAut9pS5qjfvrTTl3e7YHhJ+Gl+Z7Vhyo47
 AlrzfXAO0lFsH/96vFPuPv3mlXBW/bDuI/vL05uMp9vV+VGYqh9f9nO1P6LxD40w
 bmxHNeqJ8fooc/w0ZU7wLfUL2orSkwN2kFoBBDHUndUXu7lmeBq50XfX4h/kPN7Y
 33GiRRN3OdJ8qG46cAhoj5Xu88bh8Wp1SvqI32gAkFYfwYHMBFUIqwd847UAnUCq
 xxQNLJ97zzwO6Qh9Aldu3EFrOqN1SFUIPO337DIeHet1gwS7EdDXM6JxTUKOWHV5
 ICQOYbvB0U/0Pdp2khSGaYF4djs0Hc6p3JRNmBcttfzAbEL9uxvCZSgVQF1sr/Eu
 kr08mHomj8AQgqoT0RoZkACB3a4K1yczjj6zj9Kp9f1r2p7zppFrSXHCNSGG6w3h
 EQcXjBfsMcDs2HiH7Xd/ZHV5LXu4cdqOPPnQelPKLOfvDMhBv7yhtSkhS8oynT07
 Pkd/bQ6cAURRjhNszS8B36Nh6TL8DHYXRob8pA7v1lWz9QNRpIxPxEwBNKiDrPoR
 Rhako+wV6+6bA7UpLU7whYmh7T41rQ18lWU6ccnMjxdsetWICS0=
 =bG7Q
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmC+OL0ACgkQJNaLcl1U
 h9AnAAf/RfUSaZtJYG5stsBRYf9AYxkGfbSTtfI1xjAtdt5uwCZd+RHvkBVJ1tXu
 gVayIfnEQQ7f+rWWPkpAsxd7/e42Myi3PIBMu5vMWBQZhlnvOm4cehN7gUxlVXH0
 OlTdsZzpc4UJfysqxI8gcVzFrIMprFaB7K9glUurY949sdIb7VjFWCJdXX4FIYTo
 0htYoo2LAXtCIIabEyiwcIeP3feQkBcnzcQeT0GaLYkjtD3b0vuGJ061bwCfxDC/
 ZlvbgtfxSiqrj8eLwjJq6zUNWV2dj74dAWQhZlEsS8h94ROsObH/h7e7dQfT6kuv
 E0MgIZk/PRoglRNr26KF1Q1tBsA3UQ==
 =O8/h
 -----END PGP SIGNATURE-----

Merge tag 'tb-mfd-asoc-v5.14-1' of https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into asoc-5.14

Immutable branch between MFD and ASoC due for the v5.14 merge window
2021-06-07 16:18:18 +01:00
Kuninori Morimoto
68d8b7ba36
ASoC: hdmi-codec: add .auto_selectable_formats support
By this patch, DAI format might be automatically selected
(Depends on paired DAI).

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87a6ognc5i.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:17 +01:00
Kuninori Morimoto
af69f47df1
ASoC: fsi: add .auto_selectable_formats support
By this patch, DAI format might be automatically selected
(Depends on paired DAI).

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87bl8wnc5x.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:16 +01:00
Kuninori Morimoto
0292176522
ASoC: rsnd: add .auto_selectable_formats support
By this patch, DAI format might be automatically selected
(Depends on paired DAI).

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87cztcnc6k.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:15 +01:00
Kuninori Morimoto
bea63e8bbe
ASoC: pcm3168a: add .auto_selectable_formats support
By this patch, DAI format might be automatically selected
(Depends on paired DAI).

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87eedsnc6z.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:14 +01:00
Kuninori Morimoto
c50f381afc
ASoC: ak4613: add .auto_selectable_formats support
By this patch, DAI format might be automatically selected
(Depends on paired DAI).

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87fsy8nc7o.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:13 +01:00
Kuninori Morimoto
ba9e82a1c8
ASoC: soc-core: add snd_soc_runtime_get_dai_fmt()
ASoC is using dai_link which specify DAI format (= dai_link->dai_fmt),
and it is selected by "Sound Card" driver in corrent implementation.
In other words, Sound Card *needs* to setup it.
But, it should be possible to automatically selected from CPU and
Codec driver settings.

This patch adds new .auto_selectable_formats support
at snd_soc_dai_ops.

By this patch, dai_fmt can be automatically selected from each
driver if both CPU / Codec driver had it.
Automatically selectable *field* is depends on each drivers.

For example, some driver want to select format "automatically",
but want to select other fields "manually", because of complex limitation.
Or other example, in case of both CPU and Codec are possible to be
clock provider, but the quality was different.
In these case, user need/want to *manually* select each fields
from Sound Card driver.

This .auto_selectable_formats can set priority.
For example, no limitaion format can be HI priority,
supported but has picky limitation format can be next priority, etc.

It uses Sound Card specified fields preferentially, and try to select
non-specific fields from CPU and Codec driver automatically
if all drivers have .auto_selectable_formats.

In other words, we can select all dai_fmt via Sound Card driver
same as before.

Link: https://lore.kernel.org/r/871rb3hypy.wl-kuninori.morimoto.gx@renesas.com
Link: https://lore.kernel.org/r/871racbx0w.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7ionc8s.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:12 +01:00
Kuninori Morimoto
4d1a98b5f1
ASoC: soc-core: move snd_soc_runtime_set_dai_fmt() to upside
This patch moves snd_soc_runtime_set_dai_fmt() to upside.
This is prepare to support snd_soc_runtime_get_dai_fmt().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87im34nc9r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-07 15:55:11 +01:00
Mark Brown
ffb2df66ba
Merge series "ASoC: codecs: wcd934x: add Headset and button detection support" from Srinivas Kandagatla <srinivas.kandagatla@linaro.org>:
This patchset adds support to MBHC(Multi Button Headset Control) block found in
Qualcomm WCD codecs. MBHC support headset type detection, both Mechanical and
electrical insert/removal detection along with 8 buttons detection,
Over current interrupts on HPHL/R, Impedance Measurements on HPHL/R.

Eventhough MBHC block supports things like OverCurrent detection, Currently its
reported as a kernel debug message. Should this be reported as an uevent to
userspace? like the way USB reports?
Any suggestions?

First patch adds a common mbhc driver and the second one wcd934x specific driver
changes along with sdm845 soundcard related changes.

Common wcd-mbhc-v2 driver should be reusable across multiple codecs like
WCD9335, WCD934x, WCD937x and WCD938x.

Most of the work is derived from downstream Qualcomm kernels.
Credits to various Qualcomm authors from Patrick Lai's team who have
contributed to this code.

Changes since v2:
- switched to EXPORT_SYMBOL_GPL from EXPORT_SYMBOL
- converted one of the if else to switch case.

Srinivas Kandagatla (4):
  ASoC: dt-bindings: wcd934x: add bindings for Headset Button detection
  ASoC: codecs: wcd: add multi button Headset detection support
  ASoC: codecs: wcd934x: add mbhc support
  ASoC: qcom: sdm845: add jack support for WCD934x

 .../bindings/sound/qcom,wcd934x.yaml          |   30 +
 include/linux/mfd/wcd934x/registers.h         |   57 +
 sound/soc/codecs/Kconfig                      |    4 +
 sound/soc/codecs/Makefile                     |    2 +
 sound/soc/codecs/wcd-mbhc-v2.c                | 1475 +++++++++++++++++
 sound/soc/codecs/wcd-mbhc-v2.h                |  340 ++++
 sound/soc/codecs/wcd934x.c                    |  884 +++++++++-
 sound/soc/qcom/sdm845.c                       |    8 +
 8 files changed, 2785 insertions(+), 15 deletions(-)
 create mode 100644 sound/soc/codecs/wcd-mbhc-v2.c
 create mode 100644 sound/soc/codecs/wcd-mbhc-v2.h

--
2.21.0
2021-06-04 17:26:54 +01:00
Srinivas Kandagatla
c15d4b7209
ASoC: qcom: sdm845: add jack support for WCD934x
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210604115230.23259-5-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-04 15:29:02 +01:00
Srinivas Kandagatla
9fb9b1690f
ASoC: codecs: wcd934x: add mbhc support
WCD934x has Multi Button Headset Control hardware to support Headset insertion,
type detection, 8 headset buttons detection, Over Current detection and Impedence
measurements.

This patch adds support for this feature via common mbhc layer.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210604115230.23259-4-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-04 15:29:01 +01:00
Srinivas Kandagatla
0e5c9e7ff8
ASoC: codecs: wcd: add multi button Headset detection support
Most new Qualcomm WCD codecs support MBHC(Multi Button Headset Control) via ADC.

This patchset adds support to Common parts of this MBHC support so that
WCD codecs need not duplicate them. To do that codec exposes set of
register fields and callbacks to this common driver to control it.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20210604115230.23259-3-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-04 15:29:00 +01:00
Bertrand Jacquin
e78f36bc13
ASoC: snd-soc-lpass requires REGMAP_MMIO
With CONFIG_SND_SOC_LPASS_RX_MACRO=m and CONFIG_REGMAP_MMIO undefined,
build fails with the following error

  make -f /var/tmp/portage/sys-kernel/stable-sources-5.12.8/work/linux-5.12.8-stable/scripts/Makefile.modpost
    sed 's/\.ko$/\.o/' modules.order | scripts/mod/modpost   -E  -o modules-only.symvers -i vmlinux.symvers   -T -
  ERROR: modpost: "__devm_regmap_init_mmio_clk" [sound/soc/codecs/snd-soc-lpass-rx-macro.ko] undefined!

This does also apply to other Qualcomm Macro LPASS all making call to
devm_regmap_init_mmio()

Signed-off-by: Bertrand Jacquin <bertrand@jacquin.bzh>
Link: https://lore.kernel.org/r/20210603221816.2642402-1-bertrand@jacquin.bzh
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-04 15:27:08 +01:00
Gustavo A. R. Silva
50d790012a
ASoC: ti: davinci-mcasp: Fix fall-through warning for Clang
In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning
by explicitly adding a fallthrough; statement.

Link: https://github.com/KSPP/linux/issues/115
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Acked-by: Peter Ujfalusi <peter.ujflausi@gmail.com>
Link: https://lore.kernel.org/r/20210604072714.GA244640@embeddedor
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-04 15:27:07 +01:00
Mark Brown
f3b3bceb85
Merge series "ASoC: rsnd: tidyup adg and header" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
Hi Mark

I noticed that adg can be more clean code.
And rsnd.h header comment was not so good
because patch has been randomly added.

This patch tidyup these.

Kuninori Morimoto (5):
  ASoC: rsnd: adg: supply __printf(x, y) formatting for dbg_msg()
  ASoC: rsnd: adg: tidyup rsnd_adg_get_clkin/out() parameter
  ASoC: rsnd: adg: use more simple method for null_clk
  ASoC: rsnd: adg: check return value for rsnd_adg_get_clkin/out()
  ASoC: rsnd: tidyup __rsnd_mod_xxx macro comments

 sound/soc/sh/rcar/adg.c  | 139 +++++++++++++++++++++++++--------------
 sound/soc/sh/rcar/rsnd.h |  21 ++----
 2 files changed, 97 insertions(+), 63 deletions(-)

--
2.25.1
2021-06-03 19:36:04 +01:00
Yufen Yu
81aad47278
ASoC: img: Fix PM reference leak in img_i2s_in_probe()
pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by replacing it with pm_runtime_resume_and_get to keep usage
counter balanced.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Link: https://lore.kernel.org/r/20210524093521.612176-1-yuyufen@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 14:00:01 +01:00
Yang Yingliang
28b170110a
ASoC: fsl: imx-es8328: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210602133359.310647-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 14:00:00 +01:00
Colin Ian King
d66e033910
ASoC: rsnd: check for zero node count
Most callers of_get_child_count() check that "nr" is non-zero so it
causes a static checker warning when we don't do that here.  This
does not cause a problem or a crash, but having zero SSUIes does not
make sense either so let's add a check.

Addresses-Coverity: ("Unchecked return value")
Fixes: c413983eb6 ("ASoC: rsnd: adjust disabled module")
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210603110315.81146-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 13:59:59 +01:00
Yang Yingliang
b82d0759a3
ASoC: imx-audio-rpmsg: use module_rpmsg_driver to simplify the code
module_rpmsg_driver() makes the code simpler by eliminating
boilerplate code.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210602082610.3828408-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 13:59:57 +01:00
Yang Yingliang
6522a8486c
ASoC: atmel: sam9x5_wm8731: use devm_snd_soc_register_card()
Using devm_snd_soc_register_card() can make the code
shorter and cleaner.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20210602141619.323286-1-yangyingliang@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 13:59:56 +01:00
Kuninori Morimoto
3f4593fb4a
ASoC: rsnd: tidyup __rsnd_mod_xxx macro comments
status and __rsnd_mod_xxx were updated, but some related comments were
not. And it has verbose comments. This patch cleanup/tidyup these.

1) adds missing "D" to status sample
2) remove verbose list for "H"
3) add "needs protect" to __rsnd_mod_call_xxx

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87o8cpi1zs.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 13:56:42 +01:00
Kuninori Morimoto
d668a5e240
ASoC: rsnd: adg: check return value for rsnd_adg_get_clkin/out()
Current rsnd_adg_get_clkin/out() are void function,
thus adg->clk/clkout[i] might be NULL.

But, for_each_rsnd_clk/clkout() macros are assuming
all clks are non NULL.

Because of this mismatch, code can be complex and/or buggy.
These functions return error by this patch,
and make sure all clks are non NULL.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87pmx5i20m.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 13:56:41 +01:00
Kuninori Morimoto
cb2f97d89f
ASoC: rsnd: adg: use more simple method for null_clk
commit 965386c976 ("ASoC: rsnd: call unregister for null_hw when
removed") tried unregister null_clk, but it has some issues.

1st issue is kernel will indicate below message when unregistering,
because of its timing. unregistering should be happen after clk_disable().

	clk_unregister: unregistering prepared clock: rsnd_adg_null

2nd issue is, it is using priv->null_clk, but it should be adg->null_clk.

3rd issue is it is using very complex clk registering method.
more simple clk_register/unregister_fixed_rate() should be OK.

This patch fixes these.

Fixes: 965386c976 ("ASoC: rsnd: call unregister for null_hw when removed")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r1hli215.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 13:56:40 +01:00
Kuninori Morimoto
b48e4aa489
ASoC: rsnd: adg: tidyup rsnd_adg_get_clkin/out() parameter
set priv->adg before rsnd_adg_get_clkin/out() to be more simple code.
Nothing is changed, but is preparation for
next "ASoC: rsnd: adg: use more simple method for null_clk" patch

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87sg21i21j.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 13:56:39 +01:00
Kuninori Morimoto
2cdfe6520c
ASoC: rsnd: adg: supply __printf(x, y) formatting for dbg_msg()
Fixes the following W=1 kernel build warning(s):

sound/soc/sh/rcar/adg.c: In function 'dbg_msg':
sound/soc/sh/rcar/adg.c:594:2: warning: function 'dbg_msg' might \
 be a candidate for 'gnu_printf' format attribute\
 [-Wsuggest-attribute=format]

Fixes: 1f9c82b5ab ("ASoC: rsnd: add debugfs support")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tumhi21r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-03 13:56:38 +01:00
YueHaibing
ae624a38be
ASoC: Intel: Skylake: use DEVICE_ATTR_RO macro
Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(),
which makes the code a bit shorter and easier to read.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20210524115506.35724-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-02 12:03:33 +01:00
Vincent Knecht
8e5607e994
ASoC: codecs: tfa989x: Add support for optional vddd-supply
Allow specifying Vddd regulator/supply to be enabled on I2C probing.

Signed-off-by: Vincent Knecht <vincent.knecht@mailoo.org>
Reviewed-by: Stephan Gerhold <stephan@gerhold.net>
Link: https://lore.kernel.org/r/20210528105101.508254-4-vincent.knecht@mailoo.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-02 12:03:32 +01:00