Skip to content

Commit b98467f

Browse files
Peter Ujfalusidlezcano
authored andcommitted
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: 5093402 ("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
1 parent f8394f2 commit b98467f

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

drivers/thermal/ti-soc-thermal/ti-bandgap.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/err.h>
2121
#include <linux/types.h>
2222
#include <linux/spinlock.h>
23+
#include <linux/sys_soc.h>
2324
#include <linux/reboot.h>
2425
#include <linux/of_device.h>
2526
#include <linux/of_platform.h>
@@ -864,6 +865,17 @@ static struct ti_bandgap *ti_bandgap_build(struct platform_device *pdev)
864865
return bgp;
865866
}
866867

868+
/*
869+
* List of SoCs on which the CPU PM notifier can cause erros on the DTEMP
870+
* readout.
871+
* Enabled notifier on these machines results in erroneous, random values which
872+
* could trigger unexpected thermal shutdown.
873+
*/
874+
static const struct soc_device_attribute soc_no_cpu_notifier[] = {
875+
{ .machine = "OMAP4430" },
876+
{ /* sentinel */ },
877+
};
878+
867879
/*** Device driver call backs ***/
868880

869881
static
@@ -1020,7 +1032,8 @@ int ti_bandgap_probe(struct platform_device *pdev)
10201032

10211033
#ifdef CONFIG_PM_SLEEP
10221034
bgp->nb.notifier_call = bandgap_omap_cpu_notifier;
1023-
cpu_pm_register_notifier(&bgp->nb);
1035+
if (!soc_device_match(soc_no_cpu_notifier))
1036+
cpu_pm_register_notifier(&bgp->nb);
10241037
#endif
10251038

10261039
return 0;
@@ -1056,7 +1069,8 @@ int ti_bandgap_remove(struct platform_device *pdev)
10561069
struct ti_bandgap *bgp = platform_get_drvdata(pdev);
10571070
int i;
10581071

1059-
cpu_pm_unregister_notifier(&bgp->nb);
1072+
if (!soc_device_match(soc_no_cpu_notifier))
1073+
cpu_pm_unregister_notifier(&bgp->nb);
10601074

10611075
/* Remove sensor interfaces */
10621076
for (i = 0; i < bgp->conf->sensor_count; i++) {

0 commit comments

Comments
 (0)