Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * OMAP thermal definitions
0004  *
0005  * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
0006  * Contact:
0007  *   Eduardo Valentin <eduardo.valentin@ti.com>
0008  */
0009 #ifndef __TI_THERMAL_H
0010 #define __TI_THERMAL_H
0011 
0012 #include "ti-bandgap.h"
0013 
0014 /* PCB sensor calculation constants */
0015 #define OMAP_GRADIENT_SLOPE_W_PCB_4430              0
0016 #define OMAP_GRADIENT_CONST_W_PCB_4430              20000
0017 #define OMAP_GRADIENT_SLOPE_W_PCB_4460              1142
0018 #define OMAP_GRADIENT_CONST_W_PCB_4460              -393
0019 #define OMAP_GRADIENT_SLOPE_W_PCB_4470              1063
0020 #define OMAP_GRADIENT_CONST_W_PCB_4470              -477
0021 
0022 #define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU          100
0023 #define OMAP_GRADIENT_CONST_W_PCB_5430_CPU          484
0024 #define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU          464
0025 #define OMAP_GRADIENT_CONST_W_PCB_5430_GPU          -5102
0026 
0027 #define DRA752_GRADIENT_SLOPE_W_PCB             0
0028 #define DRA752_GRADIENT_CONST_W_PCB             2000
0029 
0030 /* trip points of interest in milicelsius (at hotspot level) */
0031 #define OMAP_TRIP_COLD                      100000
0032 #define OMAP_TRIP_HOT                       110000
0033 #define OMAP_TRIP_SHUTDOWN                  125000
0034 #define OMAP_TRIP_NUMBER                    2
0035 #define OMAP_TRIP_STEP                          \
0036     ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1))
0037 
0038 /* Update rates */
0039 #define FAST_TEMP_MONITORING_RATE               250
0040 
0041 /* helper macros */
0042 /**
0043  * ti_thermal_get_trip_value - returns trip temperature based on index
0044  * @i:  trip index
0045  */
0046 #define ti_thermal_get_trip_value(i)                    \
0047     (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP))
0048 
0049 /**
0050  * ti_thermal_is_valid_trip - check for trip index
0051  * @i:  trip index
0052  */
0053 #define ti_thermal_is_valid_trip(trip)              \
0054     ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER)
0055 
0056 #ifdef CONFIG_TI_THERMAL
0057 int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain);
0058 int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id);
0059 int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id);
0060 int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id);
0061 int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id);
0062 #else
0063 static inline
0064 int ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain)
0065 {
0066     return 0;
0067 }
0068 
0069 static inline
0070 int ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id)
0071 {
0072     return 0;
0073 }
0074 
0075 static inline
0076 int ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id)
0077 {
0078     return 0;
0079 }
0080 
0081 static inline
0082 int ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id)
0083 {
0084     return 0;
0085 }
0086 
0087 static inline
0088 int ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id)
0089 {
0090     return 0;
0091 }
0092 #endif
0093 #endif