platform/kernel/linux-rpi.git
2 years agoASoC: tda7419: use simple i2c probe function
Stephen Kitt [Tue, 5 Apr 2022 16:58:33 +0000 (18:58 +0200)]
ASoC: tda7419: use simple i2c probe function

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Link: https://lore.kernel.org/r/20220405165836.2165310-2-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: update to support either TAS2764 or TAS2780
Raphael-Xu [Fri, 8 Apr 2022 14:11:19 +0000 (22:11 +0800)]
ASoC: update to support either TAS2764 or TAS2780

update tas27xx.yaml to support either TAS2764 or TAS2780

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

rename tas2764.yaml to tas27xx.yaml

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

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

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

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

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

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

Pull in wm8731 fix.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

The headset microphone also works.

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

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

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

So, add a quirk for it.

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

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

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

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

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

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

Add support for that.

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

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

No functionality change.

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

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

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

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

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

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

The following log reveals it:

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

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

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

This patch corrects the endpoints for max98373 codec.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

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

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

This avoids scanning the identifier tables during probes.

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

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

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

wm8731.c is excluded and will be submitted separately.

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

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

This avoids scanning the identifier tables during probes.

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

Use temporary variable for struct device to make code neater.

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

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

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

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

base-commit: 3123109284176b1532874591f7c81f3837bbdc17

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

   bclk = sample_rate * N * W

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

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

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220405135419.1230088-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc.h: Add SOC_SINGLE_S_TLV() macro
Richard Fitzgerald [Tue, 5 Apr 2022 13:54:15 +0000 (14:54 +0100)]
ASoC: soc.h: Add SOC_SINGLE_S_TLV() macro

Add a convenience macro for defining a single (mono) TLV control
with a signed value. This can already be done by using
SOC_DOUBLE_R_S_TLV() with the same address for left and right
registers, but a dedicated macro is more readable.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220405135419.1230088-2-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rsnd: use inclusive language for DAIFMT mask
Kuninori Morimoto [Tue, 5 Apr 2022 00:34:54 +0000 (00:34 +0000)]
ASoC: rsnd: use inclusive language for DAIFMT mask

It is still using discriminatory terms on DAIFMT mask.
This patch tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ilropdu9.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: Fix missing of_node_put in mt2701_wm8960_machine_probe
Miaoqian Lin [Mon, 4 Apr 2022 09:35:25 +0000 (09:35 +0000)]
ASoC: mediatek: Fix missing of_node_put in mt2701_wm8960_machine_probe

This node pointer is returned by of_parse_phandle() with
refcount incremented in this function.
Calling of_node_put() to avoid the refcount leak.

Fixes: 8625c1dbd876 ("ASoC: mediatek: Add mt2701-wm8960 machine driver")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220404093526.30004-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: mediatek: Fix error handling in mt8173_max98090_dev_probe
Miaoqian Lin [Mon, 4 Apr 2022 09:29:01 +0000 (09:29 +0000)]
ASoC: mediatek: Fix error handling in mt8173_max98090_dev_probe

Call of_node_put(platform_node) to avoid refcount leak in
the error path.

Fixes: 94319ba10eca ("ASoC: mediatek: Use platform_of_node for machine drivers")
Fixes: 493433785df0 ("ASoC: mediatek: mt8173: fix device_node leak")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220404092903.26725-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: msm8916-wcd-digital: Check failure for devm_snd_soc_register_component
Miaoqian Lin [Sun, 3 Apr 2022 11:52:39 +0000 (11:52 +0000)]
ASoC: msm8916-wcd-digital: Check failure for devm_snd_soc_register_component

devm_snd_soc_register_component() may fails, we should check the error
and do the corresponding error handling.

Fixes: 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220403115239.30140-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rk817: Use devm_clk_get() in rk817_platform_probe
Miaoqian Lin [Mon, 4 Apr 2022 09:07:46 +0000 (09:07 +0000)]
ASoC: rk817: Use devm_clk_get() in rk817_platform_probe

We need to call clk_put() to undo clk_get() in the error path.
Use devm_clk_get() to obtain a reference to the clock, It has
the benefit that clk_put() is no longer required.

