Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Alexey Klimov <alexey.klimov@linaro.org>
Cc: "Krzysztof Kozlowski" <krzk@kernel.org>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>, "Lee Jones" <lee@kernel.org>,
	"Alim Akhtar" <alim.akhtar@samsung.com>,
	"Sylwester Nawrocki" <s.nawrocki@samsung.com>,
	"Chanwoo Choi" <cw00.choi@samsung.com>,
	"André Draszik" <andre.draszik@linaro.org>,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	peter.griffin@linaro.org, jyescas@google.com,
	kernel-team@android.com,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>
Subject: Re: [PATCH 5/6] firmware: samsung: acpm: Add TMU protocol support
Date: Thu, 7 May 2026 11:31:32 +0300	[thread overview]
Message-ID: <806da86b-45b7-43cc-b364-97bade8f4041@linaro.org> (raw)
In-Reply-To: <DIBOWQYHOPOU.3PCLCL8030WRL@linaro.org>



On 5/6/26 6:13 PM, Alexey Klimov wrote:
> 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 <tudor.ambarus@linaro.org>
>> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
>> ---
>>  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?

yes

> What about other messages/commands? They just return error code there?

all the other commands either return -1 for errors, regardless of the error
type, or 0 for success.
> 
>> +	 */
>> +	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?

I think we're good as we are now. The firmware returns either -1 for errors,
zero for success, or BIT(0) and BIT(1) for TMU_INIT to flag some capabilities.
I can't tell if there are other commands that return capabilities as well,
or if there are other capabilities for TMU_INIT, I don't have access to the
firmware code.

> 
> Is this error code convertation applies only to TMU protocol?

yes

Cheers,
ta


  reply	other threads:[~2026-05-07  8:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06 11:39 [PATCH 0/6] firmware: samsung: acpm: TMU support and cleanups Tudor Ambarus
2026-05-06 11:39 ` [PATCH 1/6] firmware: samsung: acpm: Consolidate transfer initialization helper Tudor Ambarus
2026-05-08 21:06   ` Peter Griffin
2026-05-06 11:39 ` [PATCH 2/6] firmware: samsung: acpm: Annotate rx_data->cmd with __counted_by_ptr Tudor Ambarus
2026-05-08 21:15   ` Peter Griffin
2026-05-06 11:39 ` [PATCH 3/6] firmware: samsung: acpm: Drop redundant _ops suffix in acpm_ops members Tudor Ambarus
2026-05-08 21:23   ` Peter Griffin
2026-05-06 11:39 ` [PATCH 4/6] firmware: samsung: acpm: Make acpm_ops const and access via pointer Tudor Ambarus
2026-05-08 21:27   ` Peter Griffin
2026-05-06 11:39 ` [PATCH 5/6] firmware: samsung: acpm: Add TMU protocol support Tudor Ambarus
2026-05-06 15:13   ` Alexey Klimov
2026-05-07  8:31     ` Tudor Ambarus [this message]
2026-05-08 21:47   ` Peter Griffin
2026-05-06 11:39 ` [PATCH 6/6] firmware: samsung: acpm: Add devm_acpm_get_by_phandle helper Tudor Ambarus
2026-05-08 21:36   ` Peter Griffin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=806da86b-45b7-43cc-b364-97bade8f4041@linaro.org \
    --to=tudor.ambarus@linaro.org \
    --cc=alexey.klimov@linaro.org \
    --cc=alim.akhtar@samsung.com \
    --cc=andre.draszik@linaro.org \
    --cc=cw00.choi@samsung.com \
    --cc=jyescas@google.com \
    --cc=kernel-team@android.com \
    --cc=krzk@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=lee@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=peter.griffin@linaro.org \
    --cc=s.nawrocki@samsung.com \
    --cc=sboyd@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox