Re: [PATCH v2 3/4] hwmon: smpro: Add Ampere's Altra smpro-hwmon driver

From: Quan Nguyen
Date: Thu Apr 08 2021 - 08:02:39 EST


On 07/04/2021 19:11, Guenter Roeck wrote:
On 4/7/21 12:41 AM, Quan Nguyen wrote:
[ ... ]

But then why don't you just use reg_ext to store SOC_VR_HOT_THRESHOLD_REG
or MEM_HOT_THRESHOLD_REG ? It is already available, after all, and with it
the code could be simplified to

        ret = regmap_read(hwmon->regmap, temperature[channel].reg_ext, &value);
        if (ret)
            return ret;

Thank you for the comment.

Will change code follow this suggestion, will include in next version

I don't have a datasheet, but I do wonder what is in bit 9..15. Any idea ?
Main question is if there is a sign bit, as theoretic as it may be.

The original intention was to use this as 9-bit 2-complement value follow LM75, but the fact is that the operation temperature is 0-125 C degree, so we simply use it as-is.


The operational temperature is not the question here. The question is if the
chip _reports_ a sign. If it does, it should be handled, even if it is outside
the operational range. The reported range is relevant here, not the operational
range. After all, the chip won't really blow apart at -1 degrees C.


I think I've got it, will handle the sign bit in next version.

-Quan