Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Binbin Zhou" <zhoubinbin@loongson.cn>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v9 7/7] thermal/drivers/loongson2: Add Loongson-2K0300 support
Date: Mon, 09 Nov 2026 08:32:16 +0000	[thread overview]
Message-ID: <sashiko-outbox-204590@kernel.org> (raw)
In-Reply-To: <038de1cc102684e0abad6c25cac0138f065a0311.1794211535.git.zhoubinbin@loongson.cn>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] thermal/drivers/loongson2: unmasked trip IRQ in
  ls2k0300_thermal_hw_init()
--

commit 024ebeb46fbe6ba2893fe68297ad030cb9ce5fe2
Author: Binbin Zhou <zhoubinbin@loongson.cn>

thermal/drivers/loongson2: Add Loongson-2K0300 support

This commit adds thermal sensor support for the Loongson-2K0300 SoC,
reading calibration data from the CHIP ID syscon registers and falling
back to an uncalibrated slope if the initial reading is out of range.

> diff --git a/drivers/thermal/loongson2_thermal.c b/drivers/thermal/loongson2_thermal.c
> index 4ce162dfb1229..68e6105051c60 100644
> --- a/drivers/thermal/loongson2_thermal.c
> +++ b/drivers/thermal/loongson2_thermal.c
[ ... ]
> @@ -87,6 +122,107 @@ static int loongson2_thermal_set_trips(struct thermal_zone_device *tz, int low,
[ ... ]
> +static int ls2k0300_thermal_hw_init(struct platform_device *pdev,
> +				    struct loongson2_thermal_data *data)
> +{
> +	struct device *dev = &pdev->dev;
> +	int ret;
> +
> +	data->regmap_cfg = syscon_regmap_lookup_by_phandle(dev->of_node, "loongson,chipid");
> +	if (IS_ERR(data->regmap_cfg))
> +		return PTR_ERR(data->regmap_cfg);
> +
> +	ret = ls2k0300_thermal_read_calib(data);
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to read calibration data");
> +
> +	writel(LS2K0300_THSENS_INIT_MASK, data->ctrl_reg + LS2K0300_THSENS_CFG_REG);
> +
> +	/*
> +	 * Wait for the ADC to produce the first valid conversion before
> +	 * using OUT_REG for the old-fuse sanity check.
> +	 */
> +	usleep_range(1000, 2000);
> +
> +	ls2k0300_thermal_detect_old_fuse(dev, data);
> +
> +	return 0;
> +}
[ ... ]
> @@ -178,6 +314,10 @@ static int ls2k2000_thermal_hw_init(struct platform_device *pdev,
>  	return 0;
>  }
>  
> +static const struct thermal_zone_device_ops ls2k0300_thermal_zone_ops = {
> +	.get_temp = ls2k0300_thermal_get_temp,
> +};

[Severity: Medium]
Can this cause a thermal interrupt storm on Loongson-2K0300 if trip
interrupts were left enabled by firmware or a previous kernel across
kexec?

Unlike ls2k1000_thermal_hw_init() and ls2k2000_thermal_hw_init(),
ls2k0300_thermal_hw_init() does not clear LOONGSON2_THSENS_STATUS_REG or
disable trip-point interrupts, while loongson2_thermal_probe() still
unconditionally registers loongson2_thermal_irq_thread().  Because
ls2k0300_thermal_zone_ops omits .set_trips, thermal_zone_device_update()
in the IRQ handler cannot update the hardware trip window or mask the
interrupt enable bit, so the comparator will keep re-asserting the
level-triggered interrupt on subsequent ADC conversions.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1794211535.git.zhoubinbin@loongson.cn?part=7

      reply	other threads:[~2026-11-09  8:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09  8:08 [PATCH v9 0/7] thermal/drivers/loongson2: Fix trip programming and add Loongson-2K0300 support Binbin Zhou
2026-11-09  8:08 ` [PATCH v9 1/7] thermal/drivers/loongson2: Fix negative trip conversion in set_trips Binbin Zhou
2026-11-09  8:08 ` [PATCH v9 2/7] thermal/drivers/loongson2: Fix clamp() usage for thermal trip points Binbin Zhou
2026-11-09  8:15   ` sashiko-bot
2026-11-09  8:08 ` [PATCH v9 3/7] thermal/drivers/loongson2: Fix Loongson-2K2000 trip point programming Binbin Zhou
2026-11-09  8:09 ` [PATCH v9 4/7] thermal/drivers/loongson2: Simplify thermal sensor registration Binbin Zhou
2026-11-09  8:09 ` [PATCH v9 5/7] thermal/drivers/loongson2: Move per-SoC ops and init into chip data Binbin Zhou
2026-11-09  8:09 ` [PATCH v9 6/7] dt-bindings: thermal: loongson,ls2k-thermal: Add compatible for Loongson-2K0300 Binbin Zhou
2026-11-09  8:18   ` sashiko-bot
2026-11-09  8:10 ` [PATCH v9 7/7] thermal/drivers/loongson2: Add Loongson-2K0300 support Binbin Zhou
2026-11-09  8:32   ` sashiko-bot [this message]

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=sashiko-outbox-204590@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=zhoubinbin@loongson.cn \
    /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