* [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
@ 2025-04-24 10:24 Chen-Yu Tsai
2025-04-24 10:24 ` [PATCH v2 01/13] ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema Chen-Yu Tsai
` (14 more replies)
0 siblings, 15 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:24 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
Hi everyone,
This is v2 of what was just a single patch "ASoC: mediatek: re-enable
buffer pre-allocation on some platforms". Link to v1:
https://lore.kernel.org/all/20250401085659.1222008-1-wenst@chromium.org/
Angelo requested that these platforms use reserved memory regions if
possible, and fall back to pre-allocated buffers only if that fails,
to align with other MediaTek SoCs / platforms that already use reserved
memory. The series covers MediaTek's MT8173, MT8183, MT8186, and MT8192
SoCs.
There are three parts to the series:
- Part one (patches 1 through 5) update the DT bindings to allow having
a memory region. The text binding for the MT8173 was converted to YAML
and also aligned with current usage by addition of a power domain.
Note that the MT8183 text binding was _not_ converted. It is
drastically different from what was landed in the device trees. Some
time is needed to work out the differences. I might try to recombine
the audio clocks (which are actually part of the same hardware block)
as well.
- Part two (patches 6 through 9) update the audio frontend drivers for
the various platforms covered in this series.
- Patch 6 is the evolution of version 1, now defaulting to reserved
memory if possible.
- Patch 7 adds support for >32 bit DMA addresses to the MT8183 driver.
This was missing, and prevents the memory regions, which are
allocated from the top end of main memory by default, from working.
- Patch 8 and 9 are just some minor cleanups to reduce the number of
"&pdev->dev" style dereferences. They are placed after the other
changes to make it easier for the fixes to be backported.
- Part three (patches 10 through 13) add a reserved memory region for
the audio frontend on the various platforms.
For the MT8173, the change covers the whole platform. In practice
there are only ChromeOS devices.
For the other platforms, only the ChromeOS devices are covered. These
are what I have available for testing.
Please have a look. I assume the DT binding and driver changes will go
through the ASoC tree, while the device tree changes will go through the
MediaTek tree.
Thanks
ChenYu
Chen-Yu Tsai (13):
ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema
ASoC: dt-bindings: mt8173-afe-pcm: Add power domain
ASoC: dt-bindings: mt8173-afe-pcm: Allow specifying reserved memory
region
ASoC: dt-bindings: mt8186-afe-pcm: Allow specifying reserved memory
region
ASoC: dt-bindings: mt8192-afe-pcm: Allow specifying reserved memory
region
ASoC: mediatek: use reserved memory or enable buffer pre-allocation
ASoC: mediatek: mt8183-afe-pcm: Support >32 bit DMA addresses
ASoC: mediatek: mt8173-afe-pcm: use local `dev` pointer in driver
callbacks
ASoC: mediatek: mt8183-afe-pcm: use local `dev` pointer in driver
callbacks
arm64: dts: mediatek: mt8173: Reserve memory for audio frontend
arm64: dts: mediatek: mt8183-kukui: Reserve memory for audio frontend
arm64: dts: mediatek: mt8186-corsola: Reserve memory for audio
frontend
arm64: dts: mediatek: mt8192-asurada: Reserve memory for audio
frontend
.../sound/mediatek,mt8173-afe-pcm.yaml | 98 +++++++++++++++++++
.../bindings/sound/mt8186-afe-pcm.yaml | 5 +
.../bindings/sound/mt8192-afe-pcm.yaml | 5 +
.../devicetree/bindings/sound/mtk-afe-pcm.txt | 45 ---------
arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 ++
.../arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 11 +++
.../boot/dts/mediatek/mt8186-corsola.dtsi | 8 ++
.../boot/dts/mediatek/mt8192-asurada.dtsi | 11 +++
.../mediatek/common/mtk-afe-platform-driver.c | 4 +-
sound/soc/mediatek/common/mtk-base-afe.h | 1 +
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 66 +++++++------
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 83 ++++++++++++----
sound/soc/mediatek/mt8186/mt8186-afe-pcm.c | 7 ++
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 7 ++
14 files changed, 266 insertions(+), 94 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/mtk-afe-pcm.txt
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH v2 01/13] ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
@ 2025-04-24 10:24 ` Chen-Yu Tsai
2025-04-28 7:24 ` Krzysztof Kozlowski
2025-04-24 10:24 ` [PATCH v2 02/13] ASoC: dt-bindings: mt8173-afe-pcm: Add power domain Chen-Yu Tsai
` (13 subsequent siblings)
14 siblings, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:24 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel, Trevor Wu
Convert the MT8173 AFE (audio frontend) binding from text to dt-schema
in YAML. "clocks" is added to the list of required properties to match
"clock-names". And the example was slightly fixed up in style. Otherwise
everything is as before.
A contributer and maintainer for a recently added MediaTek audio binding
was chosen instead of the original submitter.
Cc: Trevor Wu <trevor.wu@mediatek.com>
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
.../sound/mediatek,mt8173-afe-pcm.yaml | 87 +++++++++++++++++++
.../devicetree/bindings/sound/mtk-afe-pcm.txt | 45 ----------
2 files changed, 87 insertions(+), 45 deletions(-)
create mode 100644 Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
delete mode 100644 Documentation/devicetree/bindings/sound/mtk-afe-pcm.txt
diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
new file mode 100644
index 000000000000..a95215ba6361
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
@@ -0,0 +1,87 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/mediatek,mt8173-afe-pcm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Mediatek AFE PCM controller for MT8173
+
+maintainers:
+ - Trevor Wu <trevor.wu@mediatek.com>
+
+properties:
+ compatible:
+ const: mediatek,mt8173-afe-pcm
+
+ reg:
+ maxItems: 1
+
+ interrupts:
+ maxItems: 1
+
+ clocks:
+ items:
+ - description: audio infra sys clock
+ - description: audio top mux
+ - description: audio intbus mux
+ - description: apll1 clock
+ - description: apll2 clock
+ - description: i2s0 mclk mux
+ - description: i2s1 mclk mux
+ - description: i2s2 mclk mux
+ - description: i2s3 mclk mux
+ - description: i2s3 bclk mux
+
+ clock-names:
+ items:
+ - const: infra_sys_audio_clk
+ - const: top_pdn_audio
+ - const: top_pdn_aud_intbus
+ - const: bck0
+ - const: bck1
+ - const: i2s0_m
+ - const: i2s1_m
+ - const: i2s2_m
+ - const: i2s3_m
+ - const: i2s3_b
+
+required:
+ - compatible
+ - reg
+ - interrupts
+ - clocks
+ - clock-names
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/clock/mt8173-clk.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/interrupt-controller/irq.h>
+
+ mt8173-afe-pcm@11220000 {
+ compatible = "mediatek,mt8173-afe-pcm";
+ reg = <0x11220000 0x1000>;
+ interrupts = <GIC_SPI 134 IRQ_TYPE_EDGE_FALLING>;
+ clocks = <&infracfg CLK_INFRA_AUDIO>,
+ <&topckgen CLK_TOP_AUDIO_SEL>,
+ <&topckgen CLK_TOP_AUD_INTBUS_SEL>,
+ <&topckgen CLK_TOP_APLL1_DIV0>,
+ <&topckgen CLK_TOP_APLL2_DIV0>,
+ <&topckgen CLK_TOP_I2S0_M_SEL>,
+ <&topckgen CLK_TOP_I2S1_M_SEL>,
+ <&topckgen CLK_TOP_I2S2_M_SEL>,
+ <&topckgen CLK_TOP_I2S3_M_SEL>,
+ <&topckgen CLK_TOP_I2S3_B_SEL>;
+ clock-names = "infra_sys_audio_clk",
+ "top_pdn_audio",
+ "top_pdn_aud_intbus",
+ "bck0",
+ "bck1",
+ "i2s0_m",
+ "i2s1_m",
+ "i2s2_m",
+ "i2s3_m",
+ "i2s3_b";
+ };
diff --git a/Documentation/devicetree/bindings/sound/mtk-afe-pcm.txt b/Documentation/devicetree/bindings/sound/mtk-afe-pcm.txt
deleted file mode 100644
index e302c7f43b95..000000000000
--- a/Documentation/devicetree/bindings/sound/mtk-afe-pcm.txt
+++ /dev/null
@@ -1,45 +0,0 @@
-Mediatek AFE PCM controller
-
-Required properties:
-- compatible = "mediatek,mt8173-afe-pcm";
-- reg: register location and size
-- interrupts: Should contain AFE interrupt
-- clock-names: should have these clock names:
- "infra_sys_audio_clk",
- "top_pdn_audio",
- "top_pdn_aud_intbus",
- "bck0",
- "bck1",
- "i2s0_m",
- "i2s1_m",
- "i2s2_m",
- "i2s3_m",
- "i2s3_b";
-
-Example:
-
- afe: mt8173-afe-pcm@11220000 {
- compatible = "mediatek,mt8173-afe-pcm";
- reg = <0 0x11220000 0 0x1000>;
- interrupts = <GIC_SPI 134 IRQ_TYPE_EDGE_FALLING>;
- clocks = <&infracfg INFRA_AUDIO>,
- <&topckgen TOP_AUDIO_SEL>,
- <&topckgen TOP_AUD_INTBUS_SEL>,
- <&topckgen TOP_APLL1_DIV0>,
- <&topckgen TOP_APLL2_DIV0>,
- <&topckgen TOP_I2S0_M_CK_SEL>,
- <&topckgen TOP_I2S1_M_CK_SEL>,
- <&topckgen TOP_I2S2_M_CK_SEL>,
- <&topckgen TOP_I2S3_M_CK_SEL>,
- <&topckgen TOP_I2S3_B_CK_SEL>;
- clock-names = "infra_sys_audio_clk",
- "top_pdn_audio",
- "top_pdn_aud_intbus",
- "bck0",
- "bck1",
- "i2s0_m",
- "i2s1_m",
- "i2s2_m",
- "i2s3_m",
- "i2s3_b";
- };
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 02/13] ASoC: dt-bindings: mt8173-afe-pcm: Add power domain
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
2025-04-24 10:24 ` [PATCH v2 01/13] ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema Chen-Yu Tsai
@ 2025-04-24 10:24 ` Chen-Yu Tsai
2025-05-09 18:08 ` Rob Herring (Arm)
2025-04-24 10:24 ` [PATCH v2 03/13] ASoC: dt-bindings: mt8173-afe-pcm: Allow specifying reserved memory region Chen-Yu Tsai
` (12 subsequent siblings)
14 siblings, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:24 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
The audio subsystem sits under a controllable power domain.
Add it to the binding.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
.../devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
index a95215ba6361..666408d32f5c 100644
--- a/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
+++ b/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
@@ -45,12 +45,16 @@ properties:
- const: i2s3_m
- const: i2s3_b
+ power-domains:
+ maxItems: 1
+
required:
- compatible
- reg
- interrupts
- clocks
- clock-names
+ - power-domains
additionalProperties: false
@@ -59,11 +63,13 @@ examples:
#include <dt-bindings/clock/mt8173-clk.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/power/mt8173-power.h>
mt8173-afe-pcm@11220000 {
compatible = "mediatek,mt8173-afe-pcm";
reg = <0x11220000 0x1000>;
interrupts = <GIC_SPI 134 IRQ_TYPE_EDGE_FALLING>;
+ power-domains = <&spm MT8173_POWER_DOMAIN_AUDIO>;
clocks = <&infracfg CLK_INFRA_AUDIO>,
<&topckgen CLK_TOP_AUDIO_SEL>,
<&topckgen CLK_TOP_AUD_INTBUS_SEL>,
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 03/13] ASoC: dt-bindings: mt8173-afe-pcm: Allow specifying reserved memory region
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
2025-04-24 10:24 ` [PATCH v2 01/13] ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema Chen-Yu Tsai
2025-04-24 10:24 ` [PATCH v2 02/13] ASoC: dt-bindings: mt8173-afe-pcm: Add power domain Chen-Yu Tsai
@ 2025-04-24 10:24 ` Chen-Yu Tsai
2025-05-09 18:08 ` Rob Herring (Arm)
2025-04-24 10:24 ` [PATCH v2 04/13] ASoC: dt-bindings: mt8186-afe-pcm: " Chen-Yu Tsai
` (11 subsequent siblings)
14 siblings, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:24 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
It is desirable to reserve memory for the audio frontend.
Allow the "memory-region" property, to be used to point to a reserved
memory region.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
.../devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
index 666408d32f5c..d8993b5d457a 100644
--- a/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
+++ b/Documentation/devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml
@@ -48,6 +48,10 @@ properties:
power-domains:
maxItems: 1
+ memory-region:
+ description: memory region for audio DMA buffers
+ maxItems: 1
+
required:
- compatible
- reg
@@ -90,4 +94,5 @@ examples:
"i2s2_m",
"i2s3_m",
"i2s3_b";
+ memory-region = <&afe_dma_mem>;
};
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 04/13] ASoC: dt-bindings: mt8186-afe-pcm: Allow specifying reserved memory region
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (2 preceding siblings ...)
2025-04-24 10:24 ` [PATCH v2 03/13] ASoC: dt-bindings: mt8173-afe-pcm: Allow specifying reserved memory region Chen-Yu Tsai
@ 2025-04-24 10:24 ` Chen-Yu Tsai
2025-05-09 18:08 ` Rob Herring (Arm)
2025-04-24 10:24 ` [PATCH v2 05/13] ASoC: dt-bindings: mt8192-afe-pcm: " Chen-Yu Tsai
` (10 subsequent siblings)
14 siblings, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:24 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
It is desirable to reserve memory for the audio frontend.
Allow the "memory-region" property, to be used to point to a reserved
memory region.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Documentation/devicetree/bindings/sound/mt8186-afe-pcm.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/mt8186-afe-pcm.yaml b/Documentation/devicetree/bindings/sound/mt8186-afe-pcm.yaml
index 7fe85b08f9df..f5af2cf18158 100644
--- a/Documentation/devicetree/bindings/sound/mt8186-afe-pcm.yaml
+++ b/Documentation/devicetree/bindings/sound/mt8186-afe-pcm.yaml
@@ -25,6 +25,10 @@ properties:
reset-names:
const: audiosys
+ memory-region:
+ description: memory region for audio DMA buffers
+ maxItems: 1
+
mediatek,apmixedsys:
$ref: /schemas/types.yaml#/definitions/phandle
description: The phandle of the mediatek apmixedsys controller
@@ -170,6 +174,7 @@ examples:
"top_apll12_div_tdm",
"top_mux_audio_h",
"top_clk26m_clk";
+ memory-region = <&afe_dma_mem>;
};
...
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 05/13] ASoC: dt-bindings: mt8192-afe-pcm: Allow specifying reserved memory region
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (3 preceding siblings ...)
2025-04-24 10:24 ` [PATCH v2 04/13] ASoC: dt-bindings: mt8186-afe-pcm: " Chen-Yu Tsai
@ 2025-04-24 10:24 ` Chen-Yu Tsai
2025-05-09 18:09 ` Rob Herring (Arm)
2025-04-24 10:25 ` [PATCH v2 06/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (9 subsequent siblings)
14 siblings, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:24 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
It is desirable to reserve memory for the audio frontend.
Allow the "memory-region" property, to be used to point to a reserved
memory region.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
Documentation/devicetree/bindings/sound/mt8192-afe-pcm.yaml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/sound/mt8192-afe-pcm.yaml b/Documentation/devicetree/bindings/sound/mt8192-afe-pcm.yaml
index 064ef172bef4..8ddf49b0040d 100644
--- a/Documentation/devicetree/bindings/sound/mt8192-afe-pcm.yaml
+++ b/Documentation/devicetree/bindings/sound/mt8192-afe-pcm.yaml
@@ -23,6 +23,10 @@ properties:
reset-names:
const: audiosys
+ memory-region:
+ description: memory region for audio DMA buffers
+ maxItems: 1
+
mediatek,apmixedsys:
$ref: /schemas/types.yaml#/definitions/phandle
description: The phandle of the mediatek apmixedsys controller
@@ -95,6 +99,7 @@ examples:
"aud_dac_predis_clk",
"aud_infra_clk",
"aud_infra_26m_clk";
+ memory-region = <&afe_dma_mem>;
};
...
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 06/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (4 preceding siblings ...)
2025-04-24 10:24 ` [PATCH v2 05/13] ASoC: dt-bindings: mt8192-afe-pcm: " Chen-Yu Tsai
@ 2025-04-24 10:25 ` Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 07/13] ASoC: mediatek: mt8183-afe-pcm: Support >32 bit DMA addresses Chen-Yu Tsai
` (8 subsequent siblings)
14 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:25 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
In commit 32c9c06adb5b ("ASoC: mediatek: disable buffer pre-allocation")
buffer pre-allocation was disabled to accommodate newer platforms that
have a limited reserved memory region for the audio frontend.
Turns out disabling pre-allocation across the board impacts platforms
that don't have this reserved memory region. Buffer allocation failures
have been observed on MT8173 and MT8183 based Chromebooks under low
memory conditions, which results in no audio playback for the user.
Since some MediaTek platforms already have dedicated reserved memory
pools for the audio frontend, the plan is to enable this for all of
them. This requires device tree changes. As a fallback, reinstate the
original policy of pre-allocating audio buffers at probe time of the
reserved memory pool cannot be found or used.
This patch covers the MT8173, MT8183, MT8186 and MT8192 platforms for
now, the reason being that existing MediaTek platform drivers that
supported reserved memory were all platforms that mainly supported
ChromeOS, and is also the set of devices that I can verify.
Fixes: 32c9c06adb5b ("ASoC: mediatek: disable buffer pre-allocation")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
sound/soc/mediatek/common/mtk-afe-platform-driver.c | 4 +++-
sound/soc/mediatek/common/mtk-base-afe.h | 1 +
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 7 +++++++
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 7 +++++++
sound/soc/mediatek/mt8186/mt8186-afe-pcm.c | 7 +++++++
sound/soc/mediatek/mt8192/mt8192-afe-pcm.c | 7 +++++++
6 files changed, 32 insertions(+), 1 deletion(-)
diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c
index 6b6330583941..70fd05d5ff48 100644
--- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c
+++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c
@@ -120,7 +120,9 @@ int mtk_afe_pcm_new(struct snd_soc_component *component,
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
size = afe->mtk_afe_hardware->buffer_bytes_max;
- snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, afe->dev, 0, size);
+ snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, afe->dev,
+ afe->preallocate_buffers ? size : 0,
+ size);
return 0;
}
diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h
index f51578b6c50a..a406f2e3e7a8 100644
--- a/sound/soc/mediatek/common/mtk-base-afe.h
+++ b/sound/soc/mediatek/common/mtk-base-afe.h
@@ -117,6 +117,7 @@ struct mtk_base_afe {
struct mtk_base_afe_irq *irqs;
int irqs_size;
int memif_32bit_supported;
+ bool preallocate_buffers;
struct list_head sub_dais;
struct snd_soc_dai_driver *dai_drivers;
diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
index 04ed0cfec174..f93d6348fdf8 100644
--- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
+++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
@@ -13,6 +13,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_reserved_mem.h>
#include <linux/dma-mapping.h>
#include <linux/pm_runtime.h>
#include <sound/soc.h>
@@ -1070,6 +1071,12 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
afe->dev = &pdev->dev;
+ ret = of_reserved_mem_device_init(&pdev->dev);
+ if (ret) {
+ dev_info(&pdev->dev, "no reserved memory found, pre-allocating buffers instead\n");
+ afe->preallocate_buffers = true;
+ }
+
irq_id = platform_get_irq(pdev, 0);
if (irq_id <= 0)
return irq_id < 0 ? irq_id : -ENXIO;
diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
index d083b4bf0f95..e7378bee8e50 100644
--- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
+++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
@@ -10,6 +10,7 @@
#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_reserved_mem.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
@@ -1094,6 +1095,12 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
afe->dev = &pdev->dev;
dev = afe->dev;
+ ret = of_reserved_mem_device_init(dev);
+ if (ret) {
+ dev_info(dev, "no reserved memory found, pre-allocating buffers instead\n");
+ afe->preallocate_buffers = true;
+ }
+
/* initial audio related clock */
ret = mt8183_init_clock(afe);
if (ret) {
diff --git a/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c b/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c
index db7c93401bee..c73b4664e53e 100644
--- a/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c
+++ b/sound/soc/mediatek/mt8186/mt8186-afe-pcm.c
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_reserved_mem.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <sound/soc.h>
@@ -2835,6 +2836,12 @@ static int mt8186_afe_pcm_dev_probe(struct platform_device *pdev)
afe_priv = afe->platform_priv;
afe->dev = &pdev->dev;
+ ret = of_reserved_mem_device_init(dev);
+ if (ret) {
+ dev_info(dev, "no reserved memory found, pre-allocating buffers instead\n");
+ afe->preallocate_buffers = true;
+ }
+
afe->base_addr = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(afe->base_addr))
return PTR_ERR(afe->base_addr);
diff --git a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
index fd6af74d7995..3d32fe46118e 100644
--- a/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
+++ b/sound/soc/mediatek/mt8192/mt8192-afe-pcm.c
@@ -12,6 +12,7 @@
#include <linux/mfd/syscon.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_reserved_mem.h>
#include <linux/pm_runtime.h>
#include <linux/reset.h>
#include <sound/soc.h>
@@ -2179,6 +2180,12 @@ static int mt8192_afe_pcm_dev_probe(struct platform_device *pdev)
afe->dev = dev;
+ ret = of_reserved_mem_device_init(dev);
+ if (ret) {
+ dev_info(dev, "no reserved memory found, pre-allocating buffers instead\n");
+ afe->preallocate_buffers = true;
+ }
+
/* init audio related clock */
ret = mt8192_init_clock(afe);
if (ret) {
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 07/13] ASoC: mediatek: mt8183-afe-pcm: Support >32 bit DMA addresses
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (5 preceding siblings ...)
2025-04-24 10:25 ` [PATCH v2 06/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
@ 2025-04-24 10:25 ` Chen-Yu Tsai
2025-06-11 16:21 ` Mark Brown
2025-04-24 10:25 ` [PATCH v2 08/13] ASoC: mediatek: mt8173-afe-pcm: use local `dev` pointer in driver callbacks Chen-Yu Tsai
` (7 subsequent siblings)
14 siblings, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:25 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
The AFE DMA hardware supports up to 34 bits for DMA addresses. This is
missing from the driver and prevents reserved memory regions from
working properly when the allocated region is above the 4GB line.
Fill in the related register offsets for each DAI, and also set the
DMA mask. Also fill in the LSB end register offsets for completeness.
Fixes: a94aec035a12 ("ASoC: mediatek: mt8183: add platform driver")
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 41 ++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
index e7378bee8e50..a3c8054a434f 100644
--- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
+++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
@@ -6,6 +6,7 @@
// Author: KaiChieh Chuang <kaichieh.chuang@mediatek.com>
#include <linux/delay.h>
+#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/mfd/syscon.h>
#include <linux/of.h>
@@ -431,6 +432,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_DL1,
.reg_ofs_base = AFE_DL1_BASE,
.reg_ofs_cur = AFE_DL1_CUR,
+ .reg_ofs_end = AFE_DL1_END,
+ .reg_ofs_base_msb = AFE_DL1_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_DL1_CUR_MSB,
+ .reg_ofs_end_msb = AFE_DL1_END_MSB,
.fs_reg = AFE_DAC_CON1,
.fs_shift = DL1_MODE_SFT,
.fs_maskbit = DL1_MODE_MASK,
@@ -452,6 +457,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_DL2,
.reg_ofs_base = AFE_DL2_BASE,
.reg_ofs_cur = AFE_DL2_CUR,
+ .reg_ofs_end = AFE_DL2_END,
+ .reg_ofs_base_msb = AFE_DL2_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_DL2_CUR_MSB,
+ .reg_ofs_end_msb = AFE_DL2_END_MSB,
.fs_reg = AFE_DAC_CON1,
.fs_shift = DL2_MODE_SFT,
.fs_maskbit = DL2_MODE_MASK,
@@ -473,6 +482,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_DL3,
.reg_ofs_base = AFE_DL3_BASE,
.reg_ofs_cur = AFE_DL3_CUR,
+ .reg_ofs_end = AFE_DL3_END,
+ .reg_ofs_base_msb = AFE_DL3_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_DL3_CUR_MSB,
+ .reg_ofs_end_msb = AFE_DL3_END_MSB,
.fs_reg = AFE_DAC_CON2,
.fs_shift = DL3_MODE_SFT,
.fs_maskbit = DL3_MODE_MASK,
@@ -494,6 +507,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_VUL2,
.reg_ofs_base = AFE_VUL2_BASE,
.reg_ofs_cur = AFE_VUL2_CUR,
+ .reg_ofs_end = AFE_VUL2_END,
+ .reg_ofs_base_msb = AFE_VUL2_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_VUL2_CUR_MSB,
+ .reg_ofs_end_msb = AFE_VUL2_END_MSB,
.fs_reg = AFE_DAC_CON2,
.fs_shift = VUL2_MODE_SFT,
.fs_maskbit = VUL2_MODE_MASK,
@@ -515,6 +532,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_AWB,
.reg_ofs_base = AFE_AWB_BASE,
.reg_ofs_cur = AFE_AWB_CUR,
+ .reg_ofs_end = AFE_AWB_END,
+ .reg_ofs_base_msb = AFE_AWB_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_AWB_CUR_MSB,
+ .reg_ofs_end_msb = AFE_AWB_END_MSB,
.fs_reg = AFE_DAC_CON1,
.fs_shift = AWB_MODE_SFT,
.fs_maskbit = AWB_MODE_MASK,
@@ -536,6 +557,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_AWB2,
.reg_ofs_base = AFE_AWB2_BASE,
.reg_ofs_cur = AFE_AWB2_CUR,
+ .reg_ofs_end = AFE_AWB2_END,
+ .reg_ofs_base_msb = AFE_AWB2_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_AWB2_CUR_MSB,
+ .reg_ofs_end_msb = AFE_AWB2_END_MSB,
.fs_reg = AFE_DAC_CON2,
.fs_shift = AWB2_MODE_SFT,
.fs_maskbit = AWB2_MODE_MASK,
@@ -557,6 +582,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_VUL12,
.reg_ofs_base = AFE_VUL_D2_BASE,
.reg_ofs_cur = AFE_VUL_D2_CUR,
+ .reg_ofs_end = AFE_VUL_D2_END,
+ .reg_ofs_base_msb = AFE_VUL_D2_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_VUL_D2_CUR_MSB,
+ .reg_ofs_end_msb = AFE_VUL_D2_END_MSB,
.fs_reg = AFE_DAC_CON0,
.fs_shift = VUL12_MODE_SFT,
.fs_maskbit = VUL12_MODE_MASK,
@@ -578,6 +607,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_MOD_DAI,
.reg_ofs_base = AFE_MOD_DAI_BASE,
.reg_ofs_cur = AFE_MOD_DAI_CUR,
+ .reg_ofs_end = AFE_MOD_DAI_END,
+ .reg_ofs_base_msb = AFE_MOD_DAI_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_MOD_DAI_CUR_MSB,
+ .reg_ofs_end_msb = AFE_MOD_DAI_END_MSB,
.fs_reg = AFE_DAC_CON1,
.fs_shift = MOD_DAI_MODE_SFT,
.fs_maskbit = MOD_DAI_MODE_MASK,
@@ -599,6 +632,10 @@ static const struct mtk_base_memif_data memif_data[MT8183_MEMIF_NUM] = {
.id = MT8183_MEMIF_HDMI,
.reg_ofs_base = AFE_HDMI_OUT_BASE,
.reg_ofs_cur = AFE_HDMI_OUT_CUR,
+ .reg_ofs_end = AFE_HDMI_OUT_END,
+ .reg_ofs_base_msb = AFE_HDMI_OUT_BASE_MSB,
+ .reg_ofs_cur_msb = AFE_HDMI_OUT_CUR_MSB,
+ .reg_ofs_end_msb = AFE_HDMI_OUT_END_MSB,
.fs_reg = -1,
.fs_shift = -1,
.fs_maskbit = -1,
@@ -1081,6 +1118,10 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
struct reset_control *rstc;
int i, irq_id, ret;
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
+ if (ret)
+ return ret;
+
afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL);
if (!afe)
return -ENOMEM;
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 08/13] ASoC: mediatek: mt8173-afe-pcm: use local `dev` pointer in driver callbacks
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (6 preceding siblings ...)
2025-04-24 10:25 ` [PATCH v2 07/13] ASoC: mediatek: mt8183-afe-pcm: Support >32 bit DMA addresses Chen-Yu Tsai
@ 2025-04-24 10:25 ` Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 09/13] ASoC: mediatek: mt8183-afe-pcm: " Chen-Yu Tsai
` (6 subsequent siblings)
14 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:25 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
The probe and remove functions in the mt8183-afe-pcm driver repeatedly uses
`&pdev->dev` for |struct device *|, but then assigns this value to
`afe->dev` and uses that in other places in the same function.
Store `&pdev->dev` in a local pointer and use that exclusively to avoid
the numerous dereferences and to make the code more consistent. Lines
are reflowed where it makes sense.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | 63 +++++++++++-----------
1 file changed, 32 insertions(+), 31 deletions(-)
diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
index f93d6348fdf8..c0fa623e0b17 100644
--- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
+++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
@@ -1054,26 +1054,26 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
struct mtk_base_afe *afe;
struct mt8173_afe_private *afe_priv;
struct snd_soc_component *comp_pcm, *comp_hdmi;
+ struct device *dev = &pdev->dev;
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(33));
+ ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33));
if (ret)
return ret;
- afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL);
+ afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL);
if (!afe)
return -ENOMEM;
- afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv),
- GFP_KERNEL);
+ afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), GFP_KERNEL);
afe_priv = afe->platform_priv;
if (!afe_priv)
return -ENOMEM;
- afe->dev = &pdev->dev;
+ afe->dev = dev;
- ret = of_reserved_mem_device_init(&pdev->dev);
+ ret = of_reserved_mem_device_init(dev);
if (ret) {
- dev_info(&pdev->dev, "no reserved memory found, pre-allocating buffers instead\n");
+ dev_info(dev, "no reserved memory found, pre-allocating buffers instead\n");
afe->preallocate_buffers = true;
}
@@ -1085,27 +1085,27 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
if (IS_ERR(afe->base_addr))
return PTR_ERR(afe->base_addr);
- afe->regmap = devm_regmap_init_mmio(&pdev->dev, afe->base_addr,
- &mt8173_afe_regmap_config);
+ afe->regmap = devm_regmap_init_mmio(dev, afe->base_addr,
+ &mt8173_afe_regmap_config);
if (IS_ERR(afe->regmap))
return PTR_ERR(afe->regmap);
/* initial audio related clock */
ret = mt8173_afe_init_audio_clk(afe);
if (ret) {
- dev_err(afe->dev, "mt8173_afe_init_audio_clk fail\n");
+ dev_err(dev, "mt8173_afe_init_audio_clk fail\n");
return ret;
}
/* memif % irq initialize*/
afe->memif_size = MT8173_AFE_MEMIF_NUM;
- afe->memif = devm_kcalloc(afe->dev, afe->memif_size,
+ afe->memif = devm_kcalloc(dev, afe->memif_size,
sizeof(*afe->memif), GFP_KERNEL);
if (!afe->memif)
return -ENOMEM;
afe->irqs_size = MT8173_AFE_IRQ_NUM;
- afe->irqs = devm_kcalloc(afe->dev, afe->irqs_size,
+ afe->irqs = devm_kcalloc(dev, afe->irqs_size,
sizeof(*afe->irqs), GFP_KERNEL);
if (!afe->irqs)
return -ENOMEM;
@@ -1124,9 +1124,9 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, afe);
- pm_runtime_enable(&pdev->dev);
- if (!pm_runtime_enabled(&pdev->dev)) {
- ret = mt8173_afe_runtime_resume(&pdev->dev);
+ pm_runtime_enable(dev);
+ if (!pm_runtime_enabled(dev)) {
+ ret = mt8173_afe_runtime_resume(dev);
if (ret)
goto err_pm_disable;
}
@@ -1136,13 +1136,12 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
afe->runtime_resume = mt8173_afe_runtime_resume;
afe->runtime_suspend = mt8173_afe_runtime_suspend;
- ret = devm_snd_soc_register_component(&pdev->dev,
- &mtk_afe_pcm_platform,
- NULL, 0);
+ ret = devm_snd_soc_register_component(dev, &mtk_afe_pcm_platform,
+ NULL, 0);
if (ret)
goto err_pm_disable;
- comp_pcm = devm_kzalloc(&pdev->dev, sizeof(*comp_pcm), GFP_KERNEL);
+ comp_pcm = devm_kzalloc(dev, sizeof(*comp_pcm), GFP_KERNEL);
if (!comp_pcm) {
ret = -ENOMEM;
goto err_pm_disable;
@@ -1150,7 +1149,7 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
ret = snd_soc_component_initialize(comp_pcm,
&mt8173_afe_pcm_dai_component,
- &pdev->dev);
+ dev);
if (ret)
goto err_pm_disable;
@@ -1164,7 +1163,7 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
if (ret)
goto err_pm_disable;
- comp_hdmi = devm_kzalloc(&pdev->dev, sizeof(*comp_hdmi), GFP_KERNEL);
+ comp_hdmi = devm_kzalloc(dev, sizeof(*comp_hdmi), GFP_KERNEL);
if (!comp_hdmi) {
ret = -ENOMEM;
goto err_cleanup_components;
@@ -1172,7 +1171,7 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
ret = snd_soc_component_initialize(comp_hdmi,
&mt8173_afe_hdmi_dai_component,
- &pdev->dev);
+ dev);
if (ret)
goto err_cleanup_components;
@@ -1186,30 +1185,32 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
if (ret)
goto err_cleanup_components;
- ret = devm_request_irq(afe->dev, irq_id, mt8173_afe_irq_handler,
+ ret = devm_request_irq(dev, irq_id, mt8173_afe_irq_handler,
0, "Afe_ISR_Handle", (void *)afe);
if (ret) {
- dev_err(afe->dev, "could not request_irq\n");
+ dev_err(dev, "could not request_irq\n");
goto err_cleanup_components;
}
- dev_info(&pdev->dev, "MT8173 AFE driver initialized.\n");
+ dev_info(dev, "MT8173 AFE driver initialized.\n");
return 0;
err_cleanup_components:
- snd_soc_unregister_component(&pdev->dev);
+ snd_soc_unregister_component(dev);
err_pm_disable:
- pm_runtime_disable(&pdev->dev);
+ pm_runtime_disable(dev);
return ret;
}
static void mt8173_afe_pcm_dev_remove(struct platform_device *pdev)
{
- snd_soc_unregister_component(&pdev->dev);
+ struct device *dev = &pdev->dev;
- pm_runtime_disable(&pdev->dev);
- if (!pm_runtime_status_suspended(&pdev->dev))
- mt8173_afe_runtime_suspend(&pdev->dev);
+ snd_soc_unregister_component(dev);
+
+ pm_runtime_disable(dev);
+ if (!pm_runtime_status_suspended(dev))
+ mt8173_afe_runtime_suspend(dev);
}
static const struct of_device_id mt8173_afe_pcm_dt_match[] = {
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 09/13] ASoC: mediatek: mt8183-afe-pcm: use local `dev` pointer in driver callbacks
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (7 preceding siblings ...)
2025-04-24 10:25 ` [PATCH v2 08/13] ASoC: mediatek: mt8173-afe-pcm: use local `dev` pointer in driver callbacks Chen-Yu Tsai
@ 2025-04-24 10:25 ` Chen-Yu Tsai
2025-06-11 16:22 ` Mark Brown
2025-04-24 10:25 ` [PATCH v2 10/13] arm64: dts: mediatek: mt8173: Reserve memory for audio frontend Chen-Yu Tsai
` (5 subsequent siblings)
14 siblings, 1 reply; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:25 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
The probe and remove functions in the mt8183-afe-pcm driver repeatedly uses
`&pdev->dev` for |struct device *|, but then assigns this value to
`afe->dev` and uses that in other places in the same function.
Store `&pdev->dev` in a local pointer and use that exclusively to avoid
the numerous dereferences and to make the code more consistent. Lines
are reflowed where it makes sense.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c | 37 ++++++++++------------
1 file changed, 17 insertions(+), 20 deletions(-)
diff --git a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
index a3c8054a434f..d63b7fe19fbf 100644
--- a/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
+++ b/sound/soc/mediatek/mt8183/mt8183-afe-pcm.c
@@ -1114,27 +1114,25 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
{
struct mtk_base_afe *afe;
struct mt8183_afe_private *afe_priv;
- struct device *dev;
+ struct device *dev = &pdev->dev;
struct reset_control *rstc;
int i, irq_id, ret;
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
+ ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(34));
if (ret)
return ret;
- afe = devm_kzalloc(&pdev->dev, sizeof(*afe), GFP_KERNEL);
+ afe = devm_kzalloc(dev, sizeof(*afe), GFP_KERNEL);
if (!afe)
return -ENOMEM;
platform_set_drvdata(pdev, afe);
- afe->platform_priv = devm_kzalloc(&pdev->dev, sizeof(*afe_priv),
- GFP_KERNEL);
+ afe->platform_priv = devm_kzalloc(dev, sizeof(*afe_priv), GFP_KERNEL);
if (!afe->platform_priv)
return -ENOMEM;
afe_priv = afe->platform_priv;
- afe->dev = &pdev->dev;
- dev = afe->dev;
+ afe->dev = dev;
ret = of_reserved_mem_device_init(dev);
if (ret) {
@@ -1179,7 +1177,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
/* enable clock for regcache get default value from hw */
afe_priv->pm_runtime_bypass_reg_ctl = true;
- pm_runtime_get_sync(&pdev->dev);
+ pm_runtime_get_sync(dev);
ret = regmap_reinit_cache(afe->regmap, &mt8183_afe_regmap_config);
if (ret) {
@@ -1187,7 +1185,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
goto err_pm_disable;
}
- pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_put_sync(dev);
afe_priv->pm_runtime_bypass_reg_ctl = false;
regcache_cache_only(afe->regmap, true);
@@ -1245,7 +1243,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
for (i = 0; i < ARRAY_SIZE(dai_register_cbs); i++) {
ret = dai_register_cbs[i](afe);
if (ret) {
- dev_warn(afe->dev, "dai register i %d fail, ret %d\n",
+ dev_warn(dev, "dai register i %d fail, ret %d\n",
i, ret);
goto err_pm_disable;
}
@@ -1254,8 +1252,7 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
/* init dai_driver and component_driver */
ret = mtk_afe_combine_sub_dai(afe);
if (ret) {
- dev_warn(afe->dev, "mtk_afe_combine_sub_dai fail, ret %d\n",
- ret);
+ dev_warn(dev, "mtk_afe_combine_sub_dai fail, ret %d\n", ret);
goto err_pm_disable;
}
@@ -1267,16 +1264,14 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
afe->runtime_suspend = mt8183_afe_runtime_suspend;
/* register component */
- ret = devm_snd_soc_register_component(&pdev->dev,
- &mtk_afe_pcm_platform,
+ ret = devm_snd_soc_register_component(dev, &mtk_afe_pcm_platform,
NULL, 0);
if (ret) {
dev_warn(dev, "err_platform\n");
goto err_pm_disable;
}
- ret = devm_snd_soc_register_component(afe->dev,
- &mt8183_afe_pcm_dai_component,
+ ret = devm_snd_soc_register_component(dev, &mt8183_afe_pcm_dai_component,
afe->dai_drivers,
afe->num_dai_drivers);
if (ret) {
@@ -1287,15 +1282,17 @@ static int mt8183_afe_pcm_dev_probe(struct platform_device *pdev)
return ret;
err_pm_disable:
- pm_runtime_disable(&pdev->dev);
+ pm_runtime_disable(dev);
return ret;
}
static void mt8183_afe_pcm_dev_remove(struct platform_device *pdev)
{
- pm_runtime_disable(&pdev->dev);
- if (!pm_runtime_status_suspended(&pdev->dev))
- mt8183_afe_runtime_suspend(&pdev->dev);
+ struct device *dev = &pdev->dev;
+
+ pm_runtime_disable(dev);
+ if (!pm_runtime_status_suspended(dev))
+ mt8183_afe_runtime_suspend(dev);
}
static const struct of_device_id mt8183_afe_pcm_dt_match[] = {
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 10/13] arm64: dts: mediatek: mt8173: Reserve memory for audio frontend
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (8 preceding siblings ...)
2025-04-24 10:25 ` [PATCH v2 09/13] ASoC: mediatek: mt8183-afe-pcm: " Chen-Yu Tsai
@ 2025-04-24 10:25 ` Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 11/13] arm64: dts: mediatek: mt8183-kukui: " Chen-Yu Tsai
` (4 subsequent siblings)
14 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:25 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
Some MediaTek platforms already reserve a small block of memory for the
audio frontend. These platforms reserve it at a fixed address, though it
is unclear if that is due to hardware access restrictions or simply
compacting the reserved memory blocks together.
Reserve the same size of memory on the MT8173 as well, to align with the
other platforms. This also helps with memory starvation as these devices
commonly end up in low memory conditions.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
arch/arm64/boot/dts/mediatek/mt8173.dtsi | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8173.dtsi b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
index 6d1d8877b43f..122a57c3780b 100644
--- a/arch/arm64/boot/dts/mediatek/mt8173.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8173.dtsi
@@ -318,6 +318,14 @@ reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
+
+ afe_dma_mem: audio-dma-pool {
+ compatible = "shared-dma-pool";
+ size = <0 0x100000>;
+ alignment = <0 0x10>;
+ no-map;
+ };
+
vpu_dma_reserved: vpu-dma-mem@b7000000 {
compatible = "shared-dma-pool";
reg = <0 0xb7000000 0 0x500000>;
@@ -887,6 +895,7 @@ afe: audio-controller@11220000 {
<&topckgen CLK_TOP_AUD_2_SEL>;
assigned-clock-parents = <&topckgen CLK_TOP_APLL1>,
<&topckgen CLK_TOP_APLL2>;
+ memory-region = <&afe_dma_mem>;
};
mmc0: mmc@11230000 {
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 11/13] arm64: dts: mediatek: mt8183-kukui: Reserve memory for audio frontend
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (9 preceding siblings ...)
2025-04-24 10:25 ` [PATCH v2 10/13] arm64: dts: mediatek: mt8173: Reserve memory for audio frontend Chen-Yu Tsai
@ 2025-04-24 10:25 ` Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 12/13] arm64: dts: mediatek: mt8186-corsola: " Chen-Yu Tsai
` (3 subsequent siblings)
14 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:25 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
Some MediaTek platforms already reserve a small block of memory for the
audio frontend. These platforms reserve it at a fixed address, though it
is unclear if that is due to hardware access restrictions or simply
compacting the reserved memory blocks together.
Reserve the same size of memory on the MT8183 Kukui & Jacuzzi families
as well, to align with the other MediaTek-based ChromeOS platforms. This
also helps with memory starvation as these devices commonly end up in
low memory conditions.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
index 0fe9f2d1b912..00b97cfa0eec 100644
--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui.dtsi
@@ -85,6 +85,13 @@ reserved_memory: reserved-memory {
#size-cells = <2>;
ranges;
+ afe_dma_mem: audio-dma-pool {
+ compatible = "shared-dma-pool";
+ size = <0 0x100000>;
+ alignment = <0 0x10>;
+ no-map;
+ };
+
scp_mem_reserved: memory@50000000 {
compatible = "shared-dma-pool";
reg = <0 0x50000000 0 0x2900000>;
@@ -198,6 +205,10 @@ tboard_thermistor2: thermal-sensor2 {
};
};
+&afe {
+ memory-region = <&afe_dma_mem>;
+};
+
&auxadc {
status = "okay";
};
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 12/13] arm64: dts: mediatek: mt8186-corsola: Reserve memory for audio frontend
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (10 preceding siblings ...)
2025-04-24 10:25 ` [PATCH v2 11/13] arm64: dts: mediatek: mt8183-kukui: " Chen-Yu Tsai
@ 2025-04-24 10:25 ` Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 13/13] arm64: dts: mediatek: mt8192-asurada: " Chen-Yu Tsai
` (2 subsequent siblings)
14 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:25 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
Some MediaTek platforms already reserve a small block of memory for the
audio frontend. These platforms reserve it at a fixed address, though it
is unclear if that is due to hardware access restrictions or simply
compacting the reserved memory blocks together.
Reserve the same size of memory on the MT8186 Corsola family as well, to
align with the other MediaTek-based ChromeOS platforms. This also helps
with memory starvation as these devices sometimes end up in low memory
conditions.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
arch/arm64/boot/dts/mediatek/mt8186-corsola.dtsi | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8186-corsola.dtsi b/arch/arm64/boot/dts/mediatek/mt8186-corsola.dtsi
index c864ed495702..b139588ae246 100644
--- a/arch/arm64/boot/dts/mediatek/mt8186-corsola.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8186-corsola.dtsi
@@ -161,6 +161,13 @@ reserved_memory: reserved-memory {
#size-cells = <2>;
ranges;
+ afe_dma_mem: audio-dma-pool {
+ compatible = "shared-dma-pool";
+ size = <0 0x100000>;
+ alignment = <0 0x10>;
+ no-map;
+ };
+
adsp_dma_mem: memory@61000000 {
compatible = "shared-dma-pool";
reg = <0 0x61000000 0 0x100000>;
@@ -310,6 +317,7 @@ &adsp {
};
&afe {
+ memory-region = <&afe_dma_mem>;
status = "okay";
};
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH v2 13/13] arm64: dts: mediatek: mt8192-asurada: Reserve memory for audio frontend
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (11 preceding siblings ...)
2025-04-24 10:25 ` [PATCH v2 12/13] arm64: dts: mediatek: mt8186-corsola: " Chen-Yu Tsai
@ 2025-04-24 10:25 ` Chen-Yu Tsai
2025-05-14 8:54 ` [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Mark Brown
2025-06-14 11:12 ` (subset) " Mark Brown
14 siblings, 0 replies; 25+ messages in thread
From: Chen-Yu Tsai @ 2025-04-24 10:25 UTC (permalink / raw)
To: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Chen-Yu Tsai, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
Some MediaTek platforms already reserve a small block of memory for the
audio frontend. These platforms reserve it at a fixed address, though it
is unclear if that is due to hardware access restrictions or simply
compacting the reserved memory blocks together.
Reserve the same size of memory on the MT8192 Asurada family as well, to
align with the other MediaTek-based ChromeOS platforms.
Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
---
arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
index 516fba9b3c6d..0574fe50468f 100644
--- a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi
@@ -199,6 +199,13 @@ reserved_memory: reserved-memory {
#size-cells = <2>;
ranges;
+ afe_dma_mem: audio-dma-pool {
+ compatible = "shared-dma-pool";
+ size = <0 0x100000>;
+ alignment = <0 0x10>;
+ no-map;
+ };
+
scp_mem_reserved: scp@50000000 {
compatible = "shared-dma-pool";
reg = <0 0x50000000 0 0x2900000>;
@@ -277,6 +284,10 @@ sound: sound {
};
};
+&afe {
+ memory-region = <&afe_dma_mem>;
+};
+
&dpi0 {
pinctrl-names = "sleep", "default";
pinctrl-0 = <&dpi_pin_default>;
--
2.49.0.805.g082f7c87e0-goog
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH v2 01/13] ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema
2025-04-24 10:24 ` [PATCH v2 01/13] ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema Chen-Yu Tsai
@ 2025-04-28 7:24 ` Krzysztof Kozlowski
0 siblings, 0 replies; 25+ messages in thread
From: Krzysztof Kozlowski @ 2025-04-28 7:24 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Liam Girdwood, Mark Brown, Matthias Brugger,
AngeloGioacchino Del Regno, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel, Trevor Wu
On Thu, Apr 24, 2025 at 06:24:55PM GMT, Chen-Yu Tsai wrote:
> Convert the MT8173 AFE (audio frontend) binding from text to dt-schema
> in YAML. "clocks" is added to the list of required properties to match
> "clock-names". And the example was slightly fixed up in style. Otherwise
> everything is as before.
>
> A contributer and maintainer for a recently added MediaTek audio binding
> was chosen instead of the original submitter.
>
> Cc: Trevor Wu <trevor.wu@mediatek.com>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> .../sound/mediatek,mt8173-afe-pcm.yaml | 87 +++++++++++++++++++
> .../devicetree/bindings/sound/mtk-afe-pcm.txt | 45 ----------
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 02/13] ASoC: dt-bindings: mt8173-afe-pcm: Add power domain
2025-04-24 10:24 ` [PATCH v2 02/13] ASoC: dt-bindings: mt8173-afe-pcm: Add power domain Chen-Yu Tsai
@ 2025-05-09 18:08 ` Rob Herring (Arm)
0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring (Arm) @ 2025-05-09 18:08 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: devicetree, Matthias Brugger, AngeloGioacchino Del Regno,
Mark Brown, Jiaxin Yu, linux-arm-kernel, linux-mediatek,
linux-kernel, Takashi Iwai, Jaroslav Kysela, Conor Dooley,
linux-sound, Krzysztof Kozlowski, Liam Girdwood
On Thu, 24 Apr 2025 18:24:56 +0800, Chen-Yu Tsai wrote:
> The audio subsystem sits under a controllable power domain.
>
> Add it to the binding.
>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> .../devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml | 6 ++++++
> 1 file changed, 6 insertions(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 03/13] ASoC: dt-bindings: mt8173-afe-pcm: Allow specifying reserved memory region
2025-04-24 10:24 ` [PATCH v2 03/13] ASoC: dt-bindings: mt8173-afe-pcm: Allow specifying reserved memory region Chen-Yu Tsai
@ 2025-05-09 18:08 ` Rob Herring (Arm)
0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring (Arm) @ 2025-05-09 18:08 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: linux-arm-kernel, linux-mediatek, Mark Brown, Krzysztof Kozlowski,
AngeloGioacchino Del Regno, Matthias Brugger, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, linux-sound, devicetree, Jiaxin Yu,
linux-kernel, Conor Dooley
On Thu, 24 Apr 2025 18:24:57 +0800, Chen-Yu Tsai wrote:
> It is desirable to reserve memory for the audio frontend.
>
> Allow the "memory-region" property, to be used to point to a reserved
> memory region.
>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> .../devicetree/bindings/sound/mediatek,mt8173-afe-pcm.yaml | 5 +++++
> 1 file changed, 5 insertions(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 04/13] ASoC: dt-bindings: mt8186-afe-pcm: Allow specifying reserved memory region
2025-04-24 10:24 ` [PATCH v2 04/13] ASoC: dt-bindings: mt8186-afe-pcm: " Chen-Yu Tsai
@ 2025-05-09 18:08 ` Rob Herring (Arm)
0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring (Arm) @ 2025-05-09 18:08 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: devicetree, linux-kernel, linux-arm-kernel, Jaroslav Kysela,
Liam Girdwood, AngeloGioacchino Del Regno, Conor Dooley,
Krzysztof Kozlowski, Jiaxin Yu, linux-sound, Matthias Brugger,
linux-mediatek, Mark Brown, Takashi Iwai
On Thu, 24 Apr 2025 18:24:58 +0800, Chen-Yu Tsai wrote:
> It is desirable to reserve memory for the audio frontend.
>
> Allow the "memory-region" property, to be used to point to a reserved
> memory region.
>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> Documentation/devicetree/bindings/sound/mt8186-afe-pcm.yaml | 5 +++++
> 1 file changed, 5 insertions(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 05/13] ASoC: dt-bindings: mt8192-afe-pcm: Allow specifying reserved memory region
2025-04-24 10:24 ` [PATCH v2 05/13] ASoC: dt-bindings: mt8192-afe-pcm: " Chen-Yu Tsai
@ 2025-05-09 18:09 ` Rob Herring (Arm)
0 siblings, 0 replies; 25+ messages in thread
From: Rob Herring (Arm) @ 2025-05-09 18:09 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: linux-sound, Takashi Iwai, Jiaxin Yu, Mark Brown,
linux-arm-kernel, Matthias Brugger, Liam Girdwood, Conor Dooley,
Jaroslav Kysela, AngeloGioacchino Del Regno, linux-kernel,
linux-mediatek, devicetree, Krzysztof Kozlowski
On Thu, 24 Apr 2025 18:24:59 +0800, Chen-Yu Tsai wrote:
> It is desirable to reserve memory for the audio frontend.
>
> Allow the "memory-region" property, to be used to point to a reserved
> memory region.
>
> Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
> ---
> Documentation/devicetree/bindings/sound/mt8192-afe-pcm.yaml | 5 +++++
> 1 file changed, 5 insertions(+)
>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (12 preceding siblings ...)
2025-04-24 10:25 ` [PATCH v2 13/13] arm64: dts: mediatek: mt8192-asurada: " Chen-Yu Tsai
@ 2025-05-14 8:54 ` Mark Brown
2025-06-11 10:22 ` AngeloGioacchino Del Regno
2025-06-14 11:12 ` (subset) " Mark Brown
14 siblings, 1 reply; 25+ messages in thread
From: Mark Brown @ 2025-05-14 8:54 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Liam Girdwood, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela,
Takashi Iwai, Jiaxin Yu, linux-sound, devicetree,
linux-arm-kernel, linux-mediatek, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 607 bytes --]
On Thu, Apr 24, 2025 at 06:24:54PM +0800, Chen-Yu Tsai wrote:
> This is v2 of what was just a single patch "ASoC: mediatek: re-enable
> buffer pre-allocation on some platforms". Link to v1:
>
> https://lore.kernel.org/all/20250401085659.1222008-1-wenst@chromium.org/
>
> Angelo requested that these platforms use reserved memory regions if
> possible, and fall back to pre-allocated buffers only if that fails,
> to align with other MediaTek SoCs / platforms that already use reserved
> memory. The series covers MediaTek's MT8173, MT8183, MT8186, and MT8192
> SoCs.
AngeloGioacchino?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
2025-05-14 8:54 ` [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Mark Brown
@ 2025-06-11 10:22 ` AngeloGioacchino Del Regno
2025-06-11 10:31 ` AngeloGioacchino Del Regno
0 siblings, 1 reply; 25+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-06-11 10:22 UTC (permalink / raw)
To: Mark Brown, Chen-Yu Tsai
Cc: Liam Girdwood, Matthias Brugger, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
Il 14/05/25 10:54, Mark Brown ha scritto:
> On Thu, Apr 24, 2025 at 06:24:54PM +0800, Chen-Yu Tsai wrote:
>
>> This is v2 of what was just a single patch "ASoC: mediatek: re-enable
>> buffer pre-allocation on some platforms". Link to v1:
>>
>> https://lore.kernel.org/all/20250401085659.1222008-1-wenst@chromium.org/
>>
>> Angelo requested that these platforms use reserved memory regions if
>> possible, and fall back to pre-allocated buffers only if that fails,
>> to align with other MediaTek SoCs / platforms that already use reserved
>> memory. The series covers MediaTek's MT8173, MT8183, MT8186, and MT8192
>> SoCs.
>
> AngeloGioacchino?
Truly sorry for this slipping through the cracks - and thank you for the pings.
Also, thank you for all this code, love it.
Whole series is:
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Sorry again for all the wait.
Cheers!
Angelo
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
2025-06-11 10:22 ` AngeloGioacchino Del Regno
@ 2025-06-11 10:31 ` AngeloGioacchino Del Regno
0 siblings, 0 replies; 25+ messages in thread
From: AngeloGioacchino Del Regno @ 2025-06-11 10:31 UTC (permalink / raw)
To: Mark Brown, Chen-Yu Tsai
Cc: Liam Girdwood, Matthias Brugger, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Jaroslav Kysela, Takashi Iwai, Jiaxin Yu,
linux-sound, devicetree, linux-arm-kernel, linux-mediatek,
linux-kernel
Il 11/06/25 12:22, AngeloGioacchino Del Regno ha scritto:
> Il 14/05/25 10:54, Mark Brown ha scritto:
>> On Thu, Apr 24, 2025 at 06:24:54PM +0800, Chen-Yu Tsai wrote:
>>
>>> This is v2 of what was just a single patch "ASoC: mediatek: re-enable
>>> buffer pre-allocation on some platforms". Link to v1:
>>>
>>> https://lore.kernel.org/all/20250401085659.1222008-1-wenst@chromium.org/
>>>
>>> Angelo requested that these platforms use reserved memory regions if
>>> possible, and fall back to pre-allocated buffers only if that fails,
>>> to align with other MediaTek SoCs / platforms that already use reserved
>>> memory. The series covers MediaTek's MT8173, MT8183, MT8186, and MT8192
>>> SoCs.
>>
>> AngeloGioacchino?
>
> Truly sorry for this slipping through the cracks - and thank you for the pings.
> Also, thank you for all this code, love it.
>
> Whole series is:
>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>
> Sorry again for all the wait.
>
> Cheers!
> Angelo
Also, I picked patches 10 to 13, applied to v6.16-next/dts64 and manually fixed
a merge issue with patch 13.
https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux.git/log/?h=v6.16-next/dts64
Cheers!
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 07/13] ASoC: mediatek: mt8183-afe-pcm: Support >32 bit DMA addresses
2025-04-24 10:25 ` [PATCH v2 07/13] ASoC: mediatek: mt8183-afe-pcm: Support >32 bit DMA addresses Chen-Yu Tsai
@ 2025-06-11 16:21 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2025-06-11 16:21 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Liam Girdwood, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela,
Takashi Iwai, Jiaxin Yu, linux-sound, devicetree,
linux-arm-kernel, linux-mediatek, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 492 bytes --]
On Thu, Apr 24, 2025 at 06:25:01PM +0800, Chen-Yu Tsai wrote:
> The AFE DMA hardware supports up to 34 bits for DMA addresses. This is
> missing from the driver and prevents reserved memory regions from
> working properly when the allocated region is above the 4GB line.
>
> Fill in the related register offsets for each DAI, and also set the
> DMA mask. Also fill in the LSB end register offsets for completeness.
This doesn't apply against current code, please check and resend.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH v2 09/13] ASoC: mediatek: mt8183-afe-pcm: use local `dev` pointer in driver callbacks
2025-04-24 10:25 ` [PATCH v2 09/13] ASoC: mediatek: mt8183-afe-pcm: " Chen-Yu Tsai
@ 2025-06-11 16:22 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2025-06-11 16:22 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: Liam Girdwood, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Jaroslav Kysela,
Takashi Iwai, Jiaxin Yu, linux-sound, devicetree,
linux-arm-kernel, linux-mediatek, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 642 bytes --]
On Thu, Apr 24, 2025 at 06:25:03PM +0800, Chen-Yu Tsai wrote:
> The probe and remove functions in the mt8183-afe-pcm driver repeatedly uses
> `&pdev->dev` for |struct device *|, but then assigns this value to
> `afe->dev` and uses that in other places in the same function.
>
> Store `&pdev->dev` in a local pointer and use that exclusively to avoid
> the numerous dereferences and to make the code more consistent. Lines
> are reflowed where it makes sense.
This doesn't apply against current code, please check and resend.
I'm just about to drop everything else into CI so it should just be the
couple of patches I flagged.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: (subset) [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
` (13 preceding siblings ...)
2025-05-14 8:54 ` [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Mark Brown
@ 2025-06-14 11:12 ` Mark Brown
14 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2025-06-14 11:12 UTC (permalink / raw)
To: Liam Girdwood, Matthias Brugger, AngeloGioacchino Del Regno,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Chen-Yu Tsai
Cc: Jaroslav Kysela, Takashi Iwai, Jiaxin Yu, linux-sound, devicetree,
linux-arm-kernel, linux-mediatek, linux-kernel
On Thu, 24 Apr 2025 18:24:54 +0800, Chen-Yu Tsai wrote:
> This is v2 of what was just a single patch "ASoC: mediatek: re-enable
> buffer pre-allocation on some platforms". Link to v1:
>
> https://lore.kernel.org/all/20250401085659.1222008-1-wenst@chromium.org/
>
> Angelo requested that these platforms use reserved memory regions if
> possible, and fall back to pre-allocated buffers only if that fails,
> to align with other MediaTek SoCs / platforms that already use reserved
> memory. The series covers MediaTek's MT8173, MT8183, MT8186, and MT8192
> SoCs.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[01/13] ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema
commit: bb90e0c91d375ec5db8a4f8cd2555900aea0725f
[02/13] ASoC: dt-bindings: mt8173-afe-pcm: Add power domain
commit: 2fd902152c15a8cacab91e4a660413d189411561
[03/13] ASoC: dt-bindings: mt8173-afe-pcm: Allow specifying reserved memory region
commit: 473ee884263f2127ea4e46a74ba15d07446ceabb
[04/13] ASoC: dt-bindings: mt8186-afe-pcm: Allow specifying reserved memory region
commit: 81c73294a4eb2df31e974db2fc4397f5e0ecae09
[05/13] ASoC: dt-bindings: mt8192-afe-pcm: Allow specifying reserved memory region
commit: cd12d3a5ed10e3e3b323f2b2c652de1c8e17a750
[06/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
commit: ec4a10ca4a68ec97f12f4d17d7abb74db34987db
[07/13] ASoC: mediatek: mt8183-afe-pcm: Support >32 bit DMA addresses
commit: 9e7bc5cb8d089d9799e17a9ac99c5da9b13b02e3
[08/13] ASoC: mediatek: mt8173-afe-pcm: use local `dev` pointer in driver callbacks
commit: b2c090c9f6aa9d19f4c966233d7fcb872255f83b
[09/13] ASoC: mediatek: mt8183-afe-pcm: use local `dev` pointer in driver callbacks
commit: bb8d8ba4715cb8f997d63d90ba935f6073595df5
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2025-06-14 11:12 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-24 10:24 [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
2025-04-24 10:24 ` [PATCH v2 01/13] ASoC: dt-bindings: Convert MT8173 AFE binding to dt-schema Chen-Yu Tsai
2025-04-28 7:24 ` Krzysztof Kozlowski
2025-04-24 10:24 ` [PATCH v2 02/13] ASoC: dt-bindings: mt8173-afe-pcm: Add power domain Chen-Yu Tsai
2025-05-09 18:08 ` Rob Herring (Arm)
2025-04-24 10:24 ` [PATCH v2 03/13] ASoC: dt-bindings: mt8173-afe-pcm: Allow specifying reserved memory region Chen-Yu Tsai
2025-05-09 18:08 ` Rob Herring (Arm)
2025-04-24 10:24 ` [PATCH v2 04/13] ASoC: dt-bindings: mt8186-afe-pcm: " Chen-Yu Tsai
2025-05-09 18:08 ` Rob Herring (Arm)
2025-04-24 10:24 ` [PATCH v2 05/13] ASoC: dt-bindings: mt8192-afe-pcm: " Chen-Yu Tsai
2025-05-09 18:09 ` Rob Herring (Arm)
2025-04-24 10:25 ` [PATCH v2 06/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 07/13] ASoC: mediatek: mt8183-afe-pcm: Support >32 bit DMA addresses Chen-Yu Tsai
2025-06-11 16:21 ` Mark Brown
2025-04-24 10:25 ` [PATCH v2 08/13] ASoC: mediatek: mt8173-afe-pcm: use local `dev` pointer in driver callbacks Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 09/13] ASoC: mediatek: mt8183-afe-pcm: " Chen-Yu Tsai
2025-06-11 16:22 ` Mark Brown
2025-04-24 10:25 ` [PATCH v2 10/13] arm64: dts: mediatek: mt8173: Reserve memory for audio frontend Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 11/13] arm64: dts: mediatek: mt8183-kukui: " Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 12/13] arm64: dts: mediatek: mt8186-corsola: " Chen-Yu Tsai
2025-04-24 10:25 ` [PATCH v2 13/13] arm64: dts: mediatek: mt8192-asurada: " Chen-Yu Tsai
2025-05-14 8:54 ` [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation Mark Brown
2025-06-11 10:22 ` AngeloGioacchino Del Regno
2025-06-11 10:31 ` AngeloGioacchino Del Regno
2025-06-14 11:12 ` (subset) " Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).