|
13 | 13 | #include "charge_state.h" |
14 | 14 | #include "charger/chg_rt9490.h" |
15 | 15 | #include "driver/charger/rt9490.h" |
| 16 | +#include "driver/charger/isl9241.h" |
16 | 17 | #include "hooks.h" |
17 | 18 | #include "peci.h" |
18 | 19 | #include "temp_sensor.h" |
@@ -320,6 +321,31 @@ __maybe_unused static int battery_get_temp(const struct temp_sensor_t *sensor, |
320 | 321 | .zephyr_info = GET_ZEPHYR_TEMP_SENSOR_BATTERY(named_id), \ |
321 | 322 | } |
322 | 323 |
|
| 324 | + |
| 325 | +#if DT_HAS_COMPAT_STATUS_OKAY(ISL9241_COMPAT) |
| 326 | +__maybe_unused static int isl9241_get_temp(const struct temp_sensor_t *sensor, |
| 327 | + int *temp_ptr) |
| 328 | +{ |
| 329 | + return isl9241_get_temperature_val(sensor->idx, temp_ptr); |
| 330 | +} |
| 331 | +#endif /* BATTERY_COMPAT */ |
| 332 | + |
| 333 | +#define GET_ZEPHYR_TEMP_SENSOR_ISL9241(named_id) \ |
| 334 | + (&(const struct zephyr_temp_sensor){ \ |
| 335 | + .read = &isl9241_get_temp, \ |
| 336 | + .thermistor = NULL, \ |
| 337 | + .update_temperature = NULL, \ |
| 338 | + FILL_POWER_GOOD(named_id) }) |
| 339 | + |
| 340 | +#define TEMP_ISL9241(named_id, sensor_id) \ |
| 341 | + [TEMP_SENSOR_ID(named_id)] = { \ |
| 342 | + .name = DT_NODE_FULL_NAME(sensor_id), \ |
| 343 | + .idx = 0, \ |
| 344 | + .type = TEMP_SENSOR_TYPE_BOARD, \ |
| 345 | + .zephyr_info = GET_ZEPHYR_TEMP_SENSOR_ISL9241(named_id), \ |
| 346 | + } |
| 347 | + |
| 348 | + |
323 | 349 | #ifdef CONFIG_PLATFORM_EC_CUSTOMIZED_DESIGN |
324 | 350 | #if DT_HAS_COMPAT_STATUS_OKAY(AMDR23M_COMPAT) |
325 | 351 | /* The function maybe unused because a temperature sensor can be added to dts |
@@ -422,6 +448,7 @@ __maybe_unused static int peci_get_temp(const struct temp_sensor_t *sensor, |
422 | 448 | CHECK_COMPAT(F75303_COMPAT, named_id, sensor_id, TEMP_F75303) \ |
423 | 449 | CHECK_COMPAT(F75397_COMPAT, named_id, sensor_id, TEMP_F75397) \ |
424 | 450 | CHECK_COMPAT(BATTERY_COMPAT, named_id, sensor_id, TEMP_BATTERY) \ |
| 451 | + CHECK_COMPAT(ISL9241_COMPAT, named_id, sensor_id, TEMP_ISL9241) \ |
425 | 452 | CHECK_COMPAT(AMDR23M_COMPAT, named_id, sensor_id, TEMP_AMDR23M) \ |
426 | 453 | CHECK_COMPAT(PECI_COMPAT, named_id, sensor_id, TEMP_PECI) |
427 | 454 |
|
|
0 commit comments