mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
1adea4ab66
Prior to this commit, we expect passing ldo_unit_t to esp_ldo driver `ldo_unit` field. And ldo_unit_t will alias the LDO unit to values starting from 0, e.g. LDO_UNIT_1 is actually value 0. With this commit, esp_ldo driver `ldo_unit` field will start with 1, which is aligned with the datasheet. So LDO_UNIT_1 is in value 1, meanwhile setting 1 to `ldo_unit` will work as well.
33 lines
865 B
C
33 lines
865 B
C
/*
|
|
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "sdkconfig.h"
|
|
#include "esp_attr.h"
|
|
#include "esp_log.h"
|
|
#include "esp_check.h"
|
|
#include "soc/soc_caps.h"
|
|
#include "hal/ldo_ll.h"
|
|
#include "esp_private/esp_ldo.h"
|
|
#include "esp_private/esp_ldo_psram.h"
|
|
|
|
void esp_ldo_vdd_psram_early_init(void)
|
|
{
|
|
if (CONFIG_ESP_VDD_PSRAM_LDO_ID != -1) {
|
|
esp_ldo_unit_init_cfg_t unit_cfg = {
|
|
.unit_id = CONFIG_ESP_VDD_PSRAM_LDO_ID,
|
|
.cfg = {
|
|
.voltage_mv = CONFIG_ESP_VDD_PSRAM_LDO_VOLTAGE_MV,
|
|
},
|
|
.flags.enable_unit = true,
|
|
.flags.shared_ldo = true,
|
|
};
|
|
esp_ldo_unit_handle_t early_unit = esp_ldo_init_unit_early(&unit_cfg);
|
|
assert(early_unit);
|
|
}
|
|
}
|