Skip to content

Commit 05c483f

Browse files
Zick WeiCommit Bot
authored andcommitted
nipperkin: add regulator thermistor
This patch add 5v regulator thermistor. BUG=b:193395015 BRANCH=none TEST=verify 5v regulator thermistor can be read. Signed-off-by: Zick Wei <[email protected]> Change-Id: I1fc0cd6b5341f18100ac80e24cb884d53df7e4a0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3132555 Reviewed-by: Devin Lu <[email protected]> Reviewed-by: Rob Barnes <[email protected]> Commit-Queue: Rob Barnes <[email protected]>
1 parent b90e958 commit 05c483f

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

board/nipperkin/board.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ int board_get_ambient_temp_mk(int *temp_mk)
171171

172172
/* ADC Channels */
173173
const struct adc_t adc_channels[] = {
174-
[ADC_TEMP_SENSOR_SOC] = {
175-
.name = "SOC",
174+
[ADC_TEMP_SENSOR_MEMORY] = {
175+
.name = "MEMORY",
176176
.input_ch = NPCX_ADC_CH0,
177177
.factor_mul = ADC_MAX_VOLT,
178178
.factor_div = ADC_READ_MAX + 1,
@@ -185,8 +185,8 @@ const struct adc_t adc_channels[] = {
185185
.factor_div = ADC_READ_MAX + 1,
186186
.shift = 0,
187187
},
188-
[ADC_TEMP_SENSOR_MEMORY] = {
189-
.name = "MEMORY",
188+
[ADC_TEMP_SENSOR_5V_REGULATOR] = {
189+
.name = "5V_REGULATOR",
190190
.input_ch = NPCX_ADC_CH2,
191191
.factor_mul = ADC_MAX_VOLT,
192192
.factor_div = ADC_READ_MAX + 1,
@@ -210,7 +210,7 @@ const struct adc_t adc_channels[] = {
210210
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
211211

212212
/* Temp Sensors */
213-
static int board_get_memory_temp(int, int *);
213+
static int board_get_temp(int, int *);
214214

215215
const struct tmp112_sensor_t tmp112_sensors[] = {
216216
{ I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS0 },
@@ -234,9 +234,15 @@ const struct temp_sensor_t temp_sensors[] = {
234234
[TEMP_SENSOR_MEMORY] = {
235235
.name = "Memory",
236236
.type = TEMP_SENSOR_TYPE_BOARD,
237-
.read = board_get_memory_temp,
237+
.read = board_get_temp,
238238
.idx = ADC_TEMP_SENSOR_MEMORY,
239239
},
240+
[TEMP_SENSOR_5V_REGULATOR] = {
241+
.name = "5V_REGULATOR",
242+
.type = TEMP_SENSOR_TYPE_BOARD,
243+
.read = board_get_temp,
244+
.idx = ADC_TEMP_SENSOR_5V_REGULATOR,
245+
},
240246
[TEMP_SENSOR_CPU] = {
241247
.name = "CPU",
242248
.type = TEMP_SENSOR_TYPE_CPU,
@@ -309,7 +315,7 @@ struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT] = {
309315
};
310316
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
311317

312-
static int board_get_memory_temp(int idx, int *temp_k)
318+
static int board_get_temp(int idx, int *temp_k)
313319
{
314320
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
315321
return EC_ERROR_NOT_POWERED;

board/nipperkin/board.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ enum battery_type {
4747

4848
/* ADC Channels */
4949
enum adc_channel {
50-
ADC_TEMP_SENSOR_SOC = 0,
50+
ADC_TEMP_SENSOR_MEMORY = 0,
5151
ADC_TEMP_SENSOR_CHARGER,
52-
ADC_TEMP_SENSOR_MEMORY,
52+
ADC_TEMP_SENSOR_5V_REGULATOR,
5353
ADC_CORE_IMON1,
5454
ADC_SOC_IMON2,
5555
ADC_CH_COUNT
@@ -60,6 +60,7 @@ enum temp_sensor_id {
6060
TEMP_SENSOR_SOC = 0,
6161
TEMP_SENSOR_CHARGER,
6262
TEMP_SENSOR_MEMORY,
63+
TEMP_SENSOR_5V_REGULATOR,
6364
TEMP_SENSOR_CPU,
6465
TEMP_SENSOR_AMBIENT,
6566
TEMP_SENSOR_COUNT

0 commit comments

Comments
 (0)