18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * OMAP thermal definitions 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ 68c2ecf20Sopenharmony_ci * Contact: 78c2ecf20Sopenharmony_ci * Eduardo Valentin <eduardo.valentin@ti.com> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#ifndef __TI_THERMAL_H 108c2ecf20Sopenharmony_ci#define __TI_THERMAL_H 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include "ti-bandgap.h" 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci/* PCB sensor calculation constants */ 158c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_SLOPE_W_PCB_4430 0 168c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_CONST_W_PCB_4430 20000 178c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_SLOPE_W_PCB_4460 1142 188c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_CONST_W_PCB_4460 -393 198c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_SLOPE_W_PCB_4470 1063 208c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_CONST_W_PCB_4470 -477 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_SLOPE_W_PCB_5430_CPU 100 238c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_CONST_W_PCB_5430_CPU 484 248c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_SLOPE_W_PCB_5430_GPU 464 258c2ecf20Sopenharmony_ci#define OMAP_GRADIENT_CONST_W_PCB_5430_GPU -5102 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci#define DRA752_GRADIENT_SLOPE_W_PCB 0 288c2ecf20Sopenharmony_ci#define DRA752_GRADIENT_CONST_W_PCB 2000 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci/* trip points of interest in milicelsius (at hotspot level) */ 318c2ecf20Sopenharmony_ci#define OMAP_TRIP_COLD 100000 328c2ecf20Sopenharmony_ci#define OMAP_TRIP_HOT 110000 338c2ecf20Sopenharmony_ci#define OMAP_TRIP_SHUTDOWN 125000 348c2ecf20Sopenharmony_ci#define OMAP_TRIP_NUMBER 2 358c2ecf20Sopenharmony_ci#define OMAP_TRIP_STEP \ 368c2ecf20Sopenharmony_ci ((OMAP_TRIP_SHUTDOWN - OMAP_TRIP_HOT) / (OMAP_TRIP_NUMBER - 1)) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* Update rates */ 398c2ecf20Sopenharmony_ci#define FAST_TEMP_MONITORING_RATE 250 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci/* helper macros */ 428c2ecf20Sopenharmony_ci/** 438c2ecf20Sopenharmony_ci * ti_thermal_get_trip_value - returns trip temperature based on index 448c2ecf20Sopenharmony_ci * @i: trip index 458c2ecf20Sopenharmony_ci */ 468c2ecf20Sopenharmony_ci#define ti_thermal_get_trip_value(i) \ 478c2ecf20Sopenharmony_ci (OMAP_TRIP_HOT + ((i) * OMAP_TRIP_STEP)) 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/** 508c2ecf20Sopenharmony_ci * ti_thermal_is_valid_trip - check for trip index 518c2ecf20Sopenharmony_ci * @i: trip index 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_ci#define ti_thermal_is_valid_trip(trip) \ 548c2ecf20Sopenharmony_ci ((trip) >= 0 && (trip) < OMAP_TRIP_NUMBER) 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_ci#ifdef CONFIG_TI_THERMAL 578c2ecf20Sopenharmony_ciint ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain); 588c2ecf20Sopenharmony_ciint ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id); 598c2ecf20Sopenharmony_ciint ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id); 608c2ecf20Sopenharmony_ciint ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id); 618c2ecf20Sopenharmony_ciint ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id); 628c2ecf20Sopenharmony_ci#else 638c2ecf20Sopenharmony_cistatic inline 648c2ecf20Sopenharmony_ciint ti_thermal_expose_sensor(struct ti_bandgap *bgp, int id, char *domain) 658c2ecf20Sopenharmony_ci{ 668c2ecf20Sopenharmony_ci return 0; 678c2ecf20Sopenharmony_ci} 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_cistatic inline 708c2ecf20Sopenharmony_ciint ti_thermal_remove_sensor(struct ti_bandgap *bgp, int id) 718c2ecf20Sopenharmony_ci{ 728c2ecf20Sopenharmony_ci return 0; 738c2ecf20Sopenharmony_ci} 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_cistatic inline 768c2ecf20Sopenharmony_ciint ti_thermal_report_sensor_temperature(struct ti_bandgap *bgp, int id) 778c2ecf20Sopenharmony_ci{ 788c2ecf20Sopenharmony_ci return 0; 798c2ecf20Sopenharmony_ci} 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_cistatic inline 828c2ecf20Sopenharmony_ciint ti_thermal_register_cpu_cooling(struct ti_bandgap *bgp, int id) 838c2ecf20Sopenharmony_ci{ 848c2ecf20Sopenharmony_ci return 0; 858c2ecf20Sopenharmony_ci} 868c2ecf20Sopenharmony_ci 878c2ecf20Sopenharmony_cistatic inline 888c2ecf20Sopenharmony_ciint ti_thermal_unregister_cpu_cooling(struct ti_bandgap *bgp, int id) 898c2ecf20Sopenharmony_ci{ 908c2ecf20Sopenharmony_ci return 0; 918c2ecf20Sopenharmony_ci} 928c2ecf20Sopenharmony_ci#endif 938c2ecf20Sopenharmony_ci#endif 94