]> granicus.if.org Git - esp-idf/commitdiff
PM: I2S and I2C added in the Power Management docs
authorSachin Parekh <sachin.parekh@espressif.com>
Fri, 22 Feb 2019 14:18:59 +0000 (19:48 +0530)
committerbot <bot@espressif.com>
Wed, 9 Oct 2019 11:37:33 +0000 (11:37 +0000)
Signed-off-by: Sachin Parekh <sachin.parekh@espressif.com>
components/driver/i2s.c
docs/en/api-reference/system/power_management.rst

index 4cac2e8d21d6935006a4c6395268f0cf6c0cee64..4c1f834bd1b941c7f78734064e5a721f8d5f31b7 100644 (file)
@@ -1087,13 +1087,19 @@ esp_err_t i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config,
         p_i2s_obj[i2s_num]->channel_num = i2s_config->channel_format < I2S_CHANNEL_FMT_ONLY_RIGHT ? 2 : 1;
 
 #ifdef CONFIG_PM_ENABLE
-    err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "i2s_driver",
-            &p_i2s_obj[i2s_num]->pm_lock);
+    if (i2s_config->use_apll) {
+        err = esp_pm_lock_create(ESP_PM_NO_LIGHT_SLEEP, 0, "i2s_driver", &p_i2s_obj[i2s_num]->pm_lock);
+    } else {
+        err = esp_pm_lock_create(ESP_PM_APB_FREQ_MAX, 0, "i2s_driver", &p_i2s_obj[i2s_num]->pm_lock);
+    }
     if (err != ESP_OK) {
+        free(p_i2s_obj[i2s_num]);
+        p_i2s_obj[i2s_num] = NULL;
+        ESP_LOGE(I2S_TAG, "I2S pm lock error");
         return err;
     }
-
 #endif //CONFIG_PM_ENABLE
+
         //To make sure hardware is enabled before any hardware register operations.
         if (i2s_num == I2S_NUM_1) {
             periph_module_enable(PERIPH_I2S1_MODULE);
@@ -1166,7 +1172,7 @@ esp_err_t i2s_driver_uninstall(i2s_port_t i2s_num)
     }
 #ifdef CONFIG_PM_ENABLE
     if (p_i2s_obj[i2s_num]->pm_lock) {
-            esp_pm_lock_delete(p_i2s_obj[i2s_num]->pm_lock);
+        esp_pm_lock_delete(p_i2s_obj[i2s_num]->pm_lock);
     }
 #endif
 
index 9380a8d880cb0358ba3f92faa236620db3b3f783..6c7446a1d144d8089a2719de24cf593772519376 100644 (file)
@@ -108,6 +108,10 @@ Currently, the following peripheral drivers are aware of DFS and will use ``ESP_
 
 - SPI master
 
+- I2C
+
+- I2S (If APLL clock is used then it will use ``ESP_PM_NO_LIGHT_SLEEP`` lock)
+
 - SDMMC
 
 The following drivers will hold ``ESP_PM_APB_FREQ_MAX`` lock while the driver is enabled:
@@ -124,10 +128,6 @@ The following drivers will hold ``ESP_PM_APB_FREQ_MAX`` lock while the driver is
 
 The following peripheral drivers are not aware of DFS yet. Applications need to acquire/release locks when necessary:
 
-- I2C
-
-- I2S
-
 - MCPWM
 
 - PCNT