Peter Ujfalusi and Mark Brown
36fabc449a
ASoC: SOF: mediatek: mtk-adsp-common: Use guard() for spinlock_irqsave
...
Replace the manual spinlock_irqsave lock/unlock pairs with guard().
Only code refactoring, and no behavior change.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Link: https://patch.msgid.link/20260112101004.7648-6-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2026-01-12 11:21:27 +00:00
Rob Herring (Arm) and Mark Brown
bc163baef5
ASoC: Use of_reserved_mem_region_to_resource() for "memory-region"
...
Use the newly added of_reserved_mem_region_to_resource() function to
handle "memory-region" properties.
Signed-off-by: Rob Herring (Arm) <robh@kernel.org >
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org >
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org >
Link: https://patch.msgid.link/20250703183523.2075276-1-robh@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org >
2025-07-04 13:09:47 +01:00
AngeloGioacchino Del Regno and Mark Brown
24489150c5
ASoC: SOF: mediatek: Commonize duplicated functions
...
In order to reduce duplication, move the ADSP mailbox callbacks
handle_reply(), handle_request(), and other common SOF callbacks
send_msg(), get_bar_index(), pcm_hw_params() and pcm_pointer()
to the mtk-adsp-common.c file.
This cleanup brings no functional differences.
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patch.msgid.link/20250320115300.137410-1-angelogioacchino.delregno@collabora.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2025-03-20 18:56:50 +00:00
Takashi Iwai and Mark Brown
f8d952c5f7
ASoC: SOF: of: Convert to EXPORT_DEV_PM_OPS()
...
Use the newer EXPORT_DEV_PM_OPS() macro together with pm_ptr().
This optimizes slightly when CONFIG_PM is disabled, too.
Cc: sound-open-firmware@alsa-project.org
Signed-off-by: Takashi Iwai <tiwai@suse.de >
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com >
Link: https://patch.msgid.link/20250317095603.20073-80-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org >
2025-03-17 10:14:57 +00:00
Thorsten Blum and Mark Brown
3f75771987
ASoC: SOF: mediatek: Use str_on_off() helper function
...
Remove hard-coded strings by using the str_on_off() helper function.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev >
Link: https://patch.msgid.link/20250204153806.3587-2-thorsten.blum@linux.dev
Signed-off-by: Mark Brown <broonie@kernel.org >
2025-02-05 12:46:01 +00:00
Luoxi Li and Mark Brown
87284832bb
ASoC: use to_platform_device() instead of container_of()
...
Use the to_platform_device() macro where possible.
Signed-off-by: Luoxi Li <lee.lockhey@gmail.com >
Link: https://patch.msgid.link/20250123033937.3587880-1-lee.lockhey@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2025-01-23 11:29:38 +00:00
Peter Zijlstra and Linus Torvalds
cdd30ebb1b
module: Convert symbol namespace to string literal
...
Clean up the existing export namespace code along the same lines of
commit 33def8498f ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org >
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org >
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org >
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2024-12-02 11:34:44 -08:00
Uwe Kleine-König and Mark Brown
130af75b5c
ASoC: Switch back to struct platform_driver::remove()
...
After commit 0edb555a65 ("platform: Make platform_driver::remove()
return void") .remove() is (again) the right callback to implement for
platform drivers.
Convert all drivers below sound/soc to use .remove(), with the eventual
goal to drop struct platform_driver::remove_new(). As .remove() and
.remove_new() have the same prototypes, conversion is done by just
changing the structure member name in the driver initializer.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com >
Link: https://patch.msgid.link/20240909151230.909818-2-u.kleine-koenig@baylibre.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-09-09 18:26:49 +01:00
Albert Jakieła and Mark Brown
c0196faaa9
ASoC: SOF: mediatek: Add missing board compatible
...
Add Google Dojo compatible.
Signed-off-by: Albert Jakieła <jakiela@google.com >
Reviewed-by: Chen-Yu Tsai <wenst@chromium.org >
Link: https://patch.msgid.link/20240809135627.544429-1-jakiela@google.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-08-13 15:46:29 +01:00
Curtis Malainey and Mark Brown
7354eb7f15
ASoC: SOF: Remove libraries from topology lookups
...
Default firmware shipped in open source are not licensed for 3P
libraries, therefore topologies should not reference them.
If a OS wants to use 3P (that they have licensed) then they should use
the appropriate topology override mechanisms.
Fixes: 8a7d5d85ed ("ASoC: SOF: mediatek: mt8195: Add devicetree support to select topologies")
Signed-off-by: Curtis Malainey <cujomalainey@chromium.org >
Cc: Wojciech Macek <wmacek@google.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://patch.msgid.link/20240731212153.921327-1-cujomalainey@chromium.org
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-08-01 12:43:31 +01:00
Christophe JAILLET and Mark Brown
1c75adb22d
ASoC: SOF: mediatek: Constify struct mtk_adsp_ipc_ops
...
'struct mtk_adsp_ipc_ops' is not modified in these drivers.
Constifying this structure moves some data to a read-only section, so
increase overall security.
In order to do it, "struct mtk_adsp_ipc" also needs to be adjusted to this
new const qualifier.
On a x86_64, with allmodconfig:
Before:
======
text data bss dec hex filename
15533 2383 0 17916 45fc sound/soc/sof/mediatek/mt8195/mt8195.o
After:
=====
text data bss dec hex filename
15557 2367 0 17924 4604 sound/soc/sof/mediatek/mt8195/mt8195.o
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr >
Link: https://msgid.link/r/a45d6b2b5ec040ea0fc78fca662c2dca3f13a49f.1718312321.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-06-17 13:08:31 +01:00
Pierre-Louis Bossart and Mark Brown
3ff78451b8
ASoC: SOF: add missing MODULE_DESCRIPTION()
...
MODULE_DESCRIPTION() was optional until it became mandatory and
flagged as an error by 'make W=1'.
Reported-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com >
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://msgid.link/r/20240527194414.166156-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-05-27 21:19:27 +01:00
Takashi Iwai and Mark Brown
9c2f5b6eb8
ASoC: SOF: Use *-y instead of *-objs in Makefile
...
*-objs suffix is reserved rather for (user-space) host programs while
usually *-y suffix is used for kernel drivers (although *-objs works
for that purpose for now).
Let's correct the old usages of *-objs in Makefiles.
Signed-off-by: Takashi Iwai <tiwai@suse.de >
Link: https://lore.kernel.org/r/20240507155540.24815-25-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-05-08 11:39:30 +09:00
Krzysztof Kozlowski and Mark Brown
8b6d678fed
ASoC: SOF: mediatek: mt8195: Constify snd_sof_dsp_ops
...
'struct snd_sof_dsp_ops' is not modified by core code, so it can be made
const for increased code safety.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org >
Link: https://lore.kernel.org/r/20240426-n-const-ops-var-v2-14-e553fe67ae82@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-04-30 00:16:58 +09:00
Krzysztof Kozlowski and Mark Brown
fe80673f59
ASoC: SOF: mediatek: mt8186: Constify snd_sof_dsp_ops
...
'struct snd_sof_dsp_ops' is not modified by core code, so it can be made
const for increased code safety.
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org >
Link: https://lore.kernel.org/r/20240426-n-const-ops-var-v2-13-e553fe67ae82@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org >
2024-04-30 00:16:57 +09:00
Trevor Wu and Mark Brown
a08ee9d00e
ASoC: SOF: mediatek: remove unused variables
...
To prevent confusion on the follow-up platform, it is necessary to
remove any unused variables within the struct mtk_adsp_chip_info.
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com >
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://lore.kernel.org/r/20231103095433.10475-4-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-11-13 00:44:31 +00:00
Trevor Wu and Mark Brown
a4de5a345c
ASoC: SOF: mediatek: mt8186: clean up unused code
...
Since there are some variables that are no longer being used, we remove
the code that was implemented for those variables.
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com >
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://lore.kernel.org/r/20231103095433.10475-3-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-11-13 00:44:30 +00:00
Trevor Wu and Mark Brown
ab47596645
ASoC: SOF: mediatek: mt8195: clean up unused code
...
Since there are some variables that are no longer being used, we remove
the code that was implemented for those variables.
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com >
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://lore.kernel.org/r/20231103095433.10475-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-11-13 00:44:29 +00:00
Pierre-Louis Bossart and Mark Brown
e4d09de391
ASoC: SOF: make .remove callback return void
...
We don't use the returned value and return 0 anyways, let's follow the
example of platform drivers and simplify the definitions.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com >
Reviewed-by: Rander Wang <rander.wang@intel.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com >
Link: https://lore.kernel.org/r/20231012191850.147140-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-10-12 20:28:12 +01:00
Uwe Kleine-König and Mark Brown
52fee5c915
ASoC: SOF: Convert to platform remove callback returning void
...
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
The SOF platform drivers all use either sof_of_remove() or
sof_acpi_remove() which both return zero unconditionally. Change these
functions to return void and the drivers to use .remove_new(). There is
no semantical change.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://lore.kernel.org/r/20231009155945.285537-1-u.kleine-koenig@pengutronix.de
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-10-10 19:21:04 +01:00
Kuninori Morimoto and Mark Brown
80b72082e9
ASoC: sof: mediatek: convert not to use asoc_xxx()
...
ASoC is now unified asoc_xxx() into snd_soc_xxx().
This patch convert asoc_xxx() to snd_soc_xxx().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com >
Link: https://lore.kernel.org/r/87r0n4p8uh.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-09-25 14:16:46 +02:00
Peter Ujfalusi and Mark Brown
0f7e753fc3
ASoC: SOF: mediatek: Use generic names for IPC types
...
Use the new SOF_IPC_TYPE_3 in core code.
No functional changes, just renaming.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com >
Reviewed-by: Rander Wang <rander.wang@intel.com >
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com >
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Link: https://lore.kernel.org/r/20230919104226.32239-9-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-09-19 13:49:12 +01:00
Trevor Wu and Mark Brown
1d54134df4
ASoC: SOF: mediatek: mt8186 modify dram type as non-cache
...
To prevent incorrect access between the host and DSP sides, we need to
modify DRAM as a non-cache memory type. Additionally, we can retrieve
the size of shared DMA from the device tree.
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com >
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com >
Reviewed-by: Kuan-Hsun Cheng <Allen-KH.Cheng@mediatek.com >
Link: https://lore.kernel.org/r/20230803075028.32170-1-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-08-04 13:30:41 +01:00
Trevor Wu and Mark Brown
089adf3370
ASoC: SOF: mediatek: add adsp debug dump
...
Add mt8188 and mt8186 .dbg_dump callback to print some information when
DSP panic occurs.
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com >
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com >
Link: https://lore.kernel.org/r/20230601034939.15802-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-06-01 12:30:44 +01:00
Trevor Wu and Mark Brown
0f3d5585ad
ASoC: SOF: mediatek: add mt8188 audio support
...
Add mt8188 dai driver and specify of_machine to support mt8188 audio.
Signed-off-by: Trevor Wu <trevor.wu@mediatek.com >
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com >
Reviewed-by: Yaochun Hung <yc.hung@mediatek.com >
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com >
Link: https://lore.kernel.org/r/20230523025933.30494-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org >
2023-05-30 13:43:33 +01:00