summaryrefslogtreecommitdiff
path: root/zephyr/program/myst/src/stt.c
blob: f739155ee650dd81428f7cd282e7e520abb73e4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/* Copyright 2023 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* Support code for STT temperature reporting */

#include "chipset.h"
#include "driver/temp_sensor/f75303.h"
#include "temp_sensor/pct2075.h"
#include "temp_sensor/temp_sensor.h"

int board_get_soc_temp_mk(int *temp_mk)
{
	if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
		return EC_ERROR_NOT_POWERED;

#ifdef CONFIG_TEMP_SENSOR_PCT2075
	return pct2075_get_val_mk(PCT2075_SENSOR_ID(DT_NODELABEL(soc_pct2075)),
				  temp_mk);
#else
	return f75303_get_val_mk(F75303_SENSOR_ID(DT_NODELABEL(soc_f75303)),
				 temp_mk);
#endif
}

int board_get_ambient_temp_mk(int *temp_mk)
{
	if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
		return EC_ERROR_NOT_POWERED;

#ifdef CONFIG_TEMP_SENSOR_PCT2075
	return pct2075_get_val_mk(PCT2075_SENSOR_ID(DT_NODELABEL(amb_pct2075)),
				  temp_mk);
#else
	return f75303_get_val_mk(F75303_SENSOR_ID(DT_NODELABEL(amb_f75303)),
				 temp_mk);
#endif
}