Hi Angelo,
+static int soc_temp_lvts_read_temp(void *data, int *temperature)
+{
+ struct soc_temp_tz *lvts_tz = (struct soc_temp_tz *)data;
+ struct lvts_data *lvts_data = lvts_tz->lvts_data;
+ struct device *dev = lvts_data->dev;
+ unsigned int msr_raw;
+
+ msr_raw = readl(lvts_data->reg[lvts_tz->id]) & MRS_RAW_MASK;
+ if (msr_raw == 0) {
+ /* Prevents a false critical temperature trap */
+ *temperature = 0;
+ dev_dbg(dev, "LVTS not yet ready\n");
...and you're not returning an error code, despite this function was called
while LVTS is still not ready? :-)
if I add "return -ENAVAIL;" here, I will get the following errors on boot :
[ 0.292094] thermal thermal_zone0: failed to read out thermal zone (-119)
[ 0.293019] thermal thermal_zone1: failed to read out thermal zone (-119)
[ 0.294158] thermal thermal_zone6: failed to read out thermal zone (-119)
[ 0.295697] thermal thermal_zone9: failed to read out thermal zone (-119)
[ 0.296600] thermal thermal_zone10: failed to read out thermal zone (-119)
[ 0.297698] thermal thermal_zone15: failed to read out thermal zone (-119)
[ 0.298625] thermal thermal_zone16: failed to read out thermal zone (-119)
I just preferred : *temperature = 0; to avoid a false critical temperature trap,
and "return 0;" to suppress these errors.
After that (first read at boot when LVTS is not fully ready),
"msr_raw" will be always != 0.
And I did not want to add a "delay" or a "sleep".
Please let me know if you have any suggestions that could fix it in a
better way.
+
+ } else
+ *temperature = lvts_raw_to_temp(&lvts_data->coeff, msr_raw);
+
+ return 0;
+}
Best regards,
Balsam