Commit graph

474 commits

Author SHA1 Message Date
Jiaxin Yu
097e874ad3
ASoC: mediatek: mt8186: add platform driver
Add mt8186 platform and affiliated driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220718162204.26238-3-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-20 17:42:24 +01:00
Chunxu Li
0caf1120c5
ASoC: mediatek: mt8195: extract SOF common code
The functions related to SOF can be reused in different machine drivers,
such as mt8195 or mt8186, so extract the common code to avoid duplication.

Set mtk_soc_card_data which include machine private data and SOF private
data as card drvdata, then the difference between machine private can be
ignored such as mt8195_mt6359_priv or mt8186_mt6366_priv, at the same
time the SOF related code can be reused in different machine drivers.

Signed-off-by: Chunxu Li <chunxu.li@mediatek.com>
Link: https://lore.kernel.org/r/20220715085903.7796-1-chunxu.li@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-18 13:45:16 +01:00
Zhongjun Tan
19bb587f3f
ASoC: mediatek: mt8186: Remove condition with no effect
Remove condition with no effect

Signed-off-by: Zhongjun Tan <tanzhongjun@coolpad.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220708024651.42999-1-hbut_tan@163.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-07-11 12:06:28 +01:00
Fei Shao
6c9e9046e1
ASoC: mediatek: mt8186: Fix mutex double unlock in GPIO request
The lockdep mechanism revealed an unbalanced unlocking on MT8186:

  [    2.993966] WARNING: bad unlock balance detected!
  [    2.993978] -------------------------------------
  [    2.993983] kworker/u16:1/10 is trying to release lock (gpio_request_mutex) at:
  [    2.993994] [<ffffffdcd9adebf8>] mt8186_afe_gpio_request+0xf8/0x210
  [    2.994012] but there are no more locks to release!

The cause is that the mutex will be double unlocked if dai is unknown
during GPIO selection, and this patch fixes it.

Fixes: cfa9a966f1 ("ASoC: mediatek: mt8186: support gpio control in platform driver")

Signed-off-by: Fei Shao <fshao@chromium.org>
Link: https://lore.kernel.org/r/20220617111003.2014395-1-fshao@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-17 18:25:24 +01:00
Charles Keepax
845a215558
ASoC: mediatek: mt8186: Use new direct clock defines
Update this driver to the new direct clock producer/consumer defines. It
appears this driver was added with the inversion taken account of but
still uses the CODEC defines so no inversion of the producer/consumer
is necessary.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220613161552.481337-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-14 09:14:16 +01:00
Mark Brown
d3d8feadcc
Specify clock provider directly to CPU DAIs
Merge series from Charles Keepax <ckeepax@opensource.cirrus.com>:

Currently the set_fmt callback always passes clock provider/consumer
with respect to the CODEC. This made sense when the framework was
directly broken down into platforms and CODECs. However, as things
are now broken down into components which can be connected as either
the CPU or CODEC side of a DAI link it simplifies things if each
side of the link is just told if it is provider or consumer of the
clocks. Making this change allows us to remove one of the last parts
of the ASoC core that needs to know if a driver is a CODEC driver,
where it flips the clock format specifier if a CODEC driver is used on
the CPU side of a DAI link, as well as just being conceptually more
consistent with componentisation.

The basic idea of this patch chain is to change the set_fmt callback
from specifying if the CODEC is provider/consumer into directly
specifying if the component is provider/consumer. To do this we add
some new defines, and then to preserve bisectability, the migration is
done by adding a new callback, converting over all existing CPU side
drivers, converting the core, and then finally reverting back to the
old callback.

Converting the platform drivers makes sense as the existing defines
are from the perspective of the CODEC and there are more CODEC drivers
than platform drivers.

Obviously a fair amount of this patch chain I was only able to build
test, so any testing that can be done would be greatly appreciated.
2022-06-09 11:56:32 +01:00
Colin Ian King
b09654e39c
ASoC: mediatek: mt8186: Fix a handful of spelling mistakes
There are several spelling mistakes in dev_err messages. Fix them.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20220608082338.2083456-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-08 11:26:54 +01:00
Miaoqian Lin
efe2178d1a
ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Fix refcount leak in some error paths.

Fixes: 0f83f9296d ("ASoC: mediatek: Add machine driver for ALC5650 codec")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220603124243.31358-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-07 12:00:44 +01:00
Mark Brown
88406aa6db
ASoC: trivial changes for cppcheck warnings
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

This can probably wait for the next merge window, I found a number of
cppcheck warnings that I didn't see in my last checks. The irony is
that the only really important issue found by cppcheck was on one of
my previous DPCM changes (submitted separately as a fix).
2022-06-07 11:52:12 +01:00
Mark Brown
2822388960
ASoC: Intel: soc-acpi and machine driver updates
Merge series from Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>:

Small updates to add initial tables for MeteorLake, SoundWire machine
driver support for tests without HDMI and RT1019 for consistency on
Chromebooks.
2022-06-07 11:52:07 +01:00
Jiaxin Yu
80d8cad2e9
ASoC: mediatek: mt8186: add misc driver and register definitions
Add mt8186 platform misc driver and data tables/register definitions files.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/20220523132858.22166-14-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:52 +01:00
Jiaxin Yu
cfa9a966f1
ASoC: mediatek: mt8186: support gpio control in platform driver
Add gpio control for all audio interface separately.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/20220523132858.22166-13-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:51 +01:00
Jiaxin Yu
55b423d562
ASoC: mediatek: mt8186: support audio clock control in platform driver
Add audio clock control with CCF interface.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/20220523132858.22166-12-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:50 +01:00
Jiaxin Yu
ae92dcbee8
ASoC: mediatek: mt8186: support tdm in platform driver
Add mt8186 tdm dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/20220523132858.22166-11-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:49 +01:00
Jiaxin Yu
e118015db7
ASoC: mediatek: mt8186: support src in platform driver
Add mt8186 src dai driver

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/20220523132858.22166-10-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:48 +01:00
Jiaxin Yu
920508f9fe
ASoC: mediatek: mt8186: support pcm in platform driver
Add mt8186 pcm dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220523132858.22166-9-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:47 +01:00
Jiaxin Yu
2907d26127
ASoC: mediatek: mt8186: support i2s in platform driver
Add mt8186 i2s dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220523132858.22166-8-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:46 +01:00
Jiaxin Yu
2567ccae91
ASoC: mediatek: mt8186: support hw gain in platform driver
Add mt8186 hw gain dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220523132858.22166-7-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:45 +01:00
Jiaxin Yu
55cac93d27
ASoC: mediatek: mt8186: support hostless in platform driver
Add mt8186 hostless dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220523132858.22166-6-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:44 +01:00
Jiaxin Yu
b65c466220
ASoC: mediatek: mt8186: support adda in platform driver
Add mt8186 adda dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220523132858.22166-5-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:43 +01:00
Jiaxin Yu
58949aa35c
ASoC: mediatek: mt8186: support audsys clock control
Add mt8186 audio cg control. Audio clock gates are registered to
CCF for reference count and clock parent management.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220523132858.22166-4-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 16:00:42 +01:00
Minghao Chi
12ba5ceb4a
ASoC: mediatek: remove unnecessary check of clk_disable_unprepare
Because clk_disable_unprepare already checked NULL clock
parameter, so the additional checks are unnecessary, just remove them.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220602071809.278134-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 12:38:51 +01:00
Miaoqian Lin
7472eb8d7d
ASoC: mt6797-mt6351: Fix refcount leak in mt6797_mt6351_dev_probe
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Add missing of_node_put() to avoid refcount leak.

Fixes: f0ab0bf250 ("ASoC: add mt6797-mt6351 driver and config option")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220603083417.9011-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 12:38:49 +01:00
Miaoqian Lin
ae4f11c1ed
ASoC: mediatek: mt8173: Fix refcount leak in mt8173_rt5650_rt5676_dev_probe
of_parse_phandle() returns a node pointer with refcount
incremented, we should use of_node_put() on it when not need anymore.
Fix missing of_node_put() in error paths.

Fixes: 94319ba10e ("ASoC: mediatek: Use platform_of_node for machine drivers")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220602034144.60159-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 12:38:35 +01:00
Pierre-Louis Bossart
9e9fb5d3f3
ASoC: mediatek: mt8195: simplify error handling
cppcheck warnings:

sound/soc/mediatek/mt8195/mt8195-afe-clk.c:311:9: warning: Identical
condition and return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/mediatek/mt8195/mt8195-afe-clk.c:297:6: note: If condition
'ret' is true, the function will return/exit
 if (ret)
     ^
sound/soc/mediatek/mt8195/mt8195-afe-clk.c:311:9: note: Returning
identical expression 'ret'
 return ret;
        ^
