From c3f0d062a637ff7e1b47292ed500a1dfc1b3ba12 Mon Sep 17 00:00:00 2001 From: Facebook GitHub Bot Date: Tue, 31 Mar 2026 16:21:36 -0700 Subject: [PATCH] Re-sync with internal repository The internal and external repositories are out of sync. This Pull Request attempts to brings them back in sync by patching the GitHub repository. Please carefully review this patch. You must disable ShipIt for your project in order to merge this pull request. DO NOT IMPORT this pull request. Instead, merge it directly on GitHub using the MERGE BUTTON. Re-enable ShipIt after merging. fbshipit-source-id: 040320aa871279d1600d3f4fb8fa5432fbeda363 --- common/dev/emc1413.c | 22 ++++++++++++++++++++++ common/dev/include/emc1413.h | 2 ++ 2 files changed, 24 insertions(+) diff --git a/common/dev/emc1413.c b/common/dev/emc1413.c index 07b5674887..14f8ae830b 100644 --- a/common/dev/emc1413.c +++ b/common/dev/emc1413.c @@ -443,6 +443,28 @@ bool emc1413_clear_temp_status(sensor_cfg *cfg) return true; } +bool emc1413_get_temp_open_status(sensor_cfg *cfg, uint8_t *temp_status) +{ + CHECK_NULL_ARG_WITH_RETURN(cfg, false); + + I2C_MSG i2c_msg = { 0 }; + uint8_t retry = 5; + i2c_msg.bus = cfg->port; + i2c_msg.target_addr = cfg->target_addr; + i2c_msg.tx_len = 1; + i2c_msg.rx_len = 1; + i2c_msg.data[0] = EMC1413_OPEN_STATUS_REG; + + if (i2c_master_read(&i2c_msg, retry)) { + LOG_ERR("TMP[0x%x] get open status reg[0x%d] failed.", cfg->num, + EMC1413_OPEN_STATUS_REG); + return false; + } + *temp_status = i2c_msg.data[0]; + + return true; +} + uint8_t emc1413_init(sensor_cfg *cfg) { CHECK_NULL_ARG_WITH_RETURN(cfg, SENSOR_INIT_UNSPECIFIED_ERROR); diff --git a/common/dev/include/emc1413.h b/common/dev/include/emc1413.h index ef251ca457..19088fc861 100644 --- a/common/dev/include/emc1413.h +++ b/common/dev/include/emc1413.h @@ -50,6 +50,7 @@ enum EMC1413_REIGSTER_MAP { EMC1413_INTERNAL_THERM_LIMIT_REG = 0x20, EMC1413_EXTERNAL_1_THERM_LIMIT_REG = 0x19, EMC1413_EXTERNAL_2_THERM_LIMIT_REG = 0x1A, + EMC1413_OPEN_STATUS_REG = 0x1B, EMC1413_REG_MAX, }; @@ -59,5 +60,6 @@ bool emc1413_set_temp_threshold(sensor_cfg *cfg, uint8_t temp_threshold_index, uint32_t *millidegree_celsius); bool emc1413_set_comparator_mode(sensor_cfg *cfg); bool emc1413_set_therm_hysteresis(sensor_cfg *cfg, uint8_t temp_therm_hysteresis_val); +bool emc1413_get_temp_open_status(sensor_cfg *cfg, uint8_t *temp_status); #endif