Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: ti-soc-thermal: Disable the CPU PM notifier for OMAP4430

It has been observed that on OMAP4430 (ES2.0, ES2.1 and ES2.3) the enabled
notifier causes errors on the DTEMP readout values:

ti-soc-thermal 4a002260.bandgap: in range ADC val: 52
ti-soc-thermal 4a002260.bandgap: in range ADC val: 64
ti-soc-thermal 4a002260.bandgap: in range ADC val: 64
ti-soc-thermal 4a002260.bandgap: out of range ADC val: 0
thermal thermal_zone0: failed to read out thermal zone (-5)
ti-soc-thermal 4a002260.bandgap: out of range ADC val: 0
thermal thermal_zone0: failed to read out thermal zone (-5)
ti-soc-thermal 4a002260.bandgap: out of range ADC val: 4
thermal thermal_zone0: failed to read out thermal zone (-5)
ti-soc-thermal 4a002260.bandgap: in range ADC val: 100

raw 100 translates to 133 Celsius on omap4-sdp, triggering shutdown due to
critical temperature.

When the notifier is disable for OMAP4430 the DTEMP values are stable:
ti-soc-thermal 4a002260.bandgap: in range ADC val: 56
ti-soc-thermal 4a002260.bandgap: in range ADC val: 56
ti-soc-thermal 4a002260.bandgap: in range ADC val: 57
ti-soc-thermal 4a002260.bandgap: in range ADC val: 57
ti-soc-thermal 4a002260.bandgap: in range ADC val: 56

Fixes: 5093402e5b44 ("thermal: ti-soc-thermal: Enable addition power management")
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20201029100335.27665-1-peter.ujfalusi@ti.com

authored by

Peter Ujfalusi and committed by
Daniel Lezcano
b98467fe f8394f23

+16 -2
+16 -2
drivers/thermal/ti-soc-thermal/ti-bandgap.c
··· 20 20 #include <linux/err.h> 21 21 #include <linux/types.h> 22 22 #include <linux/spinlock.h> 23 + #include <linux/sys_soc.h> 23 24 #include <linux/reboot.h> 24 25 #include <linux/of_device.h> 25 26 #include <linux/of_platform.h> ··· 865 864 return bgp; 866 865 } 867 866 867 + /* 868 + * List of SoCs on which the CPU PM notifier can cause erros on the DTEMP 869 + * readout. 870 + * Enabled notifier on these machines results in erroneous, random values which 871 + * could trigger unexpected thermal shutdown. 872 + */ 873 + static const struct soc_device_attribute soc_no_cpu_notifier[] = { 874 + { .machine = "OMAP4430" }, 875 + { /* sentinel */ }, 876 + }; 877 + 868 878 /*** Device driver call backs ***/ 869 879 870 880 static ··· 1032 1020 1033 1021 #ifdef CONFIG_PM_SLEEP 1034 1022 bgp->nb.notifier_call = bandgap_omap_cpu_notifier; 1035 - cpu_pm_register_notifier(&bgp->nb); 1023 + if (!soc_device_match(soc_no_cpu_notifier)) 1024 + cpu_pm_register_notifier(&bgp->nb); 1036 1025 #endif 1037 1026 1038 1027 return 0; ··· 1069 1056 struct ti_bandgap *bgp = platform_get_drvdata(pdev); 1070 1057 int i; 1071 1058 1072 - cpu_pm_unregister_notifier(&bgp->nb); 1059 + if (!soc_device_match(soc_no_cpu_notifier)) 1060 + cpu_pm_unregister_notifier(&bgp->nb); 1073 1061 1074 1062 /* Remove sensor interfaces */ 1075 1063 for (i = 0; i < bgp->conf->sensor_count; i++) {