Change the signature of mtk_regmap_update_bits to also take a shift, and
warn when reg >= 0 but shift < 0. This reduce the code repetition
on the calling side, and prevent future UBSAN warning when some of the
xxx_shift and xxx_reg are both set to -1.
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
In sound/soc/mediatek/common/mtk-afe-fe-dai.c, when xxx_reg is -1, it's
a no-op to call mtk_regmap_update_bits, but since both xxx_reg and
xxx_shift are set to -1, the (1 << xxx_shift) in the argument would
trigger a UBSAN warning.
Fix the warning by setting those xxx_shift to 0 instead.
Note that since the code explicitly checks .mono_shift >= 0 and
.fs_shift >= 0 before using them in '<<' operator, those two members are
not set to 0.
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Skip for i2s5 in mck_disable which is also bypassed in mck_enable.
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Another batch of changes for ASoC, no big core changes - it's mainly
small fixes and improvements for individual drivers.
- A big refresh and cleanup of the Samsung drivers, fixing a number of
issues which allow the driver to be used with a wider range of
userspaces.
- Fixes for the Intel drivers to make them more standard so less likely
to get bitten by core issues.
- New driver for Cirrus Logic CS35L26.
-----BEGIN PGP SIGNATURE-----
iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlx3z7ETHGJyb29uaWVA
a2VybmVsLm9yZwAKCRAk1otyXVSH0H5QB/9jwKEwOdk6ynoFUpQwXPPkQl7CGkIh
P8J3OMTt+U4FNOrVG2S7xgUl69ZoaLm9rS/PHVrMV5krSLqY//2CTvF068qDBBlj
haBxgeRbe4pwLZPfFUnWvn6v1rdvNCXzDG/be9jGPJjDcm6wK44VJQWkPbqTsh6O
ZORqvKn48D89W0DegG1B+4jvbietPkhA0+nHQXwsWZ+sfMcEV/AWWsE5FIQ7ucCC
bundBBncUFKMMp9whuhj2W9FO62LUd8OAM7ejis3hfKk9MsQWUy6vrcN1XgRCq47
4I0doB5o+WhsOGMTZMcuhFISCVaCDqbNqGuVbeK0sdonjc1xz0682jLo
=9rq8
-----END PGP SIGNATURE-----
Merge tag 'asoc-v5.1-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: More changes for v5.1
Another batch of changes for ASoC, no big core changes - it's mainly
small fixes and improvements for individual drivers.
- A big refresh and cleanup of the Samsung drivers, fixing a number of
issues which allow the driver to be used with a wider range of
userspaces.
- Fixes for the Intel drivers to make them more standard so less likely
to get bitten by core issues.
- New driver for Cirrus Logic CS35L26.
Fixes the following sparse warnings:
sound/soc/mediatek/mt8183/mt8183-dai-i2s.c:966:5: warning:
symbol 'mt8183_dai_i2s_get_share' was not declared. Should it be static?
sound/soc/mediatek/mt8183/mt8183-dai-i2s.c:986:5: warning:
symbol 'mt8183_dai_i2s_set_priv' was not declared. Should it be static?
Fixes: a94aec035a ("ASoC: mediatek: mt8183: add platform driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.
Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Lots and lots of new drivers so far, a highlight being the MediaTek
BTCVSD which is a driver for a Bluetooth radio chip - the first such
driver we've had upstream. Hopefully we will soon also see a baseband
with an upstream driver!
- Support for only powering up channels that are actively being used.
- Quite a few improvements to simplify the generic card drivers,
especially the merge of the SCU cards into the main generic drivers.
- Lots of fixes for probing on Intel systems, trying to rationalize
things to look more standard from a framework point of view.
- New drivers for Asahi Kasei Microdevices AK4497, Cirrus Logic CS4341,
Google ChromeOS embedded controllers, Ingenic JZ4725B, MediaTek
BTCVSD, MT8183 and MT6358, NXP MICFIL, Rockchip RK3328, Spreadtrum
DMA controllers, Qualcomm WCD9335, Xilinx S/PDIF and PCM formatters.
-----BEGIN PGP SIGNATURE-----
iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlxde0wTHGJyb29uaWVA
a2VybmVsLm9yZwAKCRAk1otyXVSH0JWRB/9aQsLR22dNvKosiitTO/nnnPw/sUiG
cFZsI4G1mFpjXyC2azaY1MQOIjRZY3WDsRjcHtAJUkdJnz8fdyj74mIRoHrQI/yv
qdc7EtV5J0k0DemDQH2z5J7WjrkLg4aQCMT2XIvwrXL44jBv/iVKUE8l08D2AZ6t
hQiVIF/9iBnaJwqfUSKzJaufdd88Onh1dBljLGwZnRDtG9mndpxoi+S9pR6gwSMG
JzbgO4kUXdN95wKPxDsHFZimiSaX4bBo2cr79cisPrvcIKTyMAdtkAoNAcyuRezx
qiN2l4zz6Wxi8TygkBZfmWGKz2/2fMDWLvYwfEnA9PhddlSUZt/P1IPl
=tkEF
-----END PGP SIGNATURE-----
Merge tag 'asoc-v5.1' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v5.1
Lots and lots of new drivers so far, a highlight being the MediaTek
BTCVSD which is a driver for a Bluetooth radio chip - the first such
driver we've had upstream. Hopefully we will soon also see a baseband
with an upstream driver!
- Support for only powering up channels that are actively being used.
- Quite a few improvements to simplify the generic card drivers,
especially the merge of the SCU cards into the main generic drivers.
- Lots of fixes for probing on Intel systems, trying to rationalize
things to look more standard from a framework point of view.
- New drivers for Asahi Kasei Microdevices AK4497, Cirrus Logic CS4341,
Google ChromeOS embedded controllers, Ingenic JZ4725B, MediaTek
BTCVSD, MT8183 and MT6358, NXP MICFIL, Rockchip RK3328, Spreadtrum
DMA controllers, Qualcomm WCD9335, Xilinx S/PDIF and PCM formatters.
snd_pcm_lib_preallocate_pages() and co always succeed, so the error
check is simply redundant. Drop it.
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Acked-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
There is a spelling mistake in a dev_warn message. Fix this.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The driver function for transferring/receiving
BT encoded data to/from BT firmware.
Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
In preparation to remove the node name pointer from struct device_node,
convert printf users to use the %pOFn format specifier.
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: Olivier Moysan <olivier.moysan@st.com>
Cc: Arnaud Pouliquen <arnaud.pouliquen@st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Cc: alsa-devel@alsa-project.org
Cc: linux-stm32@st-md-mailman.stormreply.com
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
commit 7fe072b4df ("ASoC: add for_each_card_prelinks() macro")
added new for_each_card_prelinks() macro, but it had typo.
This patch fixup it
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
To be more readable code, this patch adds
new for_each_card_prelinks() macro, and replace existing code to it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
platform_driver_register will set the .owner field. So it is safe
to remove the redundant assignment.
The issue is detected with the help of Coccinelle.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
ALSA SoC snd_soc_pcm_runtime has snd_soc_dai array for codec_dai.
To be more readable code, this patch adds
new for_each_rtd_codec_dai() macro, and replace existing code to it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
use list_head for sub_dais,
since original sub_dais array is sparsely occupied
Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
add path for hosltess lpbk from ADDA Capture to ADDA Playback
add path for hostless phone call between ADDA DAI and PCM DAI
Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
The new mt6797-afe driver uses some functions in a common file, which
works for a built-in driver but fails for a loadable module:
ERROR: "mtk_afe_pcm_free" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
ERROR: "mtk_afe_add_sub_dai_control" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
ERROR: "mtk_afe_pcm_new" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
ERROR: "mtk_afe_combine_sub_dai" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
ERROR: "mtk_afe_pcm_ops" [sound/soc/mediatek/mt6797/snd-soc-mt6797-afe.ko] undefined!
This exports the five symbols above for modules.
Fixes: b3c702f56b ("ASoC: mt6797: combine DAI to register component")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
In MediaTek SoC chip we have multiple DAI,
such as I2S, ADDA, PCM, etc.
Organize each DAI in to one sub dai,
with its dai driver, controls, widgets, routes.
add mtk_afe_combine_sub_dai() to combine
dai driver from each DAI.
add mtk_afe_add_sub_dai_control() to register
the control, widget, routes to component.
Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
For the sake of uniformity, this patch adds a callback mt2701_afe_pcm_probe()
in mt2701_afe_pcm_dai_component to retrieve the regmap - the canonical way to
obtain the pointer..
Doing so, we could switch to use devm_snd_soc_register_component() to register
the component driver.
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
avoid using snd_soc_platform, which is removed after 4.18
Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
preallocate pages should use platform device,
since we set dma mask for platform device.
Signed-off-by: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Add SPDX identifiers to all remaining files in sound/soc/mediatek/
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This patch adds support for the MT7622 AFE which reuses MT2701 driver.
We also introduce the 'struct mt2701_soc_variants' to differentiate
between the SoC generations as there might be other (existing or future)
chips that use the same binding and driver, then being a little more
abstract could help in the long run.
Cc: Jia Zeng <jia.zeng@mediatek.com>
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Reviewed-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Add MTK_STREAM_NUM to common header and modify related stuff so that
the other SoCs can reuse it.
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Reviewed-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This patch adjusts the mt2701_afe_i2s_ops to simplify the control
logic of the I2S path.
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Reviewed-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Reduce the boilerplate code to retrieve the private data.
No functional change intended.
Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
Reviewed-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
It's not necessary to unregister a component registered
with devm_snd_soc_register_component().
Fixes: f1b5bf0736 ("ASoC: mt2701/mt8173: replace platform to componen")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Now platform can be replaced to component, let's do it.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Garlic Tseng <garlic.tseng@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Now we can replace Codec to Component. Let's do it.
Because Intel/Mediatek platforms are using rt5645/rt5677,
we need to update these all related drivers in same time.
Otherwise compile error/warning happen
rt5645:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 1 -> .idle_bias_on = 0
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
rt5677:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 1 -> .idle_bias_on = 0
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>