Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom Silicon Labs sleep management #5581

Merged
merged 2 commits into from
Dec 12, 2017

Conversation

stevew817
Copy link
Contributor

Description

Standardize on the mbed sleep manager by removing the sleepmodes API, and statically redirecting hal_sleep to EM1 and hal_deepsleep to EM2. This should resolve #5423, #5005 and #4082.

@0xc0170 @bulislaw

Status

READY

Migrations

If users were calling blockSleepmode and unblockSleepmode:

  • (un)blockSleepmode(EM0) and (un)blockSleepmode(EM1): don't call anymore
  • (un)blockSleepmode(EM2) and below: replace with sleep_manager_(un)lock_deep_sleep() from mbed_sleep.h

Copy link
Member

@bulislaw bulislaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I'm not 100% sure the locking is necessary as we lock the deep sleep in our driver layer. It also seem to conform with our new sleep HAL API https://github.com/ARMmbed/mbed-os/blob/feature-hal-spec-sleep/hal/sleep_api.h

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 27, 2017

Standardize on the mbed sleep manager by removing the sleepmodes API, and statically redirecting hal_sleep to EM1 and hal_deepsleep to EM2. This should resolve #5423, #5005 and #4082.

+1 for addressing those issues.

In the most cases in this patch, the changes in HAL could be removals. It should be functional either way. Is that correct?

For instance i2c hal implementation does not need to touch deepsleep here, as I2C object does. Same could be applied to spi, pwmout, serial.

@stevew817
Copy link
Contributor Author

@0xc0170 Yes, should be functional either way. I'm not sure what the preferred means is in mbed-OS, actually. Do you just always disable deepsleep when doing 'something', or do you leave it up to the driver to figure out whether the current operation is supported in deepsleep or not?

Comes to mind:

  • EFM32 has a low-energy UART which is available during deepsleep. If you disable deepsleep for all Serial operations in the CPP driver layer, then the point of having LEUART is basically moot.
  • EFM32 has an I2C peripheral which under some circumstances can operate in deepsleep

Yes, I'm making a case for leaving it up to the driver, since it is the silicon vendor who should know best what is possible during deepsleep and what is not.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 29, 2017

@0xc0170 Yes, should be functional either way. I'm not sure what the preferred means is in mbed-OS, actually. Do you just always disable deepsleep when doing 'something', or do you leave it up to the driver to figure out whether the current operation is supported in deepsleep or not?

Fair points. Only disabling deepsleep for drivers that require high speed freq clocks (very limited cases where it could potentially run, then question is what speed can be achieved, and other factors). The model was simplified. Therefore drivers like SPI, I2C, Serial lock deep sleep

Yes, I'm making a case for leaving it up to the driver, since it is the silicon vendor who should know best what is possible during deepsleep and what is not.

I haven't seen this in the code, might have overlooked. Ane example, If serial object locks deepsleep while transferring data and waiting for interrupt, and in HAL there is a check if its LPUART, then it would in the idle loop enter deepsleep anyway?

@0xc0170 0xc0170 requested a review from c1728p9 November 29, 2017 18:05
@stevew817
Copy link
Contributor Author

I haven't seen this in the code, might have overlooked.

Here, for example: https://github.com/ARMmbed/mbed-os/pull/5581/files#diff-a61dbd2ee4b7dbd1c40906a404f3629bL2119

If the LEUART is ran off of the LF clock, and its baud rate is supported by the LF clock, then deepsleep is not blocked by the driver.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 30, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Nov 30, 2017

Build : SUCCESS

Build number : 626
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5581/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Nov 30, 2017

@mbed-ci
Copy link

mbed-ci commented Nov 30, 2017

@bulislaw
Copy link
Member

@0xc0170 do you think it makes sense to push the locking to HAL implementation rather than have it in driver? So we can leverage different HW capabilities?

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 1, 2017

@stevew817 Can you please rebase, there is conflict now due to your earlier patches that got in yesterday

@0xc0170 do you think it makes sense to push the locking to HAL implementation rather than have it in driver? So we can leverage different HW capabilities?

As it is , driver provides generic locking, HAL can extend it if it provides more granular selection, as we can see within this patch.

Standardize on the mbed sleep manager by removing the sleepmodes API, and statically redirecting hal_sleep to EM1 and hal_deepsleep to EM2.
@stevew817 stevew817 force-pushed the feature/remove-custom-sleepmodes branch from 4a0b5b5 to 5dd4613 Compare December 1, 2017 11:14
@stevew817
Copy link
Contributor Author

@0xc0170 Rebased.

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 1, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Dec 1, 2017

Build : ABORTED

Build number : 639
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5581/

@stevew817
Copy link
Contributor Author

@0xc0170 Can you restart CI?

@0xc0170
Copy link
Contributor

0xc0170 commented Dec 4, 2017

/morph build

@mbed-ci
Copy link

mbed-ci commented Dec 4, 2017

Build : SUCCESS

Build number : 646
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/5581/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci
Copy link

mbed-ci commented Dec 4, 2017

@mbed-ci
Copy link

mbed-ci commented Dec 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EFM32: EM1 blocking with wait
5 participants