refactor(boards): Move ZMK Uno to power domains.

* Add main and sub power domains.
* Default necessary Kconfig settings.
This commit is contained in:
Peter Johanson 2023-04-23 06:58:34 +00:00
parent e01f13f9f0
commit 3ddaac19a1
4 changed files with 49 additions and 11 deletions

View file

@ -3,6 +3,15 @@
if SHIELD_ZMK_UNO_BASE
config SHIELD_ZMK_UNO_PM
bool "ZMK Uno Automatic Power Management"
default y
select PM_DEVICE
select PM_DEVICE_POWER_DOMAIN
select PM_DEVICE_RUNTIME
select POWER_DOMAIN
select POWER_DOMAIN_GPIO
config ZMK_KEYBOARD_NAME
default "ZMK Uno"

View file

@ -0,0 +1 @@
CONFIG_ZMK_POWER_DOMAINS=y

View file

@ -63,4 +63,4 @@ encoder: &qdec0 {
wakeup-sources = <&soft_off_direct_kscan>;
};
};
};

View file

@ -9,6 +9,22 @@
&arduino_i2c {
status = "okay";
oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
label = "DISPLAY";
width = <128>;
height = <64>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <63>;
prechargep = <0x22>;
power-domain = <&core_power_domain>;
zephyr,pm-device-runtime-auto;
};
};
nice_view_spi: &arduino_spi {
@ -20,11 +36,17 @@ nice_view_spi: &arduino_spi {
// on the bus, properly picking up the first `cs-gpios` specifier.
ls0xx@0 {
reg = <0>;
power-domain = <&core_power_domain>;
zephyr,pm-device-runtime-auto;
};
led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
power-domain = <&rgb_power>;
zephyr,pm-device-runtime-auto;
/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <4000000>;
@ -35,6 +57,7 @@ nice_view_spi: &arduino_spi {
spi-zero-frame = <0x40>;
color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};
@ -42,19 +65,24 @@ nice_view_spi: &arduino_spi {
chosen {
zmk,backlight = &backlight;
zmk,underglow = &led_strip;
zephyr,display = &oled;
};
// Commented out until we add more powerful power domain support
// external_power {
// compatible = "zmk,ext-power-generic";
// init-delay-ms = <200>;
// control-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
// };
core_power_domain: core_power_domain {
compatible = "power-domain-gpio";
startup-delay-us = <2000>;
off-on-delay-us = <2000>;
enable-gpios = <&arduino_header 0 GPIO_ACTIVE_LOW>;
zephyr,pm-device-runtime-auto;
};
rgb_power {
compatible = "zmk,ext-power-generic";
init-delay-ms = <200>;
control-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
rgb_power: rgb_power {
compatible = "power-domain-gpio";
startup-delay-us = <200>;
off-on-delay-us = <2000>;
enable-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
power-domain = <&core_power_domain>;
zephyr,pm-device-runtime-auto;
};
backlight: gpioleds {