1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * OMAP thermal definitions
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
6*4882a593Smuzhiyun * Contact:
7*4882a593Smuzhiyun * Eduardo Valentin <eduardo.valentin@ti.com>
8*4882a593Smuzhiyun */
9*4882a593Smuzhiyun #ifndef __TI_THERMAL_H
10*4882a593Smuzhiyun #define __TI_THERMAL_H
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun #include "ti-bandgap.h"
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun /* PCB sensor calculation constants */
15*4882a593Smuzhiyun #define OMAP_GRADIENT_SLOPE_W_PCB_4430 0
16*4882a593Smuzhiyun #define OMAP_GRADIENT_CONST_W_PCB_4430 20000
17*4882a593Smuzhiyun #define OMAP_GRADIENT_SLOPE_W_PCB_4460 1142
18*4882a593Smuzhiyun #define OMAP_GRADIENT_CONST_W_PCB_4460 -393
19*4882a593Smuzhiyun #define OMAP_GRADIENT_SLOPE_W_PCB_4470 1063
20*4882a593Smuzhiyun #define OMAP_GRADIENT_CONST_W_PCB_4470 -477
21*4882a593Smuzhiyun
22*4882a593Smuzhiyun #define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 100
23*4882a593Smuzhiyun #define OMAP_GRADIENT_CONST_W_PCB_5430_CPU 484
24*4882a593Smuzhiyun #define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464
25*4882a593Smuzhiyun #define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun #define DRA752_GRADIENT_SLOPE_W_PCB 0
28*4882a593Smuzhiyun #define DRA752_GRADIENT_CONST_W_PCB 2000
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun /* trip points of interest in milicelsius (at hotspot level) */
31*4882a593Smuzhiyun #define OMAP_TRIP_COLD 100000
32*4882a593Smuzhiyun #define OMAP_TRIP_HOT 110000
33*4882a593Smuzhiyun #define OMAP_TRIP_SHUTDOWN 125000
34*4882a593Smuzhiyun #define OMAP_TRIP_NUMBER 2
35*4882a593Smuzhiyun #define OMAP_TRIP_STEP \
36*4882a593Smuzhiyun ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1))
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun /* Update rates */
39*4882a593Smuzhiyun #define FAST_TEMP_MONITORING_RATE 250
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun /* helper macros */
42*4882a593Smuzhiyun /**
43*4882a593Smuzhiyun * ti_thermal_get_trip_value - returns trip temperature based on index
44*4882a593Smuzhiyun * @i: trip index
45*4882a593Smuzhiyun */
46*4882a593Smuzhiyun #define ti_thermal_get_trip_value(i) \
47*4882a593Smuzhiyun (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
48*4882a593Smuzhiyun
49*4882a593Smuzhiyun /**
50*4882a593Smuzhiyun * ti_thermal_is_valid_trip - check for trip index
51*4882a593Smuzhiyun * @i: trip index
52*4882a593Smuzhiyun */
53*4882a593Smuzhiyun #define ti_thermal_is_valid_trip(trip) \
54*4882a593Smuzhiyun ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
55*4882a593Smuzhiyun
56*4882a593Smuzhiyun #ifdef CONFIG_TI_THERMAL
57*4882a593Smuzhiyun int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain);
58*4882a593Smuzhiyun int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id);
59*4882a593Smuzhiyun int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id);
60*4882a593Smuzhiyun int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id);
61*4882a593Smuzhiyun int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id);
62*4882a593Smuzhiyun #else
63*4882a593Smuzhiyun static inline
ti_thermal_expose_sensor(struct ti_bandgap * bgp,int id,char * domain)64*4882a593Smuzhiyun int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain)
65*4882a593Smuzhiyun {
66*4882a593Smuzhiyun return 0;
67*4882a593Smuzhiyun }
68*4882a593Smuzhiyun
69*4882a593Smuzhiyun static inline
ti_thermal_remove_sensor(struct ti_bandgap * bgp,int id)70*4882a593Smuzhiyun int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
71*4882a593Smuzhiyun {
72*4882a593Smuzhiyun return 0;
73*4882a593Smuzhiyun }
74*4882a593Smuzhiyun
75*4882a593Smuzhiyun static inline
ti_thermal_report_sensor_temperature(struct ti_bandgap * bgp,int id)76*4882a593Smuzhiyun int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
77*4882a593Smuzhiyun {
78*4882a593Smuzhiyun return 0;
79*4882a593Smuzhiyun }
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun static inline
ti_thermal_register_cpu_cooling(struct ti_bandgap * bgp,int id)82*4882a593Smuzhiyun int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
83*4882a593Smuzhiyun {
84*4882a593Smuzhiyun return 0;
85*4882a593Smuzhiyun }
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun static inline
ti_thermal_unregister_cpu_cooling(struct ti_bandgap * bgp,int id)88*4882a593Smuzhiyun int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
89*4882a593Smuzhiyun {
90*4882a593Smuzhiyun return 0;
91*4882a593Smuzhiyun }
92*4882a593Smuzhiyun #endif
93*4882a593Smuzhiyun #endif
94