-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Experimental: Automatic power domain handling for displays/RGB #1775
base: main
Are you sure you want to change the base?
Experimental: Automatic power domain handling for displays/RGB #1775
Conversation
4788427
to
ac9777a
Compare
Tested with Corne, n!ce nano v2, OLED and RGB. Can confirm when LEDs and OLEDs are off that VCC pin on OLED reads 0.0v. Also can toggle LEDs off and on without the OLED being disabled. Did find one issue. if you toggle the RGB off, it will turn itself back on the next time you wake the OLEDs from sleep. |
Just tested with a Lily58 Pro and it worked perfectly. I'm able to have my RGBs and LEDs on now, when previously only the RGBs would work. |
ac9777a
to
15b33e2
Compare
@@ -71,7 +70,7 @@ | |||
&flash0 { | |||
/* | |||
* For more information, see: | |||
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html | |||
* http: //docs.zephyrproject.org/latest/devices/dts/flash_partitions.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like you inadvertently broke this URL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. Hate when my auto formatting butchers that. Good catch. Thanks!
15b33e2
to
9c818cf
Compare
I tried installing a nice!view display on an Aurora Corne with this PR, and the display remained blank. Is the |
Yes, this still needs driver work for the |
9c818cf
to
3a999f1
Compare
4ae4c54
to
1fdd8ba
Compare
Just rebased everything, and also pushed driver changes to |
1fdd8ba
to
e6c606c
Compare
Hi @petejohanson! I can confirm that the changes work on Leeloo v2.1 and Leeloo-Micro v1.1; RGB LEDs on rgb_power, and nice!view Displays on core_power_domain. Thank you for all your work on this change! |
e6c606c
to
7ab5c80
Compare
7ab5c80
to
4c98bfe
Compare
4c98bfe
to
0a792b7
Compare
0a792b7
to
4dc2313
Compare
I've just updated this for the Zephyr 3.5 update. |
4dc2313
to
ef36248
Compare
@@ -83,7 +91,7 @@ | |||
&flash0 { | |||
/* | |||
* For more information, see: | |||
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html | |||
* http: //docs.zephyrproject.org/latest/devices/dts/flash_partitions.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* http: //docs.zephyrproject.org/latest/devices/dts/flash_partitions.html | |
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html |
}; | ||
|
||
core_power_domain: core_power_domain { | ||
// The "power-domain" compatible is needed for any PDs used for that have dynamic deps, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// The "power-domain" compatible is needed for any PDs used for that have dynamic deps, | |
// The "power-domain" compatible is needed for any PDs which have dynamic deps, |
|
||
config ZMK_EXT_POWER | ||
bool "Enable support to control external power output" | ||
default y | ||
default y if !ZMK_POWER_DOMAINS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default y if !ZMK_POWER_DOMAINS | |
default y | |
depends on !ZMK_POWER_DOMAINS && DT_HAS_ZMK_EXT_POWER_GENERIC_ENABLED |
Perhaps you know of some better way to wall this off for boards which don't have an external power cutoff? It's already a bit of a thorn in the side of STM32/RP2040.
config ZMK_RGB_UNDERGLOW_EXT_POWER | ||
bool "RGB underglow toggling also controls external power" | ||
default y | ||
depends on !ZMK_POWER_DOMAINS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends on !ZMK_POWER_DOMAINS | |
depends on ZMK_EXT_POWER |
This suggestion builds on my previous one.
Hello, i am very interested in this feature, as i have built a keyboard that can control power to RGB and OLED/display seperately using transistors. Is there an estimate when this feature will be merged? Is there anything I can do to help/support? Thanks, for the awesome work! |
Hey hey @petejohanson, Some context: Question: the settings that do not work are:
particularly CONFIG_ZMK_RGB_UNDERGLOW_EFF_START, it keeps either breath or spectrum effect instead of a constant color. it also seems that we can not set a color at the start (but that might be due to the effect fooling us :D ). The breathing also appears if we do not specify the EFF_START in the config while it should default to 0 according to the documentation link to the config repo: |
I would wager this has nothing to do with the power management changes here. As documented in https://zmk.dev/docs/config/underglow these settings don't have an effect if you changed them via |
We have investigated further. @caksoylar Regarding your remark with settings being persisted to flash: we don't have any rgb behavior on the keymap, we are just trying to modify the rgb configuration by changing the .conf/kconfig and then reflashing.
I am unclear what the conclusion is...
happy to get feedback - we are super confused :) |
The functionality for the settings reset to reset everything (and not just BLE pairings) is recent in #2072 and that branch doesn't have that.
I don't know how the code works, but I suspect settings are maybe persisted to flash on boot (and then reused on next boot) even if you don't manually use the bindings? Then that might be considered a bug, and there are already similar issues that are reported and PRs filed for. If it were me, at the end of the day I'd either look into PRs or understand the code and try to debug, or use the bindings/Kconfig to set a known state and not worry about the |
Hello again,
Edit: We just measured power-domain behavior when starting from a wireless state, i.e.: disconnecting USB cables from both halves and then resetting each half. Now the power-domain behavior is entirely as expected. Point 1 & 4 no longer apply. Have not tested point 5 yet. |
2adaeb7
to
5f1a1b2
Compare
There's some problems with underglow and oled, so I turned it off and will follow the thread zmkfirmware/zmk#1775
* Add main and sub power domains. * Default necessary Kconfig settings.
* Properly get/put the display device as needed when we start/ stop using it as part of our high level app logic.
* Properly get/put the LED strip instance when actively using the LEDs, to allow automatic power domain handling to cut power when the LEDs are not in use.
* High level ZMK_POWER_DOMAINS for the feature. * ZMK_POWER_DOMAINS_DYNAMIC_DEFAULT config setting to have various subsystems add their respective devices to the chosen `zmk,default-power-domain` on init.
* Set a chosen `zmk,default-power-domain` * Enable the relevant Kconfig settings for PDs.
* Set a chosen `zmk,default-power-domain` * Enable the relevant Kconfig settings for PDs.
5f1a1b2
to
a2c2cc6
Compare
This is the initial draft of the experimental work to add automatic power domain handling to ZMK.
Ideally, this will allow for boards/shields that contain one or more power domains to have those power domains automatically enabled whenever a device on that domain (e.g. display, or RGB LEDs) is used by a particular subsystem in ZMK.
To do this:
nice_nano_v2.dts
:zmk,default-power-domain
, and enable theZMK_POWER_DOMAINS_DYNAMIC_DEFAULT
. This will cause subsystems like our display or RGB underglow code to auto-assign the respective peripherals to that chosen PD. By doing so, the only thing shields possible need to do is set a new higher default value for thePM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM
Kconfig symbol and it will "just work' if they are built with a board that supports power domains.At runtime, the power will only be enabled when a device on that PD is requested used.
In addition, I've included the necessary driver fixes for the Zephyr
ssd1306
andls0xx
drivers to add PM hooks to re-init the device when is us turned back on.Changes
This PR encompasses:
TODO:
&ext_power
behavior with this new system. It may be a no-op, or maybe could be made to request the default/assigned power domain when toggled on, to force on VCC. Turning it "off" ould just release the request, and if no other device is active on the power domain, it would then turn of VCC.