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