Fixes: 0d6a04da9b25 ("ASoC: Add Rockchip rk817 audio CODEC support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220404090753.17940-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Pull in fixes
Mark Brown [Tue, 5 Apr 2022 09:29:12 +0000 (10:29 +0100)]
ASoC: Pull in fixes

cs35l41 is getting some active work and conflicts, plus some of the
fixes are needed for my testing.

Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ASRC support on Tegra186 and later
Mark Brown [Tue, 5 Apr 2022 09:25:03 +0000 (10:25 +0100)]
ASoC: ASRC support on Tegra186 and later

Merge series from Sameer Pujar <spujar@nvidia.com>:

This series adds support for Asynchronous Sample Rate Converter (ASRC)
module on Tegra186 and later generations of SoCs. ASRC is a client of
AHUB. The driver and DT support is added to make it work with Tegra
audio graph card. The module can be plugged into audio path using ALSA
mixer controls.

ASRC supports two modes of operation, where it gets the ratio info
from SW and ratio detector module. Presently the support is added for
SW mode.

2 years agoASoC: topology: Cleanup patches
Mark Brown [Tue, 5 Apr 2022 09:25:02 +0000 (10:25 +0100)]
ASoC: topology: Cleanup patches

Merge series from Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>:

Following patches contain minor changes, cleaning up code to be easier
to read.  Clean up few loops, to be simpler or altogether remove them.
Rename some things to make code easier to understand.

2 years agoASoC: wm8731: Overhaul of the driver
Mark Brown [Tue, 5 Apr 2022 09:25:00 +0000 (10:25 +0100)]
ASoC: wm8731: Overhaul of the driver

Merge series from Mark Brown <broonie@kernel.org>:

This series contains a bunch of fairly minor changes which overhaul and
modernise the WM8731 driver, there should be no impact on the driver's
functionality.

2 years agoASoC: SOF: Miscellaneous fixes for IPC and trace
Mark Brown [Tue, 5 Apr 2022 09:24:59 +0000 (10:24 +0100)]
ASoC: SOF: Miscellaneous fixes for IPC and trace

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

This series includes some miscellaenous fixes pertaining to IPC, DMA
buffer and DMA trace.

2 years agoASoC: mediatek: Add support for MT8195 sound card with max98390 and rt5682
Mark Brown [Tue, 5 Apr 2022 09:24:57 +0000 (10:24 +0100)]
ASoC: mediatek: Add support for MT8195 sound card with max98390 and rt5682

Merge series from Trevor Wu <trevor.wu@mediatek.com>:

This series of patches adds support for mt8195 board with mt6359, max98390
and rt5682.  To prevent from copy-paste components, mt8195 machine
drivers and dt-bindings are merged in the patch.

2 years agoASoC: atmel: Fixes for AT91SAM9G20-EK audio driver
Mark Brown [Tue, 5 Apr 2022 09:24:56 +0000 (10:24 +0100)]
ASoC: atmel: Fixes for AT91SAM9G20-EK audio driver

Merge series from Mark Brown <broonie@kernel.org>:

At some point the machine driver for the audio subsystem on the
AT91SAM9G20-EK appears to have bitrotted, no longer probing due to
effects of the transition to the common clock framework. The first patch
in this series fixes the initial probe problem, with the rest of the
series being random other fixes and cleanups I noticed while looking at
the driver.

2 years agoASoC: cs35l41: Fix a shift-out-of-bounds warning found by UBSAN
Hui Wang [Thu, 24 Mar 2022 08:18:39 +0000 (16:18 +0800)]
ASoC: cs35l41: Fix a shift-out-of-bounds warning found by UBSAN

We enabled UBSAN in the ubuntu kernel, and the cs35l41 driver triggers
a warning calltrace like below:

cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: bitoffset= 8, word_offset=23, bit_sum mod 32=0, otp_map[i].size = 24
cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: bitoffset= 0, word_offset=24, bit_sum mod 32=24, otp_map[i].size = 0
================================================================================
UBSAN: shift-out-of-bounds in linux-kernel-src/sound/soc/codecs/cs35l41-lib.c:836:8
shift exponent 64 is too large for 64-bit type 'long unsigned int'
CPU: 10 PID: 595 Comm: systemd-udevd Not tainted 5.15.0-23-generic #23
Hardware name: LENOVO \x02MFG_IN_GO/\x02MFG_IN_GO, BIOS N3GET19W (1.00 ) 03/11/2022
Call Trace:
 <TASK>
 show_stack+0x52/0x58
 dump_stack_lvl+0x4a/0x5f
 dump_stack+0x10/0x12
 ubsan_epilogue+0x9/0x45
 __ubsan_handle_shift_out_of_bounds.cold+0x61/0xef
 ? regmap_unlock_mutex+0xe/0x10
 cs35l41_otp_unpack.cold+0x1c6/0x2b2 [snd_soc_cs35l41_lib]
 cs35l41_hda_probe+0x24f/0x33a [snd_hda_scodec_cs35l41]
 cs35l41_hda_i2c_probe+0x65/0x90 [snd_hda_scodec_cs35l41_i2c]

When both bitoffset and otp_map[i].size are 0, the line 836 will
result in GENMASK(-1, 0), this triggers the shift-out-of-bounds
calltrace.

Here add a checking, if both bitoffset and otp_map[i].size are 0,
do not run GENMASK() and directly set otp_val to 0, this will not
bring any function change on the driver but could avoid the calltrace.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20220324081839.62009-2-hui.wang@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l41: Add one more variable in the debug log
Hui Wang [Thu, 24 Mar 2022 08:18:38 +0000 (16:18 +0800)]
ASoC: cs35l41: Add one more variable in the debug log

otp_map[].size is a key variable to compute the value of otp_val and
to update the bit_offset, it is helpful to debug if could put it in
the debug log.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Reviewed-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220324081839.62009-1-hui.wang@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682: fix an incorrect NULL check on list iterator
Xiaomeng Tong [Sun, 27 Mar 2022 08:10:02 +0000 (16:10 +0800)]
ASoC: rt5682: fix an incorrect NULL check on list iterator

The bug is here:
if (!dai) {

The list iterator value 'dai' will *always* be set and non-NULL
by for_each_component_dais(), so it is incorrect to assume that
the iterator value will be NULL if the list is empty or no element
is found (In fact, it will be a bogus pointer to an invalid struct
object containing the HEAD). Otherwise it will bypass the check
'if (!dai) {' (never call dev_err() and never return -ENODEV;)
and lead to invalid memory access lately when calling
'rt5682_set_bclk1_ratio(dai, factor);'.

To fix the bug, just return rt5682_set_bclk1_ratio(dai, factor);
when found the 'dai', otherwise dev_err() and return -ENODEV;

Cc: stable@vger.kernel.org
Fixes: ebbfabc16d23d ("ASoC: rt5682: Add CCF usage for providing I2S clks")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220327081002.12684-1-xiam0nd.tong@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: soc-dapm: fix two incorrect uses of list iterator
Xiaomeng Tong [Tue, 29 Mar 2022 01:21:34 +0000 (09:21 +0800)]
ASoC: soc-dapm: fix two incorrect uses of list iterator

These two bug are here:
list_for_each_entry_safe_continue(w, n, list,
power_list);
list_for_each_entry_safe_continue(w, n, list,
power_list);

After the list_for_each_entry_safe_continue() exits, the list iterator
will always be a bogus pointer which point to an invalid struct objdect
containing HEAD member. The funciton poniter 'w->event' will be a
invalid value which can lead to a control-flow hijack if the 'w' can be
controlled.

The original intention was to continue the outer list_for_each_entry_safe()
loop with the same entry if w->event is NULL, but misunderstanding the
meaning of list_for_each_entry_safe_continue().

So just add a 'continue;' to fix the bug.

Cc: stable@vger.kernel.org
Fixes: 163cac061c973 ("ASoC: Factor out DAPM sequence execution")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Link: https://lore.kernel.org/r/20220329012134.9375-1-xiam0nd.tong@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Intel: catpt: Drop redundant enum constant
Cezary Rojewski [Sun, 3 Apr 2022 14:16:47 +0000 (16:16 +0200)]
ASoC: Intel: catpt: Drop redundant enum constant

CATPT_SSP_IFACE_LAST is being used only to calculate CATPT_SSP_COUNT.
Make CATPT_SSP_COUNT part of the enum directly and remove the redundant
constant.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220403141647.1037173-1-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: rt5682s: Separate the regulator consumer controls
Derek Fang [Mon, 28 Mar 2022 05:33:38 +0000 (13:33 +0800)]
ASoC: rt5682s: Separate the regulator consumer controls

Control the regulators separately instead of using regulator_bulk to
accord to the timing request in the datasheet.

Signed-off-by: Derek Fang <derek.fang@realtek.com>
Link: https://lore.kernel.org/r/20220328053338.21441-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: ipc3-topology: Set scontrol->priv to NULL after freeing it
Peter Ujfalusi [Thu, 31 Mar 2022 11:47:57 +0000 (14:47 +0300)]
ASoC: SOF: ipc3-topology: Set scontrol->priv to NULL after freeing it

Since the scontrol->priv is freed up during load operation it should be set
to NULL to be safe against double freeing attempt.

Fixes: b5cee8feb1d48 ("ASoC: SOF: topology: Make control parsing IPC agnostic")
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/20220331114757.32551-1-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs*: use simple i2c probe function
Stephen Kitt [Fri, 25 Mar 2022 17:07:34 +0000 (18:07 +0100)]
ASoC: cs*: use simple i2c probe function

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

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220325170734.1216018-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: wm*: use i2c_match_id and simple i2c probe
Stephen Kitt [Fri, 25 Mar 2022 16:25:15 +0000 (17:25 +0100)]
ASoC: wm*: use i2c_match_id and simple i2c probe

As part of the ongoing i2c transition to the simple probe
("probe_new"), this patch uses i2c_match_id to retrieve the
driver_data for the probed device. The id parameter is thus no longer
necessary and the simple probe can be used instead.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220325162515.1204107-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ada*, ssm*: use simple i2c probe function
Stephen Kitt [Fri, 25 Mar 2022 16:48:28 +0000 (17:48 +0100)]
ASoC: ada*, ssm*: use simple i2c probe function

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

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220325164828.1209201-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l41: Fix an out-of-bounds access in otp_packed_element_t
Hui Wang [Mon, 28 Mar 2022 12:35:35 +0000 (20:35 +0800)]
ASoC: cs35l41: Fix an out-of-bounds access in otp_packed_element_t

The CS35L41_NUM_OTP_ELEM is 100, but only 99 entries are defined in
the array otp_map_1/2[CS35L41_NUM_OTP_ELEM], this will trigger UBSAN
to report a shift-out-of-bounds warning in the cs35l41_otp_unpack()
since the last entry in the array will result in GENMASK(-1, 0).

UBSAN reports this problem:
 UBSAN: shift-out-of-bounds in /home/hwang4/build/jammy/jammy/sound/soc/codecs/cs35l41-lib.c:836:8
 shift exponent 64 is too large for 64-bit type 'long unsigned int'
 CPU: 10 PID: 595 Comm: systemd-udevd Not tainted 5.15.0-23-generic #23
 Hardware name: LENOVO \x02MFG_IN_GO/\x02MFG_IN_GO, BIOS N3GET19W (1.00 ) 03/11/2022
 Call Trace:
  <TASK>
  show_stack+0x52/0x58
  dump_stack_lvl+0x4a/0x5f
  dump_stack+0x10/0x12
  ubsan_epilogue+0x9/0x45
  __ubsan_handle_shift_out_of_bounds.cold+0x61/0xef
  ? regmap_unlock_mutex+0xe/0x10
  cs35l41_otp_unpack.cold+0x1c6/0x2b2 [snd_soc_cs35l41_lib]
  cs35l41_hda_probe+0x24f/0x33a [snd_hda_scodec_cs35l41]
  cs35l41_hda_i2c_probe+0x65/0x90 [snd_hda_scodec_cs35l41_i2c]
  ? cs35l41_hda_i2c_remove+0x20/0x20 [snd_hda_scodec_cs35l41_i2c]
  i2c_device_probe+0x252/0x2b0

Fixes: 6450ef559056 ("ASoC: cs35l41: CS35L41 Boosted Smart Amplifier")
Reviewed-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20220328123535.50000-2-hui.wang@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: cs35l41: Add one more variable in the debug log
Hui Wang [Mon, 28 Mar 2022 12:35:34 +0000 (20:35 +0800)]
ASoC: cs35l41: Add one more variable in the debug log

otp_map[].size is a key variable to compute the value of otp_val and
to update the bit_offset, it is helpful to debug if could put it in
the debug log.

Reviewed-by: Lucas Tanure <tanureal@opensource.cirrus.com>
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220328123535.50000-1-hui.wang@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: samsung: Constify snd_soc_dapm_{route,widget} structs
Rikard Falkeborn [Wed, 30 Mar 2022 20:42:27 +0000 (22:42 +0200)]
ASoC: samsung: Constify snd_soc_dapm_{route,widget} structs

These structs only have their address assigned to the
dapm_{routes,widget} fields in the snd_soc_card struct,
both which are pointers to const data. Make them const to
allow the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220330204227.25081-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: da7218: use i2c_match_id and simple i2c probe
Stephen Kitt [Fri, 25 Mar 2022 17:19:04 +0000 (18:19 +0100)]
ASoC: da7218: use i2c_match_id and simple i2c probe

As part of the ongoing i2c transition to the simple probe
("probe_new"), this patch uses i2c_match_id to retrieve the
driver_data for the probed device. The id parameter is thus no longer
necessary and the simple probe can be used instead.

This patch follows the model set by da7218_of_get_id().

Signed-off-by: Stephen Kitt <steve@sk2.org>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Link: https://lore.kernel.org/r/20220325171904.1223539-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: da[79]*: use simple i2c probe function
Stephen Kitt [Fri, 25 Mar 2022 17:12:43 +0000 (18:12 +0100)]
ASoC: da[79]*: use simple i2c probe function

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

This avoids scanning the identifier tables during probes.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20220325171243.1218003-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: qcom: Add driver support for ALC5682I-VS
Judy Hsiao [Thu, 31 Mar 2022 08:42:01 +0000 (16:42 +0800)]
ASoC: qcom: Add driver support for ALC5682I-VS

Add Machine driver support for ALC5682I-VS codec.

Signed-off-by: Judy Hsiao <judyhsiao@chromium.org>
Link: https://lore.kernel.org/r/20220331084201.62815-1-judyhsiao@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: intel: atom: Remove superfluous flush_scheduled_work()
Takashi Iwai [Tue, 22 Mar 2022 15:48:26 +0000 (16:48 +0100)]
ASoC: intel: atom: Remove superfluous flush_scheduled_work()

It seems that flush_scheduled_work() is called without any real
purpose at sst_context_cleanup() (the driver doesn't put works on the
global queue at all).  As the flush_schedule_work() function is going
to be abolished in near future, let's drop it now.

Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220322154826.19400-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: ad1*, ada*, ssm*: use i2c_match_id and simple i2c probe
Stephen Kitt [Fri, 25 Mar 2022 16:54:52 +0000 (17:54 +0100)]
ASoC: ad1*, ada*, ssm*: use i2c_match_id and simple i2c probe

As part of the ongoing i2c transition to the simple probe
("probe_new"), this patch uses i2c_match_id to retrieve the
driver_data for the probed device. The id parameter is thus no longer
necessary and the simple probe can be used instead.

Signed-off-by: Stephen Kitt <steve@sk2.org>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20220325165452.1212975-1-steve@sk2.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: Introduce snd_soc_of_get_dai_link_cpus
Martin Povišer [Thu, 31 Mar 2022 00:04:48 +0000 (02:04 +0200)]
ASoC: Introduce snd_soc_of_get_dai_link_cpus

This function is an analogue of snd_soc_of_get_dai_link_codecs to help
machine drivers read CPU DAI lists from devicetrees.

Signed-off-by: Martin Povišer <povik+lin@cutebit.org>
Link: https://lore.kernel.org/r/20220331000449.41062-5-povik+lin@cutebit.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: codecs: Fix error handling in power domain init and exit handlers
Srinivasa Rao Mandadapu [Tue, 22 Mar 2022 16:18:57 +0000 (21:48 +0530)]
ASoC: codecs: Fix error handling in power domain init and exit handlers

Update error handling in power domain init and exit handlers, as existing handling
may cause issues in device remove function.
Use appropriate pm core api for power domain get and sync to avoid redundant code.

Fixes: 9e3d83c52844 ("ASoC: codecs: Add power domains support in digital macro codecs")

Signed-off-by: Srinivasa Rao Mandadapu <quic_srivasam@quicinc.com>
Co-developed-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Signed-off-by: Venkata Prasad Potturu <quic_potturu@quicinc.com>
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/1647965937-32203-1-git-send-email-quic_srivasam@quicinc.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2 years agoASoC: SOF: topology: use new sound control LED layer
Jaroslav Kysela [Tue, 29 Mar 2022 12:00:39 +0000 (14:00 +0200)]
ASoC: SOF: topology: use new sound control LED layer

Use the new sound control LED layer instead the direct ledtrig_audio_set()
call - see 22d8de62f11b ("ALSA: control - add generic LED trigger module
as the new control layer").

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Cc: Bard Liao <yung-chuan.liao@linux.intel.com>
Cc: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20220329120039.2394138-1-perex@perex.cz
Signed-off-by: Mark Brown <broonie@kernel.org>