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
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * temp.c	Thermal management for cpu's with Thermal Assist Units
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Written by Troy Benjegerdes <hozer@drgw.net>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * TODO:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * dynamic power management to limit peak CPU temp (using ICTC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * calibration???
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * Silly, crazy ideas: use cpu load (from scheduler) and ICTC to extend battery
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * life in portables, and add a 'performance/watt' metric somewhere in /proc
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/string.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/workqueue.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <asm/reg.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include <asm/nvram.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include <asm/cache.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include <asm/8xx_immap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include <asm/machdep.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #include <asm/asm-prototypes.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "setup.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) static struct tau_temp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	int interrupts;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	unsigned char low;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	unsigned char high;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	unsigned char grew;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) } tau[NR_CPUS];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static bool tau_int_enable;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) /* TODO: put these in a /proc interface, with some sanity checks, and maybe
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * dynamic adjustment to minimize # of interrupts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /* configurable values for step size and how much to expand the window when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * we get an interrupt. These are based on the limit that was out of range */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #define step_size		2	/* step size when temp goes out of range */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) #define window_expand		1	/* expand the window by this much */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) /* configurable values for shrinking the window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) #define shrink_timer	2000	/* period between shrinking the window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) #define min_window	2	/* minimum window size, degrees C */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) static void set_thresholds(unsigned long cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	u32 maybe_tie = tau_int_enable ? THRM1_TIE : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	/* setup THRM1, threshold, valid bit, interrupt when below threshold */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	mtspr(SPRN_THRM1, THRM1_THRES(tau[cpu].low) | THRM1_V | maybe_tie | THRM1_TID);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	/* setup THRM2, threshold, valid bit, interrupt when above threshold */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	mtspr(SPRN_THRM2, THRM1_THRES(tau[cpu].high) | THRM1_V | maybe_tie);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) static void TAUupdate(int cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 	u32 thrm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	u32 bits = THRM1_TIV | THRM1_TIN | THRM1_V;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	/* if both thresholds are crossed, the step_sizes cancel out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	 * and the window winds up getting expanded twice. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	thrm = mfspr(SPRN_THRM1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	if ((thrm & bits) == bits) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		mtspr(SPRN_THRM1, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		if (tau[cpu].low >= step_size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 			tau[cpu].low -= step_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 			tau[cpu].high -= (step_size - window_expand);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		tau[cpu].grew = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		pr_debug("%s: low threshold crossed\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	thrm = mfspr(SPRN_THRM2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	if ((thrm & bits) == bits) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 		mtspr(SPRN_THRM2, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		if (tau[cpu].high <= 127 - step_size) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			tau[cpu].low += (step_size - window_expand);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 			tau[cpu].high += step_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 		tau[cpu].grew = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		pr_debug("%s: high threshold crossed\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #ifdef CONFIG_TAU_INT
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99)  * TAU interrupts - called when we have a thermal assist unit interrupt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100)  * with interrupts disabled
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) void TAUException(struct pt_regs * regs)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 	int cpu = smp_processor_id();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	irq_enter();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	tau[cpu].interrupts++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	TAUupdate(cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 	irq_exit();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) #endif /* CONFIG_TAU_INT */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) static void tau_timeout(void * info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	int cpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	int size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	int shrink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	cpu = smp_processor_id();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	if (!tau_int_enable)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		TAUupdate(cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	/* Stop thermal sensor comparisons and interrupts */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	mtspr(SPRN_THRM3, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	size = tau[cpu].high - tau[cpu].low;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	if (size > min_window && ! tau[cpu].grew) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		/* do an exponential shrink of half the amount currently over size */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		shrink = (2 + size - min_window) / 4;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		if (shrink) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 			tau[cpu].low += shrink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 			tau[cpu].high -= shrink;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		} else { /* size must have been min_window + 1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 			tau[cpu].low += 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) #if 1 /* debug */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 			if ((tau[cpu].high - tau[cpu].low) != min_window){
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 				printk(KERN_ERR "temp.c: line %d, logic error\n", __LINE__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	tau[cpu].grew = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	set_thresholds(cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	/* Restart thermal sensor comparisons and interrupts.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	 * The "PowerPC 740 and PowerPC 750 Microprocessor Datasheet"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	 * recommends that "the maximum value be set in THRM3 under all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	 * conditions."
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	mtspr(SPRN_THRM3, THRM3_SITV(0x1fff) | THRM3_E);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) static struct workqueue_struct *tau_workq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static void tau_work_func(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	msleep(shrink_timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	on_each_cpu(tau_timeout, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	/* schedule ourselves to be run again */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	queue_work(tau_workq, work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) DECLARE_WORK(tau_work, tau_work_func);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172)  * setup the TAU
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)  * Set things up to use THRM1 as a temperature lower bound, and THRM2 as an upper bound.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)  * Start off at zero
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) int tau_initialized = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) static void __init TAU_init_smp(void *info)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	unsigned long cpu = smp_processor_id();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	/* set these to a reasonable value and let the timer shrink the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	 * window */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	tau[cpu].low = 5;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	tau[cpu].high = 120;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	set_thresholds(cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static int __init TAU_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	/* We assume in SMP that if one CPU has TAU support, they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	 * all have it --BenH
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	if (!cpu_has_feature(CPU_FTR_TAU)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		printk("Thermal assist unit not available\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 		tau_initialized = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		return 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	tau_int_enable = IS_ENABLED(CONFIG_TAU_INT) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 			 !strcmp(cur_cpu_spec->platform, "ppc750");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	tau_workq = alloc_workqueue("tau", WQ_UNBOUND, 1, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	if (!tau_workq)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	on_each_cpu(TAU_init_smp, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	queue_work(tau_workq, &tau_work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	pr_info("Thermal assist unit using %s, shrink_timer: %d ms\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		tau_int_enable ? "interrupts" : "workqueue", shrink_timer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	tau_initialized = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) __initcall(TAU_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * return current temp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) u32 cpu_temp_both(unsigned long cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	return ((tau[cpu].high << 16) | tau[cpu].low);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) u32 cpu_temp(unsigned long cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	return ((tau[cpu].high + tau[cpu].low) / 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) u32 tau_interrupts(unsigned long cpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	return (tau[cpu].interrupts);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) }