Skip to content

Commit

Permalink
Merge branch 'fix/fix_tsens_retention_p4_v5.4' into 'release/v5.4'
Browse files Browse the repository at this point in the history
fix(temperature_sensor): Fix temperature sensor sleep retention on p4 (backport v5.4)

See merge request espressif/esp-idf!34979
  • Loading branch information
suda-morris committed Nov 18, 2024
2 parents 84569bc + 479f7bf commit 538b0fc
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions components/esp_driver_tsens/src/temperature_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "soc/temperature_sensor_periph.h"
#include "esp_memory_utils.h"
#include "esp_private/sar_periph_ctrl.h"
#include "esp_sleep.h"
#if TEMPERATURE_SENSOR_USE_RETENTION_LINK
#include "esp_private/sleep_retention.h"
#endif
Expand Down Expand Up @@ -137,6 +138,10 @@ esp_err_t temperature_sensor_install(const temperature_sensor_config_t *tsens_co
ESP_RETURN_ON_FALSE(tsens_config->flags.allow_pd == 0, ESP_ERR_NOT_SUPPORTED, TAG, "not able to power down in light sleep");
#endif // SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION

#if SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION && !SOC_TEMPERATURE_SENSOR_UNDER_PD_TOP_DOMAIN
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON);
#endif

#if TEMPERATURE_SENSOR_USE_RETENTION_LINK
sleep_retention_module_init_param_t init_param = {
.cbs = { .create = { .handle = s_temperature_sensor_sleep_retention_init, .arg = (void *)tsens } }
Expand Down Expand Up @@ -199,6 +204,10 @@ esp_err_t temperature_sensor_uninstall(temperature_sensor_handle_t tsens)
}
#endif // TEMPERATURE_SENSOR_USE_RETENTION_LINK

#if SOC_TEMPERATURE_SENSOR_SUPPORT_SLEEP_RETENTION && !SOC_TEMPERATURE_SENSOR_UNDER_PD_TOP_DOMAIN
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
#endif

temperature_sensor_power_release();

free(tsens);
Expand Down

0 comments on commit 538b0fc

Please sign in to comment.