Re: [PATCH v9,4/7] thermal: mediatek: Add LVTS driver for mt8192 thermal zones

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Il 15/09/22 18:58, Balsam CHIHI ha scritto:
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.


It's the wrong error number. You have to return -EAGAIN :-)

+
+     } else
+             *temperature = lvts_raw_to_temp(&lvts_data->coeff, msr_raw);
+
+     return 0;
+}

Best regards,
Balsam




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux