This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 6c41549ac45b37f2c3b4f435216a6a9f480a5ab3
Author: Jerzy Kasenberg <jerzy.kasenb...@codecoup.pl>
AuthorDate: Fri Feb 26 14:47:28 2021 +0100

    hw/bus: Enable bus device in non automatic mode
    
    Function bus_dev_enable was called during bus controller initialization.
    When automatic mode with timeout was enabled but there was no activity
    on the bus, controller stayed enabled till it was used first time
    which activated timeout that would disable bus.
    
    Now when automatic mode is enabled BUS_PM = 1 and BUS_PM_MODE = AUTO
    bus is not enabled before first use to conserve power.
---
 hw/bus/src/bus.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/bus/src/bus.c b/hw/bus/src/bus.c
index ce5188a..58712df 100644
--- a/hw/bus/src/bus.c
+++ b/hw/bus/src/bus.c
@@ -256,7 +256,9 @@ bus_dev_init_func(struct os_dev *odev, void *arg)
     odev->od_handlers.od_suspend = bus_dev_suspend_func;
     odev->od_handlers.od_resume = bus_dev_resume_func;
 
-    bus_dev_enable(bdev);
+    if (!MYNEWT_VAL(BUS_PM) || MYNEWT_VAL_CHOICE(BUS_PM_MODE, MANUAL)) {
+        bus_dev_enable(bdev);
+    }
 
     return 0;
 }

Reply via email to