History log of /linux-master/sound/soc/fsl/fsl-asoc-card.c
Revision Date Author Comments
# 7465582e 18-Dec-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: fsl-asoc-card: don't need DUMMY Platform

We can use SND_SOC_DAILINK_REG() with 2 parameter.
DUMMY Platform is not needed.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://msgid.link/r/877cla93ry.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# fbfe616a 06-Oct-2023 Hui Wang <hui.wang@canonical.com>

ASoC: fsl-asoc-card: Add comment for mclk in the codec_priv

Otherwise a warning will be detected as below:
warning: Function parameter or member 'mclk' not described in
'codec_priv'

Fixes: 1075df4bdeb3 ("ASoC: fsl-asoc-card: add nau8822 support")
Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/20231007040117.22446-1-hui.wang@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 14ec63f6 11-Sep-2023 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: convert not to use asoc_xxx()

ASoC is now unified asoc_xxx() into snd_soc_xxx().
This patch convert asoc_xxx() to snd_soc_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874jk0s24t.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2b21207a 20-Sep-2023 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: use integer type for fll_id and pll_id

As the pll_id and pll_id can be zero (WM8960_SYSCLK_AUTO)
with the commit 2bbc2df46e67 ("ASoC: wm8960: Make automatic the
default clocking mode")

Then the machine driver will skip to call set_sysclk() and set_pll()
for codec, when the sysclk rate is different with what wm8960 read
at probe, the output sound frequency is wrong.

So change the fll_id and pll_id initial value, still keep machine
driver's behavior same as before.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1695202992-24864-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6ab11462 16-Jun-2023 Fabio Estevam <festevam@denx.de>

ASoC: fsl-asoc-card: Allow passing the number of slots in use

Currently, fsl-asoc-card supports passing the width of the TDM slot, but
not the number of slots in use, as it harcodes it as two slots.

Add support for passing the number of slots in use.

Signed-off-by: Fabio Estevam <festevam@denx.de>
Link: https://lore.kernel.org/r/20230616203913.551183-1-festevam@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1075df4b 15-Jun-2022 Hui Wang <hui.wang@canonical.com>

ASoC: fsl-asoc-card: add nau8822 support

This is for an imx6sx EVB which has a nau8822 codec connects to the
SSI2 interface, so add the nau8822 support in this machine driver.

Because the codec driver nau8822.c doesn't handle mclk enabling, here
adding a codec_priv->mclk for nau8822 and similar codecs which need to
enable the mclk in the machine driver, and enable the mclk in the
card_late_probe() conditionally.

Signed-off-by: Hui Wang <hui.wang@canonical.com>
Link: https://lore.kernel.org/r/Message-Id: <20220616040046.103524-1-hui.wang@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 574399f4 16-Apr-2023 Christophe JAILLET <christophe.jaillet@wanadoo.fr>

ASoC: fsl: Simplify an error message

dev_err_probe() already display the error code. There is no need to
duplicate it explicitly in the error message.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Iuliana Prodan <iuliana.prodan@nxp.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/c167c16a535049d56f817bbede9c9f6f0a0f4c68.1681626553.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9934844f 16-Mar-2023 Alexander Stein <alexander.stein@ew.tq-group.com>

ASoC: fsl: Specify driver name in ASoC card

Set the snd_soc_card driver name which fixes the warning:
fsl-asoc-card sound: ASoC: driver name too long 'imx-audio-tlv320aic32x4'
-> 'imx-audio-tlv32'

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230316123611.3495597-2-alexander.stein@ew.tq-group.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1d52cba3 16-Mar-2023 Alexander Stein <alexander.stein@ew.tq-group.com>

ASoC: fsl: define a common DRIVER_NAME

Instead of copying the driver name manually, use a common define.
No functional change.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20230316123611.3495597-1-alexander.stein@ew.tq-group.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1b381f6f 26-Jan-2023 Luca Ceresoli <luca.ceresoli@bootlin.com>

scripts/spelling.txt: add "exsits" pattern and fix typo instances

Fix typos and add the following to the scripts/spelling.txt:

exsits||exists

Link: https://lkml.kernel.org/r/20230126152205.959277-1-luca.ceresoli@bootlin.com
Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# 18e16350 26-Jan-2023 Luca Ceresoli <luca.ceresoli@bootlin.com>

ASoC: fsl-asoc-card: constify fsl_asoc_card_dai

This is never modified and can be made const.

Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Link: https://lore.kernel.org/r/20230126152412.959574-1-luca.ceresoli@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1a77d59e 06-Jan-2023 Mark Brown <broonie@kernel.org>

ASoC: fsl-asoc-card: Log error code when we fail to register

The chances are that any error we see here will be EPROBE_DEFER but let's
actually tell the user so they know.

Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230106-asoc-fsl-err-log-v1-1-49d845c99434@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 242fc66a 06-Jan-2023 Mark Brown <broonie@kernel.org>

ASoC: fsl-asoc-card: Fix naming of AC'97 CODEC widgets

The fsl-asoc-card AC'97 support currently tries to route to Playback and
Capture widgets provided by the AC'97 CODEC. This doesn't work since the
generic AC'97 driver registers with an "AC97" at the front of the stream
and hence widget names, update to reflect reality. It's not clear to me
if or how this ever worked.

Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230106-asoc-udoo-probe-v1-2-a5d7469d4f67@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8c6a42b5 06-Jan-2023 Mark Brown <broonie@kernel.org>

ASoC: fsl_ssi: Rename AC'97 streams to avoid collisions with AC'97 CODEC

The SSI driver calls the AC'97 playback and transmit streams "AC97 Playback"
and "AC97 Capture" respectively. This is the same name used by the generic
AC'97 CODEC driver in ASoC, creating confusion for the Freescale ASoC card
when it attempts to use these widgets in routing. Add a "CPU" in the name
like the regular DAIs registered by the driver to disambiguate.

Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20230106-asoc-udoo-probe-v1-1-a5d7469d4f67@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6c7b077d 21-Jul-2022 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: force cast the asrc_format type

Fix sparse warning:
sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: warning: incorrect type in argument 3 (different base types)
sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: expected unsigned int [usertype] *out_value
sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: got restricted snd_pcm_format_t *

Fixes: 859e364302c5 ("ASoC: fsl-asoc-card: Support new property fsl, asrc-format")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1658399393-28777-4-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5cb90dcb 21-Mar-2022 Meng Tang <tangmeng@uniontech.com>

ASoC: fsl-asoc-card: Fix jack_event() always return 0

Today, hp_jack_event and mic_jack_event always return 0. However,
snd_soc_dapm_disable_pin and snd_soc_dapm_enable_pin may return a
non-zero value, this will cause the user who calling hp_jack_event
and mic_jack_event don't know whether the operation was really
successfully.

Signed-off-by: Meng Tang <tangmeng@uniontech.com>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Link: https://lore.kernel.org/r/20220321065754.18307-1-tangmeng@uniontech.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# d4c4e286 17-Jan-2022 Ariel D'Alessandro <ariel.dalessandro@collabora.com>

ASoC: fsl-asoc-card: Remove BCLK default value for tlv320aic31xx card

Now that fsl-asoc-card support setting mclk-id through the device-tree
mclk-id property, let's remove the default BCLK configuration for this
card.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Link: https://lore.kernel.org/r/20220117132109.283365-6-ariel.dalessandro@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 91e4e40b 17-Jan-2022 Ariel D'Alessandro <ariel.dalessandro@collabora.com>

ASoC: fsl-asoc-card: Add optional dt property for setting mclk-id

Sound cards may allow using different main clock inputs. In the generic
fsl-asoc-card driver, these values are hardcoded for each specific card
configuration.

Let's make it more flexible, allowing setting mclk-id from the
device-tree node. Otherwise, the default value for each card
configuration is used.

Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Link: https://lore.kernel.org/r/20220117132109.283365-5-ariel.dalessandro@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 2e6f557c 13-Dec-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: Use dev_err_probe() helper

Use the dev_err_probe() helper, instead of open-coding the same
operation.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/20211214020843.2225831-14-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8c9b9cfb 18-Nov-2021 Ariel D'Alessandro <ariel.dalessandro@collabora.com>

ASoC: fsl-asoc-card: Support fsl,imx-audio-tlv320aic31xx codec

Add entry for fsl,imx-audio-tlv320aic31xx audio codec. This codec is
configured to use BCLK as clock input.

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: Ariel D'Alessandro <ariel.dalessandro@collabora.com>
Link: https://lore.kernel.org/r/20211119153248.419802-6-ariel.dalessandro@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 8fcfd349 21-Sep-2021 Mark Brown <broonie@kernel.org>

ASoC: fsl-asoc-card: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the fsl-asoc-card driver to use more modern terminology for clocking.

Signed-off-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210921213542.31688-2-broonie@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4b1d5171 02-Jun-2021 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: change dev_err to dev_dbg for defer probe

Don't need to print error message for defer probe

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Fabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/1622616132-10391-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3bba9414 13-Jun-2021 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: switch to use snd_soc_daifmt_parse_format/clock_provider()

This patch switch to use snd_soc_daifmt_parse_format/clock_provider() from
snd_soc_of_parse_daifmt().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/874ke1w9dc.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a8437f05 27-May-2021 Nicolas Cavallari <nicolas.cavallari@green-communications.fr>

ASoC: fsl-asoc-card: Set .owner attribute when registering card.

Otherwise, when compiled as module, a WARN_ON is triggered:

WARNING: CPU: 0 PID: 5 at sound/core/init.c:208 snd_card_new+0x310/0x39c [snd]
[...]
CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.10.39 #1
Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
Workqueue: events deferred_probe_work_func
[<c0111988>] (unwind_backtrace) from [<c010c8ac>] (show_stack+0x10/0x14)
[<c010c8ac>] (show_stack) from [<c092784c>] (dump_stack+0xdc/0x104)
[<c092784c>] (dump_stack) from [<c0129710>] (__warn+0xd8/0x114)
[<c0129710>] (__warn) from [<c0922a48>] (warn_slowpath_fmt+0x5c/0xc4)
[<c0922a48>] (warn_slowpath_fmt) from [<bf0496f8>] (snd_card_new+0x310/0x39c [snd])
[<bf0496f8>] (snd_card_new [snd]) from [<bf1d7df8>] (snd_soc_bind_card+0x334/0x9c4 [snd_soc_core])
[<bf1d7df8>] (snd_soc_bind_card [snd_soc_core]) from [<bf1e9cd8>] (devm_snd_soc_register_card+0x30/0x6c [snd_soc_core])
[<bf1e9cd8>] (devm_snd_soc_register_card [snd_soc_core]) from [<bf22d964>] (fsl_asoc_card_probe+0x550/0xcc8 [snd_soc_fsl_asoc_card])
[<bf22d964>] (fsl_asoc_card_probe [snd_soc_fsl_asoc_card]) from [<c060c930>] (platform_drv_probe+0x48/0x98)
[...]

Signed-off-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com>
Link: https://lore.kernel.org/r/20210527163409.22049-1-nicolas.cavallari@green-communications.fr
Signed-off-by: Mark Brown <broonie@kernel.org>


# efd0b166 17-Mar-2021 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Add support for WM8958 codec

WM8958 codec is used on some i.MX based platform.
So add it support in this generic driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1615986303-27959-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 77f1ff75 29-Nov-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Add support for si476x codec

The si476x codec is used for FM radio function on i.MX6
auto board, it only supports recording function.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1606708668-28786-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# b5074755 21-Aug-2020 Matthias Schiffer <matthias.schiffer@ew.tq-group.com>

ASoC: fsl-asoc-card: add support for TLV320AIC32x4 codec

The TLV320AIC32x4 is commonly used on TQ-Systems starterkit mainboards
for i.MX-based SoMs (i.MX6Q/DL, i.MX6UL, i.MX7) and LS1021A.

Signed-off-by: Matthias Schiffer <matthias.schiffer@ew.tq-group.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20200821071153.7317-2-matthias.schiffer@ew.tq-group.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# a8fd5ca8 10-Aug-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Get "extal" clock rate by clk_get_rate

On some platform(.e.g. i.MX8QM MEK), the "extal" clock is different
with the mclk of codec, then the clock rate is also different.
So it is better to get clock rate of "extal" rate by clk_get_rate,
don't reuse the clock rate of mclk.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1597047103-6863-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# f36e8edb 02-Aug-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Remove fsl_asoc_card_set_bias_level function

With this case:
aplay -Dhw:x 16khz.wav 24khz.wav
There is sound distortion for 24khz.wav. The reason is that setting
PLL of WM8962 with set_bias_level function, the bias level is not
changed when 24khz.wav is played, then the PLL won't be reset, the
clock is not correct, so distortion happens.

The resolution of this issue is to remove fsl_asoc_card_set_bias_level.
Move PLL configuration to hw_params and hw_free.

After removing fsl_asoc_card_set_bias_level, also test WM8960 case,
it can work.

Fixes: 708b4351f08c ("ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support")
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1596420811-16690-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 08b54b5e 20-Jul-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Support configuring dai fmt from DT

Support same propeties as simple card for configuring fmt
from DT.
In order to make this change compatible with old DT, these
properties are optional.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1595302910-19688-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9f5f078a 19-Jul-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: use asoc_substream_to_rtd()

Now we can use asoc_substream_to_rtd() macro,
let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87eep70ytr.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1b582141 15-Jul-2020 Lee Jones <lee.jones@linaro.org>

ASoC: fsl: fsl-asoc-card: Trivial: Fix misspelling of 'exists'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: https://lore.kernel.org/r/20200715150009.407442-1-lee.jones@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3b171194 15-Jul-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Support Headphone and Microphone Jack detection

Use asoc_simple_init_jack function from simple card to implement
the Headphone and Microphone detection.
Register notifier to disable Speaker when Headphone is plugged in
and enable Speaker when Headphone is unplugged.
Register notifier to disable Digital Microphone when Analog Microphone
is plugged in and enable DMIC when Analog Microphone is unplugged.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1594822179-1849-4-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 31deacff 02-Jul-2020 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>

ASoC: fsl: fsl-asoc-card: fix kernel-doc

Fix W=1 warnings. Kernel-doc syntax was not properly used.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/20200702192141.168018-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3cd99026 23-Jun-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Add WM8524 support

WM8524 only supports playback mode, and only works at
slave mode.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/1592895167-30483-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 039652a5 16-Jun-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Add MQS support

The MQS codec isn't an i2c device, so use of_find_device_by_node
to get platform device pointer.

Because MQS only support playback, then add a new audio map.

And there maybe "model" property or no "audio-routing" property in
devicetree, so add some enhancement for these two property.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Reviewed-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/918505decb7f757f12c38059c590984f28d2f3a4.1592369271.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# e396dec4 04-Jun-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Defer probe when fail to find codec device

Defer probe when fail to find codec device, because the codec
device maybe probed later than machine driver.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Link: https://lore.kernel.org/r/1591251930-4111-1-git-send-email-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 859e3643 16-Apr-2020 Shengjiu Wang <shengjiu.wang@nxp.com>

ASoC: fsl-asoc-card: Support new property fsl, asrc-format

In order to align with new ESARC, we add new property fsl,asrc-format.
The fsl,asrc-format can replace the fsl,asrc-width, driver
can accept format from devicetree, don't need to convert it to
format through width.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Link: https://lore.kernel.org/r/02f53d5512b9acd3492e2acdd5e0ba3113f18009.1587038908.git.shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 17198ae7 22-Mar-2020 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: use asoc_rtd_to_cpu() / asoc_rtd_to_codec() macro for DAI pointer

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/87v9mvir89.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 4468189f 09-Dec-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: soc-core: find rtd via dai_link pointer at snd_soc_get_pcm_runtime()

Current snd_soc_get_pcm_runtime() is finding rtd by checking dai_link
name. But, it is strange and waste of CPU power, because its user want
to get from rtd from dai_link, not from dai_link name.
This patch find rtd via dai_link pointer instead of its name.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.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/87a781yq67.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 9998d3e2 27-Jun-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: fsl-asoc-card: consider CPU-Platform possibility

commit e57a4c2f15df27 ("ASoC: fsl: fsl-asoc-card: don't select unnecessary
Platform")

Current ALSA SoC avoid to add duplicate component to rtd,
and this driver was selecting CPU component as Platform component.
Thus, above patch removed Platform settings from this driver,
because it assumed these are same component.

But, some CPU driver is using generic DMAEngine, in such case, both
CPU component and Platform component will have same of_node/name.
In other words, there are some components which are different but
have same of_node/name.

In such case, Card driver definitely need to select Platform even
though it is same as CPU.
It is depends on CPU driver, but is difficult to know it from Card driver.
This patch reverts above patch.

Fixes: commit e57a4c2f15df27 ("ASoC: fsl: fsl-asoc-card: don't select unnecessary Platform")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e57a4c2f 18-Jun-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: fsl-asoc-card: don't select unnecessary Platform

ALSA SoC is now supporting "no Platform". Sound card doesn't need to
select "CPU component" as "Platform" anymore if it doesn't need
special Platform.
This patch removes such settings.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 893f1951 05-Jun-2019 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: fsl: fsl-asoc-card: use modern dai_link style

ASoC is now supporting modern style dai_link
(= snd_soc_dai_link_component) for CPU/Codec/Platform.
This patch switches to use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 11907e9d 02-Feb-2019 wen yang <yellowriver2010@hotmail.com>

ASoC: fsl-asoc-card: fix object reference leaks in fsl_asoc_card_probe

The of_find_device_by_node() takes a reference to the underlying device
structure, we should release that reference.

Signed-off-by: Wen Yang <yellowriver2010@hotmil.com>
Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1d52a74e 05-Dec-2018 Rob Herring <robh@kernel.org>

ASoC: Use of_node_name_eq for node name comparisons

Convert string compares of DT node names to use of_node_name_eq helper
instead. This removes direct access to the node name pointer.

For the FSL ASoC card, the full node names appear to be "ssi", "esai",
and "sai", so there's not any reason to use strstr and of_node_name_eq
can be used instead.

Cc: Timur Tabi <timur@kernel.org>
Cc: Nicolin Chen <nicoleotsuka@gmail.com>
Cc: Xiubo Li <Xiubo.Lee@gmail.com>
Cc: Fabio Estevam <fabio.estevam@nxp.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: alsa-devel@alsa-project.org
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ebc22af0 25-Jul-2018 Takashi Iwai <tiwai@suse.de>

ASoC: fsl: Use snd_mask_set_format()

Use the new helper function snd_mask_set_format() for avoiding the
ugly cast with __force prefix.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Mark Brown <broonie@kernel.org>


# aa624a0a 24-Jul-2018 Fabio Estevam <fabio.estevam@nxp.com>

ASoC: fsl-asoc-card: Switch to SPDX identifier

Adopt the SPDX license identifier headers to ease license compliance
management.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# fc734c24 11-Feb-2018 Fabio Estevam <fabio.estevam@nxp.com>

ASoC: fsl-asoc-card: Use 'snd_pcm_format_t' type when appropriate

A better suited type for 'sample_format' and 'asrc_format' is
'snd_pcm_format_t'.

Change the type so that the following build warnings with W=1 are gone:

sound/soc/fsl/fsl-asoc-card.c:153:29: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl-asoc-card.c:153:29: expected unsigned int [unsigned] [usertype] sample_format
sound/soc/fsl/fsl-asoc-card.c:153:29: got restricted snd_pcm_format_t
sound/soc/fsl/fsl-asoc-card.c:258:44: warning: restricted snd_pcm_format_t degrades to integer
sound/soc/fsl/fsl-asoc-card.c:525:29: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl-asoc-card.c:525:29: expected unsigned int [unsigned] [usertype] sample_format
sound/soc/fsl/fsl-asoc-card.c:525:29: got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/fsl/fsl-asoc-card.c:680:43: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl-asoc-card.c:680:43: expected unsigned int [unsigned] [usertype] asrc_format
sound/soc/fsl/fsl-asoc-card.c:680:43: got restricted snd_pcm_format_t [usertype] <noident>
sound/soc/fsl/fsl-asoc-card.c:682:43: warning: incorrect type in assignment (different base types)
sound/soc/fsl/fsl-asoc-card.c:682:43: expected unsigned int [unsigned] [usertype] asrc_format
sound/soc/fsl/fsl-asoc-card.c:682:43: got restricted snd_pcm_format_t [usertype] <noident>

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 845f80cb 04-Dec-2017 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

ASoC: don't use rtd->codec on fsl-asoc-card

rtd->codec will be removed soon.
rtd->codec = rtd->codec_dai->codec, thus,
we can use rtd->codec_dai->component instead of it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 7add71b6 20-Sep-2017 Arvind Yadav <arvind.yadav.cs@gmail.com>

ASoC: fsl-asoc-card: Handle return value of devm_kasprintf

devm_kasprintf() can fail here and we must check its return value.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 758a3b01 07-Sep-2017 Nicolin Chen <nicoleotsuka@gmail.com>

ASoC: fsl-asoc-card: Don't error out if ENOTSUPP

The snd_soc_component_set_sysclk() and snd_soc_dai_set_tdm_slot()
in the soc-core.c will return -ENOTSUPP if there is no function
implementation for them in the dai and component drivers.

So this patch tries to ignore this errno.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# e5d619e9 18-Aug-2017 Lucas Stach <l.stach@pengutronix.de>

ASoC: fsl-asoc-card: don't print EPROBE_DEFER as error

Probe deferral is to be expected during normal operation, so avoid
printing an error when it is encountered.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# ddba7fa4 15-Oct-2016 Julia Lawall <Julia.Lawall@lip6.fr>

ASoC: constify snd_soc_ops structures

Check for snd_soc_ops structures that are only stored in the ops field of a
snd_soc_dai_link structure. This field is declared const, so snd_soc_ops
structures that have this property can be declared as const also.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct snd_soc_ops i@p = { ... };

@ok1@
identifier r.i;
struct snd_soc_dai_link e;
position p;
@@
e.ops = &i@p;

@ok2@
identifier r.i, e;
position p;
@@
struct snd_soc_dai_link e[] = { ..., { .ops = &i@p, }, ..., };

@bad@
position p != {r.p,ok1.p,ok2.p};
identifier r.i;
struct snd_soc_ops e;
@@
e@i@p

@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct snd_soc_ops i = { ... };
// </smpl>

The effect on the layout of the .o files is shown by the following output of
the size command, first before then after the transformation:

text data bss dec hex filename
8748 1024 0 9772 262c sound/soc/fsl/fsl-asoc-card.o
8812 952 0 9764 2624 sound/soc/fsl/fsl-asoc-card.o

text data bss dec hex filename
4165 264 8 4437 1155 sound/soc/fsl/imx-wm8962.o
4229 200 8 4437 1155 sound/soc/fsl/imx-wm8962.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 57e756d3 29-Jan-2016 Felipe F. Tonello <eu@felipetonello.com>

ASoC: fsl-asoc-card: add cs4271 and cs4272 support

add cs4271 and cs42727 support for fsl-asoc-card

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 089dfaf7 31-Jan-2016 Nicolin Chen <nicolinc@nvidia.com>

ASoC: fsl-asoc-card: Don't add DAPM routes for ASRC if it doesn't exist

There are a pair of warnings when ASRC is absent in the DTB:
fsl-asoc-card sound: ASoC: no source widget found for ASRC-Playback
fsl-asoc-card sound: ASoC: Failed to add route ASRC-Playback -> direct -> CPU-Playback
fsl-asoc-card sound: ASoC: no sink widget found for ASRC-Capture
fsl-asoc-card sound: ASoC: Failed to add route CPU-Capture -> direct -> ASRC-Capture

This is because the driver is still trying to add DAPM routes for ASRC
even if it doesn't exist on that platform.

The warnings are harmless but it might be annoying. So this patch drops
the DAPM routes of ASRC when it's absent in the DAI link.

Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 25e5ef97 20-Dec-2015 Maciej S. Szmigiero <mail@maciej.szmigiero.name>

ASoC: fsl-asoc-card: use different route map for AC'97 mode

fsl_ssi uses different stream names ("AC97 Playback" / "AC97 Capture")
in AC'97 mode so in this case fsl-asoc-card route map should
also be using them.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# abd657b1 20-Nov-2015 Vinod Koul <vkoul@kernel.org>

ASoC: fsl-asoc-card: Update the rtd query

sound card rtd was an array and was updated to a list so update
the driver to use a list

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5015920a 18-Nov-2015 Mengdong Lin <mengdong.lin@linux.intel.com>

ASoC: Vendor drivers get a link's runtime by snd_soc_get_pcm_runtime()

Vendor drivers no longer access a DAI link's runtime by the link index
but by matching the link name via snd_soc_get_pcm_runtime(). We assume
each DAI link has a unique name.

This is preparation for changing runtimes from an array to a list later.

Vendor drivers changed:
sound/soc/fsl/fsl-asoc-card.c
sound/soc/fsl/imx-wm8962.c
sound/soc/pxa/mioa701_wm9713.c
sound/soc/samsung/bells.c
sound/soc/samsung/littlemill.c
sound/soc/samsung/odroidx2_max98090.c
sound/soc/samsung/snow.c
sound/soc/samsung/speyside.c
sound/soc/samsung/tobermory.c
sound/soc/tegra/tegra_wm8903

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 50760cad 18-Sep-2015 Maciej S. Szmigiero <mail@maciej.szmigiero.name>

ASoC: fsl-asoc-card: add AC'97 support

Add AC'97 support to fsl-asoc-card using generic
ASoC AC'97 CODEC.

The SSI controller will silently enable any TX
AC'97 slots that have their bits set in SLOTREQ
received from CODEC and then will redirect some
of playback samples there.

That's why it is important to make sure that
any of CODEC playback slots that can pull samples
are set to slots 3/4 (standard PCM playback slots).
Currently, this applies to S/PDIF slots as they
were seen to pull samples sometimes even with
S/PDIF output being disabled.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5226f234 02-Sep-2015 Luis de Bethencourt <luis@debethencourt.com>

ASoC: fsl-asoc-card: Fix module autoload for OF platform driver

This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luis@debethencourt.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 6bd3c6f7 31-Aug-2015 Maciej S. Szmigiero <mail@maciej.szmigiero.name>

ASoC: fsl-asoc-card: put ASRC OF node in case of unknown device

In case of unknown DT compatible device the ASRC OF node
possibly acquired earlier by of_parse_phandle() has
to be put before returning from probe method.

Signed-off-by: Maciej Szmigiero <mail@maciej.szmigiero.name>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 50e0ee01 14-Aug-2015 Zidan Wang <zidan.wang@freescale.com>

ASoC: fsl-asoc-card: add wm8960 support

add wm8960 support for fsl-asoc-card

Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 114bb139 12-Aug-2015 Nicolin Chen <nicoleotsuka@gmail.com>

ASoC: fsl-asoc-card: Specify codec_dai_name for DAI links

The dev->name of CODEC might not be identical to its codec_dai_name,
so using dev->name to probe the CODEC dai is not a correct approach.

This patch specifies each supporting codec_dai_name instead of using
dev->name any more.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 3185878a 14-Feb-2015 Nicolin Chen <nicoleotsuka@gmail.com>

ASoC: fsl-asoc-card: Add snd_soc_of_parse_audio_routing()

This patch adds snd_soc_of_parse_audio_routing() to get dapm routes
configurations via Device Tree.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# cb3fc1ff 24-Oct-2014 Nicolin Chen <nicoleotsuka@gmail.com>

ASoC: fsl-asoc-card: Add slot_width setting for cpu-dai

ESAI may need to use fixed slot width to comply with external
CODEC. So this set_tdm_slot() call will allow the ESAI driver
to override its default dynamic slot width policy.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 41282920 24-Oct-2014 Nicolin Chen <nicoleotsuka@gmail.com>

ASoC: fsl-asoc-card: Don't bypass settings if cpu-dai is Master

When cpu-dai is the DAI Master (CBM_CFx), it may need some configurations,
set_sysclk() call for eample, for cpu-dai side in the hw_params(), even if
the set_bias_level() has already taken care of the codec-dai side.

So this patch just simply adds an additional condition.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>


# 5f37671e 18-Aug-2014 Shengjiu Wang <shengjiu.wang@freescale.com>

ASoC: fsl-asoc-card: Fix build warning for maybe-uninitialized

When build fsl-asoc-card as module, there is following error:

sound/soc/fsl/fsl-asoc-card.c: In function 'fsl_asoc_card_probe':
>> sound/soc/fsl/fsl-asoc-card.c:547:13: warning: 'asrc_np' may be used uninitialized in this function [-Wmaybe-uninitialized]
of_node_put(asrc_np);
^

vim +/asrc_np +547 sound/soc/fsl/fsl-asoc-card.c

531 if (width == 24)
532 priv->asrc_format = SNDRV_PCM_FORMAT_S24_LE;
533 else
534 priv->asrc_format = SNDRV_PCM_FORMAT_S16_LE;
535 }
536
537 /* Finish card registering */
538 platform_set_drvdata(pdev, priv);
539 snd_soc_card_set_drvdata(&priv->card, priv);
540
541 ret = devm_snd_soc_register_card(&pdev->dev, &priv->card);
542 if (ret)
543 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
544
545 fail:
546 of_node_put(codec_np);
> 547 of_node_put(asrc_np);
548 of_node_put(cpu_np);
549
550 return ret;
551 }
552
553 static const struct of_device_id fsl_asoc_card_dt_ids[] = {
554 { .compatible = "fsl,imx-audio-cs42888", },
555 { .compatible = "fsl,imx-audio-sgtl5000", },

Add 'asrc_fail' branch for error jump after asrc_np initialized.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Mark Brown <broonie@linaro.org>


# 708b4351 30-Jul-2014 Nicolin Chen <nicoleotsuka@gmail.com>

ASoC: fsl: Add Freescale Generic ASoC Sound Card with ASRC support

The Freescale Generic ASoC Sound Card is a general ASoC DAI Link driver that
can be used, ideally, for all Freescale CPU DAI drivers and external CODECs.

The idea of this generic sound card is a bit like ASoC Simple Card. However,
for Freescale SoCs (especially those released in recent years), most of them
have ASRC (Documentation/devicetree/bindings/sound/fsl,asrc.txt) inside. And
this is a specific feature that might be painstakingly controlled and merged
into the Simple Card driver.

So having this driver will allow all Freescale SoC users to benefit from the
simplification to support a new card and the capability of wide sample rates
support through ASRC.

The driver is initially designed for sound card using I2S or PCM DAI formats.
However, it's also possible to merge those non-I2S/PCM type sound cards, such
as S/PDIF audio and HDMI audio, into this card as long as the merge will not
break the original function and as long as there is something redundant that
can be abstracted along with I2S type sound cards.

As an initial version, it only supports three cards that I can test:
imx-audio-cs42888, a new card that links ESAI with CS42888 CODEC
imx-audio-sgtl5000, just like the old imx-sgtl5000.c driver
imx-audio-wm8962, just like the old imx-wm8962.c driver

The driver is also compatible with the old Device Tree bindings of WM8962 and
SGTL5000. So we may consider to remove those two drivers after this driver is
totally enabled. (It needs to be added into defconfig)

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>