Skip to content

Commit

Permalink
Experimental: Automatic power domain handling for displays/RGB zmkfi…
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian König committed Oct 23, 2023
1 parent b866d40 commit c6d4d2e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
10 changes: 9 additions & 1 deletion app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,16 @@ if ZMK_RGB_UNDERGLOW
config SPI
default y


config ZMK_RGB_UNDERGLOW_DEFAULT_POWER_DOMAIN
bool "Auto-assign the RGB underglow to the default power domain"
default y
depends on ZMK_POWER_DOMAINS_DYNAMIC_DEFAULT

config ZMK_RGB_UNDERGLOW_EXT_POWER
bool "RGB underglow toggling also controls external power"
default y if !POWER_DOMAIN
default y
depends on !ZMK_POWER_DOMAINS

config ZMK_RGB_UNDERGLOW_BRT_MIN
int "RGB underglow minimum brightness in percent"
Expand Down Expand Up @@ -273,6 +280,7 @@ config ZMK_RGB_UNDERGLOW_AUTO_OFF_USB
bool "Turn off RGB underglow when USB is disconnected"
depends on USB_DEVICE_STACK


#ZMK_RGB_UNDERGLOW
endif

Expand Down
5 changes: 5 additions & 0 deletions app/src/display/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ config ZMK_DISPLAY_BLANK_ON_IDLE
bool "Blank display on idle"
default y if SSD1306

config ZMK_DISPLAY_DEFAULT_POWER_DOMAIN
bool "Auto-assign the display to the default power domain"
default y
depends on ZMK_POWER_DOMAINS_DYNAMIC_DEFAULT

if LV_USE_THEME_MONO

config ZMK_DISPLAY_INVERT
Expand Down
2 changes: 1 addition & 1 deletion app/src/display/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ void initialize_display(struct k_work *work) {
return;
}

#if IS_ENABLED(CONFIG_ZMK_POWER_DOMAINS) && DT_HAS_CHOSEN(zmk_default_power_domain)
#if IS_ENABLED(CONFIG_ZMK_DISPLAY_DEFAULT_POWER_DOMAIN) && DT_HAS_CHOSEN(zmk_default_power_domain)

pm_device_runtime_enable(display);
if (!pm_device_on_power_domain(display)) {
Expand Down
3 changes: 2 additions & 1 deletion app/src/rgb_underglow.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ static int zmk_rgb_underglow_init(const struct device *_arg) {
}
#endif

#if IS_ENABLED(CONFIG_ZMK_POWER_DOMAINS) && DT_HAS_CHOSEN(zmk_default_power_domain)
#if IS_ENABLED(CONFIG_ZMK_RGB_UNDERGLOW_DEFAULT_POWER_DOMAIN) && \
DT_HAS_CHOSEN(zmk_default_power_domain)

pm_device_runtime_enable(led_strip);
if (!pm_device_on_power_domain(led_strip)) {
Expand Down

0 comments on commit c6d4d2e

Please sign in to comment.