Skip to content

Commit d154431

Browse files
authored
Merge pull request #716 from FrameworkComputer/lotus.thermal_sensor_wrong_idx
Fix wrong F75303 index and STT index
2 parents b0a351c + 30fba49 commit d154431

File tree

6 files changed

+49
-16
lines changed

6 files changed

+49
-16
lines changed

zephyr/program/lotus/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON
1919
"src/led_pwm.c")
2020
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_LED_COMMON
2121
"src/led.c")
22-
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_AMD_STT
23-
"src/stt.c")
2422

2523
if(DEFINED CONFIG_BOARD_LOTUS)
2624
project(lotus)
@@ -39,6 +37,9 @@ if(DEFINED CONFIG_BOARD_LOTUS)
3937
"lotus/src/amd_r23m.c"
4038
"lotus/src/ej889i.c"
4139
)
40+
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_AMD_STT
41+
"lotus/src/stt.c")
42+
4243
endif()
4344
if(DEFINED CONFIG_BOARD_AZALEA)
4445
project(azalea)
@@ -53,4 +54,7 @@ if(DEFINED CONFIG_BOARD_AZALEA)
5354
"azalea/src/project_diagnostics.c"
5455
"azalea/src/power_button_x86.c"
5556
)
57+
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_AMD_STT
58+
"azalea/src/stt.c")
59+
5660
endif()

zephyr/program/lotus/lotus/i2c.dtsi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,21 +193,21 @@
193193
pinctrl-names = "default";
194194

195195
/* TODO: Add the device on this bus */
196-
local_f75303: local_f75303@4d {
196+
ambient_f75303: ambient_f75303@4d {
197197
compatible = "cros-ec,temp-sensor-f75303";
198198
temperature-type = "F75303_IDX_LOCAL";
199199
reg = <0x4d>;
200200
};
201201

202-
ddr_f75303: ddr_f75303@4d {
202+
charger_f75303: charger_f75303@4d {
203203
compatible = "cros-ec,temp-sensor-f75303";
204-
temperature-type = "F75303_IDX_REMOTE1";
204+
temperature-type = "F75303_IDX_REMOTE2";
205205
reg = <0x4d>;
206206
};
207207

208-
cpu_f75303: cpu_f75303@4d {
208+
apu_f75303: apu_f75303@4d {
209209
compatible = "cros-ec,temp-sensor-f75303";
210-
temperature-type = "F75303_IDX_REMOTE2";
210+
temperature-type = "F75303_IDX_REMOTE1";
211211
reg = <0x4d>;
212212
};
213213

zephyr/program/lotus/lotus/overlay.dtsi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
named-temp-sensors {
1212
compatible = "cros-ec,temp-sensors";
13-
local-f75303 {
13+
ambient-f75303 {
1414
temp_host_warn = <90>;
1515
temp_host_high = <90>;
1616
temp_host_halt = <105>;
@@ -19,9 +19,9 @@
1919
temp_fan_off = <45>;
2020
temp_fan_max = <60>;
2121
power-good-pin = <&gpio_slp_s3_l>;
22-
sensor = <&local_f75303>;
22+
sensor = <&ambient_f75303>;
2323
};
24-
ddr-f75303 {
24+
charger-f75303 {
2525
temp_host_warn = <90>;
2626
temp_host_high = <90>;
2727
temp_host_halt = <105>;
@@ -30,9 +30,9 @@
3030
temp_fan_off = <45>;
3131
temp_fan_max = <60>;
3232
power-good-pin = <&gpio_slp_s3_l>;
33-
sensor = <&ddr_f75303>;
33+
sensor = <&charger_f75303>;
3434
};
35-
cpu-f75303 {
35+
apu-f75303 {
3636
temp_host_warn = <90>;
3737
temp_host_high = <90>;
3838
temp_host_halt = <105>;
@@ -41,7 +41,7 @@
4141
temp_fan_off = <45>;
4242
temp_fan_max = <62>;
4343
power-good-pin = <&gpio_slp_s3_l>;
44-
sensor = <&cpu_f75303>;
44+
sensor = <&apu_f75303>;
4545
};
4646
amd-apu {
4747
temp_host_warn = <108>;

zephyr/program/lotus/lotus/src/f75303.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ void f75303_update_temperature(int idx)
7777
if (idx >= F75303_IDX_COUNT)
7878
return;
7979
switch (idx) {
80-
/* local_f75303 */
80+
/* ambient_f75303 */
8181
case 0:
8282
rv = get_temp(idx, F75303_TEMP_LOCAL_REGISTER, &temp_reg);
8383
break;
84-
/* ddr_f75303 */
84+
/* apu_f75303 */
8585
case 1:
8686
rv = get_temp(idx, F75303_TEMP_REMOTE1_REGISTER, &temp_reg);
8787
break;
88-
/* cpu_f75303 */
88+
/* charger_f75303 */
8989
case 2:
9090
rv = get_temp(idx, F75303_TEMP_REMOTE2_REGISTER, &temp_reg);
9191
break;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* Copyright 2022 The ChromiumOS Authors
2+
* Use of this source code is governed by a BSD-style license that can be
3+
* found in the LICENSE file.
4+
*/
5+
6+
/* Support code for STT temperature reporting */
7+
8+
#include "chipset.h"
9+
#include "temp_sensor/f75303.h"
10+
#include "temp_sensor/pct2075.h"
11+
#include "temp_sensor/temp_sensor.h"
12+
13+
int board_get_soc_temp_mk(int *temp_mk)
14+
{
15+
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
16+
return EC_ERROR_NOT_POWERED;
17+
18+
return f75303_get_val_mk(F75303_SENSOR_ID(DT_NODELABEL(apu_f75303)),
19+
temp_mk);
20+
}
21+
22+
int board_get_ambient_temp_mk(int *temp_mk)
23+
{
24+
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
25+
return EC_ERROR_NOT_POWERED;
26+
27+
return f75303_get_val_mk(
28+
F75303_SENSOR_ID(DT_NODELABEL(ambient_f75303)), temp_mk);
29+
}

0 commit comments

Comments
 (0)