[PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation

Chen-Yu Tsai posted 13 patches 7 months, 4 weeks ago
There is a newer version of this series
.../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
[PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
Posted by Chen-Yu Tsai 7 months, 4 weeks ago
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
Re: [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
Posted by Mark Brown 7 months, 1 week ago
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?
Re: [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
Posted by AngeloGioacchino Del Regno 6 months, 1 week ago
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
Re: [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
Posted by AngeloGioacchino Del Regno 6 months, 1 week ago
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!
Re: (subset) [PATCH v2 00/13] ASoC: mediatek: use reserved memory or enable buffer pre-allocation
Posted by Mark Brown 6 months, 1 week ago
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