Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

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