Re: [PATCH RFC v2 3/5] thermal: qcom: Add support for MBG thermal monitoring
From: Jonathan Cameron
Date: Sat Dec 14 2024 - 09:18:07 EST
On Thu, 12 Dec 2024 21:41:22 +0530
Satya Priya Kakitapalli <quic_skakitap@xxxxxxxxxxx> wrote:
> Add driver for the MBG thermal monitoring device. It monitors
> the die temperature, and when there is a level 1 upper threshold
> violation, it receives an interrupt over spmi. The driver reads
> the fault status register and notifies thermal accordingly.
>
> Signed-off-by: Satya Priya Kakitapalli <quic_skakitap@xxxxxxxxxxx>
Just a quick comment on consistency of formatting.
> +static int mbg_tm_set_trip_temp(struct thermal_zone_device *tz, int low_temp,
> + int temp)
> +{
> + struct mbg_tm_chip *chip = thermal_zone_device_priv(tz);
> + int ret = 0;
> +
> + guard(mutex)(&chip->lock);
> +
> + /* The HW has a limitation that the trip set must be above 25C */
> + if (temp > MBG_MIN_TRIP_TEMP && temp < MBG_MAX_SUPPORTED_TEMP) {
> + regmap_set_bits(chip->map,
> + chip->base + MBG_TEMP_MON2_MISC_CFG, MON2_UP_THRESH_EN);
> + ret = regmap_write(chip->map, chip->base + MON2_LVL1_UP_THRESH,
> + temp_to_vtemp(temp));
Alignment in this driver should be consistent / tidied up.
I'm not sure on style preferred in thermal, but I'd always default to align
after the opening bracket + wrap at 80 chars unless readability is hurt.
> + if (ret < 0)
> + return ret;
> + } else {
> + dev_dbg(chip->dev, "Set trip b/w 25C and 160C\n");
> + regmap_clear_bits(chip->map,
> + chip->base + MBG_TEMP_MON2_MISC_CFG, MON2_UP_THRESH_EN);
> + }