2020-05-24 21:30:55 +01:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#ifndef TEMPERATURE_H
|
|
|
|
#define TEMPERATURE_H
|
2022-02-19 16:17:40 +00:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
*
|
2020-05-24 21:30:55 +01:00
|
|
|
* Provides a function to read the CPU core temperature.
|
|
|
|
*
|
2022-02-19 19:56:55 +00:00
|
|
|
*//*
|
2022-02-19 16:17:40 +00:00
|
|
|
* Copyright (C) 2020-2022 Martin Whitaker.
|
2023-02-13 22:29:17 +01:00
|
|
|
* Copyright (C) 2003-2023 Sam Demeulemeester.
|
2020-05-24 21:30:55 +01:00
|
|
|
*/
|
|
|
|
|
2023-02-13 22:29:17 +01:00
|
|
|
#define AMD_TEMP_REG_K8 0xE4
|
|
|
|
#define AMD_TEMP_REG_K10 0xA4
|
|
|
|
|
2024-11-11 22:49:31 +00:00
|
|
|
#define AMD_SMU_INDEX_ADDR_REG 0xB8
|
|
|
|
#define AMD_SMU_INDEX_DATA_REG 0xBC
|
|
|
|
#define AMD_F15_M60H_TEMP_CTRL_OFFSET 0xD8200CA4
|
|
|
|
|
2023-05-12 15:33:28 +02:00
|
|
|
// Temp Registers on AMD ZEN System Management Network
|
|
|
|
#define SMN_SMUIO_THM 0x00059800
|
|
|
|
#define SMN_THM_TCON_CUR_TMP (SMN_SMUIO_THM + 0x00)
|
|
|
|
|
2023-02-13 22:29:17 +01:00
|
|
|
/**
|
|
|
|
* Global CPU Temperature offset
|
|
|
|
*/
|
|
|
|
extern float cpu_temp_offset;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Init temperature sensor and compute offsets if needed
|
|
|
|
*/
|
|
|
|
void temperature_init(void);
|
|
|
|
|
2022-02-19 16:17:40 +00:00
|
|
|
/**
|
2020-05-24 21:30:55 +01:00
|
|
|
* Returns the current temperature of the CPU. Returns 0 if
|
|
|
|
* the temperature cannot be read.
|
|
|
|
*/
|
|
|
|
int get_cpu_temperature(void);
|
|
|
|
|
|
|
|
#endif // TEMPERATURE_H
|