This patch adds snd_soc_daifmt_clock_provider_from_bitmap() function
to judge clock/frame master from its bitmap.
This is prepare for snd_soc_of_parse_daifmt() cleanup.
The snd_soc_dai_ops structures is only stored in the ops field of a
snd_soc_dai_driver structure, so make the snd_soc_dai_ops structure
const to allow the compiler to put it in read-only memory.
Mark Brown [Thu, 17 Jun 2021 14:27:24 +0000 (15:27 +0100)]
Merge series "ASoC: stm32: Use devm_platform_get_and_ioremap_resource()" from Yang Yingliang <yangyingliang@huawei.com>:
Use devm_platform_get_and_ioremap_resource() to simplify
code.
Yang Yingliang (3):
ASoC: stm32: i2s: Use devm_platform_get_and_ioremap_resource()
ASoC: stm32: sai: Use devm_platform_get_and_ioremap_resource()
ASoC: stm32: spdifrx: Use devm_platform_get_and_ioremap_resource()
Return statements in functions returning bool should use true/false
instead of 1/0.
Fix the following coccicheck warning:
./sound/soc/codecs/wcd938x.c:1190:9-10: WARNING: return of 0/1 in
function 'wcd938x_volatile_register' with return type bool.
Mark Brown [Tue, 15 Jun 2021 17:16:31 +0000 (18:16 +0100)]
Merge series "ASoC: qdsp6: Add Quinary MI2S ports support" from Gabriel David <ultracoolguy@disroot.org>:
Various devices(such as the Motorola Moto G7 Power, codename ocean) use
the Quinary MI2S ports for reproducing audio. Add support to them in
kernel.
Signed-off-by: Gabriel David <ultracoolguy@disroot.org>
Gabriel David (4):
ASoC: q6afe: dt-bindings: Add QUIN_MI2S_RX/TX
ASoC: qdsp6: q6afe: Add Quinary MI2S ports
ASoC: qdsp6: q6afe-dai: Add Quinary MI2S ports
ASoC: qdsp6: q6routing: Add Quinary MI2S ports
include/dt-bindings/sound/qcom,q6afe.h | 2 ++
sound/soc/qcom/qdsp6/q6afe-dai.c | 41 ++++++++++++++++++++++++++
sound/soc/qcom/qdsp6/q6afe.c | 8 +++++
sound/soc/qcom/qdsp6/q6afe.h | 2 +-
sound/soc/qcom/qdsp6/q6routing.c | 11 +++++++
5 files changed, 63 insertions(+), 1 deletion(-)
---
As a warning, I'm currently the only tester of these patches. If that's
gonna be a problem then I understand.
The snd_soc_dai_ops structures is only stored in the ops field of a
snd_soc_dai_driver structure, so make the snd_soc_dai_ops structure
const to allow the compiler to put it in read-only memory.
Mark Brown [Tue, 15 Jun 2021 11:51:46 +0000 (12:51 +0100)]
Merge series "Unify NVIDIA Tegra ASoC machine drivers" from Dmitry Osipenko <digetx@gmail.com>:
This series squashes all the ASoC machine drivers into a single one,
this change was suggested by Jon Hunter. It also sets driver_name and
components string of each card, allowing userspace alsa-lib to find
UCMs at predictable path.
Changelog:
v6: - Fixed missed configuration of AC97 clock rate for the WM9712 codec
in the unified driver.
- Added new patch that removes now obsolete "utils" helpers and moves
code into the unified driver.
ASoC: tegra: Squash utils into common machine driver
v5: - The v4 removed the customization of components string for Nexus 7,
but I missed to remove the "components" hook which is unused now,
it's removed in v5 for consistency.
- Slightly improved naming of the common 12MHz MCLK rate function
to make it more consistent with the rest of the driver functions.
v4: - Moved out mclk_rate callback that is currently used only by WM8903
machine driver from the common driver. This was suggested by Jon Hunter.
- Dropped patch which was setting custom components string for Nexus 7.
Jaroslav Kysela wants it to be specified in a device-tree, but the
components string doesn't have a firm specification for today. It's
better to drop this change for now since it's optional anyways.
- Fixed compilation error that was reported by kernel robot for v3.
- Jaroslav Kysela merged alsa-ucm-conf PR [1] which added UCMs for
Nexus 7 and Acer A500. The UCMs are fully working using a combination
of updated kernel + alsa-ucm-conf master + alsa-lib master, meaning
that they will work with the next releases of kernel and ALSA userspace
upstream packages.
- Added ack from Jaroslav Kysela to the "Specify components string for
each card" patch that he gave to v3.
v3: - Added components string as was suggested by Jaroslav Kysela to v2.
- Renamed MCLK rate function that is used by max98090 and other codecs
to make it look more generic. Added option for specifying CLK ID per
device. This all was suggested by Jon Hunter to v2.
v2: - Dropped use of of_device_compatible_match(), like it was suggested
by Rob Herring in a review comment to v1.
- Added patch that sets card's driver_name of as Tegra ASoC drivers.
In a comment to v1 Jaroslav Kysela suggested that the Tegra drivers
don't set the card name properly and he was right.
I opened pull request with the new Tegra UCMs and updated lookup paths
for older UCMs [1].
Dmitry Osipenko (4):
ASoC: tegra: Set driver_name=tegra for all machine drivers
ASoC: tegra: Unify ASoC machine drivers
ASoC: tegra: Specify components string for each card
ASoC: tegra: Squash utils into common machine driver
Dmitry Osipenko [Sat, 29 May 2021 15:46:48 +0000 (18:46 +0300)]
ASoC: tegra: Specify components string for each card
Specify components string for each card of each supported device. It's
a free form string that describes audio hardware configuration. This
information is useful for ALSA UCM rules. It allows to generalize UCM
rules, potentially removing a need to add new UCM rule for each device.
Dmitry Osipenko [Sat, 29 May 2021 15:46:47 +0000 (18:46 +0300)]
ASoC: tegra: Unify ASoC machine drivers
Squash all machine drivers into a single-universal one. This reduces
code duplication, eases addition of a new drivers and upgrades older
code to a modern Linux kernel APIs.
Suggested-by: Jonathan Hunter <jonathanh@nvidia.com> Co-developed-by: Ion Agorria <ion@agorria.com> Signed-off-by: Ion Agorria <ion@agorria.com> Co-developed-by: Svyatoslav Ryhel <clamor95@gmail.com> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Link: https://lore.kernel.org/r/20210529154649.25936-3-digetx@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
Dmitry Osipenko [Sat, 29 May 2021 15:46:46 +0000 (18:46 +0300)]
ASoC: tegra: Set driver_name=tegra for all machine drivers
The driver_name="tegra" is now required by the newer ALSA UCMs, otherwise
Tegra UCMs don't match by the path/name.
All Tegra machine drivers are specifying the card's name, but it has no
effect if model name is specified in the device-tree since it overrides
the card's name. We need to set the driver_name to "tegra" in order to
get a usable lookup path for the updated ALSA UCMs. The new UCM lookup
path has a form of driver_name/card_name.
The old lookup paths that are based on driver module name continue to
work as before. Note that UCM matching never worked for Tegra ASoC drivers
if they were compiled as built-in, this is fixed by supporting the new
naming scheme.
ASoC: qcom: Add four speaker support on MI2S secondary
Add four speaker support on MI2S secondary block
by using I2S SD1 line on gpio52 pin, and add channel map
control support in the lpass-cpu audio driver.
The Realtek rt5640 codec driver can be used with the generic sound card
drivers, so it should be selectable. For example, with the addition
of #sound-dai-cells = <0> property in DT, it can be used with simple and
graph card drivers.
Tan Zhongjun [Thu, 10 Jun 2021 12:50:52 +0000 (20:50 +0800)]
ASoC: fsl_easrc: Remove superfluous error message around platform_get_irq()
Clean up the check for irq.dev_err is superfluous as platform_get_irq()
already prints an error.Remove curly braces to confirm to styling
requirements.
Jaroslav Kysela [Mon, 14 Jun 2021 07:17:46 +0000 (09:17 +0200)]
ASoC: soc-pcm: fix the return value in dpcm_apply_symmetry()
In case, where the loops are not executed for a reason, the uninitialized
variable 'err' is returned to the caller. Make code fully predictible
and assign zero in the declaration.
Mark Brown [Mon, 14 Jun 2021 13:58:52 +0000 (14:58 +0100)]
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
ASoC: dt-bindings: wcd938x-sdw: add bindings for wcd938x-sdw
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. This bindings is for those slave devices on WCD9380/WCD9385.
ASoC: dt-bindings: wcd938x: add bindings for wcd938x
Qualcomm WCD9380/WCD9385 Codec is a standalone Hi-Fi audio codec IC
connected over SoundWire. This device has two SoundWire device RX and
TX respectively, supporting 4 x ADCs, ClassH, Ear, Aux PA, 2xHPH,
7 x TX diff inputs, 8 DMICs, MBHC.
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.
Maxime Ripard [Tue, 25 May 2021 13:23:47 +0000 (15:23 +0200)]
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.
Maxime Ripard [Tue, 25 May 2021 13:23:46 +0000 (15:23 +0200)]
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.
Maxime Ripard [Tue, 25 May 2021 13:23:44 +0000 (15:23 +0200)]
ALSA: iec958: Split status creation and fill
In some situations, like a codec probe, we need to provide an IEC status
default but don't have access to the sampling rate and width yet since
no stream has been configured yet.
Each and every driver has its own default, whereas the core iec958 code
also has some buried in the snd_pcm_create_iec958_consumer functions.
Let's split these functions in two to provide a default that doesn't
rely on the sampling rate and width, and another function to fill them
when available.
Maxime Ripard [Tue, 25 May 2021 13:23:43 +0000 (15:23 +0200)]
ALSA: doc: Clarify IEC958 controls iface
The doc currently mentions that the IEC958 Playback Default should be
exposed on the PCM iface, and the Playback Mask on the mixer iface.
It's a bit confusing to advise to have two related controls on two
separate ifaces, and it looks like the drivers that currently expose
those controls use any combination of the mixer and PCM ifaces.
Let's try to clarify the situation a bit, and encourage to at least have
the controls on the same iface.
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.
Mark Brown [Mon, 7 Jun 2021 18:53:01 +0000 (19:53 +0100)]
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
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: 0d6a04da9b25 ("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>
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.
Mark Brown [Fri, 4 Jun 2021 16:26:54 +0000 (17:26 +0100)]
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
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.
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.
ASoC: dt-bindings: wcd934x: add bindings for Headset Button detection
Add bindings required for Multi Button Headset detection.
WCD934x support Headsets with upto 8 buttons including, impedance measurement
on both L/R Headset speakers and cross connection detection.
Yufen Yu [Mon, 24 May 2021 09:35:21 +0000 (05:35 -0400)]
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.
Colin Ian King [Thu, 3 Jun 2021 11:03:15 +0000 (12:03 +0100)]
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: c413983eb66a ("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>