Skip to content

Commit 34445a7

Browse files
Josh-Tsaiamstan
authored andcommitted
fwk: dogwood: fix ectool thermalget/set broken
In this change ee99355, I added the variable in the host command struct and let the thermalget/set command be broken. This change moves the variable out from thermal_config struct and creates a new struct for temperature_filter configuration. BRANCH=fwk-dogwood-27111 BUG=https://app.clickup.com/t/86ett7kn7 TEST=the ectool thermalget/set will not return error message Signed-off-by: Josh Tsai <Josh_Tsai@compal.com>
1 parent 2dd7da7 commit 34445a7

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

include/ec_commands.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3778,12 +3778,6 @@ struct ec_thermal_config {
37783778
uint32_t temp_host_release[EC_TEMP_THRESH_COUNT]; /* release levels */
37793779
uint32_t temp_fan_off; /* no active cooling needed */
37803780
uint32_t temp_fan_max; /* max active cooling needed */
3781-
/**
3782-
* (bug: 86ett7kn7)
3783-
* TODO: should not add the new variable in host command struct
3784-
* without cmd version
3785-
*/
3786-
int32_t coefficients[6]; /* coefficients to calculate the virtual temperature */
37873781
} __ec_align4;
37883782

37893783
/* Version 1 - get config for one sensor. */

zephyr/shim/src/temperature_filter.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,29 @@
66
#include "hooks.h"
77
#include "math_util.h"
88
#include "temperature_filter.h"
9+
#include "temp_sensor.h"
910
#include "thermal.h"
1011
#include "util.h"
1112

1213
#define Q_SCALE 14
1314
/* scale input up to improve filter performance */
1415
#define IN_SCALE 7
1516

17+
struct ec_temperature_filter_config {
18+
int32_t coefficients[6]; /* coefficients to calculate the virtual temperature */
19+
} __ec_align4;
20+
21+
#define TEMP_FILTER_CONFIG(node_id) \
22+
[TEMP_SENSOR_ID(node_id)] = { \
23+
.coefficients = DT_PROP_OR(node_id, coefficients, {0}), \
24+
}
25+
26+
struct ec_temperature_filter_config temp_filter_params[] = {
27+
#if DT_HAS_COMPAT_STATUS_OKAY(TEMP_SENSORS_COMPAT)
28+
DT_FOREACH_CHILD_SEP(TEMP_SENSORS_NODEID, TEMP_FILTER_CONFIG, (,))
29+
#endif /* DT_HAS_COMPAT_STATUS_OKAY(TEMP_SENSORS_COMPAT) */
30+
};
31+
1632
struct temperature_filter_t {
1733
int32_t state[4];
1834
int32_t coeff[6];
@@ -55,7 +71,7 @@ bool temperature_filter_is_support(enum temp_sensor_id id)
5571
int zero[6] = {0};
5672
int rv;
5773

58-
rv = memcmp(thermal_params[id].coefficients, zero, 6);
74+
rv = memcmp(temp_filter_params[id].coefficients, zero, 6);
5975

6076
/* No coefficients (zero arrays), return false */
6177
return !!rv;
@@ -76,7 +92,7 @@ static void temperature_filter_init(void)
7692
{
7793
for (int temp_id = 0; temp_id < TEMP_SENSOR_COUNT; temp_id++) {
7894
if (temperature_filter_is_support(temp_id))
79-
memcpy(filters[temp_id].coeff, thermal_params[temp_id].coefficients,
95+
memcpy(filters[temp_id].coeff, temp_filter_params[temp_id].coefficients,
8096
sizeof(filters[temp_id].coeff));
8197
}
8298
}

zephyr/shim/src/thermal.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
.temp_fan_max = C_TO_K(DT_PROP_OR(node_id, \
4444
temp_fan_max, \
4545
-273)), \
46-
.coefficients = DT_PROP_OR(node_id, coefficients, {0}), \
4746
}
4847

4948
struct ec_thermal_config thermal_params[] = {

0 commit comments

Comments
 (0)