sound/soc/mediatek/mt8195/mt8195-afe-clk.c:341:9: warning: Identical
condition and return expression 'ret', return value is always 0
[identicalConditionAfterEarlyExit]
 return ret;
        ^
sound/soc/mediatek/mt8195/mt8195-afe-clk.c:338:6: note: If condition
'ret' is true, the function will return/exit
if (ret)
     ^
sound/soc/mediatek/mt8195/mt8195-afe-clk.c:341:9: note: Returning
identical expression 'ret'
return ret;
        ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20220520211719.607543-12-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 12:35:17 +01:00
Charles Keepax
00ca2d152e
ASoC: mediatek: Rename set_fmt_new back to set_fmt
Now the core has been migrated across to the new direct clock
specification we can move the drivers back to the normal set_fmt
callback.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220519154318.2153729-41-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 12:34:05 +01:00
Charles Keepax
3af99430f8
ASoC: mediatek: Update to use set_fmt_new callback
As part of updating the core to directly tell drivers if they are clock
provider or consumer update these CPU side drivers to use the new direct
callback.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220519154318.2153729-14-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-06-06 12:33:38 +01:00
YueHaibing
0e63a2be56
ASoC: mediatek: mt8195: Fix build warning without CONFIG_OF
sound/soc/mediatek/mt8195/mt8195-mt6359.c:1639:32: warning: ‘mt8195_mt6359_max98390_rt5682_card’ defined but not used [-Wunused-variable]
 1639 | static struct mt8195_card_data mt8195_mt6359_max98390_rt5682_card = {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/mediatek/mt8195/mt8195-mt6359.c:1634:32: warning: ‘mt8195_mt6359_rt1011_rt5682_card’ defined but not used [-Wunused-variable]
 1634 | static struct mt8195_card_data mt8195_mt6359_rt1011_rt5682_card = {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sound/soc/mediatek/mt8195/mt8195-mt6359.c:1629:32: warning: ‘mt8195_mt6359_rt1019_rt5682_card’ defined but not used [-Wunused-variable]
 1629 | static struct mt8195_card_data mt8195_mt6359_rt1019_rt5682_card = {
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Since all users of this driver do need CONFIG_OF anyway, there is no
need to save a few bytes on kernel builds while CONFIG_OF disabled, so
just remove the #ifdef to fix this warning.

Fixes: 86a6b9c9df ("ASoC: mediatek: mt8195: add machine support for max98390 and rt5682")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20220509120918.9000-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-09 19:04:37 +01:00
Minghao Chi
74eaa8126f
ASoC: mediatek: simplify the return expression of mtk_dai_pcm_prepare()
Simplify the return expression.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
Link: https://lore.kernel.org/r/20220505021808.54337-1-chi.minghao@zte.com.cn
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-05-09 12:48:42 +01:00
Akihiko Odaki
19aed2d6cd
ASoC: soc-card: Create jack kcontrol without pins
snd_soc_card_jack_new() allowed to create jack kcontrol without pins,
but did not create kcontrols. The jack would not have kcontrols if pins
were not going to be added.

This renames the old snd_soc_card_jack_new() to
snd_soc_card_jack_new_pins() for use when pins are provided or will be
added later. The new snd_soc_card_jack_new() appropriately creates a
jack for use without pins and adds a kcontrol.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Link: https://lore.kernel.org/r/20220408041114.6024-1-akihiko.odaki@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-14 17:37:21 +01:00
Mark Brown
7a80167b08
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.
2022-04-08 15:43:43 +01:00
Lv Ruyi
a2c11c5b68
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: 86a6b9c9df ("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>
2022-04-08 15:43:38 +01:00
Jiaxin Yu
6181ab3182
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>
2022-04-08 12:09:51 +01:00
Jiaxin Yu
f8910fb498
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>
2022-04-08 12:09:50 +01:00
Jiaxin Yu
e1e408e60e
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>
2022-04-08 12:09:49 +01:00
Miaoqian Lin
05654431a1
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: 8625c1dbd8 ("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>
2022-04-05 10:44:31 +01:00
Miaoqian Lin
4f4e0454e2
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: 94319ba10e ("ASoC: mediatek: Use platform_of_node for machine drivers")
Fixes: 493433785d ("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>
2022-04-05 10:44:30 +01:00
Trevor Wu
86a6b9c9df
ASoC: mediatek: mt8195: add machine support for max98390 and rt5682
This patch adds support for mt8195 board with mt6359, max98390 and
rt5682.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220324053851.27350-6-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-04 08:39:41 +01:00
Trevor Wu
3a0323c26c
ASoC: mediatek: mt8195: rename card controls
In order to be able to reuse the same configurations in user space,
rename the controls to generic names.

"Headphone Jack" -> "Headphone"
"Speakers" -> "Ext Spk"
"Left Speaker" -> "Left Spk"
"Right Speaker" -> "Right SPk"

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220324053851.27350-5-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-04 08:39:40 +01:00
Trevor Wu
094e30efa4
ASoC: mediatek: mt8195: merge machine driver
Because most functions can be reused in different codec combinations,
mt8195 machine drivers are combined to one common file.

The model and compatible string are used to decide which codecs are
being used.

As a result, We can prevent from copy-paste functions when new codec
combination is introduced.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220324053851.27350-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-04 08:39:38 +01:00
Trevor Wu
4dbc714fe0
ASoC: mediatek: mt8195: revise mt8195-mt6359-rt1019-rt5682.c
Revise driver for the coming driver combination.
There are two major parts including in the patch.
1. Apply some suggested changes used in mt8195-mt6359-rt1011-rt5682.c.
2. Reorder the layout for centralizing the codec related code.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220324053851.27350-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-04-04 08:39:37 +01:00
Miaoqian Lin
c4b7174fe5
ASoC: mediatek: mt8195: Fix error handling in mt8195_mt6359_rt1019_rt5682_dev_probe
The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error path.

Fixes: 082482a502 ("ASoC: mediatek: mt8195: release device_node after snd_soc_register_card")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220316084623.24238-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-16 16:39:25 +00:00
Miaoqian Lin
28a265a1ee
ASoC: mediatek: Fix error handling in mt8183_da7219_max98357_dev_probe
The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
Fix this by calling of_node_put() in error handling too.

Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220316014059.19292-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-16 16:39:20 +00:00
Trevor Wu
f67084148d
ASoC: mediatek: mt8195: add reset controller
Audio hardware is possibly used in the firmware stage, so resetting audio
hardware before regcache records default register values is required.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220308072435.22460-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-11 13:41:12 +00:00
Miaoqian Lin
e45ac7831f
ASoC: mediatek: mt8192-mt6359: Fix error handling in mt8192_mt6359_dev_probe
The device_node pointer is returned by of_parse_phandle()  with refcount
incremented. We should use of_node_put() on it when done.

This function only calls of_node_put() in the regular path.
And it will cause refcount leak in error paths.
Fix this by calling of_node_put() in error handling too.

Fixes: 4e28491a7a ("ASoC: mediatek: mt8192-mt6359: fix device_node leak")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220308015224.23585-1-linmq006@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-08 12:27:59 +00:00
Jiaxin Yu
5ea14bf62e
ASoC: mediatek: mt8183: support wb bt audio
Use "bt-sco-pcm-wb" codec dai driver for wb bt audio.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://lore.kernel.org/r/20220307033056.11463-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-03-08 12:27:53 +00:00
Yang Li
7d642c9c14
ASoC: mediatek: mt8195: Remove unnecessary print function dev_err()
The print function dev_err() is redundant because platform_get_irq()
already prints an error.

Eliminate the follow coccicheck warning:
./sound/soc/mediatek/mt8195/mt8195-afe-pcm.c:3126:2-9: line 3126 is
redundant because platform_get_irq() already prints an error

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220224011046.76904-1-yang.lee@linux.alibaba.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-28 13:33:55 +00:00
Trevor Wu
ff5a90173d
ASoC: mediatek: mt8195: enable apll tuner
Normally, the clock source of audio module is either 26M or APLL1/APLL2,
but APLL1/APLL2 are not the multiple of 26M.

In the patch, APLL1 and APLL2 tuners are enabled to handle sample rate
mismatch when the data path crosses two different clock domains.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20220221055716.18580-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-02-21 13:24:56 +00:00
Julian Braha
579b2c8f72
ASoC: mediatek: fix unmet dependency on GPIOLIB for SND_SOC_DMIC
When SND_SOC_MT8195_MT6359_RT1011_RT5682 is selected,
and GPIOLIB is not selected,
Kbuild gives the following warning:

WARNING: unmet direct dependencies detected for SND_SOC_DMIC
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_MT8195_MT6359_RT1011_RT5682 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y] && SND_SOC_MT8195 [=y] && MTK_PMIC_WRAP [=y]

This is because SND_SOC_MT8195_MT6359_RT1011_RT5682
selects SND_SOC_DMIC without selecting or depending on
GPIOLIB, depsite SND_SOC_DMIC depending on GPIOLIB.

This unmet dependency bug was detected by Kismet,
a static analysis tool for Kconfig. Please advise
if this is not the appropriate solution.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20220117050324.68371-1-julianbraha@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2022-01-19 16:47:37 +00:00
Mark Brown
a155b7526e
ASoC: mediatek: mt8195: repair pcmif BE dai
Merge series from Trevor Wu <trevor.wu@mediatek.com>:

This series of patches repairs some problems for pcmif BE dai.
The unexpected control flow is corrected, and the missing playback
support of DPCM is added.
2021-12-31 14:38:47 +00:00
Mark Brown
8b974c122b
ASoC: Merge fixes
So we can send to Linus.
2021-12-31 13:23:28 +00:00
Trevor Wu
db5e1c209b
ASoC: mediatek: mt8195: add playback support to PCM1_BE dai_link
PCM1_BE should be a dai_link for both playback and capture.
In the patch, the missing DPCM playback support is added.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211230084731.31372-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:20:58 +00:00
Trevor Wu
2355028c0c
ASoC: mediatek: mt8195: correct pcmif BE dai control flow
Originally, the conditions for preventing reentry are not correct.
dai->component->active is not the state specifically for pcmif dai, so it
is not a correct condition to indicate the status of pcmif dai.
On the other hand, snd_soc_dai_stream_actvie() in prepare ops for both
playback and capture possibly return true at the first entry when these
two streams are opened at the same time.

In the patch, I refer to the implementation in mt8192-dai-pcm.c.
Clock and enabling bit for PCMIF are managed by DAPM, and the condition
for prepare ops is replaced by the status of dai widget.

Fixes: 1f95c01911 ("ASoC: mediatek: mt8195: support pcm in platform driver")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211230084731.31372-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-31 13:20:57 +00:00
Trevor Wu
c5ab93e289
ASoC: mediatek: mt8195: update control for RT5682 series
Playback pop is observed and the root cause is the reference clock
provided by MT8195 is diabled before RT5682 finishes the control flow.

To ensure the reference clock supplied to RT5682 is disabled after RT5682
finishes all register controls. We replace BCLK with MCLK for RT5682
reference clock, and makes use of set_bias_level_post to handle MCLK
which guarantees MCLK is off after all RT5682 register access.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211228064821.27865-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-29 12:45:48 +00:00
Tzung-Bi Shih
3667a037e5
ASoC: mediatek: use of_device_get_match_data()
Uses of_device_get_match_data() helper to clean some boilerplate code.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211227062153.3887447-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-29 12:45:45 +00:00
Tzung-Bi Shih
082482a502
ASoC: mediatek: mt8195: release device_node after snd_soc_register_card
Device nodes can be released after components have bound.

Shortens the lifecycle of the device nodes.  Releases the reference
counts after snd_soc_register_card.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211224064719.2031210-5-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:56 +00:00
Tzung-Bi Shih
db3f5abe68
ASoC: mediatek: mt8173: reduce log verbosity in probe()
Eliminates error messages if snd_soc_register_card() failed.  Kernel
emits messages if device probe error anyway.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211224064719.2031210-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:55 +00:00
Tzung-Bi Shih
cb006006fe
ASoC: mediatek: mt8183: fix device_node leak
Fixes the device_node leak.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211224064719.2031210-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:53 +00:00
Tzung-Bi Shih
493433785d
ASoC: mediatek: mt8173: fix device_node leak
Fixes the device_node leak.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211224064719.2031210-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-24 14:06:52 +00:00
Tzung-Bi Shih
4e28491a7a
ASoC: mediatek: mt8192-mt6359: fix device_node leak
The of_parse_phandle() document:
    >>> Use of_node_put() on it when done.

The driver didn't call of_node_put().  Fixes the leak.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211214040028.2992627-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-23 17:36:44 +00:00
Tzung-Bi Shih
98bf33ca3f
ASoC: mediatek: mt8195-mt6359: reduce log verbosity in probe()
Eliminates error messages if snd_soc_register_card() failed.  Kernel
emits messages if device probe error anyway.

This is mainly for removing the following error messages during boot.
    >>> snd_soc_register_card fail -517

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211220093408.207206-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 20:26:53 +00:00
Trevor Wu
30e693ee82
ASoC: mediatek: mt8195: correct default value
mt8195_cg_patch is used to reset the default value of audio cg, so the
register value could be consistent with CCF reference count.
Nevertheless, AUDIO_TOP_CON1[1:0] is used to control an internal mux,
and it's expected to keep the default value 0.

This patch corrects the default value in case an unexpected behavior
happens in the future.

Fixes: 6746cc8582 ("ASoC: mediatek: mt8195: add platform driver")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211216022424.28470-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-20 12:45:17 +00:00
Jiaxin Yu
03c2192ab6
ASoC: mediatek: assign correct type to argument
Fix the following sparse warning: (new ones prefixed by >>)
>> sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33:
     sparse: sparse: incorrect type in argument 3 (different base types)
   sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33: sparse:
     expected unsigned int to
   sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c:370:33: sparse:
     got restricted snd_pcm_format_t [usertype]

Correct discription of format, use S32_LE and S24_LE to distinguish the
different 32bit.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211209073224.21793-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-14 13:22:18 +00:00
Dan Carpenter
9abc21c966
ASoC: mediatek: mt8195: silence uninitialized variable warning
Smatch complains that we might hit the continue path on every iteration
through the loop.

    sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c:831
      mt8195_mt6359_rt1019_rt5682_card_late_probe()
    error: uninitialized symbol 'sof_comp'.

Initialize "sof_comp" to NULL to silence this warning.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20211208151145.GA29257@kili
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-08 15:31:29 +00:00
Mark Brown
6e2127dcb7
ASoC: mediatek: support memory-region assignment
Merge series from Trevor Wu <trevor.wu@mediatek.com>:

This series of patches adds support for memory-region assignment, so the
access region of DMA engine could be restricted.
Patches are based on broonie tree "for-next" branch.

Trevor Wu (2):
  ASoC: mediatek: mt8195: support reserved memory assignment
  dt-bindings: mediatek: mt8195: add memory-region property

 .../devicetree/bindings/sound/mt8195-afe-pcm.yaml         | 8 ++++++++
 sound/soc/mediatek/mt8195/mt8195-afe-pcm.c                | 7 +++++++
 2 files changed, 15 insertions(+)

--
2.18.0
2021-12-06 17:25:00 +00:00
Trevor Wu
3d00d2c07f
ASoC: mediatek: mt8195: add sof support on mt8195-mt6359-rt1019-rt5682
In the patch, widgets, routes and dai-link requrird by SOF are included,
and late_probe is introduced for SOF route connection.

Only when adsp phandle could be retrieved from DTS, the SOF related part
of machine driver is executed.

Additionally, supported dai-links could be specified from DTS, so that
we can disable AP side hardware controls when DSP SOF controls the same
audio FE.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Signed-off-by: YC Hung <yc.hung@mediatek.com>
Link: https://lore.kernel.org/r/20211129141057.12422-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:50:14 +00:00
Trevor Wu
c9d57a25de
ASoC: mediatek: mt8195: add headset codec rt5682s support
mt8195 machine driver adds rt5682s support in this patch.
Card name can be specified from dts by model property, and driver makes
use of the name to distinguish which headset codec is on the board.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211129141057.12422-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:20 +00:00
Trevor Wu
4d408ea028
ASoC: mediatek: mt8195: support reserved memory assignment
For security purpose, restrict the memory assess region of AFE memif.
The specified memory region should be assigned from DTS.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211130053905.28470-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-12-06 13:49:16 +00:00
Colin Ian King
91745b034d
ASoC: mediatek: mt8195: make several arrays static const
Don't populate various arrays on the stack but instead make them
static const. Also makes the object code smaller by a few hundred
bytes.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Link: https://lore.kernel.org/r/20211129224236.506883-1-colin.i.king@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:13 +00:00
Rikard Falkeborn
8752d9a82f
ASoC: mediatek: mt8195: Constify static snd_soc_ops
These are only assigned to the ops field in the snd_soc_dai_link which
is a pointer to const struct snd_soc_ops. Make them const to allow the
compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211127093147.17368-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-30 13:08:08 +00:00
Jiaxin Yu
faf695517c
ASoC: mediatek: remove unnecessary CONFIG_PM
The unnecessary conditional inclusion caused the following warning.

Such as:
>> sound/soc/mediatek/mt8192/mt8192-afe-pcm.c:2368:32: warning: unused
>> variable 'mt8192_afe_pm_ops' [-Wunused-const-variable]
   static const struct dev_pm_ops mt8192_afe_pm_ops = {

Because runtime_pm already handles the case without CONFIG_PM, we
can remove CONFIG_PM condition.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Acked-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211125042422.2349-1-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-25 11:54:28 +00:00
AngeloGioacchino Del Regno
8c32984bc7
ASoC: mediatek: mt8173: Fix debugfs registration for components
When registering the mt8173-afe-pcm driver, we are also adding two
components: one is for the PCM DAIs and one is for the HDMI DAIs, but
when debugfs is enabled, we're getting the following issue:

[   17.279176] debugfs: Directory '11220000.audio-controller' with parent 'mtk-rt5650' already present!
[   17.288345] debugfs: Directory '11220000.audio-controller' with parent 'mtk-rt5650' already present!

To overcome to that without any potentially big rewrite of this driver,
similarly to what was done in mt8195-afe-pcm, add a debugfs_prefix to
the components before actually adding them.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20211111161108.502344-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-12 18:16:44 +00:00
AngeloGioacchino Del Regno
0a8facac0d
ASoC: mediatek: mt8173-rt5650: Rename Speaker control to Ext Spk
Some RT5645 and RT5650 powered platforms are using "Ext Spk"
instead of "Speaker", and this is also reflected in alsa-lib
configurations for the generic RT5645 usecase manager configs.

Rename the "Speaker" control to "Ext Spk" in order to be able
to make the userspace reuse/inherit the same configurations also
for this machine, along with the others.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20211105152013.75252-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-11-05 15:26:39 +00:00
Trevor Wu
0261e36477
ASoC: mediatek: mt8195: add machine driver with mt6359, rt1011 and rt5682
This patch adds support for mt8195 board with mt6359, rt1011 and rt5682.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211020071428.14297-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-29 16:49:47 +01:00
Julian Braha
2554877e4b
ASoC: fix unmet dependencies on GPIOLIB for SND_SOC_RT1015P
When SND_SOC_MT8192_MT6359_RT1015_RT5682,
SND_SOC_MT8192_MT6359_RT1015_RT5682,
SND_SOC_MT8183_DA7219_MAX98357A, or
SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A is selected,
and GPIOLIB is not selected, Kbuild gives the following
warnings, respectively:

WARNING: unmet direct dependencies detected for SND_SOC_DMIC
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_MT8192_MT6359_RT1015_RT5682 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y] && SND_SOC_MT8192 [=y] && MTK_PMIC_WRAP [=y]

WARNING: unmet direct dependencies detected for SND_SOC_RT1015P
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_MT8192_MT6359_RT1015_RT5682 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y] && SND_SOC_MT8192 [=y] && MTK_PMIC_WRAP [=y]

WARNING: unmet direct dependencies detected for SND_SOC_RT1015P
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_MT8183_DA7219_MAX98357A [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && SND_SOC_MT8183 [=y] && I2C [=y]

WARNING: unmet direct dependencies detected for SND_SOC_RT1015P
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
  Selected by [y]:
  - SND_SOC_MT8183_MT6358_TS3A227E_MAX98357A [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y] && SND_SOC_MT8183 [=y]

This is because these config options select SND_SOC_RT1015P
without selecting or depending on GPIOLIB, despite
SND_SOC_RT1015P depending on GPIOLIB.

These unmet dependency bugs were detected by Kismet,
a static analysis tool for Kconfig. Please advise if this
is not the appropriate solution.

Signed-off-by: Julian Braha <julianbraha@gmail.com>
Acked-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20211029001225.27218-1-julianbraha@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-29 12:36:05 +01:00
Pierre-Louis Bossart
439c06f341
ASoC: mediatek: mt8195: fix return value
cppcheck reports the following warning:

sound/soc/mediatek/mt8195/mt8195-dai-etdm.c:1299:10: style: Variable
'ret' is assigned a value that is never used. [unreadVariable]
 int ret = 0;
         ^

The suggested change aligns the implementation of
mt8195_afe_disable_etdm() with mt8195_afe_enable_etdm() - same
negative return value upon error.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211025185933.144327-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-27 11:31:15 +01:00
Pierre-Louis Bossart
73983ad922
ASoC: mediatek: mt8195: rename shadowed array
cppcheck warning:

Checking sound/soc/mediatek/mt8195/mt8195-afe-pcm.c ...
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c:2884:35: style: Local
variable 'irq_data' shadows outer variable [shadowVariable]
  struct mtk_base_irq_data const *irq_data;
                                  ^
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c:2235:39: note: Shadowed declaration
static const struct mtk_base_irq_data irq_data[MT8195_AFE_IRQ_NUM] = {
                                      ^
sound/soc/mediatek/mt8195/mt8195-afe-pcm.c:2884:35: note: Shadow variable
  struct mtk_base_irq_data const *irq_data;
                                  ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211025185933.144327-7-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-27 11:31:14 +01:00
Pierre-Louis Bossart
33fb790fcc
ASoC: mediatek: remove unnecessary initialization
Cppcheck warning:

sound/soc/mediatek/common/mtk-afe-fe-dai.c:353:8: style: Variable 'i'
is assigned a value that is never used. [unreadVariable]
 int i = 0;
       ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211025185933.144327-6-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-27 11:31:12 +01:00
Mark Brown
b8f3b56493 Linux 5.15-rc6
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCAA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmFtDW0eHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiGHDUH+gL+6mKumVgT8HuZ
 r2u7oETr4MCNIPHOkKZ6EYLDcC5jNcBULjs+IVjN3/KXKHdHZg+KU9Uj2gnS44bt
 NBZ1CAGSUAmE4dS2ahzyBaVwfmo9vV+XNOJxhlr5HxPKxMxp67GHqimTn0E3BPoF
 shDKZ52KDGDz6Ae7eVYlZ1Kv3RdgdlNDSoCELzXXK1L69FScp9YU/nKQ1E5nKIFa
 hC4TC1RgQi/Fhv/YdDBsY467lVCLikIWClm04A0zyP5qQIJUhCITkKhdhUrE5uBR
 A8icsDBy//d4Y6BE1/9GCayPNpBg94gpu0zEqBlBw8llTtIGqaxZ7fGr3szXSC25
 qedpPUw=
 =mnCx
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmFtba0ACgkQJNaLcl1U
 h9BE0Af+Kal8qYR8tiTbHildLUldTsS36YhIw+WEjZueX55rOPAbCHf6t3oTpTdz
 dZ9ByH89yKZ892DZfJZ4hYiUNIQOrVRNHVF0+Mr8mjKnuySHtleO/F2NeSam5N0/
 86UHp7MkOylKr1jlgBZfRZdegBw6mwhbFGRw9coOlDsEh+d3WCadRczwvMP2sJ69
 t8bt5RGrLtO6pSksRdtwl3mW7M/f99x3BZwKfPp5eDCUyXGlys3cHUH+ojqF8JZl
 UGt2K0oqpcniW0j99/MjzHOxfz19Hjf0w2b/khk6HkqISaxNyJcs0YW8vpiqwBUc
 xFZqMcSk7Ny7ZeFaw8hD1aeIEYpeBA==
 =AaU+
 -----END PGP SIGNATURE-----

Merge tag 'v5.15-rc6' into asoc-5.16

Linux 5.15-rc6
2021-10-18 13:50:42 +01:00
Rikard Falkeborn
abed054f03
ASoC: mediatek: Constify static snd_soc_ops
These are only assigned to the ops field in the snd_soc_dai_link struct
which is a pointer to const struct snd_soc_ops. Make them const to allow
the compiler to put them in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Link: https://lore.kernel.org/r/20211012205521.14098-1-rikard.falkeborn@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-13 12:59:28 +01:00
Trevor Wu
5245352588
ASoC: mediatek: mt8195: update audsys clock parent name
Because clock names are modified in mediatek CCF driver, sync the updated
clock names to audsys driver.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Message-Id: <20211008070424.14347-1-trevor.wu@mediatek.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-08 17:22:50 +01:00
Trevor Wu
bd8bec1408
ASoC: mediatek: mt8195: move of_node_put to remove function
platforms->of_node and codes->of_node are assigned in probe function,
and of_node_put is called at the end of probe function, because of_node
seems to be not used after probe functon

In this patch, of_node_put is moved to platform remove function in case
of_node is used at any occasions after probe function in the future.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20211001031601.3953-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-10-01 19:35:01 +01:00
Trevor Wu
b05cfb1215
ASoC: mediatek: mt8195: add missing of_node_put in probe
dp node and hdmi node are retrieved from of_parse_phandle(), so using
of_node_put() on them before return.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210928063520.23927-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-28 13:16:25 +01:00
Trevor Wu
3abe2eec87
ASoC: mediatek: mt8195: remove wrong fixup assignment on HDMITX
S24_LE params fixup is only required for DPTX.
Remove fixup ops assignment for HDMITX.

Fixes: 40d605df0a ("ASoC: mediatek: mt8195: add machine driver with mt6359, rt1019 and rt5682")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210917082805.30898-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-17 13:16:35 +01:00
Colin Ian King
ce3f935763
ASoC: mediatek: mt8195: make array adda_dai_list static const
Don't populate the array adda_dai_list on the stack but instead it
static const. Also makes the object code smaller by 33 bytes:

Before:
   text	   data	    bss	    dec	    hex	filename
  28271	  11640	      0	  39911	   9be7	mt8195/mt8195-dai-adda.o

After:
   text	   data	    bss	    dec	    hex	filename
  28142	  11736	      0	  39878	   9bc6	mt8195/mt8195-dai-adda.o

(gcc version 11.2.0)

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210915105027.10805-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-15 13:12:27 +01:00
Bixuan Cui
b2fc2c92d2
ASoC: mediatek: mt8195: Add missing of_node_put()
The platform_node is returned by of_parse_phandle() should have
of_node_put() before return.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
Link: https://lore.kernel.org/r/20210911081246.33867-1-cuibixuan@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-15 13:12:26 +01:00
Trevor Wu
2b9b42c847
ASoC: mt8195: remove unnecessary CONFIG_PM
The unnecessary conditional inclusion caused the following warning.

>> sound/soc/mediatek/mt8195/mt8195-afe-pcm.c:3260:32: warning: unused
>> variable 'mt8195_afe_pm_ops' [-Wunused-const-variable]
   static const struct dev_pm_ops mt8195_afe_pm_ops = {
                                  ^
   1 warning generated.

Because runtime_pm already handles the case without CONFIG_PM, we
can remove CONFIG_PM condition.

Fixes: 6746cc8582 ("ASoC: mediatek: mt8195: add platform driver")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210902071440.6087-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13 01:59:16 +01:00
Colin Ian King
d67bbdda25
ASoC: mediatek: mt8195: Fix unused initialization of pointer etdm_data
The pointer etdm_data is being inintialized with a value that is never
read, it is later being re-assigned a new value. Remove the redundant
initialization.

Addresses-Coverity: ("Unused value")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210903114928.11743-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13 01:59:08 +01:00
Cai Huoqing
c6b1b57469
ASoC: mediatek: mt8195: Make use of the helper function devm_platform_ioremap_resource()
Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Link: https://lore.kernel.org/r/20210901132742.31714-1-caihuoqing@baidu.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13 01:59:05 +01:00
Sebastian Andrzej Siewior
c3815f8bc7
ASoC: mediatek: mt8195: Remove unsued irqs_lock.
irqs_lock is not used, never was.

Remove irqs_lock.

Fixes: 283b612429 ("ASoC: mediatek: implement mediatek common structure")
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: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://lore.kernel.org/r/20210910094847.3430413-1-bigeasy@linutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-13 01:59:02 +01:00
Trevor Wu
1dd0385226
ASoC: mediatek: common: handle NULL case in suspend/resume function
When memory allocation for afe->reg_back_up fails, reg_back_up can't
be used.
Keep the suspend/resume flow but skip register backup when
afe->reg_back_up is NULL, in case illegal memory access happens.

Fixes: 283b612429 ("ASoC: mediatek: implement mediatek common structure")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20210910092613.30188-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-10 15:08:26 +01:00
Trevor Wu
5a80dea931
ASoC: mediatek: add required config dependency
Because SND_SOC_MT8195 depends on COMPILE_TEST, it's possible to build
MT8195 driver in many different config combinations.
Add all dependent config for SND_SOC_MT8195 in case some errors happen
when COMPILE_TEST is enabled.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://lore.kernel.org/r/20210909065533.2114-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-09 14:16:25 +01:00
Trevor Wu
7eac1e24fb
ASoC: mt8195: correct the dts parsing logic about DPTX and HDMITX
According to the description in dt-bindings, phandle assignment of
HDMI TX and DP TX are not required properties, but driver regards them
as required properties.
In real use case, it's expected that DP TX and HDMI TX are optional
features, so correct the behavior in driver.

Fixes: 40d605df0a ("ASoC: mediatek: mt8195: add machine driver with mt6359, rt1019 and rt5682")
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210903060049.20764-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-03 13:31:46 +01:00
Mark Brown
0f2ef911de ASoC: Updates for v5.15
Quite a quiet release this time, mostly a combination of cleanups
 and a good set of new drivers.
 
  - Lots of cleanups and improvements to the Intel drivers,
    including some new systems support.
  - New support for AMD Vangoh, CUI CMM-4030D-261, Mediatek
    Mt8195, Renesas RZ/G2L Mediatek Mt8195, RealTek RT101P,
    Renesas RZ/G2L,, Rockchip RK3568 S/PDIF.
 -----BEGIN PGP SIGNATURE-----
 
 iQFHBAABCgAxFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmEsxhYTHGJyb29uaWVA
 a2VybmVsLm9yZwAKCRAk1otyXVSH0Py1B/0dVvB5iLx7t7Vp3EbxIbAQ/4URpmfV
 A/yIWY6fii6vhVsdsqU+8FN7D5m5ZpVUx+3kH//oCsPL7VLem3sjh64lge1lQz4A
 9G9FU63nSCY8X0dL4cfZTNEd+FYrCHZDqU8y7oJg+v3U7D42MVLhTwySaCuP6W56
 KZhxOUIuyfIrhmkfBEAUCA6jyPSbVAy7Aw9B5WhJhX07yw0vToxnycbTnjwMzMYn
 3Bvfycyg9pqpxAdCuJVPVs3S8+CM5/+QjKb0J6vy1Zuw49jNSUdkvuyRWXZsAoAF
 zepXWEKXvclKNZDR0N1AO4H+9fUeSvkc/IX7XEHZ0Zk8w2eMico0ceAz
 =BHW1
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmEvqq8ACgkQJNaLcl1U
 h9DCWgf+MNGZqiPqneyDMVnZ/ZrjZGy+6o0Zs7NDeD0hDF4t5MAu0meRpyHgfW4N
 vw/AP26M6OQPg/FQpqHySCuVrsEWFABP3jVUl6QBMIsyGS7FKdU7I20awGzn1+fE
 TK2forDsQvxTFA/X9y4JqZIBNCU2FT1WEwamgvFIUh0qR1ZJfHLogN1E8ch7Y17u
 EhDgEiwiD3jWtW5E/6KStwpyEo2zEomN0vN6iLp/DjZRQy/B02F3RtKdH4HIom6n
 kFs6yOyqBAxzi6uUYC4TfIEywWUrxSUtekeo2Sn7ViSbA0QiN44QdXbN43GFUUHq
 c3rzV1+z80mcyYtCAhpjgtbU9nJpUg==
 =Zo3t
 -----END PGP SIGNATURE-----

Merge tag 'asoc-v5.15' into asoc-5.15

ASoC: Updates for v5.15

Quite a quiet release this time, mostly a combination of cleanups
and a good set of new drivers.

 - Lots of cleanups and improvements to the Intel drivers,
   including some new systems support.
 - New support for AMD Vangoh, CUI CMM-4030D-261, Mediatek
   Mt8195, Renesas RZ/G2L Mediatek Mt8195, RealTek RT101P,
   Renesas RZ/G2L,, Rockchip RK3568 S/PDIF.
2021-09-01 17:30:37 +01:00
Geert Uytterhoeven
940ffa1945
ASoC: mediatek: SND_SOC_MT8195 should depend on ARCH_MEDIATEK
The Mediatek MT8195 sound hardware is only present on Mediatek MT8195
SoCs.  Hence add a dependency on ARCH_MEDIATEK, to prevent asking the
user about this driver when configuring a kernel without Mediatek SoC
support.

Fixes: 6746cc8582 ("ASoC: mediatek: mt8195: add platform driver")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/7e628e359bde04ceb9ddd74a45931059b4a4623c.1630415860.git.geert+renesas@glider.be
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-01 16:46:49 +01:00
Trevor Wu
cd5e4efde2
ASoC: mediatek: mt8195: add MTK_PMIC_WRAP dependency
randconfig builds show the warning below,

WARNING: unmet direct dependencies detected for SND_SOC_MT6359
   Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && MTK_PMIC_WRAP [=n]
   Selected by [y]:
   - SND_SOC_MT8195_MT6359_RT1019_RT5682 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y] && SND_SOC_MT8195 [=y]

Add a dependency to avoid it.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Link: https://lore.kernel.org/r/20210831021303.5230-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-09-01 16:26:34 +01:00
Mark Brown
38b7673000
Merge remote-tracking branch 'asoc/for-5.15' into asoc-linus 2021-08-30 12:30:33 +01:00
Colin Ian King
11a08e0507
ASoC: mediatek: mt8195: Fix spelling mistake "bitwiedh" -> "bitwidth"
There is a spelling mistake in a dev_dbg message. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20210826112611.10356-1-colin.king@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-26 13:42:42 +01:00
Trevor Wu
ef46cd42ec
ASoC: mediatek: mt8195: add HDMITX audio support
This patch adds HDMITX audio support on mt8195-mt6359-rt1019-rt5682 board.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-11-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:14:00 +01:00
Trevor Wu
e581e3014c
ASoC: mediatek: mt8195: add DPTX audio support
This patch adds DPTX audio support on mt8195-mt6359-rt1019-rt5682 board.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-10-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:59 +01:00
Trevor Wu
40d605df0a
ASoC: mediatek: mt8195: add machine driver with mt6359, rt1019 and rt5682
This patch adds support for mt8195 board with mt6359, rt1019 and rt5682.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210819084144.18483-9-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:58 +01:00
Trevor Wu
6746cc8582
ASoC: mediatek: mt8195: add platform driver
This patch adds mt8195 platform and affiliated driver.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210819084144.18483-7-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:56 +01:00
Trevor Wu
1f95c01911
ASoC: mediatek: mt8195: support pcm in platform driver
This patch adds mt8195 pcm dai driver.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-6-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:55 +01:00
Trevor Wu
3de3eba588
ASoC: mediatek: mt8195: support adda in platform driver
This patch adds mt8195 adda dai driver.

audio_h clock is used by ADSP bus and ADDA module.
When ADDA requires audio_h clock, it is switched to APLL1, otherwise
it is switched to Xtal_26m so that APLL1 can be turned off when audio
feature is not used.
ADSP bus only requires that the clock is on, so dynamic reparenting
is used for the purpose of lowering power consumption.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-5-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:54 +01:00
Trevor Wu
1de9a54aca
ASoC: mediatek: mt8195: support etdm in platform driver
This patch adds mt8195 tdm/i2s dai driver.

MCLK clock tree is as follows.
PLL -> MUX -> DIVIDER -> MCLK

For PLL source of MCLK, driver only supports APLL1 and APLL2 now.
APLL3 and APLL4 are used to track external clock source, so they are
only used when slave input is connected.

For example,
case 1: (HDMI RX connected)
DL memif (a1sys) -> etdm out2 (clk from apll1/apll2) -> codec
case 2: (HDMI RX disconnected)
HDMI RX -> a3sys -> UL memif (a3sys) -> DL memif (a3sys) -> .... ->
etdm out2 (clk from apll3) -> codec

We keep all modules in the pipeline working on the same clock domain.
MCLK is expected to output the clock generated from the same clock
source as the pipeline, so dynamic reparenting is required for MCLK
configuration.

As a result, clk_set_parent() is used to select PLL source,
and clk_set_rate() is used to configure divider to get MCLK output rate.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:53 +01:00
Trevor Wu
d62ad762f6
ASoC: mediatek: mt8195: support audsys clock control
This patch adds mt8195 audio cg control.
Audio clock gates are registered to CCF for reference count and
clock parent management.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20210819084144.18483-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:52 +01:00
Trevor Wu
cab2b9e5fc
ASoC: mediatek: mt8195: update mediatek common driver
Update mediatek common driver to support MT8195

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/r/20210819084144.18483-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-08-24 19:13:51 +01:00
Gustavo A. R. Silva
4796372e7c ASoC: Mediatek: MT8183: Fix fall-through warning for Clang
Fix the following fallthrough warning:

sound/soc/mediatek/mt8183/mt8183-dai-adda.c:342:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]

Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2021-07-13 14:58:18 -05:00
Zhang Qilong
19f479c37f
ASoC: mediatek: mt8183: Fix Unbalanced pm_runtime_enable in mt8183_afe_pcm_dev_probe
Add missing pm_runtime_disable() when probe error out. It could
avoid pm_runtime implementation complains when removing and probing
again the driver.

Fixes:a94aec035a122 ("ASoC: mediatek: mt8183: add platform driver")

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20210618141104.105047-3-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-11 23:47:35 +01:00
Zhang Qilong
2af2f861ed
ASoC: mediatek: mt8192:Fix Unbalanced pm_runtime_enable in mt8192_afe_pcm_dev_probe
Add missing pm_runtime_disable() when probe error out. It could
avoid pm_runtime implementation complains when removing and probing
again the driver.

Fixes:125ab5d588b0b ("ASoC: mediatek: mt8192: add platform driver")

Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20210618141104.105047-2-zhangqilong3@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-07-11 23:47:34 +01:00
Christophe JAILLET
b6052c3c7a
ASoC: mediatek: mtk-btcvsd: Fix an error handling path in 'mtk_btcvsd_snd_probe()'
If an error occurs after a successful 'of_iomap()' call, it must be undone
by a corresponding 'iounmap()' call, as already done in the remove
function.

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

Fixes: 4bd8597dc3 ("ASoC: mediatek: add btcvsd driver")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/0c2ba562c3364e61bfbd5b3013a99dfa0d9045d7.1622989685.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-06-08 13:36:46 +01:00
Zhen Lei
85c966dc97
ASoC: mediatek: mt8192: Delete a redundant condition branch
The statement of the "if (afe_priv->mtkaif_protocol == MTKAIF_PROTOCOL_2)"
branch is the same as the "else" branch. Delete it to simplify code.

No functional change.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Link: https://lore.kernel.org/r/20210510083640.3368-1-thunder.leizhen@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-05-10 13:05:33 +01:00
Mark Brown
ad858508fd ALSA: control - add generic LED API
This patchset tries to resolve the diversity in the audio LED
 control among the ALSA drivers. A new control layer registration
 is introduced which allows to run additional operations on
 top of the elementary ALSA sound controls.
 
 A new control access group (three bits in the access flags)
 was introduced to carry the LED group information for
 the sound controls. The low-level sound drivers can just
 mark those controls using this access group. This information
 is not exported to the user space, but user space can
 manage the LED sound control associations through sysfs
 (last patch) per Mark's request. It makes things fully
 configurable in the kernel and user space (UCM).
 
 The actual state ('route') evaluation is really easy
 (the minimal value check for all channels / controls / cards).
 If there's more complicated logic for a given hardware,
 the card driver may eventually export a new read-only
 sound control for the LED group and do the logic itself.
 
 The new LED trigger control code is completely separated
 and possibly optional (there's no symbol dependency).
 The full code separation allows eventually to move this
 LED trigger control to the user space in future.
 Actually it replaces the already present functionality
 in the kernel space (HDA drivers) and allows a quick adoption
 for the recent hardware (ASoC codecs including SoundWire).
 
 snd_ctl_led            24576  0
 
 The sound driver implementation is really easy:
 
 1) call snd_ctl_led_request() when control LED layer should be
    automatically activated
    / it calls module_request("snd-ctl-led") on demand /
 2) mark all related kcontrols with
         SNDRV_CTL_ELEM_ACCESS_SPK_LED or
         SNDRV_CTL_ELEM_ACCESS_MIC_LED
 
 Link: https://lore.kernel.org/r/20210317172945.842280-1-perex@perex.cz
 Signed-off-by: Takashi Iwai <tiwai@suse.de>
 -----BEGIN PGP SIGNATURE-----
 
 iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmBjRuQOHHRpd2FpQHN1
 c2UuZGUACgkQLtJE4w1nLE9ZQw/6Ao2X1io4TVnyO/gO8HtwmnZ6TWcrLUlySaep
 H6Suf0RHsOQO9VOaMcUarA3Wnz1vZ44qJ/fkdLTslnIPGSRJDUx15bbb+n2N6pQJ
 gS7Umxy6n73rQyEoDjd3ZorvDGjFSVFpjM+RYjk/Ohq+yziz7nQ/SZuHPPeqm1GU
 C5d9SxyXGdqlJJ6yFCHzbtjSmIey+l1TZ+j3rSSww/CzDKxB2l5J6JZAMUjVdL9b
 J80Mcw0XLdG9iTtEnkUt3TwvLMcMl95UPeQHIkVQlwsRRb3BtHNIwJLPQ/n+Cou7
 Hre3y2miUYHrNICEzMdMlpDzQBqu5wvpXgbgIV0CwAwCXPZBVWE1hVJ9gG0l+r1G
 fy1a75OmEin4V9g8w+wNTWDEgjwAOkWhA67WVjpbvHtd6kEbISzt4JHFksG1rjU2
 vXOIj2VBmQN6zHtxfcZqY8Ge4A7XGo7tAM/3NsUxin+2y7ZXI6sDvv+0esYmqrYr
 9as/tD84L5LTrbUYewaUgEdauQXluQI1egRi7pSeg7hZyLeYYkmszk54Ra3zdlmM
 m7Hr6u+Y/G7yeFdn/WdeG3VzdmxhC2ZFfk3gq0vneBS3WrATbf6nAORp2bwzGSz4
 pUsVLSv+vhpZdSF+IxpUuMnsLkkbUCvFivXLjQ6irSWvp7uts1HWdRowdg7Pe2lC
 FVbFRuA=
 =1uM7
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmBkoFEACgkQJNaLcl1U
 h9BqTgf5AUfR5NbQgJIUMtdMsuz+bthKGuPnpYhYzNUH0io9i3Sjpt0Mbw21dLp2
 nXW+70BH0tJZBGR4DNGpmcpBLH5WPdOR9WIv4vCYy9Pr0uCGGKF/JkGeZAg7/llF
 C3+yDfTnF0AvR+74xbf/LTjBPGja/08PED1ZC00NAkLhE3C0Pa/VQ0NaEtPUULWE
 ZOWboF7hfQUeGzGPTqNp4Cy0/Pzokk6Fvl4kgfrxjNWO7ojIv9mCAvmYbusLW7NU
 3Ph5VGsIuyMeorEoAVOFaBY2nrYG/mFZyzTNWJMgvF1MdeigMPNfbbffrUK0sn6k
 e81zgWbwxboEujQ91/EZU7glIqtb6A==
 =rr4V
 -----END PGP SIGNATURE-----

Merge tag 'mute-led-rework' of https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound into asoc-5.13

ALSA: control - add generic LED API

This patchset tries to resolve the diversity in the audio LED
control among the ALSA drivers. A new control layer registration
is introduced which allows to run additional operations on
top of the elementary ALSA sound controls.

A new control access group (three bits in the access flags)
was introduced to carry the LED group information for
the sound controls. The low-level sound drivers can just
mark those controls using this access group. This information
is not exported to the user space, but user space can
manage the LED sound control associations through sysfs
(last patch) per Mark's request. It makes things fully
configurable in the kernel and user space (UCM).

The actual state ('route') evaluation is really easy
(the minimal value check for all channels / controls / cards).
If there's more complicated logic for a given hardware,
the card driver may eventually export a new read-only
sound control for the LED group and do the logic itself.

The new LED trigger control code is completely separated
and possibly optional (there's no symbol dependency).
The full code separation allows eventually to move this
LED trigger control to the user space in future.
Actually it replaces the already present functionality
in the kernel space (HDA drivers) and allows a quick adoption
for the recent hardware (ASoC codecs including SoundWire).

snd_ctl_led            24576  0

The sound driver implementation is really easy:

1) call snd_ctl_led_request() when control LED layer should be
   automatically activated
   / it calls module_request("snd-ctl-led") on demand /
2) mark all related kcontrols with
        SNDRV_CTL_ELEM_ACCESS_SPK_LED or
        SNDRV_CTL_ELEM_ACCESS_MIC_LED

Link: https://lore.kernel.org/r/20210317172945.842280-1-perex@perex.cz
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2021-03-31 17:16:14 +01:00
Pierre-Louis Bossart
14667403a5
ASoC: mediatek: mt8173: rename local irq variable
cppcheck warning:

sound/soc/mediatek/mt8173/mt8173-afe-pcm.c:929:28: style: Local
variable 'irq' shadows outer argument [shadowArgument]
  struct mtk_base_afe_irq *irq;
                           ^
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c:914:47: note: Shadowed
declaration
static irqreturn_t mt8173_afe_irq_handler(int irq, void *dev_id)
                                              ^
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c:929:28: note: Shadow
variable
  struct mtk_base_afe_irq *irq;
                           ^

Not a great idea to have two 'irq' variables in the same function...

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210311004904.121205-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:29:54 +00:00
Pierre-Louis Bossart
d9cdc13356
ASoC: mediatek: mt2701: rename shadowed array
cppcheck warning:

sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:406:36: style: Local
variable 'memif_data' shadows outer variable [shadowVariable]
 const struct mtk_base_memif_data *memif_data;
                                   ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:977:41: note: Shadowed
declaration
static const struct mtk_base_memif_data memif_data[MT2701_MEMIF_NUM] = {
                                        ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:406:36: note: Shadow
variable
 const struct mtk_base_memif_data *memif_data;
                                   ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:431:36: style: Local
variable 'memif_data' shadows outer variable [shadowVariable]
 const struct mtk_base_memif_data *memif_data;
                                   ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:977:41: note: Shadowed
declaration
static const struct mtk_base_memif_data memif_data[MT2701_MEMIF_NUM] = {
                                        ^
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c:431:36: note: Shadow
variable
 const struct mtk_base_memif_data *memif_data;
                                   ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210311004904.121205-4-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:29:53 +00:00
Pierre-Louis Bossart
57f1379e77
ASoC: mediatek: mt2701: align function prototype
cppcheck warnings:

sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c:102:30:
style:inconclusive: Function 'mt2701_afe_enable_i2s' argument 2 names
different: declaration 'path' definition
'i2s_path'. [funcArgNamesDifferent]
     struct mt2701_i2s_path *i2s_path,
                             ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.h:21:30: note:
Function 'mt2701_afe_enable_i2s' argument 2 names different:
declaration 'path' definition 'i2s_path'.
     struct mt2701_i2s_path *path,
                             ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c:102:30: note:
Function 'mt2701_afe_enable_i2s' argument 2 names different:
declaration 'path' definition 'i2s_path'.

     struct mt2701_i2s_path *i2s_path,
                             ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c:128:32:
style:inconclusive: Function 'mt2701_afe_disable_i2s' argument 2 names
different: declaration 'path' definition
'i2s_path'. [funcArgNamesDifferent]
       struct mt2701_i2s_path *i2s_path,
                               ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.h:24:32: note:
Function 'mt2701_afe_disable_i2s' argument 2 names different:
declaration 'path' definition 'i2s_path'.
       struct mt2701_i2s_path *path,
                               ^
sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c:128:32: note:
Function 'mt2701_afe_disable_i2s' argument 2 names different:
declaration 'path' definition 'i2s_path'.
       struct mt2701_i2s_path *i2s_path,
                               ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210311004904.121205-3-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:29:52 +00:00
Pierre-Louis Bossart
2e5e57f085
ASoC: mediatek: mtk-btcvsd: remove useless assignment
cppcheck warning:

sound/soc/mediatek/common/mtk-btcvsd.c:783:34: style: Variable 'avail'
is assigned a value that is never used. [unreadVariable]
 int written_size = count, avail = 0, cur_write_idx, write_size, cont;
                                 ^

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210311004904.121205-2-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:29:51 +00:00
Jiaxin Yu
8d06b9633a
ASoC: mediatek: mt8192: fix tdm out data is valid on rising edge
This patch correct tdm out bck inverse register to AUDIO_TOP_CON3[3].

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1615516005-781-1-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-12 14:25:32 +00:00
Tzung-Bi Shih
9dc21a066b
ASoC: mediatek: mt8183: support machine driver with rt1015p
Supports machine driver with rt1015p ("mt8183_mt6358_ts3a227_rt1015p").
Embeds in the existing mt8183-mt6358-ts3a227-max98357.c because they
share most of the code.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210311033151.1818603-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-03-11 13:25:07 +00:00
Jiaxin Yu
19657a609b
ASoC: mediatek: mt8183-mt6358: set playback and capture constraints
Sets playback and capture constraints to S16_LE, stereo, 48kHz.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1612513012-27688-1-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-05 15:03:04 +00:00
Mark Brown
2927e6d398
Merge branch 'asoc-5.11' into asoc-5.12 2021-02-05 15:01:21 +00:00
Tzung-Bi Shih
4cceb42f4f
ASoC: mediatek: mt8192-mt6359: simplify ops for Capture1 DAI link
1. Uses rtd->dev to get the device.
2. Generalizes the variable name.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210203032201.2882158-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-04 18:45:18 +00:00
Tzung-Bi Shih
0840706d6c
ASoC: mediatek: mt8192: use asoc_substream_to_rtd()
Uses asoc_substream_to_rtd() helper.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210203032201.2882158-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-04 18:45:17 +00:00
Tzung-Bi Shih
8e59cf943f
ASoC: mediatek: mt8192-mt6359: use asoc_substream_to_rtd()
Uses asoc_substream_to_rtd() helper.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210203032201.2882158-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-02-04 18:45:16 +00:00
Tzung-Bi Shih
339f6c73d5
ASoC: mediatek: mt8192-mt6359: add format constraints for RT5682
MT8192 determines the I2S clock rates according to the sampling rates.

There is only 1 set of I2S in between MT8192 and RT5682.  If playing and
capturing via RT5682 in different sampling rates, the I2S data will be
corrupted.

Adds format constraints to the corresponding DAI links to make sure the
sampling rates are symmetric.

Fixes: 18b13ff23f ("ASoC: mediatek: mt8192: add machine driver with mt6359, rt1015 and rt5682")
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210125061453.1056535-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-25 12:53:44 +00:00
Kuninori Morimoto
4b7ead032e
ASoC: mediatek: sync parameter naming (rate/sample_bits)
This patch syncs naming rule.

 - xxx_rates;
 + xxx_rate;

 - xxx_samplebits;
 + xxx_sample_bits;

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87ft32olha.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-21 12:37:55 +00:00
Tzung-Bi Shih
0d80c48c84
ASoC: mediatek: mt8192-mt6359: support audio over DP
If the DTS property is specified, the DP bridge should populate a
"hdmi-codec" platform device (sound/soc/codecs/hdmi-codec.c).

The "hdmi-codec" device is the communication relayer between the ASoC
machine driver and the DP bridge.  For example:
- Notifies DP bridge when setting hw_param.
- Notifies ASoC when jack detection events.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120080850.699354-6-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:46:51 +00:00
Tzung-Bi Shih
df369921d7
ASoC: mediatek: mt8192: change mclk_multiple of TDM from 128 to 512
mclk = rate * mclk_multiple
bclk = rate * channel * sample_width

If TDM outputs 8 channels and 32 bits, bclk will be greater than mclk.

Changes the ratio from 128 to 512.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120080850.699354-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:46:50 +00:00
Tzung-Bi Shih
12295ef970
ASoC: mediatek: mt8192-mt6359: simplify mt8192_rt5682_init
Returns snd_soc_component_set_jack() directly in mt8192_rt5682_init.
No need to have another block to check the return value.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120080850.699354-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:46:49 +00:00
Tzung-Bi Shih
4e37528a97
ASoC: mediatek: mt8192-mt6359: move headset_jack to card specific data
Moves headset_jack to card specific data.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120080850.699354-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:46:48 +00:00
Tzung-Bi Shih
4d36ed8eb0
ASoC: mediatek: mt8183-da7219: ignore TDM DAI link by default
hdmi-codec is an optional property.  Ignore to bind TDM DAI link
if the property isn't specified.

Fixes: 5bdbe97711 ("ASoC: mediatek: mt8183-da7219: use hdmi-codec")
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120092237.1553938-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:45:34 +00:00
Tzung-Bi Shih
5ac154443e
ASoC: mediatek: mt8183-mt6358: ignore TDM DAI link by default
hdmi-codec is an optional property.  Ignore to bind TDM DAI link
if the property isn't specified.

Fixes: f2024dc55f ("ASoC: mediatek: mt8183: use hdmi-codec")
Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20210120092237.1553938-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-20 18:45:33 +00:00
Tzung-Bi Shih
81a6320da7
ASoC: rt1015: remove bclk_ratio
bclk_ratio is unused.  Removes bclk_ratio and .set_bclk_ratio callback.

Removes snd_soc_dai_set_bclk_ratio() in a few machine drivers which are
obviously using rt1015.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201224101854.3024823-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2021-01-05 14:34:18 +00:00
Arnd Bergmann
c1cbbea9c4
ASoC: mediatek: add MTK_PMIC_WRAP dependency
Randconfig builds often show harmless warnings like

WARNING: unmet direct dependencies detected for SND_SOC_MT6359
  Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && MTK_PMIC_WRAP [=n]
  Selected by [y]:
  - SND_SOC_MT8192_MT6359_RT1015_RT5682 [=y] && SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && I2C [=y] && SND_SOC_MT8192 [=y]

Add a dependency to avoid that.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201230154345.639122-1-arnd@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-31 13:26:25 +00:00
Dan Carpenter
1688dbe7a7
ASoC: mediatek: mt8183: delete some unreachable code
This has a goto followed by an unreachable return statement.  The goto
is correct because it cleans up so the current runtime behavior is fine.
Let's delete the unreachable return statement.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/X9NFg3KVm16Gx6Io@mwanda
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-11 13:23:02 +00:00
Tzung-Bi Shih
de96bd7b7e
ASoC: mediatek: mt8183: add PM ops to machine drivers
Adds PM ops to machine drivers so that they notify components in the
sound card when system suspend.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201211051334.2313899-1-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-11 13:23:01 +00:00
Tzung-Bi Shih
cfd8bb254c
ASoC: mediatek: mt8192: support rt1015p_rt5682
Supports machines with rt1015p and rt5682.  Uses new proposed compatible
string "mt8192_mt6359_rt1015p_rt5682".

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201201132614.1691352-7-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-02 13:35:28 +00:00
Tzung-Bi Shih
ba499c36d1
ASoC: mediatek: mt8192: move rt1015_rt5682 specific data
Moves rt1015_rt5682 specific data right before the snd_soc_card
definition for neat purpose.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201201132614.1691352-4-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-02 13:35:25 +00:00
Tzung-Bi Shih
2b53d2e16f
ASoC: mediatek: mt8192: extract rt1015_rt5682 specific DAI link
Extracts rt1015_rt5682 specific DAI link from the common one.  Fills the
DAI link data according to of_match.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201201132614.1691352-3-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-02 13:35:24 +00:00
Tzung-Bi Shih
a5f8037505
ASoC: mediatek: mt8192: rename common symbols
Renames common symbols from "mt8192_mt6359_rt1015_rt5682" to
"mt8192_mt6359".

They will share between a few machine drivers on MT8192 and MT6359
with some different audio components.

Signed-off-by: Tzung-Bi Shih <tzungbi@google.com>
Link: https://lore.kernel.org/r/20201201132614.1691352-2-tzungbi@google.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-12-02 13:35:23 +00:00
Mark Brown
e5879d9882
Merge branch 'for-5.10' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-5.11 2020-11-30 16:05:07 +00:00
Lumi Lee
bbe1f69dce
ASoC: mediatek: btcvsd fix tx stream assign
Fix tx/rx stream assign in write.
Write should use tx instead of rx.

Signed-off-by: Lumi Lee <lumi.lee@mediatek.com>
Link: https://lore.kernel.org/r/1606705875-1940-1-git-send-email-Lumi.Lee@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-30 12:52:48 +00:00
Jiaxin Yu
2aff94e47d
ASoC: mediatek: mt8192: skip first time data at the beginning of DMIC recording
We can choose to drop away any length of data from the beginning according
to project needs. Some projects don't want to throw away any data, because
they want to use recorded data to do echo cancellation, so they have to
make sure that they are aligned with the reference data as much as
possible. Or there are other algorithms in the upper layer to eliminate
this noise. Or some projects want to eliminate this noise form the kernel
layer. However, the minimum recommended value is 50ms to skip pop noise.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1605062722-8711-1-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-11 12:35:12 +00:00
Zou Wei
df3d6390fa
ASoC: mediatek: mt8192: Make some symbols static
Fix the following sparse warnings:

./mt8192-dai-i2s.c:2040:5: warning: symbol 'mt8192_dai_i2s_get_share' was not declared. Should it be static?
./mt8192-dai-i2s.c:2060:5: warning: symbol 'mt8192_dai_i2s_set_priv' was not declared. Should it be static?
./mt8192-afe-gpio.c:15:16: warning: symbol 'aud_pinctrl' was not declared. Should it be static?
./mt8192-afe-pcm.c:70:5: warning: symbol 'mt8192_get_memif_pbuf_size' was not declared. Should it be static?
./mt8192-afe-pcm.c:2137:39: warning: symbol 'mt8192_afe_component' was not declared. Should it be static?

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Acked-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1604579287-25251-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-05 14:52:32 +00:00
Sudip Mukherjee
8bfe8c9675
ASoC: mediatek: mt8192: Fix build failure
A build of arm64 allmodconfig with next-20201105 fails with the error:
ERROR: modpost: "mt8192_afe_gpio_request" undefined!
ERROR: modpost: "mt8192_afe_gpio_init" undefined!

Export the symbols so that mt8192-mt6359-rt1015-rt5682.ko finds it.

Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Link: https://lore.kernel.org/r/20201105124747.18383-1-sudipm.mukherjee@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-05 14:52:31 +00:00
Jiaxin Yu
18b13ff23f
ASoC: mediatek: mt8192: add machine driver with mt6359, rt1015 and rt5682
This patch adds support for the machine board with mt6359, rt1015
and rt5682.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1604390378-23993-9-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-04 17:51:52 +00:00
Jiaxin Yu
52fcd65414
ASoC: mediatek: mt8192: support tdm in platform driver
This patch adds mt8192 tdm dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1604390378-23993-7-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-04 17:51:50 +00:00
Jiaxin Yu
c63b786601
ASoC: mediatek: mt8192: support pcm in platform driver
This patch adds mt8192 pcm dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1604390378-23993-6-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-04 17:51:49 +00:00
Jiaxin Yu
607ac48595
ASoC: mediatek: mt8192: support adda in platform driver
This patch adds mt8192 adda dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1604390378-23993-5-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-04 17:51:48 +00:00
Jiaxin Yu
2c37b4ed73
ASoC: mediatek: mt8192: support i2s in platform driver
This patch adds mt8192 i2s dai driver.

Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/1604390378-23993-4-git-send-email-jiaxin.yu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-11-04 17:51:47 +00:00