Subject: Re: [PATCH 5/6] firmware: samsung: acpm: Add TMU protocol support

From: "Alexey Klimov" <[email-masked]>
Date: Wed, 06 May 2026 16:13:54 +0100

On Wed May 6, 2026 at 12:39 PM BST, Tudor Ambarus wrote:
> The Thermal Management Unit (TMU) on the Google GS101 SoC is managed
> through a hybrid model shared between the kernel and the Alive Clock
> and Power Manager (ACPM) firmware.
>
> Add the protocol helpers required to communicate with the ACPM for
> thermal operations, including initialization, threshold configuration,
> temperature reading, and system suspend/resume handshakes.
>
> Signed-off-by: Tudor Ambarus <[email-masked]>
> Reviewed-by: Krzysztof Kozlowski <[email-masked]>
> ---
>  drivers/firmware/samsung/Makefile                  |   1 +
>  drivers/firmware/samsung/exynos-acpm-tmu.c         | 239 +++++++++++++++++++++
>  drivers/firmware/samsung/exynos-acpm-tmu.h         |  28 +++
>  drivers/firmware/samsung/exynos-acpm.c             |  12 ++
>  .../linux/firmware/samsung/exynos-acpm-protocol.h  |  18 ++
>  5 files changed, 298 insertions(+)
>
> diff --git a/drivers/firmware/samsung/Makefile b/drivers/firmware/samsung/Makefile
> index 80d4f89b33a9..5a6f72bececf 100644
> --- a/drivers/firmware/samsung/Makefile
> +++ b/drivers/firmware/samsung/Makefile
> @@ -3,4 +3,5 @@
>  acpm-protocol-objs			:= exynos-acpm.o
>  acpm-protocol-objs			+= exynos-acpm-pmic.o
>  acpm-protocol-objs			+= exynos-acpm-dvfs.o
> +acpm-protocol-objs			+= exynos-acpm-tmu.o
>  obj-$(CONFIG_EXYNOS_ACPM_PROTOCOL)	+= acpm-protocol.o
> diff --git a/drivers/firmware/samsung/exynos-acpm-tmu.c b/drivers/firmware/samsung/exynos-acpm-tmu.c
> new file mode 100644
> index 000000000000..c68d60b4c0b3
> --- /dev/null
> +++ b/drivers/firmware/samsung/exynos-acpm-tmu.c

[..]

> +static int acpm_tmu_to_linux_err(s8 fw_err)
> +{
> +	/*
> +	 * ACPM_TMU_INIT uses BIT(0) and BIT(1) of msg.rx.ret to flag APM
> +	 * capabilities. Treat zero and all positive values as success.

ACPM_TMU_INIT returns capabilities inside designated error field?
What about other messages/commands? They just return error code there?

> +	 */
> +	if (fw_err >= 0)
> +		return 0;
> +
> +	if (fw_err == -1)
> +		return -EACCES;
> +
> +	return -EIO;
> +}

Could we map these return values with better granularity instead of
returning -EIO for everything else that is not minus one?

Is this error code convertation applies only to TMU protocol?

[...]

Best regards,
Alexey