public inbox for cip-dev@lists.cip-project.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@denx.de>
To: Claudiu <claudiu.beznea@tuxon.dev>
Cc: nobuhiro.iwamatsu.x90@mail.toshiba, cip-dev@lists.cip-project.org
Subject: Re: [PATCH 6.12.y-cip 3/6] thermal/drivers/renesas/rzg3s: Add thermal driver for the Renesas RZ/G3S SoC
Date: Mon, 29 Dec 2025 21:21:51 +0100	[thread overview]
Message-ID: <aVLi32qigJKR3NcP@duo.ucw.cz> (raw)
In-Reply-To: <20251217103222.4183089-4-claudiu.beznea.uj@bp.renesas.com>

[-- Attachment #1: Type: text/plain, Size: 1711 bytes --]

Hi!

I have some comments below.

> index 000000000000..d184dccc882f
> --- /dev/null
> +++ b/drivers/thermal/renesas/rzg3s_thermal.c
> +static int rzg3s_thermal_get_temp(struct thermal_zone_device *tz, int *temp)
> +{
> +	struct rzg3s_thermal_priv *priv = thermal_zone_device_priv(tz);
> +	int ts_code_ave = 0;
> +
> +	if (priv->mode != THERMAL_DEVICE_ENABLED)
> +		return -EAGAIN;

I'm pretty sure -EAGAIN is wrong error code here. -EBUSY or something?

> +	/*
> +	 * According to the HW manual (Rev.1.10, section 40.4.4 Procedure for Measuring the
> +	 * Temperature) the computation formula is as follows:
> +	 *
> +	 * Tj = (ts_code_ave - priv->calib1) * 165 / (priv->calib0 - priv->calib1) - 40
> +	 *
> +	 * Convert everything to milli Celsius before applying the formula to avoid
> +	 * losing precision.
> +	 */
> +
> +	*temp = div_s64((s64)(ts_code_ave - MCELSIUS(priv->calib1)) * MCELSIUS(165),
> +			MCELSIUS(priv->calib0 - priv->calib1)) - MCELSIUS(40);
> +
> +	/* Report it in milli degrees Celsius and round it up to 0.5 degrees Celsius. */
> +	*temp = roundup(*temp, 500);

If we did the computation in high precision, and interface wants
millicelsius, is rounding good idea?

> +static void rzg3s_thermal_set_mode(struct rzg3s_thermal_priv *priv,
> +				   enum thermal_device_mode mode)
> +{
> +	struct device *dev = priv->dev;
> +	int ret;
> +
> +	ret = pm_runtime_resume_and_get(dev);
> +	if (ret)
> +		return;

Now caller does not know if we failed or not. Should this return errno?

Best regards,
								Pavel
-- 
In cooperation with DENX Software Engineering GmbH, HRB 165235 Munich,
Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2025-12-29 20:22 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-17 10:32 [PATCH 6.12.y-cip 0/6] RZ/G3S: Backport TSU support Claudiu
2025-12-17 10:32 ` [PATCH 6.12.y-cip 1/6] clk: renesas: r9a08g045: Add clocks, resets and power domain support for the TSU IP Claudiu
2025-12-17 10:32 ` [PATCH 6.12.y-cip 2/6] dt-bindings: thermal: r9a08g045-tsu: Document the TSU unit Claudiu
2025-12-17 10:32 ` [PATCH 6.12.y-cip 3/6] thermal/drivers/renesas/rzg3s: Add thermal driver for the Renesas RZ/G3S SoC Claudiu
2025-12-29 20:21   ` Pavel Machek [this message]
2026-01-07 12:21     ` Claudiu Beznea
2025-12-17 10:32 ` [PATCH 6.12.y-cip 4/6] arm64: dts: renesas: r9a08g045: Add OPP table Claudiu
2025-12-17 10:32 ` [PATCH 6.12.y-cip 5/6] arm64: dts: renesas: r9a08g045: Add TSU node Claudiu
2025-12-17 10:32 ` [PATCH 6.12.y-cip 6/6] arm64: defconfig: Enable Renesas RZ/G3S thermal driver Claudiu
2025-12-25  2:13 ` [PATCH 6.12.y-cip 0/6] RZ/G3S: Backport TSU support nobuhiro.iwamatsu.x90
2025-12-29 13:20   ` [cip-dev] " Claudiu Beznea
2025-12-29 20:12     ` Pavel Machek
2025-12-29 20:26   ` Pavel Machek
2026-01-05 21:57   ` Pavel Machek

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=aVLi32qigJKR3NcP@duo.ucw.cz \
    --to=pavel@denx.de \
    --cc=cip-dev@lists.cip-project.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=nobuhiro.iwamatsu.x90@mail.toshiba \
    /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